In the file jtpinterface.jar, we make available an extension for NetLogo which interfaces to the JTP reasoner. It may require NetLogo with Java 7 (but should work with NetLogo with bundled Java 6 – if there are problems, use NetLogo with no bundled Java VM instead). All software is copyright © Anthony H. Dekker, 2013, but the current version may be freely used (under the GNU GPL) as long as it is properly attributed.

Place the jtpinterface.jar file and the **jtp.jar** and **antlr.jar** files from JTP in a folder called “jtpinterface” in your NetLogo extensions folder, and put `extensions [jtpinterface]`

at the top of your NetLogo code.
The extension currently provides the following functions:

`jtpinterface:about`

— reports software version number

`jtpinterface:prove assumptions query`

— calls the reasoner, attempting to prove `query`

using `assumptions`

Queries are strings in KIF format, and assumptions are lists of such strings. The result is either
`[false]`

(if proving fails) or a list with `true`

followed by variable/value pairs (if proving succeeds). For example:

`jtpinterface:prove ["(age fred 42.5)" "(age peter 50)"] "(age fred ?x)"`

returns `[true ["x" 42.5]]`

`jtpinterface:prove ["(age fred 42.5)" "(age peter 50)"] "(age ?x ?y)"`

returns `[true ["y" 50] ["x" "peter"]]`

`jtpinterface:prove ["(forall ?x (age fred ?x))"] "(age ?y 42)"`

returns `[true ["y" "fred"]]`

`jtpinterface:prove ["(forall ?x (age fred ?x))"] "(age fred 42)"`

returns `[true]`

`jtpinterface:prove ["(age fred 42)"] "(age fred 43)"`

returns `[false]`

*This page maintained by Anthony Dekker: last updated 05 Mar 2013.*