0 JBC
↳1 JBCToGraph (⇒, 193 ms)
↳2 JBCTerminationGraph
↳3 TerminationGraphToSCCProof (⇒, 0 ms)
↳4 JBCTerminationSCC
↳5 SCCToIntTRSProof (⇒, 75 ms)
↳6 intTRS
↳7 TerminationGraphProcessor (⇔, 0 ms)
↳8 YES
/**
* Example taken from "A Term Rewriting Approach to the Automated Termination
* Analysis of Imperative Programs" (http://www.cs.unm.edu/~spf/papers/2009-02.pdf)
* and converted to Java.
*/
public class PastaB5 {
public static void main(String[] args) {
Random.args = args;
int x = Random.random();
while (x > 0 && (x % 2) == 0) {
x--;
}
}
}
public class Random {
static String[] args;
static int index = 0;
public static int random() {
String string = args[index];
index++;
return string.length();
}
}
Generated rules. Obtained 11 IRules
P rules:
f146_0_main_LE(EOS, i22, i22) → f149_0_main_LE(EOS, i22, i22)
f149_0_main_LE(EOS, i22, i22) → f158_0_main_Load(EOS, i22) | >(i22, 0)
f158_0_main_Load(EOS, i22) → f165_0_main_ConstantStackPush(EOS, i22, i22)
f165_0_main_ConstantStackPush(EOS, i22, i22) → f169_0_main_IntArithmetic(EOS, i22, i22, 2)
f169_0_main_IntArithmetic(EOS, i22, i22, matching1) → f174_0_main_NE(EOS, i22, %(i22, 2)) | =(matching1, 2)
f174_0_main_NE(EOS, i22, matching1) → f184_0_main_NE(EOS, i22, 0) | =(matching1, 0)
f184_0_main_NE(EOS, i22, matching1) → f204_0_main_Inc(EOS, i22) | =(matching1, 0)
f204_0_main_Inc(EOS, i22) → f217_0_main_JMP(EOS, +(i22, -1)) | >(i22, 0)
f217_0_main_JMP(EOS, i27) → f262_0_main_Load(EOS, i27)
f262_0_main_Load(EOS, i27) → f143_0_main_Load(EOS, i27)
f143_0_main_Load(EOS, i18) → f146_0_main_LE(EOS, i18, i18)
Combined rules. Obtained 1 IRules
P rules:
f146_0_main_LE(EOS, x0, x0) → f146_0_main_LE(EOS, -(x0, 1), -(x0, 1)) | &&(>(x0, 0), =(%(x0, 2), 0))
Filtered ground terms:
f146_0_main_LE(x1, x2, x3) → f146_0_main_LE(x2, x3)
Cond_f146_0_main_LE(x1, x2, x3, x4) → Cond_f146_0_main_LE(x1, x3, x4)
Filtered duplicate terms:
f146_0_main_LE(x1, x2) → f146_0_main_LE(x2)
Cond_f146_0_main_LE(x1, x2, x3) → Cond_f146_0_main_LE(x1, x3)
Prepared 1 rules for path length conversion:
P rules:
f146_0_main_LE(x0) → f146_0_main_LE(-(x0, 1)) | &&(>(x0, 0), =(%(x0, 2), 0))
Finished conversion. Obtained 2 rules.
P rules:
f146_0_main_LE(x0) → f146_0_main_LE'(x0) | &&(=(-(x0, *(2, div)), 0), >(x0, 0))
f146_0_main_LE'(x0) → f146_0_main_LE(-(x0, 1)) | &&(&&(&&(>(x0, 0), >=(-(x0, *(2, div)), 0)), <(-(x0, *(2, div)), 2)), =(-(x0, *(2, div)), 0))
Constructed the termination graph and obtained no non-trivial SCC(s).