0 JBC
↳1 JBCToGraph (⇒, 194 ms)
↳2 JBCTerminationGraph
↳3 TerminationGraphToSCCProof (⇒, 0 ms)
↳4 JBCTerminationSCC
↳5 SCCToIntTRSProof (⇒, 78 ms)
↳6 intTRS
↳7 PolynomialOrderProcessor (⇔, 0 ms)
↳8 YES
package example_2;
public class Test {
public static int divBy(int x){
int r = 0;
int y;
while (x > 0) {
y = 2;
x = x/y;
r = r + x;
}
return r;
}
public static void main(String[] args) {
if (args.length > 0) {
int x = args[0].length();
int r = divBy(x);
// System.out.println("Result: " + r);
}
// else System.out.println("Error: Incorrect call");
}
}
Generated rules. Obtained 15 IRules
P rules:
f205_0_divBy_LE(EOS, i37, i37) → f209_0_divBy_LE(EOS, i37, i37)
f209_0_divBy_LE(EOS, i37, i37) → f213_0_divBy_ConstantStackPush(EOS, i37) | >(i37, 0)
f213_0_divBy_ConstantStackPush(EOS, i37) → f218_0_divBy_Store(EOS, i37, 2)
f218_0_divBy_Store(EOS, i37, matching1) → f222_0_divBy_Load(EOS, i37, 2) | =(matching1, 2)
f222_0_divBy_Load(EOS, i37, matching1) → f227_0_divBy_Load(EOS, 2, i37) | =(matching1, 2)
f227_0_divBy_Load(EOS, matching1, i37) → f232_0_divBy_IntArithmetic(EOS, i37, 2) | =(matching1, 2)
f232_0_divBy_IntArithmetic(EOS, i37, matching1) → f234_0_divBy_Store(EOS, /(i37, 2)) | &&(>=(i37, 1), =(matching1, 2))
f234_0_divBy_Store(EOS, i41) → f236_0_divBy_Load(EOS, i41)
f236_0_divBy_Load(EOS, i41) → f238_0_divBy_Load(EOS, i41)
f238_0_divBy_Load(EOS, i41) → f240_0_divBy_IntArithmetic(EOS, i41, i41)
f240_0_divBy_IntArithmetic(EOS, i41, i41) → f243_0_divBy_Store(EOS, i41) | >=(i41, 0)
f243_0_divBy_Store(EOS, i41) → f245_0_divBy_JMP(EOS, i41)
f245_0_divBy_JMP(EOS, i41) → f269_0_divBy_Load(EOS, i41)
f269_0_divBy_Load(EOS, i41) → f198_0_divBy_Load(EOS, i41)
f198_0_divBy_Load(EOS, i26) → f205_0_divBy_LE(EOS, i26, i26)
Combined rules. Obtained 1 IRules
P rules:
f205_0_divBy_LE(EOS, x0, x0) → f205_0_divBy_LE(EOS, /(x0, 2), /(x0, 2)) | &&(>=(/(x0, 2), 0), >(+(x0, 1), 1))
Filtered ground terms:
f205_0_divBy_LE(x1, x2, x3) → f205_0_divBy_LE(x2, x3)
Cond_f205_0_divBy_LE(x1, x2, x3, x4) → Cond_f205_0_divBy_LE(x1, x3, x4)
Filtered duplicate terms:
f205_0_divBy_LE(x1, x2) → f205_0_divBy_LE(x2)
Cond_f205_0_divBy_LE(x1, x2, x3) → Cond_f205_0_divBy_LE(x1, x3)
Prepared 1 rules for path length conversion:
P rules:
f205_0_divBy_LE(x0) → f205_0_divBy_LE(/(x0, 2)) | &&(>=(/(x0, 2), 0), >(+(x0, 1), 1))
Finished conversion. Obtained 2 rules.
P rules:
f205_0_divBy_LE(x0) → f205_0_divBy_LE'(x0) | &&(>(+(div, 1), 0), >(x0, 0))
f205_0_divBy_LE'(x0) → f205_0_divBy_LE(arith) | &&(&&(&&(&&(&&(>(x0, 0), >=(-(x0, *(2, div)), 0)), <(-(x0, *(2, div)), 2)), >=(-(x0, *(2, arith)), 0)), >(+(div, 1), 0)), <(-(x0, *(2, arith)), 2))
Found the following polynomial interpretation:
Therefore the following rule(s) have been dropped: