AILog Code
Here are some runnable examples for the book Artificial Intelligence: foundations of computational agents by David Poole and Alan Mackworth, Cambridge University Press, 2010 (forthcoming). All code is copyright by Poole and Mackworth 2009 and released under the GPL.
This code runs in AILog2, a representation and reasoning system for definite clauses, with declarative debugging tools, assumbles, probabilities, etc.
Either save the code to a file and load it into AILog, or cut and paste
each clause and tell
it to AILog.
Chapter 5
- elect_prop.ail electrical wiring example; Example 5.5 from Section 5.2
- elect_ask.ail electrical wiring example with askables; Example 5.10 from Section 5.3.2
- elect_bug.ail the buggy electrical wiring knowledge base from Example 5.14 in Section 5.3.4
- elect_bug2.ail the buggy electrical wiring example from Exercise 5.6
- elect_bug3.ail a buggy electrical wiring
example, which fails to prove
lit_l2
, but should succeed - elect_design.ail electrical wiring example with switch positions assumable (asking a query gives ways to make it true) and elect_design_all.ail has positions and statuses assumable.
- elect_cbd.ail electrical wiring example for consistency-based diagnosis; Example 5.20 in Section 5.4.3
- elect_naf.ail electrical wiring example with negation as failure; Example 5.26 in Section 5.5
- beach.ail default reasoning about swimming at beaches; Example 5.27 in Section 5.5.1
- bronchitis.ail diagnosis Example 5.30 in Section 5.6
- elect_abd.ail electrical wiring example with abduction; Example 5.31 in Section 5.6
- plumbing.ail plumbing domain from Exercise 5.2
Chapter 12
- elect_relational.ail electrical wiring example from Section 12.3.2
- west.ail a knowledge base about rooms from Figure 12.2 in Section 12.3.3
- before.ail the
before
relation of Example 12.26 in Section 12.5 - trees.ail the tree code of Example 12.27 in Section 12.5
- cfg_simple.ail a simple context free grammar and associated dictionary from Figures 12.6 and 12.7 in Section 12.5
- trans.ail generates canned English; from Figure 12.8 in Section 12.6.4
- nl_numbera.ail a simple grammar that enforces number agreement and builds a parse tree; from Figure 12.9 in Section 12.6.5
- nl_interface.ail a simple natural language interface to a database; from Figures 12.10 and 12.11 in Section 12.6.6
Chapter 13
- prove.ail a vanilla meta-interpreter (Figure 13.9), which can be used with elect_base.ail a base-level representation of the electrical domain (Figure 13.10).
- prove2.ail a vanilla meta-interpreter, with disjunctions and built-ins; Figure 13.11.
- bprove.ail a meta-interpreter for depth-bounded search; Figure 13.12.
- hprove.ail a meta-interpreter that builds a proof tree; Figure 13.13.
- dprove.ail a meta-interpreter that delays goals; Figure 13.16. This can be used with elect_delay.ail a base-level representation of the electrical domain, with ok delayed.
Chapter 14
- delrob_sitc.ail the delivery robot in the situation calculus, as described in Section 14.1.1.
- leaving.ail ICL representation of the belief network of Figure 6.1 and Example 6.10; this representation is from Example 14.19 in Section 14.3.
- movie.ailog ICL representation of the belief network of Figure 6.1 and Example 6.10; this representation is from Example 14.19 in Section 14.3.
- movie.ailog ICL representation to predict grades of students on courses they haven't taken.
- addition.ail ICL representation of probabilistic diagnosis of students who makes addition errors; Example 14.20 in Section 14.3.