.type Integer <: symbol

.decl succ(a:Integer, b:Integer)
.decl equal(x:Integer, y:Integer, r:Integer)
.output equal()
.decl minimum(x:Integer, y:Integer, r:Integer)
.output minimum()
.decl maximum(x:Integer, y:Integer, r:Integer)
.output maximum()
.decl Is_min_max_eq(r:Integer)
.output Is_min_max_eq()

equal("0", "0", "0").
equal(m, n, r) :- succ(pm, m), succ(pn, n), equal(pm, pn, r).

minimum("1", "0", "1").
minimum("2", "0", "1").
minimum("3", "0", "1").
minimum(m, n, r) :- succ(pm, m), succ(pn, n), minimum(pm, pn, r).

maximum("0", "1", "2").
maximum("0", "2", "2").
maximum("0", "3", "2").
maximum(m, n, r) :- succ(pm, m), succ(pn, n), maximum(pm, pn, r).

Is_min_max_eq(r) :- equal("6", "6", r).
Is_min_max_eq(r) :- minimum("6", "6", r).
Is_min_max_eq(r) :- maximum("6", "6", r).

succ("0", "1").
succ("1", "2").
succ("2", "3").
succ("3", "4").
succ("4", "5").
succ("5", "6").
succ("6", "7").
succ("7", "8").
succ("8", "9").
succ("9", "10").
succ("10", "11").
succ("11", "12").
succ("12", "13").
succ("13", "14").
succ("14", "15").
succ("15", "16").
succ("16", "17").
succ("17", "18").
succ("18", "19").
succ("19", "20").

