0 JBC
↳1 JBCToGraph (⇒, 80 ms)
↳2 JBCTerminationGraph
↳3 TerminationGraphToSCCProof (⇒, 0 ms)
↳4 JBCTerminationSCC
↳5 SCCToIDPv1Proof (⇒, 70 ms)
↳6 IDP
↳7 IDPNonInfProof (⇒, 160 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 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 11 rules for P and 0 rules for R.
P rules:
146_0_main_LE(EOS(STATIC_146), i22, i22) → 149_0_main_LE(EOS(STATIC_149), i22, i22)
149_0_main_LE(EOS(STATIC_149), i22, i22) → 158_0_main_Load(EOS(STATIC_158), i22) | >(i22, 0)
158_0_main_Load(EOS(STATIC_158), i22) → 166_0_main_ConstantStackPush(EOS(STATIC_166), i22, i22)
166_0_main_ConstantStackPush(EOS(STATIC_166), i22, i22) → 170_0_main_IntArithmetic(EOS(STATIC_170), i22, i22, 2)
170_0_main_IntArithmetic(EOS(STATIC_170), i22, i22, matching1) → 174_0_main_NE(EOS(STATIC_174), i22, %(i22, 2)) | =(matching1, 2)
174_0_main_NE(EOS(STATIC_174), i22, matching1) → 183_0_main_NE(EOS(STATIC_183), i22, 0) | =(matching1, 0)
183_0_main_NE(EOS(STATIC_183), i22, matching1) → 195_0_main_Inc(EOS(STATIC_195), i22) | =(matching1, 0)
195_0_main_Inc(EOS(STATIC_195), i22) → 204_0_main_JMP(EOS(STATIC_204), +(i22, -1)) | >(i22, 0)
204_0_main_JMP(EOS(STATIC_204), i26) → 218_0_main_Load(EOS(STATIC_218), i26)
218_0_main_Load(EOS(STATIC_218), i26) → 143_0_main_Load(EOS(STATIC_143), i26)
143_0_main_Load(EOS(STATIC_143), i18) → 146_0_main_LE(EOS(STATIC_146), i18, i18)
R rules:
Combined rules. Obtained 1 conditional rules for P and 0 conditional rules for R.
P rules:
146_0_main_LE(EOS(STATIC_146), x0, x0) → 146_0_main_LE(EOS(STATIC_146), +(x0, -1), +(x0, -1)) | &&(>(x0, 0), =(0, %(x0, 2)))
R rules:
Filtered ground terms:
146_0_main_LE(x1, x2, x3) → 146_0_main_LE(x2, x3)
EOS(x1) → EOS
Cond_146_0_main_LE(x1, x2, x3, x4) → Cond_146_0_main_LE(x1, x3, x4)
Filtered duplicate args:
146_0_main_LE(x1, x2) → 146_0_main_LE(x2)
Cond_146_0_main_LE(x1, x2, x3) → Cond_146_0_main_LE(x1, x3)
Combined rules. Obtained 1 conditional rules for P and 0 conditional rules for R.
P rules:
146_0_main_LE(x0) → 146_0_main_LE(+(x0, -1)) | &&(>(x0, 0), =(0, %(x0, 2)))
R rules:
Finished conversion. Obtained 2 rules for P and 0 rules for R. System has predefined symbols.
P rules:
146_0_MAIN_LE(x0) → COND_146_0_MAIN_LE(&&(>(x0, 0), =(0, %(x0, 2))), x0)
COND_146_0_MAIN_LE(TRUE, x0) → 146_0_MAIN_LE(+(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 |
Boolean, Integer
(0) -> (1), if (x0[0] > 0 && 0 = x0[0] % 2 ∧x0[0] →* x0[1])
(1) -> (0), if (x0[1] + -1 →* x0[0])
(1) (&&(>(x0[0], 0), =(0, %(x0[0], 2)))=TRUE∧x0[0]=x0[1] ⇒ 146_0_MAIN_LE(x0[0])≥NonInfC∧146_0_MAIN_LE(x0[0])≥COND_146_0_MAIN_LE(&&(>(x0[0], 0), =(0, %(x0[0], 2))), x0[0])∧(UIncreasing(COND_146_0_MAIN_LE(&&(>(x0[0], 0), =(0, %(x0[0], 2))), x0[0])), ≥))
(2) (>(x0[0], 0)=TRUE∧>=(0, %(x0[0], 2))=TRUE∧<=(0, %(x0[0], 2))=TRUE ⇒ 146_0_MAIN_LE(x0[0])≥NonInfC∧146_0_MAIN_LE(x0[0])≥COND_146_0_MAIN_LE(&&(>(x0[0], 0), =(0, %(x0[0], 2))), x0[0])∧(UIncreasing(COND_146_0_MAIN_LE(&&(>(x0[0], 0), =(0, %(x0[0], 2))), x0[0])), ≥))
(3) (x0[0] + [-1] ≥ 0∧[-1]min{[2], [-2]} ≥ 0∧max{[2], [-2]} ≥ 0 ⇒ (UIncreasing(COND_146_0_MAIN_LE(&&(>(x0[0], 0), =(0, %(x0[0], 2))), x0[0])), ≥)∧[(-1)Bound*bni_10] + [(2)bni_10]x0[0] ≥ 0∧[(-1)bso_11] ≥ 0)
(4) (x0[0] + [-1] ≥ 0∧[-1]min{[2], [-2]} ≥ 0∧max{[2], [-2]} ≥ 0 ⇒ (UIncreasing(COND_146_0_MAIN_LE(&&(>(x0[0], 0), =(0, %(x0[0], 2))), x0[0])), ≥)∧[(-1)Bound*bni_10] + [(2)bni_10]x0[0] ≥ 0∧[(-1)bso_11] ≥ 0)
(5) (x0[0] + [-1] ≥ 0∧[4] ≥ 0∧[2] ≥ 0∧[2] ≥ 0 ⇒ (UIncreasing(COND_146_0_MAIN_LE(&&(>(x0[0], 0), =(0, %(x0[0], 2))), x0[0])), ≥)∧[(-1)Bound*bni_10] + [(2)bni_10]x0[0] ≥ 0∧[(-1)bso_11] ≥ 0)
(6) (x0[0] ≥ 0∧[4] ≥ 0∧[2] ≥ 0∧[2] ≥ 0 ⇒ (UIncreasing(COND_146_0_MAIN_LE(&&(>(x0[0], 0), =(0, %(x0[0], 2))), x0[0])), ≥)∧[(-1)Bound*bni_10 + (2)bni_10] + [(2)bni_10]x0[0] ≥ 0∧[(-1)bso_11] ≥ 0)
(7) (x0[0] ≥ 0∧[1] ≥ 0∧[1] ≥ 0∧[1] ≥ 0 ⇒ (UIncreasing(COND_146_0_MAIN_LE(&&(>(x0[0], 0), =(0, %(x0[0], 2))), x0[0])), ≥)∧[(-1)Bound*bni_10 + (2)bni_10] + [(2)bni_10]x0[0] ≥ 0∧[(-1)bso_11] ≥ 0)
(8) (COND_146_0_MAIN_LE(TRUE, x0[1])≥NonInfC∧COND_146_0_MAIN_LE(TRUE, x0[1])≥146_0_MAIN_LE(+(x0[1], -1))∧(UIncreasing(146_0_MAIN_LE(+(x0[1], -1))), ≥))
(9) ((UIncreasing(146_0_MAIN_LE(+(x0[1], -1))), ≥)∧[bni_12] = 0∧[2 + (-1)bso_13] ≥ 0)
(10) ((UIncreasing(146_0_MAIN_LE(+(x0[1], -1))), ≥)∧[bni_12] = 0∧[2 + (-1)bso_13] ≥ 0)
(11) ((UIncreasing(146_0_MAIN_LE(+(x0[1], -1))), ≥)∧[bni_12] = 0∧[2 + (-1)bso_13] ≥ 0)
(12) ((UIncreasing(146_0_MAIN_LE(+(x0[1], -1))), ≥)∧[bni_12] = 0∧0 = 0∧[2 + (-1)bso_13] ≥ 0)
POL(TRUE) = 0
POL(FALSE) = 0
POL(146_0_MAIN_LE(x1)) = [2]x1
POL(COND_146_0_MAIN_LE(x1, x2)) = [2]x2
POL(&&(x1, x2)) = [-1]
POL(>(x1, x2)) = [-1]
POL(0) = 0
POL(=(x1, x2)) = [-1]
POL(2) = [2]
POL(+(x1, x2)) = x1 + x2
POL(-1) = [-1]
Polynomial Interpretations with Context Sensitive Arithemetic Replacement
POL(TermCSAR-Mode @ Context)
POL(%(x1, 2)-1 @ {}) = min{x2, [-1]x2}
POL(%(x1, 2)1 @ {}) = max{x2, [-1]x2}
COND_146_0_MAIN_LE(TRUE, x0[1]) → 146_0_MAIN_LE(+(x0[1], -1))
146_0_MAIN_LE(x0[0]) → COND_146_0_MAIN_LE(&&(>(x0[0], 0), =(0, %(x0[0], 2))), x0[0])
146_0_MAIN_LE(x0[0]) → COND_146_0_MAIN_LE(&&(>(x0[0], 0), =(0, %(x0[0], 2))), x0[0])
!= | ~ | 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 |
Boolean, Integer
!= | ~ | 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