0 JBC
↳1 JBCToGraph (⇒, 895 ms)
↳2 JBCTerminationGraph
↳3 TerminationGraphToSCCProof (⇒, 0 ms)
↳4 JBCTerminationSCC
↳5 SCCToIntTRSProof (⇒, 43 ms)
↳6 intTRS
↳7 TerminationGraphProcessor (⇒, 12 ms)
↳8 intTRS
↳9 PolynomialOrderProcessor (⇒, 0 ms)
↳10 intTRS
↳11 TerminationGraphProcessor (⇒, 0 ms)
↳12 intTRS
↳13 PolynomialOrderProcessor (⇔, 0 ms)
↳14 YES
public class GCD2 {
public static int mod(int a, int b) {
if (a == b) {
return 0;
}
while(a>b) {
a -= b;
}
return a;
}
public static int gcd(int a, int b) {
int tmp;
while(b != 0 && a >= 0 && b >= 0) {
tmp = b;
b = mod(a, b);
a = tmp;
}
return a;
}
public static void main(String[] args) {
Random.args = args;
int x = Random.random();
int y = Random.random();
gcd(x, y);
}
}
public class Random {
static String[] args;
static int index = 0;
public static int random() {
String string = args[index];
index++;
return string.length();
}
}
Generated rules. Obtained 43 IRules
P rules:
f1347_0_gcd_EQ(EOS, i182, i200, i200) → f1349_0_gcd_EQ(EOS, i182, i200, i200)
f1349_0_gcd_EQ(EOS, i182, i200, i200) → f1352_0_gcd_Load(EOS, i182, i200) | !(=(i200, 0))
f1352_0_gcd_Load(EOS, i182, i200) → f1355_0_gcd_LT(EOS, i182, i200, i182)
f1355_0_gcd_LT(EOS, i182, i200, i182) → f1359_0_gcd_Load(EOS, i182, i200) | >=(i182, 0)
f1359_0_gcd_Load(EOS, i182, i200) → f1364_0_gcd_LT(EOS, i182, i200, i200)
f1364_0_gcd_LT(EOS, i182, i207, i207) → f1369_0_gcd_LT(EOS, i182, i207, i207)
f1369_0_gcd_LT(EOS, i182, i207, i207) → f1378_0_gcd_Load(EOS, i182, i207) | >=(i207, 0)
f1378_0_gcd_Load(EOS, i182, i207) → f1382_0_gcd_Store(EOS, i182, i207, i207)
f1382_0_gcd_Store(EOS, i182, i207, i207) → f1386_0_gcd_Load(EOS, i182, i207, i207)
f1386_0_gcd_Load(EOS, i182, i207, i207) → f1389_0_gcd_Load(EOS, i207, i207, i182)
f1389_0_gcd_Load(EOS, i207, i207, i182) → f1392_0_gcd_InvokeMethod(EOS, i207, i182, i207)
f1392_0_gcd_InvokeMethod(EOS, i207, i182, i207) → f1394_0_mod_Load(EOS, i207, i182, i207, i182, i207)
f1394_0_mod_Load(EOS, i207, i182, i207, i182, i207) → f1396_0_mod_Load(EOS, i207, i182, i207, i182, i207, i182)
f1396_0_mod_Load(EOS, i207, i182, i207, i182, i207, i182) → f1398_0_mod_NE(EOS, i207, i182, i207, i182, i207, i182, i207)
f1398_0_mod_NE(EOS, i207, i182, i207, i182, i207, i182, i207) → f1400_0_mod_NE(EOS, i207, i182, i207, i182, i207, i182, i207)
f1398_0_mod_NE(EOS, i207, i207, i207, i207, i207, i207, i207) → f1401_0_mod_NE(EOS, i207, i207, i207, i207, i207, i207, i207)
f1400_0_mod_NE(EOS, i207, i182, i207, i182, i207, i182, i207) → f1404_0_mod_Load(EOS, i207, i182, i207, i182, i207) | !(=(i182, i207))
f1404_0_mod_Load(EOS, i207, i182, i207, i182, i207) → f1460_0_mod_Load(EOS, i207, i182, i207, i182, i207)
f1460_0_mod_Load(EOS, i207, i182, i207, i214, i207) → f1470_0_mod_Load(EOS, i207, i182, i207, i214, i207, i214)
f1470_0_mod_Load(EOS, i207, i182, i207, i214, i207, i214) → f1970_0_mod_LE(EOS, i207, i182, i207, i214, i207, i214, i207)
f1970_0_mod_LE(EOS, i207, i182, i207, i214, i207, i214, i207) → f1972_0_mod_LE(EOS, i207, i182, i207, i214, i207, i214, i207)
f1970_0_mod_LE(EOS, i207, i182, i207, i214, i207, i214, i207) → f1973_0_mod_LE(EOS, i207, i182, i207, i214, i207, i214, i207)
f1972_0_mod_LE(EOS, i207, i182, i207, i214, i207, i214, i207) → f1975_0_mod_Load(EOS, i207, i182, i207, i214) | <=(i214, i207)
f1975_0_mod_Load(EOS, i207, i182, i207, i214) → f1978_0_mod_Return(EOS, i207, i182, i207, i214)
f1978_0_mod_Return(EOS, i207, i182, i207, i214) → f1984_0_gcd_Store(EOS, i207, i214)
f1984_0_gcd_Store(EOS, i207, i214) → f1988_0_gcd_Load(EOS, i214, i207)
f1988_0_gcd_Load(EOS, i214, i207) → f1991_0_gcd_Store(EOS, i214, i207)
f1991_0_gcd_Store(EOS, i214, i207) → f1994_0_gcd_JMP(EOS, i207, i214)
f1994_0_gcd_JMP(EOS, i207, i214) → f2007_0_gcd_Load(EOS, i207, i214)
f2007_0_gcd_Load(EOS, i207, i214) → f1294_0_gcd_Load(EOS, i207, i214)
f1294_0_gcd_Load(EOS, i182, i183) → f1347_0_gcd_EQ(EOS, i182, i183, i183)
f1973_0_mod_LE(EOS, i207, i182, i207, i214, i207, i214, i207) → f1976_0_mod_Load(EOS, i207, i182, i207, i214, i207) | >(i214, i207)
f1976_0_mod_Load(EOS, i207, i182, i207, i214, i207) → f1979_0_mod_Load(EOS, i207, i182, i207, i207, i214)
f1979_0_mod_Load(EOS, i207, i182, i207, i207, i214) → f1986_0_mod_IntArithmetic(EOS, i207, i182, i207, i207, i214, i207)
f1986_0_mod_IntArithmetic(EOS, i207, i182, i207, i207, i214, i207) → f1989_0_mod_Store(EOS, i207, i182, i207, i207, -(i214, i207)) | >(i207, 0)
f1989_0_mod_Store(EOS, i207, i182, i207, i207, i375) → f1992_0_mod_JMP(EOS, i207, i182, i207, i375, i207)
f1992_0_mod_JMP(EOS, i207, i182, i207, i375, i207) → f2000_0_mod_Load(EOS, i207, i182, i207, i375, i207)
f2000_0_mod_Load(EOS, i207, i182, i207, i375, i207) → f1460_0_mod_Load(EOS, i207, i182, i207, i375, i207)
f1401_0_mod_NE(EOS, i207, i207, i207, i207, i207, i207, i207) → f1406_0_mod_ConstantStackPush(EOS, i207, i207, i207, i207, i207)
f1406_0_mod_ConstantStackPush(EOS, i207, i207, i207, i207, i207) → f1410_0_mod_Return(EOS, i207, i207, i207, i207, i207, 0)
f1410_0_mod_Return(EOS, i207, i207, i207, i207, i207, matching1) → f1414_0_gcd_Store(EOS, i207, 0) | =(matching1, 0)
f1414_0_gcd_Store(EOS, i207, matching1) → f1437_0_gcd_Store(EOS, i207, 0) | =(matching1, 0)
f1437_0_gcd_Store(EOS, i207, i182) → f1984_0_gcd_Store(EOS, i207, i182)
Combined rules. Obtained 4 IRules
P rules:
f1347_0_gcd_EQ(EOS, x0, x1, x1) → f1970_0_mod_LE(EOS, x1, x0, x1, x0, x1, x0, x1) | &&(&&(>(x1, 0), !(=(x0, x1))), >(+(x0, 1), 0))
f1970_0_mod_LE(EOS, x0, x1, x0, x2, x0, x2, x0) → f1347_0_gcd_EQ(EOS, x0, x2, x2) | <=(x2, x0)
f1970_0_mod_LE(EOS, x0, x1, x0, x2, x0, x2, x0) → f1970_0_mod_LE(EOS, x0, x1, x0, -(x2, x0), x0, -(x2, x0), x0) | &&(>(x0, 0), >(x2, x0))
f1347_0_gcd_EQ(EOS, x0, x0, x0) → f1347_0_gcd_EQ(EOS, x0, 0, 0) | >(x0, 0)
Filtered ground terms:
f1347_0_gcd_EQ(x1, x2, x3, x4) → f1347_0_gcd_EQ(x2, x3, x4)
Cond_f1347_0_gcd_EQ(x1, x2, x3, x4, x5) → Cond_f1347_0_gcd_EQ(x1, x3, x4, x5)
f1970_0_mod_LE(x1, x2, x3, x4, x5, x6, x7, x8) → f1970_0_mod_LE(x2, x3, x4, x5, x6, x7, x8)
Cond_f1970_0_mod_LE(x1, x2, x3, x4, x5, x6, x7, x8, x9) → Cond_f1970_0_mod_LE(x1, x3, x4, x5, x6, x7, x8, x9)
Cond_f1970_0_mod_LE1(x1, x2, x3, x4, x5, x6, x7, x8, x9) → Cond_f1970_0_mod_LE1(x1, x3, x4, x5, x6, x7, x8, x9)
Cond_f1347_0_gcd_EQ1(x1, x2, x3, x4, x5) → Cond_f1347_0_gcd_EQ1(x1, x3, x4, x5)
Filtered duplicate terms:
f1347_0_gcd_EQ(x1, x2, x3) → f1347_0_gcd_EQ(x1, x3)
Cond_f1347_0_gcd_EQ(x1, x2, x3, x4) → Cond_f1347_0_gcd_EQ(x1, x2, x4)
f1970_0_mod_LE(x1, x2, x3, x4, x5, x6, x7) → f1970_0_mod_LE(x2, x4, x6, x7)
Cond_f1970_0_mod_LE(x1, x2, x3, x4, x5, x6, x7, x8) → Cond_f1970_0_mod_LE(x1, x3, x7, x8)
Cond_f1970_0_mod_LE1(x1, x2, x3, x4, x5, x6, x7, x8) → Cond_f1970_0_mod_LE1(x1, x3, x7, x8)
Cond_f1347_0_gcd_EQ1(x1, x2, x3, x4) → Cond_f1347_0_gcd_EQ1(x1, x4)
Filtered unneeded terms:
f1970_0_mod_LE(x1, x2, x3, x4) → f1970_0_mod_LE(x2, x3, x4)
Cond_f1970_0_mod_LE(x1, x2, x3, x4) → Cond_f1970_0_mod_LE(x1, x3, x4)
Cond_f1970_0_mod_LE1(x1, x2, x3, x4) → Cond_f1970_0_mod_LE1(x1, x3, x4)
Prepared 4 rules for path length conversion:
P rules:
f1347_0_gcd_EQ(x0, x1) → f1970_0_mod_LE(x0, x0, x1) | &&(&&(>(x1, 0), !(=(x0, x1))), >(+(x0, 1), 0))
f1970_0_mod_LE(x2, x2, x0) → f1347_0_gcd_EQ(x0, x2) | <=(x2, x0)
f1970_0_mod_LE(x2, x2, x0) → f1970_0_mod_LE(-(x2, x0), -(x2, x0), x0) | &&(>(x0, 0), >(x2, x0))
f1347_0_gcd_EQ(x0, x0) → f1347_0_gcd_EQ(x0, 0) | >(x0, 0)
Finished conversion. Obtained 5 rules.
P rules:
f1347_0_gcd_EQ(x0, x1) → f1970_0_mod_LE(x0, x0, x1) | &&(&&(>(x1, x0), >(x0, -1)), >(x1, 0))
f1347_0_gcd_EQ(x0, x1) → f1970_0_mod_LE(x0, x0, x1) | &&(&&(>(x1, 0), >(x0, -1)), <(x1, x0))
f1970_0_mod_LE(x2, x21, x3) → f1347_0_gcd_EQ(x3, x2) | &&(>=(x3, x2), =(x2, x21))
f1970_0_mod_LE(x4, x41, x5) → f1970_0_mod_LE(-(x4, x5), -(x4, x5), x5) | &&(&&(<(x5, x4), >(x5, 0)), =(x4, x41))
f1347_0_gcd_EQ(x6, x61) → f1347_0_gcd_EQ(x6, 0) | &&(>(x6, 0), =(x6, x61))
Constructed the termination graph and obtained one non-trivial SCC.
Found the following polynomial interpretation:
Therefore the following rule(s) have been dropped:
Constructed the termination graph and obtained one non-trivial SCC.
Found the following polynomial interpretation:
Therefore the following rule(s) have been dropped: