0 JBC
↳1 JBCToGraph (⇒, 167 ms)
↳2 JBCTerminationGraph
↳3 TerminationGraphToSCCProof (⇒, 0 ms)
↳4 JBCTerminationSCC
↳5 SCCToIntTRSProof (⇒, 106 ms)
↳6 intTRS
↳7 PolynomialOrderProcessor (⇔, 0 ms)
↳8 YES
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 rules. Obtained 16 IRules
P rules:
f253_0_twoWay_GE(EOS, matching1, i29, matching2, i29, i29) → f261_0_twoWay_GE(EOS, 1, i29, 1, i29, i29) | &&(=(matching1, 1), =(matching2, 1))
f261_0_twoWay_GE(EOS, matching1, i29, matching2, i29, i29) → f271_0_twoWay_Load(EOS, 1, i29, 1, i29) | &&(&&(>=(i29, 0), =(matching1, 1)), =(matching2, 1))
f271_0_twoWay_Load(EOS, matching1, i29, matching2, i29) → f280_0_twoWay_Store(EOS, 1, i29, 1, i29) | &&(=(matching1, 1), =(matching2, 1))
f280_0_twoWay_Store(EOS, matching1, i29, matching2, i29) → f291_0_twoWay_Load(EOS, 1, i29, 1, i29) | &&(=(matching1, 1), =(matching2, 1))
f291_0_twoWay_Load(EOS, matching1, i29, matching2, i29) → f328_0_twoWay_EQ(EOS, 1, i29, 1, i29, 1) | &&(=(matching1, 1), =(matching2, 1))
f328_0_twoWay_EQ(EOS, matching1, i29, matching2, i29, matching3) → f331_0_twoWay_Inc(EOS, 1, i29, 1, i29) | &&(&&(&&(>(1, 0), =(matching1, 1)), =(matching2, 1)), =(matching3, 1))
f331_0_twoWay_Inc(EOS, matching1, i29, matching2, i29) → f335_0_twoWay_JMP(EOS, 1, i29, 1, +(i29, -1)) | &&(&&(>=(i29, 0), =(matching1, 1)), =(matching2, 1))
f335_0_twoWay_JMP(EOS, matching1, i29, matching2, i42) → f337_0_twoWay_Load(EOS, 1, i29, 1, i42) | &&(=(matching1, 1), =(matching2, 1))
f337_0_twoWay_Load(EOS, matching1, i29, matching2, i42) → f338_0_twoWay_Load(EOS, 1, i29, 1, i42, i42) | &&(=(matching1, 1), =(matching2, 1))
f338_0_twoWay_Load(EOS, matching1, i29, matching2, i42, i42) → f341_0_twoWay_Load(EOS, 1, i29, i42, i42, 1) | &&(=(matching1, 1), =(matching2, 1))
f341_0_twoWay_Load(EOS, matching1, i29, i42, i42, matching2) → f343_0_twoWay_InvokeMethod(EOS, 1, i29, i42, 1, i42) | &&(=(matching1, 1), =(matching2, 1))
f343_0_twoWay_InvokeMethod(EOS, matching1, i29, i42, matching2, i42) → f345_0_twoWay_Load(EOS, 1, i42, 1, i42) | &&(=(matching1, 1), =(matching2, 1))
f343_0_twoWay_InvokeMethod(EOS, matching1, i29, i42, matching2, i42) → f345_1_twoWay_Load(EOS, 1, i29, i42, 1, i42, 1, i42) | &&(=(matching1, 1), =(matching2, 1))
f345_0_twoWay_Load(EOS, matching1, i42, matching2, i42) → f347_0_twoWay_Load(EOS, 1, i42, 1, i42) | &&(=(matching1, 1), =(matching2, 1))
f347_0_twoWay_Load(EOS, matching1, i42, matching2, i42) → f247_0_twoWay_Load(EOS, 1, i42, 1, i42) | &&(=(matching1, 1), =(matching2, 1))
f247_0_twoWay_Load(EOS, matching1, i25, matching2, i25) → f253_0_twoWay_GE(EOS, 1, i25, 1, i25, i25) | &&(=(matching1, 1), =(matching2, 1))
Combined rules. Obtained 2 IRules
P rules:
f253_0_twoWay_GE(EOS, 1, x1, 1, x1, x1) → f345_1_twoWay_Load(EOS, 1, x1, -(x1, 1), 1, -(x1, 1), 1, -(x1, 1)) | >(+(x1, 1), 0)
f253_0_twoWay_GE(EOS, 1, x1, 1, x1, x1) → f253_0_twoWay_GE(EOS, 1, -(x1, 1), 1, -(x1, 1), -(x1, 1)) | >(+(x1, 1), 0)
Filtered ground terms:
f253_0_twoWay_GE(x1, x2, x3, x4, x5, x6) → f253_0_twoWay_GE(x3, x5, x6)
Cond_f253_0_twoWay_GE(x1, x2, x3, x4, x5, x6, x7) → Cond_f253_0_twoWay_GE(x1, x4, x6, x7)
f345_1_twoWay_Load(x1, x2, x3, x4, x5, x6, x7, x8) → f345_1_twoWay_Load(x3, x4, x6, x8)
Cond_f253_0_twoWay_GE1(x1, x2, x3, x4, x5, x6, x7) → Cond_f253_0_twoWay_GE1(x1, x4, x6, x7)
Filtered duplicate terms:
f253_0_twoWay_GE(x1, x2, x3) → f253_0_twoWay_GE(x3)
Cond_f253_0_twoWay_GE(x1, x2, x3, x4) → Cond_f253_0_twoWay_GE(x1, x4)
f345_1_twoWay_Load(x1, x2, x3, x4) → f345_1_twoWay_Load(x4)
Cond_f253_0_twoWay_GE1(x1, x2, x3, x4) → Cond_f253_0_twoWay_GE1(x1, x4)
Filtered unneeded terms:
Cond_f253_0_twoWay_GE(x1, x2) → Cond_f253_0_twoWay_GE(x1)
Prepared 2 rules for path length conversion:
P rules:
f253_0_twoWay_GE(x1) → f345_1_twoWay_Load(-(x1, 1)) | >(+(x1, 1), 0)
f253_0_twoWay_GE(x1) → f253_0_twoWay_GE(-(x1, 1)) | >(+(x1, 1), 0)
Finished conversion. Obtained 1 rules.
P rules:
f253_0_twoWay_GE(x1) → f253_0_twoWay_GE(-(x1, 1)) | >(x1, -1)
Found the following polynomial interpretation:
Therefore the following rule(s) have been dropped: