0 JBC
↳1 JBCToGraph (⇒, 514 ms)
↳2 JBCTerminationGraph
↳3 TerminationGraphToSCCProof (⇒, 0 ms)
↳4 JBCTerminationSCC
↳5 SCCToIntTRSProof (⇒, 9 ms)
↳6 intTRS
↳7 TerminationGraphProcessor (⇒, 9 ms)
↳8 AND
↳9 intTRS
↳10 PolynomialOrderProcessor (⇔, 0 ms)
↳11 YES
↳12 intTRS
↳13 PolynomialOrderProcessor (⇔, 0 ms)
↳14 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 PastaB10 {
public static void main(String[] args) {
Random.args = args;
int x = Random.random();
int y = Random.random();
while (x + y > 0) {
if (x > 0) {
x--;
} else if (y > 0) {
y--;
} else {
continue;
}
}
}
}
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 22 IRules
P rules:
f309_0_main_Load(EOS, i18, i45, i18) → f315_0_main_IntArithmetic(EOS, i18, i45, i18, i45)
f315_0_main_IntArithmetic(EOS, i18, i45, i18, i45) → f327_0_main_LE(EOS, i18, i45, +(i18, i45)) | &&(>=(i18, 0), >=(i45, 0))
f327_0_main_LE(EOS, i18, i45, i55) → f336_0_main_LE(EOS, i18, i45, i55)
f336_0_main_LE(EOS, i18, i45, i55) → f347_0_main_Load(EOS, i18, i45) | >(i55, 0)
f347_0_main_Load(EOS, i18, i45) → f363_0_main_LE(EOS, i18, i45, i18)
f363_0_main_LE(EOS, matching1, i45, matching2) → f377_0_main_LE(EOS, 0, i45, 0) | &&(=(matching1, 0), =(matching2, 0))
f363_0_main_LE(EOS, i62, i45, i62) → f378_0_main_LE(EOS, i62, i45, i62)
f377_0_main_LE(EOS, matching1, i45, matching2) → f390_0_main_Load(EOS, 0, i45) | &&(&&(<=(0, 0), =(matching1, 0)), =(matching2, 0))
f390_0_main_Load(EOS, matching1, i45) → f405_0_main_LE(EOS, 0, i45, i45) | =(matching1, 0)
f405_0_main_LE(EOS, matching1, matching2, matching3) → f425_0_main_LE(EOS, 0, 0, 0) | &&(&&(=(matching1, 0), =(matching2, 0)), =(matching3, 0))
f405_0_main_LE(EOS, matching1, i72, i72) → f426_0_main_LE(EOS, 0, i72, i72) | =(matching1, 0)
f425_0_main_LE(EOS, matching1, matching2, matching3) → f475_0_main_Load(EOS, 0, 0) | &&(&&(&&(<=(0, 0), =(matching1, 0)), =(matching2, 0)), =(matching3, 0))
f475_0_main_Load(EOS, matching1, matching2) → f301_0_main_Load(EOS, 0, 0) | &&(=(matching1, 0), =(matching2, 0))
f301_0_main_Load(EOS, i18, i45) → f309_0_main_Load(EOS, i18, i45, i18)
f426_0_main_LE(EOS, matching1, i72, i72) → f477_0_main_Inc(EOS, 0, i72) | &&(>(i72, 0), =(matching1, 0))
f477_0_main_Inc(EOS, matching1, i72) → f1243_0_main_JMP(EOS, 0, +(i72, -1)) | &&(>(i72, 0), =(matching1, 0))
f1243_0_main_JMP(EOS, matching1, i235) → f1253_0_main_Load(EOS, 0, i235) | =(matching1, 0)
f1253_0_main_Load(EOS, matching1, i235) → f301_0_main_Load(EOS, 0, i235) | =(matching1, 0)
f378_0_main_LE(EOS, i62, i45, i62) → f393_0_main_Inc(EOS, i62, i45) | >(i62, 0)
f393_0_main_Inc(EOS, i62, i45) → f408_0_main_JMP(EOS, +(i62, -1), i45) | >(i62, 0)
f408_0_main_JMP(EOS, i68, i45) → f456_0_main_Load(EOS, i68, i45)
f456_0_main_Load(EOS, i68, i45) → f301_0_main_Load(EOS, i68, i45)
Combined rules. Obtained 2 IRules
P rules:
f309_0_main_Load(EOS, 0, x1, 0) → f309_0_main_Load(EOS, 0, -(x1, 1), 0) | >(x1, 0)
f309_0_main_Load(EOS, x0, x1, x0) → f309_0_main_Load(EOS, -(x0, 1), x1, -(x0, 1)) | &&(&&(>(+(x1, 1), 0), >(x0, 0)), >(+(x0, x1), 0))
Filtered ground terms:
f309_0_main_Load(x1, x2, x3, x4) → f309_0_main_Load(x2, x3, x4)
Cond_f309_0_main_Load(x1, x2, x3, x4, x5) → Cond_f309_0_main_Load(x1, x4)
Cond_f309_0_main_Load1(x1, x2, x3, x4, x5) → Cond_f309_0_main_Load1(x1, x3, x4, x5)
Filtered duplicate terms:
f309_0_main_Load(x1, x2, x3) → f309_0_main_Load(x2, x3)
Cond_f309_0_main_Load1(x1, x2, x3, x4) → Cond_f309_0_main_Load1(x1, x3, x4)
Prepared 2 rules for path length conversion:
P rules:
f309_0_main_Load(x1, 0) → f309_0_main_Load(-(x1, 1), 0) | >(x1, 0)
f309_0_main_Load(x1, x0) → f309_0_main_Load(x1, -(x0, 1)) | &&(&&(>(+(x1, 1), 0), >(x0, 0)), >(+(x0, x1), 0))
Finished conversion. Obtained 2 rules.
P rules:
f309_0_main_Load(x0, c0) → f309_0_main_Load(-(x0, 1), 0) | &&(>(x0, 0), =(0, c0))
f309_0_main_Load(x1, x2) → f309_0_main_Load(x1, -(x2, 1)) | &&(&&(>(x2, 0), >(x1, -1)), >(+(x2, x1), 0))
Constructed the termination graph and obtained 2 non-trivial SCCs.
Found the following polynomial interpretation:
Therefore the following rule(s) have been dropped:
Found the following polynomial interpretation:
Therefore the following rule(s) have been dropped: