(0) Obligation:

JBC Problem based on JBC Program:
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;
}

}


(1) JBCToGraph (SOUND transformation)

Constructed TerminationGraph.

(2) Obligation:

Termination Graph based on JBC Program:
Mod.main([Ljava/lang/String;)V: Graph of 178 nodes with 1 SCC.


(3) TerminationGraphToSCCProof (SOUND transformation)

Splitted TerminationGraph to 1 SCCs.

(4) Obligation:

SCC of termination graph based on JBC Program.
SCC contains nodes from the following methods: Mod.main([Ljava/lang/String;)V
SCC calls the following helper methods:
Performed SCC analyses:
  • Used field analysis yielded the following read fields:
  • Marker field analysis yielded the following relations that could be markers:

(5) SCCToIntTRSProof (SOUND transformation)

Transformed FIGraph SCCs to intTRSs. Log:

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))

(6) Obligation:

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))

(7) PolynomialOrderProcessor (SOUND transformation)

Found the following polynomial interpretation:


[f736_0_minus_EQ(x7, x9, x11)] = -x11 + x7 + x9

Therefore the following rule(s) have been dropped:


f736_0_minus_EQ(x3, x4, x5) → f736_0_minus_EQ(x3, x4, x3) | &&(&&(>(x3, 0), >=(x4, x3)), =(0, x5))

(8) Obligation:

Rules:
f736_0_minus_EQ(x0, x1, x2) → f736_0_minus_EQ(x0, -(x1, 1), -(x2, 1)) | >(x2, 0)

(9) PolynomialOrderProcessor (EQUIVALENT transformation)

Found the following polynomial interpretation:


[f736_0_minus_EQ(x4, x6, x8)] = x8

Therefore the following rule(s) have been dropped:


f736_0_minus_EQ(x0, x1, x2) → f736_0_minus_EQ(x0, -(x1, 1), -(x2, 1)) | >(x2, 0)

(10) YES