(0) Obligation:

JBC Problem based on JBC Program:
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");
}
}


(1) JBCToGraph (SOUND transformation)

Constructed TerminationGraph.

(2) Obligation:

Termination Graph based on JBC Program:
example_2.Test.main([Ljava/lang/String;)V: Graph of 88 nodes with 1 SCC.


(3) TerminationGraphToSCCProof (SOUND transformation)

Splitted TerminationGraph to 1 SCCs.

(4) Obligation:

SCC of termination graph based on JBC Program.
SCC contains nodes from the following methods: example_2.Test.main([Ljava/lang/String;)V
SCC calls the following helper methods:
Performed SCC analyses:
  • Used field analysis yielded the following read fields:
  • Marker field analysis yielded the following relations that could be markers:

(5) SCCToIntTRSProof (SOUND transformation)

Transformed FIGraph SCCs to intTRSs. Log:

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))

(6) Obligation:

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))

(7) PolynomialOrderProcessor (EQUIVALENT transformation)

Found the following polynomial interpretation:


[f205_0_divBy_LE(x6)] = -1 + 4·x6
[f205_0_divBy_LE'(x9)] = 2·x9

Therefore the following rule(s) have been dropped:


f205_0_divBy_LE(x0) → f205_0_divBy_LE'(x0) | &&(>(+(x1, 1), 0), >(x0, 0))
f205_0_divBy_LE'(x2) → f205_0_divBy_LE(x3) | &&(&&(&&(&&(&&(>(x2, 0), >=(-(x2, *(2, x4)), 0)), <(-(x2, *(2, x4)), 2)), >=(-(x2, *(2, x3)), 0)), >(+(x4, 1), 0)), <(-(x2, *(2, x3)), 2))

(8) YES