0 JBC
↳1 JBCToGraph (⇒, 110 ms)
↳2 JBCTerminationGraph
↳3 TerminationGraphToSCCProof (⇒, 0 ms)
↳4 JBCTerminationSCC
↳5 SCCToIDPv1Proof (⇒, 120 ms)
↳6 IDP
↳7 IDPNonInfProof (⇒, 120 ms)
↳8 AND
↳9 IDP
↳10 IDependencyGraphProof (⇔, 0 ms)
↳11 TRUE
↳12 IDP
↳13 IDependencyGraphProof (⇔, 0 ms)
↳14 TRUE
package TwoWay;
public class Random {
static String[] args;
static int index = 0;
public static int random() {
final String string = args[index];
index++;
return string.length();
}
}
package TwoWay;
public class TwoWay {
public static void main(String[] args) {
Random.args = args;
twoWay(true, Random.random());
}
public static int twoWay(boolean terminate, int n) {
if (n < 0) {
return 1;
} else {
int m = n;
if (terminate) {
m--;
} else {
m++;
}
return m*twoWay(terminate, m);
}
}
}
Generated 15 rules for P and 16 rules for R.
P rules:
285_0_twoWay_GE(EOS(STATIC_285), matching1, i32, i32) → 289_0_twoWay_GE(EOS(STATIC_289), 1, i32, i32) | =(matching1, 1)
289_0_twoWay_GE(EOS(STATIC_289), matching1, i32, i32) → 293_0_twoWay_Load(EOS(STATIC_293), 1, i32) | &&(>=(i32, 0), =(matching1, 1))
293_0_twoWay_Load(EOS(STATIC_293), matching1, i32) → 298_0_twoWay_Store(EOS(STATIC_298), 1, i32) | =(matching1, 1)
298_0_twoWay_Store(EOS(STATIC_298), matching1, i32) → 304_0_twoWay_Load(EOS(STATIC_304), 1, i32) | =(matching1, 1)
304_0_twoWay_Load(EOS(STATIC_304), matching1, i32) → 313_0_twoWay_EQ(EOS(STATIC_313), 1, i32, 1) | =(matching1, 1)
313_0_twoWay_EQ(EOS(STATIC_313), matching1, i32, matching2) → 316_0_twoWay_Inc(EOS(STATIC_316), 1, i32) | &&(&&(>(1, 0), =(matching1, 1)), =(matching2, 1))
316_0_twoWay_Inc(EOS(STATIC_316), matching1, i32) → 319_0_twoWay_JMP(EOS(STATIC_319), 1, +(i32, -1)) | &&(>=(i32, 0), =(matching1, 1))
319_0_twoWay_JMP(EOS(STATIC_319), matching1, i36) → 321_0_twoWay_Load(EOS(STATIC_321), 1, i36) | =(matching1, 1)
321_0_twoWay_Load(EOS(STATIC_321), matching1, i36) → 323_0_twoWay_Load(EOS(STATIC_323), 1, i36, i36) | =(matching1, 1)
323_0_twoWay_Load(EOS(STATIC_323), matching1, i36, i36) → 325_0_twoWay_Load(EOS(STATIC_325), i36, i36, 1) | =(matching1, 1)
325_0_twoWay_Load(EOS(STATIC_325), i36, i36, matching1) → 327_0_twoWay_InvokeMethod(EOS(STATIC_327), i36, 1, i36) | =(matching1, 1)
327_0_twoWay_InvokeMethod(EOS(STATIC_327), i36, matching1, i36) → 329_1_twoWay_InvokeMethod(329_0_twoWay_Load(EOS(STATIC_329), 1, i36), i36, 1, i36) | =(matching1, 1)
329_0_twoWay_Load(EOS(STATIC_329), matching1, i36) → 331_0_twoWay_Load(EOS(STATIC_331), 1, i36) | =(matching1, 1)
331_0_twoWay_Load(EOS(STATIC_331), matching1, i36) → 279_0_twoWay_Load(EOS(STATIC_279), 1, i36) | =(matching1, 1)
279_0_twoWay_Load(EOS(STATIC_279), matching1, i28) → 285_0_twoWay_GE(EOS(STATIC_285), 1, i28, i28) | =(matching1, 1)
R rules:
285_0_twoWay_GE(EOS(STATIC_285), matching1, matching2, matching3) → 287_0_twoWay_GE(EOS(STATIC_287), 1, -1, -1) | &&(&&(=(matching1, 1), =(matching2, -1)), =(matching3, -1))
287_0_twoWay_GE(EOS(STATIC_287), matching1, matching2, matching3) → 291_0_twoWay_ConstantStackPush(EOS(STATIC_291), 1, -1) | &&(&&(&&(<(-1, 0), =(matching1, 1)), =(matching2, -1)), =(matching3, -1))
291_0_twoWay_ConstantStackPush(EOS(STATIC_291), matching1, matching2) → 295_0_twoWay_Return(EOS(STATIC_295), 1, -1, 1) | &&(=(matching1, 1), =(matching2, -1))
329_1_twoWay_InvokeMethod(295_0_twoWay_Return(EOS(STATIC_295), matching1, matching2, matching3), matching4, matching5, matching6) → 339_0_twoWay_Return(EOS(STATIC_339), -1, 1, -1, 1, -1, 1) | &&(&&(&&(&&(&&(=(matching1, 1), =(matching2, -1)), =(matching3, 1)), =(matching4, -1)), =(matching5, 1)), =(matching6, -1))
329_1_twoWay_InvokeMethod(343_0_twoWay_Return(EOS(STATIC_343), matching1), i48, matching2, i48) → 355_0_twoWay_Return(EOS(STATIC_355), i48, 1, i48, -1) | &&(=(matching1, -1), =(matching2, 1))
329_1_twoWay_InvokeMethod(365_0_twoWay_Return(EOS(STATIC_365), i51), i61, matching1, i61) → 394_0_twoWay_Return(EOS(STATIC_394), i61, 1, i61, i51) | =(matching1, 1)
329_1_twoWay_InvokeMethod(406_0_twoWay_Return(EOS(STATIC_406), i76), i85, matching1, i85) → 425_0_twoWay_Return(EOS(STATIC_425), i85, 1, i85, i76) | =(matching1, 1)
339_0_twoWay_Return(EOS(STATIC_339), matching1, matching2, matching3, matching4, matching5, matching6) → 341_0_twoWay_IntArithmetic(EOS(STATIC_341), -1, 1) | &&(&&(&&(&&(&&(=(matching1, -1), =(matching2, 1)), =(matching3, -1)), =(matching4, 1)), =(matching5, -1)), =(matching6, 1))
341_0_twoWay_IntArithmetic(EOS(STATIC_341), matching1, matching2) → 343_0_twoWay_Return(EOS(STATIC_343), -1) | &&(=(matching1, -1), =(matching2, 1))
343_0_twoWay_Return(EOS(STATIC_343), matching1) → 365_0_twoWay_Return(EOS(STATIC_365), -1) | =(matching1, -1)
355_0_twoWay_Return(EOS(STATIC_355), i48, matching1, i48, matching2) → 395_0_twoWay_Return(EOS(STATIC_395), i48, 1, i48, -1) | &&(=(matching1, 1), =(matching2, -1))
365_0_twoWay_Return(EOS(STATIC_365), i51) → 406_0_twoWay_Return(EOS(STATIC_406), i51)
394_0_twoWay_Return(EOS(STATIC_394), i61, matching1, i61, i51) → 395_0_twoWay_Return(EOS(STATIC_395), i61, 1, i61, i51) | =(matching1, 1)
395_0_twoWay_Return(EOS(STATIC_395), i71, matching1, i71, i70) → 400_0_twoWay_IntArithmetic(EOS(STATIC_400), i71, i70) | =(matching1, 1)
400_0_twoWay_IntArithmetic(EOS(STATIC_400), i71, i70) → 406_0_twoWay_Return(EOS(STATIC_406), *(i71, i70)) | <(i70, 1)
425_0_twoWay_Return(EOS(STATIC_425), i85, matching1, i85, i76) → 395_0_twoWay_Return(EOS(STATIC_395), i85, 1, i85, i76) | =(matching1, 1)
Combined rules. Obtained 1 conditional rules for P and 5 conditional rules for R.
P rules:
285_0_twoWay_GE(EOS(STATIC_285), 1, x1, x1) → 329_1_twoWay_InvokeMethod(285_0_twoWay_GE(EOS(STATIC_285), 1, +(x1, -1), +(x1, -1)), +(x1, -1), 1, +(x1, -1)) | >(+(x1, 1), 0)
R rules:
285_0_twoWay_GE(EOS(STATIC_285), 1, -1, -1) → 295_0_twoWay_Return(EOS(STATIC_295), 1, -1, 1)
329_1_twoWay_InvokeMethod(295_0_twoWay_Return(EOS(STATIC_295), 1, -1, 1), -1, 1, -1) → 406_0_twoWay_Return(EOS(STATIC_406), -1)
329_1_twoWay_InvokeMethod(343_0_twoWay_Return(EOS(STATIC_343), -1), x1, 1, x1) → 406_0_twoWay_Return(EOS(STATIC_406), *(x1, -1))
329_1_twoWay_InvokeMethod(365_0_twoWay_Return(EOS(STATIC_365), x0), x1, 1, x1) → 406_0_twoWay_Return(EOS(STATIC_406), *(x1, x0)) | <(x0, 1)
329_1_twoWay_InvokeMethod(406_0_twoWay_Return(EOS(STATIC_406), x0), x1, 1, x1) → 406_0_twoWay_Return(EOS(STATIC_406), *(x1, x0)) | <(x0, 1)
Filtered ground terms:
329_1_twoWay_InvokeMethod(x1, x2, x3, x4) → 329_1_twoWay_InvokeMethod(x1, x2, x4)
285_0_twoWay_GE(x1, x2, x3, x4) → 285_0_twoWay_GE(x3, x4)
Cond_285_0_twoWay_GE(x1, x2, x3, x4, x5) → Cond_285_0_twoWay_GE(x1, x4, x5)
406_0_twoWay_Return(x1, x2) → 406_0_twoWay_Return(x2)
Cond_329_1_twoWay_InvokeMethod1(x1, x2, x3, x4, x5) → Cond_329_1_twoWay_InvokeMethod1(x1, x2, x3, x5)
Cond_329_1_twoWay_InvokeMethod(x1, x2, x3, x4, x5) → Cond_329_1_twoWay_InvokeMethod(x1, x2, x3, x5)
365_0_twoWay_Return(x1, x2) → 365_0_twoWay_Return(x2)
343_0_twoWay_Return(x1, x2) → 343_0_twoWay_Return
295_0_twoWay_Return(x1, x2, x3, x4) → 295_0_twoWay_Return
Filtered duplicate args:
285_0_twoWay_GE(x1, x2) → 285_0_twoWay_GE(x2)
Cond_285_0_twoWay_GE(x1, x2, x3) → Cond_285_0_twoWay_GE(x1, x3)
329_1_twoWay_InvokeMethod(x1, x2, x3) → 329_1_twoWay_InvokeMethod(x1, x3)
Cond_329_1_twoWay_InvokeMethod(x1, x2, x3, x4) → Cond_329_1_twoWay_InvokeMethod(x1, x2, x4)
Cond_329_1_twoWay_InvokeMethod1(x1, x2, x3, x4) → Cond_329_1_twoWay_InvokeMethod1(x1, x2, x4)
Combined rules. Obtained 1 conditional rules for P and 5 conditional rules for R.
P rules:
285_0_twoWay_GE(x1) → 329_1_twoWay_InvokeMethod(285_0_twoWay_GE(+(x1, -1)), +(x1, -1)) | >(x1, -1)
R rules:
285_0_twoWay_GE(-1) → 295_0_twoWay_Return
329_1_twoWay_InvokeMethod(295_0_twoWay_Return, -1) → 406_0_twoWay_Return(-1)
329_1_twoWay_InvokeMethod(343_0_twoWay_Return, x1) → 406_0_twoWay_Return(*(x1, -1))
329_1_twoWay_InvokeMethod(365_0_twoWay_Return(x0), x1) → 406_0_twoWay_Return(*(x1, x0)) | <(x0, 1)
329_1_twoWay_InvokeMethod(406_0_twoWay_Return(x0), x1) → 406_0_twoWay_Return(*(x1, x0)) | <(x0, 1)
Performed bisimulation on rules. Used the following equivalence classes: {[295_0_twoWay_Return, 343_0_twoWay_Return]=295_0_twoWay_Return}
Finished conversion. Obtained 2 rules for P and 7 rules for R. System has predefined symbols.
P rules:
285_0_TWOWAY_GE(x1) → COND_285_0_TWOWAY_GE(>(x1, -1), x1)
COND_285_0_TWOWAY_GE(TRUE, x1) → 285_0_TWOWAY_GE(+(x1, -1))
R rules:
285_0_twoWay_GE(-1) → 295_0_twoWay_Return
329_1_twoWay_InvokeMethod(295_0_twoWay_Return, -1) → 406_0_twoWay_Return(-1)
329_1_twoWay_InvokeMethod(295_0_twoWay_Return, x1) → 406_0_twoWay_Return(*(x1, -1))
329_1_twoWay_InvokeMethod(365_0_twoWay_Return(x0), x1) → Cond_329_1_twoWay_InvokeMethod(<(x0, 1), 365_0_twoWay_Return(x0), x1)
Cond_329_1_twoWay_InvokeMethod(TRUE, 365_0_twoWay_Return(x0), x1) → 406_0_twoWay_Return(*(x1, x0))
329_1_twoWay_InvokeMethod(406_0_twoWay_Return(x0), x1) → Cond_329_1_twoWay_InvokeMethod1(<(x0, 1), 406_0_twoWay_Return(x0), x1)
Cond_329_1_twoWay_InvokeMethod1(TRUE, 406_0_twoWay_Return(x0), x1) → 406_0_twoWay_Return(*(x1, x0))
!= | ~ | 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
(0) -> (1), if (x1[0] > -1 ∧x1[0] →* x1[1])
(1) -> (0), if (x1[1] + -1 →* x1[0])
(1) (>(x1[0], -1)=TRUE∧x1[0]=x1[1] ⇒ 285_0_TWOWAY_GE(x1[0])≥NonInfC∧285_0_TWOWAY_GE(x1[0])≥COND_285_0_TWOWAY_GE(>(x1[0], -1), x1[0])∧(UIncreasing(COND_285_0_TWOWAY_GE(>(x1[0], -1), x1[0])), ≥))
(2) (>(x1[0], -1)=TRUE ⇒ 285_0_TWOWAY_GE(x1[0])≥NonInfC∧285_0_TWOWAY_GE(x1[0])≥COND_285_0_TWOWAY_GE(>(x1[0], -1), x1[0])∧(UIncreasing(COND_285_0_TWOWAY_GE(>(x1[0], -1), x1[0])), ≥))
(3) (x1[0] ≥ 0 ⇒ (UIncreasing(COND_285_0_TWOWAY_GE(>(x1[0], -1), x1[0])), ≥)∧[(-1)Bound*bni_16] + [(2)bni_16]x1[0] ≥ 0∧[(-1)bso_17] ≥ 0)
(4) (x1[0] ≥ 0 ⇒ (UIncreasing(COND_285_0_TWOWAY_GE(>(x1[0], -1), x1[0])), ≥)∧[(-1)Bound*bni_16] + [(2)bni_16]x1[0] ≥ 0∧[(-1)bso_17] ≥ 0)
(5) (x1[0] ≥ 0 ⇒ (UIncreasing(COND_285_0_TWOWAY_GE(>(x1[0], -1), x1[0])), ≥)∧[(-1)Bound*bni_16] + [(2)bni_16]x1[0] ≥ 0∧[(-1)bso_17] ≥ 0)
(6) (COND_285_0_TWOWAY_GE(TRUE, x1[1])≥NonInfC∧COND_285_0_TWOWAY_GE(TRUE, x1[1])≥285_0_TWOWAY_GE(+(x1[1], -1))∧(UIncreasing(285_0_TWOWAY_GE(+(x1[1], -1))), ≥))
(7) ((UIncreasing(285_0_TWOWAY_GE(+(x1[1], -1))), ≥)∧[bni_18] = 0∧[2 + (-1)bso_19] ≥ 0)
(8) ((UIncreasing(285_0_TWOWAY_GE(+(x1[1], -1))), ≥)∧[bni_18] = 0∧[2 + (-1)bso_19] ≥ 0)
(9) ((UIncreasing(285_0_TWOWAY_GE(+(x1[1], -1))), ≥)∧[bni_18] = 0∧[2 + (-1)bso_19] ≥ 0)
(10) ((UIncreasing(285_0_TWOWAY_GE(+(x1[1], -1))), ≥)∧[bni_18] = 0∧0 = 0∧[2 + (-1)bso_19] ≥ 0)
POL(TRUE) = 0
POL(FALSE) = 0
POL(285_0_twoWay_GE(x1)) = [-1]
POL(-1) = [-1]
POL(295_0_twoWay_Return) = [-1]
POL(329_1_twoWay_InvokeMethod(x1, x2)) = [-1] + [-1]x2 + [-1]x1
POL(406_0_twoWay_Return(x1)) = x1
POL(*(x1, x2)) = x1·x2
POL(365_0_twoWay_Return(x1)) = x1
POL(Cond_329_1_twoWay_InvokeMethod(x1, x2, x3)) = [-1] + [-1]x3 + [-1]x2
POL(<(x1, x2)) = [-1]
POL(1) = [1]
POL(Cond_329_1_twoWay_InvokeMethod1(x1, x2, x3)) = [-1] + [-1]x3 + [-1]x2
POL(285_0_TWOWAY_GE(x1)) = [2]x1
POL(COND_285_0_TWOWAY_GE(x1, x2)) = [2]x2
POL(>(x1, x2)) = [-1]
POL(+(x1, x2)) = x1 + x2
COND_285_0_TWOWAY_GE(TRUE, x1[1]) → 285_0_TWOWAY_GE(+(x1[1], -1))
285_0_TWOWAY_GE(x1[0]) → COND_285_0_TWOWAY_GE(>(x1[0], -1), x1[0])
285_0_TWOWAY_GE(x1[0]) → COND_285_0_TWOWAY_GE(>(x1[0], -1), x1[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 |
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