(0) Obligation:

Clauses:

p(cons(X, nil)).
p(cons(s(s(X)), cons(Y, Xs))) :- ','(p(cons(X, cons(Y, Xs))), p(cons(s(s(s(s(Y)))), Xs))).
p(cons(0, Xs)) :- p(Xs).

Query: p(g)

(1) PrologToTRSTransformerProof (SOUND transformation)

Transformed Prolog program to TRS.

(2) Obligation:

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

f3_in(cons(T6, nil)) → f3_out1
f3_in(cons(s(s(T19)), cons(T20, T21))) → U1(f34_in(T19, T20, T21), cons(s(s(T19)), cons(T20, T21)))
U1(f34_out1, cons(s(s(T19)), cons(T20, T21))) → f3_out1
f3_in(cons(0, T30)) → U2(f3_in(T30), cons(0, T30))
U2(f3_out1, cons(0, T30)) → f3_out1
f34_in(T19, T20, T21) → U3(f3_in(cons(T19, cons(T20, T21))), T19, T20, T21)
U3(f3_out1, T19, T20, T21) → U4(f3_in(cons(s(s(s(s(T20)))), T21)), T19, T20, T21)
U4(f3_out1, T19, T20, T21) → f34_out1

Q is empty.

(3) DependencyPairsProof (EQUIVALENT transformation)

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

(4) Obligation:

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

F3_IN(cons(s(s(T19)), cons(T20, T21))) → U11(f34_in(T19, T20, T21), cons(s(s(T19)), cons(T20, T21)))
F3_IN(cons(s(s(T19)), cons(T20, T21))) → F34_IN(T19, T20, T21)
F3_IN(cons(0, T30)) → U21(f3_in(T30), cons(0, T30))
F3_IN(cons(0, T30)) → F3_IN(T30)
F34_IN(T19, T20, T21) → U31(f3_in(cons(T19, cons(T20, T21))), T19, T20, T21)
F34_IN(T19, T20, T21) → F3_IN(cons(T19, cons(T20, T21)))
U31(f3_out1, T19, T20, T21) → U41(f3_in(cons(s(s(s(s(T20)))), T21)), T19, T20, T21)
U31(f3_out1, T19, T20, T21) → F3_IN(cons(s(s(s(s(T20)))), T21))

The TRS R consists of the following rules:

f3_in(cons(T6, nil)) → f3_out1
f3_in(cons(s(s(T19)), cons(T20, T21))) → U1(f34_in(T19, T20, T21), cons(s(s(T19)), cons(T20, T21)))
U1(f34_out1, cons(s(s(T19)), cons(T20, T21))) → f3_out1
f3_in(cons(0, T30)) → U2(f3_in(T30), cons(0, T30))
U2(f3_out1, cons(0, T30)) → f3_out1
f34_in(T19, T20, T21) → U3(f3_in(cons(T19, cons(T20, T21))), T19, T20, T21)
U3(f3_out1, T19, T20, T21) → U4(f3_in(cons(s(s(s(s(T20)))), T21)), T19, T20, T21)
U4(f3_out1, T19, T20, T21) → f34_out1

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

(5) DependencyGraphProof (EQUIVALENT transformation)

The approximation of the Dependency Graph [LPAR04,FROCOS05,EDGSTAR] contains 1 SCC with 3 less nodes.

(6) Obligation:

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

F3_IN(cons(s(s(T19)), cons(T20, T21))) → F34_IN(T19, T20, T21)
F34_IN(T19, T20, T21) → U31(f3_in(cons(T19, cons(T20, T21))), T19, T20, T21)
U31(f3_out1, T19, T20, T21) → F3_IN(cons(s(s(s(s(T20)))), T21))
F34_IN(T19, T20, T21) → F3_IN(cons(T19, cons(T20, T21)))
F3_IN(cons(0, T30)) → F3_IN(T30)

The TRS R consists of the following rules:

f3_in(cons(T6, nil)) → f3_out1
f3_in(cons(s(s(T19)), cons(T20, T21))) → U1(f34_in(T19, T20, T21), cons(s(s(T19)), cons(T20, T21)))
U1(f34_out1, cons(s(s(T19)), cons(T20, T21))) → f3_out1
f3_in(cons(0, T30)) → U2(f3_in(T30), cons(0, T30))
U2(f3_out1, cons(0, T30)) → f3_out1
f34_in(T19, T20, T21) → U3(f3_in(cons(T19, cons(T20, T21))), T19, T20, T21)
U3(f3_out1, T19, T20, T21) → U4(f3_in(cons(s(s(s(s(T20)))), T21)), T19, T20, T21)
U4(f3_out1, T19, T20, T21) → f34_out1

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

(7) QDPOrderProof (EQUIVALENT transformation)

We use the reduction pair processor [LPAR04,JAR06].


The following pairs can be oriented strictly and are deleted.


F3_IN(cons(0, T30)) → F3_IN(T30)
The remaining pairs can at least be oriented weakly.
Used ordering: Polynomial interpretation [POLO]:

POL(0) = 1   
POL(F34_IN(x1, x2, x3)) = x1 + x2 + x3   
POL(F3_IN(x1)) = x1   
POL(U1(x1, x2)) = 0   
POL(U2(x1, x2)) = 0   
POL(U3(x1, x2, x3, x4)) = 0   
POL(U31(x1, x2, x3, x4)) = x2 + x3 + x4   
POL(U4(x1, x2, x3, x4)) = 0   
POL(cons(x1, x2)) = x1 + x2   
POL(f34_in(x1, x2, x3)) = 0   
POL(f34_out1) = 0   
POL(f3_in(x1)) = 1 + x1   
POL(f3_out1) = 1   
POL(nil) = 1   
POL(s(x1)) = x1   

The following usable rules [FROCOS05] with respect to the argument filtering of the ordering [JAR06] were oriented:
none

(8) Obligation:

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

F3_IN(cons(s(s(T19)), cons(T20, T21))) → F34_IN(T19, T20, T21)
F34_IN(T19, T20, T21) → U31(f3_in(cons(T19, cons(T20, T21))), T19, T20, T21)
U31(f3_out1, T19, T20, T21) → F3_IN(cons(s(s(s(s(T20)))), T21))
F34_IN(T19, T20, T21) → F3_IN(cons(T19, cons(T20, T21)))

The TRS R consists of the following rules:

f3_in(cons(T6, nil)) → f3_out1
f3_in(cons(s(s(T19)), cons(T20, T21))) → U1(f34_in(T19, T20, T21), cons(s(s(T19)), cons(T20, T21)))
U1(f34_out1, cons(s(s(T19)), cons(T20, T21))) → f3_out1
f3_in(cons(0, T30)) → U2(f3_in(T30), cons(0, T30))
U2(f3_out1, cons(0, T30)) → f3_out1
f34_in(T19, T20, T21) → U3(f3_in(cons(T19, cons(T20, T21))), T19, T20, T21)
U3(f3_out1, T19, T20, T21) → U4(f3_in(cons(s(s(s(s(T20)))), T21)), T19, T20, T21)
U4(f3_out1, T19, T20, T21) → f34_out1

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

(9) QDPOrderProof (EQUIVALENT transformation)

We use the reduction pair processor [LPAR04,JAR06].


The following pairs can be oriented strictly and are deleted.


U31(f3_out1, T19, T20, T21) → F3_IN(cons(s(s(s(s(T20)))), T21))
The remaining pairs can at least be oriented weakly.
Used ordering: Polynomial Order [NEGPOLO,POLO] with Interpretation:

POL( U31(x1, ..., x4) ) = 2x4 + 2


POL( f3_in(x1) ) = max{0, -2}


POL( cons(x1, x2) ) = x2 + 1


POL( s(x1) ) = 0


POL( U1(x1, x2) ) = max{0, 2x1 - 1}


POL( f34_in(x1, ..., x3) ) = x3


POL( 0 ) = 2


POL( U2(x1, x2) ) = 1


POL( f34_out1 ) = 2


POL( f3_out1 ) = 0


POL( U3(x1, ..., x4) ) = max{0, x2 + x4 - 2}


POL( U4(x1, ..., x4) ) = max{0, x1 - 1}


POL( nil ) = 0


POL( F3_IN(x1) ) = max{0, 2x1 - 2}


POL( F34_IN(x1, ..., x3) ) = 2x3 + 2



The following usable rules [FROCOS05] with respect to the argument filtering of the ordering [JAR06] were oriented:
none

