0 JBC
↳1 JBCToGraph (⇒, 467 ms)
↳2 JBCTerminationGraph
↳3 TerminationGraphToSCCProof (⇒, 0 ms)
↳4 JBCTerminationSCC
↳5 SCCToIntTRSProof (⇒, 85 ms)
↳6 intTRS
↳7 PolynomialOrderProcessor (⇒, 0 ms)
↳8 intTRS
↳9 PolynomialOrderProcessor (⇔, 0 ms)
↳10 YES
public class Mod {
public static void main(String[] args) {
int x = args[0].length();
int y = args[1].length();
mod(x, y);
}
public static int mod(int x, int y) {
while (x >= y && y > 0) {
x = minus(x,y);
}
return x;
}
public static int minus(int x, int y) {
while (y != 0) {
if (y > 0) {
y--;
x--;
} else {
y++;
x++;
}
}
return x;
}
}
Generated rules. Obtained 27 IRules
P rules:
f650_0_mod_Load(EOS, i105, i104, i105, i104) → f653_0_mod_LT(EOS, i105, i104, i105, i104, i105)
f653_0_mod_LT(EOS, i105, i104, i105, i104, i105) → f656_0_mod_LT(EOS, i105, i104, i105, i104, i105)
f656_0_mod_LT(EOS, i105, i104, i105, i104, i105) → f661_0_mod_Load(EOS, i105, i104, i105) | >=(i104, i105)
f661_0_mod_Load(EOS, i105, i104, i105) → f666_0_mod_LE(EOS, i105, i104, i105, i105)
f666_0_mod_LE(EOS, i109, i104, i109, i109) → f672_0_mod_LE(EOS, i109, i104, i109, i109)
f672_0_mod_LE(EOS, i109, i104, i109, i109) → f679_0_mod_Load(EOS, i109, i104, i109) | >(i109, 0)
f679_0_mod_Load(EOS, i109, i104, i109) → f687_0_mod_Load(EOS, i109, i109, i104)
f687_0_mod_Load(EOS, i109, i109, i104) → f695_0_mod_InvokeMethod(EOS, i109, i109, i104, i109)
f695_0_mod_InvokeMethod(EOS, i109, i109, i104, i109) → f699_0_minus_Load(EOS, i109, i109, i104, i109, i104, i109)
f699_0_minus_Load(EOS, i109, i109, i104, i109, i104, i109) → f732_0_minus_Load(EOS, i109, i109, i104, i109, i104, i109)
f732_0_minus_Load(EOS, i109, i109, i104, i109, i115, i116) → f736_0_minus_EQ(EOS, i109, i109, i104, i109, i115, i116, i116)
f736_0_minus_EQ(EOS, i109, i109, i104, i109, i115, i128, i128) → f739_0_minus_EQ(EOS, i109, i109, i104, i109, i115, i128, i128)
f736_0_minus_EQ(EOS, i109, i109, i104, i109, i115, matching1, matching2) → f740_0_minus_EQ(EOS, i109, i109, i104, i109, i115, 0, 0) | &&(=(matching1, 0), =(matching2, 0))
f739_0_minus_EQ(EOS, i109, i109, i104, i109, i115, i128, i128) → f742_0_minus_Load(EOS, i109, i109, i104, i109, i115, i128) | >(i128, 0)
f742_0_minus_Load(EOS, i109, i109, i104, i109, i115, i128) → f747_0_minus_LE(EOS, i109, i109, i104, i109, i115, i128, i128)
f747_0_minus_LE(EOS, i109, i109, i104, i109, i115, i128, i128) → f751_0_minus_Inc(EOS, i109, i109, i104, i109, i115, i128) | >(i128, 0)
f751_0_minus_Inc(EOS, i109, i109, i104, i109, i115, i128) → f756_0_minus_Inc(EOS, i109, i109, i104, i109, i115, +(i128, -1)) | >(i128, 0)
f756_0_minus_Inc(EOS, i109, i109, i104, i109, i115, i131) → f760_0_minus_JMP(EOS, i109, i109, i104, i109, +(i115, -1), i131)
f760_0_minus_JMP(EOS, i109, i109, i104, i109, i132, i131) → f800_0_minus_Load(EOS, i109, i109, i104, i109, i132, i131)
f800_0_minus_Load(EOS, i109, i109, i104, i109, i132, i131) → f732_0_minus_Load(EOS, i109, i109, i104, i109, i132, i131)
f740_0_minus_EQ(EOS, i109, i109, i104, i109, i115, matching1, matching2) → f745_0_minus_Load(EOS, i109, i109, i104, i109, i115) | &&(=(matching1, 0), =(matching2, 0))
f745_0_minus_Load(EOS, i109, i109, i104, i109, i115) → f749_0_minus_Return(EOS, i109, i109, i104, i109, i115)
f749_0_minus_Return(EOS, i109, i109, i104, i109, i115) → f754_0_mod_Store(EOS, i109, i109, i115)
f754_0_mod_Store(EOS, i109, i109, i115) → f758_0_mod_JMP(EOS, i109, i115, i109)
f758_0_mod_JMP(EOS, i109, i115, i109) → f788_0_mod_Load(EOS, i109, i115, i109)
f788_0_mod_Load(EOS, i109, i115, i109) → f646_0_mod_Load(EOS, i109, i115, i109)
f646_0_mod_Load(EOS, i105, i104, i105) → f650_0_mod_Load(EOS, i105, i104, i105, i104)
Combined rules. Obtained 2 IRules
P rules:
f736_0_minus_EQ(EOS, x0, x0, x1, x0, x2, x3, x3) → f736_0_minus_EQ(EOS, x0, x0, x1, x0, -(x2, 1), -(x3, 1), -(x3, 1)) | >(x3, 0)
f736_0_minus_EQ(EOS, x0, x0, x1, x0, x2, 0, 0) → f736_0_minus_EQ(EOS, x0, x0, x2, x0, x2, x0, x0) | &&(>(x0, 0), >=(x2, x0))
Filtered ground terms:
f736_0_minus_EQ(x1, x2, x3, x4, x5, x6, x7, x8) → f736_0_minus_EQ(x2, x3, x4, x5, x6, x7, x8)
Cond_f736_0_minus_EQ(x1, x2, x3, x4, x5, x6, x7, x8, x9) → Cond_f736_0_minus_EQ(x1, x3, x4, x5, x6, x7, x8, x9)
Cond_f736_0_minus_EQ1(x1, x2, x3, x4, x5, x6, x7, x8, x9) → Cond_f736_0_minus_EQ1(x1, x3, x4, x5, x6, x7)
Filtered duplicate terms:
f736_0_minus_EQ(x1, x2, x3, x4, x5, x6, x7) → f736_0_minus_EQ(x3, x4, x5, x7)
Cond_f736_0_minus_EQ(x1, x2, x3, x4, x5, x6, x7, x8) → Cond_f736_0_minus_EQ(x1, x4, x5, x6, x8)
Cond_f736_0_minus_EQ1(x1, x2, x3, x4, x5, x6) → Cond_f736_0_minus_EQ1(x1, x4, x5, x6)
Filtered unneeded terms:
Cond_f736_0_minus_EQ(x1, x2, x3, x4, x5) → Cond_f736_0_minus_EQ(x1, x3, x4, x5)
f736_0_minus_EQ(x1, x2, x3, x4) → f736_0_minus_EQ(x2, x3, x4)
Cond_f736_0_minus_EQ1(x1, x2, x3, x4) → Cond_f736_0_minus_EQ1(x1, x3, x4)
Prepared 2 rules for path length conversion:
P rules:
f736_0_minus_EQ(x0, x2, x3) → f736_0_minus_EQ(x0, -(x2, 1), -(x3, 1)) | >(x3, 0)
f736_0_minus_EQ(x0, x2, 0) → f736_0_minus_EQ(x0, x2, x0) | &&(>(x0, 0), >=(x2, x0))
Finished conversion. Obtained 2 rules.
P rules:
f736_0_minus_EQ(x0, x1, x2) → f736_0_minus_EQ(x0, -(x1, 1), -(x2, 1)) | >(x2, 0)
f736_0_minus_EQ(x3, x4, c0) → f736_0_minus_EQ(x3, x4, x3) | &&(&&(>(x3, 0), >=(x4, x3)), =(0, c0))
Found the following polynomial interpretation:
Therefore the following rule(s) have been dropped:
Found the following polynomial interpretation:
Therefore the following rule(s) have been dropped: