0 JBC
↳1 JBCToGraph (⇒, 110 ms)
↳2 JBCTerminationGraph
↳3 TerminationGraphToSCCProof (⇒, 0 ms)
↳4 JBCTerminationSCC
↳5 SCCToIDPv1Proof (⇒, 130 ms)
↳6 IDP
↳7 IDPNonInfProof (⇒, 130 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:
259_0_twoWay_GE(EOS(STATIC_259), matching1, i27, i27) → 263_0_twoWay_GE(EOS(STATIC_263), 1, i27, i27) | =(matching1, 1)
263_0_twoWay_GE(EOS(STATIC_263), matching1, i27, i27) → 266_0_twoWay_Load(EOS(STATIC_266), 1, i27) | &&(>=(i27, 0), =(matching1, 1))
266_0_twoWay_Load(EOS(STATIC_266), matching1, i27) → 272_0_twoWay_Store(EOS(STATIC_272), 1, i27) | =(matching1, 1)
272_0_twoWay_Store(EOS(STATIC_272), matching1, i27) → 277_0_twoWay_Load(EOS(STATIC_277), 1, i27) | =(matching1, 1)
277_0_twoWay_Load(EOS(STATIC_277), matching1, i27) → 284_0_twoWay_EQ(EOS(STATIC_284), 1, i27, 1) | =(matching1, 1)
284_0_twoWay_EQ(EOS(STATIC_284), matching1, i27, matching2) → 287_0_twoWay_Inc(EOS(STATIC_287), 1, i27) | &&(&&(>(1, 0), =(matching1, 1)), =(matching2, 1))
287_0_twoWay_Inc(EOS(STATIC_287), matching1, i27) → 289_0_twoWay_JMP(EOS(STATIC_289), 1, +(i27, -1)) | &&(>=(i27, 0), =(matching1, 1))
289_0_twoWay_JMP(EOS(STATIC_289), matching1, i32) → 291_0_twoWay_Load(EOS(STATIC_291), 1, i32) | =(matching1, 1)
291_0_twoWay_Load(EOS(STATIC_291), matching1, i32) → 293_0_twoWay_Load(EOS(STATIC_293), 1, i32, i32) | =(matching1, 1)
293_0_twoWay_Load(EOS(STATIC_293), matching1, i32, i32) → 295_0_twoWay_Load(EOS(STATIC_295), i32, i32, 1) | =(matching1, 1)
295_0_twoWay_Load(EOS(STATIC_295), i32, i32, matching1) → 297_0_twoWay_InvokeMethod(EOS(STATIC_297), i32, 1, i32) | =(matching1, 1)
297_0_twoWay_InvokeMethod(EOS(STATIC_297), i32, matching1, i32) → 299_1_twoWay_InvokeMethod(299_0_twoWay_Load(EOS(STATIC_299), 1, i32), i32, 1, i32) | =(matching1, 1)
299_0_twoWay_Load(EOS(STATIC_299), matching1, i32) → 301_0_twoWay_Load(EOS(STATIC_301), 1, i32) | =(matching1, 1)
301_0_twoWay_Load(EOS(STATIC_301), matching1, i32) → 254_0_twoWay_Load(EOS(STATIC_254), 1, i32) | =(matching1, 1)
254_0_twoWay_Load(EOS(STATIC_254), matching1, i25) → 259_0_twoWay_GE(EOS(STATIC_259), 1, i25, i25) | =(matching1, 1)
R rules:
259_0_twoWay_GE(EOS(STATIC_259), matching1, matching2, matching3) → 261_0_twoWay_GE(EOS(STATIC_261), 1, -1, -1) | &&(&&(=(matching1, 1), =(matching2, -1)), =(matching3, -1))
261_0_twoWay_GE(EOS(STATIC_261), matching1, matching2, matching3) → 264_0_twoWay_ConstantStackPush(EOS(STATIC_264), 1, -1) | &&(&&(&&(<(-1, 0), =(matching1, 1)), =(matching2, -1)), =(matching3, -1))
264_0_twoWay_ConstantStackPush(EOS(STATIC_264), matching1, matching2) → 270_0_twoWay_Return(EOS(STATIC_270), 1, -1, 1) | &&(=(matching1, 1), =(matching2, -1))
299_1_twoWay_InvokeMethod(270_0_twoWay_Return(EOS(STATIC_270), matching1, matching2, matching3), matching4, matching5, matching6) → 309_0_twoWay_Return(EOS(STATIC_309), -1, 1, -1, 1, -1, 1) | &&(&&(&&(&&(&&(=(matching1, 1), =(matching2, -1)), =(matching3, 1)), =(matching4, -1)), =(matching5, 1)), =(matching6, -1))
299_1_twoWay_InvokeMethod(313_0_twoWay_Return(EOS(STATIC_313), matching1), i43, matching2, i43) → 326_0_twoWay_Return(EOS(STATIC_326), i43, 1, i43, -1) | &&(=(matching1, -1), =(matching2, 1))
299_1_twoWay_InvokeMethod(337_0_twoWay_Return(EOS(STATIC_337), i46), i56, matching1, i56) → 370_0_twoWay_Return(EOS(STATIC_370), i56, 1, i56, i46) | =(matching1, 1)
299_1_twoWay_InvokeMethod(383_0_twoWay_Return(EOS(STATIC_383), i72), i81, matching1, i81) → 403_0_twoWay_Return(EOS(STATIC_403), i81, 1, i81, i72) | =(matching1, 1)
309_0_twoWay_Return(EOS(STATIC_309), matching1, matching2, matching3, matching4, matching5, matching6) → 311_0_twoWay_IntArithmetic(EOS(STATIC_311), -1, 1) | &&(&&(&&(&&(&&(=(matching1, -1), =(matching2, 1)), =(matching3, -1)), =(matching4, 1)), =(matching5, -1)), =(matching6, 1))
311_0_twoWay_IntArithmetic(EOS(STATIC_311), matching1, matching2) → 313_0_twoWay_Return(EOS(STATIC_313), -1) | &&(=(matching1, -1), =(matching2, 1))
313_0_twoWay_Return(EOS(STATIC_313), matching1) → 337_0_twoWay_Return(EOS(STATIC_337), -1) | =(matching1, -1)
326_0_twoWay_Return(EOS(STATIC_326), i43, matching1, i43, matching2) → 371_0_twoWay_Return(EOS(STATIC_371), i43, 1, i43, -1) | &&(=(matching1, 1), =(matching2, -1))
337_0_twoWay_Return(EOS(STATIC_337), i46) → 383_0_twoWay_Return(EOS(STATIC_383), i46)
370_0_twoWay_Return(EOS(STATIC_370), i56, matching1, i56, i46) → 371_0_twoWay_Return(EOS(STATIC_371), i56, 1, i56, i46) | =(matching1, 1)
371_0_twoWay_Return(EOS(STATIC_371), i65, matching1, i65, i64) → 376_0_twoWay_IntArithmetic(EOS(STATIC_376), i65, i64) | =(matching1, 1)
376_0_twoWay_IntArithmetic(EOS(STATIC_376), i65, i64) → 383_0_twoWay_Return(EOS(STATIC_383), *(i65, i64)) | <(i64, 1)
403_0_twoWay_Return(EOS(STATIC_403), i81, matching1, i81, i72) → 371_0_twoWay_Return(EOS(STATIC_371), i81, 1, i81, i72) | =(matching1, 1)
Combined rules. Obtained 1 conditional rules for P and 5 conditional rules for R.
P rules:
259_0_twoWay_GE(EOS(STATIC_259), 1, x1, x1) → 299_1_twoWay_InvokeMethod(259_0_twoWay_GE(EOS(STATIC_259), 1, +(x1, -1), +(x1, -1)), +(x1, -1), 1, +(x1, -1)) | >(+(x1, 1), 0)
R rules:
259_0_twoWay_GE(EOS(STATIC_259), 1, -1, -1) → 270_0_twoWay_Return(EOS(STATIC_270), 1, -1, 1)
299_1_twoWay_InvokeMethod(270_0_twoWay_Return(EOS(STATIC_270), 1, -1, 1), -1, 1, -1) → 383_0_twoWay_Return(EOS(STATIC_383), -1)
299_1_twoWay_InvokeMethod(313_0_twoWay_Return(EOS(STATIC_313), -1), x1, 1, x1) → 383_0_twoWay_Return(EOS(STATIC_383), *(x1, -1))
299_1_twoWay_InvokeMethod(337_0_twoWay_Return(EOS(STATIC_337), x0), x1, 1, x1) → 383_0_twoWay_Return(EOS(STATIC_383), *(x1, x0)) | <(x0, 1)
299_1_twoWay_InvokeMethod(383_0_twoWay_Return(EOS(STATIC_383), x0), x1, 1, x1) → 383_0_twoWay_Return(EOS(STATIC_383), *(x1, x0)) | <(x0, 1)
Filtered ground terms:
299_1_twoWay_InvokeMethod(x1, x2, x3, x4) → 299_1_twoWay_InvokeMethod(x1, x2, x4)
259_0_twoWay_GE(x1, x2, x3, x4) → 259_0_twoWay_GE(x3, x4)
Cond_259_0_twoWay_GE(x1, x2, x3, x4, x5) → Cond_259_0_twoWay_GE(x1, x4, x5)
383_0_twoWay_Return(x1, x2) → 383_0_twoWay_Return(x2)
Cond_299_1_twoWay_InvokeMethod1(x1, x2, x3, x4, x5) → Cond_299_1_twoWay_InvokeMethod1(x1, x2, x3, x5)
Cond_299_1_twoWay_InvokeMethod(x1, x2, x3, x4, x5) → Cond_299_1_twoWay_InvokeMethod(x1, x2, x3, x5)
337_0_twoWay_Return(x1, x2) → 337_0_twoWay_Return(x2)
313_0_twoWay_Return(x1, x2) → 313_0_twoWay_Return
270_0_twoWay_Return(x1, x2, x3, x4) → 270_0_twoWay_Return
Filtered duplicate args:
259_0_twoWay_GE(x1, x2) → 259_0_twoWay_GE(x2)
Cond_259_0_twoWay_GE(x1, x2, x3) → Cond_259_0_twoWay_GE(x1, x3)
299_1_twoWay_InvokeMethod(x1, x2, x3) → 299_1_twoWay_InvokeMethod(x1, x3)
Cond_299_1_twoWay_InvokeMethod(x1, x2, x3, x4) → Cond_299_1_twoWay_InvokeMethod(x1, x2, x4)
Cond_299_1_twoWay_InvokeMethod1(x1, x2, x3, x4) → Cond_299_1_twoWay_InvokeMethod1(x1, x2, x4)
Combined rules. Obtained 1 conditional rules for P and 5 conditional rules for R.
P rules:
259_0_twoWay_GE(x1) → 299_1_twoWay_InvokeMethod(259_0_twoWay_GE(+(x1, -1)), +(x1, -1)) | >(x1, -1)
R rules:
259_0_twoWay_GE(-1) → 270_0_twoWay_Return
299_1_twoWay_InvokeMethod(270_0_twoWay_Return, -1) → 383_0_twoWay_Return(-1)
299_1_twoWay_InvokeMethod(313_0_twoWay_Return, x1) → 383_0_twoWay_Return(*(x1, -1))
299_1_twoWay_InvokeMethod(337_0_twoWay_Return(x0), x1) → 383_0_twoWay_Return(*(x1, x0)) | <(x0, 1)
299_1_twoWay_InvokeMethod(383_0_twoWay_Return(x0), x1) → 383_0_twoWay_Return(*(x1, x0)) | <(x0, 1)
Performed bisimulation on rules. Used the following equivalence classes: {[270_0_twoWay_Return, 313_0_twoWay_Return]=270_0_twoWay_Return}
Finished conversion. Obtained 2 rules for P and 7 rules for R. System has predefined symbols.
P rules:
259_0_TWOWAY_GE(x1) → COND_259_0_TWOWAY_GE(>(x1, -1), x1)
COND_259_0_TWOWAY_GE(TRUE, x1) → 259_0_TWOWAY_GE(+(x1, -1))
R rules:
259_0_twoWay_GE(-1) → 270_0_twoWay_Return
299_1_twoWay_InvokeMethod(270_0_twoWay_Return, -1) → 383_0_twoWay_Return(-1)
299_1_twoWay_InvokeMethod(270_0_twoWay_Return, x1) → 383_0_twoWay_Return(*(x1, -1))
299_1_twoWay_InvokeMethod(337_0_twoWay_Return(x0), x1) → Cond_299_1_twoWay_InvokeMethod(<(x0, 1), 337_0_twoWay_Return(x0), x1)
Cond_299_1_twoWay_InvokeMethod(TRUE, 337_0_twoWay_Return(x0), x1) → 383_0_twoWay_Return(*(x1, x0))
299_1_twoWay_InvokeMethod(383_0_twoWay_Return(x0), x1) → Cond_299_1_twoWay_InvokeMethod1(<(x0, 1), 383_0_twoWay_Return(x0), x1)
Cond_299_1_twoWay_InvokeMethod1(TRUE, 383_0_twoWay_Return(x0), x1) → 383_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] ⇒ 259_0_TWOWAY_GE(x1[0])≥NonInfC∧259_0_TWOWAY_GE(x1[0])≥COND_259_0_TWOWAY_GE(>(x1[0], -1), x1[0])∧(UIncreasing(COND_259_0_TWOWAY_GE(>(x1[0], -1), x1[0])), ≥))
(2) (>(x1[0], -1)=TRUE ⇒ 259_0_TWOWAY_GE(x1[0])≥NonInfC∧259_0_TWOWAY_GE(x1[0])≥COND_259_0_TWOWAY_GE(>(x1[0], -1), x1[0])∧(UIncreasing(COND_259_0_TWOWAY_GE(>(x1[0], -1), x1[0])), ≥))
(3) (x1[0] ≥ 0 ⇒ (UIncreasing(COND_259_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_259_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_259_0_TWOWAY_GE(>(x1[0], -1), x1[0])), ≥)∧[(-1)Bound*bni_16] + [(2)bni_16]x1[0] ≥ 0∧[(-1)bso_17] ≥ 0)
(6) (COND_259_0_TWOWAY_GE(TRUE, x1[1])≥NonInfC∧COND_259_0_TWOWAY_GE(TRUE, x1[1])≥259_0_TWOWAY_GE(+(x1[1], -1))∧(UIncreasing(259_0_TWOWAY_GE(+(x1[1], -1))), ≥))
(7) ((UIncreasing(259_0_TWOWAY_GE(+(x1[1], -1))), ≥)∧[bni_18] = 0∧[2 + (-1)bso_19] ≥ 0)
(8) ((UIncreasing(259_0_TWOWAY_GE(+(x1[1], -1))), ≥)∧[bni_18] = 0∧[2 + (-1)bso_19] ≥ 0)
(9) ((UIncreasing(259_0_TWOWAY_GE(+(x1[1], -1))), ≥)∧[bni_18] = 0∧[2 + (-1)bso_19] ≥ 0)
(10) ((UIncreasing(259_0_TWOWAY_GE(+(x1[1], -1))), ≥)∧[bni_18] = 0∧0 = 0∧[2 + (-1)bso_19] ≥ 0)
POL(TRUE) = 0
POL(FALSE) = 0
POL(259_0_twoWay_GE(x1)) = [-1]
POL(-1) = [-1]
POL(270_0_twoWay_Return) = [-1]
POL(299_1_twoWay_InvokeMethod(x1, x2)) = [-1] + [-1]x2 + [-1]x1
POL(383_0_twoWay_Return(x1)) = x1
POL(*(x1, x2)) = x1·x2
POL(337_0_twoWay_Return(x1)) = x1
POL(Cond_299_1_twoWay_InvokeMethod(x1, x2, x3)) = [-1] + [-1]x3 + [-1]x2
POL(<(x1, x2)) = [-1]
POL(1) = [1]
POL(Cond_299_1_twoWay_InvokeMethod1(x1, x2, x3)) = [-1] + [-1]x3 + [-1]x2
POL(259_0_TWOWAY_GE(x1)) = [2]x1
POL(COND_259_0_TWOWAY_GE(x1, x2)) = [2]x2
POL(>(x1, x2)) = [-1]
POL(+(x1, x2)) = x1 + x2
COND_259_0_TWOWAY_GE(TRUE, x1[1]) → 259_0_TWOWAY_GE(+(x1[1], -1))
259_0_TWOWAY_GE(x1[0]) → COND_259_0_TWOWAY_GE(>(x1[0], -1), x1[0])
259_0_TWOWAY_GE(x1[0]) → COND_259_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