(0) Obligation:

Clauses:

log2(X, Y) :- log2(X, 0, s(0), Y).
log2(s(s(X)), Half, Acc, Y) :- log2(X, s(Half), Acc, Y).
log2(X, s(s(Half)), Acc, Y) :- ','(small(X), log2(Half, s(0), s(Acc), Y)).
log2(X, Half, Y, Y) :- ','(small(X), small(Half)).
small(0).
small(s(0)).

Queries:

log2(g,a).

(1) PrologToPiTRSProof (SOUND transformation)

We use the technique of [LOPSTR]. With regard to the inferred argument filtering the predicates were used in the following modes:
log2_in: (b,f)
log2_in: (b,b,b,f)
Transforming Prolog into the following Term Rewriting System:
Pi-finite rewrite system:
The TRS R consists of the following rules:

log2_in_ga(X, Y) → U1_ga(X, Y, log2_in_ggga(X, 0, s(0), Y))
log2_in_ggga(s(s(X)), Half, Acc, Y) → U2_ggga(X, Half, Acc, Y, log2_in_ggga(X, s(Half), Acc, Y))
log2_in_ggga(X, s(s(Half)), Acc, Y) → U3_ggga(X, Half, Acc, Y, small_in_g(X))
small_in_g(0) → small_out_g(0)
small_in_g(s(0)) → small_out_g(s(0))
U3_ggga(X, Half, Acc, Y, small_out_g(X)) → U4_ggga(X, Half, Acc, Y, log2_in_ggga(Half, s(0), s(Acc), Y))
log2_in_ggga(X, Half, Y, Y) → U5_ggga(X, Half, Y, small_in_g(X))
U5_ggga(X, Half, Y, small_out_g(X)) → U6_ggga(X, Half, Y, small_in_g(Half))
U6_ggga(X, Half, Y, small_out_g(Half)) → log2_out_ggga(X, Half, Y, Y)
U4_ggga(X, Half, Acc, Y, log2_out_ggga(Half, s(0), s(Acc), Y)) → log2_out_ggga(X, s(s(Half)), Acc, Y)
U2_ggga(X, Half, Acc, Y, log2_out_ggga(X, s(Half), Acc, Y)) → log2_out_ggga(s(s(X)), Half, Acc, Y)
U1_ga(X, Y, log2_out_ggga(X, 0, s(0), Y)) → log2_out_ga(X, Y)

The argument filtering Pi contains the following mapping:
log2_in_ga(x1, x2)  =  log2_in_ga(x1)
U1_ga(x1, x2, x3)  =  U1_ga(x3)
log2_in_ggga(x1, x2, x3, x4)  =  log2_in_ggga(x1, x2, x3)
s(x1)  =  s(x1)
U2_ggga(x1, x2, x3, x4, x5)  =  U2_ggga(x5)
U3_ggga(x1, x2, x3, x4, x5)  =  U3_ggga(x2, x3, x5)
small_in_g(x1)  =  small_in_g(x1)
0  =  0
small_out_g(x1)  =  small_out_g
U4_ggga(x1, x2, x3, x4, x5)  =  U4_ggga(x5)
U5_ggga(x1, x2, x3, x4)  =  U5_ggga(x2, x3, x4)
U6_ggga(x1, x2, x3, x4)  =  U6_ggga(x3, x4)
log2_out_ggga(x1, x2, x3, x4)  =  log2_out_ggga(x4)
log2_out_ga(x1, x2)  =  log2_out_ga(x2)

Infinitary Constructor Rewriting Termination of PiTRS implies Termination of Prolog

(2) Obligation:

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

log2_in_ga(X, Y) → U1_ga(X, Y, log2_in_ggga(X, 0, s(0), Y))
log2_in_ggga(s(s(X)), Half, Acc, Y) → U2_ggga(X, Half, Acc, Y, log2_in_ggga(X, s(Half), Acc, Y))
log2_in_ggga(X, s(s(Half)), Acc, Y) → U3_ggga(X, Half, Acc, Y, small_in_g(X))
small_in_g(0) → small_out_g(0)
small_in_g(s(0)) → small_out_g(s(0))
U3_ggga(X, Half, Acc, Y, small_out_g(X)) → U4_ggga(X, Half, Acc, Y, log2_in_ggga(Half, s(0), s(Acc), Y))
log2_in_ggga(X, Half, Y, Y) → U5_ggga(X, Half, Y, small_in_g(X))
U5_ggga(X, Half, Y, small_out_g(X)) → U6_ggga(X, Half, Y, small_in_g(Half))
U6_ggga(X, Half, Y, small_out_g(Half)) → log2_out_ggga(X, Half, Y, Y)
U4_ggga(X, Half, Acc, Y, log2_out_ggga(Half, s(0), s(Acc), Y)) → log2_out_ggga(X, s(s(Half)), Acc, Y)
U2_ggga(X, Half, Acc, Y, log2_out_ggga(X, s(Half), Acc, Y)) → log2_out_ggga(s(s(X)), Half, Acc, Y)
U1_ga(X, Y, log2_out_ggga(X, 0, s(0), Y)) → log2_out_ga(X, Y)

The argument filtering Pi contains the following mapping:
log2_in_ga(x1, x2)  =  log2_in_ga(x1)
U1_ga(x1, x2, x3)  =  U1_ga(x3)
log2_in_ggga(x1, x2, x3, x4)  =  log2_in_ggga(x1, x2, x3)
s(x1)  =  s(x1)
U2_ggga(x1, x2, x3, x4, x5)  =  U2_ggga(x5)
U3_ggga(x1, x2, x3, x4, x5)  =  U3_ggga(x2, x3, x5)
small_in_g(x1)  =  small_in_g(x1)
0  =  0
small_out_g(x1)  =  small_out_g
U4_ggga(x1, x2, x3, x4, x5)  =  U4_ggga(x5)
U5_ggga(x1, x2, x3, x4)  =  U5_ggga(x2, x3, x4)
U6_ggga(x1, x2, x3, x4)  =  U6_ggga(x3, x4)
log2_out_ggga(x1, x2, x3, x4)  =  log2_out_ggga(x4)
log2_out_ga(x1, x2)  =  log2_out_ga(x2)

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

