YES We show the termination of the TRS R: app(app(twice(),f),x) -> app(f,app(f,x)) app(app(map(),f),nil()) -> nil() app(app(map(),f),app(app(cons(),h),t)) -> app(app(cons(),app(f,h)),app(app(map(),f),t)) app(app(fmap(),nil()),x) -> nil() app(app(fmap(),app(app(cons(),f),t_f())),x) -> app(app(cons(),app(f,x)),app(app(fmap(),t_f()),x)) 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(fmap_0(),y) -> fmap_1(y) app(fmap_1(x1),y) -> fmap_2(x1,y) app(map_0(),y) -> map_1(y) app(map_1(x1),y) -> map_2(x1,y) app(twice_0(),y) -> twice_1(y) app(twice_1(x1),y) -> twice_2(x1,y) twice_2(f,x) -> app(f,app(f,x)) map_2(f,nil_0()) -> nil_0() map_2(f,cons_2(h,t)) -> cons_2(app(f,h),map_2(f,t)) fmap_2(nil_0(),x) -> nil_0() fmap_2(cons_2(f,t_f_0()),x) -> cons_2(app(f,x),fmap_2(t_f_0(),x)) -- SCC decomposition. Consider the dependency pair problem (P, R), where P consists of p1: app#(fmap_1(x1),y) -> fmap_2#(x1,y) p2: app#(map_1(x1),y) -> map_2#(x1,y) p3: app#(twice_1(x1),y) -> twice_2#(x1,y) p4: twice_2#(f,x) -> app#(f,app(f,x)) p5: twice_2#(f,x) -> app#(f,x) p6: map_2#(f,cons_2(h,t)) -> app#(f,h) p7: map_2#(f,cons_2(h,t)) -> map_2#(f,t) p8: fmap_2#(cons_2(f,t_f_0()),x) -> app#(f,x) p9: fmap_2#(cons_2(f,t_f_0()),x) -> fmap_2#(t_f_0(),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(fmap_0(),y) -> fmap_1(y) r4: app(fmap_1(x1),y) -> fmap_2(x1,y) r5: app(map_0(),y) -> map_1(y) r6: app(map_1(x1),y) -> map_2(x1,y) r7: app(twice_0(),y) -> twice_1(y) r8: app(twice_1(x1),y) -> twice_2(x1,y) r9: twice_2(f,x) -> app(f,app(f,x)) r10: map_2(f,nil_0()) -> nil_0() r11: map_2(f,cons_2(h,t)) -> cons_2(app(f,h),map_2(f,t)) r12: fmap_2(nil_0(),x) -> nil_0() r13: fmap_2(cons_2(f,t_f_0()),x) -> cons_2(app(f,x),fmap_2(t_f_0(),x)) The estimated dependency graph contains the following SCCs: {p1, p2, p3, p4, p5, p6, p7, p8} -- Reduction pair. Consider the dependency pair problem (P, R), where P consists of p1: app#(fmap_1(x1),y) -> fmap_2#(x1,y) p2: fmap_2#(cons_2(f,t_f_0()),x) -> app#(f,x) p3: app#(twice_1(x1),y) -> twice_2#(x1,y) p4: twice_2#(f,x) -> app#(f,x) p5: app#(map_1(x1),y) -> map_2#(x1,y) p6: map_2#(f,cons_2(h,t)) -> map_2#(f,t) p7: map_2#(f,cons_2(h,t)) -> app#(f,h) p8: twice_2#(f,x) -> app#(f,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(fmap_0(),y) -> fmap_1(y) r4: app(fmap_1(x1),y) -> fmap_2(x1,y) r5: app(map_0(),y) -> map_1(y) r6: app(map_1(x1),y) -> map_2(x1,y) r7: app(twice_0(),y) -> twice_1(y) r8: app(twice_1(x1),y) -> twice_2(x1,y) r9: twice_2(f,x) -> app(f,app(f,x)) r10: map_2(f,nil_0()) -> nil_0() r11: map_2(f,cons_2(h,t)) -> cons_2(app(f,h),map_2(f,t)) r12: fmap_2(nil_0(),x) -> nil_0() r13: fmap_2(cons_2(f,t_f_0()),x) -> cons_2(app(f,x),fmap_2(t_f_0(),x)) The set of usable rules consists of r1, r12 Take the reduction pair: generalized weighted path order (>=MG, >MG) base order 1: max/plus interpretation on natural numbers: app#_A(x1,x2) = x1 + 2 fmap_1_A(x1) = x1 + 21 fmap_2#_A(x1,x2) = x1 + 20 cons_2_A(x1,x2) = max{6, x1 - 16, x2 - 18} t_f_0_A = 1 twice_1_A(x1) = max{11, x1 + 4} twice_2#_A(x1,x2) = max{5, x1 + 3} map_1_A(x1) = x1 + 5 map_2#_A(x1,x2) = x1 + 4 app_A(x1,x2) = max{10, x1 - 38, x2 - 11} cons_0_A = 1 cons_1_A(x1) = 2 fmap_2_A(x1,x2) = max{9, x1 - 16, x2 - 12} nil_0_A = 0 base order 2: precedence: cons_1 > app = cons_0 > twice_1 = map_1 = fmap_2 > fmap_1 = cons_2 = nil_0 > fmap_2# > app# > t_f_0 = twice_2# = map_2# partial status: pi(app#) = [1] pi(fmap_1) = [] pi(fmap_2#) = [] pi(cons_2) = [] pi(t_f_0) = [] pi(twice_1) = [] pi(twice_2#) = [] pi(map_1) = [1] pi(map_2#) = [1] pi(app) = [] pi(cons_0) = [] pi(cons_1) = [] pi(fmap_2) = [] pi(nil_0) = [] The following rules are removed: p1 -- SCC decomposition. Consider the dependency pair problem (P, R), where P consists of p1: fmap_2#(cons_2(f,t_f_0()),x) -> app#(f,x) p2: app#(twice_1(x1),y) -> twice_2#(x1,y) p3: twice_2#(f,x) -> app#(f,x) p4: app#(map_1(x1),y) -> map_2#(x1,y) p5: map_2#(f,cons_2(h,t)) -> map_2#(f,t) p6: map_2#(f,cons_2(h,t)) -> app#(f,h) p7: twice_2#(f,x) -> app#(f,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(fmap_0(),y) -> fmap_1(y) r4: app(fmap_1(x1),y) -> fmap_2(x1,y) r5: app(map_0(),y) -> map_1(y) r6: app(map_1(x1),y) -> map_2(x1,y) r7: app(twice_0(),y) -> twice_1(y) r8: app(twice_1(x1),y) -> twice_2(x1,y) r9: twice_2(f,x) -> app(f,app(f,x)) r10: map_2(f,nil_0()) -> nil_0() r11: map_2(f,cons_2(h,t)) -> cons_2(app(f,h),map_2(f,t)) r12: fmap_2(nil_0(),x) -> nil_0() r13: fmap_2(cons_2(f,t_f_0()),x) -> cons_2(app(f,x),fmap_2(t_f_0(),x)) The estimated dependency graph contains the following SCCs: {p2, p3, p4, p5, p6, p7} -- Reduction pair. Consider the dependency pair problem (P, R), where P consists of p1: app#(twice_1(x1),y) -> twice_2#(x1,y) p2: twice_2#(f,x) -> app#(f,app(f,x)) p3: app#(map_1(x1),y) -> map_2#(x1,y) p4: map_2#(f,cons_2(h,t)) -> app#(f,h) p5: map_2#(f,cons_2(h,t)) -> map_2#(f,t) p6: twice_2#(f,x) -> 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(fmap_0(),y) -> fmap_1(y) r4: app(fmap_1(x1),y) -> fmap_2(x1,y) r5: app(map_0(),y) -> map_1(y) r6: app(map_1(x1),y) -> map_2(x1,y) r7: app(twice_0(),y) -> twice_1(y) r8: app(twice_1(x1),y) -> twice_2(x1,y) r9: twice_2(f,x) -> app(f,app(f,x)) r10: map_2(f,nil_0()) -> nil_0() r11: map_2(f,cons_2(h,t)) -> cons_2(app(f,h),map_2(f,t)) r12: fmap_2(nil_0(),x) -> nil_0() r13: fmap_2(cons_2(f,t_f_0()),x) -> cons_2(app(f,x),fmap_2(t_f_0(),x)) The set of usable rules consists of r1, r3, r12 Take the reduction pair: generalized weighted path order (>=MG, >MG) base order 1: max/plus interpretation on natural numbers: app#_A(x1,x2) = max{1, x1} twice_1_A(x1) = max{16, x1 + 3} twice_2#_A(x1,x2) = x1 + 2 app_A(x1,x2) = max{15, x1 - 17, x2 - 17} map_1_A(x1) = max{3, x1 + 2} map_2#_A(x1,x2) = max{3, x1 + 2} cons_2_A(x1,x2) = max{5, x1 - 9, x2 - 9} cons_0_A = 3 cons_1_A(x1) = max{4, x1 - 18} fmap_0_A = 18 fmap_1_A(x1) = max{14, x1 - 18} fmap_2_A(x1,x2) = max{16, x1 - 4, x2 - 1} nil_0_A = 0 base order 2: precedence: fmap_2 > app = cons_2 = nil_0 > app# = twice_1 = map_1 = cons_1 = fmap_1 > twice_2# = map_2# = cons_0 = fmap_0 partial status: pi(app#) = [1] pi(twice_1) = [] pi(twice_2#) = [] pi(app) = [] pi(map_1) = [1] pi(map_2#) = [1] pi(cons_2) = [] pi(cons_0) = [] pi(cons_1) = [] pi(fmap_0) = [] pi(fmap_1) = [] pi(fmap_2) = [] pi(nil_0) = [] The following rules are removed: p3 -- SCC decomposition. Consider the dependency pair problem (P, R), where P consists of p1: app#(twice_1(x1),y) -> twice_2#(x1,y) p2: twice_2#(f,x) -> app#(f,app(f,x)) p3: map_2#(f,cons_2(h,t)) -> app#(f,h) p4: map_2#(f,cons_2(h,t)) -> map_2#(f,t) p5: twice_2#(f,x) -> 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(fmap_0(),y) -> fmap_1(y) r4: app(fmap_1(x1),y) -> fmap_2(x1,y) r5: app(map_0(),y) -> map_1(y) r6: app(map_1(x1),y) -> map_2(x1,y) r7: app(twice_0(),y) -> twice_1(y) r8: app(twice_1(x1),y) -> twice_2(x1,y) r9: twice_2(f,x) -> app(f,app(f,x)) r10: map_2(f,nil_0()) -> nil_0() r11: map_2(f,cons_2(h,t)) -> cons_2(app(f,h),map_2(f,t)) r12: fmap_2(nil_0(),x) -> nil_0() r13: fmap_2(cons_2(f,t_f_0()),x) -> cons_2(app(f,x),fmap_2(t_f_0(),x)) The estimated dependency graph contains the following SCCs: {p4} {p1, p2, p5} -- Reduction pair. Consider the dependency pair problem (P, R), where P consists of p1: map_2#(f,cons_2(h,t)) -> map_2#(f,t) and R consists of: r1: app(cons_0(),y) -> cons_1(y) r2: app(cons_1(x1),y) -> cons_2(x1,y) r3: app(fmap_0(),y) -> fmap_1(y) r4: app(fmap_1(x1),y) -> fmap_2(x1,y) r5: app(map_0(),y) -> map_1(y) r6: app(map_1(x1),y) -> map_2(x1,y) r7: app(twice_0(),y) -> twice_1(y) r8: app(twice_1(x1),y) -> twice_2(x1,y) r9: twice_2(f,x) -> app(f,app(f,x)) r10: map_2(f,nil_0()) -> nil_0() r11: map_2(f,cons_2(h,t)) -> cons_2(app(f,h),map_2(f,t)) r12: fmap_2(nil_0(),x) -> nil_0() r13: fmap_2(cons_2(f,t_f_0()),x) -> cons_2(app(f,x),fmap_2(t_f_0(),x)) The set of usable rules consists of r1, r3, r5, r7, r12 Take the reduction pair: generalized weighted path order (>=MG, >MG) base order 1: max/plus interpretation on natural numbers: map_2#_A(x1,x2) = max{x1 + 5, x2 + 12} cons_2_A(x1,x2) = max{3, x1 - 7, x2 + 1} app_A(x1,x2) = max{5, x1 - 14, x2 - 6} cons_0_A = 1 cons_1_A(x1) = max{2, x1 - 7} fmap_0_A = 3 fmap_1_A(x1) = max{4, x1 - 7} map_0_A = 2 map_1_A(x1) = max{3, x1 - 7} twice_0_A = 3 twice_1_A(x1) = max{4, x1 - 7} fmap_2_A(x1,x2) = max{6, x1 - 6, x2 - 3} nil_0_A = 0 base order 2: precedence: fmap_2 > map_2# = app > cons_2 = fmap_1 = twice_1 > cons_1 = fmap_0 = map_1 = twice_0 = nil_0 > cons_0 = map_0 partial status: pi(map_2#) = [2] pi(cons_2) = [2] pi(app) = [] pi(cons_0) = [] pi(cons_1) = [] pi(fmap_0) = [] pi(fmap_1) = [] pi(map_0) = [] pi(map_1) = [] pi(twice_0) = [] pi(twice_1) = [] pi(fmap_2) = [] pi(nil_0) = [] 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#(twice_1(x1),y) -> twice_2#(x1,y) p2: twice_2#(f,x) -> app#(f,x) p3: twice_2#(f,x) -> app#(f,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(fmap_0(),y) -> fmap_1(y) r4: app(fmap_1(x1),y) -> fmap_2(x1,y) r5: app(map_0(),y) -> map_1(y) r6: app(map_1(x1),y) -> map_2(x1,y) r7: app(twice_0(),y) -> twice_1(y) r8: app(twice_1(x1),y) -> twice_2(x1,y) r9: twice_2(f,x) -> app(f,app(f,x)) r10: map_2(f,nil_0()) -> nil_0() r11: map_2(f,cons_2(h,t)) -> cons_2(app(f,h),map_2(f,t)) r12: fmap_2(nil_0(),x) -> nil_0() r13: fmap_2(cons_2(f,t_f_0()),x) -> cons_2(app(f,x),fmap_2(t_f_0(),x)) The set of usable rules consists of r1, r3, r5, r12 Take the reduction pair: generalized weighted path order (>=MG, >MG) base order 1: max/plus interpretation on natural numbers: app#_A(x1,x2) = x1 + 2 twice_1_A(x1) = max{2, x1} twice_2#_A(x1,x2) = max{4, x1 + 2} app_A(x1,x2) = 3 cons_0_A = 2 cons_1_A(x1) = 1 fmap_0_A = 2 fmap_1_A(x1) = 1 map_0_A = 3 map_1_A(x1) = 2 fmap_2_A(x1,x2) = max{8, x1 - 10, x2 - 3} nil_0_A = 0 base order 2: precedence: fmap_2 > app# = twice_2# > twice_1 > app = cons_0 = fmap_0 = map_0 = nil_0 > cons_1 = fmap_1 = map_1 partial status: pi(app#) = [1] pi(twice_1) = [1] pi(twice_2#) = [1] pi(app) = [] pi(cons_0) = [] pi(cons_1) = [] pi(fmap_0) = [] pi(fmap_1) = [] pi(map_0) = [] pi(map_1) = [] pi(fmap_2) = [] pi(nil_0) = [] The following rules are removed: p1 -- SCC decomposition. Consider the dependency pair problem (P, R), where P consists of p1: twice_2#(f,x) -> app#(f,x) p2: twice_2#(f,x) -> app#(f,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(fmap_0(),y) -> fmap_1(y) r4: app(fmap_1(x1),y) -> fmap_2(x1,y) r5: app(map_0(),y) -> map_1(y) r6: app(map_1(x1),y) -> map_2(x1,y) r7: app(twice_0(),y) -> twice_1(y) r8: app(twice_1(x1),y) -> twice_2(x1,y) r9: twice_2(f,x) -> app(f,app(f,x)) r10: map_2(f,nil_0()) -> nil_0() r11: map_2(f,cons_2(h,t)) -> cons_2(app(f,h),map_2(f,t)) r12: fmap_2(nil_0(),x) -> nil_0() r13: fmap_2(cons_2(f,t_f_0()),x) -> cons_2(app(f,x),fmap_2(t_f_0(),x)) The estimated dependency graph contains the following SCCs: (no SCCs)