(0) Obligation:

Clauses:

average(0, 0, Z) :- ','(!, eq(Z, 0)).
average(0, s(0), Z) :- ','(!, eq(Z, 0)).
average(0, s(s(0)), Z) :- ','(!, eq(Z, s(0))).
average(X, Y, Z) :- ','(p(X, P), average(P, s(Y), Z)).
average(X, Y, Z) :- ','(p(Y, P1), ','(p(P1, P2), ','(p(P2, P3), ','(average(s(X), P3, U), p(Z, U))))).
p(0, 0).
p(s(X), X).
eq(X, X).

Queries:

average(g,g,a).

(1) PrologToDTProblemTransformerProof (SOUND transformation)

Built DT problem from termination graph.

(2) Obligation:

Triples:

average1(0, T26, T28) :- average1(0, s(T26), T28).
average1(s(T34), T26, T28) :- average1(T34, s(T26), T28).
average1(T44, 0, T47) :- average1(s(T44), 0, X64).
average1(T44, s(0), T47) :- average1(s(T44), 0, X64).
average1(T44, s(s(0)), T47) :- average1(s(T44), 0, X64).
average1(T44, s(s(s(T86))), T47) :- average1(s(T44), T86, X64).

Clauses:

averagec1(0, 0, 0).
averagec1(0, s(0), 0).
averagec1(0, s(s(0)), s(0)).
averagec1(0, T26, T28) :- averagec1(0, s(T26), T28).
averagec1(s(T34), T26, T28) :- averagec1(T34, s(T26), T28).
averagec1(T44, 0, 0) :- averagec1(s(T44), 0, 0).
averagec1(T44, 0, s(T60)) :- averagec1(s(T44), 0, T60).
averagec1(T44, s(0), 0) :- averagec1(s(T44), 0, 0).
averagec1(T44, s(0), s(T73)) :- averagec1(s(T44), 0, T73).
averagec1(T44, s(s(0)), 0) :- averagec1(s(T44), 0, 0).
averagec1(T44, s(s(0)), s(T83)) :- averagec1(s(T44), 0, T83).
averagec1(T44, s(s(s(T86))), 0) :- averagec1(s(T44), T86, 0).
averagec1(T44, s(s(s(T86))), s(T94)) :- averagec1(s(T44), T86, T94).

Afs:

average1(x1, x2, x3)  =  average1(x1, x2)

(3) TriplesToPiDPProof (SOUND transformation)

We use the technique of [LOPSTR]. With regard to the inferred argument filtering the predicates were used in the following modes:
average1_in: (b,b,f)
Transforming TRIPLES into the following Term Rewriting System:
Pi DP problem:
The TRS P consists of the following rules:

AVERAGE1_IN_GGA(0, T26, T28) → U1_GGA(T26, T28, average1_in_gga(0, s(T26), T28))
AVERAGE1_IN_GGA(0, T26, T28) → AVERAGE1_IN_GGA(0, s(T26), T28)
AVERAGE1_IN_GGA(s(T34), T26, T28) → U2_GGA(T34, T26, T28, average1_in_gga(T34, s(T26), T28))
AVERAGE1_IN_GGA(s(T34), T26, T28) → AVERAGE1_IN_GGA(T34, s(T26), T28)
AVERAGE1_IN_GGA(T44, 0, T47) → U3_GGA(T44, T47, average1_in_gga(s(T44), 0, X64))
AVERAGE1_IN_GGA(T44, 0, T47) → AVERAGE1_IN_GGA(s(T44), 0, X64)
AVERAGE1_IN_GGA(T44, s(0), T47) → U4_GGA(T44, T47, average1_in_gga(s(T44), 0, X64))
AVERAGE1_IN_GGA(T44, s(0), T47) → AVERAGE1_IN_GGA(s(T44), 0, X64)
AVERAGE1_IN_GGA(T44, s(s(0)), T47) → U5_GGA(T44, T47, average1_in_gga(s(T44), 0, X64))
AVERAGE1_IN_GGA(T44, s(s(0)), T47) → AVERAGE1_IN_GGA(s(T44), 0, X64)
AVERAGE1_IN_GGA(T44, s(s(s(T86))), T47) → U6_GGA(T44, T86, T47, average1_in_gga(s(T44), T86, X64))
AVERAGE1_IN_GGA(T44, s(s(s(T86))), T47) → AVERAGE1_IN_GGA(s(T44), T86, X64)