LOG2_IN_GA(X, Y) → U1_GA(X, Y, log2_in_ggga(X, 0, s(0), Y))
LOG2_IN_GA(X, Y) → LOG2_IN_GGGA(X, 0, s(0), Y)
LOG2_IN_GGGA(s(s(X)), Half, Acc, Y) → U2_GGGA(X, Half, Acc, Y, log2_in_ggga(X, s(Half), Acc, Y))
LOG2_IN_GGGA(s(s(X)), Half, Acc, Y) → LOG2_IN_GGGA(X, s(Half), Acc, Y)
LOG2_IN_GGGA(X, s(s(Half)), Acc, Y) → U3_GGGA(X, Half, Acc, Y, small_in_g(X))
LOG2_IN_GGGA(X, s(s(Half)), Acc, Y) → SMALL_IN_G(X)
U3_GGGA(X, Half, Acc, Y, small_out_g(X)) → U4_GGGA(X, Half, Acc, Y, log2_in_ggga(Half, s(0), s(Acc), Y))
U3_GGGA(X, Half, Acc, Y, small_out_g(X)) → LOG2_IN_GGGA(Half, s(0), s(Acc), Y)
LOG2_IN_GGGA(X, Half, Y, Y) → U5_GGGA(X, Half, Y, small_in_g(X))
LOG2_IN_GGGA(X, Half, Y, Y) → SMALL_IN_G(X)
U5_GGGA(X, Half, Y, small_out_g(X)) → U6_GGGA(X, Half, Y, small_in_g(Half))
U5_GGGA(X, Half, Y, small_out_g(X)) → SMALL_IN_G(Half)

The TRS R consists of the following rules:

log2_in_ga(X, Y) → U1_ga(X, Y, log2_in_ggga(X, 0, s(0), Y))
log2_in_ggga(s(s(X)), Half, Acc, Y) → U2_ggga(X, Half, Acc, Y, log2_in_ggga(X, s(Half), Acc, Y))
log2_in_ggga(X, s(s(Half)), Acc, Y) → U3_ggga(X, Half, Acc, Y, small_in_g(X))
small_in_g(0) → small_out_g(0)
small_in_g(s(0)) → small_out_g(s(0))
U3_ggga(X, Half, Acc, Y, small_out_g(X)) → U4_ggga(X, Half, Acc, Y, log2_in_ggga(Half, s(0), s(Acc), Y))
log2_in_ggga(X, Half, Y, Y) → U5_ggga(X, Half, Y, small_in_g(X))
U5_ggga(X, Half, Y, small_out_g(X)) → U6_ggga(X, Half, Y, small_in_g(Half))
U6_ggga(X, Half, Y, small_out_g(Half)) → log2_out_ggga(X, Half, Y, Y)
U4_ggga(X, Half, Acc, Y, log2_out_ggga(Half, s(0), s(Acc), Y)) → log2_out_ggga(X, s(s(Half)), Acc, Y)
U2_ggga(X, Half, Acc, Y, log2_out_ggga(X, s(Half), Acc, Y)) → log2_out_ggga(s(s(X)), Half, Acc, Y)
U1_ga(X, Y, log2_out_ggga(X, 0, s(0), Y)) → log2_out_ga(X, Y)

The argument filtering Pi contains the following mapping:
log2_in_ga(x1, x2)  =  log2_in_ga(x1)
U1_ga(x1, x2, x3)  =  U1_ga(x3)
log2_in_ggga(x1, x2, x3, x4)  =  log2_in_ggga(x1, x2, x3)
s(x1)  =  s(x1)
U2_ggga(x1, x2, x3, x4, x5)  =  U2_ggga(x5)
U3_ggga(x1, x2, x3, x4, x5)  =  U3_ggga(x2, x3, x5)
small_in_g(x1)  =  small_in_g(x1)
0  =  0
small_out_g(x1)  =  small_out_g
U4_ggga(x1, x2, x3, x4, x5)  =  U4_ggga(x5)
U5_ggga(x1, x2, x3, x4)  =  U5_ggga(x2, x3, x4)
U6_ggga(x1, x2, x3, x4)  =  U6_ggga(x3, x4)
log2_out_ggga(x1, x2, x3, x4)  =  log2_out_ggga(x4)
log2_out_ga(x1, x2)  =  log2_out_ga(x2)
LOG2_IN_GA(x1, x2)  =  LOG2_IN_GA(x1)
U1_GA(x1, x2, x3)  =  U1_GA(x3)
LOG2_IN_GGGA(x1, x2, x3, x4)  =  LOG2_IN_GGGA(x1, x2, x3)
U2_GGGA(x1, x2, x3, x4, x5)  =  U2_GGGA(x5)
U3_GGGA(x1, x2, x3, x4, x5)  =  U3_GGGA(x2, x3, x5)
SMALL_IN_G(x1)  =  SMALL_IN_G(x1)
U4_GGGA(x1, x2, x3, x4, x5)  =  U4_GGGA(x5)
U5_GGGA(x1, x2, x3, x4)  =  U5_GGGA(x2, x3, x4)
U6_GGGA(x1, x2, x3, x4)  =  U6_GGGA(x3, x4)

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

(4) Obligation:

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

