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: 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!): matrix interpretation with standard point-wise order: carrier: N^1 order: standard order interpretations: fold#_A(x1,x2,x3) = x3 s_A(x1) = x1 + 2 fold#!_A(x1,x2,x3) = 0 s!_A(x1) = 3 2. marked-algebra reduction triple (>=A, >=A!, >A!): max/plus interpretation on natural numbers: fold#_A(x1,x2,x3) = x3 s_A(x1) = x1 + 4 fold#!_A(x1,x2,x3) = max{4, x1 - 1, x2 - 1} s!_A(x1) = max{3, x1 - 1} partial status: pi(fold#) = [3] 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 r7, r8, r9, r10, r11, r12, r13, r14, r15 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!): matrix interpretation with standard point-wise order: carrier: N^1 order: standard order interpretations: foldB#_A(x1,x2) = 0 s_A(x1) = x1 + 8 f#_A(x1,x2) = 0 foldB_A(x1,x2) = x1 + x2 + 1 B_A() = 4 |f'|#_A(x1,x2) = 0 g_A(x1) = 1 triple_A(x1,x2,x3) = x2 + x3 + 11 A_A() = 2 |0|_A() = 0 |f''|#_A(x1) = 0 foldC#_A(x1,x2) = 0 foldC_A(x1,x2) = x1 + x2 + 1 C_A() = 4 f_A(x1,x2) = x1 + 8 |f'|_A(x1,x2) = x1 + 8 |f''|_A(x1) = x1 + 1 foldB#!_A(x1,x2) = x1 + x2 + 5 s!_A(x1) = x1 + 22 f#!_A(x1,x2) = x1 + 7 foldB!_A(x1,x2) = x1 + x2 + 3 B!_A() = 12 |f'|#!_A(x1,x2) = x1 + 7 g!_A(x1) = x1 + 14 triple!_A(x1,x2,x3) = x2 + x3 + 12 A!_A() = 17 |0|!_A() = 22 |f''|#!_A(x1) = x1 foldC#!_A(x1,x2) = x1 + x2 foldC!_A(x1,x2) = x1 + x2 + 5 C!_A() = 13 f!_A(x1,x2) = x1 + 10 |f'|!_A(x1,x2) = x1 + 10 |f''|!_A(x1) = x1 + 6 2. marked-algebra reduction triple (>=A, >=A!, >A!): max/plus interpretation on natural numbers: foldB#_A(x1,x2) = 4 s_A(x1) = 4 f#_A(x1,x2) = max{4, x2} foldB_A(x1,x2) = max{10, x1} B_A = 4 |f'|#_A(x1,x2) = 4 g_A(x1) = 76 triple_A(x1,x2,x3) = max{10, x1 - 68, x3 - 66} A_A = 2 |0|_A = 27 |f''|#_A(x1) = 4 foldC#_A(x1,x2) = 4 foldC_A(x1,x2) = max{10, x1} C_A = 4 f_A(x1,x2) = max{10, x1, x2 - 70} |f'|_A(x1,x2) = max{10, x1} |f''|_A(x1) = max{9, x1} foldB#!_A(x1,x2) = max{132, x1 + 64} s!_A(x1) = max{133, x1 - 150} f#!_A(x1,x2) = max{0, x1 - 1} foldB!_A(x1,x2) = max{132, x2 + 131} B!_A = 0 |f'|#!_A(x1,x2) = max{0, x1 - 1} g!_A(x1) = x1 + 129 triple!_A(x1,x2,x3) = max{x1 + 4, x2 - 28, x3 + 131} A!_A = 132 |0|!_A = 136 |f''|#!_A(x1) = x1 + 89 foldC#!_A(x1,x2) = x1 + 10 foldC!_A(x1,x2) = max{135, x1 + 91} C!_A = 10 f!_A(x1,x2) = max{134, x2 + 2} |f'|!_A(x1,x2) = 134 |f''|!_A(x1) = max{135, x1 + 120} partial status: pi(foldB#) = [1] pi(s) = [] pi(f#) = [] pi(foldB) = [1] pi(B) = [] pi(|f'|#) = [] pi(g) = [1] pi(triple) = [] pi(A) = [] pi(|0|) = [] pi(|f''|#) = [] pi(foldC#) = [] pi(foldC) = [1] pi(C) = [] pi(f) = [] pi(|f'|) = [] pi(|f''|) = [] The following rules are removed: p1, p3, p4, p5, p6, p7, p8 -- 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: 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: {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: 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 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!): matrix interpretation with standard point-wise order: carrier: N^1 order: standard order interpretations: f#_A(x1,x2) = x1 |f'|#_A(x1,x2) = x1 g_A(x1) = x1 + 1 triple_A(x1,x2,x3) = x1 + x2 + x3 + 7 B_A() = 4 A_A() = 1 C_A() = 3 f#!_A(x1,x2) = x2 + 3 |f'|#!_A(x1,x2) = x2 + 1 g!_A(x1) = 8 triple!_A(x1,x2,x3) = 6 B!_A() = 3 A!_A() = 2 C!_A() = 7 2. marked-algebra reduction triple (>=A, >=A!, >A!): max/plus interpretation on natural numbers: f#_A(x1,x2) = max{0, x1 - 27, x2 - 18} |f'|#_A(x1,x2) = max{0, x1 - 27, x2 - 59} g_A(x1) = max{58, x1 - 54} triple_A(x1,x2,x3) = max{25, x1 + 23, x2 - 18, x3 + 22} B_A = 53 A_A = 17 C_A = 0 f#!_A(x1,x2) = max{x1 + 36, x2 + 3} |f'|#!_A(x1,x2) = max{2, x1 - 1, x2 - 59} g!_A(x1) = max{37, x1 - 1} triple!_A(x1,x2,x3) = max{x1 + 14, x2 + 17} B!_A = 19 A!_A = 15 C!_A = 20 partial status: pi(f#) = [1] pi(|f'|#) = [1] pi(g) = [] pi(triple) = [] pi(B) = [] pi(A) = [] pi(C) = [] The following rules are removed: p1, p2 Then no dependency pair remains.