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: lexicographic combination of reduction pairs: 1. weighted path order base order: max/plus interpretations on natural numbers: fold#_A(x1,x2,x3) = max{2, x1, x2, x3 + 1} s_A(x1) = max{1, x1} precedence: fold# = s partial status: pi(fold#) = [1, 2, 3] pi(s) = [1] 2. weighted path order base order: max/plus interpretations on natural numbers: fold#_A(x1,x2,x3) = max{x1 + 1, x2 + 1, x3 - 1} s_A(x1) = x1 precedence: fold# = s partial status: pi(fold#) = [] pi(s) = [1] The next rules are strictly ordered: p1 We remove them from the problem. 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: lexicographic combination of reduction pairs: 1. weighted path order base order: max/plus interpretations on natural numbers: foldB#_A(x1,x2) = max{x1 - 15, x2 + 37} s_A(x1) = max{173, x1 + 32} f#_A(x1,x2) = max{x1 - 21, x2 + 68} foldB_A(x1,x2) = max{x1, x2 + 57} B_A = 0 |f'|#_A(x1,x2) = max{x1 - 21, x2 + 68} g_A(x1) = max{0, x1 - 1} triple_A(x1,x2,x3) = max{79, x2 + 67} A_A = 0 |0|_A = 1 |f''|#_A(x1) = max{62, x1 - 11} foldC#_A(x1,x2) = max{68, x1 - 18} foldC_A(x1,x2) = max{89, x1 + 2} C_A = 0 |f''|_A(x1) = max{80, x1 + 10} |f'|_A(x1,x2) = max{x1, x2 + 89} f_A(x1,x2) = max{x1, x2 + 89} precedence: foldB > foldC = |f''| = |f'| = f > foldB# = f# = |f'|# = triple = |f''|# = foldC# > g > B > s = A = |0| = C partial status: pi(foldB#) = [] pi(s) = [] pi(f#) = [] pi(foldB) = [1] pi(B) = [] pi(|f'|#) = [] pi(g) = [] pi(triple) = [] pi(A) = [] pi(|0|) = [] pi(|f''|#) = [] pi(foldC#) = [] pi(foldC) = [] pi(C) = [] pi(|f''|) = [] pi(|f'|) = [] pi(f) = [] 2. weighted path order base order: max/plus interpretations on natural numbers: foldB#_A(x1,x2) = 78 s_A(x1) = 77 f#_A(x1,x2) = 78 foldB_A(x1,x2) = 76 B_A = 68 |f'|#_A(x1,x2) = 78 g_A(x1) = 74 triple_A(x1,x2,x3) = 76 A_A = 67 |0|_A = 66 |f''|#_A(x1) = 78 foldC#_A(x1,x2) = 78 foldC_A(x1,x2) = 76 C_A = 71 |f''|_A(x1) = 76 |f'|_A(x1,x2) = 76 f_A(x1,x2) = 76 precedence: foldB > B = g > C > foldB# = f# = |f'|# = A = |f''|# = foldC# > foldC = |f''| = |f'| = f > s > |0| > triple partial status: pi(foldB#) = [] pi(s) = [] pi(f#) = [] pi(foldB) = [] pi(B) = [] pi(|f'|#) = [] pi(g) = [] pi(triple) = [] pi(A) = [] pi(|0|) = [] pi(|f''|#) = [] pi(foldC#) = [] pi(foldC) = [] pi(C) = [] pi(|f''|) = [] pi(|f'|) = [] pi(f) = [] The next rules are strictly ordered: p1 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),A()) -> foldB#(triple(s(a),|0|(),c),b) p3: foldB#(t,s(n)) -> foldB#(t,n) p4: |f'|#(triple(a,b,c),A()) -> |f''|#(foldB(triple(s(a),|0|(),c),b)) p5: |f''|#(triple(a,b,c)) -> foldC#(triple(a,b,|0|()),c) p6: foldC#(t,s(n)) -> foldC#(t,n) p7: foldC#(t,s(n)) -> f#(foldC(t,n),C()) p8: |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, p4, p5, p6, p7, p8} {p3} -- 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()) p3: |f'|#(triple(a,b,c),A()) -> |f''|#(foldB(triple(s(a),|0|(),c),b)) p4: |f''|#(triple(a,b,c)) -> foldC#(triple(a,b,|0|()),c) p5: foldC#(t,s(n)) -> f#(foldC(t,n),C()) p6: foldC#(t,s(n)) -> foldC#(t,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 r1, r2, r3, r4, r5, r6, r7, r8, r9, r10, r11, r12, r13, r14, r15 Take the reduction pair: lexicographic combination of reduction pairs: 1. weighted path order base order: matrix interpretations: carrier: N^2 order: lexicographic order interpretations: f#_A(x1,x2) = ((1,0),(1,0)) x1 + ((1,0),(1,0)) x2 + (40,29) |f'|#_A(x1,x2) = ((1,0),(1,0)) x1 + x2 + (36,23) g_A(x1) = ((1,0),(1,0)) x1 + (3,1) triple_A(x1,x2,x3) = ((1,0),(0,0)) x2 + ((1,0),(0,0)) x3 + (0,6) B_A() = (11,11) A_A() = (6,0) |f''|#_A(x1) = ((1,0),(1,1)) x1 + (39,2) foldB_A(x1,x2) = ((1,0),(0,0)) x1 + ((1,0),(0,0)) x2 + (1,18) s_A(x1) = ((1,0),(1,1)) x1 + (36,0) |0|_A() = (1,7) foldC#_A(x1,x2) = ((1,0),(1,0)) x1 + ((1,0),(1,0)) x2 + (37,4) foldC_A(x1,x2) = x1 + ((1,0),(0,0)) x2 + (1,41) C_A() = (9,1) |f''|_A(x1) = x1 + (3,42) |f'|_A(x1,x2) = ((1,0),(0,0)) x1 + ((0,0),(1,0)) x2 + (36,2) f_A(x1,x2) = ((1,0),(0,0)) x1 + ((0,0),(1,0)) x2 + (36,6) precedence: |0| = foldC > f# = |f'|# = |f''|# > foldB = foldC# > s = |f'| = f > g = C > A > triple = B = |f''| partial status: pi(f#) = [] pi(|f'|#) = [2] pi(g) = [] pi(triple) = [] pi(B) = [] pi(A) = [] pi(|f''|#) = [] pi(foldB) = [] pi(s) = [1] pi(|0|) = [] pi(foldC#) = [] pi(foldC) = [] pi(C) = [] pi(|f''|) = [1] pi(|f'|) = [] pi(f) = [] 2. weighted path order base order: matrix interpretations: carrier: N^2 order: lexicographic order interpretations: f#_A(x1,x2) = (10,17) |f'|#_A(x1,x2) = ((1,0),(1,1)) x2 + (1,1) g_A(x1) = (8,7) triple_A(x1,x2,x3) = (3,4) B_A() = (11,6) A_A() = (6,5) |f''|#_A(x1) = (5,6) foldB_A(x1,x2) = (5,1) s_A(x1) = (2,0) |0|_A() = (2,0) foldC#_A(x1,x2) = (1,0) foldC_A(x1,x2) = (8,2) C_A() = (7,1) |f''|_A(x1) = x1 + (0,1) |f'|_A(x1,x2) = (4,3) f_A(x1,x2) = (4,3) precedence: foldB > f# = foldC > |f'|# = g = B = |0| = |f'| = f > A = |f''| > triple > |f''|# = s = foldC# = C partial status: pi(f#) = [] pi(|f'|#) = [2] pi(g) = [] pi(triple) = [] pi(B) = [] pi(A) = [] pi(|f''|#) = [] pi(foldB) = [] pi(s) = [] pi(|0|) = [] pi(foldC#) = [] pi(foldC) = [] pi(C) = [] pi(|f''|) = [] pi(|f'|) = [] pi(f) = [] The next rules are strictly ordered: p1, p2, p3, p5 We remove them from the problem. -- SCC decomposition. Consider the dependency pair problem (P, R), where P consists of p1: |f''|#(triple(a,b,c)) -> foldC#(triple(a,b,|0|()),c) p2: foldC#(t,s(n)) -> foldC#(t,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: {p2} -- Reduction pair. Consider the dependency pair problem (P, R), where P consists of p1: foldC#(t,s(n)) -> foldC#(t,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: lexicographic combination of reduction pairs: 1. weighted path order base order: max/plus interpretations on natural numbers: foldC#_A(x1,x2) = max{2, x1, x2 + 1} s_A(x1) = max{1, x1} precedence: foldC# = s partial status: pi(foldC#) = [1, 2] pi(s) = [1] 2. weighted path order base order: max/plus interpretations on natural numbers: foldC#_A(x1,x2) = max{x1, x2 - 1} s_A(x1) = x1 precedence: foldC# = s partial status: pi(foldC#) = [1] pi(s) = [1] The next rules are strictly ordered: p1 We remove them from the problem. Then no dependency pair remains. -- Reduction pair. Consider the dependency pair problem (P, R), where P consists of p1: foldB#(t,s(n)) -> foldB#(t,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: lexicographic combination of reduction pairs: 1. weighted path order base order: max/plus interpretations on natural numbers: foldB#_A(x1,x2) = max{2, x1, x2 + 1} s_A(x1) = max{1, x1} precedence: foldB# = s partial status: pi(foldB#) = [1, 2] pi(s) = [1] 2. weighted path order base order: max/plus interpretations on natural numbers: foldB#_A(x1,x2) = max{x1, x2 - 1} s_A(x1) = x1 precedence: foldB# = s partial status: pi(foldB#) = [1] pi(s) = [1] The next rules are strictly ordered: p1 We remove them from the problem. Then no dependency pair remains.