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