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