Syntax and Semantics of Fact Files for IP2 1.0 and 2.0


The fact file contains all the typed objects of the domain as well as the initial and the goal state. It must be a text file of the form (name).fct . As in the .ops file, you need to put different problems into different files.

Here's an EBNF for the .fct file:

  FCT_FILE       ::=  TYPE_LIST
"initial:" CONST_LIT_LIST ";"
"goal:" CONST_LIT_LIST ";"
TYPE_LIST ::= TYPE | TYPE TYPE_LIST
TYPE ::= NAME ":" CONSTANT_LIST ";"
CONSTANT_LIST ::= NAME | NAME SPC CONSTANT_LIST
CONST_LIT_LIST ::= CONST_LIT | CONST_LIT CONST_LIT_LIST
CONST_LIT ::= NAME "(" { NAME } ")"
NAME ::= small_letter { small_letter | "-" | digit }
SPC ::= " " { " " | newline }
TYPE stands for a list of constants of the same type, for example

location: freiburg melbourne cairo;

CONST_LIT_LIST stands for a list of ground atoms (facts): on(b1 table) arm-empty()

An example for a legal IP2 fact file is:

  location: l1 l2 l3 home;
  object: o1 o2 o3;

  initial: is-at(home) at(o1 l1) at(o2 l2) at(o3 l3) 
           not-in(o1) not-in(o2) not-in(o3);

  goal: is-at(home)  at(o1 home) at(o2 home) at(o3 home); 
NOTE:
This is the .fct file used for Russell's flat tire domain:

object: wrench jack pump wheel1 wheel2 nuts; 
hub: the-hub; 
nut: nuts;
container: boot;
wheel: wheel1 wheel2; 

initial: 

intact(wheel2) in(jack boot) in(pump boot) have(wheel2) 
in(wrench boot) on(wheel1 the-hub) on-ground(the-hub) tight(nuts the-hub)
not-inflated(wheel2) unlocked(boot) fastened(the-hub) closed(boot);

goal:
 
on(wheel2 the-hub) inflated(wheel2)
in(wheel1 boot)
in(wrench boot) in(jack boot) in(pump boot) 
tight(nuts the-hub) 
closed(boot);

Note that wheel1 and wheel2 have two different types; this makes it possible to treat them as objects when applying the put-in, put-out ( of boot ) operators and to distinguish them from other objects when applying the put-on-wheel or remove-wheel operators.

As in .ops files, space and newlines can be inserted wherever you like, except, of course, in names.
comments go from "#" to newline.

Important: Do not use Tabulator signs, they cause syntax errors.