(0) Obligation:

Clauses:

h(X) :- ','(f(X), g(X)).
f(c(0, X1)) :- !.
f(c(X, Y)) :- ','(p(X, P), f(c(P, s(Y)))).
g(c(X2, 0)) :- !.
g(c(X, Y)) :- ','(p(Y, P), g(c(s(X), P))).
p(0, 0).
p(s(X), X).

Query: h(g)

(1) PrologToPiTRSViaGraphTransformerProof (SOUND transformation)

Transformed Prolog program to (Pi-)TRS.

(2) Obligation:

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

hA_in_g(c(0, 0)) → hA_out_g(c(0, 0))
hA_in_g(c(0, s(0))) → hA_out_g(c(0, s(0)))
hA_in_g(c(0, s(s(0)))) → hA_out_g(c(0, s(s(0))))
hA_in_g(c(0, s(s(s(0))))) → hA_out_g(c(0, s(s(s(0)))))
hA_in_g(c(0, s(s(s(s(0)))))) → hA_out_g(c(0, s(s(s(s(0))))))
hA_in_g(c(0, s(s(s(s(s(0))))))) → hA_out_g(c(0, s(s(s(s(s(0)))))))
hA_in_g(c(0, s(s(s(s(s(s(0)))))))) → hA_out_g(c(0, s(s(s(s(s(s(0))))))))
hA_in_g(c(0, s(s(s(s(s(s(s(0))))))))) → hA_out_g(c(0, s(s(s(s(s(s(s(0)))))))))
hA_in_g(c(0, s(s(s(s(s(s(s(s(T54)))))))))) → U1_g(T54, gB_in_gg(s(s(s(s(s(s(s(0))))))), T54))
gB_in_gg(T59, 0) → gB_out_gg(T59, 0)
gB_in_gg(T65, s(T70)) → U3_gg(T65, T70, gB_in_gg(s(T65), T70))
U3_gg(T65, T70, gB_out_gg(s(T65), T70)) → gB_out_gg(T65, s(T70))
U1_g(T54, gB_out_gg(s(s(s(s(s(s(s(0))))))), T54)) → hA_out_g(c(0, s(s(s(s(s(s(s(s(T54))))))))))
hA_in_g(c(s(T81), T77)) → U2_g(T81, T77, pC_in_gg(T81, T77))
pC_in_gg(T81, T77) → U5_gg(T81, T77, fD_in_gg(T81, T77))
fD_in_gg(0, T86) → fD_out_gg(0, T86)
fD_in_gg(s(T97), T93) → U4_gg(T97, T93, fD_in_gg(T97, s(T93)))
U4_gg(T97, T93, fD_out_gg(T97, s(T93))) → fD_out_gg(s(T97), T93)
U5_gg(T81, T77, fD_out_gg(T81, T77)) → U6_gg(T81, T77, gB_in_gg(T81, T77))
U6_gg(T81, T77, gB_out_gg(T81, T77)) → pC_out_gg(T81, T77)
U2_g(T81, T77, pC_out_gg(T81, T77)) → hA_out_g(c(s(T81), T77))

Pi is empty.

(3) 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:

HA_IN_G(c(0, s(s(s(s(s(s(s(s(T54)))))))))) → U1_G(T54, gB_in_gg(s(s(s(s(s(s(s(0))))))), T54))
HA_IN_G(c(0, s(s(s(s(s(s(s(s(T54)))))))))) → GB_IN_GG(s(s(s(s(s(s(s(0))))))), T54)
GB_IN_GG(T65, s(T70)) → U3_GG(T65, T70, gB_in_gg(s(T65), T70))
GB_IN_GG(T65, s(T70)) → GB_IN_GG(s(T65), T70)
HA_IN_G(c(s(T81), T77)) → U2_G(T81, T77, pC_in_gg(T81, T77))
HA_IN_G(c(s(T81), T77)) → PC_IN_GG(T81, T77)
PC_IN_GG(T81, T77) → U5_GG(T81, T77, fD_in_gg(T81, T77))
PC_IN_GG(T81, T77) → FD_IN_GG(T81, T77)
FD_IN_GG(s(T97), T93) → U4_GG(T97, T93, fD_in_gg(T97, s(T93)))
FD_IN_GG(s(T97), T93) → FD_IN_GG(T97, s(T93))
U5_GG(T81, T77, fD_out_gg(T81, T77)) → U6_GG(T81, T77, gB_in_gg(T81, T77))
U5_GG(T81, T77, fD_out_gg(T81, T77)) → GB_IN_GG(T81, T77)

