/export/starexec/sandbox2/solver/bin/starexec_run_complexity /export/starexec/sandbox2/benchmark/theBenchmark.koat /export/starexec/sandbox2/output/output_files -------------------------------------------------------------------------------- WORST_CASE(Omega(n^2), O(n^2)) proof of /export/starexec/sandbox2/benchmark/theBenchmark.koat # AProVE Commit ID: 794c25de1cacf0d048858bcd21c9a779e1221865 marcel 20200619 unpublished dirty The runtime complexity of the given CpxIntTrs could be proven to be BOUNDS(n^2, max(1, 5 + 2 * Arg_0) + nat(1 + Arg_0) + nat(2 + 3 * Arg_0 + Arg_0^2)). (0) CpxIntTrs (1) Koat2 Proof [FINISHED, 222 ms] (2) BOUNDS(1, max(1, 5 + 2 * Arg_0) + nat(1 + Arg_0) + nat(2 + 3 * Arg_0 + Arg_0^2)) (3) Loat Proof [FINISHED, 428 ms] (4) BOUNDS(n^2, INF) ---------------------------------------- (0) Obligation: Complexity Int TRS consisting of the following rules: eval1(A, B) -> Com_1(eval2(A, 0)) :|: A >= 0 eval2(A, B) -> Com_1(eval2(A, B + 1)) :|: A >= 1 + B eval2(A, B) -> Com_1(eval1(A - 1, B)) :|: B >= A start(A, B) -> Com_1(eval1(A, B)) :|: TRUE The start-symbols are:[start_2] ---------------------------------------- (1) Koat2 Proof (FINISHED) YES( ?, 1+2*max([0, 2+Arg_0])+max([0, 1+Arg_0])+max([0, (2+Arg_0)*(1+Arg_0)]) {O(n^2)}) Initial Complexity Problem: Start: start Program_Vars: Arg_0, Arg_1 Temp_Vars: Locations: eval1, eval2, start Transitions: 0: eval1->eval2 2: eval2->eval1 1: eval2->eval2 3: start->eval1 Timebounds: Overall timebound: 1+2*max([0, 2+Arg_0])+max([0, 1+Arg_0])+max([0, (2+Arg_0)*(1+Arg_0)]) {O(n^2)} 0: eval1->eval2: max([0, 2+Arg_0]) {O(n)} 1: eval2->eval2: max([0, 1+Arg_0])+max([0, (2+Arg_0)*(1+Arg_0)]) {O(n^2)} 2: eval2->eval1: max([0, 2+Arg_0]) {O(n)} 3: start->eval1: 1 {O(1)} Costbounds: Overall costbound: 1+2*max([0, 2+Arg_0])+max([0, 1+Arg_0])+max([0, (2+Arg_0)*(1+Arg_0)]) {O(n^2)} 0: eval1->eval2: max([0, 2+Arg_0]) {O(n)} 1: eval2->eval2: max([0, 1+Arg_0])+max([0, (2+Arg_0)*(1+Arg_0)]) {O(n^2)} 2: eval2->eval1: max([0, 2+Arg_0]) {O(n)} 3: start->eval1: 1 {O(1)} Sizebounds: `Lower: 0: eval1->eval2, Arg_0: 0 {O(1)} 0: eval1->eval2, Arg_1: 0 {O(1)} 1: eval2->eval2, Arg_0: 0 {O(1)} 1: eval2->eval2, Arg_1: 0 {O(1)} 2: eval2->eval1, Arg_0: -1 {O(1)} 2: eval2->eval1, Arg_1: 0 {O(1)} 3: start->eval1, Arg_0: Arg_0 {O(n)} 3: start->eval1, Arg_1: Arg_1 {O(n)} `Upper: 0: eval1->eval2, Arg_0: Arg_0 {O(n)} 0: eval1->eval2, Arg_1: 0 {O(1)} 1: eval2->eval2, Arg_0: Arg_0 {O(n)} 1: eval2->eval2, Arg_1: max([0, 1+Arg_0])+max([0, (2+Arg_0)*(1+Arg_0)]) {O(n^2)} 2: eval2->eval1, Arg_0: Arg_0 {O(n)} 2: eval2->eval1, Arg_1: max([0, max([0, 1+Arg_0])+max([0, (2+Arg_0)*(1+Arg_0)])]) {O(n^2)} 3: start->eval1, Arg_0: Arg_0 {O(n)} 3: start->eval1, Arg_1: Arg_1 {O(n)} ---------------------------------------- (2) BOUNDS(1, max(1, 5 + 2 * Arg_0) + nat(1 + Arg_0) + nat(2 + 3 * Arg_0 + Arg_0^2)) ---------------------------------------- (3) Loat Proof (FINISHED) ### Pre-processing the ITS problem ### Initial linear ITS problem Start location: start 0: eval1 -> eval2 : B'=0, [ A>=0 ], cost: 1 1: eval2 -> eval2 : B'=1+B, [ A>=1+B ], cost: 1 2: eval2 -> eval1 : A'=-1+A, [ B>=A ], cost: 1 3: start -> eval1 : [], cost: 1 Checking for constant complexity: The following rule is satisfiable with cost >= 1, yielding constant complexity: 3: start -> eval1 : [], cost: 1 ### Simplification by acceleration and chaining ### Accelerating simple loops of location 1. Accelerating the following rules: 1: eval2 -> eval2 : B'=1+B, [ A>=1+B ], cost: 1 Accelerated rule 1 with metering function A-B, yielding the new rule 4. Removing the simple loops: 1. Accelerated all simple loops using metering functions (where possible): Start location: start 0: eval1 -> eval2 : B'=0, [ A>=0 ], cost: 1 2: eval2 -> eval1 : A'=-1+A, [ B>=A ], cost: 1 4: eval2 -> eval2 : B'=A, [ A>=1+B ], cost: A-B 3: start -> eval1 : [], cost: 1 Chained accelerated rules (with incoming rules): Start location: start 0: eval1 -> eval2 : B'=0, [ A>=0 ], cost: 1 5: eval1 -> eval2 : B'=A, [ A>=1 ], cost: 1+A 2: eval2 -> eval1 : A'=-1+A, [ B>=A ], cost: 1 3: start -> eval1 : [], cost: 1 Eliminated locations (on tree-shaped paths): Start location: start 6: eval1 -> eval1 : A'=-1+A, B'=0, [ A>=0 && 0>=A ], cost: 2 7: eval1 -> eval1 : A'=-1+A, B'=A, [ A>=1 ], cost: 2+A 3: start -> eval1 : [], cost: 1 Accelerating simple loops of location 0. Simplified some of the simple loops (and removed duplicate rules). Accelerating the following rules: 6: eval1 -> eval1 : A'=-1+A, B'=0, [ -A==0 ], cost: 2 7: eval1 -> eval1 : A'=-1+A, B'=A, [ A>=1 ], cost: 2+A Accelerated rule 6 with metering function 1+A, yielding the new rule 8. Accelerated rule 7 with metering function A, yielding the new rule 9. Removing the simple loops: 6 7. Accelerated all simple loops using metering functions (where possible): Start location: start 8: eval1 -> eval1 : A'=-1, B'=0, [ -A==0 ], cost: 2+2*A 9: eval1 -> eval1 : A'=0, B'=1, [ A>=1 ], cost: 5/2*A+1/2*A^2 3: start -> eval1 : [], cost: 1 Chained accelerated rules (with incoming rules): Start location: start 3: start -> eval1 : [], cost: 1 10: start -> eval1 : A'=-1, B'=0, [ -A==0 ], cost: 3+2*A 11: start -> eval1 : A'=0, B'=1, [ A>=1 ], cost: 1+5/2*A+1/2*A^2 Removed unreachable locations (and leaf rules with constant cost): Start location: start 10: start -> eval1 : A'=-1, B'=0, [ -A==0 ], cost: 3+2*A 11: start -> eval1 : A'=0, B'=1, [ A>=1 ], cost: 1+5/2*A+1/2*A^2 ### Computing asymptotic complexity ### Fully simplified ITS problem Start location: start 10: start -> eval1 : A'=-1, B'=0, [ -A==0 ], cost: 3+2*A 11: start -> eval1 : A'=0, B'=1, [ A>=1 ], cost: 1+5/2*A+1/2*A^2 Computing asymptotic complexity for rule 10 Could not solve the limit problem. Resulting cost 0 has complexity: Unknown Computing asymptotic complexity for rule 11 Solved the limit problem by the following transformations: Created initial limit problem: A (+/+!), 1+5/2*A+1/2*A^2 (+) [not solved] removing all constraints (solved by SMT) resulting limit problem: [solved] applying transformation rule (C) using substitution {A==n} resulting limit problem: [solved] Solution: A / n Resulting cost 1+5/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+5/2*n+1/2*n^2 Rule cost: 1+5/2*A+1/2*A^2 Rule guard: [ A>=1 ] WORST_CASE(Omega(n^2),?) ---------------------------------------- (4) BOUNDS(n^2, INF)