YES We show the termination of the TRS R: f(|0|()) -> true() f(|1|()) -> false() f(s(x)) -> f(x) if(true(),x,y) -> x if(false(),x,y) -> y g(s(x),s(y)) -> if(f(x),s(x),s(y)) g(x,c(y)) -> g(x,g(s(c(y)),y)) -- SCC decomposition. Consider the dependency pair problem (P, R), where P consists of p1: f#(s(x)) -> f#(x) p2: g#(s(x),s(y)) -> if#(f(x),s(x),s(y)) p3: g#(s(x),s(y)) -> f#(x) p4: g#(x,c(y)) -> g#(x,g(s(c(y)),y)) p5: g#(x,c(y)) -> g#(s(c(y)),y) and R consists of: r1: f(|0|()) -> true() r2: f(|1|()) -> false() r3: f(s(x)) -> f(x) r4: if(true(),x,y) -> x r5: if(false(),x,y) -> y r6: g(s(x),s(y)) -> if(f(x),s(x),s(y)) r7: g(x,c(y)) -> g(x,g(s(c(y)),y)) The estimated dependency graph contains the following SCCs: {p4, p5} {p1} -- Reduction pair. Consider the dependency pair problem (P, R), where P consists of p1: g#(x,c(y)) -> g#(s(c(y)),y) p2: g#(x,c(y)) -> g#(x,g(s(c(y)),y)) and R consists of: r1: f(|0|()) -> true() r2: f(|1|()) -> false() r3: f(s(x)) -> f(x) r4: if(true(),x,y) -> x r5: if(false(),x,y) -> y r6: g(s(x),s(y)) -> if(f(x),s(x),s(y)) r7: g(x,c(y)) -> g(x,g(s(c(y)),y)) The set of usable rules consists of r1, r2, r3, r4, r5, r6, r7 Take the reduction pair: lexicographic combination of reduction pairs: 1. weighted path order base order: max/plus interpretations on natural numbers: g#_A(x1,x2) = max{x1 + 2, x2 + 4} c_A(x1) = x1 + 8 s_A(x1) = 0 g_A(x1,x2) = x2 + 7 f_A(x1) = 4 |0|_A = 4 true_A = 0 |1|_A = 0 false_A = 1 if_A(x1,x2,x3) = max{x1 + 2, x2 + 7, x3 + 4} precedence: g# = c = true = false > g > f = |0| = |1| > if > s partial status: pi(g#) = [2] pi(c) = [1] pi(s) = [] pi(g) = [] pi(f) = [] pi(|0|) = [] pi(true) = [] pi(|1|) = [] pi(false) = [] pi(if) = [1, 2, 3] 2. weighted path order base order: max/plus interpretations on natural numbers: g#_A(x1,x2) = x2 + 20 c_A(x1) = max{18, x1 + 6} s_A(x1) = 22 g_A(x1,x2) = 5 f_A(x1) = 23 |0|_A = 23 true_A = 24 |1|_A = 23 false_A = 24 if_A(x1,x2,x3) = max{20, x1 - 1, x2 + 1, x3 + 1} precedence: g# = c = s = g = f = true = |1| > |0| = false > if partial status: pi(g#) = [] pi(c) = [1] pi(s) = [] pi(g) = [] pi(f) = [] pi(|0|) = [] pi(true) = [] pi(|1|) = [] pi(false) = [] pi(if) = [] The next rules are strictly ordered: p1, p2 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: f#(s(x)) -> f#(x) and R consists of: r1: f(|0|()) -> true() r2: f(|1|()) -> false() r3: f(s(x)) -> f(x) r4: if(true(),x,y) -> x r5: if(false(),x,y) -> y r6: g(s(x),s(y)) -> if(f(x),s(x),s(y)) r7: g(x,c(y)) -> g(x,g(s(c(y)),y)) 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: f#_A(x1) = max{4, x1 + 3} s_A(x1) = max{3, x1 + 2} precedence: f# = s partial status: pi(f#) = [1] pi(s) = [1] 2. weighted path order base order: max/plus interpretations on natural numbers: f#_A(x1) = max{1, x1 - 1} s_A(x1) = x1 precedence: f# = s partial status: pi(f#) = [] pi(s) = [1] The next rules are strictly ordered: p1 We remove them from the problem. Then no dependency pair remains.