The TRS R consists of the following rules:

hA_in_g(c(0, 0)) → hA_out_g(c(0, 0))
hA_in_g(c(0, s(0))) → hA_out_g(c(0, s(0)))
hA_in_g(c(0, s(s(0)))) → hA_out_g(c(0, s(s(0))))
hA_in_g(c(0, s(s(s(0))))) → hA_out_g(c(0, s(s(s(0)))))
hA_in_g(c(0, s(s(s(s(0)))))) → hA_out_g(c(0, s(s(s(s(0))))))
hA_in_g(c(0, s(s(s(s(s(0))))))) → hA_out_g(c(0, s(s(s(s(s(0)))))))
hA_in_g(c(0, s(s(s(s(s(s(0)))))))) → hA_out_g(c(0, s(s(s(s(s(s(0))))))))
hA_in_g(c(0, s(s(s(s(s(s(s(0))))))))) → hA_out_g(c(0, s(s(s(s(s(s(s(0)))))))))
hA_in_g(c(0, s(s(s(s(s(s(s(s(T54)))))))))) → U1_g(T54, gB_in_gg(s(s(s(s(s(s(s(0))))))), T54))
gB_in_gg(T59, 0) → gB_out_gg(T59, 0)
gB_in_gg(T65, s(T70)) → U3_gg(T65, T70, gB_in_gg(s(T65), T70))
U3_gg(T65, T70, gB_out_gg(s(T65), T70)) → gB_out_gg(T65, s(T70))
U1_g(T54, gB_out_gg(s(s(s(s(s(s(s(0))))))), T54)) → hA_out_g(c(0, s(s(s(s(s(s(s(s(T54))))))))))
hA_in_g(c(s(T81), T77)) → U2_g(T81, T77, pC_in_gg(T81, T77))
pC_in_gg(T81, T77) → U5_gg(T81, T77, fD_in_gg(T81, T77))
fD_in_gg(0, T86) → fD_out_gg(0, T86)
fD_in_gg(s(T97), T93) → U4_gg(T97, T93, fD_in_gg(T97, s(T93)))
U4_gg(T97, T93, fD_out_gg(T97, s(T93))) → fD_out_gg(s(T97), T93)
U5_gg(T81, T77, fD_out_gg(T81, T77)) → U6_gg(T81, T77, gB_in_gg(T81, T77))
U6_gg(T81, T77, gB_out_gg(T81, T77)) → pC_out_gg(T81, T77)
U2_g(T81, T77, pC_out_gg(T81, T77)) → hA_out_g(c(s(T81), T77))

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

(4) Obligation:

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

HA_IN_G(c(0, s(s(s(s(s(s(s(s(T54)))))))))) → U1_G(T54, gB_in_gg(s(s(s(s(s(s(s(0))))))), T54))
HA_IN_G(c(0, s(s(s(s(s(s(s(s(T54)))))))))) → GB_IN_GG(s(s(s(s(s(s(s(0))))))), T54)
GB_IN_GG(T65, s(T70)) → U3_GG(T65, T70, gB_in_gg(s(T65), T70))
GB_IN_GG(T65, s(T70)) → GB_IN_GG(s(T65), T70)
HA_IN_G(c(s(T81), T77)) → U2_G(T81, T77, pC_in_gg(T81, T77))
HA_IN_G(c(s(T81), T77)) → PC_IN_GG(T81, T77)
PC_IN_GG(T81, T77) → U5_GG(T81, T77, fD_in_gg(T81, T77))
PC_IN_GG(T81, T77) → FD_IN_GG(T81, T77)
FD_IN_GG(s(T97), T93) → U4_GG(T97, T93, fD_in_gg(T97, s(T93)))
FD_IN_GG(s(T97), T93) → FD_IN_GG(T97, s(T93))
U5_GG(T81, T77, fD_out_gg(T81, T77)) → U6_GG(T81, T77, gB_in_gg(T81, T77))
U5_GG(T81, T77, fD_out_gg(T81, T77)) → GB_IN_GG(T81, T77)

The TRS R consists of the following rules:

hA_in_g(c(0, 0)) → hA_out_g(c(0, 0))
hA_in_g(c(0, s(0))) → hA_out_g(c(0, s(0)))
hA_in_g(c(0, s(s(0)))) → hA_out_g(c(0, s(s(0))))
hA_in_g(c(0, s(s(s(0))))) → hA_out_g(c(0, s(s(s(0)))))
hA_in_g(c(0, s(s(s(s(0)))))) → hA_out_g(c(0, s(s(s(s(0))))))
hA_in_g(c(0, s(s(s(s(s(0))))))) → hA_out_g(c(0, s(s(s(s(s(0)))))))
hA_in_g(c(0, s(s(s(s(s(s(0)))))))) → hA_out_g(c(0, s(s(s(s(s(s(0))))))))
hA_in_g(c(0, s(s(s(s(s(s(s(0))))))))) → hA_out_g(c(0, s(s(s(s(s(s(s(0)))))))))
hA_in_g(c(0, s(s(s(s(s(s(s(s(T54)))))))))) → U1_g(T54, gB_in_gg(s(s(s(s(s(s(s(0))))))), T54))
gB_in_gg(T59, 0) → gB_out_gg(T59, 0)
gB_in_gg(T65, s(T70)) → U3_gg(T65, T70, gB_in_gg(s(T65), T70))
U3_gg(T65, T70, gB_out_gg(s(T65), T70)) → gB_out_gg(T65, s(T70))
U1_g(T54, gB_out_gg(s(s(s(s(s(s(s(0))))))), T54)) → hA_out_g(c(0, s(s(s(s(s(s(s(s(T54))))))))))
hA_in_g(c(s(T81), T77)) → U2_g(T81, T77, pC_in_gg(T81, T77))
pC_in_gg(T81, T77) → U5_gg(T81, T77, fD_in_gg(T81, T77))
fD_in_gg(0, T86) → fD_out_gg(0, T86)
fD_in_gg(s(T97), T93) → U4_gg(T97, T93, fD_in_gg(T97, s(T93)))
U4_gg(T97, T93, fD_out_gg(T97, s(T93))) → fD_out_gg(s(T97), T93)
U5_gg(T81, T77, fD_out_gg(T81, T77)) → U6_gg(T81, T77, gB_in_gg(T81, T77))
U6_gg(T81, T77, gB_out_gg(T81, T77)) → pC_out_gg(T81, T77)
U2_g(T81, T77, pC_out_gg(T81, T77)) → hA_out_g(c(s(T81), T77))

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

(5) DependencyGraphProof (EQUIVALENT transformation)

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

(6) Complex Obligation (AND)

(7) Obligation:

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

FD_IN_GG(s(T97), T93) → FD_IN_GG(T97, s(T93))

The TRS R consists of the following rules:

hA_in_g(c(0, 0)) → hA_out_g(c(0, 0))
hA_in_g(c(0, s(0))) → hA_out_g(c(0, s(0)))
hA_in_g(c(0, s(s(0)))) → hA_out_g(c(0, s(s(0))))
hA_in_g(c(0, s(s(s(0))))) → hA_out_g(c(0, s(s(s(0)))))
hA_in_g(c(0, s(s(s(s(0)))))) → hA_out_g(c(0, s(s(s(s(0))))))
hA_in_g(c(0, s(s(s(s(s(0))))))) → hA_out_g(c(0, s(s(s(s(s(0)))))))
hA_in_g(c(0, s(s(s(s(s(s(0)))))))) → hA_out_g(c(0, s(s(s(s(s(s(0))))))))
hA_in_g(c(0, s(s(s(s(s(s(s(0))))))))) → hA_out_g(c(0, s(s(s(s(s(s(s(0)))))))))
hA_in_g(c(0, s(s(s(s(s(s(s(s(T54)))))))))) → U1_g(T54, gB_in_gg(s(s(s(s(s(s(s(0))))))), T54))
gB_in_gg(T59, 0) → gB_out_gg(T59, 0)
gB_in_gg(T65, s(T70)) → U3_gg(T65, T70, gB_in_gg(s(T65), T70))
U3_gg(T65, T70, gB_out_gg(s(T65), T70)) → gB_out_gg(T65, s(T70))
U1_g(T54, gB_out_gg(s(s(s(s(s(s(s(0))))))), T54)) → hA_out_g(c(0, s(s(s(s(s(s(s(s(T54))))))))))
hA_in_g(c(s(T81), T77)) → U2_g(T81, T77, pC_in_gg(T81, T77))
pC_in_gg(T81, T77) → U5_gg(T81, T77, fD_in_gg(T81, T77))
fD_in_gg(0, T86) → fD_out_gg(0, T86)
fD_in_gg(s(T97), T93) → U4_gg(T97, T93, fD_in_gg(T97, s(T93)))
U4_gg(T97, T93, fD_out_gg(T97, s(T93))) → fD_out_gg(s(T97), T93)
U5_gg(T81, T77, fD_out_gg(T81, T77)) → U6_gg(T81, T77, gB_in_gg(T81, T77))
U6_gg(T81, T77, gB_out_gg(T81, T77)) → pC_out_gg(T81, T77)
U2_g(T81, T77, pC_out_gg(T81, T77)) → hA_out_g(c(s(T81), T77))

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

