(0) Obligation:

Q restricted rewrite system:
The TRS R consists of the following rules:

active(p(0)) → mark(0)
active(p(s(X))) → mark(X)
active(leq(0, Y)) → mark(true)
active(leq(s(X), 0)) → mark(false)
active(leq(s(X), s(Y))) → mark(leq(X, Y))
active(if(true, X, Y)) → mark(X)
active(if(false, X, Y)) → mark(Y)
active(diff(X, Y)) → mark(if(leq(X, Y), 0, s(diff(p(X), Y))))
active(p(X)) → p(active(X))
active(s(X)) → s(active(X))
active(leq(X1, X2)) → leq(active(X1), X2)
active(leq(X1, X2)) → leq(X1, active(X2))
active(if(X1, X2, X3)) → if(active(X1), X2, X3)
active(diff(X1, X2)) → diff(active(X1), X2)
active(diff(X1, X2)) → diff(X1, active(X2))
p(mark(X)) → mark(p(X))
s(mark(X)) → mark(s(X))
leq(mark(X1), X2) → mark(leq(X1, X2))
leq(X1, mark(X2)) → mark(leq(X1, X2))
if(mark(X1), X2, X3) → mark(if(X1, X2, X3))
diff(mark(X1), X2) → mark(diff(X1, X2))
diff(X1, mark(X2)) → mark(diff(X1, X2))
proper(p(X)) → p(proper(X))
proper(0) → ok(0)
proper(s(X)) → s(proper(X))
proper(leq(X1, X2)) → leq(proper(X1), proper(X2))
proper(true) → ok(true)
proper(false) → ok(false)
proper(if(X1, X2, X3)) → if(proper(X1), proper(X2), proper(X3))
proper(diff(X1, X2)) → diff(proper(X1), proper(X2))
p(ok(X)) → ok(p(X))
s(ok(X)) → ok(s(X))
leq(ok(X1), ok(X2)) → ok(leq(X1, X2))
if(ok(X1), ok(X2), ok(X3)) → ok(if(X1, X2, X3))
diff(ok(X1), ok(X2)) → ok(diff(X1, X2))
top(mark(X)) → top(proper(X))
top(ok(X)) → top(active(X))

Q is empty.

(1) DependencyPairsProof (EQUIVALENT transformation)

Using Dependency Pairs [AG00,LPAR04] we result in the following initial DP problem.

(2) Obligation:

Q DP problem:
The TRS P consists of the following rules:

