(0) Obligation:

Clauses:

p(s(0), 0).
p(s(s(X)), s(s(Y))) :- p(s(X), s(Y)).
plus(0, Y, Y).
plus(s(X), Y, s(Z)) :- ','(p(s(X), U), plus(U, Y, Z)).

Query: plus(g,a,a)

(1) PrologToPiTRSViaGraphTransformerProof (SOUND transformation)

Transformed Prolog program to (Pi-)TRS.

(2) Obligation:

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

plusA_in_gaa(0, T5, T5) → plusA_out_gaa(0, T5, T5)
plusA_in_gaa(s(0), T20, s(T20)) → plusA_out_gaa(s(0), T20, s(T20))
plusA_in_gaa(s(s(T23)), T12, s(T13)) → U1_gaa(T23, T12, T13, pB_in_gaaa(T23, X31, T12, T13))
pB_in_gaaa(T23, T24, T12, T13) → U3_gaaa(T23, T24, T12, T13, pC_in_ga(T23, T24))
pC_in_ga(s(T27), s(X40)) → U2_ga(T27, X40, pC_in_ga(T27, X40))
U2_ga(T27, X40, pC_out_ga(T27, X40)) → pC_out_ga(s(T27), s(X40))
U3_gaaa(T23, T24, T12, T13, pC_out_ga(T23, T24)) → U4_gaaa(T23, T24, T12, T13, plusA_in_gaa(s(s(T24)), T12, T13))
U4_gaaa(T23, T24, T12, T13, plusA_out_gaa(s(s(T24)), T12, T13)) → pB_out_gaaa(T23, T24, T12, T13)
U1_gaa(T23, T12, T13, pB_out_gaaa(T23, X31, T12, T13)) → plusA_out_gaa(s(s(T23)), T12, s(T13))

The argument filtering Pi contains the following mapping:
plusA_in_gaa(x1, x2, x3)  =  plusA_in_gaa(x1)
0  =  0
plusA_out_gaa(x1, x2, x3)  =  plusA_out_gaa(x1)
s(x1)  =  s(x1)
U1_gaa(x1, x2, x3, x4)  =  U1_gaa(x1, x4)
pB_in_gaaa(x1, x2, x3, x4)  =  pB_in_gaaa(x1)
U3_gaaa(x1, x2, x3, x4, x5)  =  U3_gaaa(x1, x5)
pC_in_ga(x1, x2)  =  pC_in_ga(x1)
U2_ga(x1, x2, x3)  =  U2_ga(x1, x3)
pC_out_ga(x1, x2)  =  pC_out_ga(x1, x2)
U4_gaaa(x1, x2, x3, x4, x5)  =  U4_gaaa(x1, x2, x5)
pB_out_gaaa(x1, x2, x3, x4)  =  pB_out_gaaa(x1, x2)

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

PLUSA_IN_GAA(s(s(T23)), T12, s(T13)) → U1_GAA(T23, T12, T13, pB_in_gaaa(T23, X31, T12, T13))
PLUSA_IN_GAA(s(s(T23)), T12, s(T13)) → PB_IN_GAAA(T23, X31, T12, T13)
PB_IN_GAAA(T23, T24, T12, T13) → U3_GAAA(T23, T24, T12, T13, pC_in_ga(T23, T24))
PB_IN_GAAA(T23, T24, T12, T13) → PC_IN_GA(T23, T24)
PC_IN_GA(s(T27), s(X40)) → U2_GA(T27, X40, pC_in_ga(T27, X40))
PC_IN_GA(s(T27), s(X40)) → PC_IN_GA(T27, X40)
U3_GAAA(T23, T24, T12, T13, pC_out_ga(T23, T24)) → U4_GAAA(T23, T24, T12, T13, plusA_in_gaa(s(s(T24)), T12, T13))
U3_GAAA(T23, T24, T12, T13, pC_out_ga(T23, T24)) → PLUSA_IN_GAA(s(s(T24)), T12, T13)

The TRS R consists of the following rules:

plusA_in_gaa(0, T5, T5) → plusA_out_gaa(0, T5, T5)
plusA_in_gaa(s(0), T20, s(T20)) → plusA_out_gaa(s(0), T20, s(T20))
plusA_in_gaa(s(s(T23)), T12, s(T13)) → U1_gaa(T23, T12, T13, pB_in_gaaa(T23, X31, T12, T13))
pB_in_gaaa(T23, T24, T12, T13) → U3_gaaa(T23, T24, T12, T13, pC_in_ga(T23, T24))
pC_in_ga(s(T27), s(X40)) → U2_ga(T27, X40, pC_in_ga(T27, X40))
U2_ga(T27, X40, pC_out_ga(T27, X40)) → pC_out_ga(s(T27), s(X40))
U3_gaaa(T23, T24, T12, T13, pC_out_ga(T23, T24)) → U4_gaaa(T23, T24, T12, T13, plusA_in_gaa(s(s(T24)), T12, T13))
U4_gaaa(T23, T24, T12, T13, plusA_out_gaa(s(s(T24)), T12, T13)) → pB_out_gaaa(T23, T24, T12, T13)
U1_gaa(T23, T12, T13, pB_out_gaaa(T23, X31, T12, T13)) → plusA_out_gaa(s(s(T23)), T12, s(T13))

The argument filtering Pi contains the following mapping:
plusA_in_gaa(x1, x2, x3)  =  plusA_in_gaa(x1)
0  =  0
plusA_out_gaa(x1, x2, x3)  =  plusA_out_gaa(x1)
s(x1)  =  s(x1)
U1_gaa(x1, x2, x3, x4)  =  U1_gaa(x1, x4)
pB_in_gaaa(x1, x2, x3, x4)  =  pB_in_gaaa(x1)
U3_gaaa(x1, x2, x3, x4, x5)  =  U3_gaaa(x1, x5)
pC_in_ga(x1, x2)  =  pC_in_ga(x1)
U2_ga(x1, x2, x3)  =  U2_ga(x1, x3)
pC_out_ga(x1, x2)  =  pC_out_ga(x1, x2)
U4_gaaa(x1, x2, x3, x4, x5)  =  U4_gaaa(x1, x2, x5)
pB_out_gaaa(x1, x2, x3, x4)  =  pB_out_gaaa(x1, x2)
PLUSA_IN_GAA(x1, x2, x3)  =  PLUSA_IN_GAA(x1)
U1_GAA(x1, x2, x3, x4)  =  U1_GAA(x1, x4)
PB_IN_GAAA(x1, x2, x3, x4)  =  PB_IN_GAAA(x1)
U3_GAAA(x1, x2, x3, x4, x5)  =  U3_GAAA(x1, x5)
PC_IN_GA(x1, x2)  =  PC_IN_GA(x1)
U2_GA(x1, x2, x3)  =  U2_GA(x1, x3)
U4_GAAA(x1, x2, x3, x4, x5)  =  U4_GAAA(x1, x2, x5)

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

(4) Obligation:

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

PLUSA_IN_GAA(s(s(T23)), T12, s(T13)) → U1_GAA(T23, T12, T13, pB_in_gaaa(T23, X31, T12, T13))
PLUSA_IN_GAA(s(s(T23)), T12, s(T13)) → PB_IN_GAAA(T23, X31, T12, T13)
PB_IN_GAAA(T23, T24, T12, T13) → U3_GAAA(T23, T24, T12, T13, pC_in_ga(T23, T24))
PB_IN_GAAA(T23, T24, T12, T13) → PC_IN_GA(T23, T24)
PC_IN_GA(s(T27), s(X40)) → U2_GA(T27, X40, pC_in_ga(T27, X40))
PC_IN_GA(s(T27), s(X40)) → PC_IN_GA(T27, X40)
U3_GAAA(T23, T24, T12, T13, pC_out_ga(T23, T24)) → U4_GAAA(T23, T24, T12, T13, plusA_in_gaa(s(s(T24)), T12, T13))
U3_GAAA(T23, T24, T12, T13, pC_out_ga(T23, T24)) → PLUSA_IN_GAA(s(s(T24)), T12, T13)

The TRS R consists of the following rules:

