YES We show the termination of the TRS R: app(g(),app(h(),app(g(),x))) -> app(g(),x) app(g(),app(g(),x)) -> app(g(),app(h(),app(g(),x))) app(h(),app(h(),x)) -> app(h(),app(app(f(),app(h(),x)),x)) app(app(map(),|fun|),nil()) -> nil() app(app(map(),|fun|),app(app(cons(),x),xs)) -> app(app(cons(),app(|fun|,x)),app(app(map(),|fun|),xs)) app(app(filter(),|fun|),nil()) -> nil() app(app(filter(),|fun|),app(app(cons(),x),xs)) -> app(app(app(app(filter2(),app(|fun|,x)),|fun|),x),xs) app(app(app(app(filter2(),true()),|fun|),x),xs) -> app(app(cons(),x),app(app(filter(),|fun|),xs)) app(app(app(app(filter2(),false()),|fun|),x),xs) -> app(app(filter(),|fun|),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(f_0(),y) -> f_1(y) app(f_1(x1),y) -> f_2(x1,y) app(filter_0(),y) -> filter_1(y) app(filter_1(x1),y) -> filter_2(x1,y) app(filter2_0(),y) -> filter2_1(y) app(filter2_1(x1),y) -> filter2_2(x1,y) app(filter2_2(x1,x2),y) -> filter2_3(x1,x2,y) app(filter2_3(x1,x2,x3),y) -> filter2_4(x1,x2,x3,y) app(g_0(),y) -> g_1(y) app(h_0(),y) -> h_1(y) app(map_0(),y) -> map_1(y) app(map_1(x1),y) -> map_2(x1,y) g_1(h_1(g_1(x))) -> g_1(x) g_1(g_1(x)) -> g_1(h_1(g_1(x))) h_1(h_1(x)) -> h_1(f_2(h_1(x),x)) map_2(|fun|,nil_0()) -> nil_0() map_2(|fun|,cons_2(x,xs)) -> cons_2(app(|fun|,x),map_2(|fun|,xs)) filter_2(|fun|,nil_0()) -> nil_0() filter_2(|fun|,cons_2(x,xs)) -> filter2_4(app(|fun|,x),|fun|,x,xs) filter2_4(true_0(),|fun|,x,xs) -> cons_2(x,filter_2(|fun|,xs)) filter2_4(false_0(),|fun|,x,xs) -> filter_2(|fun|,xs) -- SCC decomposition. Consider the dependency pair problem (P, R), where P consists of p1: app#(filter_1(x1),y) -> filter_2#(x1,y) p2: app#(filter2_3(x1,x2,x3),y) -> filter2_4#(x1,x2,x3,y) p3: app#(g_0(),y) -> g_1#(y) p4: app#(h_0(),y) -> h_1#(y) p5: app#(map_1(x1),y) -> map_2#(x1,y) p6: g_1#(g_1(x)) -> g_1#(h_1(g_1(x))) p7: g_1#(g_1(x)) -> h_1#(g_1(x)) p8: h_1#(h_1(x)) -> h_1#(f_2(h_1(x),x)) p9: map_2#(|fun|,cons_2(x,xs)) -> app#(|fun|,x) p10: map_2#(|fun|,cons_2(x,xs)) -> map_2#(|fun|,xs) p11: filter_2#(|fun|,cons_2(x,xs)) -> filter2_4#(app(|fun|,x),|fun|,x,xs) p12: filter_2#(|fun|,cons_2(x,xs)) -> app#(|fun|,x) p13: filter2_4#(true_0(),|fun|,x,xs) -> filter_2#(|fun|,xs) p14: filter2_4#(false_0(),|fun|,x,xs) -> filter_2#(|fun|,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(f_0(),y) -> f_1(y) r4: app(f_1(x1),y) -> f_2(x1,y) r5: app(filter_0(),y) -> filter_1(y) r6: app(filter_1(x1),y) -> filter_2(x1,y) r7: app(filter2_0(),y) -> filter2_1(y) r8: app(filter2_1(x1),y) -> filter2_2(x1,y) r9: app(filter2_2(x1,x2),y) -> filter2_3(x1,x2,y) r10: app(filter2_3(x1,x2,x3),y) -> filter2_4(x1,x2,x3,y) r11: app(g_0(),y) -> g_1(y) r12: app(h_0(),y) -> h_1(y) r13: app(map_0(),y) -> map_1(y) r14: app(map_1(x1),y) -> map_2(x1,y) r15: g_1(h_1(g_1(x))) -> g_1(x) r16: g_1(g_1(x)) -> g_1(h_1(g_1(x))) r17: h_1(h_1(x)) -> h_1(f_2(h_1(x),x)) r18: map_2(|fun|,nil_0()) -> nil_0() r19: map_2(|fun|,cons_2(x,xs)) -> cons_2(app(|fun|,x),map_2(|fun|,xs)) r20: filter_2(|fun|,nil_0()) -> nil_0() r21: filter_2(|fun|,cons_2(x,xs)) -> filter2_4(app(|fun|,x),|fun|,x,xs) r22: filter2_4(true_0(),|fun|,x,xs) -> cons_2(x,filter_2(|fun|,xs)) r23: filter2_4(false_0(),|fun|,x,xs) -> filter_2(|fun|,xs) The estimated dependency graph contains the following SCCs: {p1, p2, p5, p9, p10, p11, p12, p13, p14} {p6} -- Reduction pair. Consider the dependency pair problem (P, R), where P consists of p1: app#(filter_1(x1),y) -> filter_2#(x1,y) p2: filter_2#(|fun|,cons_2(x,xs)) -> app#(|fun|,x) p3: app#(map_1(x1),y) -> map_2#(x1,y) p4: map_2#(|fun|,cons_2(x,xs)) -> map_2#(|fun|,xs) p5: map_2#(|fun|,cons_2(x,xs)) -> app#(|fun|,x) p6: app#(filter2_3(x1,x2,x3),y) -> filter2_4#(x1,x2,x3,y) p7: filter2_4#(false_0(),|fun|,x,xs) -> filter_2#(|fun|,xs) p8: filter_2#(|fun|,cons_2(x,xs)) -> filter2_4#(app(|fun|,x),|fun|,x,xs) p9: filter2_4#(true_0(),|fun|,x,xs) -> filter_2#(|fun|,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(f_0(),y) -> f_1(y) r4: app(f_1(x1),y) -> f_2(x1,y) r5: app(filter_0(),y) -> filter_1(y) r6: app(filter_1(x1),y) -> filter_2(x1,y) r7: app(filter2_0(),y) -> filter2_1(y) r8: app(filter2_1(x1),y) -> filter2_2(x1,y) r9: app(filter2_2(x1,x2),y) -> filter2_3(x1,x2,y) r10: app(filter2_3(x1,x2,x3),y) -> filter2_4(x1,x2,x3,y) r11: app(g_0(),y) -> g_1(y) r12: app(h_0(),y) -> h_1(y) r13: app(map_0(),y) -> map_1(y) r14: app(map_1(x1),y) -> map_2(x1,y) r15: g_1(h_1(g_1(x))) -> g_1(x) r16: g_1(g_1(x)) -> g_1(h_1(g_1(x))) r17: h_1(h_1(x)) -> h_1(f_2(h_1(x),x)) r18: map_2(|fun|,nil_0()) -> nil_0() r19: map_2(|fun|,cons_2(x,xs)) -> cons_2(app(|fun|,x),map_2(|fun|,xs)) r20: filter_2(|fun|,nil_0()) -> nil_0() r21: filter_2(|fun|,cons_2(x,xs)) -> filter2_4(app(|fun|,x),|fun|,x,xs) r22: filter2_4(true_0(),|fun|,x,xs) -> cons_2(x,filter_2(|fun|,xs)) r23: filter2_4(false_0(),|fun|,x,xs) -> filter_2(|fun|,xs) The set of usable rules consists of r20 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{1, x1 - 31, x2 - 10} filter_1_A(x1) = max{19, x1 + 15} filter_2#_A(x1,x2) = max{1, x1 - 16, x2 - 21} cons_2_A(x1,x2) = max{20, x1 + 11, x2 + 11} map_1_A(x1) = max{19, x1 + 2} map_2#_A(x1,x2) = max{1, x1 - 31, x2 - 21} filter2_3_A(x1,x2,x3) = max{x1 + 25, x2 + 27, x3 + 30} filter2_4#_A(x1,x2,x3,x4) = max{1, x2 - 16, x3 - 10, x4 - 21} false_0_A = 11 app_A(x1,x2) = max{13, x1 - 29, x2 + 1} true_0_A = 2 filter_2_A(x1,x2) = max{29, x1 - 13, x2 + 2} nil_0_A = 30 app#!_A(x1,x2) = 3 filter_1!_A(x1) = x1 + 33 filter_2#!_A(x1,x2) = 3 cons_2!_A(x1,x2) = 4 map_1!_A(x1) = 1 map_2#!_A(x1,x2) = 3 filter2_3!_A(x1,x2,x3) = max{x1 + 7, x2 + 7} filter2_4#!_A(x1,x2,x3,x4) = 3 false_0!_A = 32 app!_A(x1,x2) = max{x1 - 20, x2 + 30} true_0!_A = 5 filter_2!_A(x1,x2) = x1 + 33 nil_0!_A = 32 2. marked-algebra reduction triple (>=A, >=A!, >A!): max/plus interpretation on natural numbers: app#_A(x1,x2) = max{4, x1 - 53, x2 - 42} filter_1_A(x1) = max{52, x1 + 3} filter_2#_A(x1,x2) = max{4, x1 - 53, x2 - 42} cons_2_A(x1,x2) = max{41, x1 + 39, x2 + 24} map_1_A(x1) = max{52, x1 + 37} map_2#_A(x1,x2) = max{4, x1 - 16, x2 - 42} filter2_3_A(x1,x2,x3) = max{x1 + 48, x2, x3 + 56} filter2_4#_A(x1,x2,x3,x4) = max{4, x2 - 53, x3 - 3, x4 - 42} false_0_A = 5 app_A(x1,x2) = max{51, x1 - 55, x2 + 2} true_0_A = 5 filter_2_A(x1,x2) = max{29, x1 - 79, x2 + 3} nil_0_A = 20 app#!_A(x1,x2) = x2 + 6 filter_1!_A(x1) = max{3, x1 + 2} filter_2#!_A(x1,x2) = max{1, x2 - 32} cons_2!_A(x1,x2) = max{x1 + 41, x2 - 30} map_1!_A(x1) = max{3, x1 - 16} map_2#!_A(x1,x2) = max{5, x2 - 32} filter2_3!_A(x1,x2,x3) = 50 filter2_4#!_A(x1,x2,x3,x4) = max{5, x4 - 31} false_0!_A = 54 app!_A(x1,x2) = max{2, x1} true_0!_A = 54 filter_2!_A(x1,x2) = max{53, x1 + 1, x2} nil_0!_A = 0 partial status: pi(app#) = [] pi(filter_1) = [1] pi(filter_2#) = [] pi(cons_2) = [] pi(map_1) = [1] pi(map_2#) = [] pi(filter2_3) = [] pi(filter2_4#) = [] pi(false_0) = [] pi(app) = [1, 2] pi(true_0) = [] pi(filter_2) = [] pi(nil_0) = [] The following rules are removed: p1, p2, p3, p4, p5, p6, p7, p8, p9 Then no dependency pair remains. -- Reduction pair. Consider the dependency pair problem (P, R), where P consists of p1: g_1#(g_1(x)) -> g_1#(h_1(g_1(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(f_0(),y) -> f_1(y) r4: app(f_1(x1),y) -> f_2(x1,y) r5: app(filter_0(),y) -> filter_1(y) r6: app(filter_1(x1),y) -> filter_2(x1,y) r7: app(filter2_0(),y) -> filter2_1(y) r8: app(filter2_1(x1),y) -> filter2_2(x1,y) r9: app(filter2_2(x1,x2),y) -> filter2_3(x1,x2,y) r10: app(filter2_3(x1,x2,x3),y) -> filter2_4(x1,x2,x3,y) r11: app(g_0(),y) -> g_1(y) r12: app(h_0(),y) -> h_1(y) r13: app(map_0(),y) -> map_1(y) r14: app(map_1(x1),y) -> map_2(x1,y) r15: g_1(h_1(g_1(x))) -> g_1(x) r16: g_1(g_1(x)) -> g_1(h_1(g_1(x))) r17: h_1(h_1(x)) -> h_1(f_2(h_1(x),x)) r18: map_2(|fun|,nil_0()) -> nil_0() r19: map_2(|fun|,cons_2(x,xs)) -> cons_2(app(|fun|,x),map_2(|fun|,xs)) r20: filter_2(|fun|,nil_0()) -> nil_0() r21: filter_2(|fun|,cons_2(x,xs)) -> filter2_4(app(|fun|,x),|fun|,x,xs) r22: filter2_4(true_0(),|fun|,x,xs) -> cons_2(x,filter_2(|fun|,xs)) r23: filter2_4(false_0(),|fun|,x,xs) -> filter_2(|fun|,xs) The set of usable rules consists of r15, r16, r17 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: g_1#_A(x1) = max{0, x1 - 21} g_1_A(x1) = max{20, x1 + 6} h_1_A(x1) = max{3, x1 - 5} f_2_A(x1,x2) = max{4, x1 - 4, x2 - 5} g_1#!_A(x1) = max{1, x1 - 30} g_1!_A(x1) = max{3, x1 - 28} h_1!_A(x1) = max{2, x1 - 49} f_2!_A(x1,x2) = max{3, x1 - 48, x2 - 27} 2. marked-algebra reduction triple (>=A, >=A!, >A!): max/plus interpretation on natural numbers: g_1#_A(x1) = max{0, x1 - 26} g_1_A(x1) = max{25, x1 + 17} h_1_A(x1) = max{9, x1 - 3} f_2_A(x1,x2) = max{2, x1 - 11, x2 - 3} g_1#!_A(x1) = max{2, x1 - 45} g_1!_A(x1) = max{3, x1 - 18} h_1!_A(x1) = max{1, x1 - 44} f_2!_A(x1,x2) = max{2, x1 - 10, x2 - 44} partial status: pi(g_1#) = [1] pi(g_1) = [] pi(h_1) = [] pi(f_2) = [] The following rules are removed: p1 Then no dependency pair remains.