0 JBC
↳1 JBCToGraph (⇒, 70 ms)
↳2 JBCTerminationGraph
↳3 TerminationGraphToSCCProof (⇒, 0 ms)
↳4 JBCTerminationSCC
↳5 SCCToIDPv1Proof (⇒, 60 ms)
↳6 IDP
↳7 IDPNonInfProof (⇒, 90 ms)
↳8 AND
↳9 IDP
↳10 IDependencyGraphProof (⇔, 0 ms)
↳11 TRUE
↳12 IDP
↳13 IDependencyGraphProof (⇔, 0 ms)
↳14 TRUE
public class TerminatorRec02 {
public static void main(String[] args) {
fact(args.length);
}
public static int fact(int x) {
if (x > 1) {
int y = fact(x - 1);
return y * x;
}
return 1;
}
}
Generated 10 rules for P and 17 rules for R.
P rules:
68_0_fact_ConstantStackPush(EOS(STATIC_68), i1, i1) → 69_0_fact_LE(EOS(STATIC_69), i1, i1, 1)
69_0_fact_LE(EOS(STATIC_69), i8, i8, matching1) → 71_0_fact_LE(EOS(STATIC_71), i8, i8, 1) | =(matching1, 1)
71_0_fact_LE(EOS(STATIC_71), i8, i8, matching1) → 74_0_fact_Load(EOS(STATIC_74), i8) | &&(>(i8, 1), =(matching1, 1))
74_0_fact_Load(EOS(STATIC_74), i8) → 78_0_fact_ConstantStackPush(EOS(STATIC_78), i8, i8)
78_0_fact_ConstantStackPush(EOS(STATIC_78), i8, i8) → 84_0_fact_IntArithmetic(EOS(STATIC_84), i8, i8, 1)
84_0_fact_IntArithmetic(EOS(STATIC_84), i8, i8, matching1) → 96_0_fact_InvokeMethod(EOS(STATIC_96), i8, -(i8, 1)) | &&(>(i8, 0), =(matching1, 1))
96_0_fact_InvokeMethod(EOS(STATIC_96), i8, i12) → 100_1_fact_InvokeMethod(100_0_fact_Load(EOS(STATIC_100), i12), i8, i12)
100_0_fact_Load(EOS(STATIC_100), i12) → 105_0_fact_Load(EOS(STATIC_105), i12)
105_0_fact_Load(EOS(STATIC_105), i12) → 65_0_fact_Load(EOS(STATIC_65), i12)
65_0_fact_Load(EOS(STATIC_65), i1) → 68_0_fact_ConstantStackPush(EOS(STATIC_68), i1, i1)
R rules:
69_0_fact_LE(EOS(STATIC_69), i7, i7, matching1) → 70_0_fact_LE(EOS(STATIC_70), i7, i7, 1) | =(matching1, 1)
70_0_fact_LE(EOS(STATIC_70), i7, i7, matching1) → 72_0_fact_ConstantStackPush(EOS(STATIC_72)) | &&(<=(i7, 1), =(matching1, 1))
72_0_fact_ConstantStackPush(EOS(STATIC_72)) → 76_0_fact_Return(EOS(STATIC_76), 1)
100_1_fact_InvokeMethod(76_0_fact_Return(EOS(STATIC_76), matching1), i8, matching2) → 120_0_fact_Return(EOS(STATIC_120), i8, 1, 1) | &&(=(matching1, 1), =(matching2, 1))
100_1_fact_InvokeMethod(131_0_fact_Return(EOS(STATIC_131)), i8, i22) → 146_0_fact_Return(EOS(STATIC_146), i8, i22)
100_1_fact_InvokeMethod(167_0_fact_Return(EOS(STATIC_167)), i8, i30) → 186_0_fact_Return(EOS(STATIC_186), i8, i30)
120_0_fact_Return(EOS(STATIC_120), i8, matching1, matching2) → 122_0_fact_Store(EOS(STATIC_122), i8, 1) | &&(=(matching1, 1), =(matching2, 1))
122_0_fact_Store(EOS(STATIC_122), i8, matching1) → 124_0_fact_Load(EOS(STATIC_124), i8, 1) | =(matching1, 1)
124_0_fact_Load(EOS(STATIC_124), i8, matching1) → 126_0_fact_Load(EOS(STATIC_126), i8, 1) | =(matching1, 1)
126_0_fact_Load(EOS(STATIC_126), i8, matching1) → 129_0_fact_IntArithmetic(EOS(STATIC_129), 1, i8) | =(matching1, 1)
129_0_fact_IntArithmetic(EOS(STATIC_129), matching1, i8) → 131_0_fact_Return(EOS(STATIC_131)) | &&(>(i8, 1), =(matching1, 1))
146_0_fact_Return(EOS(STATIC_146), i8, i22) → 152_0_fact_Store(EOS(STATIC_152), i8)
152_0_fact_Store(EOS(STATIC_152), i8) → 157_0_fact_Load(EOS(STATIC_157), i8)
157_0_fact_Load(EOS(STATIC_157), i8) → 162_0_fact_Load(EOS(STATIC_162), i8)
162_0_fact_Load(EOS(STATIC_162), i8) → 164_0_fact_IntArithmetic(EOS(STATIC_164), i8)
164_0_fact_IntArithmetic(EOS(STATIC_164), i8) → 167_0_fact_Return(EOS(STATIC_167)) | >(i8, 1)
186_0_fact_Return(EOS(STATIC_186), i8, i30) → 146_0_fact_Return(EOS(STATIC_146), i8, i30)
Combined rules. Obtained 1 conditional rules for P and 3 conditional rules for R.
P rules:
68_0_fact_ConstantStackPush(EOS(STATIC_68), x0, x0) → 100_1_fact_InvokeMethod(68_0_fact_ConstantStackPush(EOS(STATIC_68), -(x0, 1), -(x0, 1)), x0, -(x0, 1)) | >(x0, 1)
R rules:
100_1_fact_InvokeMethod(76_0_fact_Return(EOS(STATIC_76), 1), x1, 1) → 131_0_fact_Return(EOS(STATIC_131)) | >(x1, 1)
100_1_fact_InvokeMethod(131_0_fact_Return(EOS(STATIC_131)), x0, x1) → 167_0_fact_Return(EOS(STATIC_167)) | >(x0, 1)
100_1_fact_InvokeMethod(167_0_fact_Return(EOS(STATIC_167)), x0, x1) → 167_0_fact_Return(EOS(STATIC_167)) | >(x0, 1)
Filtered ground terms:
68_0_fact_ConstantStackPush(x1, x2, x3) → 68_0_fact_ConstantStackPush(x2, x3)
Cond_68_0_fact_ConstantStackPush(x1, x2, x3, x4) → Cond_68_0_fact_ConstantStackPush(x1, x3, x4)
167_0_fact_Return(x1) → 167_0_fact_Return
Cond_100_1_fact_InvokeMethod2(x1, x2, x3, x4) → Cond_100_1_fact_InvokeMethod2(x1, x3, x4)
Cond_100_1_fact_InvokeMethod1(x1, x2, x3, x4) → Cond_100_1_fact_InvokeMethod1(x1, x3, x4)
131_0_fact_Return(x1) → 131_0_fact_Return
Cond_100_1_fact_InvokeMethod(x1, x2, x3, x4) → Cond_100_1_fact_InvokeMethod(x1, x3)
76_0_fact_Return(x1, x2) → 76_0_fact_Return
Filtered duplicate args:
68_0_fact_ConstantStackPush(x1, x2) → 68_0_fact_ConstantStackPush(x2)
Cond_68_0_fact_ConstantStackPush(x1, x2, x3) → Cond_68_0_fact_ConstantStackPush(x1, x3)
Filtered unneeded arguments:
Cond_100_1_fact_InvokeMethod(x1, x2) → Cond_100_1_fact_InvokeMethod(x1)
Cond_100_1_fact_InvokeMethod1(x1, x2, x3) → Cond_100_1_fact_InvokeMethod1(x1)
Cond_100_1_fact_InvokeMethod2(x1, x2, x3) → Cond_100_1_fact_InvokeMethod2(x1)
Combined rules. Obtained 1 conditional rules for P and 3 conditional rules for R.
P rules:
68_0_fact_ConstantStackPush(x0) → 100_1_fact_InvokeMethod(68_0_fact_ConstantStackPush(-(x0, 1)), x0, -(x0, 1)) | >(x0, 1)
R rules:
100_1_fact_InvokeMethod(76_0_fact_Return, x1, 1) → 131_0_fact_Return | >(x1, 1)
100_1_fact_InvokeMethod(131_0_fact_Return, x0, x1) → 167_0_fact_Return | >(x0, 1)
100_1_fact_InvokeMethod(167_0_fact_Return, x0, x1) → 167_0_fact_Return | >(x0, 1)
Performed bisimulation on rules. Used the following equivalence classes: {[76_0_fact_Return, 131_0_fact_Return, 167_0_fact_Return]=76_0_fact_Return, [Cond_100_1_fact_InvokeMethod1_4, Cond_100_1_fact_InvokeMethod2_4]=Cond_100_1_fact_InvokeMethod1_4}
Finished conversion. Obtained 2 rules for P and 4 rules for R. System has predefined symbols.
P rules:
68_0_FACT_CONSTANTSTACKPUSH(x0) → COND_68_0_FACT_CONSTANTSTACKPUSH(>(x0, 1), x0)
COND_68_0_FACT_CONSTANTSTACKPUSH(TRUE, x0) → 68_0_FACT_CONSTANTSTACKPUSH(-(x0, 1))
R rules:
100_1_fact_InvokeMethod(76_0_fact_Return, x1, 1) → Cond_100_1_fact_InvokeMethod(>(x1, 1), 76_0_fact_Return, x1, 1)
Cond_100_1_fact_InvokeMethod(TRUE, 76_0_fact_Return, x1, 1) → 76_0_fact_Return
100_1_fact_InvokeMethod(76_0_fact_Return, x0, x1) → Cond_100_1_fact_InvokeMethod1(>(x0, 1), 76_0_fact_Return, x0, x1)
Cond_100_1_fact_InvokeMethod1(TRUE, 76_0_fact_Return, x0, x1) → 76_0_fact_Return
!= | ~ | 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 (x0[0] > 1 ∧x0[0] →* x0[1])
(1) -> (0), if (x0[1] - 1 →* x0[0])
(1) (>(x0[0], 1)=TRUE∧x0[0]=x0[1] ⇒ 68_0_FACT_CONSTANTSTACKPUSH(x0[0])≥NonInfC∧68_0_FACT_CONSTANTSTACKPUSH(x0[0])≥COND_68_0_FACT_CONSTANTSTACKPUSH(>(x0[0], 1), x0[0])∧(UIncreasing(COND_68_0_FACT_CONSTANTSTACKPUSH(>(x0[0], 1), x0[0])), ≥))
(2) (>(x0[0], 1)=TRUE ⇒ 68_0_FACT_CONSTANTSTACKPUSH(x0[0])≥NonInfC∧68_0_FACT_CONSTANTSTACKPUSH(x0[0])≥COND_68_0_FACT_CONSTANTSTACKPUSH(>(x0[0], 1), x0[0])∧(UIncreasing(COND_68_0_FACT_CONSTANTSTACKPUSH(>(x0[0], 1), x0[0])), ≥))
(3) (x0[0] + [-2] ≥ 0 ⇒ (UIncreasing(COND_68_0_FACT_CONSTANTSTACKPUSH(>(x0[0], 1), x0[0])), ≥)∧[(-1)Bound*bni_15] + [(2)bni_15]x0[0] ≥ 0∧[(-1)bso_16] ≥ 0)
(4) (x0[0] + [-2] ≥ 0 ⇒ (UIncreasing(COND_68_0_FACT_CONSTANTSTACKPUSH(>(x0[0], 1), x0[0])), ≥)∧[(-1)Bound*bni_15] + [(2)bni_15]x0[0] ≥ 0∧[(-1)bso_16] ≥ 0)
(5) (x0[0] + [-2] ≥ 0 ⇒ (UIncreasing(COND_68_0_FACT_CONSTANTSTACKPUSH(>(x0[0], 1), x0[0])), ≥)∧[(-1)Bound*bni_15] + [(2)bni_15]x0[0] ≥ 0∧[(-1)bso_16] ≥ 0)
(6) (x0[0] ≥ 0 ⇒ (UIncreasing(COND_68_0_FACT_CONSTANTSTACKPUSH(>(x0[0], 1), x0[0])), ≥)∧[(-1)Bound*bni_15 + (4)bni_15] + [(2)bni_15]x0[0] ≥ 0∧[(-1)bso_16] ≥ 0)
(7) (COND_68_0_FACT_CONSTANTSTACKPUSH(TRUE, x0[1])≥NonInfC∧COND_68_0_FACT_CONSTANTSTACKPUSH(TRUE, x0[1])≥68_0_FACT_CONSTANTSTACKPUSH(-(x0[1], 1))∧(UIncreasing(68_0_FACT_CONSTANTSTACKPUSH(-(x0[1], 1))), ≥))
(8) ((UIncreasing(68_0_FACT_CONSTANTSTACKPUSH(-(x0[1], 1))), ≥)∧[bni_17] = 0∧[2 + (-1)bso_18] ≥ 0)
(9) ((UIncreasing(68_0_FACT_CONSTANTSTACKPUSH(-(x0[1], 1))), ≥)∧[bni_17] = 0∧[2 + (-1)bso_18] ≥ 0)
(10) ((UIncreasing(68_0_FACT_CONSTANTSTACKPUSH(-(x0[1], 1))), ≥)∧[bni_17] = 0∧[2 + (-1)bso_18] ≥ 0)
(11) ((UIncreasing(68_0_FACT_CONSTANTSTACKPUSH(-(x0[1], 1))), ≥)∧[bni_17] = 0∧0 = 0∧[2 + (-1)bso_18] ≥ 0)
POL(TRUE) = 0
POL(FALSE) = 0
POL(100_1_fact_InvokeMethod(x1, x2, x3)) = [-1] + [-1]x2
POL(76_0_fact_Return) = [-1]
POL(1) = [1]
POL(Cond_100_1_fact_InvokeMethod(x1, x2, x3, x4)) = [-1] + [-1]x3
POL(>(x1, x2)) = [-1]
POL(Cond_100_1_fact_InvokeMethod1(x1, x2, x3, x4)) = [-1] + [-1]x3
POL(68_0_FACT_CONSTANTSTACKPUSH(x1)) = [2]x1
POL(COND_68_0_FACT_CONSTANTSTACKPUSH(x1, x2)) = [2]x2
POL(-(x1, x2)) = x1 + [-1]x2
COND_68_0_FACT_CONSTANTSTACKPUSH(TRUE, x0[1]) → 68_0_FACT_CONSTANTSTACKPUSH(-(x0[1], 1))
68_0_FACT_CONSTANTSTACKPUSH(x0[0]) → COND_68_0_FACT_CONSTANTSTACKPUSH(>(x0[0], 1), x0[0])
68_0_FACT_CONSTANTSTACKPUSH(x0[0]) → COND_68_0_FACT_CONSTANTSTACKPUSH(>(x0[0], 1), 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 |
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