Printing Ergo explanations

30 views
Skip to first unread message

Robert Goldman

unread,
Jun 4, 2026, 2:42:08 PM (10 days ago) Jun 4
to ErgoAI and XSB Users Forum
Is there any way to get more readable presentations of explanation terms, like the ones we see on p. 353 of the manual, without having to configure TextIt or ErgoText?

I mean just print a term with reasonable indentation when it breaks across lines, nothing more than that.

When I get an explanation, it just looks like this, which is pretty indigestible:

explanation(true(${permission(strong)(taskForceAlpha,mission(TFACheckpoint),tFAPot2)@main},'it is a top query',ruleid(48,'deontics.ergo',main)),[explanation(true(${candidate(permission(strong)(taskForceAlpha,mission(TFACheckpoint),tFAPot2))@main},null,ruleid(unrestrictedTFAMission(199),'caveats.ergo',main)),[explanation(true(${tFAPot2:CheckpointOp@main},'it is a base fact',ruleid(null,null,null)),[]), explanation(true(${notInactive(tFAPot2)@main},null,ruleid(84,'world_change.ergo',main)),[explanation(true(${world_tag(intel1)@main},'it is a base fact',ruleid(null,null,null)),[]), explanation(true(${tFAPot2[state->Potential]@main},'it is a base fact',ruleid(null,null,null)),[]), explanation(true(${tFAPot2[world_tag->intel1]@main},'it is a base fact',ruleid(null,null,null)),[]), explanation(true(Potential != Inactive,null,ruleid(null,null,null)),[])]), explanation(true(${tFAPot2[agent->taskForceAlpha]@main},'it is a base fact',ruleid(null,null,null)),[]), explanation(true(${unrestrictedTFAMission(CheckpointOp,mission(TFACheckpoint))@main},'it is a base fact',ruleid(null,null,null)),[])])])

Using the \show library doesn't make it much better:

'explanation(true(${permission(strong)(taskForceAlpha,mission(TFACheckpoint),tFAPot2)@main},it is a top query,ruleid(48,deontics.ergo,main)),[explanation(true(${candidate(permission(strong)(taskForceAlpha,mission(TFACheckpoint),tFAPot2))@main},null,ruleid(unrestrictedTFAMission(199),caveats.ergo,main)),[explanation(true(${tFAPot2:CheckpointOp@main},it is a base fact,ruleid(null,null,null)),[]), explanation(true(${notInactive(tFAPot2)@main},null,ruleid(84,world_change.ergo,main)),[explanation(true(${world_tag(intel1)@main},it is a base fact,ruleid(null,null,null)),[]), explanation(true(${tFAPot2[state->Potential]@main},it is a base fact,ruleid(null,null,null)),[]), explanation(true(${tFAPot2[world_tag->intel1]@main},it is a base fact,ruleid(null,null,null)),[]), explanation(true(Potential != Inactive,null,ruleid(null,null,null)),[])]), explanation(true(${tFAPot2[agent->taskForceAlpha]@main},it is a base fact,ruleid(null,null,null)),[]), explanation(true(${unrestrictedTFAMission(CheckpointOp,mission(TFACheckpoint))@main},it is a base fact,ruleid(null,null,null)),[])])])'

Thanks for any advice!

Michael Kifer

unread,
Jun 4, 2026, 4:11:49 PM (10 days ago) Jun 4
to ErgoAI-X...@coherentknowledge.com

It is not supposed to be digestible by humans.  It is a HiLog term that encodes proof trees. As such, it is digestible for machines.  The structure of that term is described in the manual and we provide a method for converting it to Json.  The plan is to provide a standalone (most likely Javascript) widget that would enable convenient browsing of these trees by humans and will be accessible from Ergo programmatically.

Currently the Ergo studio has  a graphical widget, but it is built into the studio, is non-programmable,  is non-programmable and unwieldy.

--
You received this message because you are subscribed to the Google Groups "ErgoAI and XSB Users Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ErgoAI-XSB-for...@coherentknowledge.com.
To view this discussion visit https://groups.google.com/a/coherentknowledge.com/d/msgid/ErgoAI-XSB-forum/3b63838d-d4a8-4c7c-aa84-4728abed6022n%40coherentknowledge.com.

Miguel Calejo

unread,
Jun 4, 2026, 5:43:57 PM (10 days ago) Jun 4
to Robert Goldman, ErgoAI and XSB Users Forum
Here's one :-) Just a first stab, incomplete



 
Miguel Calejo
Director
InterProlog Consulting
Madan Parque de Ciência
Rua dos Inventores, 2825-182 Caparica, Portugal
http://interprolog.com
Screenshot 2026-06-04 at 21.39.22.png
On 4 Jun 2026, at 21:44, Miguel Calejo <m...@interprolog.com> wrote:

