
.type node = number

// defines the interface and some basic properties
.comp Closure {
    .decl edge(a:node,b:node)
    .decl link(a:node,b:node)
.output link()

    link(X,Y) :- edge(X,Y).
}

// strategy A
.comp LeftRecursive : Closure {
    link(X,Z) :- link(X,Y), edge(Y,Z).
}

// strategy B
.comp RightRecursive : Closure {
    link(X,Z) :- edge(X,Y), link(Y,Z).
}

// strategy C
.comp QuadraticRecursive : Closure {
    link(X,Z) :- link(X,Y), link(Y,Z).
}


// get input data
.decl less(a:node,b:node)
less(1,2).
less(2,3).
less(3,4).
less(4,5).
less(5,6).


// init strategies
.init A = LeftRecursive
.init B = RightRecursive
.init C = QuadraticRecursive

// wire in input data
A.edge(X,Y) :- less(X,Y).
B.edge(X,Y) :- less(X,Y).
C.edge(X,Y) :- less(X,Y).



