Certification Problem

Input (TPDB TRS_Standard/Applicative_05/TreeFlatten)

The rewrite relation of the following TRS is considered.

app(app(map,f),nil) nil (1)
app(app(map,f),app(app(cons,x),xs)) app(app(cons,app(f,x)),app(app(map,f),xs)) (2)
app(flatten,app(app(node,x),xs)) app(app(cons,x),app(concat,app(app(map,flatten),xs))) (3)
app(concat,nil) nil (4)
app(concat,app(app(cons,x),xs)) app(app(append,x),app(concat,xs)) (5)
app(app(append,nil),xs) xs (6)
app(app(append,app(app(cons,x),xs)),ys) app(app(cons,x),app(app(append,xs),ys)) (7)

Property / Task

Prove or disprove termination.

Answer / Result

Yes.

Proof (by AProVE @ termCOMP 2023)

1 Uncurrying

We uncurry the binary symbol app in combination with the following symbol map which also determines the applicative arities of these symbols.

map is mapped to map, map1(x1), map2(x1, x2)
nil is mapped to nil
cons is mapped to cons, cons1(x1), cons2(x1, x2)
flatten is mapped to flatten, flatten1(x1)
node is mapped to node, node1(x1), node2(x1, x2)
concat is mapped to concat, concat1(x1)
append is mapped to append, append1(x1), append2(x1, x2)


There are no uncurry rules.
No rules have to be added for the eta-expansion.

Uncurrying the rules and adding the uncurrying rules yields the new set of rules
map2(f,nil) nil (18)
map2(f,cons2(x,xs)) cons2(app(f,x),map2(f,xs)) (19)
flatten1(node2(x,xs)) cons2(x,concat1(map2(flatten,xs))) (20)
concat1(nil) nil (21)
concat1(cons2(x,xs)) append2(x,concat1(xs)) (22)
append2(nil,xs) xs (23)
append2(cons2(x,xs),ys) cons2(x,append2(xs,ys)) (24)
app(map,y1) map1(y1) (8)
app(map1(x0),y1) map2(x0,y1) (9)
app(cons,y1) cons1(y1) (10)
app(cons1(x0),y1) cons2(x0,y1) (11)
app(flatten,y1) flatten1(y1) (12)
app(node,y1) node1(y1) (13)
app(node1(x0),y1) node2(x0,y1) (14)
app(concat,y1) concat1(y1) (15)
app(append,y1) append1(y1) (16)
app(append1(x0),y1) append2(x0,y1) (17)

1.1 Rule Removal

Using the
prec(map2) = 6 stat(map2) = mul
prec(nil) = 0 stat(nil) = mul
prec(cons2) = 1 stat(cons2) = lex
prec(app) = 6 stat(app) = mul
prec(flatten1) = 6 stat(flatten1) = mul
prec(node2) = 3 stat(node2) = mul
prec(flatten) = 2 stat(flatten) = mul
prec(append2) = 1 stat(append2) = lex
prec(map) = 7 stat(map) = mul
prec(map1) = 4 stat(map1) = lex
prec(cons) = 8 stat(cons) = mul
prec(cons1) = 5 stat(cons1) = lex
prec(node) = 9 stat(node) = mul
prec(concat) = 10 stat(concat) = mul
prec(append) = 11 stat(append) = mul
prec(append1) = 1 stat(append1) = mul

π(map2) = [1,2]
π(nil) = []
π(cons2) = [1,2]
π(app) = [1,2]
π(flatten1) = [1]
π(node2) = [1,2]
π(concat1) = 1
π(flatten) = []
π(append2) = [1,2]
π(map) = []
π(map1) = [1]
π(cons) = []
π(cons1) = [1]
π(node) = []
π(node1) = 1
π(concat) = []
π(append) = []
π(append1) = [1]

all of the following rules can be deleted.
map2(f,nil) nil (18)
map2(f,cons2(x,xs)) cons2(app(f,x),map2(f,xs)) (19)
flatten1(node2(x,xs)) cons2(x,concat1(map2(flatten,xs))) (20)
append2(nil,xs) xs (23)
append2(cons2(x,xs),ys) cons2(x,append2(xs,ys)) (24)
app(map,y1) map1(y1) (8)
app(map1(x0),y1) map2(x0,y1) (9)
app(cons,y1) cons1(y1) (10)
app(cons1(x0),y1) cons2(x0,y1) (11)
app(flatten,y1) flatten1(y1) (12)
app(node,y1) node1(y1) (13)
app(node1(x0),y1) node2(x0,y1) (14)
app(concat,y1) concat1(y1) (15)
app(append,y1) append1(y1) (16)
app(append1(x0),y1) append2(x0,y1) (17)

1.1.1 Rule Removal

Using the Knuth Bendix order with w0 = 1 and the following precedence and weight functions
prec(nil) = 0 weight(nil) = 1
prec(concat1) = 3 weight(concat1) = 0
prec(cons2) = 1 weight(cons2) = 0
prec(append2) = 2 weight(append2) = 0
all of the following rules can be deleted.
concat1(nil) nil (21)
concat1(cons2(x,xs)) append2(x,concat1(xs)) (22)

1.1.1.1 R is empty

There are no rules in the TRS. Hence, it is terminating.