ACTIVE(leq(s(X), s(Y))) → LEQ(X, Y)
ACTIVE(diff(X, Y)) → IF(leq(X, Y), 0, s(diff(p(X), Y)))
ACTIVE(diff(X, Y)) → LEQ(X, Y)
ACTIVE(diff(X, Y)) → S(diff(p(X), Y))
ACTIVE(diff(X, Y)) → DIFF(p(X), Y)
ACTIVE(diff(X, Y)) → P(X)
ACTIVE(p(X)) → P(active(X))
ACTIVE(p(X)) → ACTIVE(X)
ACTIVE(s(X)) → S(active(X))
ACTIVE(s(X)) → ACTIVE(X)
ACTIVE(leq(X1, X2)) → LEQ(active(X1), X2)
ACTIVE(leq(X1, X2)) → ACTIVE(X1)
ACTIVE(leq(X1, X2)) → LEQ(X1, active(X2))
ACTIVE(leq(X1, X2)) → ACTIVE(X2)
ACTIVE(if(X1, X2, X3)) → IF(active(X1), X2, X3)
ACTIVE(if(X1, X2, X3)) → ACTIVE(X1)
ACTIVE(diff(X1, X2)) → DIFF(active(X1), X2)
ACTIVE(diff(X1, X2)) → ACTIVE(X1)
ACTIVE(diff(X1, X2)) → DIFF(X1, active(X2))
ACTIVE(diff(X1, X2)) → ACTIVE(X2)
P(mark(X)) → P(X)
S(mark(X)) → S(X)
LEQ(mark(X1), X2) → LEQ(X1, X2)
LEQ(X1, mark(X2)) → LEQ(X1, X2)
IF(mark(X1), X2, X3) → IF(X1, X2, X3)
DIFF(mark(X1), X2) → DIFF(X1, X2)
DIFF(X1, mark(X2)) → DIFF(X1, X2)
PROPER(p(X)) → P(proper(X))
PROPER(p(X)) → PROPER(X)
PROPER(s(X)) → S(proper(X))
PROPER(s(X)) → PROPER(X)
PROPER(leq(X1, X2)) → LEQ(proper(X1), proper(X2))
PROPER(leq(X1, X2)) → PROPER(X1)
PROPER(leq(X1, X2)) → PROPER(X2)
PROPER(if(X1, X2, X3)) → IF(proper(X1), proper(X2), proper(X3))
PROPER(if(X1, X2, X3)) → PROPER(X1)
PROPER(if(X1, X2, X3)) → PROPER(X2)
PROPER(if(X1, X2, X3)) → PROPER(X3)
PROPER(diff(X1, X2)) → DIFF(proper(X1), proper(X2))
PROPER(diff(X1, X2)) → PROPER(X1)
PROPER(diff(X1, X2)) → PROPER(X2)
P(ok(X)) → P(X)
S(ok(X)) → S(X)
LEQ(ok(X1), ok(X2)) → LEQ(X1, X2)
IF(ok(X1), ok(X2), ok(X3)) → IF(X1, X2, X3)
DIFF(ok(X1), ok(X2)) → DIFF(X1, X2)
TOP(mark(X)) → TOP(proper(X))
TOP(mark(X)) → PROPER(X)
TOP(ok(X)) → TOP(active(X))
TOP(ok(X)) → ACTIVE(X)

The TRS R consists of the following rules:

active(p(0)) → mark(0)
active(p(s(X))) → mark(X)
active(leq(0, Y)) → mark(true)
active(leq(s(X), 0)) → mark(false)
active(leq(s(X), s(Y))) → mark(leq(X, Y))
active(if(true, X, Y)) → mark(X)
active(if(false, X, Y)) → mark(Y)
active(diff(X, Y)) → mark(if(leq(X, Y), 0, s(diff(p(X), Y))))
active(p(X)) → p(active(X))
active(s(X)) → s(active(X))
active(leq(X1, X2)) → leq(active(X1), X2)
active(leq(X1, X2)) → leq(X1, active(X2))
active(if(X1, X2, X3)) → if(active(X1), X2, X3)
active(diff(X1, X2)) → diff(active(X1), X2)
active(diff(X1, X2)) → diff(X1, active(X2))
p(mark(X)) → mark(p(X))
s(mark(X)) → mark(s(X))
leq(mark(X1), X2) → mark(leq(X1, X2))
leq(X1, mark(X2)) → mark(leq(X1, X2))
if(mark(X1), X2, X3) → mark(if(X1, X2, X3))
diff(mark(X1), X2) → mark(diff(X1, X2))
diff(X1, mark(X2)) → mark(diff(X1, X2))
proper(p(X)) → p(proper(X))
proper(0) → ok(0)
proper(s(X)) → s(proper(X))
proper(leq(X1, X2)) → leq(proper(X1), proper(X2))
proper(true) → ok(true)
proper(false) → ok(false)
proper(if(X1, X2, X3)) → if(proper(X1), proper(X2), proper(X3))
proper(diff(X1, X2)) → diff(proper(X1), proper(X2))
p(ok(X)) → ok(p(X))
s(ok(X)) → ok(s(X))
leq(ok(X1), ok(X2)) → ok(leq(X1, X2))
if(ok(X1), ok(X2), ok(X3)) → ok(if(X1, X2, X3))
diff(ok(X1), ok(X2)) → ok(diff(X1, X2))
top(mark(X)) → top(proper(X))
top(ok(X)) → top(active(X))

Q is empty.
We have to consider all minimal (P,Q,R)-chains.

(3) DependencyGraphProof (EQUIVALENT transformation)

The approximation of the Dependency Graph [LPAR04,FROCOS05,EDGSTAR] contains 8 SCCs with 20 less nodes.

(4) Complex Obligation (AND)

(5) Obligation:

Q DP problem:
The TRS P consists of the following rules:

DIFF(X1, mark(X2)) → DIFF(X1, X2)
DIFF(mark(X1), X2) → DIFF(X1, X2)
DIFF(ok(X1), ok(X2)) → DIFF(X1, X2)

The TRS R consists of the following rules:

active(p(0)) → mark(0)
active(p(s(X))) → mark(X)
active(leq(0, Y)) → mark(true)
active(leq(s(X), 0)) → mark(false)
active(leq(s(X), s(Y))) → mark(leq(X, Y))
active(if(true, X, Y)) → mark(X)
active(if(false, X, Y)) → mark(Y)
active(diff(X, Y)) → mark(if(leq(X, Y), 0, s(diff(p(X), Y))))
active(p(X)) → p(active(X))
active(s(X)) → s(active(X))
active(leq(X1, X2)) → leq(active(X1), X2)
active(leq(X1, X2)) → leq(X1, active(X2))
active(if(X1, X2, X3)) → if(active(X1), X2, X3)
active(diff(X1, X2)) → diff(active(X1), X2)
active(diff(X1, X2)) → diff(X1, active(X2))
p(mark(X)) → mark(p(X))
s(mark(X)) → mark(s(X))
leq(mark(X1), X2) → mark(leq(X1, X2))
leq(X1, mark(X2)) → mark(leq(X1, X2))
if(mark(X1), X2, X3) → mark(if(X1, X2, X3))
diff(mark(X1), X2) → mark(diff(X1, X2))
diff(X1, mark(X2)) → mark(diff(X1, X2))
proper(p(X)) → p(proper(X))
proper(0) → ok(0)
proper(s(X)) → s(proper(X))
proper(leq(X1, X2)) → leq(proper(X1), proper(X2))
proper(true) → ok(true)
proper(false) → ok(false)
proper(if(X1, X2, X3)) → if(proper(X1), proper(X2), proper(X3))
proper(diff(X1, X2)) → diff(proper(X1), proper(X2))
p(ok(X)) → ok(p(X))
s(ok(X)) → ok(s(X))
leq(ok(X1), ok(X2)) → ok(leq(X1, X2))
if(ok(X1), ok(X2), ok(X3)) → ok(if(X1, X2, X3))
diff(ok(X1), ok(X2)) → ok(diff(X1, X2))
top(mark(X)) → top(proper(X))
top(ok(X)) → top(active(X))

Q is empty.
We have to consider all minimal (P,Q,R)-chains.

(6) Obligation:

Q DP problem:
The TRS P consists of the following rules:

IF(ok(X1), ok(X2), ok(X3)) → IF(X1, X2, X3)
IF(mark(X1), X2, X3) → IF(X1, X2, X3)

The TRS R consists of the following rules:

active(p(0)) → mark(0)
active(p(s(X))) → mark(X)
active(leq(0, Y)) → mark(true)
active(leq(s(X), 0)) → mark(false)
active(leq(s(X), s(Y))) → mark(leq(X, Y))
active(if(true, X, Y)) → mark(X)
active(if(false, X, Y)) → mark(Y)
active(diff(X, Y)) → mark(if(leq(X, Y), 0, s(diff(p(X), Y))))
active(p(X)) → p(active(X))
active(s(X)) → s(active(X))
active(leq(X1, X2)) → leq(active(X1), X2)
active(leq(X1, X2)) → leq(X1, active(X2))
active(if(X1, X2, X3)) → if(active(X1), X2, X3)
active(diff(X1, X2)) → diff(active(X1), X2)
active(diff(X1, X2)) → diff(X1, active(X2))
p(mark(X)) → mark(p(X))
s(mark(X)) → mark(s(X))
leq(mark(X1), X2) → mark(leq(X1, X2))
leq(X1, mark(X2)) → mark(leq(X1, X2))
if(mark(X1), X2, X3) → mark(if(X1, X2, X3))
diff(mark(X1), X2) → mark(diff(X1, X2))
diff(X1, mark(X2)) → mark(diff(X1, X2))
proper(p(X)) → p(proper(X))
proper(0) → ok(0)
proper(s(X)) → s(proper(X))
proper(leq(X1, X2)) → leq(proper(X1), proper(X2))
proper(true) → ok(true)
proper(false) → ok(false)
proper(if(X1, X2, X3)) → if(proper(X1), proper(X2), proper(X3))
proper(diff(X1, X2)) → diff(proper(X1), proper(X2))
p(ok(X)) → ok(p(X))
s(ok(X)) → ok(s(X))
leq(ok(X1), ok(X2)) → ok(leq(X1, X2))
if(ok(X1), ok(X2), ok(X3)) → ok(if(X1, X2, X3))
diff(ok(X1), ok(X2)) → ok(diff(X1, X2))
top(mark(X)) → top(proper(X))
top(ok(X)) → top(active(X))

Q is empty.
We have to consider all minimal (P,Q,R)-chains.

(7) Obligation:

Q DP problem:
The TRS P consists of the following rules:

LEQ(X1, mark(X2)) → LEQ(X1, X2)
LEQ(mark(X1), X2) → LEQ(X1, X2)
LEQ(ok(X1), ok(X2)) → LEQ(X1, X2)

The TRS R consists of the following rules:

active(p(0)) → mark(0)
active(p(s(X))) → mark(X)
active(leq(0, Y)) → mark(true)
active(leq(s(X), 0)) → mark(false)
active(leq(s(X), s(Y))) → mark(leq(X, Y))
active(if(true, X, Y)) → mark(X)
active(if(false, X, Y)) → mark(Y)
active(diff(X, Y)) → mark(if(leq(X, Y), 0, s(diff(p(X), Y))))
active(p(X)) → p(active(X))
active(s(X)) → s(active(X))
active(leq(X1, X2)) → leq(active(X1), X2)
active(leq(X1, X2)) → leq(X1, active(X2))
active(if(X1, X2, X3)) → if(active(X1), X2, X3)
active(diff(X1, X2)) → diff(active(X1), X2)
active(diff(X1, X2)) → diff(X1, active(X2))
p(mark(X)) → mark(p(X))
s(mark(X)) → mark(s(X))
leq(mark(X1), X2) → mark(leq(X1, X2))
leq(X1, mark(X2)) → mark(leq(X1, X2))
if(mark(X1), X2, X3) → mark(if(X1, X2, X3))
diff(mark(X1), X2) → mark(diff(X1, X2))
diff(X1, mark(X2)) → mark(diff(X1, X2))
proper(p(X)) → p(proper(X))
proper(0) → ok(0)
proper(s(X)) → s(proper(X))
proper(leq(X1, X2)) → leq(proper(X1), proper(X2))
proper(true) → ok(true)
proper(false) → ok(false)
proper(if(X1, X2, X3)) → if(proper(X1), proper(X2), proper(X3))
proper(diff(X1, X2)) → diff(proper(X1), proper(X2))
p(ok(X)) → ok(p(X))
s(ok(X)) → ok(s(X))
leq(ok(X1), ok(X2)) → ok(leq(X1, X2))
if(ok(X1), ok(X2), ok(X3)) → ok(if(X1, X2, X3))
diff(ok(X1), ok(X2)) → ok(diff(X1, X2))
top(mark(X)) → top(proper(X))
top(ok(X)) → top(active(X))

Q is empty.
We have to consider all minimal (P,Q,R)-chains.

(8) Obligation:

Q DP problem:
The TRS P consists of the following rules:

S(ok(X)) → S(X)
S(mark(X)) → S(X)

The TRS R consists of the following rules:

active(p(0)) → mark(0)
active(p(s(X))) → mark(X)
active(leq(0, Y)) → mark(true)
active(leq(s(X), 0)) → mark(false)
active(leq(s(X), s(Y))) → mark(leq(X, Y))
active(if(true, X, Y)) → mark(X)
active(if(false, X, Y)) → mark(Y)
active(diff(X, Y)) → mark(if(leq(X, Y), 0, s(diff(p(X), Y))))
active(p(X)) → p(active(X))
active(s(X)) → s(active(X))
active(leq(X1, X2)) → leq(active(X1), X2)
active(leq(X1, X2)) → leq(X1, active(X2))
active(if(X1, X2, X3)) → if(active(X1), X2, X3)
active(diff(X1, X2)) → diff(active(X1), X2)
active(diff(X1, X2)) → diff(X1, active(X2))
p(mark(X)) → mark(p(X))
s(mark(X)) → mark(s(X))
leq(mark(X1), X2) → mark(leq(X1, X2))
leq(X1, mark(X2)) → mark(leq(X1, X2))
if(mark(X1), X2, X3) → mark(if(X1, X2, X3))
diff(mark(X1), X2) → mark(diff(X1, X2))
diff(X1, mark(X2)) → mark(diff(X1, X2))
proper(p(X)) → p(proper(X))
proper(0) → ok(0)
proper(s(X)) → s(proper(X))
proper(leq(X1, X2)) → leq(proper(X1), proper(X2))
proper(true) → ok(true)
proper(false) → ok(false)
proper(if(X1, X2, X3)) → if(proper(X1), proper(X2), proper(X3))
proper(diff(X1, X2)) → diff(proper(X1), proper(X2))
p(ok(X)) → ok(p(X))
s(ok(X)) → ok(s(X))
leq(ok(X1), ok(X2)) → ok(leq(X1, X2))
if(ok(X1), ok(X2), ok(X3)) → ok(if(X1, X2, X3))
diff(ok(X1), ok(X2)) → ok(diff(X1, X2))
top(mark(X)) → top(proper(X))
top(ok(X)) → top(active(X))

Q is empty.
We have to consider all minimal (P,Q,R)-chains.

(9) Obligation:

Q DP problem:
The TRS P consists of the following rules:

P(ok(X)) → P(X)
P(mark(X)) → P(X)

The TRS R consists of the following rules:

active(p(0)) → mark(0)
active(p(s(X))) → mark(X)
active(leq(0, Y)) → mark(true)
active(leq(s(X), 0)) → mark(false)
active(leq(s(X), s(Y))) → mark(leq(X, Y))
active(if(true, X, Y)) → mark(X)
active(if(false, X, Y)) → mark(Y)
active(diff(X, Y)) → mark(if(leq(X, Y), 0, s(diff(p(X), Y))))
active(p(X)) → p(active(X))
active(s(X)) → s(active(X))
active(leq(X1, X2)) → leq(active(X1), X2)
active(leq(X1, X2)) → leq(X1, active(X2))
active(if(X1, X2, X3)) → if(active(X1), X2, X3)
active(diff(X1, X2)) → diff(active(X1), X2)
active(diff(X1, X2)) → diff(X1, active(X2))
p(mark(X)) → mark(p(X))
s(mark(X)) → mark(s(X))
leq(mark(X1), X2) → mark(leq(X1, X2))
leq(X1, mark(X2)) → mark(leq(X1, X2))
if(mark(X1), X2, X3) → mark(if(X1, X2, X3))
diff(mark(X1), X2) → mark(diff(X1, X2))
diff(X1, mark(X2)) → mark(diff(X1, X2))
proper(p(X)) → p(proper(X))
proper(0) → ok(0)
proper(s(X)) → s(proper(X))
proper(leq(X1, X2)) → leq(proper(X1), proper(X2))
proper(true) → ok(true)
proper(false) → ok(false)
proper(if(X1, X2, X3)) → if(proper(X1), proper(X2), proper(X3))
proper(diff(X1, X2)) → diff(proper(X1), proper(X2))
p(ok(X)) → ok(p(X))
s(ok(X)) → ok(s(X))
leq(ok(X1), ok(X2)) → ok(leq(X1, X2))
if(ok(X1), ok(X2), ok(X3)) → ok(if(X1, X2, X3))
diff(ok(X1), ok(X2)) → ok(diff(X1, X2))
top(mark(X)) → top(proper(X))
top(ok(X)) → top(active(X))

