(0) Obligation:

Clauses:

sum([], [], []).
sum(.(X1, Y1), .(X2, Y2), .(X3, Y3)) :- ','(add(X1, X2, X3), sum(Y1, Y2, Y3)).
add(0, X, X).
add(s(X), Y, s(Z)) :- add(X, Y, Z).

Query: sum(g,a,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:

sumA_in_gag([], [], []) → sumA_out_gag([], [], [])
sumA_in_gag(.(T10, T11), .(T16, T17), .(T14, T15)) → U1_gag(T10, T11, T16, T17, T14, T15, pB_in_gaggag(T10, T16, T14, T11, T17, T15))
pB_in_gaggag(0, T22, T22, T11, T23, T15) → U2_gaggag(T22, T11, T23, T15, sumA_in_gag(T11, T23, T15))
U2_gaggag(T22, T11, T23, T15, sumA_out_gag(T11, T23, T15)) → pB_out_gaggag(0, T22, T22, T11, T23, T15)
pB_in_gaggag(s(T30), T33, s(T32), T11, T34, T15) → U3_gaggag(T30, T33, T32, T11, T34, T15, pB_in_gaggag(T30, T33, T32, T11, T34, T15))
U3_gaggag(T30, T33, T32, T11, T34, T15, pB_out_gaggag(T30, T33, T32, T11, T34, T15)) → pB_out_gaggag(s(T30), T33, s(T32), T11, T34, T15)
U1_gag(T10, T11, T16, T17, T14, T15, pB_out_gaggag(T10, T16, T14, T11, T17, T15)) → sumA_out_gag(.(T10, T11), .(T16, T17), .(T14, T15))

The argument filtering Pi contains the following mapping:
sumA_in_gag(x1, x2, x3)  =  sumA_in_gag(x1, x3)
[]  =  []
sumA_out_gag(x1, x2, x3)  =  sumA_out_gag(x1, x2, x3)
.(x1, x2)  =  .(x1, x2)
U1_gag(x1, x2, x3, x4, x5, x6, x7)  =  U1_gag(x1, x2, x5, x6, x7)
pB_in_gaggag(x1, x2, x3, x4, x5, x6)  =  pB_in_gaggag(x1, x3, x4, x6)
0  =  0
U2_gaggag(x1, x2, x3, x4, x5)  =  U2_gaggag(x1, x2, x4, x5)
pB_out_gaggag(x1, x2, x3, x4, x5, x6)  =  pB_out_gaggag(x1, x2, x3, x4, x5, x6)
s(x1)  =  s(x1)
U3_gaggag(x1, x2, x3, x4, x5, x6, x7)  =  U3_gaggag(x1, x3, x4, x6, x7)

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

SUMA_IN_GAG(.(T10, T11), .(T16, T17), .(T14, T15)) → U1_GAG(T10, T11, T16, T17, T14, T15, pB_in_gaggag(T10, T16, T14, T11, T17, T15))
SUMA_IN_GAG(.(T10, T11), .(T16, T17), .(T14, T15)) → PB_IN_GAGGAG(T10, T16, T14, T11, T17, T15)
PB_IN_GAGGAG(0, T22, T22, T11, T23, T15) → U2_GAGGAG(T22, T11, T23, T15, sumA_in_gag(T11, T23, T15))
PB_IN_GAGGAG(0, T22, T22, T11, T23, T15) → SUMA_IN_GAG(T11, T23, T15)
PB_IN_GAGGAG(s(T30), T33, s(T32), T11, T34, T15) → U3_GAGGAG(T30, T33, T32, T11, T34, T15, pB_in_gaggag(T30, T33, T32, T11, T34, T15))
PB_IN_GAGGAG(s(T30), T33, s(T32), T11, T34, T15) → PB_IN_GAGGAG(T30, T33, T32, T11, T34, T15)

The TRS R consists of the following rules:

sumA_in_gag([], [], []) → sumA_out_gag([], [], [])
sumA_in_gag(.(T10, T11), .(T16, T17), .(T14, T15)) → U1_gag(T10, T11, T16, T17, T14, T15, pB_in_gaggag(T10, T16, T14, T11, T17, T15))
pB_in_gaggag(0, T22, T22, T11, T23, T15) → U2_gaggag(T22, T11, T23, T15, sumA_in_gag(T11, T23, T15))
U2_gaggag(T22, T11, T23, T15, sumA_out_gag(T11, T23, T15)) → pB_out_gaggag(0, T22, T22, T11, T23, T15)
pB_in_gaggag(s(T30), T33, s(T32), T11, T34, T15) → U3_gaggag(T30, T33, T32, T11, T34, T15, pB_in_gaggag(T30, T33, T32, T11, T34, T15))
U3_gaggag(T30, T33, T32, T11, T34, T15, pB_out_gaggag(T30, T33, T32, T11, T34, T15)) → pB_out_gaggag(s(T30), T33, s(T32), T11, T34, T15)
U1_gag(T10, T11, T16, T17, T14, T15, pB_out_gaggag(T10, T16, T14, T11, T17, T15)) → sumA_out_gag(.(T10, T11), .(T16, T17), .(T14, T15))

The argument filtering Pi contains the following mapping:
sumA_in_gag(x1, x2, x3)  =  sumA_in_gag(x1, x3)
[]  =  []
sumA_out_gag(x1, x2, x3)  =  sumA_out_gag(x1, x2, x3)
.(x1, x2)  =  .(x1, x2)
U1_gag(x1, x2, x3, x4, x5, x6, x7)  =  U1_gag(x1, x2, x5, x6, x7)
pB_in_gaggag(x1, x2, x3, x4, x5, x6)  =  pB_in_gaggag(x1, x3, x4, x6)
0  =  0
U2_gaggag(x1, x2, x3, x4, x5)  =  U2_gaggag(x1, x2, x4, x5)
pB_out_gaggag(x1, x2, x3, x4, x5, x6)  =  pB_out_gaggag(x1, x2, x3, x4, x5, x6)
s(x1)  =  s(x1)
U3_gaggag(x1, x2, x3, x4, x5, x6, x7)  =  U3_gaggag(x1, x3, x4, x6, x7)
SUMA_IN_GAG(x1, x2, x3)  =  SUMA_IN_GAG(x1, x3)
U1_GAG(x1, x2, x3, x4, x5, x6, x7)  =  U1_GAG(x1, x2, x5, x6, x7)
PB_IN_GAGGAG(x1, x2, x3, x4, x5, x6)  =  PB_IN_GAGGAG(x1, x3, x4, x6)
U2_GAGGAG(x1, x2, x3, x4, x5)  =  U2_GAGGAG(x1, x2, x4, x5)
U3_GAGGAG(x1, x2, x3, x4, x5, x6, x7)  =  U3_GAGGAG(x1, x3, x4, x6, x7)

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

(4) Obligation:

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

SUMA_IN_GAG(.(T10, T11), .(T16, T17), .(T14, T15)) → U1_GAG(T10, T11, T16, T17, T14, T15, pB_in_gaggag(T10, T16, T14, T11, T17, T15))
SUMA_IN_GAG(.(T10, T11), .(T16, T17), .(T14, T15)) → PB_IN_GAGGAG(T10, T16, T14, T11, T17, T15)
PB_IN_GAGGAG(0, T22, T22, T11, T23, T15) → U2_GAGGAG(T22, T11, T23, T15, sumA_in_gag(T11, T23, T15))
PB_IN_GAGGAG(0, T22, T22, T11, T23, T15) → SUMA_IN_GAG(T11, T23, T15)
PB_IN_GAGGAG(s(T30), T33, s(T32), T11, T34, T15) → U3_GAGGAG(T30, T33, T32, T11, T34, T15, pB_in_gaggag(T30, T33, T32, T11, T34, T15))
PB_IN_GAGGAG(s(T30), T33, s(T32), T11, T34, T15) → PB_IN_GAGGAG(T30, T33, T32, T11, T34, T15)

The TRS R consists of the following rules:

sumA_in_gag([], [], []) → sumA_out_gag([], [], [])
sumA_in_gag(.(T10, T11), .(T16, T17), .(T14, T15)) → U1_gag(T10, T11, T16, T17, T14, T15, pB_in_gaggag(T10, T16, T14, T11, T17, T15))
pB_in_gaggag(0, T22, T22, T11, T23, T15) → U2_gaggag(T22, T11, T23, T15, sumA_in_gag(T11, T23, T15))
U2_gaggag(T22, T11, T23, T15, sumA_out_gag(T11, T23, T15)) → pB_out_gaggag(0, T22, T22, T11, T23, T15)
pB_in_gaggag(s(T30), T33, s(T32), T11, T34, T15) → U3_gaggag(T30, T33, T32, T11, T34, T15, pB_in_gaggag(T30, T33, T32, T11, T34, T15))
U3_gaggag(T30, T33, T32, T11, T34, T15, pB_out_gaggag(T30, T33, T32, T11, T34, T15)) → pB_out_gaggag(s(T30), T33, s(T32), T11, T34, T15)
U1_gag(T10, T11, T16, T17, T14, T15, pB_out_gaggag(T10, T16, T14, T11, T17, T15)) → sumA_out_gag(.(T10, T11), .(T16, T17), .(T14, T15))

The argument filtering Pi contains the following mapping:
sumA_in_gag(x1, x2, x3)  =  sumA_in_gag(x1, x3)
[]  =  []
sumA_out_gag(x1, x2, x3)  =  sumA_out_gag(x1, x2, x3)
.(x1, x2)  =  .(x1, x2)
U1_gag(x1, x2, x3, x4, x5, x6, x7)  =  U1_gag(x1, x2, x5, x6, x7)
pB_in_gaggag(x1, x2, x3, x4, x5, x6)  =  pB_in_gaggag(x1, x3, x4, x6)
0  =  0
U2_gaggag(x1, x2, x3, x4, x5)  =  U2_gaggag(x1, x2, x4, x5)
pB_out_gaggag(x1, x2, x3, x4, x5, x6)  =  pB_out_gaggag(x1, x2, x3, x4, x5, x6)
s(x1)  =  s(x1)
U3_gaggag(x1, x2, x3, x4, x5, x6, x7)  =  U3_gaggag(x1, x3, x4, x6, x7)
SUMA_IN_GAG(x1, x2, x3)  =  SUMA_IN_GAG(x1, x3)
U1_GAG(x1, x2, x3, x4, x5, x6, x7)  =  U1_GAG(x1, x2, x5, x6, x7)
PB_IN_GAGGAG(x1, x2, x3, x4, x5, x6)  =  PB_IN_GAGGAG(x1, x3, x4, x6)
U2_GAGGAG(x1, x2, x3, x4, x5)  =  U2_GAGGAG(x1, x2, x4, x5)
U3_GAGGAG(x1, x2, x3, x4, x5, x6, x7)  =  U3_GAGGAG(x1, x3, x4, x6, x7)

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

(5) DependencyGraphProof (EQUIVALENT transformation)

The approximation of the Dependency Graph [LOPSTR] contains 1 SCC with 3 less nodes.

(6) Obligation:

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

SUMA_IN_GAG(.(T10, T11), .(T16, T17), .(T14, T15)) → PB_IN_GAGGAG(T10, T16, T14, T11, T17, T15)
PB_IN_GAGGAG(0, T22, T22, T11, T23, T15) → SUMA_IN_GAG(T11, T23, T15)
PB_IN_GAGGAG(s(T30), T33, s(T32), T11, T34, T15) → PB_IN_GAGGAG(T30, T33, T32, T11, T34, T15)

The TRS R consists of the following rules:

sumA_in_gag([], [], []) → sumA_out_gag([], [], [])
sumA_in_gag(.(T10, T11), .(T16, T17), .(T14, T15)) → U1_gag(T10, T11, T16, T17, T14, T15, pB_in_gaggag(T10, T16, T14, T11, T17, T15))
pB_in_gaggag(0, T22, T22, T11, T23, T15) → U2_gaggag(T22, T11, T23, T15, sumA_in_gag(T11, T23, T15))
U2_gaggag(T22, T11, T23, T15, sumA_out_gag(T11, T23, T15)) → pB_out_gaggag(0, T22, T22, T11, T23, T15)
pB_in_gaggag(s(T30), T33, s(T32), T11, T34, T15) → U3_gaggag(T30, T33, T32, T11, T34, T15, pB_in_gaggag(T30, T33, T32, T11, T34, T15))
U3_gaggag(T30, T33, T32, T11, T34, T15, pB_out_gaggag(T30, T33, T32, T11, T34, T15)) → pB_out_gaggag(s(T30), T33, s(T32), T11, T34, T15)
U1_gag(T10, T11, T16, T17, T14, T15, pB_out_gaggag(T10, T16, T14, T11, T17, T15)) → sumA_out_gag(.(T10, T11), .(T16, T17), .(T14, T15))

The argument filtering Pi contains the following mapping:
sumA_in_gag(x1, x2, x3)  =  sumA_in_gag(x1, x3)
[]  =  []
sumA_out_gag(x1, x2, x3)  =  sumA_out_gag(x1, x2, x3)
.(x1, x2)  =  .(x1, x2)
U1_gag(x1, x2, x3, x4, x5, x6, x7)  =  U1_gag(x1, x2, x5, x6, x7)
pB_in_gaggag(x1, x2, x3, x4, x5, x6)  =  pB_in_gaggag(x1, x3, x4, x6)
0  =  0
U2_gaggag(x1, x2, x3, x4, x5)  =  U2_gaggag(x1, x2, x4, x5)
pB_out_gaggag(x1, x2, x3, x4, x5, x6)  =  pB_out_gaggag(x1, x2, x3, x4, x5, x6)
s(x1)  =  s(x1)
U3_gaggag(x1, x2, x3, x4, x5, x6, x7)  =  U3_gaggag(x1, x3, x4, x6, x7)
SUMA_IN_GAG(x1, x2, x3)  =  SUMA_IN_GAG(x1, x3)
PB_IN_GAGGAG(x1, x2, x3, x4, x5, x6)  =  PB_IN_GAGGAG(x1, x3, x4, x6)

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

(7) UsableRulesProof (EQUIVALENT transformation)

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

(8) Obligation:

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

SUMA_IN_GAG(.(T10, T11), .(T16, T17), .(T14, T15)) → PB_IN_GAGGAG(T10, T16, T14, T11, T17, T15)
PB_IN_GAGGAG(0, T22, T22, T11, T23, T15) → SUMA_IN_GAG(T11, T23, T15)
PB_IN_GAGGAG(s(T30), T33, s(T32), T11, T34, T15) → PB_IN_GAGGAG(T30, T33, T32, T11, T34, T15)

R is empty.
The argument filtering Pi contains the following mapping:
.(x1, x2)  =  .(x1, x2)
0  =  0
s(x1)  =  s(x1)
SUMA_IN_GAG(x1, x2, x3)  =  SUMA_IN_GAG(x1, x3)
PB_IN_GAGGAG(x1, x2, x3, x4, x5, x6)  =  PB_IN_GAGGAG(x1, x3, x4, x6)

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

(9) PiDPToQDPProof (SOUND transformation)

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

(10) Obligation:

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

SUMA_IN_GAG(.(T10, T11), .(T14, T15)) → PB_IN_GAGGAG(T10, T14, T11, T15)
PB_IN_GAGGAG(0, T22, T11, T15) → SUMA_IN_GAG(T11, T15)
PB_IN_GAGGAG(s(T30), s(T32), T11, T15) → PB_IN_GAGGAG(T30, T32, T11, T15)

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

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

  • PB_IN_GAGGAG(0, T22, T11, T15) → SUMA_IN_GAG(T11, T15)
    The graph contains the following edges 3 >= 1, 4 >= 2

  • PB_IN_GAGGAG(s(T30), s(T32), T11, T15) → PB_IN_GAGGAG(T30, T32, T11, T15)
    The graph contains the following edges 1 > 1, 2 > 2, 3 >= 3, 4 >= 4

  • SUMA_IN_GAG(.(T10, T11), .(T14, T15)) → PB_IN_GAGGAG(T10, T14, T11, T15)
    The graph contains the following edges 1 > 1, 2 > 2, 1 > 3, 2 > 4

(12) YES