(10) Obligation:

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

F3_IN(cons(s(s(T19)), cons(T20, T21))) → F34_IN(T19, T20, T21)
F34_IN(T19, T20, T21) → U31(f3_in(cons(T19, cons(T20, T21))), T19, T20, T21)
F34_IN(T19, T20, T21) → F3_IN(cons(T19, cons(T20, T21)))

The TRS R consists of the following rules:

f3_in(cons(T6, nil)) → f3_out1
f3_in(cons(s(s(T19)), cons(T20, T21))) → U1(f34_in(T19, T20, T21), cons(s(s(T19)), cons(T20, T21)))
U1(f34_out1, cons(s(s(T19)), cons(T20, T21))) → f3_out1
f3_in(cons(0, T30)) → U2(f3_in(T30), cons(0, T30))
U2(f3_out1, cons(0, T30)) → f3_out1
f34_in(T19, T20, T21) → U3(f3_in(cons(T19, cons(T20, T21))), T19, T20, T21)
U3(f3_out1, T19, T20, T21) → U4(f3_in(cons(s(s(s(s(T20)))), T21)), T19, T20, T21)
U4(f3_out1, T19, T20, T21) → f34_out1

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

(11) DependencyGraphProof (EQUIVALENT transformation)

The approximation of the Dependency Graph [LPAR04,FROCOS05,EDGSTAR] contains 1 SCC with 1 less node.

(12) Obligation:

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

F34_IN(T19, T20, T21) → F3_IN(cons(T19, cons(T20, T21)))
F3_IN(cons(s(s(T19)), cons(T20, T21))) → F34_IN(T19, T20, T21)

The TRS R consists of the following rules:

f3_in(cons(T6, nil)) → f3_out1
f3_in(cons(s(s(T19)), cons(T20, T21))) → U1(f34_in(T19, T20, T21), cons(s(s(T19)), cons(T20, T21)))
U1(f34_out1, cons(s(s(T19)), cons(T20, T21))) → f3_out1
f3_in(cons(0, T30)) → U2(f3_in(T30), cons(0, T30))
U2(f3_out1, cons(0, T30)) → f3_out1
f34_in(T19, T20, T21) → U3(f3_in(cons(T19, cons(T20, T21))), T19, T20, T21)
U3(f3_out1, T19, T20, T21) → U4(f3_in(cons(s(s(s(s(T20)))), T21)), T19, T20, T21)
U4(f3_out1, T19, T20, T21) → f34_out1

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

(13) UsableRulesProof (EQUIVALENT transformation)

We can use the usable rules and reduction pair processor [LPAR04] with the Ce-compatible extension of the polynomial order that maps every function symbol to the sum of its arguments. Then, we can delete all non-usable rules [FROCOS05] from R.

(14) Obligation:

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

F34_IN(T19, T20, T21) → F3_IN(cons(T19, cons(T20, T21)))
F3_IN(cons(s(s(T19)), cons(T20, T21))) → F34_IN(T19, T20, T21)

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

(15) UsableRulesReductionPairsProof (EQUIVALENT transformation)

By using the usable rules with reduction pair processor [LPAR04] with a polynomial ordering [POLO], all dependency pairs and the corresponding usable rules [FROCOS05] can be oriented non-strictly. All non-usable rules are removed, and those dependency pairs and usable rules that have been oriented strictly or contain non-usable symbols in their left-hand side are removed as well.

The following dependency pairs can be deleted:

F3_IN(cons(s(s(T19)), cons(T20, T21))) → F34_IN(T19, T20, T21)
No rules are removed from R.

Used ordering: POLO with Polynomial interpretation [POLO]:

POL(F34_IN(x1, x2, x3)) = x1 + x2 + x3   
POL(F3_IN(x1)) = x1   
POL(cons(x1, x2)) = x1 + x2   
POL(s(x1)) = 2·x1   

(16) Obligation:

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

F34_IN(T19, T20, T21) → F3_IN(cons(T19, cons(T20, T21)))

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

(17) DependencyGraphProof (EQUIVALENT transformation)

The approximation of the Dependency Graph [LPAR04,FROCOS05,EDGSTAR] contains 0 SCCs with 1 less node.

(18) TRUE