Expected Cost | +- [f] | 0 | +- [Program] | i :~ {1 : 0} | 0:While(n ≥ 1 + i) | j :~ {1 : 1 + i} | 1:While(n ≥ 1 + j) | NonDet | {Tick(1) | j :~ {1 : -1 + j} | n :~ {1 : -1 + n}} | {Skip} | j :~ {1 : 1 + j} | i :~ {1 : 1 + i} | +- While.step | | | +- [Problem] | | 0:While(n ≥ 1 + i) | | j :~ {1 : 1 + i} | | 1:While(n ≥ 1 + j) | | NonDet | | {Tick(1) | | j :~ {1 : -1 + j} | | n :~ {1 : -1 + n}} | | {Skip} | | j :~ {1 : 1 + j} | | i :~ {1 : 1 + i} | | | +- [f] | | 0 | | | +- Expected Cost Body | | | | | +- Expected Cost | | | | | | | +- [f] | | | | 0 | | | | | | | +- [Program] | | | | 1:While(n ≥ 1 + j) | | | | NonDet | | | | {Tick(1) | | | | j :~ {1 : -1 + j} | | | | n :~ {1 : -1 + n}} | | | | {Skip} | | | | j :~ {1 : 1 + j} | | | | | | | +- While.step | | | | | | | | | +- [Problem] | | | | | 1:While(n ≥ 1 + j) | | | | | NonDet | | | | | {Tick(1) | | | | | j :~ {1 : -1 + j} | | | | | n :~ {1 : -1 + n}} | | | | | {Skip} | | | | | j :~ {1 : 1 + j} | | | | | | | | | +- [f] | | | | | 0 | | | | | | | | | +- Expected Cost Body | | | | | | | | | | | `- [1 | ⊤] | | | | | | | | | +- linear-template | | | | | | | | | | | `- 1 + [-j + n | -j + n ≥ 0] | | | | | | | | | +- [Norms] | | | | | [[1 | ⊤],[-j + n | -j + n ≥ 0]] | | | | | | | | | +- [Invariant] | | | | | n ≥ 1 + j ==> [1 | ⊤] + h([1 | ⊤],[-1 + -j + n | -1 + -j + n ≥ 0]) ≼ h([1 | ⊤],[-j + n | -j + n ≥ 0]) | | | | | 1 + j ≥ 1 + n ==> 0 ≼ h([1 | ⊤],[-j + n | -j + n ≥ 0]) | | | | | | | | | `- [-j + n | -j + n ≥ 0] | | | | | | | `- [-j + n | -j + n ≥ 0] | | | | | +- Expected Cost | | | | | | | +- [f] | | | | 0 | | | | | | | +- [Program] | | | | i :~ {1 : 1 + i} | | | | | | | `- 0 | | | | | +- Expected Cost | | | | | | | +- [f] | | | | 0 | | | | | | | +- [Program] | | | | 1:While(n ≥ 1 + j) | | | | NonDet | | | | {Tick(1) | | | | j :~ {1 : -1 + j} | | | | n :~ {1 : -1 + n}} | | | | {Skip} | | | | j :~ {1 : 1 + j} | | | | | | | `- 0 | | | | | `- [-1 + -i + n | -1 + -i + n ≥ 0] | | | +- mixed-iteration-template | | | | | `- [-i + n | -i + n ≥ 0] + [-i + n | -i + n ≥ 0]^2 | | | +- [Norms] | | [[-i + n | -i + n ≥ 0],[-2·(i·n) + i^2 + n^2 | -i + n ≥ 0]] | | | +- While.step | | | | | +- [Problem] | | | 1:While(n ≥ 1 + j) | | | NonDet | | | {Tick(1) | | | j :~ {1 : -1 + j} | | | n :~ {1 : -1 + n}} | | | {Skip} | | | j :~ {1 : 1 + j} | | | | | +- [f] | | | [1 + 2·(i) + -2·(i·n) + i^2 + -2·(n) + n^2 | -1 + -i + n ≥ 0] | | | | | +- linear-template | | | | | | | `- 1 + [1 + 2·(i) + -2·(i·n) + i^2 + -2·(n) + n^2 | -1 + -i + n ≥ 0] + [3 + 2·(i) | 3 + 2·(i) ≥ 0]·[-j + n | -j + n ≥ 0] + [-j + n | -j + n ≥ 0] | | | | | +- [Norms] | | | [[1 | ⊤],[1 + 2·(i) + -2·(i·n) + i^2 + -2·(n) + n^2 | -1 + -i + n ≥ 0],[-2·(i·j) + 2·(i·n) + -3·(j) + 3·(n) | 3 + 2·(i) ≥ 0 ∧ -j + n ≥ 0],[-j + n | -j + n ≥ 0]] | | | | | +- [Invariant] | | | n ≥ 1 + j ==> 0 + h([1 | ⊤],sup([4 + 4·(i) + -2·(i·n) + i^2 + -4·(n) + n^2 | -2 + -i + n ≥ 0],[1 + 2·(i) + -2·(i·n) + i^2 + -2·(n) + n^2 | -1 + -i + n ≥ 0]),[-3 + -2·(i) + -2·(i·j) + 2·(i·n) + -3·(j) + 3·(n) | -1 + -j + n ≥ 0 ∧ 3 + 2·(i) ≥ 0],[-1 + -j + n | -1 + -j + n ≥ 0]) ≼ h([1 | ⊤],[1 + 2·(i) + -2·(i·n) + i^2 + -2·(n) + n^2 | -1 + -i + n ≥ 0],[-2·(i·j) + 2·(i·n) + -3·(j) + 3·(n) | 3 + 2·(i) ≥ 0 ∧ -j + n ≥ 0],[-j + n | -j + n ≥ 0]) | | | 1 + j ≥ 1 + n ==> [1 + 2·(i) + -2·(i·n) + i^2 + -2·(n) + n^2 | -1 + -i + n ≥ 0] ≼ h([1 | ⊤],[1 + 2·(i) + -2·(i·n) + i^2 + -2·(n) + n^2 | -1 + -i + n ≥ 0],[-2·(i·j) + 2·(i·n) + -3·(j) + 3·(n) | 3 + 2·(i) ≥ 0 ∧ -j + n ≥ 0],[-j + n | -j + n ≥ 0]) | | | | | `- [1 + 2·(i) + -2·(i·n) + i^2 + -2·(n) + n^2 | -1 + -i + n ≥ 0] | | | +- [Invariant] | | n ≥ 1 + i ==> [-1 + -i + n | -1 + -i + n ≥ 0] + h([-1 + -i + n | -1 + -i + n ≥ 0],[1 + 2·(i) + -2·(i·n) + i^2 + -2·(n) + n^2 | -1 + -i + n ≥ 0]) ≼ h([-i + n | -i + n ≥ 0],[-2·(i·n) + i^2 + n^2 | -i + n ≥ 0]) | | 1 + i ≥ 1 + n ==> 0 ≼ h([-i + n | -i + n ≥ 0],[-2·(i·n) + i^2 + n^2 | -i + n ≥ 0]) | | | `- 1/2·[-2·(i·n) + i^2 + n^2 | -i + n ≥ 0] | `- 1/2·[n^2 | n ≥ 0]