WORST_CASE(Omega(n^1),O(n^1)) proof of /export/starexec/sandbox/benchmark/theBenchmark.trs # AProVE Commit ID: c69e44bd14796315568835c1ffa2502984884775 mhark 20210624 unpublished The Runtime Complexity (innermost) of the given CpxRelTRS could be proven to be BOUNDS(n^1, n^1). (0) CpxRelTRS (1) SInnermostTerminationProof [BOTH CONCRETE BOUNDS(ID, ID), 231 ms] (2) CpxRelTRS (3) RelTrsToWeightedTrsProof [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, 122 ms] (12) BOUNDS(1, n^1) (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 CpxRelTRS could be proven to be BOUNDS(n^1, n^1). The TRS R consists of the following rules: F(0) -> c F(s(z0)) -> c1(G(f(z0)), F(z0)) F(s(z0)) -> c2(F(z0)) F(s(z0)) -> c3(F(z0)) G(z0) -> c4 The (relative) TRS S consists of the following rules: f(0) -> 1 f(s(z0)) -> g(f(z0)) f(s(z0)) -> +(f(z0), s(f(z0))) g(z0) -> +(z0, s(z0)) Rewrite Strategy: INNERMOST ---------------------------------------- (1) SInnermostTerminationProof (BOTH CONCRETE BOUNDS(ID, ID)) proved innermost termination of relative rules ---------------------------------------- (2) Obligation: The Runtime Complexity (innermost) of the given CpxRelTRS could be proven to be BOUNDS(n^1, n^1). The TRS R consists of the following rules: F(0) -> c F(s(z0)) -> c1(G(f(z0)), F(z0)) F(s(z0)) -> c2(F(z0)) F(s(z0)) -> c3(F(z0)) G(z0) -> c4 The (relative) TRS S consists of the following rules: f(0) -> 1 f(s(z0)) -> g(f(z0)) f(s(z0)) -> +(f(z0), s(f(z0))) g(z0) -> +(z0, s(z0)) Rewrite Strategy: INNERMOST ---------------------------------------- (3) RelTrsToWeightedTrsProof (BOTH BOUNDS(ID, ID)) Transformed relative TRS to weighted TRS ---------------------------------------- (4) 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: F(0) -> c [1] F(s(z0)) -> c1(G(f(z0)), F(z0)) [1] F(s(z0)) -> c2(F(z0)) [1] F(s(z0)) -> c3(F(z0)) [1] G(z0) -> c4 [1] f(0) -> 1 [0] f(s(z0)) -> g(f(z0)) [0] f(s(z0)) -> +(f(z0), s(f(z0))) [0] g(z0) -> +(z0, s(z0)) [0] 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: F(0) -> c [1] F(s(z0)) -> c1(G(f(z0)), F(z0)) [1] F(s(z0)) -> c2(F(z0)) [1] F(s(z0)) -> c3(F(z0)) [1] G(z0) -> c4 [1] f(0) -> 1 [0] f(s(z0)) -> g(f(z0)) [0] f(s(z0)) -> +(f(z0), s(f(z0))) [0] g(z0) -> +(z0, s(z0)) [0] The TRS has the following type information: F :: 0:s:1:+ -> c:c1:c2:c3 0 :: 0:s:1:+ c :: c:c1:c2:c3 s :: 0:s:1:+ -> 0:s:1:+ c1 :: c4 -> c:c1:c2:c3 -> c:c1:c2:c3 G :: 0:s:1:+ -> c4 f :: 0:s:1:+ -> 0:s:1:+ c2 :: c:c1:c2:c3 -> c:c1:c2:c3 c3 :: c:c1:c2:c3 -> c:c1:c2:c3 c4 :: c4 1 :: 0:s:1:+ g :: 0:s:1:+ -> 0:s:1:+ + :: 0:s:1:+ -> 0:s:1:+ -> 0:s:1:+ 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: f(v0) -> null_f [0] g(v0) -> null_g [0] F(v0) -> null_F [0] And the following fresh constants: null_f, null_g, null_F ---------------------------------------- (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: F(0) -> c [1] F(s(z0)) -> c1(G(f(z0)), F(z0)) [1] F(s(z0)) -> c2(F(z0)) [1] F(s(z0)) -> c3(F(z0)) [1] G(z0) -> c4 [1] f(0) -> 1 [0] f(s(z0)) -> g(f(z0)) [0] f(s(z0)) -> +(f(z0), s(f(z0))) [0] g(z0) -> +(z0, s(z0)) [0] f(v0) -> null_f [0] g(v0) -> null_g [0] F(v0) -> null_F [0] The TRS has the following type information: F :: 0:s:1:+:null_f:null_g -> c:c1:c2:c3:null_F 0 :: 0:s:1:+:null_f:null_g c :: c:c1:c2:c3:null_F s :: 0:s:1:+:null_f:null_g -> 0:s:1:+:null_f:null_g c1 :: c4 -> c:c1:c2:c3:null_F -> c:c1:c2:c3:null_F G :: 0:s:1:+:null_f:null_g -> c4 f :: 0:s:1:+:null_f:null_g -> 0:s:1:+:null_f:null_g c2 :: c:c1:c2:c3:null_F -> c:c1:c2:c3:null_F c3 :: c:c1:c2:c3:null_F -> c:c1:c2:c3:null_F c4 :: c4 1 :: 0:s:1:+:null_f:null_g g :: 0:s:1:+:null_f:null_g -> 0:s:1:+:null_f:null_g + :: 0:s:1:+:null_f:null_g -> 0:s:1:+:null_f:null_g -> 0:s:1:+:null_f:null_g null_f :: 0:s:1:+:null_f:null_g null_g :: 0:s:1:+:null_f:null_g null_F :: c:c1:c2:c3:null_F 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 c => 0 c4 => 0 1 => 1 null_f => 0 null_g => 0 null_F => 0 ---------------------------------------- (10) Obligation: Complexity RNTS consisting of the following rules: F(z) -{ 1 }-> 0 :|: z = 0 F(z) -{ 0 }-> 0 :|: v0 >= 0, z = v0 F(z) -{ 1 }-> 1 + F(z0) :|: z = 1 + z0, z0 >= 0 F(z) -{ 1 }-> 1 + G(f(z0)) + F(z0) :|: z = 1 + z0, z0 >= 0 G(z) -{ 1 }-> 0 :|: z = z0, z0 >= 0 f(z) -{ 0 }-> g(f(z0)) :|: z = 1 + z0, z0 >= 0 f(z) -{ 0 }-> 1 :|: z = 0 f(z) -{ 0 }-> 0 :|: v0 >= 0, z = v0 f(z) -{ 0 }-> 1 + f(z0) + (1 + f(z0)) :|: z = 1 + z0, z0 >= 0 g(z) -{ 0 }-> 0 :|: v0 >= 0, z = v0 g(z) -{ 0 }-> 1 + z0 + (1 + z0) :|: z = z0, z0 >= 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),0,[fun(V, Out)],[V >= 0]). eq(start(V),0,[fun1(V, Out)],[V >= 0]). eq(start(V),0,[f(V, Out)],[V >= 0]). eq(start(V),0,[g(V, Out)],[V >= 0]). eq(fun(V, Out),1,[],[Out = 0,V = 0]). eq(fun(V, Out),1,[f(V1, Ret010),fun1(Ret010, Ret01),fun(V1, Ret1)],[Out = 1 + Ret01 + Ret1,V = 1 + V1,V1 >= 0]). eq(fun(V, Out),1,[fun(V2, Ret11)],[Out = 1 + Ret11,V = 1 + V2,V2 >= 0]). eq(fun1(V, Out),1,[],[Out = 0,V = V3,V3 >= 0]). eq(f(V, Out),0,[],[Out = 1,V = 0]). eq(f(V, Out),0,[f(V4, Ret0),g(Ret0, Ret)],[Out = Ret,V = 1 + V4,V4 >= 0]). eq(f(V, Out),0,[f(V5, Ret011),f(V5, Ret111)],[Out = 2 + Ret011 + Ret111,V = 1 + V5,V5 >= 0]). eq(g(V, Out),0,[],[Out = 2 + 2*V6,V = V6,V6 >= 0]). eq(f(V, Out),0,[],[Out = 0,V7 >= 0,V = V7]). eq(g(V, Out),0,[],[Out = 0,V8 >= 0,V = V8]). eq(fun(V, Out),0,[],[Out = 0,V9 >= 0,V = V9]). input_output_vars(fun(V,Out),[V],[Out]). input_output_vars(fun1(V,Out),[V],[Out]). input_output_vars(f(V,Out),[V],[Out]). input_output_vars(g(V,Out),[V],[Out]). CoFloCo proof output: Preprocessing Cost Relations ===================================== #### Computed strongly connected components 0. non_recursive : [g/2] 1. recursive [non_tail,multiple] : [f/2] 2. non_recursive : [fun1/2] 3. recursive : [fun/2] 4. non_recursive : [start/1] #### Obtained direct recursion through partial evaluation 0. SCC is partially evaluated into g/2 1. SCC is partially evaluated into f/2 2. SCC is completely evaluated into other SCCs 3. SCC is partially evaluated into fun/2 4. SCC is partially evaluated into start/1 Control-Flow Refinement of Cost Relations ===================================== ### Specialization of cost equations g/2 * CE 13 is refined into CE [15] * CE 14 is refined into CE [16] ### Cost equations --> "Loop" of g/2 * CEs [15] --> Loop 10 * CEs [16] --> Loop 11 ### Ranking functions of CR g(V,Out) #### Partial ranking functions of CR g(V,Out) ### Specialization of cost equations f/2 * CE 12 is refined into CE [17] * CE 9 is refined into CE [18] * CE 11 is refined into CE [19] * CE 10 is refined into CE [20,21] ### Cost equations --> "Loop" of f/2 * CEs [21] --> Loop 12 * CEs [20] --> Loop 13 * CEs [19] --> Loop 14 * CEs [17] --> Loop 15 * CEs [18] --> Loop 16 ### Ranking functions of CR f(V,Out) * RF of phase [12,13,14]: [V] #### Partial ranking functions of CR f(V,Out) * Partial RF of phase [12,13,14]: - RF of loop [12:1,13:1,14:1,14:2]: V ### Specialization of cost equations fun/2 * CE 5 is refined into CE [22] * CE 8 is refined into CE [23] * CE 6 is refined into CE [24,25,26] * CE 7 is refined into CE [27] ### Cost equations --> "Loop" of fun/2 * CEs [24,25,26,27] --> Loop 17 * CEs [22,23] --> Loop 18 ### Ranking functions of CR fun(V,Out) * RF of phase [17]: [V] #### Partial ranking functions of CR fun(V,Out) * Partial RF of phase [17]: - RF of loop [17:1]: V ### Specialization of cost equations start/1 * CE 1 is refined into CE [28,29] * CE 2 is refined into CE [30] * CE 3 is refined into CE [31,32,33] * CE 4 is refined into CE [34,35] ### Cost equations --> "Loop" of start/1 * CEs [28,29,30,31,32,33,34,35] --> Loop 19 ### Ranking functions of CR start(V) #### Partial ranking functions of CR start(V) Computing Bounds ===================================== #### Cost of chains of g(V,Out): * Chain [11]: 0 with precondition: [Out=0,V>=0] * Chain [10]: 0 with precondition: [2*V+2=Out,V>=0] #### Cost of chains of f(V,Out): * Chain [16]: 0 with precondition: [V=0,Out=1] * Chain [15]: 0 with precondition: [Out=0,V>=0] * Chain [multiple([12,13,14],[[16],[15]])]: 0 with precondition: [V>=1,Out>=0] #### Cost of chains of fun(V,Out): * Chain [[17],18]: 2*it(17)+1 Such that:it(17) =< Out with precondition: [Out>=1,V>=Out] * Chain [18]: 1 with precondition: [Out=0,V>=0] #### Cost of chains of start(V): * Chain [19]: 2*s(1)+1 Such that:s(1) =< V with precondition: [V>=0] Closed-form bounds of start(V): ------------------------------------- * Chain [19] 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 128 ms. ---------------------------------------- (12) BOUNDS(1, n^1) ---------------------------------------- (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 CpxRelTRS could be proven to be BOUNDS(n^1, n^1). The TRS R consists of the following rules: F(0) -> c F(s(z0)) -> c1(G(f(z0)), F(z0)) F(s(z0)) -> c2(F(z0)) F(s(z0)) -> c3(F(z0)) G(z0) -> c4 The (relative) TRS S consists of the following rules: f(0) -> 1 f(s(z0)) -> g(f(z0)) f(s(z0)) -> +(f(z0), s(f(z0))) g(z0) -> +(z0, s(z0)) 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 F(s(z0)) ->^+ c2(F(z0)) gives rise to a decreasing loop by considering the right hand sides subterm at position [0]. The pumping substitution is [z0 / s(z0)]. 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 CpxRelTRS could be proven to be BOUNDS(n^1, n^1). The TRS R consists of the following rules: F(0) -> c F(s(z0)) -> c1(G(f(z0)), F(z0)) F(s(z0)) -> c2(F(z0)) F(s(z0)) -> c3(F(z0)) G(z0) -> c4 The (relative) TRS S consists of the following rules: f(0) -> 1 f(s(z0)) -> g(f(z0)) f(s(z0)) -> +(f(z0), s(f(z0))) g(z0) -> +(z0, s(z0)) 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 CpxRelTRS could be proven to be BOUNDS(n^1, n^1). The TRS R consists of the following rules: F(0) -> c F(s(z0)) -> c1(G(f(z0)), F(z0)) F(s(z0)) -> c2(F(z0)) F(s(z0)) -> c3(F(z0)) G(z0) -> c4 The (relative) TRS S consists of the following rules: f(0) -> 1 f(s(z0)) -> g(f(z0)) f(s(z0)) -> +(f(z0), s(f(z0))) g(z0) -> +(z0, s(z0)) Rewrite Strategy: INNERMOST