(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).

Queries:

sum(g,g,a).

(1) PrologToPrologProblemTransformerProof (SOUND transformation)

Built Prolog problem from termination graph.

(2) Obligation:

Clauses:

p7(0, T22, T22, T11, T13, T23) :- sum1(T11, T13, T23).
p7(s(T30), T31, s(T33), T11, T13, T34) :- p7(T30, T31, T33, T11, T13, T34).
sum1([], [], []).
sum1(.(T10, T11), .(T12, T13), .(T16, T17)) :- p7(T10, T12, T16, T11, T13, T17).

Queries:

sum1(g,g,a).

(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:
sum1_in: (b,b,f)
p7_in: (b,b,f,b,b,f)
Transforming Prolog into the following Term Rewriting System:
Pi-finite rewrite system:
The TRS R consists of the following rules:

sum1_in_gga([], [], []) → sum1_out_gga([], [], [])
sum1_in_gga(.(T10, T11), .(T12, T13), .(T16, T17)) → U3_gga(T10, T11, T12, T13, T16, T17, p7_in_ggagga(T10, T12, T16, T11, T13, T17))
p7_in_ggagga(0, T22, T22, T11, T13, T23) → U1_ggagga(T22, T11, T13, T23, sum1_in_gga(T11, T13, T23))
U1_ggagga(T22, T11, T13, T23, sum1_out_gga(T11, T13, T23)) → p7_out_ggagga(0, T22, T22, T11, T13, T23)
p7_in_ggagga(s(T30), T31, s(T33), T11, T13, T34) → U2_ggagga(T30, T31, T33, T11, T13, T34, p7_in_ggagga(T30, T31, T33, T11, T13, T34))
U2_ggagga(T30, T31, T33, T11, T13, T34, p7_out_ggagga(T30, T31, T33, T11, T13, T34)) → p7_out_ggagga(s(T30), T31, s(T33), T11, T13, T34)
U3_gga(T10, T11, T12, T13, T16, T17, p7_out_ggagga(T10, T12, T16, T11, T13, T17)) → sum1_out_gga(.(T10, T11), .(T12, T13), .(T16, T17))

The argument filtering Pi contains the following mapping:
sum1_in_gga(x1, x2, x3)  =  sum1_in_gga(x1, x2)
[]  =  []
sum1_out_gga(x1, x2, x3)  =  sum1_out_gga(x3)
.(x1, x2)  =  .(x1, x2)
U3_gga(x1, x2, x3, x4, x5, x6, x7)  =  U3_gga(x7)
p7_in_ggagga(x1, x2, x3, x4, x5, x6)  =  p7_in_ggagga(x1, x2, x4, x5)
0  =  0
U1_ggagga(x1, x2, x3, x4, x5)  =  U1_ggagga(x1, x5)
p7_out_ggagga(x1, x2, x3, x4, x5, x6)  =  p7_out_ggagga(x3, x6)
s(x1)  =  s(x1)
U2_ggagga(x1, x2, x3, x4, x5, x6, x7)  =  U2_ggagga(x7)

Infinitary Constructor Rewriting Termination of PiTRS implies Termination of Prolog

(4) Obligation:

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

sum1_in_gga([], [], []) → sum1_out_gga([], [], [])
sum1_in_gga(.(T10, T11), .(T12, T13), .(T16, T17)) → U3_gga(T10, T11, T12, T13, T16, T17, p7_in_ggagga(T10, T12, T16, T11, T13, T17))
p7_in_ggagga(0, T22, T22, T11, T13, T23) → U1_ggagga(T22, T11, T13, T23, sum1_in_gga(T11, T13, T23))
U1_ggagga(T22, T11, T13, T23, sum1_out_gga(T11, T13, T23)) → p7_out_ggagga(0, T22, T22, T11, T13, T23)
p7_in_ggagga(s(T30), T31, s(T33), T11, T13, T34) → U2_ggagga(T30, T31, T33, T11, T13, T34, p7_in_ggagga(T30, T31, T33, T11, T13, T34))
U2_ggagga(T30, T31, T33, T11, T13, T34, p7_out_ggagga(T30, T31, T33, T11, T13, T34)) → p7_out_ggagga(s(T30), T31, s(T33), T11, T13, T34)
U3_gga(T10, T11, T12, T13, T16, T17, p7_out_ggagga(T10, T12, T16, T11, T13, T17)) → sum1_out_gga(.(T10, T11), .(T12, T13), .(T16, T17))

The argument filtering Pi contains the following mapping:
sum1_in_gga(x1, x2, x3)  =  sum1_in_gga(x1, x2)
[]  =  []
sum1_out_gga(x1, x2, x3)  =  sum1_out_gga(x3)
.(x1, x2)  =  .(x1, x2)
U3_gga(x1, x2, x3, x4, x5, x6, x7)  =  U3_gga(x7)
p7_in_ggagga(x1, x2, x3, x4, x5, x6)  =  p7_in_ggagga(x1, x2, x4, x5)
0  =  0
U1_ggagga(x1, x2, x3, x4, x5)  =  U1_ggagga(x1, x5)
p7_out_ggagga(x1, x2, x3, x4, x5, x6)  =  p7_out_ggagga(x3, x6)
s(x1)  =  s(x1)
U2_ggagga(x1, x2, x3, x4, x5, x6, x7)  =  U2_ggagga(x7)

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

SUM1_IN_GGA(.(T10, T11), .(T12, T13), .(T16, T17)) → U3_GGA(T10, T11, T12, T13, T16, T17, p7_in_ggagga(T10, T12, T16, T11, T13, T17))
SUM1_IN_GGA(.(T10, T11), .(T12, T13), .(T16, T17)) → P7_IN_GGAGGA(T10, T12, T16, T11, T13, T17)
P7_IN_GGAGGA(0, T22, T22, T11, T13, T23) → U1_GGAGGA(T22, T11, T13, T23, sum1_in_gga(T11, T13, T23))
P7_IN_GGAGGA(0, T22, T22, T11, T13, T23) → SUM1_IN_GGA(T11, T13, T23)
P7_IN_GGAGGA(s(T30), T31, s(T33), T11, T13, T34) → U2_GGAGGA(T30, T31, T33, T11, T13, T34, p7_in_ggagga(T30, T31, T33, T11, T13, T34))
P7_IN_GGAGGA(s(T30), T31, s(T33), T11, T13, T34) → P7_IN_GGAGGA(T30, T31, T33, T11, T13, T34)

The TRS R consists of the following rules:

sum1_in_gga([], [], []) → sum1_out_gga([], [], [])
sum1_in_gga(.(T10, T11), .(T12, T13), .(T16, T17)) → U3_gga(T10, T11, T12, T13, T16, T17, p7_in_ggagga(T10, T12, T16, T11, T13, T17))
p7_in_ggagga(0, T22, T22, T11, T13, T23) → U1_ggagga(T22, T11, T13, T23, sum1_in_gga(T11, T13, T23))
U1_ggagga(T22, T11, T13, T23, sum1_out_gga(T11, T13, T23)) → p7_out_ggagga(0, T22, T22, T11, T13, T23)
p7_in_ggagga(s(T30), T31, s(T33), T11, T13, T34) → U2_ggagga(T30, T31, T33, T11, T13, T34, p7_in_ggagga(T30, T31, T33, T11, T13, T34))
U2_ggagga(T30, T31, T33, T11, T13, T34, p7_out_ggagga(T30, T31, T33, T11, T13, T34)) → p7_out_ggagga(s(T30), T31, s(T33), T11, T13, T34)
U3_gga(T10, T11, T12, T13, T16, T17, p7_out_ggagga(T10, T12, T16, T11, T13, T17)) → sum1_out_gga(.(T10, T11), .(T12, T13), .(T16, T17))

The argument filtering Pi contains the following mapping:
sum1_in_gga(x1, x2, x3)  =  sum1_in_gga(x1, x2)
[]  =  []
sum1_out_gga(x1, x2, x3)  =  sum1_out_gga(x3)
.(x1, x2)  =  .(x1, x2)
U3_gga(x1, x2, x3, x4, x5, x6, x7)  =  U3_gga(x7)
p7_in_ggagga(x1, x2, x3, x4, x5, x6)  =  p7_in_ggagga(x1, x2, x4, x5)
0  =  0
U1_ggagga(x1, x2, x3, x4, x5)  =  U1_ggagga(x1, x5)
p7_out_ggagga(x1, x2, x3, x4, x5, x6)  =  p7_out_ggagga(x3, x6)
s(x1)  =  s(x1)
U2_ggagga(x1, x2, x3, x4, x5, x6, x7)  =  U2_ggagga(x7)
SUM1_IN_GGA(x1, x2, x3)  =  SUM1_IN_GGA(x1, x2)
U3_GGA(x1, x2, x3, x4, x5, x6, x7)  =  U3_GGA(x7)
P7_IN_GGAGGA(x1, x2, x3, x4, x5, x6)  =  P7_IN_GGAGGA(x1, x2, x4, x5)
U1_GGAGGA(x1, x2, x3, x4, x5)  =  U1_GGAGGA(x1, x5)
U2_GGAGGA(x1, x2, x3, x4, x5, x6, x7)  =  U2_GGAGGA(x7)

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

(6) Obligation:

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

SUM1_IN_GGA(.(T10, T11), .(T12, T13), .(T16, T17)) → U3_GGA(T10, T11, T12, T13, T16, T17, p7_in_ggagga(T10, T12, T16, T11, T13, T17))
SUM1_IN_GGA(.(T10, T11), .(T12, T13), .(T16, T17)) → P7_IN_GGAGGA(T10, T12, T16, T11, T13, T17)
P7_IN_GGAGGA(0, T22, T22, T11, T13, T23) → U1_GGAGGA(T22, T11, T13, T23, sum1_in_gga(T11, T13, T23))
P7_IN_GGAGGA(0, T22, T22, T11, T13, T23) → SUM1_IN_GGA(T11, T13, T23)
P7_IN_GGAGGA(s(T30), T31, s(T33), T11, T13, T34) → U2_GGAGGA(T30, T31, T33, T11, T13, T34, p7_in_ggagga(T30, T31, T33, T11, T13, T34))
P7_IN_GGAGGA(s(T30), T31, s(T33), T11, T13, T34) → P7_IN_GGAGGA(T30, T31, T33, T11, T13, T34)

The TRS R consists of the following rules:

sum1_in_gga([], [], []) → sum1_out_gga([], [], [])
sum1_in_gga(.(T10, T11), .(T12, T13), .(T16, T17)) → U3_gga(T10, T11, T12, T13, T16, T17, p7_in_ggagga(T10, T12, T16, T11, T13, T17))
p7_in_ggagga(0, T22, T22, T11, T13, T23) → U1_ggagga(T22, T11, T13, T23, sum1_in_gga(T11, T13, T23))
U1_ggagga(T22, T11, T13, T23, sum1_out_gga(T11, T13, T23)) → p7_out_ggagga(0, T22, T22, T11, T13, T23)
p7_in_ggagga(s(T30), T31, s(T33), T11, T13, T34) → U2_ggagga(T30, T31, T33, T11, T13, T34, p7_in_ggagga(T30, T31, T33, T11, T13, T34))
U2_ggagga(T30, T31, T33, T11, T13, T34, p7_out_ggagga(T30, T31, T33, T11, T13, T34)) → p7_out_ggagga(s(T30), T31, s(T33), T11, T13, T34)
U3_gga(T10, T11, T12, T13, T16, T17, p7_out_ggagga(T10, T12, T16, T11, T13, T17)) → sum1_out_gga(.(T10, T11), .(T12, T13), .(T16, T17))

The argument filtering Pi contains the following mapping:
sum1_in_gga(x1, x2, x3)  =  sum1_in_gga(x1, x2)
[]  =  []
sum1_out_gga(x1, x2, x3)  =  sum1_out_gga(x3)
.(x1, x2)  =  .(x1, x2)
U3_gga(x1, x2, x3, x4, x5, x6, x7)  =  U3_gga(x7)
p7_in_ggagga(x1, x2, x3, x4, x5, x6)  =  p7_in_ggagga(x1, x2, x4, x5)
0  =  0
U1_ggagga(x1, x2, x3, x4, x5)  =  U1_ggagga(x1, x5)
p7_out_ggagga(x1, x2, x3, x4, x5, x6)  =  p7_out_ggagga(x3, x6)
s(x1)  =  s(x1)
U2_ggagga(x1, x2, x3, x4, x5, x6, x7)  =  U2_ggagga(x7)
SUM1_IN_GGA(x1, x2, x3)  =  SUM1_IN_GGA(x1, x2)
U3_GGA(x1, x2, x3, x4, x5, x6, x7)  =  U3_GGA(x7)
P7_IN_GGAGGA(x1, x2, x3, x4, x5, x6)  =  P7_IN_GGAGGA(x1, x2, x4, x5)
U1_GGAGGA(x1, x2, x3, x4, x5)  =  U1_GGAGGA(x1, x5)
U2_GGAGGA(x1, x2, x3, x4, x5, x6, x7)  =  U2_GGAGGA(x7)

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

(7) DependencyGraphProof (EQUIVALENT transformation)

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

(8) Obligation:

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

SUM1_IN_GGA(.(T10, T11), .(T12, T13), .(T16, T17)) → P7_IN_GGAGGA(T10, T12, T16, T11, T13, T17)
P7_IN_GGAGGA(0, T22, T22, T11, T13, T23) → SUM1_IN_GGA(T11, T13, T23)
P7_IN_GGAGGA(s(T30), T31, s(T33), T11, T13, T34) → P7_IN_GGAGGA(T30, T31, T33, T11, T13, T34)

The TRS R consists of the following rules:

sum1_in_gga([], [], []) → sum1_out_gga([], [], [])
sum1_in_gga(.(T10, T11), .(T12, T13), .(T16, T17)) → U3_gga(T10, T11, T12, T13, T16, T17, p7_in_ggagga(T10, T12, T16, T11, T13, T17))
p7_in_ggagga(0, T22, T22, T11, T13, T23) → U1_ggagga(T22, T11, T13, T23, sum1_in_gga(T11, T13, T23))
U1_ggagga(T22, T11, T13, T23, sum1_out_gga(T11, T13, T23)) → p7_out_ggagga(0, T22, T22, T11, T13, T23)
p7_in_ggagga(s(T30), T31, s(T33), T11, T13, T34) → U2_ggagga(T30, T31, T33, T11, T13, T34, p7_in_ggagga(T30, T31, T33, T11, T13, T34))
U2_ggagga(T30, T31, T33, T11, T13, T34, p7_out_ggagga(T30, T31, T33, T11, T13, T34)) → p7_out_ggagga(s(T30), T31, s(T33), T11, T13, T34)
U3_gga(T10, T11, T12, T13, T16, T17, p7_out_ggagga(T10, T12, T16, T11, T13, T17)) → sum1_out_gga(.(T10, T11), .(T12, T13), .(T16, T17))

The argument filtering Pi contains the following mapping:
sum1_in_gga(x1, x2, x3)  =  sum1_in_gga(x1, x2)
[]  =  []
sum1_out_gga(x1, x2, x3)  =  sum1_out_gga(x3)
.(x1, x2)  =  .(x1, x2)
U3_gga(x1, x2, x3, x4, x5, x6, x7)  =  U3_gga(x7)
p7_in_ggagga(x1, x2, x3, x4, x5, x6)  =  p7_in_ggagga(x1, x2, x4, x5)
0  =  0
U1_ggagga(x1, x2, x3, x4, x5)  =  U1_ggagga(x1, x5)
p7_out_ggagga(x1, x2, x3, x4, x5, x6)  =  p7_out_ggagga(x3, x6)
s(x1)  =  s(x1)
U2_ggagga(x1, x2, x3, x4, x5, x6, x7)  =  U2_ggagga(x7)
SUM1_IN_GGA(x1, x2, x3)  =  SUM1_IN_GGA(x1, x2)
P7_IN_GGAGGA(x1, x2, x3, x4, x5, x6)  =  P7_IN_GGAGGA(x1, x2, x4, x5)

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

(9) UsableRulesProof (EQUIVALENT transformation)

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

(10) Obligation:

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

SUM1_IN_GGA(.(T10, T11), .(T12, T13), .(T16, T17)) → P7_IN_GGAGGA(T10, T12, T16, T11, T13, T17)
P7_IN_GGAGGA(0, T22, T22, T11, T13, T23) → SUM1_IN_GGA(T11, T13, T23)
P7_IN_GGAGGA(s(T30), T31, s(T33), T11, T13, T34) → P7_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)
SUM1_IN_GGA(x1, x2, x3)  =  SUM1_IN_GGA(x1, x2)
P7_IN_GGAGGA(x1, x2, x3, x4, x5, x6)  =  P7_IN_GGAGGA(x1, x2, x4, x5)

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

(11) PiDPToQDPProof (SOUND transformation)

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

(12) Obligation:

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

SUM1_IN_GGA(.(T10, T11), .(T12, T13)) → P7_IN_GGAGGA(T10, T12, T11, T13)
P7_IN_GGAGGA(0, T22, T11, T13) → SUM1_IN_GGA(T11, T13)
P7_IN_GGAGGA(s(T30), T31, T11, T13) → P7_IN_GGAGGA(T30, T31, T11, T13)

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

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

  • P7_IN_GGAGGA(0, T22, T11, T13) → SUM1_IN_GGA(T11, T13)
    The graph contains the following edges 3 >= 1, 4 >= 2

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

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

(14) YES