(0) Obligation:

Clauses:

h(X) :- ','(f(X), g(X)).
f(c(0, X1)).
f(c(X, Y)) :- ','(no(zero(X)), ','(p(X, P), f(c(P, s(Y))))).
g(c(X2, 0)).
g(c(X, Y)) :- ','(no(zero(Y)), ','(p(Y, P), g(c(s(X), P)))).
p(0, 0).
p(s(X), X).
zero(0).
no(X) :- ','(X, ','(!, failure(a))).
no(X3).
failure(b).

Queries:

h(g).

(1) PrologToPrologProblemTransformerProof (SOUND transformation)

Built Prolog problem from termination graph.

(2) Obligation:

Clauses:

f4(c(0, T3)).
f4(c(s(T8), T5)) :- f4(c(T8, s(T5))).
g5(c(T9, 0)).
g5(c(T10, s(T14))) :- g5(c(s(T10), T14)).
h1(T2) :- f4(T2).
h1(c(T9, 0)) :- f4(c(T9, 0)).
h1(c(T10, s(T14))) :- ','(f4(c(T10, s(T14))), g5(c(s(T10), T14))).

Queries:

h1(g).

(3) PrologToPiTRSProof (SOUND transformation)

We use the technique of [LOPSTR]. With regard to the inferred argument filtering the predicates were used in the following modes:
h1_in: (b)
f4_in: (b)
g5_in: (b)
Transforming Prolog into the following Term Rewriting System:
Pi-finite rewrite system:
The TRS R consists of the following rules:

h1_in_g(T2) → U3_g(T2, f4_in_g(T2))
f4_in_g(c(0, T3)) → f4_out_g(c(0, T3))
f4_in_g(c(s(T8), T5)) → U1_g(T8, T5, f4_in_g(c(T8, s(T5))))
U1_g(T8, T5, f4_out_g(c(T8, s(T5)))) → f4_out_g(c(s(T8), T5))
U3_g(T2, f4_out_g(T2)) → h1_out_g(T2)
h1_in_g(c(T9, 0)) → U4_g(T9, f4_in_g(c(T9, 0)))
U4_g(T9, f4_out_g(c(T9, 0))) → h1_out_g(c(T9, 0))
h1_in_g(c(T10, s(T14))) → U5_g(T10, T14, f4_in_g(c(T10, s(T14))))
U5_g(T10, T14, f4_out_g(c(T10, s(T14)))) → U6_g(T10, T14, g5_in_g(c(s(T10), T14)))
g5_in_g(c(T9, 0)) → g5_out_g(c(T9, 0))
g5_in_g(c(T10, s(T14))) → U2_g(T10, T14, g5_in_g(c(s(T10), T14)))
U2_g(T10, T14, g5_out_g(c(s(T10), T14))) → g5_out_g(c(T10, s(T14)))
U6_g(T10, T14, g5_out_g(c(s(T10), T14))) → h1_out_g(c(T10, s(T14)))

Pi is empty.

Infinitary Constructor Rewriting Termination of PiTRS implies Termination of Prolog

(4) Obligation:

Pi-finite rewrite system:
The TRS R consists of the following rules:

h1_in_g(T2) → U3_g(T2, f4_in_g(T2))
f4_in_g(c(0, T3)) → f4_out_g(c(0, T3))
f4_in_g(c(s(T8), T5)) → U1_g(T8, T5, f4_in_g(c(T8, s(T5))))
U1_g(T8, T5, f4_out_g(c(T8, s(T5)))) → f4_out_g(c(s(T8), T5))
U3_g(T2, f4_out_g(T2)) → h1_out_g(T2)
h1_in_g(c(T9, 0)) → U4_g(T9, f4_in_g(c(T9, 0)))
U4_g(T9, f4_out_g(c(T9, 0))) → h1_out_g(c(T9, 0))
h1_in_g(c(T10, s(T14))) → U5_g(T10, T14, f4_in_g(c(T10, s(T14))))
U5_g(T10, T14, f4_out_g(c(T10, s(T14)))) → U6_g(T10, T14, g5_in_g(c(s(T10), T14)))
g5_in_g(c(T9, 0)) → g5_out_g(c(T9, 0))
g5_in_g(c(T10, s(T14))) → U2_g(T10, T14, g5_in_g(c(s(T10), T14)))
U2_g(T10, T14, g5_out_g(c(s(T10), T14))) → g5_out_g(c(T10, s(T14)))
U6_g(T10, T14, g5_out_g(c(s(T10), T14))) → h1_out_g(c(T10, s(T14)))

Pi is empty.

(5) DependencyPairsProof (EQUIVALENT transformation)

Using Dependency Pairs [AG00,LOPSTR] we result in the following initial DP problem:
Pi DP problem:
The TRS P consists of the following rules:

H1_IN_G(T2) → U3_G(T2, f4_in_g(T2))
H1_IN_G(T2) → F4_IN_G(T2)
F4_IN_G(c(s(T8), T5)) → U1_G(T8, T5, f4_in_g(c(T8, s(T5))))
F4_IN_G(c(s(T8), T5)) → F4_IN_G(c(T8, s(T5)))
H1_IN_G(c(T9, 0)) → U4_G(T9, f4_in_g(c(T9, 0)))
H1_IN_G(c(T9, 0)) → F4_IN_G(c(T9, 0))
H1_IN_G(c(T10, s(T14))) → U5_G(T10, T14, f4_in_g(c(T10, s(T14))))
H1_IN_G(c(T10, s(T14))) → F4_IN_G(c(T10, s(T14)))
U5_G(T10, T14, f4_out_g(c(T10, s(T14)))) → U6_G(T10, T14, g5_in_g(c(s(T10), T14)))
U5_G(T10, T14, f4_out_g(c(T10, s(T14)))) → G5_IN_G(c(s(T10), T14))
G5_IN_G(c(T10, s(T14))) → U2_G(T10, T14, g5_in_g(c(s(T10), T14)))
G5_IN_G(c(T10, s(T14))) → G5_IN_G(c(s(T10), T14))

The TRS R consists of the following rules:

h1_in_g(T2) → U3_g(T2, f4_in_g(T2))
f4_in_g(c(0, T3)) → f4_out_g(c(0, T3))
f4_in_g(c(s(T8), T5)) → U1_g(T8, T5, f4_in_g(c(T8, s(T5))))
U1_g(T8, T5, f4_out_g(c(T8, s(T5)))) → f4_out_g(c(s(T8), T5))
U3_g(T2, f4_out_g(T2)) → h1_out_g(T2)
h1_in_g(c(T9, 0)) → U4_g(T9, f4_in_g(c(T9, 0)))
U4_g(T9, f4_out_g(c(T9, 0))) → h1_out_g(c(T9, 0))
h1_in_g(c(T10, s(T14))) → U5_g(T10, T14, f4_in_g(c(T10, s(T14))))
U5_g(T10, T14, f4_out_g(c(T10, s(T14)))) → U6_g(T10, T14, g5_in_g(c(s(T10), T14)))
g5_in_g(c(T9, 0)) → g5_out_g(c(T9, 0))
g5_in_g(c(T10, s(T14))) → U2_g(T10, T14, g5_in_g(c(s(T10), T14)))
U2_g(T10, T14, g5_out_g(c(s(T10), T14))) → g5_out_g(c(T10, s(T14)))
U6_g(T10, T14, g5_out_g(c(s(T10), T14))) → h1_out_g(c(T10, s(T14)))

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

(6) Obligation:

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

H1_IN_G(T2) → U3_G(T2, f4_in_g(T2))
H1_IN_G(T2) → F4_IN_G(T2)
F4_IN_G(c(s(T8), T5)) → U1_G(T8, T5, f4_in_g(c(T8, s(T5))))
F4_IN_G(c(s(T8), T5)) → F4_IN_G(c(T8, s(T5)))
H1_IN_G(c(T9, 0)) → U4_G(T9, f4_in_g(c(T9, 0)))
H1_IN_G(c(T9, 0)) → F4_IN_G(c(T9, 0))
H1_IN_G(c(T10, s(T14))) → U5_G(T10, T14, f4_in_g(c(T10, s(T14))))
H1_IN_G(c(T10, s(T14))) → F4_IN_G(c(T10, s(T14)))
U5_G(T10, T14, f4_out_g(c(T10, s(T14)))) → U6_G(T10, T14, g5_in_g(c(s(T10), T14)))
U5_G(T10, T14, f4_out_g(c(T10, s(T14)))) → G5_IN_G(c(s(T10), T14))
G5_IN_G(c(T10, s(T14))) → U2_G(T10, T14, g5_in_g(c(s(T10), T14)))
G5_IN_G(c(T10, s(T14))) → G5_IN_G(c(s(T10), T14))

