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