0 JBC
↳1 JBCToGraph (⇒, 510 ms)
↳2 JBCTerminationGraph
↳3 TerminationGraphToSCCProof (⇒, 0 ms)
↳4 JBCTerminationSCC
↳5 SCCToIDPv1Proof (⇒, 100 ms)
↳6 IDP
↳7 IDPNonInfProof (⇒, 150 ms)
↳8 AND
↳9 IDP
↳10 IDependencyGraphProof (⇔, 0 ms)
↳11 TRUE
↳12 IDP
↳13 IDependencyGraphProof (⇔, 0 ms)
↳14 TRUE
/**
* 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 22 rules for P and 0 rules for R.
P rules:
304_0_main_Load(EOS(STATIC_304), i18, i47, i18) → 306_0_main_IntArithmetic(EOS(STATIC_306), i18, i47, i18, i47)
306_0_main_IntArithmetic(EOS(STATIC_306), i18, i47, i18, i47) → 319_0_main_LE(EOS(STATIC_319), i18, i47, +(i18, i47)) | &&(>=(i18, 0), >=(i47, 0))
319_0_main_LE(EOS(STATIC_319), i18, i47, i56) → 328_0_main_LE(EOS(STATIC_328), i18, i47, i56)
328_0_main_LE(EOS(STATIC_328), i18, i47, i56) → 336_0_main_Load(EOS(STATIC_336), i18, i47) | >(i56, 0)
336_0_main_Load(EOS(STATIC_336), i18, i47) → 347_0_main_LE(EOS(STATIC_347), i18, i47, i18)
347_0_main_LE(EOS(STATIC_347), matching1, i47, matching2) → 356_0_main_LE(EOS(STATIC_356), 0, i47, 0) | &&(=(matching1, 0), =(matching2, 0))
347_0_main_LE(EOS(STATIC_347), i60, i47, i60) → 358_0_main_LE(EOS(STATIC_358), i60, i47, i60)
356_0_main_LE(EOS(STATIC_356), matching1, i47, matching2) → 367_0_main_Load(EOS(STATIC_367), 0, i47) | &&(&&(<=(0, 0), =(matching1, 0)), =(matching2, 0))
367_0_main_Load(EOS(STATIC_367), matching1, i47) → 378_0_main_LE(EOS(STATIC_378), 0, i47, i47) | =(matching1, 0)
378_0_main_LE(EOS(STATIC_378), matching1, matching2, matching3) → 393_0_main_LE(EOS(STATIC_393), 0, 0, 0) | &&(&&(=(matching1, 0), =(matching2, 0)), =(matching3, 0))
378_0_main_LE(EOS(STATIC_378), matching1, i67, i67) → 394_0_main_LE(EOS(STATIC_394), 0, i67, i67) | =(matching1, 0)
393_0_main_LE(EOS(STATIC_393), matching1, matching2, matching3) → 428_0_main_Load(EOS(STATIC_428), 0, 0) | &&(&&(&&(<=(0, 0), =(matching1, 0)), =(matching2, 0)), =(matching3, 0))
428_0_main_Load(EOS(STATIC_428), matching1, matching2) → 297_0_main_Load(EOS(STATIC_297), 0, 0) | &&(=(matching1, 0), =(matching2, 0))
297_0_main_Load(EOS(STATIC_297), i18, i47) → 304_0_main_Load(EOS(STATIC_304), i18, i47, i18)
394_0_main_LE(EOS(STATIC_394), matching1, i67, i67) → 430_0_main_Inc(EOS(STATIC_430), 0, i67) | &&(>(i67, 0), =(matching1, 0))
430_0_main_Inc(EOS(STATIC_430), matching1, i67) → 993_0_main_JMP(EOS(STATIC_993), 0, +(i67, -1)) | &&(>(i67, 0), =(matching1, 0))
993_0_main_JMP(EOS(STATIC_993), matching1, i218) → 998_0_main_Load(EOS(STATIC_998), 0, i218) | =(matching1, 0)
998_0_main_Load(EOS(STATIC_998), matching1, i218) → 297_0_main_Load(EOS(STATIC_297), 0, i218) | =(matching1, 0)
358_0_main_LE(EOS(STATIC_358), i60, i47, i60) → 369_0_main_Inc(EOS(STATIC_369), i60, i47) | >(i60, 0)
369_0_main_Inc(EOS(STATIC_369), i60, i47) → 380_0_main_JMP(EOS(STATIC_380), +(i60, -1), i47) | >(i60, 0)
380_0_main_JMP(EOS(STATIC_380), i64, i47) → 415_0_main_Load(EOS(STATIC_415), i64, i47)
415_0_main_Load(EOS(STATIC_415), i64, i47) → 297_0_main_Load(EOS(STATIC_297), i64, i47)
R rules:
Combined rules. Obtained 3 conditional rules for P and 0 conditional rules for R.
P rules:
304_0_main_Load(EOS(STATIC_304), x0, x1, x0) → 304_0_main_Load(EOS(STATIC_304), 0, 0, 0) | FALSE
304_0_main_Load(EOS(STATIC_304), 0, x1, 0) → 304_0_main_Load(EOS(STATIC_304), 0, +(x1, -1), 0) | >(x1, 0)
304_0_main_Load(EOS(STATIC_304), x0, x1, x0) → 304_0_main_Load(EOS(STATIC_304), +(x0, -1), x1, +(x0, -1)) | &&(&&(>(+(x1, 1), 0), >(x0, 0)), <(0, +(x0, x1)))
R rules:
Filtered ground terms:
304_0_main_Load(x1, x2, x3, x4) → 304_0_main_Load(x2, x3, x4)
EOS(x1) → EOS
Cond_304_0_main_Load1(x1, x2, x3, x4, x5) → Cond_304_0_main_Load1(x1, x3, x4, x5)
Cond_304_0_main_Load(x1, x2, x3, x4, x5) → Cond_304_0_main_Load(x1, x4)
Filtered duplicate args:
304_0_main_Load(x1, x2, x3) → 304_0_main_Load(x2, x3)
Cond_304_0_main_Load1(x1, x2, x3, x4) → Cond_304_0_main_Load1(x1, x3, x4)
Combined rules. Obtained 2 conditional rules for P and 0 conditional rules for R.
P rules:
304_0_main_Load(x1, 0) → 304_0_main_Load(+(x1, -1), 0) | >(x1, 0)
304_0_main_Load(x1, x0) → 304_0_main_Load(x1, +(x0, -1)) | &&(&&(>(x1, -1), >(x0, 0)), <(0, +(x0, x1)))
R rules:
Finished conversion. Obtained 4 rules for P and 0 rules for R. System has predefined symbols.
P rules:
304_0_MAIN_LOAD(x1, 0) → COND_304_0_MAIN_LOAD(>(x1, 0), x1, 0)
COND_304_0_MAIN_LOAD(TRUE, x1, 0) → 304_0_MAIN_LOAD(+(x1, -1), 0)
304_0_MAIN_LOAD(x1, x0) → COND_304_0_MAIN_LOAD1(&&(&&(>(x1, -1), >(x0, 0)), <(0, +(x0, x1))), x1, x0)
COND_304_0_MAIN_LOAD1(TRUE, x1, x0) → 304_0_MAIN_LOAD(x1, +(x0, -1))
R rules:
!= | ~ | Neq: (Integer, Integer) -> Boolean |
* | ~ | Mul: (Integer, Integer) -> Integer |
>= | ~ | Ge: (Integer, Integer) -> Boolean |
-1 | ~ | UnaryMinus: (Integer) -> Integer |
| | ~ | Bwor: (Integer, Integer) -> Integer |
/ | ~ | Div: (Integer, Integer) -> Integer |
= | ~ | Eq: (Integer, Integer) -> Boolean |
~ | Bwxor: (Integer, Integer) -> Integer | |
|| | ~ | Lor: (Boolean, Boolean) -> Boolean |
! | ~ | Lnot: (Boolean) -> Boolean |
< | ~ | Lt: (Integer, Integer) -> Boolean |
- | ~ | Sub: (Integer, Integer) -> Integer |
<= | ~ | Le: (Integer, Integer) -> Boolean |
> | ~ | Gt: (Integer, Integer) -> Boolean |
~ | ~ | Bwnot: (Integer) -> Integer |
% | ~ | Mod: (Integer, Integer) -> Integer |
& | ~ | Bwand: (Integer, Integer) -> Integer |
+ | ~ | Add: (Integer, Integer) -> Integer |
&& | ~ | Land: (Boolean, Boolean) -> Boolean |
Integer, Boolean
(0) -> (1), if (x1[0] > 0 ∧x1[0] →* x1[1])
(1) -> (0), if x1[1] + -1 →* x1[0]
(1) -> (2), if (x1[1] + -1 →* x1[2]∧0 →* x0[2])
(2) -> (3), if (x1[2] > -1 && x0[2] > 0 && 0 < x0[2] + x1[2] ∧x1[2] →* x1[3]∧x0[2] →* x0[3])
(3) -> (0), if (x1[3] →* x1[0]∧x0[3] + -1 →* 0)
(3) -> (2), if (x1[3] →* x1[2]∧x0[3] + -1 →* x0[2])
(1) (>(x1[0], 0)=TRUE∧x1[0]=x1[1] ⇒ 304_0_MAIN_LOAD(x1[0], 0)≥NonInfC∧304_0_MAIN_LOAD(x1[0], 0)≥COND_304_0_MAIN_LOAD(>(x1[0], 0), x1[0], 0)∧(UIncreasing(COND_304_0_MAIN_LOAD(>(x1[0], 0), x1[0], 0)), ≥))
(2) (>(x1[0], 0)=TRUE ⇒ 304_0_MAIN_LOAD(x1[0], 0)≥NonInfC∧304_0_MAIN_LOAD(x1[0], 0)≥COND_304_0_MAIN_LOAD(>(x1[0], 0), x1[0], 0)∧(UIncreasing(COND_304_0_MAIN_LOAD(>(x1[0], 0), x1[0], 0)), ≥))
(3) (x1[0] + [-1] ≥ 0 ⇒ (UIncreasing(COND_304_0_MAIN_LOAD(>(x1[0], 0), x1[0], 0)), ≥)∧[bni_12 + (-1)Bound*bni_12] + [bni_12]x1[0] ≥ 0∧[(-1)bso_13] ≥ 0)
(4) (x1[0] + [-1] ≥ 0 ⇒ (UIncreasing(COND_304_0_MAIN_LOAD(>(x1[0], 0), x1[0], 0)), ≥)∧[bni_12 + (-1)Bound*bni_12] + [bni_12]x1[0] ≥ 0∧[(-1)bso_13] ≥ 0)
(5) (x1[0] + [-1] ≥ 0 ⇒ (UIncreasing(COND_304_0_MAIN_LOAD(>(x1[0], 0), x1[0], 0)), ≥)∧[bni_12 + (-1)Bound*bni_12] + [bni_12]x1[0] ≥ 0∧[(-1)bso_13] ≥ 0)
(6) (x1[0] ≥ 0 ⇒ (UIncreasing(COND_304_0_MAIN_LOAD(>(x1[0], 0), x1[0], 0)), ≥)∧[(2)bni_12 + (-1)Bound*bni_12] + [bni_12]x1[0] ≥ 0∧[(-1)bso_13] ≥ 0)
(7) (COND_304_0_MAIN_LOAD(TRUE, x1[1], 0)≥NonInfC∧COND_304_0_MAIN_LOAD(TRUE, x1[1], 0)≥304_0_MAIN_LOAD(+(x1[1], -1), 0)∧(UIncreasing(304_0_MAIN_LOAD(+(x1[1], -1), 0)), ≥))
(8) ((UIncreasing(304_0_MAIN_LOAD(+(x1[1], -1), 0)), ≥)∧[bni_14] = 0∧[1 + (-1)bso_15] ≥ 0)
(9) ((UIncreasing(304_0_MAIN_LOAD(+(x1[1], -1), 0)), ≥)∧[bni_14] = 0∧[1 + (-1)bso_15] ≥ 0)
(10) ((UIncreasing(304_0_MAIN_LOAD(+(x1[1], -1), 0)), ≥)∧[bni_14] = 0∧[1 + (-1)bso_15] ≥ 0)
(11) ((UIncreasing(304_0_MAIN_LOAD(+(x1[1], -1), 0)), ≥)∧[bni_14] = 0∧0 = 0∧[1 + (-1)bso_15] ≥ 0)
(12) (&&(&&(>(x1[2], -1), >(x0[2], 0)), <(0, +(x0[2], x1[2])))=TRUE∧x1[2]=x1[3]∧x0[2]=x0[3] ⇒ 304_0_MAIN_LOAD(x1[2], x0[2])≥NonInfC∧304_0_MAIN_LOAD(x1[2], x0[2])≥COND_304_0_MAIN_LOAD1(&&(&&(>(x1[2], -1), >(x0[2], 0)), <(0, +(x0[2], x1[2]))), x1[2], x0[2])∧(UIncreasing(COND_304_0_MAIN_LOAD1(&&(&&(>(x1[2], -1), >(x0[2], 0)), <(0, +(x0[2], x1[2]))), x1[2], x0[2])), ≥))
(13) (<(0, +(x0[2], x1[2]))=TRUE∧>(x1[2], -1)=TRUE∧>(x0[2], 0)=TRUE ⇒ 304_0_MAIN_LOAD(x1[2], x0[2])≥NonInfC∧304_0_MAIN_LOAD(x1[2], x0[2])≥COND_304_0_MAIN_LOAD1(&&(&&(>(x1[2], -1), >(x0[2], 0)), <(0, +(x0[2], x1[2]))), x1[2], x0[2])∧(UIncreasing(COND_304_0_MAIN_LOAD1(&&(&&(>(x1[2], -1), >(x0[2], 0)), <(0, +(x0[2], x1[2]))), x1[2], x0[2])), ≥))
(14) (x0[2] + [-1] + x1[2] ≥ 0∧x1[2] ≥ 0∧x0[2] + [-1] ≥ 0 ⇒ (UIncreasing(COND_304_0_MAIN_LOAD1(&&(&&(>(x1[2], -1), >(x0[2], 0)), <(0, +(x0[2], x1[2]))), x1[2], x0[2])), ≥)∧[bni_16 + (-1)Bound*bni_16] + [bni_16]x0[2] + [bni_16]x1[2] ≥ 0∧[(-1)bso_17] ≥ 0)
(15) (x0[2] + [-1] + x1[2] ≥ 0∧x1[2] ≥ 0∧x0[2] + [-1] ≥ 0 ⇒ (UIncreasing(COND_304_0_MAIN_LOAD1(&&(&&(>(x1[2], -1), >(x0[2], 0)), <(0, +(x0[2], x1[2]))), x1[2], x0[2])), ≥)∧[bni_16 + (-1)Bound*bni_16] + [bni_16]x0[2] + [bni_16]x1[2] ≥ 0∧[(-1)bso_17] ≥ 0)
(16) (x0[2] + [-1] + x1[2] ≥ 0∧x1[2] ≥ 0∧x0[2] + [-1] ≥ 0 ⇒ (UIncreasing(COND_304_0_MAIN_LOAD1(&&(&&(>(x1[2], -1), >(x0[2], 0)), <(0, +(x0[2], x1[2]))), x1[2], x0[2])), ≥)∧[bni_16 + (-1)Bound*bni_16] + [bni_16]x0[2] + [bni_16]x1[2] ≥ 0∧[(-1)bso_17] ≥ 0)
(17) (x0[2] + x1[2] ≥ 0∧x1[2] ≥ 0∧x0[2] ≥ 0 ⇒ (UIncreasing(COND_304_0_MAIN_LOAD1(&&(&&(>(x1[2], -1), >(x0[2], 0)), <(0, +(x0[2], x1[2]))), x1[2], x0[2])), ≥)∧[(2)bni_16 + (-1)Bound*bni_16] + [bni_16]x0[2] + [bni_16]x1[2] ≥ 0∧[(-1)bso_17] ≥ 0)
(18) (COND_304_0_MAIN_LOAD1(TRUE, x1[3], x0[3])≥NonInfC∧COND_304_0_MAIN_LOAD1(TRUE, x1[3], x0[3])≥304_0_MAIN_LOAD(x1[3], +(x0[3], -1))∧(UIncreasing(304_0_MAIN_LOAD(x1[3], +(x0[3], -1))), ≥))
(19) ((UIncreasing(304_0_MAIN_LOAD(x1[3], +(x0[3], -1))), ≥)∧[bni_18] = 0∧[1 + (-1)bso_19] ≥ 0)
(20) ((UIncreasing(304_0_MAIN_LOAD(x1[3], +(x0[3], -1))), ≥)∧[bni_18] = 0∧[1 + (-1)bso_19] ≥ 0)
(21) ((UIncreasing(304_0_MAIN_LOAD(x1[3], +(x0[3], -1))), ≥)∧[bni_18] = 0∧[1 + (-1)bso_19] ≥ 0)
(22) ((UIncreasing(304_0_MAIN_LOAD(x1[3], +(x0[3], -1))), ≥)∧[bni_18] = 0∧0 = 0∧0 = 0∧[1 + (-1)bso_19] ≥ 0)
POL(TRUE) = 0
POL(FALSE) = 0
POL(304_0_MAIN_LOAD(x1, x2)) = [1] + x2 + x1
POL(0) = 0
POL(COND_304_0_MAIN_LOAD(x1, x2, x3)) = [1] + x2
POL(>(x1, x2)) = [-1]
POL(+(x1, x2)) = x1 + x2
POL(-1) = [-1]
POL(COND_304_0_MAIN_LOAD1(x1, x2, x3)) = [1] + x3 + x2
POL(&&(x1, x2)) = [-1]
POL(<(x1, x2)) = [-1]
COND_304_0_MAIN_LOAD(TRUE, x1[1], 0) → 304_0_MAIN_LOAD(+(x1[1], -1), 0)
COND_304_0_MAIN_LOAD1(TRUE, x1[3], x0[3]) → 304_0_MAIN_LOAD(x1[3], +(x0[3], -1))
304_0_MAIN_LOAD(x1[0], 0) → COND_304_0_MAIN_LOAD(>(x1[0], 0), x1[0], 0)
304_0_MAIN_LOAD(x1[2], x0[2]) → COND_304_0_MAIN_LOAD1(&&(&&(>(x1[2], -1), >(x0[2], 0)), <(0, +(x0[2], x1[2]))), x1[2], x0[2])
304_0_MAIN_LOAD(x1[0], 0) → COND_304_0_MAIN_LOAD(>(x1[0], 0), x1[0], 0)
304_0_MAIN_LOAD(x1[2], x0[2]) → COND_304_0_MAIN_LOAD1(&&(&&(>(x1[2], -1), >(x0[2], 0)), <(0, +(x0[2], x1[2]))), x1[2], x0[2])
!= | ~ | Neq: (Integer, Integer) -> Boolean |
* | ~ | Mul: (Integer, Integer) -> Integer |
>= | ~ | Ge: (Integer, Integer) -> Boolean |
-1 | ~ | UnaryMinus: (Integer) -> Integer |
| | ~ | Bwor: (Integer, Integer) -> Integer |
/ | ~ | Div: (Integer, Integer) -> Integer |
= | ~ | Eq: (Integer, Integer) -> Boolean |
~ | Bwxor: (Integer, Integer) -> Integer | |
|| | ~ | Lor: (Boolean, Boolean) -> Boolean |
! | ~ | Lnot: (Boolean) -> Boolean |
< | ~ | Lt: (Integer, Integer) -> Boolean |
- | ~ | Sub: (Integer, Integer) -> Integer |
<= | ~ | Le: (Integer, Integer) -> Boolean |
> | ~ | Gt: (Integer, Integer) -> Boolean |
~ | ~ | Bwnot: (Integer) -> Integer |
% | ~ | Mod: (Integer, Integer) -> Integer |
& | ~ | Bwand: (Integer, Integer) -> Integer |
+ | ~ | Add: (Integer, Integer) -> Integer |
&& | ~ | Land: (Boolean, Boolean) -> Boolean |
Integer, Boolean
!= | ~ | Neq: (Integer, Integer) -> Boolean |
* | ~ | Mul: (Integer, Integer) -> Integer |
>= | ~ | Ge: (Integer, Integer) -> Boolean |
-1 | ~ | UnaryMinus: (Integer) -> Integer |
| | ~ | Bwor: (Integer, Integer) -> Integer |
/ | ~ | Div: (Integer, Integer) -> Integer |
= | ~ | Eq: (Integer, Integer) -> Boolean |
~ | Bwxor: (Integer, Integer) -> Integer | |
|| | ~ | Lor: (Boolean, Boolean) -> Boolean |
! | ~ | Lnot: (Boolean) -> Boolean |
< | ~ | Lt: (Integer, Integer) -> Boolean |
- | ~ | Sub: (Integer, Integer) -> Integer |
<= | ~ | Le: (Integer, Integer) -> Boolean |
> | ~ | Gt: (Integer, Integer) -> Boolean |
~ | ~ | Bwnot: (Integer) -> Integer |
% | ~ | Mod: (Integer, Integer) -> Integer |
& | ~ | Bwand: (Integer, Integer) -> Integer |
+ | ~ | Add: (Integer, Integer) -> Integer |
&& | ~ | Land: (Boolean, Boolean) -> Boolean |
Integer