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