ASPeRiX
The program
ASPeRiX is an implementation of the stable model semantics for normal logic programs.
The main specifity of our system is to realize a forward chaining of first
order rules that are grounded on the fly. So, unlike others available ASP
systems, ASPeRiX does not need a pregrounding processing.
Language
ASPeRiX 0.2 is able to deal directly with any normal logic
program containing rules with variables and function symbols.
The only syntactic restriction is the
safety of rules, ie:
all variables occurring in the rule
must also occur in its positive body (cf below for details).
- Rule
- head., head :- body., or :- body. where head is a predicate atom and body a list of literals separated by commas.
A rule is safe if each variable that appears in the rule appears also in a predicate atom or on the left side of an assignment atom of the positive body of the rule.
- Literal
- a where a is an atom or not a where a is a predicate atom.
- Atom
- a predicate atom, a relational atom or an assignment atom.
- Predicate atom
- a predicate symbol (symbolic constant), optionally followed by a parenthesized list of terms. Additionally,
a rule head can be a predicate symbol followed by a parenthesized list of range terms.
- Relational atom
- comparison between two arithmetic expressions or two symbolic constants. Operators are ==, !=, <, <=, >, >=.
Equality and inequality operators can also be used for functional terms. Relational atoms can only occur in the positive body of a rule
- Assignment atom
- variable = term. Assignment atoms can only occur in the positive body of a rule
- Term
- a symbolic constant, a numeric constant, an arithmetic expression, a functional term or a variable
- Symbolic Constant
- a string of letters, digits and underscores starting with a lower case letter, or a sequence of characters enclosed within double quotes
- Numeric constant
- an integer in [-k .. k] interval. Maximum integer constant is given by -N option (1024 by default)
- Functional term
- a functor (symbolic constant) followed by a parenthesized list of terms. Maximum nesting level is given by -F option (16 by default)
- Variable
- a string of letters, digits and underscores starting with an upper case letter
- Range term
- has form t1 .. t2 where t1 and t2 are numeric constants or variables
- Arithmetic expression
- built with numeric constants, variables, binary operators +, -, * , / and mod, unary operator abs, and parenthesis. An arithmetic expression must be grounded when evaluated.
Directives
- show / hide
- these directives allow to hide some predicates when printing answer sets of a program.
By default, all predicates are shown and a predicate named p with arity k
can be hidden by #hide p/k..
The directive #hide. without arguments hides all predicates,
and the #show p/k. directive can then be used to tell what atoms have to be printed.
Usage
Answer set(s) of a program
prog is computed as follows :
$ asperix n prog
where
n is the (maximum) number of answer sets to be computed (zero indicates all). If
n is missing, only one answer set is computed.
Option
-N k fixes the interval of integer constant accepted as
[-k..k]
Option
-F k fixes
k as the maximum nesting level accepted for functional terms
Examples
- Birds flying or not
- a stratified program birds.aspx
- Towers of hanoi
- an example with lists issued from DLV-complex home page.
hanoi.aspx is the original DLV-complex program adapted for ASPeRiX (disjunctions and short notation for lists removed).
hanoiBIS.aspx is an improvement of the preceding.
- Generic system for computing recursive arithmetic function
- an example with arithmetic and functions generic.aspx
Download
The current implementation is a prototype version numbered 0.2.4
ASPeRiX0.2 source package.
(ASPeRiX is distributed under the
GNU Public Licence
and is implemented by
Claire Lefèvre
and
Pascal Nicolas and
Stéphane Ngoma)
Version history
- ASPeRiX 0.2.4 (april, 2010)
- bug fixes
- ASPeRiX 0.2.3 (november, 2009)
- special version with 2 operators on lists : @ (member) and !@ (not member)
- ASPeRiX 0.2.2 (june, 2009)
- bug fix (thanks to Alessandro Dal Palu' who reported it)
- ASPeRiX 0.2.1 (june, 2009)
- bug fixes
- ASPeRiX 0.2 (april, 2009)
- functional terms added, arithmetic expressions accepted anywhere in a rule
- ASPeRiX 0.1 (june, 2008)
- first prototype version