The TRS R consists of the following rules:

h1_in_g(T2) → U3_g(T2, f4_in_g(T2))
f4_in_g(c(0, T3)) → f4_out_g(c(0, T3))
f4_in_g(c(s(T8), T5)) → U1_g(T8, T5, f4_in_g(c(T8, s(T5))))
U1_g(T8, T5, f4_out_g(c(T8, s(T5)))) → f4_out_g(c(s(T8), T5))
U3_g(T2, f4_out_g(T2)) → h1_out_g(T2)
h1_in_g(c(T9, 0)) → U4_g(T9, f4_in_g(c(T9, 0)))
U4_g(T9, f4_out_g(c(T9, 0))) → h1_out_g(c(T9, 0))
h1_in_g(c(T10, s(T14))) → U5_g(T10, T14, f4_in_g(c(T10, s(T14))))
U5_g(T10, T14, f4_out_g(c(T10, s(T14)))) → U6_g(T10, T14, g5_in_g(c(s(T10), T14)))
g5_in_g(c(T9, 0)) → g5_out_g(c(T9, 0))
g5_in_g(c(T10, s(T14))) → U2_g(T10, T14, g5_in_g(c(s(T10), T14)))
U2_g(T10, T14, g5_out_g(c(s(T10), T14))) → g5_out_g(c(T10, s(T14)))
U6_g(T10, T14, g5_out_g(c(s(T10), T14))) → h1_out_g(c(T10, s(T14)))

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

(7) DependencyGraphProof (EQUIVALENT transformation)

The approximation of the Dependency Graph [LOPSTR] contains 2 SCCs with 10 less nodes.

(8) Complex Obligation (AND)

(9) Obligation:

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

G5_IN_G(c(T10, s(T14))) → G5_IN_G(c(s(T10), T14))

The TRS R consists of the following rules:

h1_in_g(T2) → U3_g(T2, f4_in_g(T2))
f4_in_g(c(0, T3)) → f4_out_g(c(0, T3))
f4_in_g(c(s(T8), T5)) → U1_g(T8, T5, f4_in_g(c(T8, s(T5))))
U1_g(T8, T5, f4_out_g(c(T8, s(T5)))) → f4_out_g(c(s(T8), T5))
U3_g(T2, f4_out_g(T2)) → h1_out_g(T2)
h1_in_g(c(T9, 0)) → U4_g(T9, f4_in_g(c(T9, 0)))
U4_g(T9, f4_out_g(c(T9, 0))) → h1_out_g(c(T9, 0))
h1_in_g(c(T10, s(T14))) → U5_g(T10, T14, f4_in_g(c(T10, s(T14))))
U5_g(T10, T14, f4_out_g(c(T10, s(T14)))) → U6_g(T10, T14, g5_in_g(c(s(T10), T14)))
g5_in_g(c(T9, 0)) → g5_out_g(c(T9, 0))
g5_in_g(c(T10, s(T14))) → U2_g(T10, T14, g5_in_g(c(s(T10), T14)))
U2_g(T10, T14, g5_out_g(c(s(T10), T14))) → g5_out_g(c(T10, s(T14)))
U6_g(T10, T14, g5_out_g(c(s(T10), T14))) → h1_out_g(c(T10, s(T14)))

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

(10) UsableRulesProof (EQUIVALENT transformation)

For (infinitary) constructor rewriting [LOPSTR] we can delete all non-usable rules from R.

(11) Obligation:

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