Q is empty.
We have to consider all minimal (P,Q,R)-chains.

(10) Obligation:

Q DP problem:
The TRS P consists of the following rules:

PROPER(s(X)) → PROPER(X)
PROPER(p(X)) → PROPER(X)
PROPER(leq(X1, X2)) → PROPER(X1)
PROPER(leq(X1, X2)) → PROPER(X2)
PROPER(if(X1, X2, X3)) → PROPER(X1)
PROPER(if(X1, X2, X3)) → PROPER(X2)
PROPER(if(X1, X2, X3)) → PROPER(X3)
PROPER(diff(X1, X2)) → PROPER(X1)
PROPER(diff(X1, X2)) → PROPER(X2)

The TRS R consists of the following rules:

active(p(0)) → mark(0)
active(p(s(X))) → mark(X)
active(leq(0, Y)) → mark(true)
active(leq(s(X), 0)) → mark(false)
active(leq(s(X), s(Y))) → mark(leq(X, Y))
active(if(true, X, Y)) → mark(X)
active(if(false, X, Y)) → mark(Y)
active(diff(X, Y)) → mark(if(leq(X, Y), 0, s(diff(p(X), Y))))
active(p(X)) → p(active(X))
active(s(X)) → s(active(X))
active(leq(X1, X2)) → leq(active(X1), X2)
active(leq(X1, X2)) → leq(X1, active(X2))
active(if(X1, X2, X3)) → if(active(X1), X2, X3)
active(diff(X1, X2)) → diff(active(X1), X2)
active(diff(X1, X2)) → diff(X1, active(X2))
p(mark(X)) → mark(p(X))
s(mark(X)) → mark(s(X))
leq(mark(X1), X2) → mark(leq(X1, X2))
leq(X1, mark(X2)) → mark(leq(X1, X2))
if(mark(X1), X2, X3) → mark(if(X1, X2, X3))
diff(mark(X1), X2) → mark(diff(X1, X2))
diff(X1, mark(X2)) → mark(diff(X1, X2))
proper(p(X)) → p(proper(X))
proper(0) → ok(0)
proper(s(X)) → s(proper(X))
proper(leq(X1, X2)) → leq(proper(X1), proper(X2))
proper(true) → ok(true)
proper(false) → ok(false)
proper(if(X1, X2, X3)) → if(proper(X1), proper(X2), proper(X3))
proper(diff(X1, X2)) → diff(proper(X1), proper(X2))
p(ok(X)) → ok(p(X))
s(ok(X)) → ok(s(X))
leq(ok(X1), ok(X2)) → ok(leq(X1, X2))
if(ok(X1), ok(X2), ok(X3)) → ok(if(X1, X2, X3))
diff(ok(X1), ok(X2)) → ok(diff(X1, X2))
top(mark(X)) → top(proper(X))
top(ok(X)) → top(active(X))

Q is empty.
We have to consider all minimal (P,Q,R)-chains.

(11) Obligation:

Q DP problem:
The TRS P consists of the following rules:

ACTIVE(s(X)) → ACTIVE(X)
ACTIVE(p(X)) → ACTIVE(X)
ACTIVE(leq(X1, X2)) → ACTIVE(X1)
ACTIVE(leq(X1, X2)) → ACTIVE(X2)
ACTIVE(if(X1, X2, X3)) → ACTIVE(X1)
ACTIVE(diff(X1, X2)) → ACTIVE(X1)
ACTIVE(diff(X1, X2)) → ACTIVE(X2)

The TRS R consists of the following rules:

active(p(0)) → mark(0)
active(p(s(X))) → mark(X)
active(leq(0, Y)) → mark(true)
active(leq(s(X), 0)) → mark(false)
active(leq(s(X), s(Y))) → mark(leq(X, Y))
active(if(true, X, Y)) → mark(X)
active(if(false, X, Y)) → mark(Y)
active(diff(X, Y)) → mark(if(leq(X, Y), 0, s(diff(p(X), Y))))
active(p(X)) → p(active(X))
active(s(X)) → s(active(X))
active(leq(X1, X2)) → leq(active(X1), X2)
active(leq(X1, X2)) → leq(X1, active(X2))
active(if(X1, X2, X3)) → if(active(X1), X2, X3)
active(diff(X1, X2)) → diff(active(X1), X2)
active(diff(X1, X2)) → diff(X1, active(X2))
p(mark(X)) → mark(p(X))
s(mark(X)) → mark(s(X))
leq(mark(X1), X2) → mark(leq(X1, X2))
leq(X1, mark(X2)) → mark(leq(X1, X2))
if(mark(X1), X2, X3) → mark(if(X1, X2, X3))
diff(mark(X1), X2) → mark(diff(X1, X2))
diff(X1, mark(X2)) → mark(diff(X1, X2))
proper(p(X)) → p(proper(X))
proper(0) → ok(0)
proper(s(X)) → s(proper(X))
proper(leq(X1, X2)) → leq(proper(X1), proper(X2))
proper(true) → ok(true)
proper(false) → ok(false)
proper(if(X1, X2, X3)) → if(proper(X1), proper(X2), proper(X3))
proper(diff(X1, X2)) → diff(proper(X1), proper(X2))
p(ok(X)) → ok(p(X))
s(ok(X)) → ok(s(X))
leq(ok(X1), ok(X2)) → ok(leq(X1, X2))
if(ok(X1), ok(X2), ok(X3)) → ok(if(X1, X2, X3))
diff(ok(X1), ok(X2)) → ok(diff(X1, X2))
top(mark(X)) → top(proper(X))
top(ok(X)) → top(active(X))

Q is empty.
We have to consider all minimal (P,Q,R)-chains.

(12) Obligation:

Q DP problem:
The TRS P consists of the following rules:

TOP(ok(X)) → TOP(active(X))
TOP(mark(X)) → TOP(proper(X))

The TRS R consists of the following rules:

active(p(0)) → mark(0)
active(p(s(X))) → mark(X)
active(leq(0, Y)) → mark(true)
active(leq(s(X), 0)) → mark(false)
active(leq(s(X), s(Y))) → mark(leq(X, Y))
active(if(true, X, Y)) → mark(X)
active(if(false, X, Y)) → mark(Y)
active(diff(X, Y)) → mark(if(leq(X, Y), 0, s(diff(p(X), Y))))
active(p(X)) → p(active(X))
active(s(X)) → s(active(X))
active(leq(X1, X2)) → leq(active(X1), X2)
active(leq(X1, X2)) → leq(X1, active(X2))
active(if(X1, X2, X3)) → if(active(X1), X2, X3)
active(diff(X1, X2)) → diff(active(X1), X2)
active(diff(X1, X2)) → diff(X1, active(X2))
p(mark(X)) → mark(p(X))
s(mark(X)) → mark(s(X))
leq(mark(X1), X2) → mark(leq(X1, X2))
leq(X1, mark(X2)) → mark(leq(X1, X2))
if(mark(X1), X2, X3) → mark(if(X1, X2, X3))
diff(mark(X1), X2) → mark(diff(X1, X2))
diff(X1, mark(X2)) → mark(diff(X1, X2))
proper(p(X)) → p(proper(X))
proper(0) → ok(0)
proper(s(X)) → s(proper(X))
proper(leq(X1, X2)) → leq(proper(X1), proper(X2))
proper(true) → ok(true)
proper(false) → ok(false)
proper(if(X1, X2, X3)) → if(proper(X1), proper(X2), proper(X3))
proper(diff(X1, X2)) → diff(proper(X1), proper(X2))
p(ok(X)) → ok(p(X))
s(ok(X)) → ok(s(X))
leq(ok(X1), ok(X2)) → ok(leq(X1, X2))
if(ok(X1), ok(X2), ok(X3)) → ok(if(X1, X2, X3))
diff(ok(X1), ok(X2)) → ok(diff(X1, X2))
top(mark(X)) → top(proper(X))
top(ok(X)) → top(active(X))

Q is empty.
We have to consider all minimal (P,Q,R)-chains.