WORST_CASE(Omega(n^1), O(n^1)) proof of /export/starexec/sandbox/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^1). (0) CpxTRS (1) RelTrsToWeightedTrsProof [BOTH BOUNDS(ID, ID), 0 ms] (2) CpxWeightedTrs (3) TypeInferenceProof [BOTH BOUNDS(ID, ID), 1 ms] (4) CpxTypedWeightedTrs (5) CompletionProof [UPPER BOUND(ID), 0 ms] (6) CpxTypedWeightedCompleteTrs (7) CpxTypedWeightedTrsToRntsProof [UPPER BOUND(ID), 0 ms] (8) CpxRNTS (9) CompleteCoflocoProof [FINISHED, 37 ms] (10) BOUNDS(1, n^1) (11) RelTrsToDecreasingLoopProblemProof [LOWER BOUND(ID), 0 ms] (12) TRS for Loop Detection (13) DecreasingLoopProof [LOWER BOUND(ID), 0 ms] (14) BEST (15) proven lower bound (16) LowerBoundPropagationProof [FINISHED, 0 ms] (17) BOUNDS(n^1, INF) (18) TRS for Loop Detection ---------------------------------------- (0) Obligation: The Runtime Complexity (innermost) of the given CpxTRS could be proven to be BOUNDS(n^1, n^1). The TRS R consists of the following rules: sum(0) -> 0 sum(s(x)) -> +(sum(x), s(x)) sum1(0) -> 0 sum1(s(x)) -> s(+(sum1(x), +(x, x))) 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^1). The TRS R consists of the following rules: sum(0) -> 0 [1] sum(s(x)) -> +(sum(x), s(x)) [1] sum1(0) -> 0 [1] sum1(s(x)) -> s(+(sum1(x), +(x, x))) [1] Rewrite Strategy: INNERMOST ---------------------------------------- (3) TypeInferenceProof (BOTH BOUNDS(ID, ID)) Infered types. ---------------------------------------- (4) Obligation: Runtime Complexity Weighted TRS with Types. The TRS R consists of the following rules: sum(0) -> 0 [1] sum(s(x)) -> +(sum(x), s(x)) [1] sum1(0) -> 0 [1] sum1(s(x)) -> s(+(sum1(x), +(x, x))) [1] The TRS has the following type information: sum :: 0:s:+ -> 0:s:+ 0 :: 0:s:+ s :: 0:s:+ -> 0:s:+ + :: 0:s:+ -> 0:s:+ -> 0:s:+ sum1 :: 0:s:+ -> 0:s:+ Rewrite Strategy: INNERMOST ---------------------------------------- (5) 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: sum(v0) -> null_sum [0] sum1(v0) -> null_sum1 [0] And the following fresh constants: null_sum, null_sum1 ---------------------------------------- (6) 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)) -> +(sum(x), s(x)) [1] sum1(0) -> 0 [1] sum1(s(x)) -> s(+(sum1(x), +(x, x))) [1] sum(v0) -> null_sum [0] sum1(v0) -> null_sum1 [0] The TRS has the following type information: sum :: 0:s:+:null_sum:null_sum1 -> 0:s:+:null_sum:null_sum1 0 :: 0:s:+:null_sum:null_sum1 s :: 0:s:+:null_sum:null_sum1 -> 0:s:+:null_sum:null_sum1 + :: 0:s:+:null_sum:null_sum1 -> 0:s:+:null_sum:null_sum1 -> 0:s:+:null_sum:null_sum1 sum1 :: 0:s:+:null_sum:null_sum1 -> 0:s:+:null_sum:null_sum1 null_sum :: 0:s:+:null_sum:null_sum1 null_sum1 :: 0:s:+:null_sum:null_sum1 Rewrite Strategy: INNERMOST ---------------------------------------- (7) 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 null_sum => 0 null_sum1 => 0 ---------------------------------------- (8) Obligation: Complexity RNTS consisting of the following rules: sum(z) -{ 1 }-> 0 :|: z = 0 sum(z) -{ 0 }-> 0 :|: v0 >= 0, z = v0 sum(z) -{ 1 }-> 1 + sum(x) + (1 + x) :|: x >= 0, z = 1 + x sum1(z) -{ 1 }-> 0 :|: z = 0 sum1(z) -{ 0 }-> 0 :|: v0 >= 0, z = v0 sum1(z) -{ 1 }-> 1 + (1 + sum1(x) + (1 + x + x)) :|: x >= 0, z = 1 + x Only complete derivations are relevant for the runtime complexity. ---------------------------------------- (9) CompleteCoflocoProof (FINISHED) Transformed the RNTS (where only complete derivations are relevant) into cost relations for CoFloCo: eq(start(V),0,[sum(V, Out)],[V >= 0]). eq(start(V),0,[sum1(V, Out)],[V >= 0]). eq(sum(V, Out),1,[],[Out = 0,V = 0]). eq(sum(V, Out),1,[sum(V1, Ret01)],[Out = 2 + Ret01 + V1,V1 >= 0,V = 1 + V1]). eq(sum1(V, Out),1,[],[Out = 0,V = 0]). eq(sum1(V, Out),1,[sum1(V2, Ret101)],[Out = 3 + Ret101 + 2*V2,V2 >= 0,V = 1 + V2]). eq(sum(V, Out),0,[],[Out = 0,V3 >= 0,V = V3]). eq(sum1(V, Out),0,[],[Out = 0,V4 >= 0,V = V4]). input_output_vars(sum(V,Out),[V],[Out]). input_output_vars(sum1(V,Out),[V],[Out]). CoFloCo proof output: Preprocessing Cost Relations ===================================== #### Computed strongly connected components 0. recursive : [sum/2] 1. recursive : [sum1/2] 2. non_recursive : [start/1] #### Obtained direct recursion through partial evaluation 0. SCC is partially evaluated into sum/2 1. SCC is partially evaluated into sum1/2 2. SCC is partially evaluated into start/1 Control-Flow Refinement of Cost Relations ===================================== ### Specialization of cost equations sum/2 * CE 3 is refined into CE [9] * CE 5 is refined into CE [10] * CE 4 is refined into CE [11] ### Cost equations --> "Loop" of sum/2 * CEs [11] --> Loop 6 * CEs [9,10] --> Loop 7 ### Ranking functions of CR sum(V,Out) * RF of phase [6]: [V] #### Partial ranking functions of CR sum(V,Out) * Partial RF of phase [6]: - RF of loop [6:1]: V ### Specialization of cost equations sum1/2 * CE 6 is refined into CE [12] * CE 8 is refined into CE [13] * CE 7 is refined into CE [14] ### Cost equations --> "Loop" of sum1/2 * CEs [14] --> Loop 8 * CEs [12,13] --> Loop 9 ### Ranking functions of CR sum1(V,Out) * RF of phase [8]: [V] #### Partial ranking functions of CR sum1(V,Out) * Partial RF of phase [8]: - RF of loop [8:1]: V ### Specialization of cost equations start/1 * CE 1 is refined into CE [15,16] * CE 2 is refined into CE [17,18] ### Cost equations --> "Loop" of start/1 * CEs [15,16,17,18] --> Loop 10 ### Ranking functions of CR start(V) #### Partial ranking functions of CR start(V) Computing Bounds ===================================== #### Cost of chains of sum(V,Out): * Chain [[6],7]: 1*it(6)+1 Such that:it(6) =< V with precondition: [V>=1,Out>=V+1] * Chain [7]: 1 with precondition: [Out=0,V>=0] #### Cost of chains of sum1(V,Out): * Chain [[8],9]: 1*it(8)+1 Such that:it(8) =< V with precondition: [V>=1,Out>=2*V+1] * Chain [9]: 1 with precondition: [Out=0,V>=0] #### Cost of chains of start(V): * Chain [10]: 2*s(1)+1 Such that:aux(1) =< V s(1) =< aux(1) with precondition: [V>=0] Closed-form bounds of start(V): ------------------------------------- * Chain [10] with precondition: [V>=0] - Upper bound: 2*V+1 - Complexity: n ### Maximum cost of start(V): 2*V+1 Asymptotic class: n * Total analysis performed in 58 ms. ---------------------------------------- (10) BOUNDS(1, n^1) ---------------------------------------- (11) RelTrsToDecreasingLoopProblemProof (LOWER BOUND(ID)) Transformed a relative TRS into a decreasing-loop problem. ---------------------------------------- (12) 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^1). The TRS R consists of the following rules: sum(0) -> 0 sum(s(x)) -> +(sum(x), s(x)) sum1(0) -> 0 sum1(s(x)) -> s(+(sum1(x), +(x, x))) S is empty. Rewrite Strategy: INNERMOST ---------------------------------------- (13) DecreasingLoopProof (LOWER BOUND(ID)) The following loop(s) give(s) rise to the lower bound Omega(n^1): The rewrite sequence sum(s(x)) ->^+ +(sum(x), s(x)) gives rise to a decreasing loop by considering the right hand sides subterm at position [0]. The pumping substitution is [x / s(x)]. The result substitution is [ ]. ---------------------------------------- (14) Complex Obligation (BEST) ---------------------------------------- (15) 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^1). The TRS R consists of the following rules: sum(0) -> 0 sum(s(x)) -> +(sum(x), s(x)) sum1(0) -> 0 sum1(s(x)) -> s(+(sum1(x), +(x, x))) S is empty. Rewrite Strategy: INNERMOST ---------------------------------------- (16) LowerBoundPropagationProof (FINISHED) Propagated lower bound. ---------------------------------------- (17) BOUNDS(n^1, INF) ---------------------------------------- (18) 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^1). The TRS R consists of the following rules: sum(0) -> 0 sum(s(x)) -> +(sum(x), s(x)) sum1(0) -> 0 sum1(s(x)) -> s(+(sum1(x), +(x, x))) S is empty. Rewrite Strategy: INNERMOST