===================================
Syntax for ground logic programs
-- a proposal
Gayathri Namasivayam
Lengning Liu
Miroslaw Truszczynski
===================================
We propose a standard syntax to write a ground logic program. The syntax
is quite similar to that of the high-level lparse programs, except that
all atoms are grounded.
A ground program is a finite collection of ground rules.
* Each rule is in one line and ended by "."
* All ground atoms are of the form
v*
where ** is a positive integer. If the program uses n atoms, then
v1, ..., vn must appear at least once in the program (no gap in atom
naming)
* A literal is either an atom v** or its negation -v**
* A constraint atom is either a c-atom or a w-atom
* A c-atom has the form
* { l_1, ..., l_k }
where and are two non-negative integers and l_i's are literals
* A w-atom has the form
{ l_1 = w_1, ..., l_k = w_k }
where , , w_1, ..., w_k are non-negative integers and l_i's are
literals
* A rule is either a fact or a program rule
* A fact has the following form:
.
* A program rule has the following form:
:-
* is either a literal or a constraint atom
* is of the form
l_1, ..., l_m, not l_{m+1}, ..., not l_{n}, C_1, ..., C_k
where l_i's are literals and C_j's are constraint atoms
* Comments are lines starting with "%".
* Spaces are allowed around literals, "not", and punctuations.
An example of a ground logic program is given as follows:
% a choice rule
0 { v1 } 1 .
% two normal rules
-v2 :- not v3 , v1 .
v3 :- not -v2 , v1 .
% a cardinality rule
1 { v1 , v2 , v3 } 1 :- 1 { v1 , v2 , v3 } 3 .
% a weight rule
:- 14 { v1 = 10 , -v2 = 3 , v3 = 4 } .