(0) Obligation:

JBC Problem based on JBC Program:
public class Avg {
public static void main(String[] args) {
int x, y;
x = args[0].length();
y = args[1].length();
average(x,y);
}

public static int average(int x, int y) {
if (x > 0) {
return average(x-1, y+1);
} else if (y > 2) {
return 1 + average(x+1, y-2);
} else {
return 1;
}
}
}


(1) JBCToGraph (SOUND transformation)

Constructed TerminationGraph.

(2) Obligation:

Termination Graph based on JBC Program:
Avg.main([Ljava/lang/String;)V: Graph of 164 nodes with 0 SCCs.

Avg.average(II)I: Graph of 64 nodes with 0 SCCs.


(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: Avg.average(II)I
SCC calls the following helper methods: Avg.average(II)I
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 30 IRules

P rules:
f262_0_average_LE(EOS, matching1, i36, matching2, i36, matching3) → f266_0_average_LE(EOS, 0, i36, 0, i36, 0) | &&(&&(=(matching1, 0), =(matching2, 0)), =(matching3, 0))
f262_0_average_LE(EOS, i44, i36, i44, i36, i44) → f267_0_average_LE(EOS, i44, i36, i44, i36, i44)
f266_0_average_LE(EOS, matching1, i36, matching2, i36, matching3) → f271_0_average_Load(EOS, 0, i36, 0, i36) | &&(&&(&&(<=(0, 0), =(matching1, 0)), =(matching2, 0)), =(matching3, 0))
f271_0_average_Load(EOS, matching1, i36, matching2, i36) → f285_0_average_ConstantStackPush(EOS, 0, i36, 0, i36, i36) | &&(=(matching1, 0), =(matching2, 0))
f285_0_average_ConstantStackPush(EOS, matching1, i36, matching2, i36, i36) → f301_0_average_LE(EOS, 0, i36, 0, i36, i36, 2) | &&(=(matching1, 0), =(matching2, 0))
f301_0_average_LE(EOS, matching1, i52, matching2, i52, i52, matching3) → f316_0_average_LE(EOS, 0, i52, 0, i52, i52, 2) | &&(&&(=(matching1, 0), =(matching2, 0)), =(matching3, 2))
f316_0_average_LE(EOS, matching1, i52, matching2, i52, i52, matching3) → f347_0_average_ConstantStackPush(EOS, 0, i52, 0, i52) | &&(&&(&&(>(i52, 2), =(matching1, 0)), =(matching2, 0)), =(matching3, 2))
f347_0_average_ConstantStackPush(EOS, matching1, i52, matching2, i52) → f370_0_average_Load(EOS, 0, i52, 0, i52, 1) | &&(=(matching1, 0), =(matching2, 0))
f370_0_average_Load(EOS, matching1, i52, matching2, i52, matching3) → f393_0_average_ConstantStackPush(EOS, 0, i52, i52, 1, 0) | &&(&&(=(matching1, 0), =(matching2, 0)), =(matching3, 1))
f393_0_average_ConstantStackPush(EOS, matching1, i52, i52, matching2, matching3) → f451_0_average_IntArithmetic(EOS, 0, i52, i52, 1, 0, 1) | &&(&&(=(matching1, 0), =(matching2, 1)), =(matching3, 0))
f451_0_average_IntArithmetic(EOS, matching1, i52, i52, matching2, matching3, matching4) → f460_0_average_Load(EOS, 0, i52, i52, 1, 1) | &&(&&(&&(=(matching1, 0), =(matching2, 1)), =(matching3, 0)), =(matching4, 1))
f460_0_average_Load(EOS, matching1, i52, i52, matching2, matching3) → f470_0_average_ConstantStackPush(EOS, 0, i52, 1, 1, i52) | &&(&&(=(matching1, 0), =(matching2, 1)), =(matching3, 1))
f470_0_average_ConstantStackPush(EOS, matching1, i52, matching2, matching3, i52) → f476_0_average_IntArithmetic(EOS, 0, i52, 1, 1, i52, 2) | &&(&&(=(matching1, 0), =(matching2, 1)), =(matching3, 1))
f476_0_average_IntArithmetic(EOS, matching1, i52, matching2, matching3, i52, matching4) → f497_0_average_InvokeMethod(EOS, 0, i52, 1, 1, -(i52, 2)) | &&(&&(&&(&&(>(i52, 0), =(matching1, 0)), =(matching2, 1)), =(matching3, 1)), =(matching4, 2))
f497_0_average_InvokeMethod(EOS, matching1, i52, matching2, matching3, i82) → f504_0_average_Load(EOS, 1, i82, 1, i82) | &&(&&(=(matching1, 0), =(matching2, 1)), =(matching3, 1))
f497_0_average_InvokeMethod(EOS, matching1, i52, matching2, matching3, i82) → f504_1_average_Load(EOS, 0, i52, 1, 1, i82, 1, i82) | &&(&&(=(matching1, 0), =(matching2, 1)), =(matching3, 1))
f504_0_average_Load(EOS, matching1, i82, matching2, i82) → f510_0_average_Load(EOS, 1, i82, 1, i82) | &&(=(matching1, 1), =(matching2, 1))
f510_0_average_Load(EOS, matching1, i82, matching2, i82) → f254_0_average_Load(EOS, 1, i82, 1, i82) | &&(=(matching1, 1), =(matching2, 1))
f254_0_average_Load(EOS, i18, i36, i18, i36) → f262_0_average_LE(EOS, i18, i36, i18, i36, i18)
f267_0_average_LE(EOS, i44, i36, i44, i36, i44) → f278_0_average_Load(EOS, i44, i36, i44, i36) | >(i44, 0)
f278_0_average_Load(EOS, i44, i36, i44, i36) → f292_0_average_ConstantStackPush(EOS, i44, i36, i44, i36, i44)
f292_0_average_ConstantStackPush(EOS, i44, i36, i44, i36, i44) → f308_0_average_IntArithmetic(EOS, i44, i36, i44, i36, i44, 1)
f308_0_average_IntArithmetic(EOS, i44, i36, i44, i36, i44, matching1) → f328_0_average_Load(EOS, i44, i36, i44, i36, -(i44, 1)) | &&(>(i44, 0), =(matching1, 1))
f328_0_average_Load(EOS, i44, i36, i44, i36, i55) → f355_0_average_ConstantStackPush(EOS, i44, i36, i44, i36, i55, i36)
f355_0_average_ConstantStackPush(EOS, i44, i36, i44, i36, i55, i36) → f377_0_average_IntArithmetic(EOS, i44, i36, i44, i36, i55, i36, 1)
f377_0_average_IntArithmetic(EOS, i44, i36, i44, i36, i55, i36, matching1) → f400_0_average_InvokeMethod(EOS, i44, i36, i44, i36, i55, +(i36, 1)) | &&(>=(i36, 0), =(matching1, 1))
f400_0_average_InvokeMethod(EOS, i44, i36, i44, i36, i55, i64) → f456_0_average_Load(EOS, i55, i64, i55, i64)
f400_0_average_InvokeMethod(EOS, i44, i36, i44, i36, i55, i64) → f456_1_average_Load(EOS, i44, i36, i44, i36, i55, i64, i55, i64)
f456_0_average_Load(EOS, i55, i64, i55, i64) → f465_0_average_Load(EOS, i55, i64, i55, i64)
f465_0_average_Load(EOS, i55, i64, i55, i64) → f254_0_average_Load(EOS, i55, i64, i55, i64)

Combined rules. Obtained 4 IRules

P rules:
f262_0_average_LE(EOS, 0, x1, 0, x1, 0) → f504_1_average_Load(EOS, 0, x1, 1, 1, -(x1, 2), 1, -(x1, 2)) | >(x1, 2)
f262_0_average_LE(EOS, 0, x1, 0, x1, 0) → f262_0_average_LE(EOS, 1, -(x1, 2), 1, -(x1, 2), 1) | >(x1, 2)
f262_0_average_LE(EOS, x0, x1, x0, x1, x0) → f456_1_average_Load(EOS, x0, x1, x0, x1, -(x0, 1), +(x1, 1), -(x0, 1), +(x1, 1)) | &&(>(+(x1, 1), 0), >(x0, 0))
f262_0_average_LE(EOS, x0, x1, x0, x1, x0) → f262_0_average_LE(EOS, -(x0, 1), +(x1, 1), -(x0, 1), +(x1, 1), -(x0, 1)) | &&(>(+(x1, 1), 0), >(x0, 0))

Filtered ground terms:


f262_0_average_LE(x1, x2, x3, x4, x5, x6) → f262_0_average_LE(x2, x3, x4, x5, x6)
Cond_f262_0_average_LE(x1, x2, x3, x4, x5, x6, x7) → Cond_f262_0_average_LE(x1, x4, x6)
f504_1_average_Load(x1, x2, x3, x4, x5, x6, x7, x8) → f504_1_average_Load(x3, x6, x8)
Cond_f262_0_average_LE1(x1, x2, x3, x4, x5, x6, x7) → Cond_f262_0_average_LE1(x1, x4, x6)
Cond_f262_0_average_LE2(x1, x2, x3, x4, x5, x6, x7) → Cond_f262_0_average_LE2(x1, x3, x4, x5, x6, x7)
f456_1_average_Load(x1, x2, x3, x4, x5, x6, x7, x8, x9) → f456_1_average_Load(x2, x3, x4, x5, x6, x7, x8, x9)
Cond_f262_0_average_LE3(x1, x2, x3, x4, x5, x6, x7) → Cond_f262_0_average_LE3(x1, x3, x4, x5, x6, x7)

Filtered duplicate terms:


f262_0_average_LE(x1, x2, x3, x4, x5) → f262_0_average_LE(x4, x5)
Cond_f262_0_average_LE(x1, x2, x3) → Cond_f262_0_average_LE(x1, x3)
f504_1_average_Load(x1, x2, x3) → f504_1_average_Load(x3)
Cond_f262_0_average_LE1(x1, x2, x3) → Cond_f262_0_average_LE1(x1, x3)
Cond_f262_0_average_LE2(x1, x2, x3, x4, x5, x6) → Cond_f262_0_average_LE2(x1, x5, x6)
f456_1_average_Load(x1, x2, x3, x4, x5, x6, x7, x8) → f456_1_average_Load(x7, x8)
Cond_f262_0_average_LE3(x1, x2, x3, x4, x5, x6) → Cond_f262_0_average_LE3(x1, x5, x6)

Filtered unneeded terms:


Cond_f262_0_average_LE(x1, x2) → Cond_f262_0_average_LE(x1)
Cond_f262_0_average_LE2(x1, x2, x3) → Cond_f262_0_average_LE2(x1)

Prepared 4 rules for path length conversion:

P rules:
f262_0_average_LE(x1, 0) → f504_1_average_Load(-(x1, 2)) | >(x1, 2)
f262_0_average_LE(x1, 0) → f262_0_average_LE(-(x1, 2), 1) | >(x1, 2)
f262_0_average_LE(x1, x0) → f456_1_average_Load(-(x0, 1), +(x1, 1)) | &&(>(+(x1, 1), 0), >(x0, 0))
f262_0_average_LE(x1, x0) → f262_0_average_LE(+(x1, 1), -(x0, 1)) | &&(>(+(x1, 1), 0), >(x0, 0))

Finished conversion. Obtained 2 rules.

P rules:
f262_0_average_LE(x1, c0) → f262_0_average_LE(-(x1, 2), 1) | &&(>(x1, 2), =(0, c0))
f262_0_average_LE(x4, x5) → f262_0_average_LE(+(x4, 1), -(x5, 1)) | &&(>(x4, -1), >(x5, 0))

(6) Obligation:

Rules:
f262_0_average_LE(x1, c0) → f262_0_average_LE(-(x1, 2), 1) | &&(>(x1, 2), =(0, c0))
f262_0_average_LE(x4, x5) → f262_0_average_LE(+(x4, 1), -(x5, 1)) | &&(>(x4, -1), >(x5, 0))

(7) PolynomialOrderProcessor (EQUIVALENT transformation)

Found the following polynomial interpretation:


[f262_0_average_LE(x5, x7)] = 2·x5 + 3·x7

Therefore the following rule(s) have been dropped:


f262_0_average_LE(x0, x1) → f262_0_average_LE(-(x0, 2), 1) | &&(>(x0, 2), =(0, x1))
f262_0_average_LE(x2, x3) → f262_0_average_LE(+(x2, 1), -(x3, 1)) | &&(>(x2, -1), >(x3, 0))

(8) YES