G5_IN_G(c(T10, s(T14))) → G5_IN_G(c(s(T10), T14))

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

(12) PiDPToQDPProof (EQUIVALENT transformation)

Transforming (infinitary) constructor rewriting Pi-DP problem [LOPSTR] into ordinary QDP problem [LPAR04] by application of Pi.

(13) Obligation:

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

G5_IN_G(c(T10, s(T14))) → G5_IN_G(c(s(T10), T14))

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

(14) MRRProof (EQUIVALENT transformation)

By using the rule removal processor [LPAR04] with the following ordering, at least one Dependency Pair or term rewrite system rule of this QDP problem can be strictly oriented.
Strictly oriented dependency pairs:

G5_IN_G(c(T10, s(T14))) → G5_IN_G(c(s(T10), T14))


Used ordering: Polynomial interpretation [POLO]:

POL(G5_IN_G(x1)) = 2·x1   
POL(c(x1, x2)) = x1 + 2·x2   
POL(s(x1)) = 1 + x1   

(15) Obligation:

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

(16) PisEmptyProof (EQUIVALENT transformation)

The TRS P is empty. Hence, there is no (P,Q,R) chain.

(17) TRUE

(18) Obligation:

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

F4_IN_G(c(s(T8), T5)) → F4_IN_G(c(T8, s(T5)))

The TRS R consists of the following rules:

h1_in_g(T2) → U3_g(T2, f4_in_g(T2))
f4_in_g(c(0, T3)) → f4_out_g(c(0, T3))
f4_in_g(c(s(T8), T5)) → U1_g(T8, T5, f4_in_g(c(T8, s(T5))))
U1_g(T8, T5, f4_out_g(c(T8, s(T5)))) → f4_out_g(c(s(T8), T5))
U3_g(T2, f4_out_g(T2)) → h1_out_g(T2)
h1_in_g(c(T9, 0)) → U4_g(T9, f4_in_g(c(T9, 0)))
U4_g(T9, f4_out_g(c(T9, 0))) → h1_out_g(c(T9, 0))
h1_in_g(c(T10, s(T14))) → U5_g(T10, T14, f4_in_g(c(T10, s(T14))))
U5_g(T10, T14, f4_out_g(c(T10, s(T14)))) → U6_g(T10, T14, g5_in_g(c(s(T10), T14)))
g5_in_g(c(T9, 0)) → g5_out_g(c(T9, 0))
g5_in_g(c(T10, s(T14))) → U2_g(T10, T14, g5_in_g(c(s(T10), T14)))
U2_g(T10, T14, g5_out_g(c(s(T10), T14))) → g5_out_g(c(T10, s(T14)))
U6_g(T10, T14, g5_out_g(c(s(T10), T14))) → h1_out_g(c(T10, s(T14)))

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

(19) UsableRulesProof (EQUIVALENT transformation)

For (infinitary) constructor rewriting [LOPSTR] we can delete all non-usable rules from R.

(20) Obligation:

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

F4_IN_G(c(s(T8), T5)) → F4_IN_G(c(T8, s(T5)))

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

(21) PiDPToQDPProof (EQUIVALENT transformation)

Transforming (infinitary) constructor rewriting Pi-DP problem [LOPSTR] into ordinary QDP problem [LPAR04] by application of Pi.

(22) Obligation:

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

F4_IN_G(c(s(T8), T5)) → F4_IN_G(c(T8, s(T5)))

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

(23) MRRProof (EQUIVALENT transformation)

By using the rule removal processor [LPAR04] with the following ordering, at least one Dependency Pair or term rewrite system rule of this QDP problem can be strictly oriented.
Strictly oriented dependency pairs:

F4_IN_G(c(s(T8), T5)) → F4_IN_G(c(T8, s(T5)))


Used ordering: Polynomial interpretation [POLO]:

POL(F4_IN_G(x1)) = 2·x1   
POL(c(x1, x2)) = 2·x1 + x2   
POL(s(x1)) = 1 + x1   

(24) Obligation:

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

(25) PisEmptyProof (EQUIVALENT transformation)

The TRS P is empty. Hence, there is no (P,Q,R) chain.

(26) TRUE