R is empty.
The argument filtering Pi contains the following mapping:
average1_in_gga(x1, x2, x3)  =  average1_in_gga(x1, x2)
0  =  0
s(x1)  =  s(x1)
AVERAGE1_IN_GGA(x1, x2, x3)  =  AVERAGE1_IN_GGA(x1, x2)
U1_GGA(x1, x2, x3)  =  U1_GGA(x1, x3)
U2_GGA(x1, x2, x3, x4)  =  U2_GGA(x1, x2, x4)
U3_GGA(x1, x2, x3)  =  U3_GGA(x1, x3)
U4_GGA(x1, x2, x3)  =  U4_GGA(x1, x3)
U5_GGA(x1, x2, x3)  =  U5_GGA(x1, x3)
U6_GGA(x1, x2, x3, x4)  =  U6_GGA(x1, x2, x4)

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

Infinitary Constructor Rewriting Termination of PiDP implies Termination of TRIPLES

(4) Obligation:

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

AVERAGE1_IN_GGA(0, T26, T28) → U1_GGA(T26, T28, average1_in_gga(0, s(T26), T28))
AVERAGE1_IN_GGA(0, T26, T28) → AVERAGE1_IN_GGA(0, s(T26), T28)
AVERAGE1_IN_GGA(s(T34), T26, T28) → U2_GGA(T34, T26, T28, average1_in_gga(T34, s(T26), T28))
AVERAGE1_IN_GGA(s(T34), T26, T28) → AVERAGE1_IN_GGA(T34, s(T26), T28)
AVERAGE1_IN_GGA(T44, 0, T47) → U3_GGA(T44, T47, average1_in_gga(s(T44), 0, X64))
AVERAGE1_IN_GGA(T44, 0, T47) → AVERAGE1_IN_GGA(s(T44), 0, X64)
AVERAGE1_IN_GGA(T44, s(0), T47) → U4_GGA(T44, T47, average1_in_gga(s(T44), 0, X64))
AVERAGE1_IN_GGA(T44, s(0), T47) → AVERAGE1_IN_GGA(s(T44), 0, X64)
AVERAGE1_IN_GGA(T44, s(s(0)), T47) → U5_GGA(T44, T47, average1_in_gga(s(T44), 0, X64))
AVERAGE1_IN_GGA(T44, s(s(0)), T47) → AVERAGE1_IN_GGA(s(T44), 0, X64)
AVERAGE1_IN_GGA(T44, s(s(s(T86))), T47) → U6_GGA(T44, T86, T47, average1_in_gga(s(T44), T86, X64))
AVERAGE1_IN_GGA(T44, s(s(s(T86))), T47) → AVERAGE1_IN_GGA(s(T44), T86, X64)

R is empty.
The argument filtering Pi contains the following mapping:
average1_in_gga(x1, x2, x3)  =  average1_in_gga(x1, x2)
0  =  0
s(x1)  =  s(x1)
AVERAGE1_IN_GGA(x1, x2, x3)  =  AVERAGE1_IN_GGA(x1, x2)
U1_GGA(x1, x2, x3)  =  U1_GGA(x1, x3)
U2_GGA(x1, x2, x3, x4)  =  U2_GGA(x1, x2, x4)
U3_GGA(x1, x2, x3)  =  U3_GGA(x1, x3)
U4_GGA(x1, x2, x3)  =  U4_GGA(x1, x3)
U5_GGA(x1, x2, x3)  =  U5_GGA(x1, x3)
U6_GGA(x1, x2, x3, x4)  =  U6_GGA(x1, x2, x4)

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

(5) DependencyGraphProof (EQUIVALENT transformation)

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

(6) Obligation:

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

AVERAGE1_IN_GGA(T44, s(0), T47) → AVERAGE1_IN_GGA(s(T44), 0, X64)
AVERAGE1_IN_GGA(s(T34), T26, T28) → AVERAGE1_IN_GGA(T34, s(T26), T28)
AVERAGE1_IN_GGA(0, T26, T28) → AVERAGE1_IN_GGA(0, s(T26), T28)
AVERAGE1_IN_GGA(T44, s(s(0)), T47) → AVERAGE1_IN_GGA(s(T44), 0, X64)
AVERAGE1_IN_GGA(T44, 0, T47) → AVERAGE1_IN_GGA(s(T44), 0, X64)
AVERAGE1_IN_GGA(T44, s(s(s(T86))), T47) → AVERAGE1_IN_GGA(s(T44), T86, X64)

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

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

(7) PiDPToQDPProof (SOUND transformation)

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

(8) Obligation:

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

AVERAGE1_IN_GGA(T44, s(0)) → AVERAGE1_IN_GGA(s(T44), 0)
AVERAGE1_IN_GGA(s(T34), T26) → AVERAGE1_IN_GGA(T34, s(T26))
AVERAGE1_IN_GGA(0, T26) → AVERAGE1_IN_GGA(0, s(T26))
AVERAGE1_IN_GGA(T44, s(s(0))) → AVERAGE1_IN_GGA(s(T44), 0)
AVERAGE1_IN_GGA(T44, 0) → AVERAGE1_IN_GGA(s(T44), 0)
AVERAGE1_IN_GGA(T44, s(s(s(T86)))) → AVERAGE1_IN_GGA(s(T44), T86)

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

(9) Instantiation (EQUIVALENT transformation)

By instantiating [LPAR04] the rule AVERAGE1_IN_GGA(0, T26) → AVERAGE1_IN_GGA(0, s(T26)) we obtained the following new rules [LPAR04]:

AVERAGE1_IN_GGA(0, s(z1)) → AVERAGE1_IN_GGA(0, s(s(z1)))

(10) Obligation:

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

AVERAGE1_IN_GGA(T44, s(0)) → AVERAGE1_IN_GGA(s(T44), 0)
AVERAGE1_IN_GGA(s(T34), T26) → AVERAGE1_IN_GGA(T34, s(T26))
AVERAGE1_IN_GGA(T44, s(s(0))) → AVERAGE1_IN_GGA(s(T44), 0)
AVERAGE1_IN_GGA(T44, 0) → AVERAGE1_IN_GGA(s(T44), 0)
AVERAGE1_IN_GGA(T44, s(s(s(T86)))) → AVERAGE1_IN_GGA(s(T44), T86)
AVERAGE1_IN_GGA(0, s(z1)) → AVERAGE1_IN_GGA(0, s(s(z1)))

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

(11) Instantiation (EQUIVALENT transformation)

By instantiating [LPAR04] the rule AVERAGE1_IN_GGA(T44, 0) → AVERAGE1_IN_GGA(s(T44), 0) we obtained the following new rules [LPAR04]:

AVERAGE1_IN_GGA(s(z0), 0) → AVERAGE1_IN_GGA(s(s(z0)), 0)

(12) Obligation:

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

AVERAGE1_IN_GGA(T44, s(0)) → AVERAGE1_IN_GGA(s(T44), 0)
AVERAGE1_IN_GGA(s(T34), T26) → AVERAGE1_IN_GGA(T34, s(T26))
AVERAGE1_IN_GGA(T44, s(s(0))) → AVERAGE1_IN_GGA(s(T44), 0)
AVERAGE1_IN_GGA(T44, s(s(s(T86)))) → AVERAGE1_IN_GGA(s(T44), T86)
AVERAGE1_IN_GGA(0, s(z1)) → AVERAGE1_IN_GGA(0, s(s(z1)))
AVERAGE1_IN_GGA(s(z0), 0) → AVERAGE1_IN_GGA(s(s(z0)), 0)

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

(13) ForwardInstantiation (EQUIVALENT transformation)

By forward instantiating [JAR06] the rule AVERAGE1_IN_GGA(s(T34), T26) → AVERAGE1_IN_GGA(T34, s(T26)) we obtained the following new rules [LPAR04]:

AVERAGE1_IN_GGA(s(x0), 0) → AVERAGE1_IN_GGA(x0, s(0))
AVERAGE1_IN_GGA(s(x0), s(0)) → AVERAGE1_IN_GGA(x0, s(s(0)))
AVERAGE1_IN_GGA(s(x0), s(s(y_1))) → AVERAGE1_IN_GGA(x0, s(s(s(y_1))))
AVERAGE1_IN_GGA(s(s(y_0)), x1) → AVERAGE1_IN_GGA(s(y_0), s(x1))
AVERAGE1_IN_GGA(s(0), x1) → AVERAGE1_IN_GGA(0, s(x1))

(14) Obligation:

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

AVERAGE1_IN_GGA(T44, s(0)) → AVERAGE1_IN_GGA(s(T44), 0)
AVERAGE1_IN_GGA(T44, s(s(0))) → AVERAGE1_IN_GGA(s(T44), 0)
AVERAGE1_IN_GGA(T44, s(s(s(T86)))) → AVERAGE1_IN_GGA(s(T44), T86)
AVERAGE1_IN_GGA(0, s(z1)) → AVERAGE1_IN_GGA(0, s(s(z1)))
AVERAGE1_IN_GGA(s(z0), 0) → AVERAGE1_IN_GGA(s(s(z0)), 0)
AVERAGE1_IN_GGA(s(x0), 0) → AVERAGE1_IN_GGA(x0, s(0))
AVERAGE1_IN_GGA(s(x0), s(0)) → AVERAGE1_IN_GGA(x0, s(s(0)))
AVERAGE1_IN_GGA(s(x0), s(s(y_1))) → AVERAGE1_IN_GGA(x0, s(s(s(y_1))))
AVERAGE1_IN_GGA(s(s(y_0)), x1) → AVERAGE1_IN_GGA(s(y_0), s(x1))
AVERAGE1_IN_GGA(s(0), x1) → AVERAGE1_IN_GGA(0, s(x1))

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

(15) ForwardInstantiation (EQUIVALENT transformation)

By forward instantiating [JAR06] the rule AVERAGE1_IN_GGA(T44, s(s(s(T86)))) → AVERAGE1_IN_GGA(s(T44), T86) we obtained the following new rules [LPAR04]:

AVERAGE1_IN_GGA(x0, s(s(s(s(0))))) → AVERAGE1_IN_GGA(s(x0), s(0))
AVERAGE1_IN_GGA(x0, s(s(s(s(s(0)))))) → AVERAGE1_IN_GGA(s(x0), s(s(0)))
AVERAGE1_IN_GGA(x0, s(s(s(s(s(s(y_1))))))) → AVERAGE1_IN_GGA(s(x0), s(s(s(y_1))))
AVERAGE1_IN_GGA(x0, s(s(s(0)))) → AVERAGE1_IN_GGA(s(x0), 0)
AVERAGE1_IN_GGA(x0, s(s(s(s(s(y_1)))))) → AVERAGE1_IN_GGA(s(x0), s(s(y_1)))
AVERAGE1_IN_GGA(s(y_0), s(s(s(x1)))) → AVERAGE1_IN_GGA(s(s(y_0)), x1)
AVERAGE1_IN_GGA(0, s(s(s(x1)))) → AVERAGE1_IN_GGA(s(0), x1)

(16) Obligation:

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

AVERAGE1_IN_GGA(T44, s(0)) → AVERAGE1_IN_GGA(s(T44), 0)
AVERAGE1_IN_GGA(T44, s(s(0))) → AVERAGE1_IN_GGA(s(T44), 0)
AVERAGE1_IN_GGA(0, s(z1)) → AVERAGE1_IN_GGA(0, s(s(z1)))
AVERAGE1_IN_GGA(s(z0), 0) → AVERAGE1_IN_GGA(s(s(z0)), 0)
AVERAGE1_IN_GGA(s(x0), 0) → AVERAGE1_IN_GGA(x0, s(0))
AVERAGE1_IN_GGA(s(x0), s(0)) → AVERAGE1_IN_GGA(x0, s(s(0)))
AVERAGE1_IN_GGA(s(x0), s(s(y_1))) → AVERAGE1_IN_GGA(x0, s(s(s(y_1))))
AVERAGE1_IN_GGA(s(s(y_0)), x1) → AVERAGE1_IN_GGA(s(y_0), s(x1))
AVERAGE1_IN_GGA(s(0), x1) → AVERAGE1_IN_GGA(0, s(x1))
AVERAGE1_IN_GGA(x0, s(s(s(s(0))))) → AVERAGE1_IN_GGA(s(x0), s(0))
AVERAGE1_IN_GGA(x0, s(s(s(s(s(0)))))) → AVERAGE1_IN_GGA(s(x0), s(s(0)))
AVERAGE1_IN_GGA(x0, s(s(s(s(s(s(y_1))))))) → AVERAGE1_IN_GGA(s(x0), s(s(s(y_1))))
AVERAGE1_IN_GGA(x0, s(s(s(0)))) → AVERAGE1_IN_GGA(s(x0), 0)
AVERAGE1_IN_GGA(x0, s(s(s(s(s(y_1)))))) → AVERAGE1_IN_GGA(s(x0), s(s(y_1)))
AVERAGE1_IN_GGA(s(y_0), s(s(s(x1)))) → AVERAGE1_IN_GGA(s(s(y_0)), x1)
AVERAGE1_IN_GGA(0, s(s(s(x1)))) → AVERAGE1_IN_GGA(s(0), x1)

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

(17) NonTerminationProof (EQUIVALENT transformation)

We used the non-termination processor [FROCOS05] to show that the DP problem is infinite.
Found a loop by semiunifying a rule from P directly.

s = AVERAGE1_IN_GGA(0, s(z1)) evaluates to t =AVERAGE1_IN_GGA(0, s(s(z1)))

Thus s starts an infinite chain as s semiunifies with t with the following substitutions:
  • Semiunifier: [ ]
  • Matcher: [z1 / s(z1)]




Rewriting sequence

The DP semiunifies directly so there is only one rewrite step from AVERAGE1_IN_GGA(0, s(z1)) to AVERAGE1_IN_GGA(0, s(s(z1))).



(18) NO