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