/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, n^2). (0) CpxIntTrs (1) Koat Proof [FINISHED, 22 ms] (2) BOUNDS(1, n^2) (3) Loat Proof [FINISHED, 263 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 >= 1 eval2(A, B) -> Com_1(eval2(A, B + 1)) :|: A >= 1 && B >= 0 && A >= B + 1 eval2(A, B) -> Com_1(eval1(A - 1, B)) :|: A >= 1 && B >= 0 && B >= A start(A, B) -> Com_1(eval1(A, B)) :|: TRUE The start-symbols are:[start_2] ---------------------------------------- (1) Koat Proof (FINISHED) YES(?, 4*ar_0 + 2*ar_0^2 + 1) Initial complexity problem: 1: T: (Comp: ?, Cost: 1) eval1(ar_0, ar_1) -> Com_1(eval2(ar_0, 0)) [ ar_0 >= 1 ] (Comp: ?, Cost: 1) eval2(ar_0, ar_1) -> Com_1(eval2(ar_0, ar_1 + 1)) [ ar_0 >= 1 /\ ar_1 >= 0 /\ ar_0 >= ar_1 + 1 ] (Comp: ?, Cost: 1) eval2(ar_0, ar_1) -> Com_1(eval1(ar_0 - 1, ar_1)) [ ar_0 >= 1 /\ ar_1 >= 0 /\ ar_1 >= ar_0 ] (Comp: ?, Cost: 1) start(ar_0, ar_1) -> Com_1(eval1(ar_0, ar_1)) (Comp: 1, Cost: 0) koat_start(ar_0, ar_1) -> Com_1(start(ar_0, ar_1)) [ 0 <= 0 ] start location: koat_start leaf cost: 0 Repeatedly propagating knowledge in problem 1 produces the following problem: 2: T: (Comp: ?, Cost: 1) eval1(ar_0, ar_1) -> Com_1(eval2(ar_0, 0)) [ ar_0 >= 1 ] (Comp: ?, Cost: 1) eval2(ar_0, ar_1) -> Com_1(eval2(ar_0, ar_1 + 1)) [ ar_0 >= 1 /\ ar_1 >= 0 /\ ar_0 >= ar_1 + 1 ] (Comp: ?, Cost: 1) eval2(ar_0, ar_1) -> Com_1(eval1(ar_0 - 1, ar_1)) [ ar_0 >= 1 /\ ar_1 >= 0 /\ ar_1 >= ar_0 ] (Comp: 1, Cost: 1) start(ar_0, ar_1) -> Com_1(eval1(ar_0, ar_1)) (Comp: 1, Cost: 0) koat_start(ar_0, ar_1) -> Com_1(start(ar_0, ar_1)) [ 0 <= 0 ] start location: koat_start leaf cost: 0 A polynomial rank function with Pol(eval1) = 2*V_1 Pol(eval2) = 2*V_1 - 1 Pol(start) = 2*V_1 Pol(koat_start) = 2*V_1 orients all transitions weakly and the transitions eval2(ar_0, ar_1) -> Com_1(eval1(ar_0 - 1, ar_1)) [ ar_0 >= 1 /\ ar_1 >= 0 /\ ar_1 >= ar_0 ] eval1(ar_0, ar_1) -> Com_1(eval2(ar_0, 0)) [ ar_0 >= 1 ] strictly and produces the following problem: 3: T: (Comp: 2*ar_0, Cost: 1) eval1(ar_0, ar_1) -> Com_1(eval2(ar_0, 0)) [ ar_0 >= 1 ] (Comp: ?, Cost: 1) eval2(ar_0, ar_1) -> Com_1(eval2(ar_0, ar_1 + 1)) [ ar_0 >= 1 /\ ar_1 >= 0 /\ ar_0 >= ar_1 + 1 ] (Comp: 2*ar_0, Cost: 1) eval2(ar_0, ar_1) -> Com_1(eval1(ar_0 - 1, ar_1)) [ ar_0 >= 1 /\ ar_1 >= 0 /\ ar_1 >= ar_0 ] (Comp: 1, Cost: 1) start(ar_0, ar_1) -> Com_1(eval1(ar_0, ar_1)) (Comp: 1, Cost: 0) koat_start(ar_0, ar_1) -> Com_1(start(ar_0, ar_1)) [ 0 <= 0 ] start location: koat_start leaf cost: 0 A polynomial rank function with Pol(eval2) = V_1 - V_2 and size complexities S("koat_start(ar_0, ar_1) -> Com_1(start(ar_0, ar_1)) [ 0 <= 0 ]", 0-0) = ar_0 S("koat_start(ar_0, ar_1) -> Com_1(start(ar_0, ar_1)) [ 0 <= 0 ]", 0-1) = ar_1 S("start(ar_0, ar_1) -> Com_1(eval1(ar_0, ar_1))", 0-0) = ar_0 S("start(ar_0, ar_1) -> Com_1(eval1(ar_0, ar_1))", 0-1) = ar_1 S("eval2(ar_0, ar_1) -> Com_1(eval1(ar_0 - 1, ar_1)) [ ar_0 >= 1 /\\ ar_1 >= 0 /\\ ar_1 >= ar_0 ]", 0-0) = ar_0 S("eval2(ar_0, ar_1) -> Com_1(eval1(ar_0 - 1, ar_1)) [ ar_0 >= 1 /\\ ar_1 >= 0 /\\ ar_1 >= ar_0 ]", 0-1) = ar_0 S("eval2(ar_0, ar_1) -> Com_1(eval2(ar_0, ar_1 + 1)) [ ar_0 >= 1 /\\ ar_1 >= 0 /\\ ar_0 >= ar_1 + 1 ]", 0-0) = ar_0 S("eval2(ar_0, ar_1) -> Com_1(eval2(ar_0, ar_1 + 1)) [ ar_0 >= 1 /\\ ar_1 >= 0 /\\ ar_0 >= ar_1 + 1 ]", 0-1) = ar_0 S("eval1(ar_0, ar_1) -> Com_1(eval2(ar_0, 0)) [ ar_0 >= 1 ]", 0-0) = ar_0 S("eval1(ar_0, ar_1) -> Com_1(eval2(ar_0, 0)) [ ar_0 >= 1 ]", 0-1) = 0 orients the transitions eval2(ar_0, ar_1) -> Com_1(eval2(ar_0, ar_1 + 1)) [ ar_0 >= 1 /\ ar_1 >= 0 /\ ar_0 >= ar_1 + 1 ] weakly and the transition eval2(ar_0, ar_1) -> Com_1(eval2(ar_0, ar_1 + 1)) [ ar_0 >= 1 /\ ar_1 >= 0 /\ ar_0 >= ar_1 + 1 ] strictly and produces the following problem: 4: T: (Comp: 2*ar_0, Cost: 1) eval1(ar_0, ar_1) -> Com_1(eval2(ar_0, 0)) [ ar_0 >= 1 ] (Comp: 2*ar_0^2, Cost: 1) eval2(ar_0, ar_1) -> Com_1(eval2(ar_0, ar_1 + 1)) [ ar_0 >= 1 /\ ar_1 >= 0 /\ ar_0 >= ar_1 + 1 ] (Comp: 2*ar_0, Cost: 1) eval2(ar_0, ar_1) -> Com_1(eval1(ar_0 - 1, ar_1)) [ ar_0 >= 1 /\ ar_1 >= 0 /\ ar_1 >= ar_0 ] (Comp: 1, Cost: 1) start(ar_0, ar_1) -> Com_1(eval1(ar_0, ar_1)) (Comp: 1, Cost: 0) koat_start(ar_0, ar_1) -> Com_1(start(ar_0, ar_1)) [ 0 <= 0 ] start location: koat_start leaf cost: 0 Complexity upper bound 4*ar_0 + 2*ar_0^2 + 1 Time: 0.068 sec (SMT: 0.062 sec) ---------------------------------------- (2) BOUNDS(1, n^2) ---------------------------------------- (3) Loat Proof (FINISHED) ### Pre-processing the ITS problem ### Initial linear ITS problem Start location: start 0: eval1 -> eval2 : B'=0, [ A>=1 ], cost: 1 1: eval2 -> eval2 : B'=1+B, [ A>=1 && B>=0 && A>=1+B ], cost: 1 2: eval2 -> eval1 : A'=-1+A, [ A>=1 && B>=0 && B>=A ], cost: 1 3: start -> eval1 : [], cost: 1 Simplified all rules, resulting in: Start location: start 0: eval1 -> eval2 : B'=0, [ A>=1 ], cost: 1 1: eval2 -> eval2 : B'=1+B, [ B>=0 && A>=1+B ], cost: 1 2: eval2 -> eval1 : A'=-1+A, [ A>=1 && B>=0 && B>=A ], cost: 1 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, [ B>=0 && 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>=1 ], cost: 1 2: eval2 -> eval1 : A'=-1+A, [ A>=1 && B>=0 && B>=A ], cost: 1 4: eval2 -> eval2 : B'=A, [ B>=0 && 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>=1 ], cost: 1 5: eval1 -> eval2 : B'=A, [ A>=1 ], cost: 1+A 2: eval2 -> eval1 : A'=-1+A, [ A>=1 && B>=0 && 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'=A, [ A>=1 ], cost: 2+A 3: start -> eval1 : [], cost: 1 Accelerating simple loops of location 0. Accelerating the following rules: 6: eval1 -> eval1 : A'=-1+A, B'=A, [ A>=1 ], cost: 2+A Accelerated rule 6 with metering function A, yielding the new rule 7. Removing the simple loops: 6. Accelerated all simple loops using metering functions (where possible): Start location: start 7: 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 8: 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 8: 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 8: start -> eval1 : A'=0, B'=1, [ A>=1 ], cost: 1+5/2*A+1/2*A^2 Computing asymptotic complexity for rule 8 Solved the limit problem by the following transformations: Created initial limit problem: 1+5/2*A+1/2*A^2 (+), A (+/+!) [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+1/2*n^2+5/2*n 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+1/2*n^2+5/2*n Rule cost: 1+5/2*A+1/2*A^2 Rule guard: [ A>=1 ] WORST_CASE(Omega(n^2),?) ---------------------------------------- (4) BOUNDS(n^2, INF)