(0) Obligation:
Need to prove time_complexity of the following program:
public class CyclicPair {
CyclicPair next;
public static void main(String[] args) {
Random.args = args;
CyclicPair one = new CyclicPair();
CyclicPair two = new CyclicPair();
int i = Random.random();
if (i == 0) { //two cyclic
two.next = two;
} else { //one cyclic
one.next = one;
}
while (two.next == two && one.next == one) {
one.next = two; //one: o1, two: o2 | o1: (next=o2), o2: (next=o2)
two.next = one; //one: o1, two: o2 | o1: (next=o2), o2: (next=o1)
one.next = two.next; //one: o2, two: o2 | o1: (next=o1), o2: (next=o1)
two.next = two;
}
}
}
public class Random {
static String[] args;
static int index = 0;
public static int random() {
String string = args[index];
index++;
return string.length();
}
}
(1) JBCToGraph (BOTH CONCRETE BOUNDS(ID, ID) transformation)
Constructed TerminationGraph.
(2) Obligation:
Termination Graph based on JBC Program:
CyclicPair.main([Ljava/lang/String;)V: Graph of 135 nodes with 0 SCCs.
(3) TerminationGraphToComplexityProof (EQUIVALENT transformation)
Proven constant complexity by absence of SCCs and edges with non-constant weight
(4) BOUNDS(CONSTANT, 116)
(5) JBCToGraph (BOTH CONCRETE BOUNDS(ID, ID) transformation)
Constructed TerminationGraph.
(6) Obligation:
Termination Graph based on JBC Program:
CyclicPair.main([Ljava/lang/String;)V: Graph of 134 nodes with 0 SCCs.