/export/starexec/sandbox2/solver/bin/starexec_run_complexity /export/starexec/sandbox2/benchmark/theBenchmark.xml /export/starexec/sandbox2/output/output_files -------------------------------------------------------------------------------- WORST_CASE(Omega(n^1), O(n^2)) proof of /export/starexec/sandbox2/benchmark/theBenchmark.xml # AProVE Commit ID: 794c25de1cacf0d048858bcd21c9a779e1221865 marcel 20200619 unpublished dirty The Runtime Complexity (innermost) of the given CpxTRS could be proven to be BOUNDS(n^1, n^2). (0) CpxTRS (1) RelTrsToWeightedTrsProof [BOTH BOUNDS(ID, ID), 0 ms] (2) CpxWeightedTrs (3) CpxWeightedTrsRenamingProof [BOTH BOUNDS(ID, ID), 0 ms] (4) CpxWeightedTrs (5) TypeInferenceProof [BOTH BOUNDS(ID, ID), 0 ms] (6) CpxTypedWeightedTrs (7) CompletionProof [UPPER BOUND(ID), 0 ms] (8) CpxTypedWeightedCompleteTrs (9) CpxTypedWeightedTrsToRntsProof [UPPER BOUND(ID), 0 ms] (10) CpxRNTS (11) CompleteCoflocoProof [FINISHED, 128 ms] (12) BOUNDS(1, n^2) (13) RelTrsToDecreasingLoopProblemProof [LOWER BOUND(ID), 0 ms] (14) TRS for Loop Detection (15) DecreasingLoopProof [LOWER BOUND(ID), 0 ms] (16) BEST (17) proven lower bound (18) LowerBoundPropagationProof [FINISHED, 0 ms] (19) BOUNDS(n^1, INF) (20) TRS for Loop Detection ---------------------------------------- (0) Obligation: The Runtime Complexity (innermost) of the given CpxTRS could be proven to be BOUNDS(n^1, n^2). The TRS R consists of the following rules: sum(0) -> 0 sum(s(x)) -> +(sum(x), s(x)) +(x, 0) -> x +(x, s(y)) -> s(+(x, y)) S is empty. Rewrite Strategy: INNERMOST ---------------------------------------- (1) RelTrsToWeightedTrsProof (BOTH BOUNDS(ID, ID)) Transformed relative TRS to weighted TRS ---------------------------------------- (2) Obligation: The Runtime Complexity (innermost) of the given CpxWeightedTrs could be proven to be BOUNDS(1, n^2). The TRS R consists of the following rules: sum(0) -> 0 [1] sum(s(x)) -> +(sum(x), s(x)) [1] +(x, 0) -> x [1] +(x, s(y)) -> s(+(x, y)) [1] Rewrite Strategy: INNERMOST ---------------------------------------- (3) CpxWeightedTrsRenamingProof (BOTH BOUNDS(ID, ID)) Renamed defined symbols to avoid conflicts with arithmetic symbols: + => plus ---------------------------------------- (4) Obligation: The Runtime Complexity (innermost) of the given CpxWeightedTrs could be proven to be BOUNDS(1, n^2). The TRS R consists of the following rules: sum(0) -> 0 [1] sum(s(x)) -> plus(sum(x), s(x)) [1] plus(x, 0) -> x [1] plus(x, s(y)) -> s(plus(x, y)) [1] Rewrite Strategy: INNERMOST ---------------------------------------- (5) TypeInferenceProof (BOTH BOUNDS(ID, ID)) Infered types. ---------------------------------------- (6) Obligation: Runtime Complexity Weighted TRS with Types. The TRS R consists of the following rules: sum(0) -> 0 [1] sum(s(x)) -> plus(sum(x), s(x)) [1] plus(x, 0) -> x [1] plus(x, s(y)) -> s(plus(x, y)) [1] The TRS has the following type information: sum :: 0:s -> 0:s 0 :: 0:s s :: 0:s -> 0:s plus :: 0:s -> 0:s -> 0:s Rewrite Strategy: INNERMOST ---------------------------------------- (7) CompletionProof (UPPER BOUND(ID)) The TRS is a completely defined constructor system, as every type has a constant constructor and the following rules were added: none And the following fresh constants: none ---------------------------------------- (8) Obligation: Runtime Complexity Weighted TRS where all functions are completely defined. The underlying TRS is: Runtime Complexity Weighted TRS with Types. The TRS R consists of the following rules: sum(0) -> 0 [1] sum(s(x)) -> plus(sum(x), s(x)) [1] plus(x, 0) -> x [1] plus(x, s(y)) -> s(plus(x, y)) [1] The TRS has the following type information: sum :: 0:s -> 0:s 0 :: 0:s s :: 0:s -> 0:s plus :: 0:s -> 0:s -> 0:s Rewrite Strategy: INNERMOST ---------------------------------------- (9) CpxTypedWeightedTrsToRntsProof (UPPER BOUND(ID)) Transformed the TRS into an over-approximating RNTS by (improved) Size Abstraction. The constant constructors are abstracted as follows: 0 => 0 ---------------------------------------- (10) Obligation: Complexity RNTS consisting of the following rules: plus(z, z') -{ 1 }-> x :|: x >= 0, z = x, z' = 0 plus(z, z') -{ 1 }-> 1 + plus(x, y) :|: z' = 1 + y, x >= 0, y >= 0, z = x sum(z) -{ 1 }-> plus(sum(x), 1 + x) :|: x >= 0, z = 1 + x sum(z) -{ 1 }-> 0 :|: z = 0 Only complete derivations are relevant for the runtime complexity. ---------------------------------------- (11) CompleteCoflocoProof (FINISHED) Transformed the RNTS (where only complete derivations are relevant) into cost relations for CoFloCo: eq(start(V, V2),0,[sum(V, Out)],[V >= 0]). eq(start(V, V2),0,[plus(V, V2, Out)],[V >= 0,V2 >= 0]). eq(sum(V, Out),1,[],[Out = 0,V = 0]). eq(sum(V, Out),1,[sum(V1, Ret0),plus(Ret0, 1 + V1, Ret)],[Out = Ret,V1 >= 0,V = 1 + V1]). eq(plus(V, V2, Out),1,[],[Out = V3,V3 >= 0,V = V3,V2 = 0]). eq(plus(V, V2, Out),1,[plus(V4, V5, Ret1)],[Out = 1 + Ret1,V2 = 1 + V5,V4 >= 0,V5 >= 0,V = V4]). input_output_vars(sum(V,Out),[V],[Out]). input_output_vars(plus(V,V2,Out),[V,V2],[Out]). CoFloCo proof output: Preprocessing Cost Relations ===================================== #### Computed strongly connected components 0. recursive : [plus/3] 1. recursive [non_tail] : [sum/2] 2. non_recursive : [start/2] #### Obtained direct recursion through partial evaluation 0. SCC is partially evaluated into plus/3 1. SCC is partially evaluated into sum/2 2. SCC is partially evaluated into start/2 Control-Flow Refinement of Cost Relations ===================================== ### Specialization of cost equations plus/3 * CE 6 is refined into CE [7] * CE 5 is refined into CE [8] ### Cost equations --> "Loop" of plus/3 * CEs [8] --> Loop 6 * CEs [7] --> Loop 7 ### Ranking functions of CR plus(V,V2,Out) * RF of phase [7]: [V2] #### Partial ranking functions of CR plus(V,V2,Out) * Partial RF of phase [7]: - RF of loop [7:1]: V2 ### Specialization of cost equations sum/2 * CE 4 is refined into CE [9] * CE 3 is refined into CE [10] ### Cost equations --> "Loop" of sum/2 * CEs [10] --> Loop 8 * CEs [9] --> Loop 9 ### Ranking functions of CR sum(V,Out) * RF of phase [9]: [V] #### Partial ranking functions of CR sum(V,Out) * Partial RF of phase [9]: - RF of loop [9:1]: V ### Specialization of cost equations start/2 * CE 1 is refined into CE [11,12] * CE 2 is refined into CE [13,14] ### Cost equations --> "Loop" of start/2 * CEs [12] --> Loop 10 * CEs [14] --> Loop 11 * CEs [13] --> Loop 12 * CEs [11] --> Loop 13 ### Ranking functions of CR start(V,V2) #### Partial ranking functions of CR start(V,V2) Computing Bounds ===================================== #### Cost of chains of plus(V,V2,Out): * Chain [[7],6]: 1*it(7)+1 Such that:it(7) =< V2 with precondition: [V+V2=Out,V>=0,V2>=1] * Chain [6]: 1 with precondition: [V2=0,V=Out,V>=0] #### Cost of chains of sum(V,Out): * Chain [[9],8]: 2*it(9)+1*s(3)+1 Such that:aux(3) =< V it(9) =< aux(3) s(3) =< it(9)*aux(3) with precondition: [V>=1,Out>=V] * Chain [8]: 1 with precondition: [V=0,Out=0] #### Cost of chains of start(V,V2): * Chain [13]: 1 with precondition: [V=0] * Chain [12]: 1 with precondition: [V2=0,V>=0] * Chain [11]: 1*s(4)+1 Such that:s(4) =< V2 with precondition: [V>=0,V2>=1] * Chain [10]: 2*s(6)+1*s(7)+1 Such that:s(5) =< V s(6) =< s(5) s(7) =< s(6)*s(5) with precondition: [V>=1] Closed-form bounds of start(V,V2): ------------------------------------- * Chain [13] with precondition: [V=0] - Upper bound: 1 - Complexity: constant * Chain [12] with precondition: [V2=0,V>=0] - Upper bound: 1 - Complexity: constant * Chain [11] with precondition: [V>=0,V2>=1] - Upper bound: V2+1 - Complexity: n * Chain [10] with precondition: [V>=1] - Upper bound: 2*V+1+V*V - Complexity: n^2 ### Maximum cost of start(V,V2): max([nat(V2),2*V+V*V])+1 Asymptotic class: n^2 * Total analysis performed in 75 ms. ---------------------------------------- (12) BOUNDS(1, n^2) ---------------------------------------- (13) RelTrsToDecreasingLoopProblemProof (LOWER BOUND(ID)) Transformed a relative TRS into a decreasing-loop problem. ---------------------------------------- (14) Obligation: Analyzing the following TRS for decreasing loops: The Runtime Complexity (innermost) of the given CpxTRS could be proven to be BOUNDS(n^1, n^2). The TRS R consists of the following rules: sum(0) -> 0 sum(s(x)) -> +(sum(x), s(x)) +(x, 0) -> x +(x, s(y)) -> s(+(x, y)) S is empty. Rewrite Strategy: INNERMOST ---------------------------------------- (15) DecreasingLoopProof (LOWER BOUND(ID)) The following loop(s) give(s) rise to the lower bound Omega(n^1): The rewrite sequence +(x, s(y)) ->^+ s(+(x, y)) gives rise to a decreasing loop by considering the right hand sides subterm at position [0]. The pumping substitution is [y / s(y)]. The result substitution is [ ]. ---------------------------------------- (16) Complex Obligation (BEST) ---------------------------------------- (17) Obligation: Proved the lower bound n^1 for the following obligation: The Runtime Complexity (innermost) of the given CpxTRS could be proven to be BOUNDS(n^1, n^2). The TRS R consists of the following rules: sum(0) -> 0 sum(s(x)) -> +(sum(x), s(x)) +(x, 0) -> x +(x, s(y)) -> s(+(x, y)) S is empty. Rewrite Strategy: INNERMOST ---------------------------------------- (18) LowerBoundPropagationProof (FINISHED) Propagated lower bound. ---------------------------------------- (19) BOUNDS(n^1, INF) ---------------------------------------- (20) Obligation: Analyzing the following TRS for decreasing loops: The Runtime Complexity (innermost) of the given CpxTRS could be proven to be BOUNDS(n^1, n^2). The TRS R consists of the following rules: sum(0) -> 0 sum(s(x)) -> +(sum(x), s(x)) +(x, 0) -> x +(x, s(y)) -> s(+(x, y)) S is empty. Rewrite Strategy: INNERMOST