(8) UsableRulesProof (EQUIVALENT transformation)

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

(9) Obligation:

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

FD_IN_GG(s(T97), T93) → FD_IN_GG(T97, s(T93))

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

(10) PiDPToQDPProof (EQUIVALENT transformation)

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

(11) Obligation:

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

FD_IN_GG(s(T97), T93) → FD_IN_GG(T97, s(T93))

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

(12) QDPSizeChangeProof (EQUIVALENT transformation)

By using the subterm criterion [SUBTERM_CRITERION] together with the size-change analysis [AAECC05] we have proven that there are no infinite chains for this DP problem.

From the DPs we obtained the following set of size-change graphs:

  • FD_IN_GG(s(T97), T93) → FD_IN_GG(T97, s(T93))
    The graph contains the following edges 1 > 1

(13) YES

(14) Obligation:

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

GB_IN_GG(T65, s(T70)) → GB_IN_GG(s(T65), T70)

The TRS R consists of the following rules:

hA_in_g(c(0, 0)) → hA_out_g(c(0, 0))
hA_in_g(c(0, s(0))) → hA_out_g(c(0, s(0)))
hA_in_g(c(0, s(s(0)))) → hA_out_g(c(0, s(s(0))))
hA_in_g(c(0, s(s(s(0))))) → hA_out_g(c(0, s(s(s(0)))))
hA_in_g(c(0, s(s(s(s(0)))))) → hA_out_g(c(0, s(s(s(s(0))))))
hA_in_g(c(0, s(s(s(s(s(0))))))) → hA_out_g(c(0, s(s(s(s(s(0)))))))
hA_in_g(c(0, s(s(s(s(s(s(0)))))))) → hA_out_g(c(0, s(s(s(s(s(s(0))))))))
hA_in_g(c(0, s(s(s(s(s(s(s(0))))))))) → hA_out_g(c(0, s(s(s(s(s(s(s(0)))))))))
hA_in_g(c(0, s(s(s(s(s(s(s(s(T54)))))))))) → U1_g(T54, gB_in_gg(s(s(s(s(s(s(s(0))))))), T54))
gB_in_gg(T59, 0) → gB_out_gg(T59, 0)
gB_in_gg(T65, s(T70)) → U3_gg(T65, T70, gB_in_gg(s(T65), T70))
U3_gg(T65, T70, gB_out_gg(s(T65), T70)) → gB_out_gg(T65, s(T70))
U1_g(T54, gB_out_gg(s(s(s(s(s(s(s(0))))))), T54)) → hA_out_g(c(0, s(s(s(s(s(s(s(s(T54))))))))))
hA_in_g(c(s(T81), T77)) → U2_g(T81, T77, pC_in_gg(T81, T77))
pC_in_gg(T81, T77) → U5_gg(T81, T77, fD_in_gg(T81, T77))
fD_in_gg(0, T86) → fD_out_gg(0, T86)
fD_in_gg(s(T97), T93) → U4_gg(T97, T93, fD_in_gg(T97, s(T93)))
U4_gg(T97, T93, fD_out_gg(T97, s(T93))) → fD_out_gg(s(T97), T93)
U5_gg(T81, T77, fD_out_gg(T81, T77)) → U6_gg(T81, T77, gB_in_gg(T81, T77))
U6_gg(T81, T77, gB_out_gg(T81, T77)) → pC_out_gg(T81, T77)
U2_g(T81, T77, pC_out_gg(T81, T77)) → hA_out_g(c(s(T81), T77))

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

(15) UsableRulesProof (EQUIVALENT transformation)

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

(16) Obligation:

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

GB_IN_GG(T65, s(T70)) → GB_IN_GG(s(T65), T70)

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

(17) PiDPToQDPProof (EQUIVALENT transformation)

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

(18) Obligation:

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

GB_IN_GG(T65, s(T70)) → GB_IN_GG(s(T65), T70)

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

(19) QDPSizeChangeProof (EQUIVALENT transformation)

By using the subterm criterion [SUBTERM_CRITERION] together with the size-change analysis [AAECC05] we have proven that there are no infinite chains for this DP problem.

From the DPs we obtained the following set of size-change graphs:

  • GB_IN_GG(T65, s(T70)) → GB_IN_GG(s(T65), T70)
    The graph contains the following edges 2 > 2

(20) YES