Clingo{f} Home Page


Clingo{f} is an inference engine for language ASP{f}. It is derived from clingo 2.0.2.
The ASP{f} language allows for a direct representation of non-Herbrand functions in ASP. For more details, refer to [bal12,bal12b].


The latest version is 0.4.4.

Installation and Usage

To install Clingo{f}
  1. Ensure that cmake is installed on your computer and accessible from command-line without specifying any path.
  2. Ensure that re2c is installed on your computer and accessible from command-line without specifying any path. The latest version of re2c can be found here.
  3. Download clingo{f} using the links below.
  4. If you with to compile clingo{f} from sources:

To run clingo{f}
Usage: clingof [<number of models; default: 1>] [[<input file 1>] [<input file 2>...]]
E.g.: clingof 0 instance1 main_program
Finds all the answer sets of the program consisting of files instance1 and main_program.
Command clingof -v shows the complete list of command-line options.
Some clingo-specific options are not supported by clingof and will be removed soon.


Syntax
Syntax restrictions:
  1. Variables occurring in dependent t-literals must satisfy the same safety requirements as those occurring in literals under default negation.
    For example, the following programs are syntactically correct:
    P1:
    #nherb.
    p(X,Y) :- l(X)#=Y.
    
    P2:
    #nherb.
    l(a)#=3.
    p(X,Y) :- l(X)#=Y.
    
    P3:
    #nherb.
    d(a;b).
    l(a)#=3.
    p(X) :- d(X), l(X)#!=2.
    
    while these ones are not:
    P4:
    #nherb.
    l(a)#=3.
    p(X) :- l(X)#!=2.
    
    P5:
    #nherb.
    l(a)#=3.
    p(X,Y) :- l(X)#!=Y.
    


Example of use
Let ex1.aspf be the program:
#nherb.

dom(1..10).

x(0) #= 1.

x(1) #= V :-
        dom(V),
        x(0) #= V,
        not x(1) #!= x(0).

x(1) #= 2 :- change(x,0).

change(x,0).
Executing clingof 0 ex1.aspf produces:
Warning: #!=/2 is never defined.
Answer: 1
dom(0) dom(1) dom(2) dom(3) dom(4) dom(5) dom(6) dom(7) dom(8) dom(9) dom(10) change(x,0) x(0)#=1 x(1)#=2 

Models      : 1     
Time        : 0.000 

(The warning about #!=/2 not being defined should be ignored.)
Let ex2.aspf be the program:
#nherb.

cod(a;b).
dom(1..2).

0{ f(X)#=V : dom(V) }1 :- cod(X).

num(N) :- N=count{ f(X)#=V : dom(V) : cod(X) }.
num(V,N) :- dom(V), N=count{ f(X)#=V : cod(X) }.
tot(S) :- S=sum[ f(X)#=V : dom(V) : cod(X) = V ].


p #= 1 :- not p #!= 1.
p #= 2 :- f(a) #= f(b).
Executing clingof 0 ex2.aspf produces:
Warning: #!=/2 is never defined.
Answer: 1
cod(a) dom(1) dom(2) cod(b) num(2) num(1,1) num(2,1) tot(3) p#=1 f(a)#=1 f(b)#=2 
Answer: 2
cod(a) dom(1) dom(2) cod(b) num(1) num(1,1) num(2,0) tot(1) p#=1 f(a)#=1 
Answer: 3
cod(a) dom(1) dom(2) cod(b) num(2) num(1,2) num(2,0) tot(2) p#=2 f(a)#=1 f(b)#=1 
Answer: 4
cod(a) dom(1) dom(2) cod(b) num(1) num(1,1) num(2,0) tot(1) p#=1 f(b)#=1 
Answer: 5
cod(a) dom(1) dom(2) cod(b) num(2) num(1,1) num(2,1) tot(3) p#=1 f(a)#=2 f(b)#=1 
Answer: 6
cod(a) dom(1) dom(2) cod(b) num(0) num(1,0) num(2,0) tot(0) p#=1 
Answer: 7
cod(a) dom(1) dom(2) cod(b) num(1) num(1,0) num(2,1) tot(2) p#=1 f(a)#=2 
Answer: 8
cod(a) dom(1) dom(2) cod(b) num(1) num(1,0) num(2,1) tot(2) p#=1 f(b)#=2 
Answer: 9
cod(a) dom(1) dom(2) cod(b) num(2) num(1,0) num(2,2) tot(4) p#=2 f(a)#=2 f(b)#=2

Models      : 9     
Time        : 0.000 



Downloads

Clingo{f} should run without problems under most Unix variants and C/C++ compilers. It was tested under Linux Fedora 11 and 16, and compiled using gcc 4.4 and 4.6.


Questions, Bugs, etc.

Send emails to marcello.balduccini@gmail.com.

Authors

Clingo{f} was written by Marcello Balduccini.
Clasp and Clingo were written by Roland Kaminski.




References

[bal12] Marcello Balduccini, A ``Conservative'' Approach to Extending Answer Set Programming with Non-Herbrand Functions, 2012. To appear.
[bal12b] Marcello Balduccini, Answer Set Solving and Non-Herbrand Functions, 2012.

Back to my home page
Author: Marcello Balduccini (marcello.balduccini@gmail.com)
Last Update: 01/16/15