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