Hi Michael,

I hope you're well. 

Given the situation you describe wrt explanations, you might want to vibe code a simple renderer for non-Studio users... here's a first stab, for old time Studio''s sake :-)


I opted to answer to you rather than Robert in case you want to refine it a bit, as my Ergo is beyond rusty. The single (...) prompt I used with Claude (Opus 4.8)  is below

Cheers
Miguel

---- Prompt:

I need a Javascript-based displayer of proof explanations for https://github.com/ErgoAI , given to it as HiLog terms, for example:

explanation(true(${permission(strong)(taskForceAlpha,mission(TFACheckpoint),tFAPot2)@main},'it is a top query',ruleid(48,'deontics.ergo',main)),[explanation(true(${candidate(permission(strong)(taskForceAlpha,mission(TFACheckpoint),tFAPot2))@main},null,ruleid(unrestrictedTFAMission(199),'caveats.ergo',main)),[explanation(true(${tFAPot2:CheckpointOp@main},'it is a base fact',ruleid(null,null,null)),[]), explanation(true(${notInactive(tFAPot2)@main},null,ruleid(84,'world_change.ergo',main)),[explanation(true(${world_tag(intel1)@main},'it is a base fact',ruleid(null,null,null)),[]), explanation(true(${tFAPot2[state->Potential]@main},'it is a base fact',ruleid(null,null,null)),[]), explanation(true(${tFAPot2[world_tag->intel1]@main},'it is a base fact',ruleid(null,null,null)),[]), explanation(true(Potential != Inactive,null,ruleid(null,null,null)),[])]), explanation(true(${tFAPot2[agent->taskForceAlpha]@main},'it is a base fact',ruleid(null,null,null)),[]), explanation(true(${unrestrictedTFAMission(CheckpointOp,mission(TFACheckpoint))@main},'it is a base fact',ruleid(null,null,null)),[])])])

For starters, use simple HTML indented list items


---- How it looks with Robert's explanation:

Screenshot 2026-06-04 at 21.39.22.png


Theresa Swift

unread,
Jun 4, 2026, 7:56:12 PM (10 days ago) Jun 4
to ErgoAI and XSB Users Forum
A great answer to Robert’s question from Miguel Calejo!

I’m forwarding it to the list since time is of the essence to Robert and any other CODORD people earring this

Miguel. Is that code you can export for Robert and others to use?  (Even if rough)

And thanks to Miguel and Michael

Miguel Calejo

unread,
Jun 5, 2026, 2:27:42 AM (10 days ago) Jun 5
to Theresa Swift, ErgoAI and XSB Users Forum
Sure, just open the link below, view the HTML source in your browser and save it locally; it’s a self contained HTML+Javascript file, no server required

Cheers,
Miguel

On 5 Jun 2026, at 00:56, Theresa Swift <theres...@gmail.com> wrote:



Robert Goldman

unread,
Jun 5, 2026, 5:14:19 PM (9 days ago) Jun 5
to ErgoAI and XSB Users Forum, mc, ErgoAI and XSB Users Forum
I found that I could not simply download the HTML source and run it.  When I go to that web site, it seems that there's a lot of context that comes from hosting at claude.ai.  When I downloaded the HTML file, I found it to be full of references to material hosted at anthropic.com, and it seemed like it might rely for correct functioning on your Claude license.  Is there something you need to do to export the file in such a way as to make it freestanding?

Miguel Calejo

unread,
Jun 5, 2026, 5:30:42 PM (9 days ago) Jun 5
to Robert Goldman, ErgoAI and XSB Users Forum
No, it's self-contained other than a couple links to Google fonts; but I don't know in which context you tried to download it, perhaps that has injected noise into the process.

The HTML page (with Javascript code) is in the enclosed zip, just save and expand it into your drive and open directly with Chrome or Safari other browser. 

M

ergo-proof-explainer.html.zip

Robert Goldman

unread,
Jun 5, 2026, 5:59:57 PM (9 days ago) Jun 5
to ErgoAI and XSB Users Forum, mc, ErgoAI and XSB Users Forum
Yes, thanks!  That works much better.  When I got to the page through claude.ai it looks like the server added a whole lot of gunk (technical term!) to the HTML source.  The archive is clean.

Robert Goldman

unread,
Jun 5, 2026, 7:20:09 PM (9 days ago) Jun 5
to ErgoAI and XSB Users Forum, Robert Goldman, ErgoAI and XSB Users Forum
If I understand correctly, it's intended that we use TextIt to generate more human-readable (as opposed to computer scientist-readable ;-) ) explanations.  Are there any examples of this?  I suppose maybe I should look into the source code for the studio?
Reply all
Reply to author
Forward
0 new messages