(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,a,g).

(1) PrologToPrologProblemTransformerProof (SOUND transformation)

Built Prolog problem from termination graph.

(2) Obligation:

Clauses:

p7(0, T22, T22, T11, T23, T15) :- sum1(T11, T23, T15).
p7(s(T30), T33, s(T32), T11, T34, T15) :- p7(T30, T33, T32, T11, T34, T15).
sum1([], [], []).
sum1(.(T10, T11), .(T16, T17), .(T14, T15)) :- p7(T10, T16, T14, T11, T17, T15).

Queries:

sum1(g,a,g).

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

sum1_in_gag([], [], []) → sum1_out_gag([], [], [])
sum1_in_gag(.(T10, T11), .(T16, T17), .(T14, T15)) → U3_gag(T10, T11, T16, T17, T14, T15, p7_in_gaggag(T10, T16, T14, T11, T17, T15))
p7_in_gaggag(0, T22, T22, T11, T23, T15) → U1_gaggag(T22, T11, T23, T15, sum1_in_gag(T11, T23, T15))
U1_gaggag(T22, T11, T23, T15, sum1_out_gag(T11, T23, T15)) → p7_out_gaggag(0, T22, T22, T11, T23, T15)
p7_in_gaggag(s(T30), T33, s(T32), T11, T34, T15) → U2_gaggag(T30, T33, T32, T11, T34, T15, p7_in_gaggag(T30, T33, T32, T11, T34, T15))
U2_gaggag(T30, T33, T32, T11, T34, T15, p7_out_gaggag(T30, T33, T32, T11, T34, T15)) → p7_out_gaggag(s(T30), T33, s(T32), T11, T34, T15)
U3_gag(T10, T11, T16, T17, T14, T15, p7_out_gaggag(T10, T16, T14, T11, T17, T15)) → sum1_out_gag(.(T10, T11), .(T16, T17), .(T14, T15))

The argument filtering Pi contains the following mapping:
sum1_in_gag(x1, x2, x3)  =  sum1_in_gag(x1, x3)
[]  =  []
sum1_out_gag(x1, x2, x3)  =  sum1_out_gag(x2)
.(x1, x2)  =  .(x1, x2)
U3_gag(x1, x2, x3, x4, x5, x6, x7)  =  U3_gag(x7)
p7_in_gaggag(x1, x2, x3, x4, x5, x6)  =  p7_in_gaggag(x1, x3, x4, x6)
0  =  0
U1_gaggag(x1, x2, x3, x4, x5)  =  U1_gaggag(x1, x5)
p7_out_gaggag(x1, x2, x3, x4, x5, x6)  =  p7_out_gaggag(x2, x5)
s(x1)  =  s(x1)
U2_gaggag(x1, x2, x3, x4, x5, x6, x7)  =  U2_gaggag(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_gag([], [], []) → sum1_out_gag([], [], [])
sum1_in_gag(.(T10, T11), .(T16, T17), .(T14, T15)) → U3_gag(T10, T11, T16, T17, T14, T15, p7_in_gaggag(T10, T16, T14, T11, T17, T15))
p7_in_gaggag(0, T22, T22, T11, T23, T15) → U1_gaggag(T22, T11, T23, T15, sum1_in_gag(T11, T23, T15))
U1_gaggag(T22, T11, T23, T15, sum1_out_gag(T11, T23, T15)) → p7_out_gaggag(0, T22, T22, T11, T23, T15)
p7_in_gaggag(s(T30), T33, s(T32), T11, T34, T15) → U2_gaggag(T30, T33, T32, T11, T34, T15, p7_in_gaggag(T30, T33, T32, T11, T34, T15))
U2_gaggag(T30, T33, T32, T11, T34, T15, p7_out_gaggag(T30, T33, T32, T11, T34, T15)) → p7_out_gaggag(s(T30), T33, s(T32), T11, T34, T15)
U3_gag(T10, T11, T16, T17, T14, T15, p7_out_gaggag(T10, T16, T14, T11, T17, T15)) → sum1_out_gag(.(T10, T11), .(T16, T17), .(T14, T15))

The argument filtering Pi contains the following mapping:
sum1_in_gag(x1, x2, x3)  =  sum1_in_gag(x1, x3)
[]  =  []
sum1_out_gag(x1, x2, x3)  =  sum1_out_gag(x2)
.(x1, x2)  =  .(x1, x2)
U3_gag(x1, x2, x3, x4, x5, x6, x7)  =  U3_gag(x7)
p7_in_gaggag(x1, x2, x3, x4, x5, x6)  =  p7_in_gaggag(x1, x3, x4, x6)
0  =  0
U1_gaggag(x1, x2, x3, x4, x5)  =  U1_gaggag(x1, x5)
p7_out_gaggag(x1, x2, x3, x4, x5, x6)  =  p7_out_gaggag(x2, x5)
s(x1)  =  s(x1)
U2_gaggag(x1, x2, x3, x4, x5, x6, x7)  =  U2_gaggag(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_GAG(.(T10, T11), .(T16, T17), .(T14, T15)) → U3_GAG(T10, T11, T16, T17, T14, T15, p7_in_gaggag(T10, T16, T14, T11, T17, T15))
SUM1_IN_GAG(.(T10, T11), .(T16, T17), .(T14, T15)) → P7_IN_GAGGAG(T10, T16, T14, T11, T17, T15)
P7_IN_GAGGAG(0, T22, T22, T11, T23, T15) → U1_GAGGAG(T22, T11, T23, T15, sum1_in_gag(T11, T23, T15))
P7_IN_GAGGAG(0, T22, T22, T11, T23, T15) → SUM1_IN_GAG(T11, T23, T15)
P7_IN_GAGGAG(s(T30), T33, s(T32), T11, T34, T15) → U2_GAGGAG(T30, T33, T32, T11, T34, T15, p7_in_gaggag(T30, T33, T32, T11, T34, T15))
P7_IN_GAGGAG(s(T30), T33, s(T32), T11, T34, T15) → P7_IN_GAGGAG(T30, T33, T32, T11, T34, T15)

The TRS R consists of the following rules:

sum1_in_gag([], [], []) → sum1_out_gag([], [], [])
sum1_in_gag(.(T10, T11), .(T16, T17), .(T14, T15)) → U3_gag(T10, T11, T16, T17, T14, T15, p7_in_gaggag(T10, T16, T14, T11, T17, T15))
p7_in_gaggag(0, T22, T22, T11, T23, T15) → U1_gaggag(T22, T11, T23, T15, sum1_in_gag(T11, T23, T15))
U1_gaggag(T22, T11, T23, T15, sum1_out_gag(T11, T23, T15)) → p7_out_gaggag(0, T22, T22, T11, T23, T15)
p7_in_gaggag(s(T30), T33, s(T32), T11, T34, T15) → U2_gaggag(T30, T33, T32, T11, T34, T15, p7_in_gaggag(T30, T33, T32, T11, T34, T15))
U2_gaggag(T30, T33, T32, T11, T34, T15, p7_out_gaggag(T30, T33, T32, T11, T34, T15)) → p7_out_gaggag(s(T30), T33, s(T32), T11, T34, T15)
U3_gag(T10, T11, T16, T17, T14, T15, p7_out_gaggag(T10, T16, T14, T11, T17, T15)) → sum1_out_gag(.(T10, T11), .(T16, T17), .(T14, T15))

The argument filtering Pi contains the following mapping:
sum1_in_gag(x1, x2, x3)  =  sum1_in_gag(x1, x3)
[]  =  []
sum1_out_gag(x1, x2, x3)  =  sum1_out_gag(x2)
.(x1, x2)  =  .(x1, x2)
U3_gag(x1, x2, x3, x4, x5, x6, x7)  =  U3_gag(x7)
p7_in_gaggag(x1, x2, x3, x4, x5, x6)  =  p7_in_gaggag(x1, x3, x4, x6)
0  =  0
U1_gaggag(x1, x2, x3, x4, x5)  =  U1_gaggag(x1, x5)
p7_out_gaggag(x1, x2, x3, x4, x5, x6)  =  p7_out_gaggag(x2, x5)
s(x1)  =  s(x1)
U2_gaggag(x1, x2, x3, x4, x5, x6, x7)  =  U2_gaggag(x7)
SUM1_IN_GAG(x1, x2, x3)  =  SUM1_IN_GAG(x1, x3)
U3_GAG(x1, x2, x3, x4, x5, x6, x7)  =  U3_GAG(x7)
P7_IN_GAGGAG(x1, x2, x3, x4, x5, x6)  =  P7_IN_GAGGAG(x1, x3, x4, x6)
U1_GAGGAG(x1, x2, x3, x4, x5)  =  U1_GAGGAG(x1, x5)
U2_GAGGAG(x1, x2, x3, x4, x5, x6, x7)  =  U2_GAGGAG(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_GAG(.(T10, T11), .(T16, T17), .(T14, T15)) → U3_GAG(T10, T11, T16, T17, T14, T15, p7_in_gaggag(T10, T16, T14, T11, T17, T15))
SUM1_IN_GAG(.(T10, T11), .(T16, T17), .(T14, T15)) → P7_IN_GAGGAG(T10, T16, T14, T11, T17, T15)
P7_IN_GAGGAG(0, T22, T22, T11, T23, T15) → U1_GAGGAG(T22, T11, T23, T15, sum1_in_gag(T11, T23, T15))
P7_IN_GAGGAG(0, T22, T22, T11, T23, T15) → SUM1_IN_GAG(T11, T23, T15)
P7_IN_GAGGAG(s(T30), T33, s(T32), T11, T34, T15) → U2_GAGGAG(T30, T33, T32, T11, T34, T15, p7_in_gaggag(T30, T33, T32, T11, T34, T15))
P7_IN_GAGGAG(s(T30), T33, s(T32), T11, T34, T15) → P7_IN_GAGGAG(T30, T33, T32, T11, T34, T15)

The TRS R consists of the following rules:

sum1_in_gag([], [], []) → sum1_out_gag([], [], [])
sum1_in_gag(.(T10, T11), .(T16, T17), .(T14, T15)) → U3_gag(T10, T11, T16, T17, T14, T15, p7_in_gaggag(T10, T16, T14, T11, T17, T15))
p7_in_gaggag(0, T22, T22, T11, T23, T15) → U1_gaggag(T22, T11, T23, T15, sum1_in_gag(T11, T23, T15))
U1_gaggag(T22, T11, T23, T15, sum1_out_gag(T11, T23, T15)) → p7_out_gaggag(0, T22, T22, T11, T23, T15)
p7_in_gaggag(s(T30), T33, s(T32), T11, T34, T15) → U2_gaggag(T30, T33, T32, T11, T34, T15, p7_in_gaggag(T30, T33, T32, T11, T34, T15))
U2_gaggag(T30, T33, T32, T11, T34, T15, p7_out_gaggag(T30, T33, T32, T11, T34, T15)) → p7_out_gaggag(s(T30), T33, s(T32), T11, T34, T15)
U3_gag(T10, T11, T16, T17, T14, T15, p7_out_gaggag(T10, T16, T14, T11, T17, T15)) → sum1_out_gag(.(T10, T11), .(T16, T17), .(T14, T15))

The argument filtering Pi contains the following mapping:
sum1_in_gag(x1, x2, x3)  =  sum1_in_gag(x1, x3)
[]  =  []
sum1_out_gag(x1, x2, x3)  =  sum1_out_gag(x2)
.(x1, x2)  =  .(x1, x2)
U3_gag(x1, x2, x3, x4, x5, x6, x7)  =  U3_gag(x7)
p7_in_gaggag(x1, x2, x3, x4, x5, x6)  =  p7_in_gaggag(x1, x3, x4, x6)
0  =  0
U1_gaggag(x1, x2, x3, x4, x5)  =  U1_gaggag(x1, x5)
p7_out_gaggag(x1, x2, x3, x4, x5, x6)  =  p7_out_gaggag(x2, x5)
s(x1)  =  s(x1)
U2_gaggag(x1, x2, x3, x4, x5, x6, x7)  =  U2_gaggag(x7)
SUM1_IN_GAG(x1, x2, x3)  =  SUM1_IN_GAG(x1, x3)
U3_GAG(x1, x2, x3, x4, x5, x6, x7)  =  U3_GAG(x7)
P7_IN_GAGGAG(x1, x2, x3, x4, x5, x6)  =  P7_IN_GAGGAG(x1, x3, x4, x6)
U1_GAGGAG(x1, x2, x3, x4, x5)  =  U1_GAGGAG(x1, x5)
U2_GAGGAG(x1, x2, x3, x4, x5, x6, x7)  =  U2_GAGGAG(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_GAG(.(T10, T11), .(T16, T17), .(T14, T15)) → P7_IN_GAGGAG(T10, T16, T14, T11, T17, T15)
P7_IN_GAGGAG(0, T22, T22, T11, T23, T15) → SUM1_IN_GAG(T11, T23, T15)
P7_IN_GAGGAG(s(T30), T33, s(T32), T11, T34, T15) → P7_IN_GAGGAG(T30, T33, T32, T11, T34, T15)

The TRS R consists of the following rules:

sum1_in_gag([], [], []) → sum1_out_gag([], [], [])
sum1_in_gag(.(T10, T11), .(T16, T17), .(T14, T15)) → U3_gag(T10, T11, T16, T17, T14, T15, p7_in_gaggag(T10, T16, T14, T11, T17, T15))
p7_in_gaggag(0, T22, T22, T11, T23, T15) → U1_gaggag(T22, T11, T23, T15, sum1_in_gag(T11, T23, T15))
U1_gaggag(T22, T11, T23, T15, sum1_out_gag(T11, T23, T15)) → p7_out_gaggag(0, T22, T22, T11, T23, T15)
p7_in_gaggag(s(T30), T33, s(T32), T11, T34, T15) → U2_gaggag(T30, T33, T32, T11, T34, T15, p7_in_gaggag(T30, T33, T32, T11, T34, T15))
U2_gaggag(T30, T33, T32, T11, T34, T15, p7_out_gaggag(T30, T33, T32, T11, T34, T15)) → p7_out_gaggag(s(T30), T33, s(T32), T11, T34, T15)
U3_gag(T10, T11, T16, T17, T14, T15, p7_out_gaggag(T10, T16, T14, T11, T17, T15)) → sum1_out_gag(.(T10, T11), .(T16, T17), .(T14, T15))

The argument filtering Pi contains the following mapping:
sum1_in_gag(x1, x2, x3)  =  sum1_in_gag(x1, x3)
[]  =  []
sum1_out_gag(x1, x2, x3)  =  sum1_out_gag(x2)
.(x1, x2)  =  .(x1, x2)
U3_gag(x1, x2, x3, x4, x5, x6, x7)  =  U3_gag(x7)
p7_in_gaggag(x1, x2, x3, x4, x5, x6)  =  p7_in_gaggag(x1, x3, x4, x6)
0  =  0
U1_gaggag(x1, x2, x3, x4, x5)  =  U1_gaggag(x1, x5)
p7_out_gaggag(x1, x2, x3, x4, x5, x6)  =  p7_out_gaggag(x2, x5)
s(x1)  =  s(x1)
U2_gaggag(x1, x2, x3, x4, x5, x6, x7)  =  U2_gaggag(x7)
SUM1_IN_GAG(x1, x2, x3)  =  SUM1_IN_GAG(x1, x3)
P7_IN_GAGGAG(x1, x2, x3, x4, x5, x6)  =  P7_IN_GAGGAG(x1, x3, x4, x6)

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_GAG(.(T10, T11), .(T16, T17), .(T14, T15)) → P7_IN_GAGGAG(T10, T16, T14, T11, T17, T15)
P7_IN_GAGGAG(0, T22, T22, T11, T23, T15) → SUM1_IN_GAG(T11, T23, T15)
P7_IN_GAGGAG(s(T30), T33, s(T32), T11, T34, T15) → P7_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)
SUM1_IN_GAG(x1, x2, x3)  =  SUM1_IN_GAG(x1, x3)
P7_IN_GAGGAG(x1, x2, x3, x4, x5, x6)  =  P7_IN_GAGGAG(x1, x3, x4, x6)

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_GAG(.(T10, T11), .(T14, T15)) → P7_IN_GAGGAG(T10, T14, T11, T15)
P7_IN_GAGGAG(0, T22, T11, T15) → SUM1_IN_GAG(T11, T15)
P7_IN_GAGGAG(s(T30), s(T32), T11, T15) → P7_IN_GAGGAG(T30, T32, T11, T15)

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

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

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

(14) YES