(0) Obligation:

Clauses:

delete(X, tree(X, void, Right), Right).
delete(X, tree(X, Left, void), Left).
delete(X, tree(X, Left, Right), tree(Y, Left, Right1)) :- delmin(Right, Y, Right1).
delete(X, tree(Y, Left, Right), tree(Y, Left1, Right)) :- ','(less(X, Y), delete(X, Left, Left1)).
delete(X, tree(Y, Left, Right), tree(Y, Left, Right1)) :- ','(less(Y, X), delete(X, Right, Right1)).
delmin(tree(Y, void, Right), Y, Right).
delmin(tree(X, Left, X1), Y, tree(X, Left1, X2)) :- delmin(Left, Y, Left1).
less(0, s(X3)).
less(s(X), s(Y)) :- less(X, Y).

Query: delete(g,g,a)

(1) PrologToTRSTransformerProof (SOUND transformation)

Transformed Prolog program to TRS.

(2) Obligation:

Q restricted rewrite system:
The TRS R consists of the following rules:

f2_in(T12, tree(T12, void, T13)) → f2_out1
f2_in(T22, tree(T22, T23, void)) → f2_out1
f2_in(T44, tree(T44, T45, T46)) → U1(f51_in(T46), T44, tree(T44, T45, T46))
U1(f51_out1(T49), T44, tree(T44, T45, T46)) → f2_out1
f2_in(T109, tree(T110, T111, T112)) → U2(f81_in(T109, T110, T111), T109, tree(T110, T111, T112))
U2(f81_out1, T109, tree(T110, T111, T112)) → f2_out1
f2_in(T146, tree(T147, T148, T149)) → U3(f105_in(T147, T146, T149), T146, tree(T147, T148, T149))
U3(f105_out1, T146, tree(T147, T148, T149)) → f2_out1
f51_in(tree(T63, void, T64)) → f51_out1(T63)
f51_in(tree(T77, T78, T79)) → U4(f51_in(T78), tree(T77, T78, T79))
U4(f51_out1(T83), tree(T77, T78, T79)) → f51_out1(T83)
f85_in(0, s(T123)) → f85_out1
f85_in(s(T128), s(T129)) → U5(f85_in(T128, T129), s(T128), s(T129))
U5(f85_out1, s(T128), s(T129)) → f85_out1
f81_in(T109, T110, T111) → U6(f85_in(T109, T110), T109, T110, T111)
U6(f85_out1, T109, T110, T111) → U7(f2_in(T109, T111), T109, T110, T111)
U7(f2_out1, T109, T110, T111) → f81_out1
f105_in(T147, T146, T149) → U8(f85_in(T147, T146), T147, T146, T149)
U8(f85_out1, T147, T146, T149) → U9(f2_in(T146, T149), T147, T146, T149)
U9(f2_out1, T147, T146, T149) → f105_out1

Q is empty.

(3) DependencyPairsProof (EQUIVALENT transformation)

Using Dependency Pairs [AG00,LPAR04] we result in the following initial DP problem.

(4) Obligation:

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

F2_IN(T44, tree(T44, T45, T46)) → U11(f51_in(T46), T44, tree(T44, T45, T46))
F2_IN(T44, tree(T44, T45, T46)) → F51_IN(T46)
F2_IN(T109, tree(T110, T111, T112)) → U21(f81_in(T109, T110, T111), T109, tree(T110, T111, T112))
F2_IN(T109, tree(T110, T111, T112)) → F81_IN(T109, T110, T111)
F2_IN(T146, tree(T147, T148, T149)) → U31(f105_in(T147, T146, T149), T146, tree(T147, T148, T149))
F2_IN(T146, tree(T147, T148, T149)) → F105_IN(T147, T146, T149)
F51_IN(tree(T77, T78, T79)) → U41(f51_in(T78), tree(T77, T78, T79))
F51_IN(tree(T77, T78, T79)) → F51_IN(T78)
F85_IN(s(T128), s(T129)) → U51(f85_in(T128, T129), s(T128), s(T129))
F85_IN(s(T128), s(T129)) → F85_IN(T128, T129)
F81_IN(T109, T110, T111) → U61(f85_in(T109, T110), T109, T110, T111)
F81_IN(T109, T110, T111) → F85_IN(T109, T110)
U61(f85_out1, T109, T110, T111) → U71(f2_in(T109, T111), T109, T110, T111)
U61(f85_out1, T109, T110, T111) → F2_IN(T109, T111)
F105_IN(T147, T146, T149) → U81(f85_in(T147, T146), T147, T146, T149)
F105_IN(T147, T146, T149) → F85_IN(T147, T146)
U81(f85_out1, T147, T146, T149) → U91(f2_in(T146, T149), T147, T146, T149)
U81(f85_out1, T147, T146, T149) → F2_IN(T146, T149)

The TRS R consists of the following rules:

