//// Reproduced from [FD92]
//// Adopted from DES

.type Node <: symbol

.decl tcl  (node1:Node, node2:Node)
.output tcl  ()
.decl tcr  (node1:Node, node2:Node)
.output tcr  ()
.decl base (node1:Node, node2:Node)
.output base ()
.input base ()
.decl tc (node1:Node, node2:Node)
.output tc ()

// Left-Recursive Transitive Closure
tcl(X, Y) :- base(X,Y).
tcl(X,Y) :- tcl(X,Z), base(Z,Y).

// Right-recursive Transitive Closure
tcr(X,Y) :- base(X,Y).
tcr(X,Y) :- base(X, Z),tcr(Z,Y).

// Double-recursive Transitive Closure
tc(X,Y) :- base(X,Y).
tc(X,Y) :- tc(X,Z),tc(Z,Y).

// base relation
base("a","b").
base("b","c").
base("c","d").
