/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, nat(2 + Arg_1) + max(2, 4 + Arg_1) + nat(6 + 9 * Arg_1 + 3 * Arg_1^2) + nat(3 + 3 * Arg_1)). (0) CpxIntTrs (1) Koat2 Proof [FINISHED, 972 ms] (2) BOUNDS(1, nat(2 + Arg_1) + max(2, 4 + Arg_1) + nat(6 + 9 * Arg_1 + 3 * Arg_1^2) + nat(3 + 3 * Arg_1)) (3) Loat Proof [FINISHED, 1339 ms] (4) BOUNDS(n^2, INF) ---------------------------------------- (0) Obligation: Complexity Int TRS consisting of the following rules: f0(A, B, C, D) -> Com_1(f4(0, B, C, D)) :|: TRUE f4(A, B, C, D) -> Com_1(f7(A, B, A + 1, D)) :|: B >= A + 1 f7(A, B, C, D) -> Com_1(f7(A, B, C + 1, 0)) :|: B >= C + 1 f7(A, B, C, D) -> Com_1(f7(A, B - 1, C, E)) :|: B >= C + 1 && 0 >= E + 1 f7(A, B, C, D) -> Com_1(f7(A, B - 1, C, E)) :|: B >= C + 1 && E >= 1 f7(A, B, C, D) -> Com_1(f4(A + 1, B, C, D)) :|: C >= B f4(A, B, C, D) -> Com_1(f19(A, B, C, D)) :|: A >= B The start-symbols are:[f0_4] ---------------------------------------- (1) Koat2 Proof (FINISHED) YES( ?, 2*(max([0, (2+Arg_1)*(1+Arg_1)])+max([0, 1+Arg_1]))+max([0, 2+Arg_1])+max([2, 4+Arg_1])+max([0, (2+Arg_1)*(1+Arg_1)])+max([0, 1+Arg_1]) {O(n^2)}) Initial Complexity Problem: Start: f0 Program_Vars: Arg_0, Arg_1, Arg_2, Arg_3 Temp_Vars: E Locations: f0, f19, f4, f7 Transitions: 0: f0->f4 6: f4->f19 1: f4->f7 5: f7->f4 2: f7->f7 3: f7->f7 4: f7->f7 Timebounds: Overall timebound: 2*(max([0, (2+Arg_1)*(1+Arg_1)])+max([0, 1+Arg_1]))+max([0, 2+Arg_1])+max([2, 4+Arg_1])+max([0, (2+Arg_1)*(1+Arg_1)])+max([0, 1+Arg_1]) {O(n^2)} 0: f0->f4: 1 {O(1)} 1: f4->f7: max([0, 2+Arg_1]) {O(n)} 6: f4->f19: 1 {O(1)} 2: f7->f7: max([0, (2+Arg_1)*(1+Arg_1)])+max([0, 1+Arg_1]) {O(n^2)} 3: f7->f7: max([0, (2+Arg_1)*(1+Arg_1)])+max([0, 1+Arg_1]) {O(n^2)} 4: f7->f7: max([0, (2+Arg_1)*(1+Arg_1)])+max([0, 1+Arg_1]) {O(n^2)} 5: f7->f4: max([0, 2+Arg_1]) {O(n)} Costbounds: Overall costbound: 2*(max([0, (2+Arg_1)*(1+Arg_1)])+max([0, 1+Arg_1]))+max([0, 2+Arg_1])+max([2, 4+Arg_1])+max([0, (2+Arg_1)*(1+Arg_1)])+max([0, 1+Arg_1]) {O(n^2)} 0: f0->f4: 1 {O(1)} 1: f4->f7: max([0, 2+Arg_1]) {O(n)} 6: f4->f19: 1 {O(1)} 2: f7->f7: max([0, (2+Arg_1)*(1+Arg_1)])+max([0, 1+Arg_1]) {O(n^2)} 3: f7->f7: max([0, (2+Arg_1)*(1+Arg_1)])+max([0, 1+Arg_1]) {O(n^2)} 4: f7->f7: max([0, (2+Arg_1)*(1+Arg_1)])+max([0, 1+Arg_1]) {O(n^2)} 5: f7->f4: max([0, 2+Arg_1]) {O(n)} Sizebounds: `Lower: 0: f0->f4, Arg_0: 0 {O(1)} 0: f0->f4, Arg_1: Arg_1 {O(n)} 0: f0->f4, Arg_2: Arg_2 {O(n)} 0: f0->f4, Arg_3: Arg_3 {O(n)} 1: f4->f7, Arg_0: 0 {O(1)} 1: f4->f7, Arg_1: Arg_1+-2*(max([0, (2+Arg_1)*(1+Arg_1)])+max([0, 1+Arg_1])) {O(n^2)} 1: f4->f7, Arg_2: 1 {O(1)} 6: f4->f19, Arg_0: 0 {O(1)} 6: f4->f19, Arg_1: min([Arg_1, -(-(Arg_1)+2*(max([0, (2+Arg_1)*(1+Arg_1)])+max([0, 1+Arg_1])))]) {O(n^2)} 6: f4->f19, Arg_2: min([1, Arg_2]) {O(n)} 2: f7->f7, Arg_0: 0 {O(1)} 2: f7->f7, Arg_1: Arg_1+-2*(max([0, (2+Arg_1)*(1+Arg_1)])+max([0, 1+Arg_1])) {O(n^2)} 2: f7->f7, Arg_2: 1 {O(1)} 2: f7->f7, Arg_3: 0 {O(1)} 3: f7->f7, Arg_0: 0 {O(1)} 3: f7->f7, Arg_1: Arg_1+-2*(max([0, (2+Arg_1)*(1+Arg_1)])+max([0, 1+Arg_1])) {O(n^2)} 3: f7->f7, Arg_2: 1 {O(1)} 4: f7->f7, Arg_0: 0 {O(1)} 4: f7->f7, Arg_1: Arg_1+-2*(max([0, (2+Arg_1)*(1+Arg_1)])+max([0, 1+Arg_1])) {O(n^2)} 4: f7->f7, Arg_2: 1 {O(1)} 4: f7->f7, Arg_3: 1 {O(1)} 5: f7->f4, Arg_0: 0 {O(1)} 5: f7->f4, Arg_1: Arg_1+-2*(max([0, (2+Arg_1)*(1+Arg_1)])+max([0, 1+Arg_1])) {O(n^2)} 5: f7->f4, Arg_2: 1 {O(1)} `Upper: 0: f0->f4, Arg_0: 0 {O(1)} 0: f0->f4, Arg_1: Arg_1 {O(n)} 0: f0->f4, Arg_2: Arg_2 {O(n)} 0: f0->f4, Arg_3: Arg_3 {O(n)} 1: f4->f7, Arg_0: max([0, 2+Arg_1]) {O(n)} 1: f4->f7, Arg_1: Arg_1 {O(n)} 1: f4->f7, Arg_2: max([1, 3+Arg_1]) {O(n)} 6: f4->f19, Arg_0: max([0, 2+Arg_1]) {O(n)} 6: f4->f19, Arg_1: Arg_1 {O(n)} 6: f4->f19, Arg_2: max([1, max([Arg_2, max([max([0, (2+Arg_1)*(1+Arg_1)])+max([0, 1+Arg_1])+max([1, 3+Arg_1]), 3+Arg_1])])]) {O(n^2)} 2: f7->f7, Arg_0: max([0, 2+Arg_1]) {O(n)} 2: f7->f7, Arg_1: Arg_1 {O(n)} 2: f7->f7, Arg_2: max([0, (2+Arg_1)*(1+Arg_1)])+max([0, 1+Arg_1])+max([1, 3+Arg_1]) {O(n^2)} 2: f7->f7, Arg_3: 0 {O(1)} 3: f7->f7, Arg_0: max([0, 2+Arg_1]) {O(n)} 3: f7->f7, Arg_1: Arg_1 {O(n)} 3: f7->f7, Arg_2: max([0, (2+Arg_1)*(1+Arg_1)])+max([0, 1+Arg_1])+max([1, 3+Arg_1]) {O(n^2)} 3: f7->f7, Arg_3: -1 {O(1)} 4: f7->f7, Arg_0: max([0, 2+Arg_1]) {O(n)} 4: f7->f7, Arg_1: Arg_1 {O(n)} 4: f7->f7, Arg_2: max([0, (2+Arg_1)*(1+Arg_1)])+max([0, 1+Arg_1])+max([1, 3+Arg_1]) {O(n^2)} 5: f7->f4, Arg_0: max([0, 2+Arg_1]) {O(n)} 5: f7->f4, Arg_1: Arg_1 {O(n)} 5: f7->f4, Arg_2: max([1, max([max([0, (2+Arg_1)*(1+Arg_1)])+max([0, 1+Arg_1])+max([1, 3+Arg_1]), 3+Arg_1])]) {O(n^2)} ---------------------------------------- (2) BOUNDS(1, nat(2 + Arg_1) + max(2, 4 + Arg_1) + nat(6 + 9 * Arg_1 + 3 * Arg_1^2) + nat(3 + 3 * Arg_1)) ---------------------------------------- (3) Loat Proof (FINISHED) ### Pre-processing the ITS problem ### Initial linear ITS problem Start location: f0 0: f0 -> f4 : A'=0, [], cost: 1 1: f4 -> f7 : C'=1+A, [ B>=1+A ], cost: 1 6: f4 -> f19 : [ A>=B ], cost: 1 2: f7 -> f7 : C'=1+C, D'=0, [ B>=1+C ], cost: 1 3: f7 -> f7 : B'=-1+B, D'=free, [ B>=1+C && 0>=1+free ], cost: 1 4: f7 -> f7 : B'=-1+B, D'=free_1, [ B>=1+C && free_1>=1 ], cost: 1 5: f7 -> f4 : A'=1+A, [ C>=B ], cost: 1 Checking for constant complexity: The following rule is satisfiable with cost >= 1, yielding constant complexity: 0: f0 -> f4 : A'=0, [], cost: 1 Removed unreachable and leaf rules: Start location: f0 0: f0 -> f4 : A'=0, [], cost: 1 1: f4 -> f7 : C'=1+A, [ B>=1+A ], cost: 1 2: f7 -> f7 : C'=1+C, D'=0, [ B>=1+C ], cost: 1 3: f7 -> f7 : B'=-1+B, D'=free, [ B>=1+C && 0>=1+free ], cost: 1 4: f7 -> f7 : B'=-1+B, D'=free_1, [ B>=1+C && free_1>=1 ], cost: 1 5: f7 -> f4 : A'=1+A, [ C>=B ], cost: 1 ### Simplification by acceleration and chaining ### Accelerating simple loops of location 2. Accelerating the following rules: 2: f7 -> f7 : C'=1+C, D'=0, [ B>=1+C ], cost: 1 3: f7 -> f7 : B'=-1+B, D'=free, [ B>=1+C && 0>=1+free ], cost: 1 4: f7 -> f7 : B'=-1+B, D'=free_1, [ B>=1+C && free_1>=1 ], cost: 1 Accelerated rule 2 with metering function -C+B, yielding the new rule 7. Accelerated rule 3 with metering function -C+B, yielding the new rule 8. Accelerated rule 4 with metering function -C+B, yielding the new rule 9. Removing the simple loops: 2 3 4. Accelerated all simple loops using metering functions (where possible): Start location: f0 0: f0 -> f4 : A'=0, [], cost: 1 1: f4 -> f7 : C'=1+A, [ B>=1+A ], cost: 1 5: f7 -> f4 : A'=1+A, [ C>=B ], cost: 1 7: f7 -> f7 : C'=B, D'=0, [ B>=1+C ], cost: -C+B 8: f7 -> f7 : B'=C, D'=free, [ B>=1+C && 0>=1+free ], cost: -C+B 9: f7 -> f7 : B'=C, D'=free_1, [ B>=1+C && free_1>=1 ], cost: -C+B Chained accelerated rules (with incoming rules): Start location: f0 0: f0 -> f4 : A'=0, [], cost: 1 1: f4 -> f7 : C'=1+A, [ B>=1+A ], cost: 1 10: f4 -> f7 : C'=B, D'=0, [ B>=2+A ], cost: -A+B 11: f4 -> f7 : B'=1+A, C'=1+A, D'=free, [ B>=2+A && 0>=1+free ], cost: -A+B 12: f4 -> f7 : B'=1+A, C'=1+A, D'=free_1, [ B>=2+A && free_1>=1 ], cost: -A+B 5: f7 -> f4 : A'=1+A, [ C>=B ], cost: 1 Eliminated locations (on tree-shaped paths): Start location: f0 0: f0 -> f4 : A'=0, [], cost: 1 13: f4 -> f4 : A'=1+A, C'=1+A, [ B>=1+A && 1+A>=B ], cost: 2 14: f4 -> f4 : A'=1+A, C'=B, D'=0, [ B>=2+A ], cost: 1-A+B 15: f4 -> f4 : A'=1+A, B'=1+A, C'=1+A, D'=free, [ B>=2+A && 0>=1+free ], cost: 1-A+B 16: f4 -> f4 : A'=1+A, B'=1+A, C'=1+A, D'=free_1, [ B>=2+A && free_1>=1 ], cost: 1-A+B Accelerating simple loops of location 1. Simplified some of the simple loops (and removed duplicate rules). Accelerating the following rules: 13: f4 -> f4 : A'=1+A, C'=1+A, [ 1+A-B==0 ], cost: 2 14: f4 -> f4 : A'=1+A, C'=B, D'=0, [ B>=2+A ], cost: 1-A+B 15: f4 -> f4 : A'=1+A, B'=1+A, C'=1+A, D'=free, [ B>=2+A && 0>=1+free ], cost: 1-A+B 16: f4 -> f4 : A'=1+A, B'=1+A, C'=1+A, D'=free_1, [ B>=2+A && free_1>=1 ], cost: 1-A+B Accelerated rule 13 with metering function -A+B, yielding the new rule 17. Accelerated rule 14 with metering function -1-A+B, yielding the new rule 18. Found no metering function for rule 15. Found no metering function for rule 16. Removing the simple loops: 13 14. Accelerated all simple loops using metering functions (where possible): Start location: f0 0: f0 -> f4 : A'=0, [], cost: 1 15: f4 -> f4 : A'=1+A, B'=1+A, C'=1+A, D'=free, [ B>=2+A && 0>=1+free ], cost: 1-A+B 16: f4 -> f4 : A'=1+A, B'=1+A, C'=1+A, D'=free_1, [ B>=2+A && free_1>=1 ], cost: 1-A+B 17: f4 -> f4 : A'=B, C'=B, [ 1+A-B==0 ], cost: -2*A+2*B 18: f4 -> f4 : A'=-1+B, C'=B, D'=0, [ B>=2+A ], cost: -3/2-1/2*(1+A-B)^2-3/2*A+A*(1+A-B)-(1+A-B)*B+3/2*B Chained accelerated rules (with incoming rules): Start location: f0 0: f0 -> f4 : A'=0, [], cost: 1 19: f0 -> f4 : A'=1, B'=1, C'=1, D'=free, [ B>=2 && 0>=1+free ], cost: 2+B 20: f0 -> f4 : A'=1, B'=1, C'=1, D'=free_1, [ B>=2 && free_1>=1 ], cost: 2+B 21: f0 -> f4 : A'=B, C'=B, [ 1-B==0 ], cost: 1+2*B 22: f0 -> f4 : A'=-1+B, C'=B, D'=0, [ B>=2 ], cost: -1/2+(-1+B)*B+3/2*B-1/2*(-1+B)^2 Removed unreachable locations (and leaf rules with constant cost): Start location: f0 19: f0 -> f4 : A'=1, B'=1, C'=1, D'=free, [ B>=2 && 0>=1+free ], cost: 2+B 20: f0 -> f4 : A'=1, B'=1, C'=1, D'=free_1, [ B>=2 && free_1>=1 ], cost: 2+B 21: f0 -> f4 : A'=B, C'=B, [ 1-B==0 ], cost: 1+2*B 22: f0 -> f4 : A'=-1+B, C'=B, D'=0, [ B>=2 ], cost: -1/2+(-1+B)*B+3/2*B-1/2*(-1+B)^2 ### Computing asymptotic complexity ### Fully simplified ITS problem Start location: f0 19: f0 -> f4 : A'=1, B'=1, C'=1, D'=free, [ B>=2 && 0>=1+free ], cost: 2+B 20: f0 -> f4 : A'=1, B'=1, C'=1, D'=free_1, [ B>=2 && free_1>=1 ], cost: 2+B 21: f0 -> f4 : A'=B, C'=B, [ 1-B==0 ], cost: 1+2*B 22: f0 -> f4 : A'=-1+B, C'=B, D'=0, [ B>=2 ], cost: -1/2+(-1+B)*B+3/2*B-1/2*(-1+B)^2 Computing asymptotic complexity for rule 19 Solved the limit problem by the following transformations: Created initial limit problem: -1+B (+/+!), 2+B (+), -free (+/+!) [not solved] removing all constraints (solved by SMT) resulting limit problem: [solved] applying transformation rule (C) using substitution {free==-n,B==n} resulting limit problem: [solved] Solution: free / -n B / n Resulting cost 2+n has complexity: Poly(n^1) Found new complexity Poly(n^1). Computing asymptotic complexity for rule 22 Solved the limit problem by the following transformations: Created initial limit problem: -1+3/2*B+1/2*B^2 (+), -1+B (+/+!) [not solved] removing all constraints (solved by SMT) resulting limit problem: [solved] applying transformation rule (C) using substitution {B==n} resulting limit problem: [solved] Solution: B / n Resulting cost -1+3/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+3/2*n+1/2*n^2 Rule cost: -1/2+(-1+B)*B+3/2*B-1/2*(-1+B)^2 Rule guard: [ B>=2 ] WORST_CASE(Omega(n^2),?) ---------------------------------------- (4) BOUNDS(n^2, INF)