YES We show the termination of the TRS R: app(app(map(),f),nil()) -> nil() app(app(map(),f),app(app(cons(),x),xs)) -> app(app(cons(),app(f,x)),app(app(map(),f),xs)) app(flatten(),app(app(node(),x),xs)) -> app(app(cons(),x),app(concat(),app(app(map(),flatten()),xs))) app(concat(),nil()) -> nil() app(concat(),app(app(cons(),x),xs)) -> app(app(append(),x),app(concat(),xs)) app(app(append(),nil()),xs) -> xs app(app(append(),app(app(cons(),x),xs)),ys) -> app(app(cons(),x),app(app(append(),xs),ys)) Instead we prove termination of the uncurried system: app(append_0(),y) -> append_1(y) app(append_1(x1),y) -> append_2(x1,y) app(concat_0(),y) -> concat_1(y) app(cons_0(),y) -> cons_1(y) app(cons_1(x1),y) -> cons_2(x1,y) app(flatten_0(),y) -> flatten_1(y) app(map_0(),y) -> map_1(y) app(map_1(x1),y) -> map_2(x1,y) app(node_0(),y) -> node_1(y) app(node_1(x1),y) -> node_2(x1,y) map_2(f,nil_0()) -> nil_0() map_2(f,cons_2(x,xs)) -> cons_2(app(f,x),map_2(f,xs)) flatten_1(node_2(x,xs)) -> cons_2(x,concat_1(map_2(flatten_0(),xs))) concat_1(nil_0()) -> nil_0() concat_1(cons_2(x,xs)) -> append_2(x,concat_1(xs)) append_2(nil_0(),xs) -> xs append_2(cons_2(x,xs),ys) -> cons_2(x,append_2(xs,ys)) -- SCC decomposition. Consider the dependency pair problem (P, R), where P consists of p1: app#(append_1(x1),y) -> append_2#(x1,y) p2: app#(concat_0(),y) -> concat_1#(y) p3: app#(flatten_0(),y) -> flatten_1#(y) p4: app#(map_1(x1),y) -> map_2#(x1,y) p5: map_2#(f,cons_2(x,xs)) -> app#(f,x) p6: map_2#(f,cons_2(x,xs)) -> map_2#(f,xs) p7: flatten_1#(node_2(x,xs)) -> concat_1#(map_2(flatten_0(),xs)) p8: flatten_1#(node_2(x,xs)) -> map_2#(flatten_0(),xs) p9: concat_1#(cons_2(x,xs)) -> append_2#(x,concat_1(xs)) p10: concat_1#(cons_2(x,xs)) -> concat_1#(xs) p11: append_2#(cons_2(x,xs),ys) -> append_2#(xs,ys) and R consists of: r1: app(append_0(),y) -> append_1(y) r2: app(append_1(x1),y) -> append_2(x1,y) r3: app(concat_0(),y) -> concat_1(y) r4: app(cons_0(),y) -> cons_1(y) r5: app(cons_1(x1),y) -> cons_2(x1,y) r6: app(flatten_0(),y) -> flatten_1(y) r7: app(map_0(),y) -> map_1(y) r8: app(map_1(x1),y) -> map_2(x1,y) r9: app(node_0(),y) -> node_1(y) r10: app(node_1(x1),y) -> node_2(x1,y) r11: map_2(f,nil_0()) -> nil_0() r12: map_2(f,cons_2(x,xs)) -> cons_2(app(f,x),map_2(f,xs)) r13: flatten_1(node_2(x,xs)) -> cons_2(x,concat_1(map_2(flatten_0(),xs))) r14: concat_1(nil_0()) -> nil_0() r15: concat_1(cons_2(x,xs)) -> append_2(x,concat_1(xs)) r16: append_2(nil_0(),xs) -> xs r17: append_2(cons_2(x,xs),ys) -> cons_2(x,append_2(xs,ys)) The estimated dependency graph contains the following SCCs: {p3, p4, p5, p6, p8} {p10} {p11} -- Reduction pair. Consider the dependency pair problem (P, R), where P consists of p1: map_2#(f,cons_2(x,xs)) -> app#(f,x) p2: app#(map_1(x1),y) -> map_2#(x1,y) p3: map_2#(f,cons_2(x,xs)) -> map_2#(f,xs) p4: app#(flatten_0(),y) -> flatten_1#(y) p5: flatten_1#(node_2(x,xs)) -> map_2#(flatten_0(),xs) and R consists of: r1: app(append_0(),y) -> append_1(y) r2: app(append_1(x1),y) -> append_2(x1,y) r3: app(concat_0(),y) -> concat_1(y) r4: app(cons_0(),y) -> cons_1(y) r5: app(cons_1(x1),y) -> cons_2(x1,y) r6: app(flatten_0(),y) -> flatten_1(y) r7: app(map_0(),y) -> map_1(y) r8: app(map_1(x1),y) -> map_2(x1,y) r9: app(node_0(),y) -> node_1(y) r10: app(node_1(x1),y) -> node_2(x1,y) r11: map_2(f,nil_0()) -> nil_0() r12: map_2(f,cons_2(x,xs)) -> cons_2(app(f,x),map_2(f,xs)) r13: flatten_1(node_2(x,xs)) -> cons_2(x,concat_1(map_2(flatten_0(),xs))) r14: concat_1(nil_0()) -> nil_0() r15: concat_1(cons_2(x,xs)) -> append_2(x,concat_1(xs)) r16: append_2(nil_0(),xs) -> xs r17: append_2(cons_2(x,xs),ys) -> cons_2(x,append_2(xs,ys)) The set of usable rules consists of (no rules) Take the reduction pair: generalized weighted path order (>=MG, >G) base order 1: max/plus interpretation on natural numbers: map_2#_A(x1,x2) = max{3, x1 - 3} cons_2_A(x1,x2) = max{21, x1 - 27, x2 - 45} app#_A(x1,x2) = max{3, x1 - 3} map_1_A(x1) = x1 + 7 flatten_0_A = 1 flatten_1#_A(x1) = 3 node_2_A(x1,x2) = max{37, x1 - 26, x2 - 26} base order 2: marked-algebra reduction triple (>=A, >=A!, >A!): max/plus interpretation on natural numbers: map_2#_A(x1,x2) = max{0, x1 - 8, x2 - 19} cons_2_A(x1,x2) = max{18, x1 + 11, x2 + 11} app#_A(x1,x2) = max{0, x1 - 13, x2 - 8} map_1_A(x1) = max{12, x1 + 6} flatten_0_A = 7 flatten_1#_A(x1) = max{0, x1 - 31} node_2_A(x1,x2) = max{x1 + 29, x2 + 19} map_2#!_A(x1,x2) = max{2, x1 - 8, x2 - 12} cons_2!_A(x1,x2) = max{4, x2 - 42} app#!_A(x1,x2) = max{5, x1 - 13, x2 - 10} map_1!_A(x1) = max{4, x1 - 9} flatten_0!_A = 1 flatten_1#!_A(x1) = max{2, x1 - 31} node_2!_A(x1,x2) = max{6, x1 - 12, x2 - 11} partial status: pi(map_2#) = [] pi(cons_2) = [] pi(app#) = [] pi(map_1) = [1] pi(flatten_0) = [] pi(flatten_1#) = [] pi(node_2) = [] The following rules are removed: p1, p2, p4 -- SCC decomposition. Consider the dependency pair problem (P, R), where P consists of p1: map_2#(f,cons_2(x,xs)) -> map_2#(f,xs) p2: flatten_1#(node_2(x,xs)) -> map_2#(flatten_0(),xs) and R consists of: r1: app(append_0(),y) -> append_1(y) r2: app(append_1(x1),y) -> append_2(x1,y) r3: app(concat_0(),y) -> concat_1(y) r4: app(cons_0(),y) -> cons_1(y) r5: app(cons_1(x1),y) -> cons_2(x1,y) r6: app(flatten_0(),y) -> flatten_1(y) r7: app(map_0(),y) -> map_1(y) r8: app(map_1(x1),y) -> map_2(x1,y) r9: app(node_0(),y) -> node_1(y) r10: app(node_1(x1),y) -> node_2(x1,y) r11: map_2(f,nil_0()) -> nil_0() r12: map_2(f,cons_2(x,xs)) -> cons_2(app(f,x),map_2(f,xs)) r13: flatten_1(node_2(x,xs)) -> cons_2(x,concat_1(map_2(flatten_0(),xs))) r14: concat_1(nil_0()) -> nil_0() r15: concat_1(cons_2(x,xs)) -> append_2(x,concat_1(xs)) r16: append_2(nil_0(),xs) -> xs r17: append_2(cons_2(x,xs),ys) -> cons_2(x,append_2(xs,ys)) The estimated dependency graph contains the following SCCs: {p1} -- Reduction pair. Consider the dependency pair problem (P, R), where P consists of p1: map_2#(f,cons_2(x,xs)) -> map_2#(f,xs) and R consists of: r1: app(append_0(),y) -> append_1(y) r2: app(append_1(x1),y) -> append_2(x1,y) r3: app(concat_0(),y) -> concat_1(y) r4: app(cons_0(),y) -> cons_1(y) r5: app(cons_1(x1),y) -> cons_2(x1,y) r6: app(flatten_0(),y) -> flatten_1(y) r7: app(map_0(),y) -> map_1(y) r8: app(map_1(x1),y) -> map_2(x1,y) r9: app(node_0(),y) -> node_1(y) r10: app(node_1(x1),y) -> node_2(x1,y) r11: map_2(f,nil_0()) -> nil_0() r12: map_2(f,cons_2(x,xs)) -> cons_2(app(f,x),map_2(f,xs)) r13: flatten_1(node_2(x,xs)) -> cons_2(x,concat_1(map_2(flatten_0(),xs))) r14: concat_1(nil_0()) -> nil_0() r15: concat_1(cons_2(x,xs)) -> append_2(x,concat_1(xs)) r16: append_2(nil_0(),xs) -> xs r17: append_2(cons_2(x,xs),ys) -> cons_2(x,append_2(xs,ys)) The set of usable rules consists of (no rules) Take the reduction pair: generalized weighted path order (>=MG, >G) base order 1: max/plus interpretation on natural numbers: map_2#_A(x1,x2) = x2 + 11 cons_2_A(x1,x2) = max{15, x1 - 9, x2 + 12} base order 2: marked-algebra reduction triple (>=A, >=A!, >A!): max/plus interpretation on natural numbers: map_2#_A(x1,x2) = 0 cons_2_A(x1,x2) = max{4, x1 - 2, x2 - 4} map_2#!_A(x1,x2) = max{10, x1 + 1} cons_2!_A(x1,x2) = max{9, x2 - 13} partial status: pi(map_2#) = [2] pi(cons_2) = [2] The following rules are removed: p1 Then no dependency pair remains. -- Reduction pair. Consider the dependency pair problem (P, R), where P consists of p1: concat_1#(cons_2(x,xs)) -> concat_1#(xs) and R consists of: r1: app(append_0(),y) -> append_1(y) r2: app(append_1(x1),y) -> append_2(x1,y) r3: app(concat_0(),y) -> concat_1(y) r4: app(cons_0(),y) -> cons_1(y) r5: app(cons_1(x1),y) -> cons_2(x1,y) r6: app(flatten_0(),y) -> flatten_1(y) r7: app(map_0(),y) -> map_1(y) r8: app(map_1(x1),y) -> map_2(x1,y) r9: app(node_0(),y) -> node_1(y) r10: app(node_1(x1),y) -> node_2(x1,y) r11: map_2(f,nil_0()) -> nil_0() r12: map_2(f,cons_2(x,xs)) -> cons_2(app(f,x),map_2(f,xs)) r13: flatten_1(node_2(x,xs)) -> cons_2(x,concat_1(map_2(flatten_0(),xs))) r14: concat_1(nil_0()) -> nil_0() r15: concat_1(cons_2(x,xs)) -> append_2(x,concat_1(xs)) r16: append_2(nil_0(),xs) -> xs r17: append_2(cons_2(x,xs),ys) -> cons_2(x,append_2(xs,ys)) The set of usable rules consists of (no rules) Take the reduction pair: generalized weighted path order (>=MG, >G) base order 1: max/plus interpretation on natural numbers: concat_1#_A(x1) = max{12, x1 + 6} cons_2_A(x1,x2) = max{13, x1 + 7, x2 + 7} base order 2: marked-algebra reduction triple (>=A, >=A!, >A!): max/plus interpretation on natural numbers: concat_1#_A(x1) = 0 cons_2_A(x1,x2) = max{4, x1 - 2, x2 - 4} concat_1#!_A(x1) = 0 cons_2!_A(x1,x2) = max{6, x1 - 11, x2 - 15} partial status: pi(concat_1#) = [1] pi(cons_2) = [1, 2] The following rules are removed: p1 Then no dependency pair remains. -- Reduction pair. Consider the dependency pair problem (P, R), where P consists of p1: append_2#(cons_2(x,xs),ys) -> append_2#(xs,ys) and R consists of: r1: app(append_0(),y) -> append_1(y) r2: app(append_1(x1),y) -> append_2(x1,y) r3: app(concat_0(),y) -> concat_1(y) r4: app(cons_0(),y) -> cons_1(y) r5: app(cons_1(x1),y) -> cons_2(x1,y) r6: app(flatten_0(),y) -> flatten_1(y) r7: app(map_0(),y) -> map_1(y) r8: app(map_1(x1),y) -> map_2(x1,y) r9: app(node_0(),y) -> node_1(y) r10: app(node_1(x1),y) -> node_2(x1,y) r11: map_2(f,nil_0()) -> nil_0() r12: map_2(f,cons_2(x,xs)) -> cons_2(app(f,x),map_2(f,xs)) r13: flatten_1(node_2(x,xs)) -> cons_2(x,concat_1(map_2(flatten_0(),xs))) r14: concat_1(nil_0()) -> nil_0() r15: concat_1(cons_2(x,xs)) -> append_2(x,concat_1(xs)) r16: append_2(nil_0(),xs) -> xs r17: append_2(cons_2(x,xs),ys) -> cons_2(x,append_2(xs,ys)) The set of usable rules consists of (no rules) Take the reduction pair: generalized weighted path order (>=MG, >G) base order 1: max/plus interpretation on natural numbers: append_2#_A(x1,x2) = max{x1 + 14, x2 + 7} cons_2_A(x1,x2) = max{x1 - 7, x2 + 5} base order 2: marked-algebra reduction triple (>=A, >=A!, >A!): max/plus interpretation on natural numbers: append_2#_A(x1,x2) = 0 cons_2_A(x1,x2) = max{4, x1 - 8, x2 - 8} append_2#!_A(x1,x2) = 0 cons_2!_A(x1,x2) = max{0, x1 - 3} partial status: pi(append_2#) = [1] pi(cons_2) = [] The following rules are removed: p1 Then no dependency pair remains.