.type Integer <: symbol

.decl check(x:Integer, y:Integer)
.decl list(x:Integer, y:Integer)
.decl succ(x:Integer, y:Integer)
.decl checker(x:Integer)
.output checker()

list("x", "0").
list("y", "0").
list("z", "0").
list("a", "1").

succ("x", "y").
succ("y", "z").
succ("z", "a").

check(a, "0") :- list(a, "0"), succ(a, s), check(s, "0").
check(a, "0") :- list(a, "0"), succ(a, s), check(s, "1").
check(a, "1") :- list(a, "1").


checker(a) :- check(a, "0").
