Certification Problem

Input (TPDB TRS_Standard/Secret_06_TRS/nrOfNodes)

The rewrite relation of the following TRS is considered.

isEmpty(empty) true (1)
isEmpty(node(l,r)) false (2)
left(empty) empty (3)
left(node(l,r)) l (4)
right(empty) empty (5)
right(node(l,r)) r (6)
inc(0) s(0) (7)
inc(s(x)) s(inc(x)) (8)
count(n,x) if(isEmpty(n),isEmpty(left(n)),right(n),node(left(left(n)),node(right(left(n)),right(n))),x,inc(x)) (9)
if(true,b,n,m,x,y) x (10)
if(false,false,n,m,x,y) count(m,x) (11)
if(false,true,n,m,x,y) count(n,y) (12)
nrOfNodes(n) count(n,0) (13)

Property / Task

Prove or disprove termination.

Answer / Result

Yes.

Proof (by AProVE @ termCOMP 2023)

1 Switch to Innermost Termination

The TRS is overlay and locally confluent:

10

Hence, it suffices to show innermost termination in the following.

1.1 Dependency Pair Transformation

The following set of initial dependency pairs has been identified.
inc#(s(x)) inc#(x) (14)
count#(n,x) if#(isEmpty(n),isEmpty(left(n)),right(n),node(left(left(n)),node(right(left(n)),right(n))),x,inc(x)) (15)
count#(n,x) isEmpty#(n) (16)
count#(n,x) isEmpty#(left(n)) (17)
count#(n,x) left#(n) (18)
count#(n,x) right#(n) (19)
count#(n,x) left#(left(n)) (20)
count#(n,x) right#(left(n)) (21)
count#(n,x) inc#(x) (22)
if#(false,false,n,m,x,y) count#(m,x) (23)
if#(false,true,n,m,x,y) count#(n,y) (24)
nrOfNodes#(n) count#(n,0) (25)

1.1.1 Dependency Graph Processor

The dependency pairs are split into 2 components.