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