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(app(treemap(),f),app(app(node(),x),xs)) -> app(app(node(),app(f,x)),app(app(map(),app(treemap(),f)),xs)) Instead we prove termination of the uncurried system: app(cons_0(),y) -> cons_1(y) app(cons_1(x1),y) -> cons_2(x1,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) app(treemap_0(),y) -> treemap_1(y) app(treemap_1(x1),y) -> treemap_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)) treemap_2(f,node_2(x,xs)) -> node_2(app(f,x),map_2(treemap_1(f),xs)) -- SCC decomposition. Consider the dependency pair problem (P, R), where P consists of p1: app#(map_1(x1),y) -> map_2#(x1,y) p2: app#(treemap_1(x1),y) -> treemap_2#(x1,y) p3: map_2#(f,cons_2(x,xs)) -> app#(f,x) p4: map_2#(f,cons_2(x,xs)) -> map_2#(f,xs) p5: treemap_2#(f,node_2(x,xs)) -> app#(f,x) p6: treemap_2#(f,node_2(x,xs)) -> map_2#(treemap_1(f),xs) and R consists of: r1: app(cons_0(),y) -> cons_1(y) r2: app(cons_1(x1),y) -> cons_2(x1,y) r3: app(map_0(),y) -> map_1(y) r4: app(map_1(x1),y) -> map_2(x1,y) r5: app(node_0(),y) -> node_1(y) r6: app(node_1(x1),y) -> node_2(x1,y) r7: app(treemap_0(),y) -> treemap_1(y) r8: app(treemap_1(x1),y) -> treemap_2(x1,y) r9: map_2(f,nil_0()) -> nil_0() r10: map_2(f,cons_2(x,xs)) -> cons_2(app(f,x),map_2(f,xs)) r11: treemap_2(f,node_2(x,xs)) -> node_2(app(f,x),map_2(treemap_1(f),xs)) The estimated dependency graph contains the following SCCs: {p1, p2, p3, p4, p5, p6} -- Reduction pair. Consider the dependency pair problem (P, R), where P consists of p1: app#(map_1(x1),y) -> map_2#(x1,y) p2: map_2#(f,cons_2(x,xs)) -> map_2#(f,xs) p3: map_2#(f,cons_2(x,xs)) -> app#(f,x) p4: app#(treemap_1(x1),y) -> treemap_2#(x1,y) p5: treemap_2#(f,node_2(x,xs)) -> map_2#(treemap_1(f),xs) p6: treemap_2#(f,node_2(x,xs)) -> app#(f,x) and R consists of: r1: app(cons_0(),y) -> cons_1(y) r2: app(cons_1(x1),y) -> cons_2(x1,y) r3: app(map_0(),y) -> map_1(y) r4: app(map_1(x1),y) -> map_2(x1,y) r5: app(node_0(),y) -> node_1(y) r6: app(node_1(x1),y) -> node_2(x1,y) r7: app(treemap_0(),y) -> treemap_1(y) r8: app(treemap_1(x1),y) -> treemap_2(x1,y) r9: map_2(f,nil_0()) -> nil_0() r10: map_2(f,cons_2(x,xs)) -> cons_2(app(f,x),map_2(f,xs)) r11: treemap_2(f,node_2(x,xs)) -> node_2(app(f,x),map_2(treemap_1(f),xs)) The set of usable rules consists of (no rules) Take the reduction pair: generalized weighted path order (>=MG, >G) base order 1: trivial reduction triple (T x T, T x T, Φ) base order 2: lexicographic combination of reduction triples: 1. marked-algebra reduction triple (>=A, >=A!, >A!): max/plus interpretation on natural numbers: app#_A(x1,x2) = max{0, x1 - 35, x2 - 37} map_1_A(x1) = max{34, x1 + 28} map_2#_A(x1,x2) = max{0, x1 - 35, x2 - 41} cons_2_A(x1,x2) = max{31, x1 + 30, x2 + 1} treemap_1_A(x1) = max{3, x1 + 2} treemap_2#_A(x1,x2) = max{0, x1 - 33, x2 - 37} node_2_A(x1,x2) = max{x1 + 4, x2 - 4} app#!_A(x1,x2) = max{22, x1 - 35, x2 - 5} map_1!_A(x1) = max{20, x1 - 36} map_2#!_A(x1,x2) = max{21, x1 - 35, x2 - 9} cons_2!_A(x1,x2) = max{3, x1 - 6, x2 - 37} treemap_1!_A(x1) = max{16, x1 - 29} treemap_2#!_A(x1,x2) = max{22, x1 - 33, x2 - 5} node_2!_A(x1,x2) = max{x1 + 18, x2 + 17} 2. marked-algebra reduction triple (>=A, >=A!, >A!): max/plus interpretation on natural numbers: app#_A(x1,x2) = max{0, x1 - 63, x2 - 58} map_1_A(x1) = max{62, x1 + 22} map_2#_A(x1,x2) = max{0, x1 - 63, x2 - 82} cons_2_A(x1,x2) = max{x1 + 24, x2 + 81} treemap_1_A(x1) = max{61, x1 + 56} treemap_2#_A(x1,x2) = max{0, x1 - 7, x2 - 61} node_2_A(x1,x2) = max{x1 + 58, x2 - 19} app#!_A(x1,x2) = max{8, x1 - 63, x2 - 51} map_1!_A(x1) = max{5, x1 - 14} map_2#!_A(x1,x2) = max{6, x1 - 63, x2 - 70} cons_2!_A(x1,x2) = max{2, x1 - 106, x2 - 12} treemap_1!_A(x1) = max{9, x1 - 6} treemap_2#!_A(x1,x2) = max{8, x1 - 7, x2 - 51} node_2!_A(x1,x2) = max{3, x1 - 14, x2 - 24} partial status: pi(app#) = [] pi(map_1) = [1] pi(map_2#) = [] pi(cons_2) = [2] pi(treemap_1) = [1] pi(treemap_2#) = [] pi(node_2) = [2] The following rules are removed: p1 -- 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: map_2#(f,cons_2(x,xs)) -> app#(f,x) p3: app#(treemap_1(x1),y) -> treemap_2#(x1,y) p4: treemap_2#(f,node_2(x,xs)) -> map_2#(treemap_1(f),xs) p5: treemap_2#(f,node_2(x,xs)) -> app#(f,x) and R consists of: r1: app(cons_0(),y) -> cons_1(y) r2: app(cons_1(x1),y) -> cons_2(x1,y) r3: app(map_0(),y) -> map_1(y) r4: app(map_1(x1),y) -> map_2(x1,y) r5: app(node_0(),y) -> node_1(y) r6: app(node_1(x1),y) -> node_2(x1,y) r7: app(treemap_0(),y) -> treemap_1(y) r8: app(treemap_1(x1),y) -> treemap_2(x1,y) r9: map_2(f,nil_0()) -> nil_0() r10: map_2(f,cons_2(x,xs)) -> cons_2(app(f,x),map_2(f,xs)) r11: treemap_2(f,node_2(x,xs)) -> node_2(app(f,x),map_2(treemap_1(f),xs)) The estimated dependency graph contains the following SCCs: {p1, p2, p3, p4, p5} -- 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) p2: map_2#(f,cons_2(x,xs)) -> app#(f,x) p3: app#(treemap_1(x1),y) -> treemap_2#(x1,y) p4: treemap_2#(f,node_2(x,xs)) -> app#(f,x) p5: treemap_2#(f,node_2(x,xs)) -> map_2#(treemap_1(f),xs) and R consists of: r1: app(cons_0(),y) -> cons_1(y) r2: app(cons_1(x1),y) -> cons_2(x1,y) r3: app(map_0(),y) -> map_1(y) r4: app(map_1(x1),y) -> map_2(x1,y) r5: app(node_0(),y) -> node_1(y) r6: app(node_1(x1),y) -> node_2(x1,y) r7: app(treemap_0(),y) -> treemap_1(y) r8: app(treemap_1(x1),y) -> treemap_2(x1,y) r9: map_2(f,nil_0()) -> nil_0() r10: map_2(f,cons_2(x,xs)) -> cons_2(app(f,x),map_2(f,xs)) r11: treemap_2(f,node_2(x,xs)) -> node_2(app(f,x),map_2(treemap_1(f),xs)) The set of usable rules consists of (no rules) Take the reduction pair: generalized weighted path order (>=MG, >G) base order 1: trivial reduction triple (T x T, T x T, Φ) base order 2: lexicographic combination of reduction triples: 1. marked-algebra reduction triple (>=A, >=A!, >A!): max/plus interpretation on natural numbers: map_2#_A(x1,x2) = max{0, x1 - 8, x2 - 42} cons_2_A(x1,x2) = max{x1 + 17, x2 + 1} app#_A(x1,x2) = max{0, x1 - 8, x2 - 33} treemap_1_A(x1) = max{7, x1} treemap_2#_A(x1,x2) = max{0, x1 - 8, x2 - 33} node_2_A(x1,x2) = max{31, x1 + 13, x2 - 9} map_2#!_A(x1,x2) = max{5, x1 - 53, x2 - 42} cons_2!_A(x1,x2) = max{0, x1 - 30, x2 - 10} app#!_A(x1,x2) = max{5, x1 - 53, x2 - 31} treemap_1!_A(x1) = max{4, x1 - 52} treemap_2#!_A(x1,x2) = max{5, x1 - 53, x2 - 32} node_2!_A(x1,x2) = max{0, x1 - 2, x2 - 42} 2. marked-algebra reduction triple (>=A, >=A!, >A!): max/plus interpretation on natural numbers: map_2#_A(x1,x2) = max{0, x1 - 8, x2 - 32} cons_2_A(x1,x2) = max{x1 + 11, x2 + 28} app#_A(x1,x2) = max{0, x1 - 8, x2 - 21} treemap_1_A(x1) = max{7, x1} treemap_2#_A(x1,x2) = max{0, x1 - 8, x2 - 24} node_2_A(x1,x2) = max{22, x1 + 20, x2 - 8} map_2#!_A(x1,x2) = max{34, x1 - 8, x2 + 3} cons_2!_A(x1,x2) = max{30, x1 - 18, x2 - 40} app#!_A(x1,x2) = max{34, x1 - 8, x2 + 13} treemap_1!_A(x1) = 32 treemap_2#!_A(x1,x2) = max{34, x1 - 8, x2 + 11} node_2!_A(x1,x2) = max{x1 - 14, x2 + 30} partial status: pi(map_2#) = [2] pi(cons_2) = [1, 2] pi(app#) = [2] pi(treemap_1) = [] pi(treemap_2#) = [2] pi(node_2) = [1, 2] The following rules are removed: p5 -- 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: map_2#(f,cons_2(x,xs)) -> app#(f,x) p3: app#(treemap_1(x1),y) -> treemap_2#(x1,y) p4: treemap_2#(f,node_2(x,xs)) -> app#(f,x) and R consists of: r1: app(cons_0(),y) -> cons_1(y) r2: app(cons_1(x1),y) -> cons_2(x1,y) r3: app(map_0(),y) -> map_1(y) r4: app(map_1(x1),y) -> map_2(x1,y) r5: app(node_0(),y) -> node_1(y) r6: app(node_1(x1),y) -> node_2(x1,y) r7: app(treemap_0(),y) -> treemap_1(y) r8: app(treemap_1(x1),y) -> treemap_2(x1,y) r9: map_2(f,nil_0()) -> nil_0() r10: map_2(f,cons_2(x,xs)) -> cons_2(app(f,x),map_2(f,xs)) r11: treemap_2(f,node_2(x,xs)) -> node_2(app(f,x),map_2(treemap_1(f),xs)) The estimated dependency graph contains the following SCCs: {p1} {p3, p4} -- 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(cons_0(),y) -> cons_1(y) r2: app(cons_1(x1),y) -> cons_2(x1,y) r3: app(map_0(),y) -> map_1(y) r4: app(map_1(x1),y) -> map_2(x1,y) r5: app(node_0(),y) -> node_1(y) r6: app(node_1(x1),y) -> node_2(x1,y) r7: app(treemap_0(),y) -> treemap_1(y) r8: app(treemap_1(x1),y) -> treemap_2(x1,y) r9: map_2(f,nil_0()) -> nil_0() r10: map_2(f,cons_2(x,xs)) -> cons_2(app(f,x),map_2(f,xs)) r11: treemap_2(f,node_2(x,xs)) -> node_2(app(f,x),map_2(treemap_1(f),xs)) The set of usable rules consists of (no rules) Take the reduction pair: generalized weighted path order (>=MG, >G) base order 1: trivial reduction triple (T x T, T x T, Φ) base order 2: lexicographic combination of reduction triples: 1. 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{5, x1 - 4, x2 - 6} map_2#!_A(x1,x2) = max{3, x2 - 6} cons_2!_A(x1,x2) = max{x1 + 4, x2 - 5} 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{9, x1 - 4, x2 - 6} map_2#!_A(x1,x2) = max{4, x1 - 1, x2 - 10} cons_2!_A(x1,x2) = max{3, x1 - 22, x2 - 5} 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: app#(treemap_1(x1),y) -> treemap_2#(x1,y) p2: treemap_2#(f,node_2(x,xs)) -> app#(f,x) and R consists of: r1: app(cons_0(),y) -> cons_1(y) r2: app(cons_1(x1),y) -> cons_2(x1,y) r3: app(map_0(),y) -> map_1(y) r4: app(map_1(x1),y) -> map_2(x1,y) r5: app(node_0(),y) -> node_1(y) r6: app(node_1(x1),y) -> node_2(x1,y) r7: app(treemap_0(),y) -> treemap_1(y) r8: app(treemap_1(x1),y) -> treemap_2(x1,y) r9: map_2(f,nil_0()) -> nil_0() r10: map_2(f,cons_2(x,xs)) -> cons_2(app(f,x),map_2(f,xs)) r11: treemap_2(f,node_2(x,xs)) -> node_2(app(f,x),map_2(treemap_1(f),xs)) The set of usable rules consists of (no rules) Take the reduction pair: generalized weighted path order (>=MG, >G) base order 1: trivial reduction triple (T x T, T x T, Φ) base order 2: lexicographic combination of reduction triples: 1. marked-algebra reduction triple (>=A, >=A!, >A!): max/plus interpretation on natural numbers: app#_A(x1,x2) = max{0, x1 - 7, x2 - 3} treemap_1_A(x1) = x1 + 6 treemap_2#_A(x1,x2) = max{0, x1 - 1, x2 - 7} node_2_A(x1,x2) = max{6, x1 + 4, x2 - 15} app#!_A(x1,x2) = max{3, x1 - 7, x2 - 23} treemap_1!_A(x1) = max{2, x1 - 31} treemap_2#!_A(x1,x2) = max{3, x1 - 7, x2 - 27} node_2!_A(x1,x2) = max{1, x1 - 23, x2 - 20} 2. marked-algebra reduction triple (>=A, >=A!, >A!): max/plus interpretation on natural numbers: app#_A(x1,x2) = max{0, x1 - 31, x2 - 34} treemap_1_A(x1) = x1 + 30 treemap_2#_A(x1,x2) = max{0, x1 - 1, x2 - 34} node_2_A(x1,x2) = max{x1 + 33, x2 - 3} app#!_A(x1,x2) = max{1, x1 - 53, x2 - 53} treemap_1!_A(x1) = max{3, x1 - 51} treemap_2#!_A(x1,x2) = max{1, x1 - 52, x2 - 53} node_2!_A(x1,x2) = max{2, x1 - 54, x2 - 19} partial status: pi(app#) = [2] pi(treemap_1) = [] pi(treemap_2#) = [2] pi(node_2) = [1, 2] The following rules are removed: p2 -- SCC decomposition. Consider the dependency pair problem (P, R), where P consists of p1: app#(treemap_1(x1),y) -> treemap_2#(x1,y) and R consists of: r1: app(cons_0(),y) -> cons_1(y) r2: app(cons_1(x1),y) -> cons_2(x1,y) r3: app(map_0(),y) -> map_1(y) r4: app(map_1(x1),y) -> map_2(x1,y) r5: app(node_0(),y) -> node_1(y) r6: app(node_1(x1),y) -> node_2(x1,y) r7: app(treemap_0(),y) -> treemap_1(y) r8: app(treemap_1(x1),y) -> treemap_2(x1,y) r9: map_2(f,nil_0()) -> nil_0() r10: map_2(f,cons_2(x,xs)) -> cons_2(app(f,x),map_2(f,xs)) r11: treemap_2(f,node_2(x,xs)) -> node_2(app(f,x),map_2(treemap_1(f),xs)) The estimated dependency graph contains the following SCCs: (no SCCs)