YES We show the termination of the TRS R: g(A()) -> A() g(B()) -> A() g(B()) -> B() g(C()) -> A() g(C()) -> B() g(C()) -> C() foldf(x,nil()) -> x foldf(x,cons(y,z)) -> f(foldf(x,z),y) f(t,x) -> |f'|(t,g(x)) |f'|(triple(a,b,c),C()) -> triple(a,b,cons(C(),c)) |f'|(triple(a,b,c),B()) -> f(triple(a,b,c),A()) |f'|(triple(a,b,c),A()) -> |f''|(foldf(triple(cons(A(),a),nil(),c),b)) |f''|(triple(a,b,c)) -> foldf(triple(a,b,nil()),c) -- SCC decomposition. Consider the dependency pair problem (P, R), where P consists of p1: foldf#(x,cons(y,z)) -> f#(foldf(x,z),y) p2: foldf#(x,cons(y,z)) -> foldf#(x,z) p3: f#(t,x) -> |f'|#(t,g(x)) p4: f#(t,x) -> g#(x) p5: |f'|#(triple(a,b,c),B()) -> f#(triple(a,b,c),A()) p6: |f'|#(triple(a,b,c),A()) -> |f''|#(foldf(triple(cons(A(),a),nil(),c),b)) p7: |f'|#(triple(a,b,c),A()) -> foldf#(triple(cons(A(),a),nil(),c),b) p8: |f''|#(triple(a,b,c)) -> foldf#(triple(a,b,nil()),c) and R consists of: r1: g(A()) -> A() r2: g(B()) -> A() r3: g(B()) -> B() r4: g(C()) -> A() r5: g(C()) -> B() r6: g(C()) -> C() r7: foldf(x,nil()) -> x r8: foldf(x,cons(y,z)) -> f(foldf(x,z),y) r9: f(t,x) -> |f'|(t,g(x)) r10: |f'|(triple(a,b,c),C()) -> triple(a,b,cons(C(),c)) r11: |f'|(triple(a,b,c),B()) -> f(triple(a,b,c),A()) r12: |f'|(triple(a,b,c),A()) -> |f''|(foldf(triple(cons(A(),a),nil(),c),b)) r13: |f''|(triple(a,b,c)) -> foldf(triple(a,b,nil()),c) The estimated dependency graph contains the following SCCs: {p1, p2, p3, p5, p6, p7, p8} -- Reduction pair. Consider the dependency pair problem (P, R), where P consists of p1: foldf#(x,cons(y,z)) -> f#(foldf(x,z),y) p2: f#(t,x) -> |f'|#(t,g(x)) p3: |f'|#(triple(a,b,c),A()) -> foldf#(triple(cons(A(),a),nil(),c),b) p4: foldf#(x,cons(y,z)) -> foldf#(x,z) p5: |f'|#(triple(a,b,c),A()) -> |f''|#(foldf(triple(cons(A(),a),nil(),c),b)) p6: |f''|#(triple(a,b,c)) -> foldf#(triple(a,b,nil()),c) p7: |f'|#(triple(a,b,c),B()) -> f#(triple(a,b,c),A()) and R consists of: r1: g(A()) -> A() r2: g(B()) -> A() r3: g(B()) -> B() r4: g(C()) -> A() r5: g(C()) -> B() r6: g(C()) -> C() r7: foldf(x,nil()) -> x r8: foldf(x,cons(y,z)) -> f(foldf(x,z),y) r9: f(t,x) -> |f'|(t,g(x)) r10: |f'|(triple(a,b,c),C()) -> triple(a,b,cons(C(),c)) r11: |f'|(triple(a,b,c),B()) -> f(triple(a,b,c),A()) r12: |f'|(triple(a,b,c),A()) -> |f''|(foldf(triple(cons(A(),a),nil(),c),b)) r13: |f''|(triple(a,b,c)) -> foldf(triple(a,b,nil()),c) The set of usable rules consists of r1, r2, r3, r4, r5, r6, r7, r8, r9, r10, r11, r12, r13 Take the reduction pair: lexicographic combination of reduction pairs: 1. matrix interpretations: carrier: N^1 order: standard order interpretations: foldf#_A(x1,x2) = x1 + x2 cons_A(x1,x2) = x2 + 7 f#_A(x1,x2) = x1 + 5 foldf_A(x1,x2) = x1 + x2 + 1 |f'|#_A(x1,x2) = x1 + 5 g_A(x1) = x1 + 1 triple_A(x1,x2,x3) = x2 + x3 + 1 A_A() = 2 nil_A() = 1 |f''|#_A(x1) = x1 + 2 B_A() = 1 |f''|_A(x1) = x1 + 3 |f'|_A(x1,x2) = x1 + 7 C_A() = 1 f_A(x1,x2) = x1 + 7 2. lexicographic path order with precedence: precedence: g > f > A > triple > B > cons > C > nil > foldf > |f''| > |f'| > f# > |f''|# > |f'|# > foldf# argument filter: pi(foldf#) = 2 pi(cons) = 2 pi(f#) = 1 pi(foldf) = 2 pi(|f'|#) = 1 pi(g) = [1] pi(triple) = [2, 3] pi(A) = [] pi(nil) = [] pi(|f''|#) = [1] pi(B) = [] pi(|f''|) = [] pi(|f'|) = 1 pi(C) = [] pi(f) = 1 The next rules are strictly ordered: p1, p3, p4, p5, p6 We remove them from the problem. -- SCC decomposition. Consider the dependency pair problem (P, R), where P consists of p1: f#(t,x) -> |f'|#(t,g(x)) p2: |f'|#(triple(a,b,c),B()) -> f#(triple(a,b,c),A()) and R consists of: r1: g(A()) -> A() r2: g(B()) -> A() r3: g(B()) -> B() r4: g(C()) -> A() r5: g(C()) -> B() r6: g(C()) -> C() r7: foldf(x,nil()) -> x r8: foldf(x,cons(y,z)) -> f(foldf(x,z),y) r9: f(t,x) -> |f'|(t,g(x)) r10: |f'|(triple(a,b,c),C()) -> triple(a,b,cons(C(),c)) r11: |f'|(triple(a,b,c),B()) -> f(triple(a,b,c),A()) r12: |f'|(triple(a,b,c),A()) -> |f''|(foldf(triple(cons(A(),a),nil(),c),b)) r13: |f''|(triple(a,b,c)) -> foldf(triple(a,b,nil()),c) The estimated dependency graph contains the following SCCs: {p1, p2} -- Reduction pair. Consider the dependency pair problem (P, R), where P consists of p1: f#(t,x) -> |f'|#(t,g(x)) p2: |f'|#(triple(a,b,c),B()) -> f#(triple(a,b,c),A()) and R consists of: r1: g(A()) -> A() r2: g(B()) -> A() r3: g(B()) -> B() r4: g(C()) -> A() r5: g(C()) -> B() r6: g(C()) -> C() r7: foldf(x,nil()) -> x r8: foldf(x,cons(y,z)) -> f(foldf(x,z),y) r9: f(t,x) -> |f'|(t,g(x)) r10: |f'|(triple(a,b,c),C()) -> triple(a,b,cons(C(),c)) r11: |f'|(triple(a,b,c),B()) -> f(triple(a,b,c),A()) r12: |f'|(triple(a,b,c),A()) -> |f''|(foldf(triple(cons(A(),a),nil(),c),b)) r13: |f''|(triple(a,b,c)) -> foldf(triple(a,b,nil()),c) The set of usable rules consists of r1, r2, r3, r4, r5, r6 Take the reduction pair: lexicographic combination of reduction pairs: 1. matrix interpretations: carrier: N^1 order: standard order interpretations: f#_A(x1,x2) = x1 + x2 + 2 |f'|#_A(x1,x2) = x1 + x2 g_A(x1) = x1 + 1 triple_A(x1,x2,x3) = x1 + x2 + x3 + 1 B_A() = 4 A_A() = 1 C_A() = 4 2. lexicographic path order with precedence: precedence: A > B > C > |f'|# > triple > g > f# argument filter: pi(f#) = [1, 2] pi(|f'|#) = [1] pi(g) = [1] pi(triple) = [1, 3] pi(B) = [] pi(A) = [] pi(C) = [] The next rules are strictly ordered: p1, p2 We remove them from the problem. Then no dependency pair remains.