f2_in(T12, tree(T12, void, T13)) → f2_out1
f2_in(T22, tree(T22, T23, void)) → f2_out1
f2_in(T44, tree(T44, T45, T46)) → U1(f51_in(T46), T44, tree(T44, T45, T46))
U1(f51_out1(T49), T44, tree(T44, T45, T46)) → f2_out1
f2_in(T109, tree(T110, T111, T112)) → U2(f81_in(T109, T110, T111), T109, tree(T110, T111, T112))
U2(f81_out1, T109, tree(T110, T111, T112)) → f2_out1
f2_in(T146, tree(T147, T148, T149)) → U3(f105_in(T147, T146, T149), T146, tree(T147, T148, T149))
U3(f105_out1, T146, tree(T147, T148, T149)) → f2_out1
f51_in(tree(T63, void, T64)) → f51_out1(T63)
f51_in(tree(T77, T78, T79)) → U4(f51_in(T78), tree(T77, T78, T79))
U4(f51_out1(T83), tree(T77, T78, T79)) → f51_out1(T83)
f85_in(0, s(T123)) → f85_out1
f85_in(s(T128), s(T129)) → U5(f85_in(T128, T129), s(T128), s(T129))
U5(f85_out1, s(T128), s(T129)) → f85_out1
f81_in(T109, T110, T111) → U6(f85_in(T109, T110), T109, T110, T111)
U6(f85_out1, T109, T110, T111) → U7(f2_in(T109, T111), T109, T110, T111)
U7(f2_out1, T109, T110, T111) → f81_out1
f105_in(T147, T146, T149) → U8(f85_in(T147, T146), T147, T146, T149)
U8(f85_out1, T147, T146, T149) → U9(f2_in(T146, T149), T147, T146, T149)
U9(f2_out1, T147, T146, T149) → f105_out1

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

(5) DependencyGraphProof (EQUIVALENT transformation)

The approximation of the Dependency Graph [LPAR04,FROCOS05,EDGSTAR] contains 3 SCCs with 10 less nodes.

(6) Complex Obligation (AND)

(7) Obligation:

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

F85_IN(s(T128), s(T129)) → F85_IN(T128, T129)

The TRS R consists of the following rules:

f2_in(T12, tree(T12, void, T13)) → f2_out1
f2_in(T22, tree(T22, T23, void)) → f2_out1
f2_in(T44, tree(T44, T45, T46)) → U1(f51_in(T46), T44, tree(T44, T45, T46))
U1(f51_out1(T49), T44, tree(T44, T45, T46)) → f2_out1
f2_in(T109, tree(T110, T111, T112)) → U2(f81_in(T109, T110, T111), T109, tree(T110, T111, T112))
U2(f81_out1, T109, tree(T110, T111, T112)) → f2_out1
f2_in(T146, tree(T147, T148, T149)) → U3(f105_in(T147, T146, T149), T146, tree(T147, T148, T149))
U3(f105_out1, T146, tree(T147, T148, T149)) → f2_out1
f51_in(tree(T63, void, T64)) → f51_out1(T63)
f51_in(tree(T77, T78, T79)) → U4(f51_in(T78), tree(T77, T78, T79))
U4(f51_out1(T83), tree(T77, T78, T79)) → f51_out1(T83)
f85_in(0, s(T123)) → f85_out1
f85_in(s(T128), s(T129)) → U5(f85_in(T128, T129), s(T128), s(T129))
U5(f85_out1, s(T128), s(T129)) → f85_out1
f81_in(T109, T110, T111) → U6(f85_in(T109, T110), T109, T110, T111)
U6(f85_out1, T109, T110, T111) → U7(f2_in(T109, T111), T109, T110, T111)
U7(f2_out1, T109, T110, T111) → f81_out1
f105_in(T147, T146, T149) → U8(f85_in(T147, T146), T147, T146, T149)
U8(f85_out1, T147, T146, T149) → U9(f2_in(T146, T149), T147, T146, T149)
U9(f2_out1, T147, T146, T149) → f105_out1

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

(8) UsableRulesProof (EQUIVALENT transformation)

We can use the usable rules and reduction pair processor [LPAR04] with the Ce-compatible extension of the polynomial order that maps every function symbol to the sum of its arguments. Then, we can delete all non-usable rules [FROCOS05] from R.

(9) Obligation:

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

F85_IN(s(T128), s(T129)) → F85_IN(T128, T129)

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

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

  • F85_IN(s(T128), s(T129)) → F85_IN(T128, T129)
    The graph contains the following edges 1 > 1, 2 > 2

(11) YES

(12) Obligation:

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

F51_IN(tree(T77, T78, T79)) → F51_IN(T78)

The TRS R consists of the following rules:

f2_in(T12, tree(T12, void, T13)) → f2_out1
f2_in(T22, tree(T22, T23, void)) → f2_out1
f2_in(T44, tree(T44, T45, T46)) → U1(f51_in(T46), T44, tree(T44, T45, T46))
U1(f51_out1(T49), T44, tree(T44, T45, T46)) → f2_out1
f2_in(T109, tree(T110, T111, T112)) → U2(f81_in(T109, T110, T111), T109, tree(T110, T111, T112))
U2(f81_out1, T109, tree(T110, T111, T112)) → f2_out1
f2_in(T146, tree(T147, T148, T149)) → U3(f105_in(T147, T146, T149), T146, tree(T147, T148, T149))
U3(f105_out1, T146, tree(T147, T148, T149)) → f2_out1
f51_in(tree(T63, void, T64)) → f51_out1(T63)
f51_in(tree(T77, T78, T79)) → U4(f51_in(T78), tree(T77, T78, T79))
U4(f51_out1(T83), tree(T77, T78, T79)) → f51_out1(T83)
f85_in(0, s(T123)) → f85_out1
f85_in(s(T128), s(T129)) → U5(f85_in(T128, T129), s(T128), s(T129))
U5(f85_out1, s(T128), s(T129)) → f85_out1
f81_in(T109, T110, T111) → U6(f85_in(T109, T110), T109, T110, T111)
U6(f85_out1, T109, T110, T111) → U7(f2_in(T109, T111), T109, T110, T111)
U7(f2_out1, T109, T110, T111) → f81_out1
f105_in(T147, T146, T149) → U8(f85_in(T147, T146), T147, T146, T149)
U8(f85_out1, T147, T146, T149) → U9(f2_in(T146, T149), T147, T146, T149)
U9(f2_out1, T147, T146, T149) → f105_out1

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

(13) UsableRulesProof (EQUIVALENT transformation)

We can use the usable rules and reduction pair processor [LPAR04] with the Ce-compatible extension of the polynomial order that maps every function symbol to the sum of its arguments. Then, we can delete all non-usable rules [FROCOS05] from R.

(14) Obligation:

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

F51_IN(tree(T77, T78, T79)) → F51_IN(T78)

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

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

  • F51_IN(tree(T77, T78, T79)) → F51_IN(T78)
    The graph contains the following edges 1 > 1

(16) YES

(17) Obligation:

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

F2_IN(T109, tree(T110, T111, T112)) → F81_IN(T109, T110, T111)
F81_IN(T109, T110, T111) → U61(f85_in(T109, T110), T109, T110, T111)
U61(f85_out1, T109, T110, T111) → F2_IN(T109, T111)
F2_IN(T146, tree(T147, T148, T149)) → F105_IN(T147, T146, T149)
F105_IN(T147, T146, T149) → U81(f85_in(T147, T146), T147, T146, T149)
U81(f85_out1, T147, T146, T149) → F2_IN(T146, T149)

The TRS R consists of the following rules:

f2_in(T12, tree(T12, void, T13)) → f2_out1
f2_in(T22, tree(T22, T23, void)) → f2_out1
f2_in(T44, tree(T44, T45, T46)) → U1(f51_in(T46), T44, tree(T44, T45, T46))
U1(f51_out1(T49), T44, tree(T44, T45, T46)) → f2_out1
f2_in(T109, tree(T110, T111, T112)) → U2(f81_in(T109, T110, T111), T109, tree(T110, T111, T112))
U2(f81_out1, T109, tree(T110, T111, T112)) → f2_out1
f2_in(T146, tree(T147, T148, T149)) → U3(f105_in(T147, T146, T149), T146, tree(T147, T148, T149))
U3(f105_out1, T146, tree(T147, T148, T149)) → f2_out1
f51_in(tree(T63, void, T64)) → f51_out1(T63)
f51_in(tree(T77, T78, T79)) → U4(f51_in(T78), tree(T77, T78, T79))
U4(f51_out1(T83), tree(T77, T78, T79)) → f51_out1(T83)
f85_in(0, s(T123)) → f85_out1
f85_in(s(T128), s(T129)) → U5(f85_in(T128, T129), s(T128), s(T129))
U5(f85_out1, s(T128), s(T129)) → f85_out1
f81_in(T109, T110, T111) → U6(f85_in(T109, T110), T109, T110, T111)
U6(f85_out1, T109, T110, T111) → U7(f2_in(T109, T111), T109, T110, T111)
U7(f2_out1, T109, T110, T111) → f81_out1
f105_in(T147, T146, T149) → U8(f85_in(T147, T146), T147, T146, T149)
U8(f85_out1, T147, T146, T149) → U9(f2_in(T146, T149), T147, T146, T149)
U9(f2_out1, T147, T146, T149) → f105_out1

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

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

  • F81_IN(T109, T110, T111) → U61(f85_in(T109, T110), T109, T110, T111)
    The graph contains the following edges 1 >= 2, 2 >= 3, 3 >= 4

  • U61(f85_out1, T109, T110, T111) → F2_IN(T109, T111)
    The graph contains the following edges 2 >= 1, 4 >= 2

  • U81(f85_out1, T147, T146, T149) → F2_IN(T146, T149)
    The graph contains the following edges 3 >= 1, 4 >= 2

  • F2_IN(T109, tree(T110, T111, T112)) → F81_IN(T109, T110, T111)
    The graph contains the following edges 1 >= 1, 2 > 2, 2 > 3

  • F2_IN(T146, tree(T147, T148, T149)) → F105_IN(T147, T146, T149)
    The graph contains the following edges 2 > 1, 1 >= 2, 2 > 3

  • F105_IN(T147, T146, T149) → U81(f85_in(T147, T146), T147, T146, T149)
    The graph contains the following edges 1 >= 2, 2 >= 3, 3 >= 4

(19) YES