YES We show the termination of the TRS R: minus(x,|0|()) -> x minus(s(x),s(y)) -> minus(x,y) quot(|0|(),s(y)) -> |0|() quot(s(x),s(y)) -> s(quot(minus(x,y),s(y))) plus(s(x),s(y)) -> s(s(plus(if(gt(x,y),x,y),if(not(gt(x,y)),id(x),id(y))))) plus(s(x),x) -> plus(if(gt(x,x),id(x),id(x)),s(x)) plus(zero(),y) -> y plus(id(x),s(y)) -> s(plus(x,if(gt(s(y),y),y,s(y)))) id(x) -> x if(true(),x,y) -> x if(false(),x,y) -> y not(x) -> if(x,false(),true()) gt(s(x),zero()) -> true() gt(zero(),y) -> false() gt(s(x),s(y)) -> gt(x,y) -- SCC decomposition. Consider the dependency pair problem (P, R), where P consists of p1: minus#(s(x),s(y)) -> minus#(x,y) p2: quot#(s(x),s(y)) -> quot#(minus(x,y),s(y)) p3: quot#(s(x),s(y)) -> minus#(x,y) p4: plus#(s(x),s(y)) -> plus#(if(gt(x,y),x,y),if(not(gt(x,y)),id(x),id(y))) p5: plus#(s(x),s(y)) -> if#(gt(x,y),x,y) p6: plus#(s(x),s(y)) -> gt#(x,y) p7: plus#(s(x),s(y)) -> if#(not(gt(x,y)),id(x),id(y)) p8: plus#(s(x),s(y)) -> not#(gt(x,y)) p9: plus#(s(x),s(y)) -> id#(x) p10: plus#(s(x),s(y)) -> id#(y) p11: plus#(s(x),x) -> plus#(if(gt(x,x),id(x),id(x)),s(x)) p12: plus#(s(x),x) -> if#(gt(x,x),id(x),id(x)) p13: plus#(s(x),x) -> gt#(x,x) p14: plus#(s(x),x) -> id#(x) p15: plus#(id(x),s(y)) -> plus#(x,if(gt(s(y),y),y,s(y))) p16: plus#(id(x),s(y)) -> if#(gt(s(y),y),y,s(y)) p17: plus#(id(x),s(y)) -> gt#(s(y),y) p18: not#(x) -> if#(x,false(),true()) p19: gt#(s(x),s(y)) -> gt#(x,y) and R consists of: r1: minus(x,|0|()) -> x r2: minus(s(x),s(y)) -> minus(x,y) r3: quot(|0|(),s(y)) -> |0|() r4: quot(s(x),s(y)) -> s(quot(minus(x,y),s(y))) r5: plus(s(x),s(y)) -> s(s(plus(if(gt(x,y),x,y),if(not(gt(x,y)),id(x),id(y))))) r6: plus(s(x),x) -> plus(if(gt(x,x),id(x),id(x)),s(x)) r7: plus(zero(),y) -> y r8: plus(id(x),s(y)) -> s(plus(x,if(gt(s(y),y),y,s(y)))) r9: id(x) -> x r10: if(true(),x,y) -> x r11: if(false(),x,y) -> y r12: not(x) -> if(x,false(),true()) r13: gt(s(x),zero()) -> true() r14: gt(zero(),y) -> false() r15: gt(s(x),s(y)) -> gt(x,y) The estimated dependency graph contains the following SCCs: {p2} {p1} {p4, p11, p15} {p19} -- Reduction pair. Consider the dependency pair problem (P, R), where P consists of p1: quot#(s(x),s(y)) -> quot#(minus(x,y),s(y)) and R consists of: r1: minus(x,|0|()) -> x r2: minus(s(x),s(y)) -> minus(x,y) r3: quot(|0|(),s(y)) -> |0|() r4: quot(s(x),s(y)) -> s(quot(minus(x,y),s(y))) r5: plus(s(x),s(y)) -> s(s(plus(if(gt(x,y),x,y),if(not(gt(x,y)),id(x),id(y))))) r6: plus(s(x),x) -> plus(if(gt(x,x),id(x),id(x)),s(x)) r7: plus(zero(),y) -> y r8: plus(id(x),s(y)) -> s(plus(x,if(gt(s(y),y),y,s(y)))) r9: id(x) -> x r10: if(true(),x,y) -> x r11: if(false(),x,y) -> y r12: not(x) -> if(x,false(),true()) r13: gt(s(x),zero()) -> true() r14: gt(zero(),y) -> false() r15: gt(s(x),s(y)) -> gt(x,y) The set of usable rules consists of r1, r2 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!): max/plus interpretation on natural numbers: quot#_A(x1,x2) = max{0, x1 - 24, x2 - 52} s_A(x1) = max{23, x1 + 7} minus_A(x1,x2) = max{21, x1 + 6, x2 - 21} |0|_A = 19 quot#!_A(x1,x2) = max{20, x2 + 14} s!_A(x1) = x1 + 38 minus!_A(x1,x2) = max{44, x1 - 24, x2 - 24} |0|!_A = 38 2. marked-algebra reduction triple (>=A, >=A!, >A!): matrix interpretation with standard point-wise order: carrier: N^1 order: standard order interpretations: quot#_A(x1,x2) = 0 s_A(x1) = x1 + 2 minus_A(x1,x2) = x1 + 1 |0|_A() = 1 quot#!_A(x1,x2) = x1 + x2 s!_A(x1) = 5 minus!_A(x1,x2) = x1 + x2 + 7 |0|!_A() = 0 partial status: pi(quot#) = [] pi(s) = [1] pi(minus) = [1, 2] pi(|0|) = [] 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: minus#(s(x),s(y)) -> minus#(x,y) and R consists of: r1: minus(x,|0|()) -> x r2: minus(s(x),s(y)) -> minus(x,y) r3: quot(|0|(),s(y)) -> |0|() r4: quot(s(x),s(y)) -> s(quot(minus(x,y),s(y))) r5: plus(s(x),s(y)) -> s(s(plus(if(gt(x,y),x,y),if(not(gt(x,y)),id(x),id(y))))) r6: plus(s(x),x) -> plus(if(gt(x,x),id(x),id(x)),s(x)) r7: plus(zero(),y) -> y r8: plus(id(x),s(y)) -> s(plus(x,if(gt(s(y),y),y,s(y)))) r9: id(x) -> x r10: if(true(),x,y) -> x r11: if(false(),x,y) -> y r12: not(x) -> if(x,false(),true()) r13: gt(s(x),zero()) -> true() r14: gt(zero(),y) -> false() r15: gt(s(x),s(y)) -> gt(x,y) 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!): max/plus interpretation on natural numbers: minus#_A(x1,x2) = max{0, x1 - 1, x2 - 1} s_A(x1) = max{9, x1} minus#!_A(x1,x2) = max{7, x2 - 10} s!_A(x1) = max{7, x1} 2. marked-algebra reduction triple (>=A, >=A!, >A!): matrix interpretation with standard point-wise order: carrier: N^1 order: standard order interpretations: minus#_A(x1,x2) = x1 + x2 s_A(x1) = x1 + 4 minus#!_A(x1,x2) = 0 s!_A(x1) = x1 + 6 partial status: pi(minus#) = [2] 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: plus#(s(x),s(y)) -> plus#(if(gt(x,y),x,y),if(not(gt(x,y)),id(x),id(y))) p2: plus#(id(x),s(y)) -> plus#(x,if(gt(s(y),y),y,s(y))) p3: plus#(s(x),x) -> plus#(if(gt(x,x),id(x),id(x)),s(x)) and R consists of: r1: minus(x,|0|()) -> x r2: minus(s(x),s(y)) -> minus(x,y) r3: quot(|0|(),s(y)) -> |0|() r4: quot(s(x),s(y)) -> s(quot(minus(x,y),s(y))) r5: plus(s(x),s(y)) -> s(s(plus(if(gt(x,y),x,y),if(not(gt(x,y)),id(x),id(y))))) r6: plus(s(x),x) -> plus(if(gt(x,x),id(x),id(x)),s(x)) r7: plus(zero(),y) -> y r8: plus(id(x),s(y)) -> s(plus(x,if(gt(s(y),y),y,s(y)))) r9: id(x) -> x r10: if(true(),x,y) -> x r11: if(false(),x,y) -> y r12: not(x) -> if(x,false(),true()) r13: gt(s(x),zero()) -> true() r14: gt(zero(),y) -> false() r15: gt(s(x),s(y)) -> gt(x,y) The set of usable rules consists of 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!): max/plus interpretation on natural numbers: plus#_A(x1,x2) = 0 s_A(x1) = x1 + 32 if_A(x1,x2,x3) = max{x2 + 10, x3} gt_A(x1,x2) = max{34, x1 - 32, x2 - 2} not_A(x1) = max{34, x1 - 68} id_A(x1) = max{18, x1 + 10} true_A = 1 false_A = 11 zero_A = 0 plus#!_A(x1,x2) = max{x1 + 120, x2 + 88} s!_A(x1) = max{31, x1 - 4} if!_A(x1,x2,x3) = max{129, x3 + 103} gt!_A(x1,x2) = max{149, x1 - 3, x2 - 32} not!_A(x1) = 151 id!_A(x1) = x1 + 153 true!_A = 30 false!_A = 1 zero!_A = 31 2. marked-algebra reduction triple (>=A, >=A!, >A!): matrix interpretation with standard point-wise order: carrier: N^1 order: standard order interpretations: plus#_A(x1,x2) = 0 s_A(x1) = x1 + 1 if_A(x1,x2,x3) = x2 + x3 + 1 gt_A(x1,x2) = 1 not_A(x1) = 3 id_A(x1) = x1 + 1 true_A() = 1 false_A() = 1 zero_A() = 1 plus#!_A(x1,x2) = 5 s!_A(x1) = x1 + 3 if!_A(x1,x2,x3) = 6 gt!_A(x1,x2) = x2 + 1 not!_A(x1) = 7 id!_A(x1) = x1 + 4 true!_A() = 0 false!_A() = 0 zero!_A() = 1 partial status: pi(plus#) = [] pi(s) = [1] pi(if) = [2, 3] pi(gt) = [] pi(not) = [] pi(id) = [1] pi(true) = [] pi(false) = [] pi(zero) = [] The following rules are removed: p3 -- SCC decomposition. Consider the dependency pair problem (P, R), where P consists of p1: plus#(s(x),s(y)) -> plus#(if(gt(x,y),x,y),if(not(gt(x,y)),id(x),id(y))) p2: plus#(id(x),s(y)) -> plus#(x,if(gt(s(y),y),y,s(y))) and R consists of: r1: minus(x,|0|()) -> x r2: minus(s(x),s(y)) -> minus(x,y) r3: quot(|0|(),s(y)) -> |0|() r4: quot(s(x),s(y)) -> s(quot(minus(x,y),s(y))) r5: plus(s(x),s(y)) -> s(s(plus(if(gt(x,y),x,y),if(not(gt(x,y)),id(x),id(y))))) r6: plus(s(x),x) -> plus(if(gt(x,x),id(x),id(x)),s(x)) r7: plus(zero(),y) -> y r8: plus(id(x),s(y)) -> s(plus(x,if(gt(s(y),y),y,s(y)))) r9: id(x) -> x r10: if(true(),x,y) -> x r11: if(false(),x,y) -> y r12: not(x) -> if(x,false(),true()) r13: gt(s(x),zero()) -> true() r14: gt(zero(),y) -> false() r15: gt(s(x),s(y)) -> gt(x,y) The estimated dependency graph contains the following SCCs: {p1, p2} -- Reduction pair. Consider the dependency pair problem (P, R), where P consists of p1: plus#(s(x),s(y)) -> plus#(if(gt(x,y),x,y),if(not(gt(x,y)),id(x),id(y))) p2: plus#(id(x),s(y)) -> plus#(x,if(gt(s(y),y),y,s(y))) and R consists of: r1: minus(x,|0|()) -> x r2: minus(s(x),s(y)) -> minus(x,y) r3: quot(|0|(),s(y)) -> |0|() r4: quot(s(x),s(y)) -> s(quot(minus(x,y),s(y))) r5: plus(s(x),s(y)) -> s(s(plus(if(gt(x,y),x,y),if(not(gt(x,y)),id(x),id(y))))) r6: plus(s(x),x) -> plus(if(gt(x,x),id(x),id(x)),s(x)) r7: plus(zero(),y) -> y r8: plus(id(x),s(y)) -> s(plus(x,if(gt(s(y),y),y,s(y)))) r9: id(x) -> x r10: if(true(),x,y) -> x r11: if(false(),x,y) -> y r12: not(x) -> if(x,false(),true()) r13: gt(s(x),zero()) -> true() r14: gt(zero(),y) -> false() r15: gt(s(x),s(y)) -> gt(x,y) The set of usable rules consists of r7, 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!): max/plus interpretation on natural numbers: plus#_A(x1,x2) = 0 s_A(x1) = x1 + 173 if_A(x1,x2,x3) = max{123, x2 + 21, x3} gt_A(x1,x2) = 2 not_A(x1) = 255 id_A(x1) = x1 + 168 plus_A(x1,x2) = max{495, x1 - 167, x2 + 21} zero_A = 78 true_A = 2 false_A = 1 plus#!_A(x1,x2) = max{x1 + 92, x2 - 74} s!_A(x1) = max{263, x1 + 114} if!_A(x1,x2,x3) = 261 gt!_A(x1,x2) = max{195, x1 + 118, x2 + 115} not!_A(x1) = x1 + 262 id!_A(x1) = max{262, x1} plus!_A(x1,x2) = max{1, x2 - 124} zero!_A = 0 true!_A = 194 false!_A = 196 2. marked-algebra reduction triple (>=A, >=A!, >A!): matrix interpretation with standard point-wise order: carrier: N^1 order: standard order interpretations: plus#_A(x1,x2) = 0 s_A(x1) = 2 if_A(x1,x2,x3) = x2 + x3 + 1 gt_A(x1,x2) = 1 not_A(x1) = 3 id_A(x1) = x1 + 1 plus_A(x1,x2) = x1 + x2 zero_A() = 1 true_A() = 1 false_A() = 1 plus#!_A(x1,x2) = x1 + 1 s!_A(x1) = x1 + 5 if!_A(x1,x2,x3) = 3 gt!_A(x1,x2) = 11 not!_A(x1) = 2 id!_A(x1) = x1 + 4 plus!_A(x1,x2) = 10 zero!_A() = 0 true!_A() = 1 false!_A() = 1 partial status: pi(plus#) = [] pi(s) = [1] pi(if) = [2, 3] pi(gt) = [] pi(not) = [] pi(id) = [1] pi(plus) = [2] pi(zero) = [] pi(true) = [] pi(false) = [] The following rules are removed: p1, p2 Then no dependency pair remains. -- Reduction pair. Consider the dependency pair problem (P, R), where P consists of p1: gt#(s(x),s(y)) -> gt#(x,y) and R consists of: r1: minus(x,|0|()) -> x r2: minus(s(x),s(y)) -> minus(x,y) r3: quot(|0|(),s(y)) -> |0|() r4: quot(s(x),s(y)) -> s(quot(minus(x,y),s(y))) r5: plus(s(x),s(y)) -> s(s(plus(if(gt(x,y),x,y),if(not(gt(x,y)),id(x),id(y))))) r6: plus(s(x),x) -> plus(if(gt(x,x),id(x),id(x)),s(x)) r7: plus(zero(),y) -> y r8: plus(id(x),s(y)) -> s(plus(x,if(gt(s(y),y),y,s(y)))) r9: id(x) -> x r10: if(true(),x,y) -> x r11: if(false(),x,y) -> y r12: not(x) -> if(x,false(),true()) r13: gt(s(x),zero()) -> true() r14: gt(zero(),y) -> false() r15: gt(s(x),s(y)) -> gt(x,y) 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!): max/plus interpretation on natural numbers: gt#_A(x1,x2) = max{0, x1 - 23, x2 - 23} s_A(x1) = max{30, x1 + 22} gt#!_A(x1,x2) = max{74, x1 - 31, x2 - 31} s!_A(x1) = x1 + 73 2. marked-algebra reduction triple (>=A, >=A!, >A!): matrix interpretation with standard point-wise order: carrier: N^1 order: standard order interpretations: gt#_A(x1,x2) = x1 + x2 s_A(x1) = x1 + 4 gt#!_A(x1,x2) = x1 + x2 s!_A(x1) = x1 + 9 partial status: pi(gt#) = [1] pi(s) = [1] The following rules are removed: p1 Then no dependency pair remains.