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

sumA_in_gga([], [], []) → sumA_out_gga([], [], [])
sumA_in_gga(.(T10, T11), .(T12, T13), .(T16, T17)) → U1_gga(T10, T11, T12, T13, T16, T17, pB_in_ggagga(T10, T12, T16, T11, T13, T17))
pB_in_ggagga(0, T22, T22, T11, T13, T23) → U2_ggagga(T22, T11, T13, T23, sumA_in_gga(T11, T13, T23))
U2_ggagga(T22, T11, T13, T23, sumA_out_gga(T11, T13, T23)) → pB_out_ggagga(0, T22, T22, T11, T13, T23)
pB_in_ggagga(s(T30), T31, s(T33), T11, T13, T34) → U3_ggagga(T30, T31, T33, T11, T13, T34, pB_in_ggagga(T30, T31, T33, T11, T13, T34))
U3_ggagga(T30, T31, T33, T11, T13, T34, pB_out_ggagga(T30, T31, T33, T11, T13, T34)) → pB_out_ggagga(s(T30), T31, s(T33), T11, T13, T34)
U1_gga(T10, T11, T12, T13, T16, T17, pB_out_ggagga(T10, T12, T16, T11, T13, T17)) → sumA_out_gga(.(T10, T11), .(T12, T13), .(T16, T17))

The argument filtering Pi contains the following mapping:
sumA_in_gga(x1, x2, x3)  =  sumA_in_gga(x1, x2)
[]  =  []
sumA_out_gga(x1, x2, x3)  =  sumA_out_gga(x1, x2, x3)
.(x1, x2)  =  .(x1, x2)
U1_gga(x1, x2, x3, x4, x5, x6, x7)  =  U1_gga(x1, x2, x3, x4, x7)
pB_in_ggagga(x1, x2, x3, x4, x5, x6)  =  pB_in_ggagga(x1, x2, x4, x5)
0  =  0
U2_ggagga(x1, x2, x3, x4, x5)  =  U2_ggagga(x1, x2, x3, x5)
pB_out_ggagga(x1, x2, x3, x4, x5, x6)  =  pB_out_ggagga(x1, x2, x3, x4, x5, x6)
s(x1)  =  s(x1)
U3_ggagga(x1, x2, x3, x4, x5, x6, x7)  =  U3_ggagga(x1, x2, x4, x5, 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_GGA(.(T10, T11), .(T12, T13), .(T16, T17)) → U1_GGA(T10, T11, T12, T13, T16, T17, pB_in_ggagga(T10, T12, T16, T11, T13, T17))
SUMA_IN_GGA(.(T10, T11), .(T12, T13), .(T16, T17)) → PB_IN_GGAGGA(T10, T12, T16, T11, T13, T17)
PB_IN_GGAGGA(0, T22, T22, T11, T13, T23) → U2_GGAGGA(T22, T11, T13, T23, sumA_in_gga(T11, T13, T23))
PB_IN_GGAGGA(0, T22, T22, T11, T13, T23) → SUMA_IN_GGA(T11, T13, T23)
PB_IN_GGAGGA(s(T30), T31, s(T33), T11, T13, T34) → U3_GGAGGA(T30, T31, T33, T11, T13, T34, pB_in_ggagga(T30, T31, T33, T11, T13, T34))
PB_IN_GGAGGA(s(T30), T31, s(T33), T11, T13, T34) → PB_IN_GGAGGA(T30, T31, T33, T11, T13, T34)

The TRS R consists of the following rules:

sumA_in_gga([], [], []) → sumA_out_gga([], [], [])
sumA_in_gga(.(T10, T11), .(T12, T13), .(T16, T17)) → U1_gga(T10, T11, T12, T13, T16, T17, pB_in_ggagga(T10, T12, T16, T11, T13, T17))
pB_in_ggagga(0, T22, T22, T11, T13, T23) → U2_ggagga(T22, T11, T13, T23, sumA_in_gga(T11, T13, T23))
U2_ggagga(T22, T11, T13, T23, sumA_out_gga(T11, T13, T23)) → pB_out_ggagga(0, T22, T22, T11, T13, T23)
pB_in_ggagga(s(T30), T31, s(T33), T11, T13, T34) → U3_ggagga(T30, T31, T33, T11, T13, T34, pB_in_ggagga(T30, T31, T33, T11, T13, T34))
U3_ggagga(T30, T31, T33, T11, T13, T34, pB_out_ggagga(T30, T31, T33, T11, T13, T34)) → pB_out_ggagga(s(T30), T31, s(T33), T11, T13, T34)
U1_gga(T10, T11, T12, T13, T16, T17, pB_out_ggagga(T10, T12, T16, T11, T13, T17)) → sumA_out_gga(.(T10, T11), .(T12, T13), .(T16, T17))

The argument filtering Pi contains the following mapping:
sumA_in_gga(x1, x2, x3)  =  sumA_in_gga(x1, x2)
[]  =  []
sumA_out_gga(x1, x2, x3)  =  sumA_out_gga(x1, x2, x3)
.(x1, x2)  =  .(x1, x2)
U1_gga(x1, x2, x3, x4, x5, x6, x7)  =  U1_gga(x1, x2, x3, x4, x7)
pB_in_ggagga(x1, x2, x3, x4, x5, x6)  =  pB_in_ggagga(x1, x2, x4, x5)
0  =  0
U2_ggagga(x1, x2, x3, x4, x5)  =  U2_ggagga(x1, x2, x3, x5)
pB_out_ggagga(x1, x2, x3, x4, x5, x6)  =  pB_out_ggagga(x1, x2, x3, x4, x5, x6)
s(x1)  =  s(x1)
U3_ggagga(x1, x2, x3, x4, x5, x6, x7)  =  U3_ggagga(x1, x2, x4, x5, x7)
SUMA_IN_GGA(x1, x2, x3)  =  SUMA_IN_GGA(x1, x2)
U1_GGA(x1, x2, x3, x4, x5, x6, x7)  =  U1_GGA(x1, x2, x3, x4, x7)
PB_IN_GGAGGA(x1, x2, x3, x4, x5, x6)  =  PB_IN_GGAGGA(x1, x2, x4, x5)
U2_GGAGGA(x1, x2, x3, x4, x5)  =  U2_GGAGGA(x1, x2, x3, x5)
U3_GGAGGA(x1, x2, x3, x4, x5, x6, x7)  =  U3_GGAGGA(x1, x2, x4, x5, 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_GGA(.(T10, T11), .(T12, T13), .(T16, T17)) → U1_GGA(T10, T11, T12, T13, T16, T17, pB_in_ggagga(T10, T12, T16, T11, T13, T17))
SUMA_IN_GGA(.(T10, T11), .(T12, T13), .(T16, T17)) → PB_IN_GGAGGA(T10, T12, T16, T11, T13, T17)
PB_IN_GGAGGA(0, T22, T22, T11, T13, T23) → U2_GGAGGA(T22, T11, T13, T23, sumA_in_gga(T11, T13, T23))
PB_IN_GGAGGA(0, T22, T22, T11, T13, T23) → SUMA_IN_GGA(T11, T13, T23)
PB_IN_GGAGGA(s(T30), T31, s(T33), T11, T13, T34) → U3_GGAGGA(T30, T31, T33, T11, T13, T34, pB_in_ggagga(T30, T31, T33, T11, T13, T34))
PB_IN_GGAGGA(s(T30), T31, s(T33), T11, T13, T34) → PB_IN_GGAGGA(T30, T31, T33, T11, T13, T34)

The TRS R consists of the following rules:

sumA_in_gga([], [], []) → sumA_out_gga([], [], [])
sumA_in_gga(.(T10, T11), .(T12, T13), .(T16, T17)) → U1_gga(T10, T11, T12, T13, T16, T17, pB_in_ggagga(T10, T12, T16, T11, T13, T17))
pB_in_ggagga(0, T22, T22, T11, T13, T23) → U2_ggagga(T22, T11, T13, T23, sumA_in_gga(T11, T13, T23))
U2_ggagga(T22, T11, T13, T23, sumA_out_gga(T11, T13, T23)) → pB_out_ggagga(0, T22, T22, T11, T13, T23)
pB_in_ggagga(s(T30), T31, s(T33), T11, T13, T34) → U3_ggagga(T30, T31, T33, T11, T13, T34, pB_in_ggagga(T30, T31, T33, T11, T13, T34))
U3_ggagga(T30, T31, T33, T11, T13, T34, pB_out_ggagga(T30, T31, T33, T11, T13, T34)) → pB_out_ggagga(s(T30), T31, s(T33), T11, T13, T34)
U1_gga(T10, T11, T12, T13, T16, T17, pB_out_ggagga(T10, T12, T16, T11, T13, T17)) → sumA_out_gga(.(T10, T11), .(T12, T13), .(T16, T17))

The argument filtering Pi contains the following mapping:
sumA_in_gga(x1, x2, x3)  =  sumA_in_gga(x1, x2)
[]  =  []
sumA_out_gga(x1, x2, x3)  =  sumA_out_gga(x1, x2, x3)
.(x1, x2)  =  .(x1, x2)
U1_gga(x1, x2, x3, x4, x5, x6, x7)  =  U1_gga(x1, x2, x3, x4, x7)
pB_in_ggagga(x1, x2, x3, x4, x5, x6)  =  pB_in_ggagga(x1, x2, x4, x5)
0  =  0
U2_ggagga(x1, x2, x3, x4, x5)  =  U2_ggagga(x1, x2, x3, x5)
pB_out_ggagga(x1, x2, x3, x4, x5, x6)  =  pB_out_ggagga(x1, x2, x3, x4, x5, x6)
s(x1)  =  s(x1)
U3_ggagga(x1, x2, x3, x4, x5, x6, x7)  =  U3_ggagga(x1, x2, x4, x5, x7)
SUMA_IN_GGA(x1, x2, x3)  =  SUMA_IN_GGA(x1, x2)
U1_GGA(x1, x2, x3, x4, x5, x6, x7)  =  U1_GGA(x1, x2, x3, x4, x7)
PB_IN_GGAGGA(x1, x2, x3, x4, x5, x6)  =  PB_IN_GGAGGA(x1, x2, x4, x5)
U2_GGAGGA(x1, x2, x3, x4, x5)  =  U2_GGAGGA(x1, x2, x3, x5)
U3_GGAGGA(x1, x2, x3, x4, x5, x6, x7)  =  U3_GGAGGA(x1, x2, x4, x5, 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_GGA(.(T10, T11), .(T12, T13), .(T16, T17)) → PB_IN_GGAGGA(T10, T12, T16, T11, T13, T17)
PB_IN_GGAGGA(0, T22, T22, T11, T13, T23) → SUMA_IN_GGA(T11, T13, T23)
PB_IN_GGAGGA(s(T30), T31, s(T33), T11, T13, T34) → PB_IN_GGAGGA(T30, T31, T33, T11, T13, T34)

The TRS R consists of the following rules:

sumA_in_gga([], [], []) → sumA_out_gga([], [], [])
sumA_in_gga(.(T10, T11), .(T12, T13), .(T16, T17)) → U1_gga(T10, T11, T12, T13, T16, T17, pB_in_ggagga(T10, T12, T16, T11, T13, T17))
pB_in_ggagga(0, T22, T22, T11, T13, T23) → U2_ggagga(T22, T11, T13, T23, sumA_in_gga(T11, T13, T23))
U2_ggagga(T22, T11, T13, T23, sumA_out_gga(T11, T13, T23)) → pB_out_ggagga(0, T22, T22, T11, T13, T23)
pB_in_ggagga(s(T30), T31, s(T33), T11, T13, T34) → U3_ggagga(T30, T31, T33, T11, T13, T34, pB_in_ggagga(T30, T31, T33, T11, T13, T34))
U3_ggagga(T30, T31, T33, T11, T13, T34, pB_out_ggagga(T30, T31, T33, T11, T13, T34)) → pB_out_ggagga(s(T30), T31, s(T33), T11, T13, T34)
U1_gga(T10, T11, T12, T13, T16, T17, pB_out_ggagga(T10, T12, T16, T11, T13, T17)) → sumA_out_gga(.(T10, T11), .(T12, T13), .(T16, T17))

The argument filtering Pi contains the following mapping:
sumA_in_gga(x1, x2, x3)  =  sumA_in_gga(x1, x2)
[]  =  []
sumA_out_gga(x1, x2, x3)  =  sumA_out_gga(x1, x2, x3)
.(x1, x2)  =  .(x1, x2)
U1_gga(x1, x2, x3, x4, x5, x6, x7)  =  U1_gga(x1, x2, x3, x4, x7)
pB_in_ggagga(x1, x2, x3, x4, x5, x6)  =  pB_in_ggagga(x1, x2, x4, x5)
0  =  0
U2_ggagga(x1, x2, x3, x4, x5)  =  U2_ggagga(x1, x2, x3, x5)
pB_out_ggagga(x1, x2, x3, x4, x5, x6)  =  pB_out_ggagga(x1, x2, x3, x4, x5, x6)
s(x1)  =  s(x1)
U3_ggagga(x1, x2, x3, x4, x5, x6, x7)  =  U3_ggagga(x1, x2, x4, x5, x7)
SUMA_IN_GGA(x1, x2, x3)  =  SUMA_IN_GGA(x1, x2)
PB_IN_GGAGGA(x1, x2, x3, x4, x5, x6)  =  PB_IN_GGAGGA(x1, x2, x4, x5)

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_GGA(.(T10, T11), .(T12, T13), .(T16, T17)) → PB_IN_GGAGGA(T10, T12, T16, T11, T13, T17)
PB_IN_GGAGGA(0, T22, T22, T11, T13, T23) → SUMA_IN_GGA(T11, T13, T23)
PB_IN_GGAGGA(s(T30), T31, s(T33), T11, T13, T34) → PB_IN_GGAGGA(T30, T31, T33, T11, T13, T34)

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

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_GGA(.(T10, T11), .(T12, T13)) → PB_IN_GGAGGA(T10, T12, T11, T13)
PB_IN_GGAGGA(0, T22, T11, T13) → SUMA_IN_GGA(T11, T13)
PB_IN_GGAGGA(s(T30), T31, T11, T13) → PB_IN_GGAGGA(T30, T31, T11, T13)

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_GGAGGA(0, T22, T11, T13) → SUMA_IN_GGA(T11, T13)
    The graph contains the following edges 3 >= 1, 4 >= 2

  • PB_IN_GGAGGA(s(T30), T31, T11, T13) → PB_IN_GGAGGA(T30, T31, T11, T13)
    The graph contains the following edges 1 > 1, 2 >= 2, 3 >= 3, 4 >= 4

  • SUMA_IN_GGA(.(T10, T11), .(T12, T13)) → PB_IN_GGAGGA(T10, T12, T11, T13)
    The graph contains the following edges 1 > 1, 2 > 2, 1 > 3, 2 > 4

(12) YES