(0) Obligation:

Clauses:

f(0, Y, Z) :- ','(!, eq(Z, 0)).
f(X, Y, Z) :- ','(p(X, P), ','(f(P, Y, U), f(U, Y, Z))).
p(0, 0).
p(s(X), X).
eq(X, X).

Query: f(g,a,a)

(1) PrologToCdtProblemTransformerProof (UPPER BOUND (ID) transformation)

Built complexity over-approximating cdt problems from derivation graph.

(2) Obligation:

Complexity Dependency Tuples Problem
Rules:

f2_in(0) → f2_out1(0)
f2_in(s(z0)) → U1(f27_in(z0), s(z0))
U1(f27_out1(z0, z1), s(z2)) → f2_out1(z1)
f30_in(0) → f30_out1(0)
f30_in(s(z0)) → U2(f55_in(z0), s(z0))
U2(f55_out1(z0, z1), s(z2)) → f30_out1(z1)
f27_in(z0) → U3(f30_in(z0), z0)
U3(f30_out1(z0), z1) → U4(f2_in(z0), z1, z0)
U4(f2_out1(z0), z1, z2) → f27_out1(z2, z0)
f55_in(z0) → U5(f30_in(z0), z0)
U5(f30_out1(z0), z1) → U6(f30_in(z0), z1, z0)
U6(f30_out1(z0), z1, z2) → f55_out1(z2, z0)
Tuples:

F2_IN(s(z0)) → c1(U1'(f27_in(z0), s(z0)), F27_IN(z0))
F30_IN(s(z0)) → c4(U2'(f55_in(z0), s(z0)), F55_IN(z0))
F27_IN(z0) → c6(U3'(f30_in(z0), z0), F30_IN(z0))
U3'(f30_out1(z0), z1) → c7(U4'(f2_in(z0), z1, z0), F2_IN(z0))
F55_IN(z0) → c9(U5'(f30_in(z0), z0), F30_IN(z0))
U5'(f30_out1(z0), z1) → c10(U6'(f30_in(z0), z1, z0), F30_IN(z0))
S tuples:

F2_IN(s(z0)) → c1(U1'(f27_in(z0), s(z0)), F27_IN(z0))
F30_IN(s(z0)) → c4(U2'(f55_in(z0), s(z0)), F55_IN(z0))
F27_IN(z0) → c6(U3'(f30_in(z0), z0), F30_IN(z0))
U3'(f30_out1(z0), z1) → c7(U4'(f2_in(z0), z1, z0), F2_IN(z0))
F55_IN(z0) → c9(U5'(f30_in(z0), z0), F30_IN(z0))
U5'(f30_out1(z0), z1) → c10(U6'(f30_in(z0), z1, z0), F30_IN(z0))
K tuples:none
Defined Rule Symbols:

f2_in, U1, f30_in, U2, f27_in, U3, U4, f55_in, U5, U6

Defined Pair Symbols:

F2_IN, F30_IN, F27_IN, U3', F55_IN, U5'

Compound Symbols:

c1, c4, c6, c7, c9, c10

(3) CdtGraphRemoveTrailingTuplepartsProof (BOTH BOUNDS(ID, ID) transformation)

Removed 4 trailing tuple parts

(4) Obligation:

Complexity Dependency Tuples Problem
Rules:

f2_in(0) → f2_out1(0)
f2_in(s(z0)) → U1(f27_in(z0), s(z0))
U1(f27_out1(z0, z1), s(z2)) → f2_out1(z1)
f30_in(0) → f30_out1(0)
f30_in(s(z0)) → U2(f55_in(z0), s(z0))
U2(f55_out1(z0, z1), s(z2)) → f30_out1(z1)
f27_in(z0) → U3(f30_in(z0), z0)
U3(f30_out1(z0), z1) → U4(f2_in(z0), z1, z0)
U4(f2_out1(z0), z1, z2) → f27_out1(z2, z0)
f55_in(z0) → U5(f30_in(z0), z0)
U5(f30_out1(z0), z1) → U6(f30_in(z0), z1, z0)
U6(f30_out1(z0), z1, z2) → f55_out1(z2, z0)
Tuples:

F27_IN(z0) → c6(U3'(f30_in(z0), z0), F30_IN(z0))
F55_IN(z0) → c9(U5'(f30_in(z0), z0), F30_IN(z0))
F2_IN(s(z0)) → c1(F27_IN(z0))
F30_IN(s(z0)) → c4(F55_IN(z0))
U3'(f30_out1(z0), z1) → c7(F2_IN(z0))
U5'(f30_out1(z0), z1) → c10(F30_IN(z0))
S tuples:

F27_IN(z0) → c6(U3'(f30_in(z0), z0), F30_IN(z0))
F55_IN(z0) → c9(U5'(f30_in(z0), z0), F30_IN(z0))
F2_IN(s(z0)) → c1(F27_IN(z0))
F30_IN(s(z0)) → c4(F55_IN(z0))
U3'(f30_out1(z0), z1) → c7(F2_IN(z0))
U5'(f30_out1(z0), z1) → c10(F30_IN(z0))
K tuples:none
Defined Rule Symbols:

f2_in, U1, f30_in, U2, f27_in, U3, U4, f55_in, U5, U6

Defined Pair Symbols:

F27_IN, F55_IN, F2_IN, F30_IN, U3', U5'

Compound Symbols:

c6, c9, c1, c4, c7, c10

(5) CdtPolyRedPairProof (UPPER BOUND (ADD(O(n^1))) transformation)

Found a reduction pair which oriented the following tuples strictly. Hence they can be removed from S.

F27_IN(z0) → c6(U3'(f30_in(z0), z0), F30_IN(z0))
F55_IN(z0) → c9(U5'(f30_in(z0), z0), F30_IN(z0))
F2_IN(s(z0)) → c1(F27_IN(z0))
F30_IN(s(z0)) → c4(F55_IN(z0))
We considered the (Usable) Rules:

f30_in(0) → f30_out1(0)
f30_in(s(z0)) → U2(f55_in(z0), s(z0))
f55_in(z0) → U5(f30_in(z0), z0)
U2(f55_out1(z0, z1), s(z2)) → f30_out1(z1)
U5(f30_out1(z0), z1) → U6(f30_in(z0), z1, z0)
U6(f30_out1(z0), z1, z2) → f55_out1(z2, z0)
And the Tuples:

F27_IN(z0) → c6(U3'(f30_in(z0), z0), F30_IN(z0))
F55_IN(z0) → c9(U5'(f30_in(z0), z0), F30_IN(z0))
F2_IN(s(z0)) → c1(F27_IN(z0))
F30_IN(s(z0)) → c4(F55_IN(z0))
U3'(f30_out1(z0), z1) → c7(F2_IN(z0))
U5'(f30_out1(z0), z1) → c10(F30_IN(z0))
The order we found is given by the following interpretation:
Polynomial interpretation :

POL(0) = 0   
POL(F27_IN(x1)) = [1] + [2]x1   
POL(F2_IN(x1)) = [2]x1   
POL(F30_IN(x1)) = x1   
POL(F55_IN(x1)) = [1] + x1   
POL(U2(x1, x2)) = [2]x1   
POL(U3'(x1, x2)) = [2]x1   
POL(U5(x1, x2)) = [3]x1   
POL(U5'(x1, x2)) = [2]x1   
POL(U6(x1, x2, x3)) = [2]x1   
POL(c1(x1)) = x1   
POL(c10(x1)) = x1   
POL(c4(x1)) = x1   
POL(c6(x1, x2)) = x1 + x2   
POL(c7(x1)) = x1   
POL(c9(x1, x2)) = x1 + x2   
POL(f30_in(x1)) = 0   
POL(f30_out1(x1)) = x1   
POL(f55_in(x1)) = 0   
POL(f55_out1(x1, x2)) = x2   
POL(s(x1)) = [2] + x1   

(6) Obligation:

Complexity Dependency Tuples Problem
Rules:

f2_in(0) → f2_out1(0)
f2_in(s(z0)) → U1(f27_in(z0), s(z0))
U1(f27_out1(z0, z1), s(z2)) → f2_out1(z1)
f30_in(0) → f30_out1(0)
f30_in(s(z0)) → U2(f55_in(z0), s(z0))
U2(f55_out1(z0, z1), s(z2)) → f30_out1(z1)
f27_in(z0) → U3(f30_in(z0), z0)
U3(f30_out1(z0), z1) → U4(f2_in(z0), z1, z0)
U4(f2_out1(z0), z1, z2) → f27_out1(z2, z0)
f55_in(z0) → U5(f30_in(z0), z0)
U5(f30_out1(z0), z1) → U6(f30_in(z0), z1, z0)
U6(f30_out1(z0), z1, z2) → f55_out1(z2, z0)
Tuples:

F27_IN(z0) → c6(U3'(f30_in(z0), z0), F30_IN(z0))
F55_IN(z0) → c9(U5'(f30_in(z0), z0), F30_IN(z0))
F2_IN(s(z0)) → c1(F27_IN(z0))
F30_IN(s(z0)) → c4(F55_IN(z0))
U3'(f30_out1(z0), z1) → c7(F2_IN(z0))
U5'(f30_out1(z0), z1) → c10(F30_IN(z0))
S tuples:

U3'(f30_out1(z0), z1) → c7(F2_IN(z0))
U5'(f30_out1(z0), z1) → c10(F30_IN(z0))
K tuples:

F27_IN(z0) → c6(U3'(f30_in(z0), z0), F30_IN(z0))
F55_IN(z0) → c9(U5'(f30_in(z0), z0), F30_IN(z0))
F2_IN(s(z0)) → c1(F27_IN(z0))
F30_IN(s(z0)) → c4(F55_IN(z0))
Defined Rule Symbols:

f2_in, U1, f30_in, U2, f27_in, U3, U4, f55_in, U5, U6

Defined Pair Symbols:

F27_IN, F55_IN, F2_IN, F30_IN, U3', U5'

Compound Symbols:

c6, c9, c1, c4, c7, c10

(7) CdtKnowledgeProof (EQUIVALENT transformation)

The following tuples could be moved from S to K by knowledge propagation:

U3'(f30_out1(z0), z1) → c7(F2_IN(z0))
U5'(f30_out1(z0), z1) → c10(F30_IN(z0))
F2_IN(s(z0)) → c1(F27_IN(z0))
F30_IN(s(z0)) → c4(F55_IN(z0))
Now S is empty

(8) BOUNDS(O(1), O(1))

(9) PrologToCdtProblemTransformerProof (UPPER BOUND (ID) transformation)

Built complexity over-approximating cdt problems from derivation graph.

(10) Obligation:

Complexity Dependency Tuples Problem
Rules:

f1_in(0) → f1_out1(0)
f1_in(s(z0)) → U1(f25_in(z0), s(z0))
U1(f25_out1(z0, z1), s(z2)) → f1_out1(z1)
f29_in(0) → f29_out1(0)
f29_in(s(z0)) → U2(f53_in(z0), s(z0))
U2(f53_out1(z0, z1), s(z2)) → f29_out1(z1)
f25_in(z0) → U3(f29_in(z0), z0)
U3(f29_out1(z0), z1) → U4(f1_in(z0), z1, z0)
U4(f1_out1(z0), z1, z2) → f25_out1(z2, z0)
f53_in(z0) → U5(f29_in(z0), z0)
U5(f29_out1(z0), z1) → U6(f29_in(z0), z1, z0)
U6(f29_out1(z0), z1, z2) → f53_out1(z2, z0)
Tuples:

F1_IN(s(z0)) → c1(U1'(f25_in(z0), s(z0)), F25_IN(z0))
F29_IN(s(z0)) → c4(U2'(f53_in(z0), s(z0)), F53_IN(z0))
F25_IN(z0) → c6(U3'(f29_in(z0), z0), F29_IN(z0))
U3'(f29_out1(z0), z1) → c7(U4'(f1_in(z0), z1, z0), F1_IN(z0))
F53_IN(z0) → c9(U5'(f29_in(z0), z0), F29_IN(z0))
U5'(f29_out1(z0), z1) → c10(U6'(f29_in(z0), z1, z0), F29_IN(z0))
S tuples:

F1_IN(s(z0)) → c1(U1'(f25_in(z0), s(z0)), F25_IN(z0))
F29_IN(s(z0)) → c4(U2'(f53_in(z0), s(z0)), F53_IN(z0))
F25_IN(z0) → c6(U3'(f29_in(z0), z0), F29_IN(z0))
U3'(f29_out1(z0), z1) → c7(U4'(f1_in(z0), z1, z0), F1_IN(z0))
F53_IN(z0) → c9(U5'(f29_in(z0), z0), F29_IN(z0))
U5'(f29_out1(z0), z1) → c10(U6'(f29_in(z0), z1, z0), F29_IN(z0))
K tuples:none
Defined Rule Symbols:

f1_in, U1, f29_in, U2, f25_in, U3, U4, f53_in, U5, U6

Defined Pair Symbols:

F1_IN, F29_IN, F25_IN, U3', F53_IN, U5'

Compound Symbols:

c1, c4, c6, c7, c9, c10

(11) CdtGraphRemoveTrailingTuplepartsProof (BOTH BOUNDS(ID, ID) transformation)

Removed 4 trailing tuple parts

(12) Obligation:

Complexity Dependency Tuples Problem
Rules:

f1_in(0) → f1_out1(0)
f1_in(s(z0)) → U1(f25_in(z0), s(z0))
U1(f25_out1(z0, z1), s(z2)) → f1_out1(z1)
f29_in(0) → f29_out1(0)
f29_in(s(z0)) → U2(f53_in(z0), s(z0))
U2(f53_out1(z0, z1), s(z2)) → f29_out1(z1)
f25_in(z0) → U3(f29_in(z0), z0)
U3(f29_out1(z0), z1) → U4(f1_in(z0), z1, z0)
U4(f1_out1(z0), z1, z2) → f25_out1(z2, z0)
f53_in(z0) → U5(f29_in(z0), z0)
U5(f29_out1(z0), z1) → U6(f29_in(z0), z1, z0)
U6(f29_out1(z0), z1, z2) → f53_out1(z2, z0)
Tuples:

F25_IN(z0) → c6(U3'(f29_in(z0), z0), F29_IN(z0))
F53_IN(z0) → c9(U5'(f29_in(z0), z0), F29_IN(z0))
F1_IN(s(z0)) → c1(F25_IN(z0))
F29_IN(s(z0)) → c4(F53_IN(z0))
U3'(f29_out1(z0), z1) → c7(F1_IN(z0))
U5'(f29_out1(z0), z1) → c10(F29_IN(z0))
S tuples:

F25_IN(z0) → c6(U3'(f29_in(z0), z0), F29_IN(z0))
F53_IN(z0) → c9(U5'(f29_in(z0), z0), F29_IN(z0))
F1_IN(s(z0)) → c1(F25_IN(z0))
F29_IN(s(z0)) → c4(F53_IN(z0))
U3'(f29_out1(z0), z1) → c7(F1_IN(z0))
U5'(f29_out1(z0), z1) → c10(F29_IN(z0))
K tuples:none
Defined Rule Symbols:

f1_in, U1, f29_in, U2, f25_in, U3, U4, f53_in, U5, U6

Defined Pair Symbols:

F25_IN, F53_IN, F1_IN, F29_IN, U3', U5'

Compound Symbols:

c6, c9, c1, c4, c7, c10

(13) CdtPolyRedPairProof (UPPER BOUND (ADD(O(n^1))) transformation)

Found a reduction pair which oriented the following tuples strictly. Hence they can be removed from S.

F25_IN(z0) → c6(U3'(f29_in(z0), z0), F29_IN(z0))
F53_IN(z0) → c9(U5'(f29_in(z0), z0), F29_IN(z0))
F1_IN(s(z0)) → c1(F25_IN(z0))
F29_IN(s(z0)) → c4(F53_IN(z0))
We considered the (Usable) Rules:

f29_in(0) → f29_out1(0)
f29_in(s(z0)) → U2(f53_in(z0), s(z0))
f53_in(z0) → U5(f29_in(z0), z0)
U2(f53_out1(z0, z1), s(z2)) → f29_out1(z1)
U5(f29_out1(z0), z1) → U6(f29_in(z0), z1, z0)
U6(f29_out1(z0), z1, z2) → f53_out1(z2, z0)
And the Tuples:

F25_IN(z0) → c6(U3'(f29_in(z0), z0), F29_IN(z0))
F53_IN(z0) → c9(U5'(f29_in(z0), z0), F29_IN(z0))
F1_IN(s(z0)) → c1(F25_IN(z0))
F29_IN(s(z0)) → c4(F53_IN(z0))
U3'(f29_out1(z0), z1) → c7(F1_IN(z0))
U5'(f29_out1(z0), z1) → c10(F29_IN(z0))
The order we found is given by the following interpretation:
Polynomial interpretation :

POL(0) = 0   
POL(F1_IN(x1)) = [2]x1   
POL(F25_IN(x1)) = [1] + [2]x1   
POL(F29_IN(x1)) = x1   
POL(F53_IN(x1)) = [1] + x1   
POL(U2(x1, x2)) = [2]x1   
POL(U3'(x1, x2)) = [2]x1   
POL(U5(x1, x2)) = [3]x1   
POL(U5'(x1, x2)) = [2]x1   
POL(U6(x1, x2, x3)) = [2]x1   
POL(c1(x1)) = x1   
POL(c10(x1)) = x1   
POL(c4(x1)) = x1   
POL(c6(x1, x2)) = x1 + x2   
POL(c7(x1)) = x1   
POL(c9(x1, x2)) = x1 + x2   
POL(f29_in(x1)) = 0   
POL(f29_out1(x1)) = x1   
POL(f53_in(x1)) = 0   
POL(f53_out1(x1, x2)) = x2   
POL(s(x1)) = [2] + x1   

(14) Obligation:

Complexity Dependency Tuples Problem
Rules:

f1_in(0) → f1_out1(0)
f1_in(s(z0)) → U1(f25_in(z0), s(z0))
U1(f25_out1(z0, z1), s(z2)) → f1_out1(z1)
f29_in(0) → f29_out1(0)
f29_in(s(z0)) → U2(f53_in(z0), s(z0))
U2(f53_out1(z0, z1), s(z2)) → f29_out1(z1)
f25_in(z0) → U3(f29_in(z0), z0)
U3(f29_out1(z0), z1) → U4(f1_in(z0), z1, z0)
U4(f1_out1(z0), z1, z2) → f25_out1(z2, z0)
f53_in(z0) → U5(f29_in(z0), z0)
U5(f29_out1(z0), z1) → U6(f29_in(z0), z1, z0)
U6(f29_out1(z0), z1, z2) → f53_out1(z2, z0)
Tuples:

F25_IN(z0) → c6(U3'(f29_in(z0), z0), F29_IN(z0))
F53_IN(z0) → c9(U5'(f29_in(z0), z0), F29_IN(z0))
F1_IN(s(z0)) → c1(F25_IN(z0))
F29_IN(s(z0)) → c4(F53_IN(z0))
U3'(f29_out1(z0), z1) → c7(F1_IN(z0))
U5'(f29_out1(z0), z1) → c10(F29_IN(z0))
S tuples:

U3'(f29_out1(z0), z1) → c7(F1_IN(z0))
U5'(f29_out1(z0), z1) → c10(F29_IN(z0))
K tuples:

F25_IN(z0) → c6(U3'(f29_in(z0), z0), F29_IN(z0))
F53_IN(z0) → c9(U5'(f29_in(z0), z0), F29_IN(z0))
F1_IN(s(z0)) → c1(F25_IN(z0))
F29_IN(s(z0)) → c4(F53_IN(z0))
Defined Rule Symbols:

f1_in, U1, f29_in, U2, f25_in, U3, U4, f53_in, U5, U6

Defined Pair Symbols:

F25_IN, F53_IN, F1_IN, F29_IN, U3', U5'

Compound Symbols:

c6, c9, c1, c4, c7, c10