Introspection

24 views
Skip to first unread message

Chris

unread,
Dec 17, 2009, 3:16:42 PM12/17/09
to PyKE
Does Pyke have any feature to introspect rules, and find which rules
lead to a particular deduction?

For example, given an arbitrarily large krb file, could I could Pyke
to find all rules that contain a particular pattern? Or would regex be
better suited for this?

Also, when using prove_* to find deduced facts, is there any way to
find which forward-chaining rules lead to that proof?

Regards,
Chris

Bruce Frederiksen

unread,
Dec 17, 2009, 5:47:58 PM12/17/09
to py...@googlegroups.com
There are three ways to see what's going on:

1.  Use the trace facility (this only works with backward-chaining rules).
2.  Use the krb_traceback facility to get a traceback of the backward-chaining rules that produced a proof.  (This would only work if you used prove_n or prove where you could get the traceback inside the for loop on the prove call).
3.  Add python print statements to the rules.

Yeah, to find all of the rules with a certain pattern, use a file search tool.

-Bruce


--

You received this message because you are subscribed to the Google Groups "PyKE" group.
To post to this group, send email to py...@googlegroups.com.
To unsubscribe from this group, send email to pyke+uns...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/pyke?hl=en.



Chris Spencer

unread,
Dec 17, 2009, 5:53:56 PM12/17/09
to py...@googlegroups.com
Right, I was aware of the trace utilities for backward-chaining rules,
but I'm interested in programmatically introspecting forward-chaining
rules. I don't see how print statements would help. Searching through
megs of print statement logs doesn't really seems viable.

Chris Spencer

unread,
Dec 17, 2009, 6:46:25 PM12/17/09
to py...@googlegroups.com
Just to clarify, I have an app with lots of complex rules, which
deduces hundreds of facts. Often, I see a deduced fact and wonder what
exact path was used to derive it. Essentially, I want to ask Pyke
"why?" but I don't see how I can.
Reply all
Reply to author
Forward
0 new messages