LOG2_IN_GA(X, Y) → U1_GA(X, Y, log2_in_ggga(X, 0, s(0), Y))
LOG2_IN_GA(X, Y) → LOG2_IN_GGGA(X, 0, s(0), Y)
LOG2_IN_GGGA(s(s(X)), Half, Acc, Y) → U2_GGGA(X, Half, Acc, Y, log2_in_ggga(X, s(Half), Acc, Y))
LOG2_IN_GGGA(s(s(X)), Half, Acc, Y) → LOG2_IN_GGGA(X, s(Half), Acc, Y)
LOG2_IN_GGGA(X, s(s(Half)), Acc, Y) → U3_GGGA(X, Half, Acc, Y, small_in_g(X))
LOG2_IN_GGGA(X, s(s(Half)), Acc, Y) → SMALL_IN_G(X)
U3_GGGA(X, Half, Acc, Y, small_out_g(X)) → U4_GGGA(X, Half, Acc, Y, log2_in_ggga(Half, s(0), s(Acc), Y))
U3_GGGA(X, Half, Acc, Y, small_out_g(X)) → LOG2_IN_GGGA(Half, s(0), s(Acc), Y)
LOG2_IN_GGGA(X, Half, Y, Y) → U5_GGGA(X, Half, Y, small_in_g(X))
LOG2_IN_GGGA(X, Half, Y, Y) → SMALL_IN_G(X)
U5_GGGA(X, Half, Y, small_out_g(X)) → U6_GGGA(X, Half, Y, small_in_g(Half))
U5_GGGA(X, Half, Y, small_out_g(X)) → SMALL_IN_G(Half)

The TRS R consists of the following rules:

log2_in_ga(X, Y) → U1_ga(X, Y, log2_in_ggga(X, 0, s(0), Y))
log2_in_ggga(s(s(X)), Half, Acc, Y) → U2_ggga(X, Half, Acc, Y, log2_in_ggga(X, s(Half), Acc, Y))
log2_in_ggga(X, s(s(Half)), Acc, Y) → U3_ggga(X, Half, Acc, Y, small_in_g(X))
small_in_g(0) → small_out_g(0)
small_in_g(s(0)) → small_out_g(s(0))
U3_ggga(X, Half, Acc, Y, small_out_g(X)) → U4_ggga(X, Half, Acc, Y, log2_in_ggga(Half, s(0), s(Acc), Y))
log2_in_ggga(X, Half, Y, Y) → U5_ggga(X, Half, Y, small_in_g(X))
U5_ggga(X, Half, Y, small_out_g(X)) → U6_ggga(X, Half, Y, small_in_g(Half))
U6_ggga(X, Half, Y, small_out_g(Half)) → log2_out_ggga(X, Half, Y, Y)
U4_ggga(X, Half, Acc, Y, log2_out_ggga(Half, s(0), s(Acc), Y)) → log2_out_ggga(X, s(s(Half)), Acc, Y)
U2_ggga(X, Half, Acc, Y, log2_out_ggga(X, s(Half), Acc, Y)) → log2_out_ggga(s(s(X)), Half, Acc, Y)
U1_ga(X, Y, log2_out_ggga(X, 0, s(0), Y)) → log2_out_ga(X, Y)

The argument filtering Pi contains the following mapping:
log2_in_ga(x1, x2)  =  log2_in_ga(x1)
U1_ga(x1, x2, x3)  =  U1_ga(x3)
log2_in_ggga(x1, x2, x3, x4)  =  log2_in_ggga(x1, x2, x3)
s(x1)  =  s(x1)
U2_ggga(x1, x2, x3, x4, x5)  =  U2_ggga(x5)
U3_ggga(x1, x2, x3, x4, x5)  =  U3_ggga(x2, x3, x5)
small_in_g(x1)  =  small_in_g(x1)
0  =  0
small_out_g(x1)  =  small_out_g
U4_ggga(x1, x2, x3, x4, x5)  =  U4_ggga(x5)
U5_ggga(x1, x2, x3, x4)  =  U5_ggga(x2, x3, x4)
U6_ggga(x1, x2, x3, x4)  =  U6_ggga(x3, x4)
log2_out_ggga(x1, x2, x3, x4)  =  log2_out_ggga(x4)
log2_out_ga(x1, x2)  =  log2_out_ga(x2)
LOG2_IN_GA(x1, x2)  =  LOG2_IN_GA(x1)
U1_GA(x1, x2, x3)  =  U1_GA(x3)
LOG2_IN_GGGA(x1, x2, x3, x4)  =  LOG2_IN_GGGA(x1, x2, x3)
U2_GGGA(x1, x2, x3, x4, x5)  =  U2_GGGA(x5)
U3_GGGA(x1, x2, x3, x4, x5)  =  U3_GGGA(x2, x3, x5)
SMALL_IN_G(x1)  =  SMALL_IN_G(x1)
U4_GGGA(x1, x2, x3, x4, x5)  =  U4_GGGA(x5)
U5_GGGA(x1, x2, x3, x4)  =  U5_GGGA(x2, x3, x4)
U6_GGGA(x1, x2, x3, x4)  =  U6_GGGA(x3, 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 9 less nodes.

(6) Obligation:

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

LOG2_IN_GGGA(X, s(s(Half)), Acc, Y) → U3_GGGA(X, Half, Acc, Y, small_in_g(X))
U3_GGGA(X, Half, Acc, Y, small_out_g(X)) → LOG2_IN_GGGA(Half, s(0), s(Acc), Y)
LOG2_IN_GGGA(s(s(X)), Half, Acc, Y) → LOG2_IN_GGGA(X, s(Half), Acc, Y)

The TRS R consists of the following rules:

log2_in_ga(X, Y) → U1_ga(X, Y, log2_in_ggga(X, 0, s(0), Y))
log2_in_ggga(s(s(X)), Half, Acc, Y) → U2_ggga(X, Half, Acc, Y, log2_in_ggga(X, s(Half), Acc, Y))
log2_in_ggga(X, s(s(Half)), Acc, Y) → U3_ggga(X, Half, Acc, Y, small_in_g(X))
small_in_g(0) → small_out_g(0)
small_in_g(s(0)) → small_out_g(s(0))
U3_ggga(X, Half, Acc, Y, small_out_g(X)) → U4_ggga(X, Half, Acc, Y, log2_in_ggga(Half, s(0), s(Acc), Y))
log2_in_ggga(X, Half, Y, Y) → U5_ggga(X, Half, Y, small_in_g(X))
U5_ggga(X, Half, Y, small_out_g(X)) → U6_ggga(X, Half, Y, small_in_g(Half))
U6_ggga(X, Half, Y, small_out_g(Half)) → log2_out_ggga(X, Half, Y, Y)
U4_ggga(X, Half, Acc, Y, log2_out_ggga(Half, s(0), s(Acc), Y)) → log2_out_ggga(X, s(s(Half)), Acc, Y)
U2_ggga(X, Half, Acc, Y, log2_out_ggga(X, s(Half), Acc, Y)) → log2_out_ggga(s(s(X)), Half, Acc, Y)
U1_ga(X, Y, log2_out_ggga(X, 0, s(0), Y)) → log2_out_ga(X, Y)

The argument filtering Pi contains the following mapping:
log2_in_ga(x1, x2)  =  log2_in_ga(x1)
U1_ga(x1, x2, x3)  =  U1_ga(x3)
log2_in_ggga(x1, x2, x3, x4)  =  log2_in_ggga(x1, x2, x3)
s(x1)  =  s(x1)
U2_ggga(x1, x2, x3, x4, x5)  =  U2_ggga(x5)
U3_ggga(x1, x2, x3, x4, x5)  =  U3_ggga(x2, x3, x5)
small_in_g(x1)  =  small_in_g(x1)
0  =  0
small_out_g(x1)  =  small_out_g
U4_ggga(x1, x2, x3, x4, x5)  =  U4_ggga(x5)
U5_ggga(x1, x2, x3, x4)  =  U5_ggga(x2, x3, x4)
U6_ggga(x1, x2, x3, x4)  =  U6_ggga(x3, x4)
log2_out_ggga(x1, x2, x3, x4)  =  log2_out_ggga(x4)
log2_out_ga(x1, x2)  =  log2_out_ga(x2)
LOG2_IN_GGGA(x1, x2, x3, x4)  =  LOG2_IN_GGGA(x1, x2, x3)
U3_GGGA(x1, x2, x3, x4, x5)  =  U3_GGGA(x2, x3, x5)

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

(7) UsableRulesProof (EQUIVALENT transformation)

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

(8) Obligation:

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

LOG2_IN_GGGA(X, s(s(Half)), Acc, Y) → U3_GGGA(X, Half, Acc, Y, small_in_g(X))
U3_GGGA(X, Half, Acc, Y, small_out_g(X)) → LOG2_IN_GGGA(Half, s(0), s(Acc), Y)
LOG2_IN_GGGA(s(s(X)), Half, Acc, Y) → LOG2_IN_GGGA(X, s(Half), Acc, Y)

The TRS R consists of the following rules:

small_in_g(0) → small_out_g(0)
small_in_g(s(0)) → small_out_g(s(0))

The argument filtering Pi contains the following mapping:
s(x1)  =  s(x1)
small_in_g(x1)  =  small_in_g(x1)
0  =  0
small_out_g(x1)  =  small_out_g
LOG2_IN_GGGA(x1, x2, x3, x4)  =  LOG2_IN_GGGA(x1, x2, x3)
U3_GGGA(x1, x2, x3, x4, x5)  =  U3_GGGA(x2, x3, x5)

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

(9) PiDPToQDPProof (SOUND transformation)

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

(10) Obligation:

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

LOG2_IN_GGGA(X, s(s(Half)), Acc) → U3_GGGA(Half, Acc, small_in_g(X))
U3_GGGA(Half, Acc, small_out_g) → LOG2_IN_GGGA(Half, s(0), s(Acc))
LOG2_IN_GGGA(s(s(X)), Half, Acc) → LOG2_IN_GGGA(X, s(Half), Acc)

The TRS R consists of the following rules:

small_in_g(0) → small_out_g
small_in_g(s(0)) → small_out_g

The set Q consists of the following terms:

small_in_g(x0)

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

(11) MRRProof (EQUIVALENT transformation)

By using the rule removal processor [LPAR04] with the following ordering, at least one Dependency Pair or term rewrite system rule of this QDP problem can be strictly oriented.
Strictly oriented dependency pairs:

LOG2_IN_GGGA(s(s(X)), Half, Acc) → LOG2_IN_GGGA(X, s(Half), Acc)

Strictly oriented rules of the TRS R:

small_in_g(s(0)) → small_out_g

Used ordering: Polynomial interpretation [POLO]:

POL(0) = 0   
POL(LOG2_IN_GGGA(x1, x2, x3)) = x1 + x2 + x3   
POL(U3_GGGA(x1, x2, x3)) = 2 + x1 + x2 + x3   
POL(s(x1)) = 1 + x1   
POL(small_in_g(x1)) = x1   
POL(small_out_g) = 0   

(12) Obligation:

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

LOG2_IN_GGGA(X, s(s(Half)), Acc) → U3_GGGA(Half, Acc, small_in_g(X))
U3_GGGA(Half, Acc, small_out_g) → LOG2_IN_GGGA(Half, s(0), s(Acc))

The TRS R consists of the following rules:

small_in_g(0) → small_out_g

The set Q consists of the following terms:

small_in_g(x0)

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

(13) DependencyGraphProof (EQUIVALENT transformation)

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

(14) TRUE

(15) PrologToPiTRSProof (SOUND transformation)

We use the technique of [LOPSTR]. With regard to the inferred argument filtering the predicates were used in the following modes:
log2_in: (b,f)
log2_in: (b,b,b,f)
Transforming Prolog into the following Term Rewriting System:
Pi-finite rewrite system:
The TRS R consists of the following rules:

log2_in_ga(X, Y) → U1_ga(X, Y, log2_in_ggga(X, 0, s(0), Y))
log2_in_ggga(s(s(X)), Half, Acc, Y) → U2_ggga(X, Half, Acc, Y, log2_in_ggga(X, s(Half), Acc, Y))
log2_in_ggga(X, s(s(Half)), Acc, Y) → U3_ggga(X, Half, Acc, Y, small_in_g(X))
small_in_g(0) → small_out_g(0)
small_in_g(s(0)) → small_out_g(s(0))
U3_ggga(X, Half, Acc, Y, small_out_g(X)) → U4_ggga(X, Half, Acc, Y, log2_in_ggga(Half, s(0), s(Acc), Y))
log2_in_ggga(X, Half, Y, Y) → U5_ggga(X, Half, Y, small_in_g(X))
U5_ggga(X, Half, Y, small_out_g(X)) → U6_ggga(X, Half, Y, small_in_g(Half))
U6_ggga(X, Half, Y, small_out_g(Half)) → log2_out_ggga(X, Half, Y, Y)
U4_ggga(X, Half, Acc, Y, log2_out_ggga(Half, s(0), s(Acc), Y)) → log2_out_ggga(X, s(s(Half)), Acc, Y)
U2_ggga(X, Half, Acc, Y, log2_out_ggga(X, s(Half), Acc, Y)) → log2_out_ggga(s(s(X)), Half, Acc, Y)
U1_ga(X, Y, log2_out_ggga(X, 0, s(0), Y)) → log2_out_ga(X, Y)

The argument filtering Pi contains the following mapping:
log2_in_ga(x1, x2)  =  log2_in_ga(x1)
U1_ga(x1, x2, x3)  =  U1_ga(x1, x3)
log2_in_ggga(x1, x2, x3, x4)  =  log2_in_ggga(x1, x2, x3)
s(x1)  =  s(x1)
U2_ggga(x1, x2, x3, x4, x5)  =  U2_ggga(x1, x2, x3, x5)
U3_ggga(x1, x2, x3, x4, x5)  =  U3_ggga(x1, x2, x3, x5)
small_in_g(x1)  =  small_in_g(x1)
0  =  0
small_out_g(x1)  =  small_out_g(x1)
U4_ggga(x1, x2, x3, x4, x5)  =  U4_ggga(x1, x2, x3, x5)
U5_ggga(x1, x2, x3, x4)  =  U5_ggga(x1, x2, x3, x4)
U6_ggga(x1, x2, x3, x4)  =  U6_ggga(x1, x2, x3, x4)
log2_out_ggga(x1, x2, x3, x4)  =  log2_out_ggga(x1, x2, x3, x4)
log2_out_ga(x1, x2)  =  log2_out_ga(x1, x2)

Infinitary Constructor Rewriting Termination of PiTRS implies Termination of Prolog

(16) Obligation:

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

log2_in_ga(X, Y) → U1_ga(X, Y, log2_in_ggga(X, 0, s(0), Y))
log2_in_ggga(s(s(X)), Half, Acc, Y) → U2_ggga(X, Half, Acc, Y, log2_in_ggga(X, s(Half), Acc, Y))
log2_in_ggga(X, s(s(Half)), Acc, Y) → U3_ggga(X, Half, Acc, Y, small_in_g(X))
small_in_g(0) → small_out_g(0)
small_in_g(s(0)) → small_out_g(s(0))
U3_ggga(X, Half, Acc, Y, small_out_g(X)) → U4_ggga(X, Half, Acc, Y, log2_in_ggga(Half, s(0), s(Acc), Y))
log2_in_ggga(X, Half, Y, Y) → U5_ggga(X, Half, Y, small_in_g(X))
U5_ggga(X, Half, Y, small_out_g(X)) → U6_ggga(X, Half, Y, small_in_g(Half))
U6_ggga(X, Half, Y, small_out_g(Half)) → log2_out_ggga(X, Half, Y, Y)
U4_ggga(X, Half, Acc, Y, log2_out_ggga(Half, s(0), s(Acc), Y)) → log2_out_ggga(X, s(s(Half)), Acc, Y)
U2_ggga(X, Half, Acc, Y, log2_out_ggga(X, s(Half), Acc, Y)) → log2_out_ggga(s(s(X)), Half, Acc, Y)
U1_ga(X, Y, log2_out_ggga(X, 0, s(0), Y)) → log2_out_ga(X, Y)

The argument filtering Pi contains the following mapping:
log2_in_ga(x1, x2)  =  log2_in_ga(x1)
U1_ga(x1, x2, x3)  =  U1_ga(x1, x3)
log2_in_ggga(x1, x2, x3, x4)  =  log2_in_ggga(x1, x2, x3)
s(x1)  =  s(x1)
U2_ggga(x1, x2, x3, x4, x5)  =  U2_ggga(x1, x2, x3, x5)
U3_ggga(x1, x2, x3, x4, x5)  =  U3_ggga(x1, x2, x3, x5)
small_in_g(x1)  =  small_in_g(x1)
0  =  0
small_out_g(x1)  =  small_out_g(x1)
U4_ggga(x1, x2, x3, x4, x5)  =  U4_ggga(x1, x2, x3, x5)
U5_ggga(x1, x2, x3, x4)  =  U5_ggga(x1, x2, x3, x4)
U6_ggga(x1, x2, x3, x4)  =  U6_ggga(x1, x2, x3, x4)
log2_out_ggga(x1, x2, x3, x4)  =  log2_out_ggga(x1, x2, x3, x4)
log2_out_ga(x1, x2)  =  log2_out_ga(x1, x2)

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

LOG2_IN_GA(X, Y) → U1_GA(X, Y, log2_in_ggga(X, 0, s(0), Y))
LOG2_IN_GA(X, Y) → LOG2_IN_GGGA(X, 0, s(0), Y)
LOG2_IN_GGGA(s(s(X)), Half, Acc, Y) → U2_GGGA(X, Half, Acc, Y, log2_in_ggga(X, s(Half), Acc, Y))
LOG2_IN_GGGA(s(s(X)), Half, Acc, Y) → LOG2_IN_GGGA(X, s(Half), Acc, Y)
LOG2_IN_GGGA(X, s(s(Half)), Acc, Y) → U3_GGGA(X, Half, Acc, Y, small_in_g(X))
LOG2_IN_GGGA(X, s(s(Half)), Acc, Y) → SMALL_IN_G(X)
U3_GGGA(X, Half, Acc, Y, small_out_g(X)) → U4_GGGA(X, Half, Acc, Y, log2_in_ggga(Half, s(0), s(Acc), Y))
U3_GGGA(X, Half, Acc, Y, small_out_g(X)) → LOG2_IN_GGGA(Half, s(0), s(Acc), Y)
LOG2_IN_GGGA(X, Half, Y, Y) → U5_GGGA(X, Half, Y, small_in_g(X))
LOG2_IN_GGGA(X, Half, Y, Y) → SMALL_IN_G(X)
U5_GGGA(X, Half, Y, small_out_g(X)) → U6_GGGA(X, Half, Y, small_in_g(Half))
U5_GGGA(X, Half, Y, small_out_g(X)) → SMALL_IN_G(Half)

The TRS R consists of the following rules:

log2_in_ga(X, Y) → U1_ga(X, Y, log2_in_ggga(X, 0, s(0), Y))
log2_in_ggga(s(s(X)), Half, Acc, Y) → U2_ggga(X, Half, Acc, Y, log2_in_ggga(X, s(Half), Acc, Y))
log2_in_ggga(X, s(s(Half)), Acc, Y) → U3_ggga(X, Half, Acc, Y, small_in_g(X))
small_in_g(0) → small_out_g(0)
small_in_g(s(0)) → small_out_g(s(0))
U3_ggga(X, Half, Acc, Y, small_out_g(X)) → U4_ggga(X, Half, Acc, Y, log2_in_ggga(Half, s(0), s(Acc), Y))
log2_in_ggga(X, Half, Y, Y) → U5_ggga(X, Half, Y, small_in_g(X))
U5_ggga(X, Half, Y, small_out_g(X)) → U6_ggga(X, Half, Y, small_in_g(Half))
U6_ggga(X, Half, Y, small_out_g(Half)) → log2_out_ggga(X, Half, Y, Y)
U4_ggga(X, Half, Acc, Y, log2_out_ggga(Half, s(0), s(Acc), Y)) → log2_out_ggga(X, s(s(Half)), Acc, Y)
U2_ggga(X, Half, Acc, Y, log2_out_ggga(X, s(Half), Acc, Y)) → log2_out_ggga(s(s(X)), Half, Acc, Y)
U1_ga(X, Y, log2_out_ggga(X, 0, s(0), Y)) → log2_out_ga(X, Y)

The argument filtering Pi contains the following mapping:
log2_in_ga(x1, x2)  =  log2_in_ga(x1)
U1_ga(x1, x2, x3)  =  U1_ga(x1, x3)
log2_in_ggga(x1, x2, x3, x4)  =  log2_in_ggga(x1, x2, x3)
s(x1)  =  s(x1)
U2_ggga(x1, x2, x3, x4, x5)  =  U2_ggga(x1, x2, x3, x5)
U3_ggga(x1, x2, x3, x4, x5)  =  U3_ggga(x1, x2, x3, x5)
small_in_g(x1)  =  small_in_g(x1)
0  =  0
small_out_g(x1)  =  small_out_g(x1)
U4_ggga(x1, x2, x3, x4, x5)  =  U4_ggga(x1, x2, x3, x5)
U5_ggga(x1, x2, x3, x4)  =  U5_ggga(x1, x2, x3, x4)
U6_ggga(x1, x2, x3, x4)  =  U6_ggga(x1, x2, x3, x4)
log2_out_ggga(x1, x2, x3, x4)  =  log2_out_ggga(x1, x2, x3, x4)
log2_out_ga(x1, x2)  =  log2_out_ga(x1, x2)
LOG2_IN_GA(x1, x2)  =  LOG2_IN_GA(x1)
U1_GA(x1, x2, x3)  =  U1_GA(x1, x3)
LOG2_IN_GGGA(x1, x2, x3, x4)  =  LOG2_IN_GGGA(x1, x2, x3)
U2_GGGA(x1, x2, x3, x4, x5)  =  U2_GGGA(x1, x2, x3, x5)
U3_GGGA(x1, x2, x3, x4, x5)  =  U3_GGGA(x1, x2, x3, x5)
SMALL_IN_G(x1)  =  SMALL_IN_G(x1)
U4_GGGA(x1, x2, x3, x4, x5)  =  U4_GGGA(x1, x2, x3, x5)
U5_GGGA(x1, x2, x3, x4)  =  U5_GGGA(x1, x2, x3, x4)
U6_GGGA(x1, x2, x3, x4)  =  U6_GGGA(x1, x2, x3, x4)

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

(18) Obligation:

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

LOG2_IN_GA(X, Y) → U1_GA(X, Y, log2_in_ggga(X, 0, s(0), Y))
LOG2_IN_GA(X, Y) → LOG2_IN_GGGA(X, 0, s(0), Y)
LOG2_IN_GGGA(s(s(X)), Half, Acc, Y) → U2_GGGA(X, Half, Acc, Y, log2_in_ggga(X, s(Half), Acc, Y))
LOG2_IN_GGGA(s(s(X)), Half, Acc, Y) → LOG2_IN_GGGA(X, s(Half), Acc, Y)
LOG2_IN_GGGA(X, s(s(Half)), Acc, Y) → U3_GGGA(X, Half, Acc, Y, small_in_g(X))
LOG2_IN_GGGA(X, s(s(Half)), Acc, Y) → SMALL_IN_G(X)
U3_GGGA(X, Half, Acc, Y, small_out_g(X)) → U4_GGGA(X, Half, Acc, Y, log2_in_ggga(Half, s(0), s(Acc), Y))
U3_GGGA(X, Half, Acc, Y, small_out_g(X)) → LOG2_IN_GGGA(Half, s(0), s(Acc), Y)
LOG2_IN_GGGA(X, Half, Y, Y) → U5_GGGA(X, Half, Y, small_in_g(X))
LOG2_IN_GGGA(X, Half, Y, Y) → SMALL_IN_G(X)
U5_GGGA(X, Half, Y, small_out_g(X)) → U6_GGGA(X, Half, Y, small_in_g(Half))
U5_GGGA(X, Half, Y, small_out_g(X)) → SMALL_IN_G(Half)

The TRS R consists of the following rules:

log2_in_ga(X, Y) → U1_ga(X, Y, log2_in_ggga(X, 0, s(0), Y))
log2_in_ggga(s(s(X)), Half, Acc, Y) → U2_ggga(X, Half, Acc, Y, log2_in_ggga(X, s(Half), Acc, Y))
log2_in_ggga(X, s(s(Half)), Acc, Y) → U3_ggga(X, Half, Acc, Y, small_in_g(X))
small_in_g(0) → small_out_g(0)
small_in_g(s(0)) → small_out_g(s(0))
U3_ggga(X, Half, Acc, Y, small_out_g(X)) → U4_ggga(X, Half, Acc, Y, log2_in_ggga(Half, s(0), s(Acc), Y))
log2_in_ggga(X, Half, Y, Y) → U5_ggga(X, Half, Y, small_in_g(X))
U5_ggga(X, Half, Y, small_out_g(X)) → U6_ggga(X, Half, Y, small_in_g(Half))
U6_ggga(X, Half, Y, small_out_g(Half)) → log2_out_ggga(X, Half, Y, Y)
U4_ggga(X, Half, Acc, Y, log2_out_ggga(Half, s(0), s(Acc), Y)) → log2_out_ggga(X, s(s(Half)), Acc, Y)
U2_ggga(X, Half, Acc, Y, log2_out_ggga(X, s(Half), Acc, Y)) → log2_out_ggga(s(s(X)), Half, Acc, Y)
U1_ga(X, Y, log2_out_ggga(X, 0, s(0), Y)) → log2_out_ga(X, Y)

The argument filtering Pi contains the following mapping:
log2_in_ga(x1, x2)  =  log2_in_ga(x1)
U1_ga(x1, x2, x3)  =  U1_ga(x1, x3)
log2_in_ggga(x1, x2, x3, x4)  =  log2_in_ggga(x1, x2, x3)
s(x1)  =  s(x1)
U2_ggga(x1, x2, x3, x4, x5)  =  U2_ggga(x1, x2, x3, x5)
U3_ggga(x1, x2, x3, x4, x5)  =  U3_ggga(x1, x2, x3, x5)
small_in_g(x1)  =  small_in_g(x1)
0  =  0
small_out_g(x1)  =  small_out_g(x1)
U4_ggga(x1, x2, x3, x4, x5)  =  U4_ggga(x1, x2, x3, x5)
U5_ggga(x1, x2, x3, x4)  =  U5_ggga(x1, x2, x3, x4)
U6_ggga(x1, x2, x3, x4)  =  U6_ggga(x1, x2, x3, x4)
log2_out_ggga(x1, x2, x3, x4)  =  log2_out_ggga(x1, x2, x3, x4)
log2_out_ga(x1, x2)  =  log2_out_ga(x1, x2)
LOG2_IN_GA(x1, x2)  =  LOG2_IN_GA(x1)
U1_GA(x1, x2, x3)  =  U1_GA(x1, x3)
LOG2_IN_GGGA(x1, x2, x3, x4)  =  LOG2_IN_GGGA(x1, x2, x3)
U2_GGGA(x1, x2, x3, x4, x5)  =  U2_GGGA(x1, x2, x3, x5)
U3_GGGA(x1, x2, x3, x4, x5)  =  U3_GGGA(x1, x2, x3, x5)
SMALL_IN_G(x1)  =  SMALL_IN_G(x1)
U4_GGGA(x1, x2, x3, x4, x5)  =  U4_GGGA(x1, x2, x3, x5)
U5_GGGA(x1, x2, x3, x4)  =  U5_GGGA(x1, x2, x3, x4)
U6_GGGA(x1, x2, x3, x4)  =  U6_GGGA(x1, x2, x3, x4)

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

(19) DependencyGraphProof (EQUIVALENT transformation)

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

(20) Obligation:

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

LOG2_IN_GGGA(X, s(s(Half)), Acc, Y) → U3_GGGA(X, Half, Acc, Y, small_in_g(X))
U3_GGGA(X, Half, Acc, Y, small_out_g(X)) → LOG2_IN_GGGA(Half, s(0), s(Acc), Y)
LOG2_IN_GGGA(s(s(X)), Half, Acc, Y) → LOG2_IN_GGGA(X, s(Half), Acc, Y)

The TRS R consists of the following rules:

log2_in_ga(X, Y) → U1_ga(X, Y, log2_in_ggga(X, 0, s(0), Y))
log2_in_ggga(s(s(X)), Half, Acc, Y) → U2_ggga(X, Half, Acc, Y, log2_in_ggga(X, s(Half), Acc, Y))
log2_in_ggga(X, s(s(Half)), Acc, Y) → U3_ggga(X, Half, Acc, Y, small_in_g(X))
small_in_g(0) → small_out_g(0)
small_in_g(s(0)) → small_out_g(s(0))
U3_ggga(X, Half, Acc, Y, small_out_g(X)) → U4_ggga(X, Half, Acc, Y, log2_in_ggga(Half, s(0), s(Acc), Y))
log2_in_ggga(X, Half, Y, Y) → U5_ggga(X, Half, Y, small_in_g(X))
U5_ggga(X, Half, Y, small_out_g(X)) → U6_ggga(X, Half, Y, small_in_g(Half))
U6_ggga(X, Half, Y, small_out_g(Half)) → log2_out_ggga(X, Half, Y, Y)
U4_ggga(X, Half, Acc, Y, log2_out_ggga(Half, s(0), s(Acc), Y)) → log2_out_ggga(X, s(s(Half)), Acc, Y)
U2_ggga(X, Half, Acc, Y, log2_out_ggga(X, s(Half), Acc, Y)) → log2_out_ggga(s(s(X)), Half, Acc, Y)
U1_ga(X, Y, log2_out_ggga(X, 0, s(0), Y)) → log2_out_ga(X, Y)

The argument filtering Pi contains the following mapping:
log2_in_ga(x1, x2)  =  log2_in_ga(x1)
U1_ga(x1, x2, x3)  =  U1_ga(x1, x3)
log2_in_ggga(x1, x2, x3, x4)  =  log2_in_ggga(x1, x2, x3)
s(x1)  =  s(x1)
U2_ggga(x1, x2, x3, x4, x5)  =  U2_ggga(x1, x2, x3, x5)
U3_ggga(x1, x2, x3, x4, x5)  =  U3_ggga(x1, x2, x3, x5)
small_in_g(x1)  =  small_in_g(x1)
0  =  0
small_out_g(x1)  =  small_out_g(x1)
U4_ggga(x1, x2, x3, x4, x5)  =  U4_ggga(x1, x2, x3, x5)
U5_ggga(x1, x2, x3, x4)  =  U5_ggga(x1, x2, x3, x4)
U6_ggga(x1, x2, x3, x4)  =  U6_ggga(x1, x2, x3, x4)
log2_out_ggga(x1, x2, x3, x4)  =  log2_out_ggga(x1, x2, x3, x4)
log2_out_ga(x1, x2)  =  log2_out_ga(x1, x2)
LOG2_IN_GGGA(x1, x2, x3, x4)  =  LOG2_IN_GGGA(x1, x2, x3)
U3_GGGA(x1, x2, x3, x4, x5)  =  U3_GGGA(x1, x2, x3, x5)

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

(21) UsableRulesProof (EQUIVALENT transformation)

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

(22) Obligation:

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

LOG2_IN_GGGA(X, s(s(Half)), Acc, Y) → U3_GGGA(X, Half, Acc, Y, small_in_g(X))
U3_GGGA(X, Half, Acc, Y, small_out_g(X)) → LOG2_IN_GGGA(Half, s(0), s(Acc), Y)
LOG2_IN_GGGA(s(s(X)), Half, Acc, Y) → LOG2_IN_GGGA(X, s(Half), Acc, Y)

The TRS R consists of the following rules:

small_in_g(0) → small_out_g(0)
small_in_g(s(0)) → small_out_g(s(0))

The argument filtering Pi contains the following mapping:
s(x1)  =  s(x1)
small_in_g(x1)  =  small_in_g(x1)
0  =  0
small_out_g(x1)  =  small_out_g(x1)
LOG2_IN_GGGA(x1, x2, x3, x4)  =  LOG2_IN_GGGA(x1, x2, x3)
U3_GGGA(x1, x2, x3, x4, x5)  =  U3_GGGA(x1, x2, x3, x5)

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

(23) PiDPToQDPProof (SOUND transformation)

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

(24) Obligation:

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

LOG2_IN_GGGA(X, s(s(Half)), Acc) → U3_GGGA(X, Half, Acc, small_in_g(X))
U3_GGGA(X, Half, Acc, small_out_g(X)) → LOG2_IN_GGGA(Half, s(0), s(Acc))
LOG2_IN_GGGA(s(s(X)), Half, Acc) → LOG2_IN_GGGA(X, s(Half), Acc)

The TRS R consists of the following rules:

small_in_g(0) → small_out_g(0)
small_in_g(s(0)) → small_out_g(s(0))

The set Q consists of the following terms:

small_in_g(x0)

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

(25) MRRProof (EQUIVALENT transformation)

By using the rule removal processor [LPAR04] with the following ordering, at least one Dependency Pair or term rewrite system rule of this QDP problem can be strictly oriented.
Strictly oriented dependency pairs:

LOG2_IN_GGGA(X, s(s(Half)), Acc) → U3_GGGA(X, Half, Acc, small_in_g(X))
LOG2_IN_GGGA(s(s(X)), Half, Acc) → LOG2_IN_GGGA(X, s(Half), Acc)


Used ordering: Polynomial interpretation [POLO]:

POL(0) = 0   
POL(LOG2_IN_GGGA(x1, x2, x3)) = 2·x1 + 2·x2 + x3   
POL(U3_GGGA(x1, x2, x3, x4)) = 1 + x1 + 2·x2 + x3 + x4   
POL(s(x1)) = 1 + x1   
POL(small_in_g(x1)) = 2 + x1   
POL(small_out_g(x1)) = 2 + x1   

(26) Obligation:

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

U3_GGGA(X, Half, Acc, small_out_g(X)) → LOG2_IN_GGGA(Half, s(0), s(Acc))

The TRS R consists of the following rules:

small_in_g(0) → small_out_g(0)
small_in_g(s(0)) → small_out_g(s(0))

The set Q consists of the following terms:

small_in_g(x0)

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