plusA_in_gaa(0, T5, T5) → plusA_out_gaa(0, T5, T5)
plusA_in_gaa(s(0), T20, s(T20)) → plusA_out_gaa(s(0), T20, s(T20))
plusA_in_gaa(s(s(T23)), T12, s(T13)) → U1_gaa(T23, T12, T13, pB_in_gaaa(T23, X31, T12, T13))
pB_in_gaaa(T23, T24, T12, T13) → U3_gaaa(T23, T24, T12, T13, pC_in_ga(T23, T24))
pC_in_ga(s(T27), s(X40)) → U2_ga(T27, X40, pC_in_ga(T27, X40))
U2_ga(T27, X40, pC_out_ga(T27, X40)) → pC_out_ga(s(T27), s(X40))
U3_gaaa(T23, T24, T12, T13, pC_out_ga(T23, T24)) → U4_gaaa(T23, T24, T12, T13, plusA_in_gaa(s(s(T24)), T12, T13))
U4_gaaa(T23, T24, T12, T13, plusA_out_gaa(s(s(T24)), T12, T13)) → pB_out_gaaa(T23, T24, T12, T13)
U1_gaa(T23, T12, T13, pB_out_gaaa(T23, X31, T12, T13)) → plusA_out_gaa(s(s(T23)), T12, s(T13))

The argument filtering Pi contains the following mapping:
plusA_in_gaa(x1, x2, x3)  =  plusA_in_gaa(x1)
0  =  0
plusA_out_gaa(x1, x2, x3)  =  plusA_out_gaa(x1)
s(x1)  =  s(x1)
U1_gaa(x1, x2, x3, x4)  =  U1_gaa(x1, x4)
pB_in_gaaa(x1, x2, x3, x4)  =  pB_in_gaaa(x1)
U3_gaaa(x1, x2, x3, x4, x5)  =  U3_gaaa(x1, x5)
pC_in_ga(x1, x2)  =  pC_in_ga(x1)
U2_ga(x1, x2, x3)  =  U2_ga(x1, x3)
pC_out_ga(x1, x2)  =  pC_out_ga(x1, x2)
U4_gaaa(x1, x2, x3, x4, x5)  =  U4_gaaa(x1, x2, x5)
pB_out_gaaa(x1, x2, x3, x4)  =  pB_out_gaaa(x1, x2)
PLUSA_IN_GAA(x1, x2, x3)  =  PLUSA_IN_GAA(x1)
U1_GAA(x1, x2, x3, x4)  =  U1_GAA(x1, x4)
PB_IN_GAAA(x1, x2, x3, x4)  =  PB_IN_GAAA(x1)
U3_GAAA(x1, x2, x3, x4, x5)  =  U3_GAAA(x1, x5)
PC_IN_GA(x1, x2)  =  PC_IN_GA(x1)
U2_GA(x1, x2, x3)  =  U2_GA(x1, x3)
U4_GAAA(x1, x2, x3, x4, x5)  =  U4_GAAA(x1, x2, x5)

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

(5) DependencyGraphProof (EQUIVALENT transformation)

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

(6) Complex Obligation (AND)

(7) Obligation:

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

PC_IN_GA(s(T27), s(X40)) → PC_IN_GA(T27, X40)

The TRS R consists of the following rules:

plusA_in_gaa(0, T5, T5) → plusA_out_gaa(0, T5, T5)
plusA_in_gaa(s(0), T20, s(T20)) → plusA_out_gaa(s(0), T20, s(T20))
plusA_in_gaa(s(s(T23)), T12, s(T13)) → U1_gaa(T23, T12, T13, pB_in_gaaa(T23, X31, T12, T13))
pB_in_gaaa(T23, T24, T12, T13) → U3_gaaa(T23, T24, T12, T13, pC_in_ga(T23, T24))
pC_in_ga(s(T27), s(X40)) → U2_ga(T27, X40, pC_in_ga(T27, X40))
U2_ga(T27, X40, pC_out_ga(T27, X40)) → pC_out_ga(s(T27), s(X40))
U3_gaaa(T23, T24, T12, T13, pC_out_ga(T23, T24)) → U4_gaaa(T23, T24, T12, T13, plusA_in_gaa(s(s(T24)), T12, T13))
U4_gaaa(T23, T24, T12, T13, plusA_out_gaa(s(s(T24)), T12, T13)) → pB_out_gaaa(T23, T24, T12, T13)
U1_gaa(T23, T12, T13, pB_out_gaaa(T23, X31, T12, T13)) → plusA_out_gaa(s(s(T23)), T12, s(T13))

The argument filtering Pi contains the following mapping:
plusA_in_gaa(x1, x2, x3)  =  plusA_in_gaa(x1)
0  =  0
plusA_out_gaa(x1, x2, x3)  =  plusA_out_gaa(x1)
s(x1)  =  s(x1)
U1_gaa(x1, x2, x3, x4)  =  U1_gaa(x1, x4)
pB_in_gaaa(x1, x2, x3, x4)  =  pB_in_gaaa(x1)
U3_gaaa(x1, x2, x3, x4, x5)  =  U3_gaaa(x1, x5)
pC_in_ga(x1, x2)  =  pC_in_ga(x1)
U2_ga(x1, x2, x3)  =  U2_ga(x1, x3)
pC_out_ga(x1, x2)  =  pC_out_ga(x1, x2)
U4_gaaa(x1, x2, x3, x4, x5)  =  U4_gaaa(x1, x2, x5)
pB_out_gaaa(x1, x2, x3, x4)  =  pB_out_gaaa(x1, x2)
PC_IN_GA(x1, x2)  =  PC_IN_GA(x1)

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:

PC_IN_GA(s(T27), s(X40)) → PC_IN_GA(T27, X40)

R is empty.
The argument filtering Pi contains the following mapping:
s(x1)  =  s(x1)
PC_IN_GA(x1, x2)  =  PC_IN_GA(x1)

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

(10) PiDPToQDPProof (SOUND 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:

PC_IN_GA(s(T27)) → PC_IN_GA(T27)

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:

  • PC_IN_GA(s(T27)) → PC_IN_GA(T27)
    The graph contains the following edges 1 > 1

(13) YES

(14) Obligation:

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

PLUSA_IN_GAA(s(s(T23)), T12, s(T13)) → PB_IN_GAAA(T23, X31, T12, T13)
PB_IN_GAAA(T23, T24, T12, T13) → U3_GAAA(T23, T24, T12, T13, pC_in_ga(T23, T24))
U3_GAAA(T23, T24, T12, T13, pC_out_ga(T23, T24)) → PLUSA_IN_GAA(s(s(T24)), T12, T13)

The TRS R consists of the following rules:

plusA_in_gaa(0, T5, T5) → plusA_out_gaa(0, T5, T5)
plusA_in_gaa(s(0), T20, s(T20)) → plusA_out_gaa(s(0), T20, s(T20))
plusA_in_gaa(s(s(T23)), T12, s(T13)) → U1_gaa(T23, T12, T13, pB_in_gaaa(T23, X31, T12, T13))
pB_in_gaaa(T23, T24, T12, T13) → U3_gaaa(T23, T24, T12, T13, pC_in_ga(T23, T24))
pC_in_ga(s(T27), s(X40)) → U2_ga(T27, X40, pC_in_ga(T27, X40))
U2_ga(T27, X40, pC_out_ga(T27, X40)) → pC_out_ga(s(T27), s(X40))
U3_gaaa(T23, T24, T12, T13, pC_out_ga(T23, T24)) → U4_gaaa(T23, T24, T12, T13, plusA_in_gaa(s(s(T24)), T12, T13))
U4_gaaa(T23, T24, T12, T13, plusA_out_gaa(s(s(T24)), T12, T13)) → pB_out_gaaa(T23, T24, T12, T13)
U1_gaa(T23, T12, T13, pB_out_gaaa(T23, X31, T12, T13)) → plusA_out_gaa(s(s(T23)), T12, s(T13))

The argument filtering Pi contains the following mapping:
plusA_in_gaa(x1, x2, x3)  =  plusA_in_gaa(x1)
0  =  0
plusA_out_gaa(x1, x2, x3)  =  plusA_out_gaa(x1)
s(x1)  =  s(x1)
U1_gaa(x1, x2, x3, x4)  =  U1_gaa(x1, x4)
pB_in_gaaa(x1, x2, x3, x4)  =  pB_in_gaaa(x1)
U3_gaaa(x1, x2, x3, x4, x5)  =  U3_gaaa(x1, x5)
pC_in_ga(x1, x2)  =  pC_in_ga(x1)
U2_ga(x1, x2, x3)  =  U2_ga(x1, x3)
pC_out_ga(x1, x2)  =  pC_out_ga(x1, x2)
U4_gaaa(x1, x2, x3, x4, x5)  =  U4_gaaa(x1, x2, x5)
pB_out_gaaa(x1, x2, x3, x4)  =  pB_out_gaaa(x1, x2)
PLUSA_IN_GAA(x1, x2, x3)  =  PLUSA_IN_GAA(x1)
PB_IN_GAAA(x1, x2, x3, x4)  =  PB_IN_GAAA(x1)
U3_GAAA(x1, x2, x3, x4, x5)  =  U3_GAAA(x1, x5)

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:

PLUSA_IN_GAA(s(s(T23)), T12, s(T13)) → PB_IN_GAAA(T23, X31, T12, T13)
PB_IN_GAAA(T23, T24, T12, T13) → U3_GAAA(T23, T24, T12, T13, pC_in_ga(T23, T24))
U3_GAAA(T23, T24, T12, T13, pC_out_ga(T23, T24)) → PLUSA_IN_GAA(s(s(T24)), T12, T13)

The TRS R consists of the following rules:

pC_in_ga(s(T27), s(X40)) → U2_ga(T27, X40, pC_in_ga(T27, X40))
U2_ga(T27, X40, pC_out_ga(T27, X40)) → pC_out_ga(s(T27), s(X40))

The argument filtering Pi contains the following mapping:
s(x1)  =  s(x1)
pC_in_ga(x1, x2)  =  pC_in_ga(x1)
U2_ga(x1, x2, x3)  =  U2_ga(x1, x3)
pC_out_ga(x1, x2)  =  pC_out_ga(x1, x2)
PLUSA_IN_GAA(x1, x2, x3)  =  PLUSA_IN_GAA(x1)
PB_IN_GAAA(x1, x2, x3, x4)  =  PB_IN_GAAA(x1)
U3_GAAA(x1, x2, x3, x4, x5)  =  U3_GAAA(x1, x5)

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

(17) PiDPToQDPProof (SOUND 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:

PLUSA_IN_GAA(s(s(T23))) → PB_IN_GAAA(T23)
PB_IN_GAAA(T23) → U3_GAAA(T23, pC_in_ga(T23))
U3_GAAA(T23, pC_out_ga(T23, T24)) → PLUSA_IN_GAA(s(s(T24)))

The TRS R consists of the following rules:

pC_in_ga(s(T27)) → U2_ga(T27, pC_in_ga(T27))
U2_ga(T27, pC_out_ga(T27, X40)) → pC_out_ga(s(T27), s(X40))

The set Q consists of the following terms:

pC_in_ga(x0)
U2_ga(x0, x1)

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

(19) QDPOrderProof (EQUIVALENT transformation)

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


The following pairs can be oriented strictly and are deleted.


PB_IN_GAAA(T23) → U3_GAAA(T23, pC_in_ga(T23))
The remaining pairs can at least be oriented weakly.
Used ordering: Polynomial interpretation [POLO]:

POL(PB_IN_GAAA(x1)) = 1   
POL(PLUSA_IN_GAA(x1)) = x1   
POL(U2_ga(x1, x2)) = x2   
POL(U3_GAAA(x1, x2)) = x2   
POL(pC_in_ga(x1)) = 0   
POL(pC_out_ga(x1, x2)) = 1   
POL(s(x1)) = 1   

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

pC_in_ga(s(T27)) → U2_ga(T27, pC_in_ga(T27))
U2_ga(T27, pC_out_ga(T27, X40)) → pC_out_ga(s(T27), s(X40))

(20) Obligation:

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

PLUSA_IN_GAA(s(s(T23))) → PB_IN_GAAA(T23)
U3_GAAA(T23, pC_out_ga(T23, T24)) → PLUSA_IN_GAA(s(s(T24)))

The TRS R consists of the following rules:

pC_in_ga(s(T27)) → U2_ga(T27, pC_in_ga(T27))
U2_ga(T27, pC_out_ga(T27, X40)) → pC_out_ga(s(T27), s(X40))

The set Q consists of the following terms:

pC_in_ga(x0)
U2_ga(x0, x1)

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

(21) DependencyGraphProof (EQUIVALENT transformation)

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

(22) TRUE