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) -- 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) 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) The estimated dependency graph contains the following SCCs: {p1, p2, p3, p4, p5, p7, p8, p9, p10} -- 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) 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: foldB#_A(x1,x2) = ((1,0),(0,0)) x1 + ((1,0),(1,1)) x2 + (20,1) s_A(x1) = ((1,0),(1,1)) x1 + (34,24) f#_A(x1,x2) = ((1,0),(1,0)) x1 + ((1,0),(0,0)) x2 + (2,20) foldB_A(x1,x2) = ((1,0),(0,0)) x1 + ((1,0),(1,1)) x2 + (5,60) B_A() = (33,119) |f'|#_A(x1,x2) = x1 + x2 g_A(x1) = ((1,0),(1,1)) x1 + (1,1) triple_A(x1,x2,x3) = ((1,0),(1,1)) x2 + ((1,0),(0,0)) x3 + (4,23) A_A() = (26,39) |0|_A() = (5,63) |f''|#_A(x1) = x1 + (15,1) foldC#_A(x1,x2) = ((1,0),(0,0)) x1 + ((1,0),(0,0)) x2 + (9,22) foldC_A(x1,x2) = x1 + ((1,0),(1,1)) x2 + (1,23) C_A() = (39,25) |f''|_A(x1) = ((1,0),(0,0)) x1 + (7,64) |f'|_A(x1,x2) = x1 + ((0,0),(1,0)) x2 + (34,16) f_A(x1,x2) = x1 + ((0,0),(1,0)) x2 + (34,18) precedence: |f'|# > s > B = g > triple = |f''|# > foldB > |f'| > |f''| > foldB# = A = |0| = C > foldC# = foldC > f# > f partial status: pi(foldB#) = [] pi(s) = [1] pi(f#) = [] pi(foldB) = [2] pi(B) = [] pi(|f'|#) = [] pi(g) = [1] pi(triple) = [] pi(A) = [] pi(|0|) = [] pi(|f''|#) = [1] pi(foldC#) = [] pi(foldC) = [2] pi(C) = [] pi(|f''|) = [] pi(|f'|) = [1] pi(f) = [] 2. weighted path order base order: matrix interpretations: carrier: N^2 order: lexicographic order interpretations: foldB#_A(x1,x2) = (1,2) s_A(x1) = (9,9) f#_A(x1,x2) = (8,1) foldB_A(x1,x2) = x2 + (22,11) B_A() = (6,5) |f'|#_A(x1,x2) = (3,3) g_A(x1) = (7,6) triple_A(x1,x2,x3) = (21,22) A_A() = (4,4) |0|_A() = (1,2) |f''|#_A(x1) = (2,9) foldC#_A(x1,x2) = (22,8) foldC_A(x1,x2) = x2 + (10,0) C_A() = (5,7) |f''|_A(x1) = (2,3) |f'|_A(x1,x2) = (10,10) f_A(x1,x2) = (20,21) precedence: g > f# > s > foldC > foldB > |f'|# = triple = |0| = |f''|# = foldC# > |f''| > |f'| > f > foldB# = B > A > C 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, p3, p4, p6, p8, p9 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()) -> |f''|#(foldB(triple(s(a),|0|(),c),b)) p3: 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) The estimated dependency graph contains the following SCCs: {p3} -- 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) The set of usable rules consists of (no rules) Take the reduction pair: lexicographic combination of reduction pairs: 1. weighted path order base order: matrix interpretations: carrier: N^2 order: lexicographic order interpretations: foldC#_A(x1,x2) = ((0,0),(1,0)) x2 s_A(x1) = ((1,0),(1,0)) x1 + (1,1) precedence: s > foldC# partial status: pi(foldC#) = [] pi(s) = [] 2. weighted path order base order: matrix interpretations: carrier: N^2 order: lexicographic order interpretations: foldC#_A(x1,x2) = (0,0) s_A(x1) = (1,1) precedence: s > foldC# partial status: pi(foldC#) = [] pi(s) = [] The next rules are strictly ordered: p1 We remove them from the problem. Then no dependency pair remains.