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() foldB(t,|0|()) -> t foldB(t,s(n)) -> f(foldB(t,n),B()) foldC(t,|0|()) -> t foldC(t,s(n)) -> f(foldC(t,n),C()) f(t,x) -> |f'|(t,g(x)) |f'|(triple(a,b,c),C()) -> triple(a,b,s(c)) |f'|(triple(a,b,c),B()) -> f(triple(a,b,c),A()) |f'|(triple(a,b,c),A()) -> |f''|(foldB(triple(s(a),|0|(),c),b)) |f''|(triple(a,b,c)) -> foldC(triple(a,b,|0|()),c) fold(t,x,|0|()) -> t fold(t,x,s(n)) -> f(fold(t,x,n),x) -- SCC decomposition. Consider the dependency pair problem (P, R), where P consists of p1: foldB#(t,s(n)) -> f#(foldB(t,n),B()) p2: foldB#(t,s(n)) -> foldB#(t,n) p3: foldC#(t,s(n)) -> f#(foldC(t,n),C()) p4: foldC#(t,s(n)) -> foldC#(t,n) p5: f#(t,x) -> |f'|#(t,g(x)) p6: f#(t,x) -> g#(x) p7: |f'|#(triple(a,b,c),B()) -> f#(triple(a,b,c),A()) p8: |f'|#(triple(a,b,c),A()) -> |f''|#(foldB(triple(s(a),|0|(),c),b)) p9: |f'|#(triple(a,b,c),A()) -> foldB#(triple(s(a),|0|(),c),b) p10: |f''|#(triple(a,b,c)) -> foldC#(triple(a,b,|0|()),c) p11: fold#(t,x,s(n)) -> f#(fold(t,x,n),x) p12: fold#(t,x,s(n)) -> fold#(t,x,n) 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: foldB(t,|0|()) -> t r8: foldB(t,s(n)) -> f(foldB(t,n),B()) r9: foldC(t,|0|()) -> t r10: foldC(t,s(n)) -> f(foldC(t,n),C()) r11: f(t,x) -> |f'|(t,g(x)) r12: |f'|(triple(a,b,c),C()) -> triple(a,b,s(c)) r13: |f'|(triple(a,b,c),B()) -> f(triple(a,b,c),A()) r14: |f'|(triple(a,b,c),A()) -> |f''|(foldB(triple(s(a),|0|(),c),b)) r15: |f''|(triple(a,b,c)) -> foldC(triple(a,b,|0|()),c) r16: fold(t,x,|0|()) -> t r17: fold(t,x,s(n)) -> f(fold(t,x,n),x) The estimated dependency graph contains the following SCCs: {p12} {p1, p2, p3, p4, p5, p7, p8, p9, p10} -- Reduction pair. Consider the dependency pair problem (P, R), where P consists of p1: fold#(t,x,s(n)) -> fold#(t,x,n) 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: foldB(t,|0|()) -> t r8: foldB(t,s(n)) -> f(foldB(t,n),B()) r9: foldC(t,|0|()) -> t r10: foldC(t,s(n)) -> f(foldC(t,n),C()) r11: f(t,x) -> |f'|(t,g(x)) r12: |f'|(triple(a,b,c),C()) -> triple(a,b,s(c)) r13: |f'|(triple(a,b,c),B()) -> f(triple(a,b,c),A()) r14: |f'|(triple(a,b,c),A()) -> |f''|(foldB(triple(s(a),|0|(),c),b)) r15: |f''|(triple(a,b,c)) -> foldC(triple(a,b,|0|()),c) r16: fold(t,x,|0|()) -> t r17: fold(t,x,s(n)) -> f(fold(t,x,n),x) The set of usable rules consists of (no rules) Take the reduction pair: generalized weighted path order (>=MG, >G) base order 1: matrix interpretation with standard point-wise order: carrier: N^1 order: standard order interpretations: fold#_A(x1,x2,x3) = x1 + x2 + x3 + 7 s_A(x1) = x1 + 6 base order 2: marked-algebra reduction triple (>=A, >=A!, >A!): max/plus interpretation on natural numbers: fold#_A(x1,x2,x3) = x3 s_A(x1) = max{11, x1} fold#!_A(x1,x2,x3) = max{6, x1 - 1, x2 - 1, x3 - 12} s!_A(x1) = max{5, x1 - 187} partial status: pi(fold#) = [1] pi(s) = [1] 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: foldB#(t,s(n)) -> f#(foldB(t,n),B()) p2: f#(t,x) -> |f'|#(t,g(x)) p3: |f'|#(triple(a,b,c),A()) -> foldB#(triple(s(a),|0|(),c),b) p4: foldB#(t,s(n)) -> foldB#(t,n) p5: |f'|#(triple(a,b,c),A()) -> |f''|#(foldB(triple(s(a),|0|(),c),b)) p6: |f''|#(triple(a,b,c)) -> foldC#(triple(a,b,|0|()),c) p7: foldC#(t,s(n)) -> foldC#(t,n) p8: foldC#(t,s(n)) -> f#(foldC(t,n),C()) p9: |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: foldB(t,|0|()) -> t r8: foldB(t,s(n)) -> f(foldB(t,n),B()) r9: foldC(t,|0|()) -> t r10: foldC(t,s(n)) -> f(foldC(t,n),C()) r11: f(t,x) -> |f'|(t,g(x)) r12: |f'|(triple(a,b,c),C()) -> triple(a,b,s(c)) r13: |f'|(triple(a,b,c),B()) -> f(triple(a,b,c),A()) r14: |f'|(triple(a,b,c),A()) -> |f''|(foldB(triple(s(a),|0|(),c),b)) r15: |f''|(triple(a,b,c)) -> foldC(triple(a,b,|0|()),c) r16: fold(t,x,|0|()) -> t r17: fold(t,x,s(n)) -> f(fold(t,x,n),x) The set of usable rules consists of r1, r2, r3, r4, r5, r6, r7, r8, r9, r10, r11, r12, r13, r14, r15 Take the reduction pair: generalized weighted path order (>=MG, >G) base order 1: matrix interpretation with standard point-wise order: carrier: N^1 order: standard order interpretations: foldB#_A(x1,x2) = x1 + x2 + 10 s_A(x1) = x1 + 9 f#_A(x1,x2) = x1 + x2 + 8 foldB_A(x1,x2) = x1 + x2 B_A() = 7 |f'|#_A(x1,x2) = x1 + x2 + 7 g_A(x1) = x1 triple_A(x1,x2,x3) = x2 + x3 + 4 A_A() = 5 |0|_A() = 0 |f''|#_A(x1) = x1 + 11 foldC#_A(x1,x2) = x1 + x2 + 10 foldC_A(x1,x2) = x1 + x2 + 1 C_A() = 8 f_A(x1,x2) = x1 + x2 + 1 |f'|_A(x1,x2) = x1 + x2 + 1 |f''|_A(x1) = x1 + 2 base order 2: marked-algebra reduction triple (>=A, >=A!, >A!): max/plus interpretation on natural numbers: foldB#_A(x1,x2) = max{1, x1 - 72, x2 - 71} s_A(x1) = max{63, x1} f#_A(x1,x2) = max{1, x1 - 72, x2 - 13} foldB_A(x1,x2) = max{17, x1, x2 + 1} B_A = 6 |f'|#_A(x1,x2) = max{1, x1 - 72, x2 - 136} g_A(x1) = max{12, x1 - 7} triple_A(x1,x2,x3) = max{x1 - 126, x2 + 41, x3 - 64} A_A = 0 |0|_A = 0 |f''|#_A(x1) = max{1, x1 - 72} foldC#_A(x1,x2) = max{1, x1 - 72} foldC_A(x1,x2) = max{41, x1} C_A = 12 f_A(x1,x2) = max{x1, x2 + 29} |f'|_A(x1,x2) = max{x1, x2 + 17} |f''|_A(x1) = max{41, x1} foldB#!_A(x1,x2) = max{0, x2 - 67} s!_A(x1) = 3 f#!_A(x1,x2) = max{2, x2 - 9} foldB!_A(x1,x2) = max{0, x2 - 68} B!_A = 308 |f'|#!_A(x1,x2) = max{x1 + 265, x2 - 1} g!_A(x1) = max{310, x1 - 13} triple!_A(x1,x2,x3) = max{x1 - 140, x2 - 10, x3 + 31} A!_A = 307 |0|!_A = 138 |f''|#!_A(x1) = 308 foldC#!_A(x1,x2) = max{1, x1 - 77, x2 - 77} foldC!_A(x1,x2) = max{x1 + 310, x2 - 64} C!_A = 0 f!_A(x1,x2) = max{309, x1 + 125, x2 - 17} |f'|!_A(x1,x2) = max{x1 + 96, x2 - 11} |f''|!_A(x1) = max{110, x1 - 12} partial status: pi(foldB#) = [1, 2] pi(s) = [1] pi(f#) = [] pi(foldB) = [1] pi(B) = [] pi(|f'|#) = [1, 2] pi(g) = [] pi(triple) = [2] pi(A) = [] pi(|0|) = [] pi(|f''|#) = [1] pi(foldC#) = [2] pi(foldC) = [] pi(C) = [] pi(f) = [] pi(|f'|) = [] pi(|f''|) = [1] The following rules are removed: p1, p2, p3, p4, p5, p6, p7, p8, p9 Then no dependency pair remains.