3.71/1.96 WORST_CASE(Omega(n^1), O(n^1)) 3.71/1.96 proof of /export/starexec/sandbox/benchmark/theBenchmark.koat 3.71/1.96 # AProVE Commit ID: 48fb2092695e11cc9f56e44b17a92a5f88ffb256 marcel 20180622 unpublished dirty 3.71/1.96 3.71/1.96 3.71/1.96 The runtime complexity of the given CpxIntTrs could be proven to be BOUNDS(n^1, max(3, 3 + 2 * Arg_1)). 3.71/1.96 3.71/1.96 (0) CpxIntTrs 3.71/1.96 (1) Koat2 Proof [FINISHED, 173 ms] 3.71/1.96 (2) BOUNDS(1, max(3, 3 + 2 * Arg_1)) 3.71/1.96 (3) Loat Proof [FINISHED, 166 ms] 3.71/1.96 (4) BOUNDS(n^1, INF) 3.71/1.96 3.71/1.96 3.71/1.96 ---------------------------------------- 3.71/1.96 3.71/1.96 (0) 3.71/1.96 Obligation: 3.71/1.96 Complexity Int TRS consisting of the following rules: 3.71/1.96 div(A, B) -> Com_1(end(A, B)) :|: 0 >= A 3.71/1.96 div(A, B) -> Com_1(end(A, B)) :|: A >= B 3.71/1.96 div(A, B) -> Com_1(div(A, B - A)) :|: B >= A + 1 && A >= 1 3.71/1.96 start(A, B) -> Com_1(div(A, B)) :|: TRUE 3.71/1.96 3.71/1.96 The start-symbols are:[start_2] 3.71/1.96 3.71/1.96 3.71/1.96 ---------------------------------------- 3.71/1.96 3.71/1.96 (1) Koat2 Proof (FINISHED) 3.71/1.96 YES( ?, max([3, 3+2*Arg_1]) {O(n)}) 3.71/1.96 3.71/1.96 3.71/1.96 3.71/1.96 Initial Complexity Problem: 3.71/1.96 3.71/1.96 Start: start 3.71/1.96 3.71/1.96 Program_Vars: Arg_0, Arg_1 3.71/1.96 3.71/1.96 Temp_Vars: 3.71/1.96 3.71/1.96 Locations: div, end, start 3.71/1.96 3.71/1.96 Transitions: 3.71/1.96 3.71/1.96 div(Arg_0,Arg_1) -> div(Arg_0,Arg_1-Arg_0):|:Arg_0+1 <= Arg_1 && 1 <= Arg_0 3.71/1.97 3.71/1.97 div(Arg_0,Arg_1) -> end(Arg_0,Arg_1):|:Arg_0 <= 0 3.71/1.97 3.71/1.97 div(Arg_0,Arg_1) -> end(Arg_0,Arg_1):|:Arg_1 <= Arg_0 3.71/1.97 3.71/1.97 start(Arg_0,Arg_1) -> div(Arg_0,Arg_1):|: 3.71/1.97 3.71/1.97 3.71/1.97 3.71/1.97 Timebounds: 3.71/1.97 3.71/1.97 Overall timebound: max([3, 3+2*Arg_1]) {O(n)} 3.71/1.97 3.71/1.97 0: div->end: 1 {O(1)} 3.71/1.97 3.71/1.97 1: div->end: 1 {O(1)} 3.71/1.97 3.71/1.97 2: div->div: max([0, 2*Arg_1]) {O(n)} 3.71/1.97 3.71/1.97 3: start->div: 1 {O(1)} 3.71/1.97 3.71/1.97 3.71/1.97 3.71/1.97 Costbounds: 3.71/1.97 3.71/1.97 Overall costbound: max([3, 3+2*Arg_1]) {O(n)} 3.71/1.97 3.71/1.97 0: div->end: 1 {O(1)} 3.71/1.97 3.71/1.97 1: div->end: 1 {O(1)} 3.71/1.97 3.71/1.97 2: div->div: max([0, 2*Arg_1]) {O(n)} 3.71/1.97 3.71/1.97 3: start->div: 1 {O(1)} 3.71/1.97 3.71/1.97 3.71/1.97 3.71/1.97 Sizebounds: 3.71/1.97 3.71/1.97 `Lower: 3.71/1.97 3.71/1.97 0: div->end, Arg_0: Arg_0 {O(n)} 3.71/1.97 3.71/1.97 0: div->end, Arg_1: Arg_1 {O(n)} 3.71/1.97 3.71/1.97 1: div->end, Arg_0: min([1, Arg_0]) {O(n)} 3.71/1.97 3.71/1.97 1: div->end, Arg_1: min([1, Arg_1]) {O(n)} 3.71/1.97 3.71/1.97 2: div->div, Arg_0: 1 {O(1)} 3.71/1.97 3.71/1.97 2: div->div, Arg_1: 1 {O(1)} 3.71/1.97 3.71/1.97 3: start->div, Arg_0: Arg_0 {O(n)} 3.71/1.97 3.71/1.97 3: start->div, Arg_1: Arg_1 {O(n)} 3.71/1.97 3.71/1.97 `Upper: 3.71/1.97 3.71/1.97 0: div->end, Arg_0: 0 {O(1)} 3.71/1.97 3.71/1.97 0: div->end, Arg_1: Arg_1 {O(n)} 3.71/1.97 3.71/1.97 1: div->end, Arg_0: Arg_0 {O(n)} 3.71/1.97 3.71/1.97 1: div->end, Arg_1: Arg_1 {O(n)} 3.71/1.97 3.71/1.97 2: div->div, Arg_0: Arg_0 {O(n)} 3.71/1.97 3.71/1.97 2: div->div, Arg_1: Arg_1 {O(n)} 3.71/1.97 3.71/1.97 3: start->div, Arg_0: Arg_0 {O(n)} 3.71/1.97 3.71/1.97 3: start->div, Arg_1: Arg_1 {O(n)} 3.71/1.97 3.71/1.97 3.71/1.97 ---------------------------------------- 3.71/1.97 3.71/1.97 (2) 3.71/1.97 BOUNDS(1, max(3, 3 + 2 * Arg_1)) 3.71/1.97 3.71/1.97 ---------------------------------------- 3.71/1.97 3.71/1.97 (3) Loat Proof (FINISHED) 3.71/1.97 3.71/1.97 3.71/1.97 ### Pre-processing the ITS problem ### 3.71/1.97 3.71/1.97 3.71/1.97 3.71/1.97 Initial linear ITS problem 3.71/1.97 3.71/1.97 Start location: start 3.71/1.97 3.71/1.97 0: div -> end : [ 0>=A ], cost: 1 3.71/1.97 3.71/1.97 1: div -> end : [ A>=B ], cost: 1 3.71/1.97 3.71/1.97 2: div -> div : B'=-A+B, [ B>=1+A && A>=1 ], cost: 1 3.71/1.97 3.71/1.97 3: start -> div : [], cost: 1 3.71/1.97 3.71/1.97 3.71/1.97 3.71/1.97 Removed unreachable and leaf rules: 3.71/1.97 3.71/1.97 Start location: start 3.71/1.97 3.71/1.97 2: div -> div : B'=-A+B, [ B>=1+A && A>=1 ], cost: 1 3.71/1.97 3.71/1.97 3: start -> div : [], cost: 1 3.71/1.97 3.71/1.97 3.71/1.97 3.71/1.97 ### Simplification by acceleration and chaining ### 3.71/1.97 3.71/1.97 3.71/1.97 3.71/1.97 Accelerating simple loops of location 0. 3.71/1.97 3.71/1.97 Accelerating the following rules: 3.71/1.97 3.71/1.97 2: div -> div : B'=-A+B, [ B>=1+A && A>=1 ], cost: 1 3.71/1.97 3.71/1.97 3.71/1.97 3.71/1.97 Accelerated rule 2 with backward acceleration, yielding the new rule 4. 3.71/1.97 3.71/1.97 Removing the simple loops: 2. 3.71/1.97 3.71/1.97 3.71/1.97 3.71/1.97 Accelerated all simple loops using metering functions (where possible): 3.71/1.97 3.71/1.97 Start location: start 3.71/1.97 3.71/1.97 4: div -> div : B'=-k*A+B, [ B>=1+A && A>=1 && k>0 && -(-1+k)*A+B>=1+A ], cost: k 3.71/1.97 3.71/1.97 3: start -> div : [], cost: 1 3.71/1.97 3.71/1.97 3.71/1.97 3.71/1.97 Chained accelerated rules (with incoming rules): 3.71/1.97 3.71/1.97 Start location: start 3.71/1.97 3.71/1.97 3: start -> div : [], cost: 1 3.71/1.97 3.71/1.97 5: start -> div : B'=-k*A+B, [ B>=1+A && A>=1 && k>0 && -(-1+k)*A+B>=1+A ], cost: 1+k 3.71/1.97 3.71/1.97 3.71/1.97 3.71/1.97 Removed unreachable locations (and leaf rules with constant cost): 3.71/1.97 3.71/1.97 Start location: start 3.71/1.97 3.71/1.97 5: start -> div : B'=-k*A+B, [ B>=1+A && A>=1 && k>0 && -(-1+k)*A+B>=1+A ], cost: 1+k 3.71/1.97 3.71/1.97 3.71/1.97 3.71/1.97 ### Computing asymptotic complexity ### 3.71/1.97 3.71/1.97 3.71/1.97 3.71/1.97 Fully simplified ITS problem 3.71/1.97 3.71/1.97 Start location: start 3.71/1.97 3.71/1.97 5: start -> div : B'=-k*A+B, [ B>=1+A && A>=1 && k>0 && -(-1+k)*A+B>=1+A ], cost: 1+k 3.71/1.97 3.71/1.97 3.71/1.97 3.71/1.97 Computing asymptotic complexity for rule 5 3.71/1.97 3.71/1.97 Simplified the guard: 3.71/1.97 3.71/1.97 5: start -> div : B'=-k*A+B, [ A>=1 && k>0 && -(-1+k)*A+B>=1+A ], cost: 1+k 3.71/1.97 3.71/1.97 Solved the limit problem by the following transformations: 3.71/1.97 3.71/1.97 Created initial limit problem: 3.71/1.97 3.71/1.97 -(-1+k)*A-A+B (+/+!), k (+/+!), 1+k (+), A (+/+!) [not solved] 3.71/1.97 3.71/1.97 3.71/1.97 3.71/1.97 removing all constraints (solved by SMT) 3.71/1.97 3.71/1.97 resulting limit problem: [solved] 3.71/1.97 3.71/1.97 3.71/1.97 3.71/1.97 applying transformation rule (C) using substitution {k==n,A==1,B==2*n} 3.71/1.97 3.71/1.97 resulting limit problem: 3.71/1.97 3.71/1.97 [solved] 3.71/1.97 3.71/1.97 3.71/1.97 3.71/1.97 Solved the limit problem by the following transformations: 3.71/1.97 3.71/1.97 Created initial limit problem: 3.71/1.97 3.71/1.97 -(-1+k)*A-A+B (+/+!), k (+/+!), 1+k (+), A (+/+!) [not solved] 3.71/1.97 3.71/1.97 3.71/1.97 3.71/1.97 applying transformation rule (C) using substitution {A==1} 3.71/1.97 3.71/1.97 resulting limit problem: 3.71/1.97 3.71/1.97 1 (+/+!), -k+B (+/+!), k (+/+!), 1+k (+) [not solved] 3.71/1.97 3.71/1.97 3.71/1.97 3.71/1.97 applying transformation rule (B), deleting 1 (+/+!) 3.71/1.97 3.71/1.97 resulting limit problem: 3.71/1.97 3.71/1.97 -k+B (+/+!), k (+/+!), 1+k (+) [not solved] 3.71/1.97 3.71/1.97 3.71/1.97 3.71/1.97 removing all constraints (solved by SMT) 3.71/1.97 3.71/1.97 resulting limit problem: [solved] 3.71/1.97 3.71/1.97 3.71/1.97 3.71/1.97 applying transformation rule (C) using substitution {k==n,B==1+n} 3.71/1.97 3.71/1.97 resulting limit problem: 3.71/1.97 3.71/1.97 [solved] 3.71/1.97 3.71/1.97 3.71/1.97 3.71/1.97 Solution: 3.71/1.97 3.71/1.97 k / n 3.71/1.97 3.71/1.97 A / 1 3.71/1.97 3.71/1.97 B / 2*n 3.71/1.97 3.71/1.97 Resulting cost 1+n has complexity: Poly(n^1) 3.71/1.97 3.71/1.97 3.71/1.97 3.71/1.97 Found new complexity Poly(n^1). 3.71/1.97 3.71/1.97 3.71/1.97 3.71/1.97 Obtained the following overall complexity (w.r.t. the length of the input n): 3.71/1.97 3.71/1.97 Complexity: Poly(n^1) 3.71/1.97 3.71/1.97 Cpx degree: 1 3.71/1.97 3.71/1.97 Solved cost: 1+n 3.71/1.97 3.71/1.97 Rule cost: 1+k 3.71/1.97 3.71/1.97 Rule guard: [ A>=1 && k>0 && -(-1+k)*A+B>=1+A ] 3.71/1.97 3.71/1.97 3.71/1.97 3.71/1.97 WORST_CASE(Omega(n^1),?) 3.71/1.97 3.71/1.97 3.71/1.97 ---------------------------------------- 3.71/1.97 3.71/1.97 (4) 3.71/1.97 BOUNDS(n^1, INF) 4.01/1.98 EOF