(0) Obligation:

Clauses:

div(X1, 0, X2, X3) :- failure(a).
div(0, Y, 0, 0) :- no(zero(Y)).
div(X, Y, s(Z), R) :- ','(no(zero(X)), ','(no(zero(Y)), ','(minus(X, Y, U), ','(!, div(U, Y, Z, R))))).
div(X, Y, X4, X) :- ','(no(zero(X)), no(zero(Y))).
minus(X, 0, X).
minus(s(X), s(Y), Z) :- minus(X, Y, Z).
failure(b).
zero(0).
no(X) :- ','(X, ','(!, failure(a))).
no(X5).

Queries:

div(g,g,a,a).

(1) PrologToDTProblemTransformerProof (SOUND transformation)

Built DT problem from termination graph.

(2) Obligation:

Triples:

minus160(s(T155), s(T156), X278) :- minus160(T155, T156, X278).
div1(s(T142), s(T143), s(T104), T105) :- minus160(T142, T143, X255).
div1(T119, T129, s(T104), T105) :- ','(minusc156(T119, T129, T134), div1(T134, T129, T104, T105)).

Clauses:

minusc160(T150, 0, T150).
minusc160(s(T155), s(T156), X278) :- minusc160(T155, T156, X278).
divc1(0, T72, 0, 0).
divc1(T119, T129, s(T104), T105) :- ','(minusc156(T119, T129, T134), divc1(T134, T129, T104, T105)).
divc1(T176, T182, T170, T176).
divc1(T194, T200, T188, T194).
minusc156(s(T142), s(T143), X255) :- minusc160(T142, T143, X255).

Afs:

div1(x1, x2, x3, x4)  =  div1(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:
div1_in: (b,b,f,f)
minus160_in: (b,b,f)
minusc156_in: (b,b,f)
minusc160_in: (b,b,f)
Transforming TRIPLES into the following Term Rewriting System:
Pi DP problem:
The TRS P consists of the following rules:

DIV1_IN_GGAA(s(T142), s(T143), s(T104), T105) → U2_GGAA(T142, T143, T104, T105, minus160_in_gga(T142, T143, X255))
DIV1_IN_GGAA(s(T142), s(T143), s(T104), T105) → MINUS160_IN_GGA(T142, T143, X255)
MINUS160_IN_GGA(s(T155), s(T156), X278) → U1_GGA(T155, T156, X278, minus160_in_gga(T155, T156, X278))
MINUS160_IN_GGA(s(T155), s(T156), X278) → MINUS160_IN_GGA(T155, T156, X278)
DIV1_IN_GGAA(T119, T129, s(T104), T105) → U3_GGAA(T119, T129, T104, T105, minusc156_in_gga(T119, T129, T134))
U3_GGAA(T119, T129, T104, T105, minusc156_out_gga(T119, T129, T134)) → U4_GGAA(T119, T129, T104, T105, div1_in_ggaa(T134, T129, T104, T105))
U3_GGAA(T119, T129, T104, T105, minusc156_out_gga(T119, T129, T134)) → DIV1_IN_GGAA(T134, T129, T104, T105)

The TRS R consists of the following rules:

minusc156_in_gga(s(T142), s(T143), X255) → U9_gga(T142, T143, X255, minusc160_in_gga(T142, T143, X255))
minusc160_in_gga(T150, 0, T150) → minusc160_out_gga(T150, 0, T150)
minusc160_in_gga(s(T155), s(T156), X278) → U6_gga(T155, T156, X278, minusc160_in_gga(T155, T156, X278))
U6_gga(T155, T156, X278, minusc160_out_gga(T155, T156, X278)) → minusc160_out_gga(s(T155), s(T156), X278)
U9_gga(T142, T143, X255, minusc160_out_gga(T142, T143, X255)) → minusc156_out_gga(s(T142), s(T143), X255)

The argument filtering Pi contains the following mapping:
div1_in_ggaa(x1, x2, x3, x4)  =  div1_in_ggaa(x1, x2)
s(x1)  =  s(x1)
minus160_in_gga(x1, x2, x3)  =  minus160_in_gga(x1, x2)
minusc156_in_gga(x1, x2, x3)  =  minusc156_in_gga(x1, x2)
U9_gga(x1, x2, x3, x4)  =  U9_gga(x1, x2, x4)
minusc160_in_gga(x1, x2, x3)  =  minusc160_in_gga(x1, x2)
0  =  0
minusc160_out_gga(x1, x2, x3)  =  minusc160_out_gga(x1, x2, x3)
U6_gga(x1, x2, x3, x4)  =  U6_gga(x1, x2, x4)
minusc156_out_gga(x1, x2, x3)  =  minusc156_out_gga(x1, x2, x3)
DIV1_IN_GGAA(x1, x2, x3, x4)  =  DIV1_IN_GGAA(x1, x2)
U2_GGAA(x1, x2, x3, x4, x5)  =  U2_GGAA(x1, x2, x5)
MINUS160_IN_GGA(x1, x2, x3)  =  MINUS160_IN_GGA(x1, x2)
U1_GGA(x1, x2, x3, x4)  =  U1_GGA(x1, x2, x4)
U3_GGAA(x1, x2, x3, x4, x5)  =  U3_GGAA(x1, x2, x5)
U4_GGAA(x1, x2, x3, x4, x5)  =  U4_GGAA(x1, x2, x5)

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:

DIV1_IN_GGAA(s(T142), s(T143), s(T104), T105) → U2_GGAA(T142, T143, T104, T105, minus160_in_gga(T142, T143, X255))
DIV1_IN_GGAA(s(T142), s(T143), s(T104), T105) → MINUS160_IN_GGA(T142, T143, X255)
MINUS160_IN_GGA(s(T155), s(T156), X278) → U1_GGA(T155, T156, X278, minus160_in_gga(T155, T156, X278))
MINUS160_IN_GGA(s(T155), s(T156), X278) → MINUS160_IN_GGA(T155, T156, X278)
DIV1_IN_GGAA(T119, T129, s(T104), T105) → U3_GGAA(T119, T129, T104, T105, minusc156_in_gga(T119, T129, T134))
U3_GGAA(T119, T129, T104, T105, minusc156_out_gga(T119, T129, T134)) → U4_GGAA(T119, T129, T104, T105, div1_in_ggaa(T134, T129, T104, T105))
U3_GGAA(T119, T129, T104, T105, minusc156_out_gga(T119, T129, T134)) → DIV1_IN_GGAA(T134, T129, T104, T105)

The TRS R consists of the following rules:

minusc156_in_gga(s(T142), s(T143), X255) → U9_gga(T142, T143, X255, minusc160_in_gga(T142, T143, X255))
minusc160_in_gga(T150, 0, T150) → minusc160_out_gga(T150, 0, T150)
minusc160_in_gga(s(T155), s(T156), X278) → U6_gga(T155, T156, X278, minusc160_in_gga(T155, T156, X278))
U6_gga(T155, T156, X278, minusc160_out_gga(T155, T156, X278)) → minusc160_out_gga(s(T155), s(T156), X278)
U9_gga(T142, T143, X255, minusc160_out_gga(T142, T143, X255)) → minusc156_out_gga(s(T142), s(T143), X255)

The argument filtering Pi contains the following mapping:
div1_in_ggaa(x1, x2, x3, x4)  =  div1_in_ggaa(x1, x2)
s(x1)  =  s(x1)
minus160_in_gga(x1, x2, x3)  =  minus160_in_gga(x1, x2)
minusc156_in_gga(x1, x2, x3)  =  minusc156_in_gga(x1, x2)
U9_gga(x1, x2, x3, x4)  =  U9_gga(x1, x2, x4)
minusc160_in_gga(x1, x2, x3)  =  minusc160_in_gga(x1, x2)
0  =  0
minusc160_out_gga(x1, x2, x3)  =  minusc160_out_gga(x1, x2, x3)
U6_gga(x1, x2, x3, x4)  =  U6_gga(x1, x2, x4)
minusc156_out_gga(x1, x2, x3)  =  minusc156_out_gga(x1, x2, x3)
DIV1_IN_GGAA(x1, x2, x3, x4)  =  DIV1_IN_GGAA(x1, x2)
U2_GGAA(x1, x2, x3, x4, x5)  =  U2_GGAA(x1, x2, x5)
MINUS160_IN_GGA(x1, x2, x3)  =  MINUS160_IN_GGA(x1, x2)
U1_GGA(x1, x2, x3, x4)  =  U1_GGA(x1, x2, x4)
U3_GGAA(x1, x2, x3, x4, x5)  =  U3_GGAA(x1, x2, x5)
U4_GGAA(x1, x2, x3, x4, x5)  =  U4_GGAA(x1, x2, x5)

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

(5) DependencyGraphProof (EQUIVALENT transformation)

The approximation of the Dependency Graph [LOPSTR] contains 2 SCCs with 4 less nodes.

(6) Complex Obligation (AND)

(7) Obligation:

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

MINUS160_IN_GGA(s(T155), s(T156), X278) → MINUS160_IN_GGA(T155, T156, X278)

The TRS R consists of the following rules:

minusc156_in_gga(s(T142), s(T143), X255) → U9_gga(T142, T143, X255, minusc160_in_gga(T142, T143, X255))
minusc160_in_gga(T150, 0, T150) → minusc160_out_gga(T150, 0, T150)
minusc160_in_gga(s(T155), s(T156), X278) → U6_gga(T155, T156, X278, minusc160_in_gga(T155, T156, X278))
U6_gga(T155, T156, X278, minusc160_out_gga(T155, T156, X278)) → minusc160_out_gga(s(T155), s(T156), X278)
U9_gga(T142, T143, X255, minusc160_out_gga(T142, T143, X255)) → minusc156_out_gga(s(T142), s(T143), X255)

The argument filtering Pi contains the following mapping:
s(x1)  =  s(x1)
minusc156_in_gga(x1, x2, x3)  =  minusc156_in_gga(x1, x2)
U9_gga(x1, x2, x3, x4)  =  U9_gga(x1, x2, x4)
minusc160_in_gga(x1, x2, x3)  =  minusc160_in_gga(x1, x2)
0  =  0
minusc160_out_gga(x1, x2, x3)  =  minusc160_out_gga(x1, x2, x3)
U6_gga(x1, x2, x3, x4)  =  U6_gga(x1, x2, x4)
minusc156_out_gga(x1, x2, x3)  =  minusc156_out_gga(x1, x2, x3)
MINUS160_IN_GGA(x1, x2, x3)  =  MINUS160_IN_GGA(x1, x2)

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

(8) UsableRulesProof (EQUIVALENT transformation)

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

(9) Obligation:

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

MINUS160_IN_GGA(s(T155), s(T156), X278) → MINUS160_IN_GGA(T155, T156, X278)

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

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

(10) PiDPToQDPProof (SOUND transformation)

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

(11) Obligation:

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

MINUS160_IN_GGA(s(T155), s(T156)) → MINUS160_IN_GGA(T155, T156)

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

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

  • MINUS160_IN_GGA(s(T155), s(T156)) → MINUS160_IN_GGA(T155, T156)
    The graph contains the following edges 1 > 1, 2 > 2

(13) YES

(14) Obligation:

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

DIV1_IN_GGAA(T119, T129, s(T104), T105) → U3_GGAA(T119, T129, T104, T105, minusc156_in_gga(T119, T129, T134))
U3_GGAA(T119, T129, T104, T105, minusc156_out_gga(T119, T129, T134)) → DIV1_IN_GGAA(T134, T129, T104, T105)

The TRS R consists of the following rules:

minusc156_in_gga(s(T142), s(T143), X255) → U9_gga(T142, T143, X255, minusc160_in_gga(T142, T143, X255))
minusc160_in_gga(T150, 0, T150) → minusc160_out_gga(T150, 0, T150)
minusc160_in_gga(s(T155), s(T156), X278) → U6_gga(T155, T156, X278, minusc160_in_gga(T155, T156, X278))
U6_gga(T155, T156, X278, minusc160_out_gga(T155, T156, X278)) → minusc160_out_gga(s(T155), s(T156), X278)
U9_gga(T142, T143, X255, minusc160_out_gga(T142, T143, X255)) → minusc156_out_gga(s(T142), s(T143), X255)

The argument filtering Pi contains the following mapping:
s(x1)  =  s(x1)
minusc156_in_gga(x1, x2, x3)  =  minusc156_in_gga(x1, x2)
U9_gga(x1, x2, x3, x4)  =  U9_gga(x1, x2, x4)
minusc160_in_gga(x1, x2, x3)  =  minusc160_in_gga(x1, x2)
0  =  0
minusc160_out_gga(x1, x2, x3)  =  minusc160_out_gga(x1, x2, x3)
U6_gga(x1, x2, x3, x4)  =  U6_gga(x1, x2, x4)
minusc156_out_gga(x1, x2, x3)  =  minusc156_out_gga(x1, x2, x3)
DIV1_IN_GGAA(x1, x2, x3, x4)  =  DIV1_IN_GGAA(x1, x2)
U3_GGAA(x1, x2, x3, x4, x5)  =  U3_GGAA(x1, x2, x5)

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

(15) PiDPToQDPProof (SOUND transformation)

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

(16) Obligation:

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

DIV1_IN_GGAA(T119, T129) → U3_GGAA(T119, T129, minusc156_in_gga(T119, T129))
U3_GGAA(T119, T129, minusc156_out_gga(T119, T129, T134)) → DIV1_IN_GGAA(T134, T129)

The TRS R consists of the following rules:

minusc156_in_gga(s(T142), s(T143)) → U9_gga(T142, T143, minusc160_in_gga(T142, T143))
minusc160_in_gga(T150, 0) → minusc160_out_gga(T150, 0, T150)
minusc160_in_gga(s(T155), s(T156)) → U6_gga(T155, T156, minusc160_in_gga(T155, T156))
U6_gga(T155, T156, minusc160_out_gga(T155, T156, X278)) → minusc160_out_gga(s(T155), s(T156), X278)
U9_gga(T142, T143, minusc160_out_gga(T142, T143, X255)) → minusc156_out_gga(s(T142), s(T143), X255)

The set Q consists of the following terms:

minusc156_in_gga(x0, x1)
minusc160_in_gga(x0, x1)
U6_gga(x0, x1, x2)
U9_gga(x0, x1, x2)

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

(17) QDPOrderProof (EQUIVALENT transformation)

We use the reduction pair processor [LPAR04].


The following pairs can be oriented strictly and are deleted.


U3_GGAA(T119, T129, minusc156_out_gga(T119, T129, T134)) → DIV1_IN_GGAA(T134, T129)
The remaining pairs can at least be oriented weakly.
Used ordering: Polynomial Order [NEGPOLO,POLO] with Interpretation:

POL( U3_GGAA(x1, ..., x3) ) = x3


POL( minusc156_in_gga(x1, x2) ) = max{0, 2x1 - 1}


POL( s(x1) ) = x1 + 1


POL( U9_gga(x1, ..., x3) ) = x3 + 1


POL( minusc160_in_gga(x1, x2) ) = 2x1


POL( 0 ) = 0


POL( minusc160_out_gga(x1, ..., x3) ) = 2x3


POL( U6_gga(x1, ..., x3) ) = x3


POL( minusc156_out_gga(x1, ..., x3) ) = 2x3 + 1


POL( DIV1_IN_GGAA(x1, x2) ) = 2x1



The following usable rules [FROCOS05] were oriented:

minusc156_in_gga(s(T142), s(T143)) → U9_gga(T142, T143, minusc160_in_gga(T142, T143))
minusc160_in_gga(T150, 0) → minusc160_out_gga(T150, 0, T150)
minusc160_in_gga(s(T155), s(T156)) → U6_gga(T155, T156, minusc160_in_gga(T155, T156))
U9_gga(T142, T143, minusc160_out_gga(T142, T143, X255)) → minusc156_out_gga(s(T142), s(T143), X255)
U6_gga(T155, T156, minusc160_out_gga(T155, T156, X278)) → minusc160_out_gga(s(T155), s(T156), X278)

(18) Obligation:

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

DIV1_IN_GGAA(T119, T129) → U3_GGAA(T119, T129, minusc156_in_gga(T119, T129))

The TRS R consists of the following rules:

minusc156_in_gga(s(T142), s(T143)) → U9_gga(T142, T143, minusc160_in_gga(T142, T143))
minusc160_in_gga(T150, 0) → minusc160_out_gga(T150, 0, T150)
minusc160_in_gga(s(T155), s(T156)) → U6_gga(T155, T156, minusc160_in_gga(T155, T156))
U6_gga(T155, T156, minusc160_out_gga(T155, T156, X278)) → minusc160_out_gga(s(T155), s(T156), X278)
U9_gga(T142, T143, minusc160_out_gga(T142, T143, X255)) → minusc156_out_gga(s(T142), s(T143), X255)

The set Q consists of the following terms:

minusc156_in_gga(x0, x1)
minusc160_in_gga(x0, x1)
U6_gga(x0, x1, x2)
U9_gga(x0, x1, x2)

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

(19) DependencyGraphProof (EQUIVALENT transformation)

The approximation of the Dependency Graph [LPAR04,FROCOS05,EDGSTAR] contains 0 SCCs with 1 less node.

(20) TRUE