/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^1)) 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^1). (0) CpxTRS (1) RelTrsToWeightedTrsProof [BOTH BOUNDS(ID, ID), 0 ms] (2) CpxWeightedTrs (3) TypeInferenceProof [BOTH BOUNDS(ID, ID), 0 ms] (4) CpxTypedWeightedTrs (5) CompletionProof [UPPER BOUND(ID), 0 ms] (6) CpxTypedWeightedCompleteTrs (7) CpxTypedWeightedTrsToRntsProof [UPPER BOUND(ID), 1 ms] (8) CpxRNTS (9) CompleteCoflocoProof [FINISHED, 302 ms] (10) BOUNDS(1, n^1) (11) RenamingProof [BOTH BOUNDS(ID, ID), 0 ms] (12) CpxTRS (13) TypeInferenceProof [BOTH BOUNDS(ID, ID), 0 ms] (14) typed CpxTrs (15) OrderProof [LOWER BOUND(ID), 0 ms] (16) typed CpxTrs (17) RewriteLemmaProof [LOWER BOUND(ID), 274 ms] (18) BEST (19) proven lower bound (20) LowerBoundPropagationProof [FINISHED, 0 ms] (21) BOUNDS(n^1, INF) (22) typed CpxTrs ---------------------------------------- (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: half(x) -> if(ge(x, s(s(0))), x) if(false, x) -> 0 if(true, x) -> s(half(p(p(x)))) p(0) -> 0 p(s(x)) -> x ge(x, 0) -> true ge(0, s(x)) -> false ge(s(x), s(y)) -> ge(x, y) log(0) -> 0 log(s(x)) -> s(log(half(s(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: half(x) -> if(ge(x, s(s(0))), x) [1] if(false, x) -> 0 [1] if(true, x) -> s(half(p(p(x)))) [1] p(0) -> 0 [1] p(s(x)) -> x [1] ge(x, 0) -> true [1] ge(0, s(x)) -> false [1] ge(s(x), s(y)) -> ge(x, y) [1] log(0) -> 0 [1] log(s(x)) -> s(log(half(s(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: half(x) -> if(ge(x, s(s(0))), x) [1] if(false, x) -> 0 [1] if(true, x) -> s(half(p(p(x)))) [1] p(0) -> 0 [1] p(s(x)) -> x [1] ge(x, 0) -> true [1] ge(0, s(x)) -> false [1] ge(s(x), s(y)) -> ge(x, y) [1] log(0) -> 0 [1] log(s(x)) -> s(log(half(s(x)))) [1] The TRS has the following type information: half :: 0:s -> 0:s if :: false:true -> 0:s -> 0:s ge :: 0:s -> 0:s -> false:true s :: 0:s -> 0:s 0 :: 0:s false :: false:true true :: false:true p :: 0:s -> 0:s log :: 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: none And the following fresh constants: none ---------------------------------------- (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: half(x) -> if(ge(x, s(s(0))), x) [1] if(false, x) -> 0 [1] if(true, x) -> s(half(p(p(x)))) [1] p(0) -> 0 [1] p(s(x)) -> x [1] ge(x, 0) -> true [1] ge(0, s(x)) -> false [1] ge(s(x), s(y)) -> ge(x, y) [1] log(0) -> 0 [1] log(s(x)) -> s(log(half(s(x)))) [1] The TRS has the following type information: half :: 0:s -> 0:s if :: false:true -> 0:s -> 0:s ge :: 0:s -> 0:s -> false:true s :: 0:s -> 0:s 0 :: 0:s false :: false:true true :: false:true p :: 0:s -> 0:s log :: 0:s -> 0:s 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 false => 0 true => 1 ---------------------------------------- (8) Obligation: Complexity RNTS consisting of the following rules: ge(z, z') -{ 1 }-> ge(x, y) :|: z' = 1 + y, x >= 0, y >= 0, z = 1 + x ge(z, z') -{ 1 }-> 1 :|: x >= 0, z = x, z' = 0 ge(z, z') -{ 1 }-> 0 :|: z' = 1 + x, x >= 0, z = 0 half(z) -{ 1 }-> if(ge(x, 1 + (1 + 0)), x) :|: x >= 0, z = x if(z, z') -{ 1 }-> 0 :|: z' = x, x >= 0, z = 0 if(z, z') -{ 1 }-> 1 + half(p(p(x))) :|: z' = x, z = 1, x >= 0 log(z) -{ 1 }-> 0 :|: z = 0 log(z) -{ 1 }-> 1 + log(half(1 + x)) :|: x >= 0, z = 1 + x p(z) -{ 1 }-> x :|: x >= 0, z = 1 + x p(z) -{ 1 }-> 0 :|: z = 0 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, V2),0,[half(V, Out)],[V >= 0]). eq(start(V, V2),0,[if(V, V2, Out)],[V >= 0,V2 >= 0]). eq(start(V, V2),0,[p(V, Out)],[V >= 0]). eq(start(V, V2),0,[ge(V, V2, Out)],[V >= 0,V2 >= 0]). eq(start(V, V2),0,[log(V, Out)],[V >= 0]). eq(half(V, Out),1,[ge(V1, 1 + (1 + 0), Ret0),if(Ret0, V1, Ret)],[Out = Ret,V1 >= 0,V = V1]). eq(if(V, V2, Out),1,[],[Out = 0,V2 = V3,V3 >= 0,V = 0]). eq(if(V, V2, Out),1,[p(V4, Ret100),p(Ret100, Ret10),half(Ret10, Ret1)],[Out = 1 + Ret1,V2 = V4,V = 1,V4 >= 0]). eq(p(V, Out),1,[],[Out = 0,V = 0]). eq(p(V, Out),1,[],[Out = V5,V5 >= 0,V = 1 + V5]). eq(ge(V, V2, Out),1,[],[Out = 1,V6 >= 0,V = V6,V2 = 0]). eq(ge(V, V2, Out),1,[],[Out = 0,V2 = 1 + V7,V7 >= 0,V = 0]). eq(ge(V, V2, Out),1,[ge(V8, V9, Ret2)],[Out = Ret2,V2 = 1 + V9,V8 >= 0,V9 >= 0,V = 1 + V8]). eq(log(V, Out),1,[],[Out = 0,V = 0]). eq(log(V, Out),1,[half(1 + V10, Ret101),log(Ret101, Ret11)],[Out = 1 + Ret11,V10 >= 0,V = 1 + V10]). input_output_vars(half(V,Out),[V],[Out]). input_output_vars(if(V,V2,Out),[V,V2],[Out]). input_output_vars(p(V,Out),[V],[Out]). input_output_vars(ge(V,V2,Out),[V,V2],[Out]). input_output_vars(log(V,Out),[V],[Out]). CoFloCo proof output: Preprocessing Cost Relations ===================================== #### Computed strongly connected components 0. recursive : [ge/3] 1. non_recursive : [p/2] 2. recursive : [half/2,if/3] 3. recursive : [log/2] 4. non_recursive : [start/2] #### Obtained direct recursion through partial evaluation 0. SCC is partially evaluated into ge/3 1. SCC is partially evaluated into p/2 2. SCC is partially evaluated into half/2 3. SCC is partially evaluated into log/2 4. SCC is partially evaluated into start/2 Control-Flow Refinement of Cost Relations ===================================== ### Specialization of cost equations ge/3 * CE 13 is refined into CE [16] * CE 11 is refined into CE [17] * CE 12 is refined into CE [18] ### Cost equations --> "Loop" of ge/3 * CEs [17] --> Loop 12 * CEs [18] --> Loop 13 * CEs [16] --> Loop 14 ### Ranking functions of CR ge(V,V2,Out) * RF of phase [14]: [V,V2] #### Partial ranking functions of CR ge(V,V2,Out) * Partial RF of phase [14]: - RF of loop [14:1]: V V2 ### Specialization of cost equations p/2 * CE 8 is refined into CE [19] * CE 7 is refined into CE [20] ### Cost equations --> "Loop" of p/2 * CEs [19] --> Loop 15 * CEs [20] --> Loop 16 ### Ranking functions of CR p(V,Out) #### Partial ranking functions of CR p(V,Out) ### Specialization of cost equations half/2 * CE 10 is refined into CE [21,22] * CE 9 is refined into CE [23] ### Cost equations --> "Loop" of half/2 * CEs [23] --> Loop 17 * CEs [22] --> Loop 18 * CEs [21] --> Loop 19 ### Ranking functions of CR half(V,Out) * RF of phase [17]: [V-1] #### Partial ranking functions of CR half(V,Out) * Partial RF of phase [17]: - RF of loop [17:1]: V-1 ### Specialization of cost equations log/2 * CE 15 is refined into CE [24,25,26] * CE 14 is refined into CE [27] ### Cost equations --> "Loop" of log/2 * CEs [27] --> Loop 20 * CEs [26] --> Loop 21 * CEs [25] --> Loop 22 * CEs [24] --> Loop 23 ### Ranking functions of CR log(V,Out) * RF of phase [21,22]: [V-1] #### Partial ranking functions of CR log(V,Out) * Partial RF of phase [21,22]: - RF of loop [21:1]: V/2-1 - RF of loop [22:1]: V-1 ### Specialization of cost equations start/2 * CE 1 is refined into CE [28,29,30,31,32,33] * CE 2 is refined into CE [34] * CE 3 is refined into CE [35,36,37,38] * CE 4 is refined into CE [39,40] * CE 5 is refined into CE [41,42,43,44] * CE 6 is refined into CE [45,46,47] ### Cost equations --> "Loop" of start/2 * CEs [42] --> Loop 24 * CEs [28,29,30,31,32,33,36,37,38,40,43,44,46,47] --> Loop 25 * CEs [34,35,39,41,45] --> Loop 26 ### Ranking functions of CR start(V,V2) #### Partial ranking functions of CR start(V,V2) Computing Bounds ===================================== #### Cost of chains of ge(V,V2,Out): * Chain [[14],13]: 1*it(14)+1 Such that:it(14) =< V with precondition: [Out=0,V>=1,V2>=V+1] * Chain [[14],12]: 1*it(14)+1 Such that:it(14) =< V2 with precondition: [Out=1,V2>=1,V>=V2] * Chain [13]: 1 with precondition: [V=0,Out=0,V2>=1] * Chain [12]: 1 with precondition: [V2=0,Out=1,V>=0] #### Cost of chains of p(V,Out): * Chain [16]: 1 with precondition: [V=0,Out=0] * Chain [15]: 1 with precondition: [V=Out+1,V>=1] #### Cost of chains of half(V,Out): * Chain [[17],19]: 5*it(17)+1*s(3)+3 Such that:aux(4) =< 2*Out it(17) =< aux(4) s(3) =< aux(4)*2 with precondition: [V=2*Out,V>=2] * Chain [[17],18]: 5*it(17)+1*s(3)+1*s(4)+3 Such that:s(4) =< 1 aux(5) =< V it(17) =< aux(5) s(3) =< aux(5)*2 with precondition: [V=2*Out+1,V>=3] * Chain [19]: 3 with precondition: [V=0,Out=0] * Chain [18]: 1*s(4)+3 Such that:s(4) =< 1 with precondition: [V=1,Out=0] #### Cost of chains of log(V,Out): * Chain [[21,22],23,20]: 4*it(21)+4*it(22)+1*s(5)+1*s(20)+10*s(21)+2*s(22)+5 Such that:s(5) =< 1 aux(13) =< V aux(14) =< 2*V aux(15) =< V/2 aux(6) =< aux(13) it(21) =< aux(13) it(22) =< aux(13) it(22) =< aux(14) aux(6) =< aux(15) it(21) =< aux(15) s(20) =< aux(6) s(21) =< aux(14) s(22) =< aux(14)*2 with precondition: [Out>=2,V+2>=2*Out] * Chain [23,20]: 1*s(5)+5 Such that:s(5) =< 1 with precondition: [V=1,Out=1] * Chain [20]: 1 with precondition: [V=0,Out=0] #### Cost of chains of start(V,V2): * Chain [26]: 3 with precondition: [V=0] * Chain [25]: 6*s(27)+11*s(29)+2*s(30)+11*s(37)+2*s(38)+4*s(51)+4*s(52)+1*s(53)+10*s(54)+2*s(55)+6 Such that:s(48) =< 2*V s(49) =< V/2 aux(16) =< 1 aux(17) =< V aux(18) =< V2 s(27) =< aux(16) s(37) =< aux(17) s(29) =< aux(18) s(30) =< aux(18)*2 s(38) =< aux(17)*2 s(50) =< aux(17) s(51) =< aux(17) s(52) =< aux(17) s(52) =< s(48) s(50) =< s(49) s(51) =< s(49) s(53) =< s(50) s(54) =< s(48) s(55) =< s(48)*2 with precondition: [V>=1] * Chain [24]: 1 with precondition: [V2=0,V>=0] Closed-form bounds of start(V,V2): ------------------------------------- * Chain [26] with precondition: [V=0] - Upper bound: 3 - Complexity: constant * Chain [25] with precondition: [V>=1] - Upper bound: 24*V+12+nat(V2)*15+28*V - Complexity: n * Chain [24] with precondition: [V2=0,V>=0] - Upper bound: 1 - Complexity: constant ### Maximum cost of start(V,V2): max([2,24*V+11+nat(V2)*15+28*V])+1 Asymptotic class: n * Total analysis performed in 215 ms. ---------------------------------------- (10) BOUNDS(1, n^1) ---------------------------------------- (11) RenamingProof (BOTH BOUNDS(ID, ID)) Renamed function symbols to avoid clashes with predefined symbol. ---------------------------------------- (12) Obligation: The Runtime Complexity (innermost) of the given CpxTRS could be proven to be BOUNDS(n^1, INF). The TRS R consists of the following rules: half(x) -> if(ge(x, s(s(0'))), x) if(false, x) -> 0' if(true, x) -> s(half(p(p(x)))) p(0') -> 0' p(s(x)) -> x ge(x, 0') -> true ge(0', s(x)) -> false ge(s(x), s(y)) -> ge(x, y) log(0') -> 0' log(s(x)) -> s(log(half(s(x)))) S is empty. Rewrite Strategy: INNERMOST ---------------------------------------- (13) TypeInferenceProof (BOTH BOUNDS(ID, ID)) Infered types. ---------------------------------------- (14) Obligation: Innermost TRS: Rules: half(x) -> if(ge(x, s(s(0'))), x) if(false, x) -> 0' if(true, x) -> s(half(p(p(x)))) p(0') -> 0' p(s(x)) -> x ge(x, 0') -> true ge(0', s(x)) -> false ge(s(x), s(y)) -> ge(x, y) log(0') -> 0' log(s(x)) -> s(log(half(s(x)))) Types: half :: 0':s -> 0':s if :: false:true -> 0':s -> 0':s ge :: 0':s -> 0':s -> false:true s :: 0':s -> 0':s 0' :: 0':s false :: false:true true :: false:true p :: 0':s -> 0':s log :: 0':s -> 0':s hole_0':s1_0 :: 0':s hole_false:true2_0 :: false:true gen_0':s3_0 :: Nat -> 0':s ---------------------------------------- (15) OrderProof (LOWER BOUND(ID)) Heuristically decided to analyse the following defined symbols: half, ge, log They will be analysed ascendingly in the following order: ge < half half < log ---------------------------------------- (16) Obligation: Innermost TRS: Rules: half(x) -> if(ge(x, s(s(0'))), x) if(false, x) -> 0' if(true, x) -> s(half(p(p(x)))) p(0') -> 0' p(s(x)) -> x ge(x, 0') -> true ge(0', s(x)) -> false ge(s(x), s(y)) -> ge(x, y) log(0') -> 0' log(s(x)) -> s(log(half(s(x)))) Types: half :: 0':s -> 0':s if :: false:true -> 0':s -> 0':s ge :: 0':s -> 0':s -> false:true s :: 0':s -> 0':s 0' :: 0':s false :: false:true true :: false:true p :: 0':s -> 0':s log :: 0':s -> 0':s hole_0':s1_0 :: 0':s hole_false:true2_0 :: false:true gen_0':s3_0 :: Nat -> 0':s Generator Equations: gen_0':s3_0(0) <=> 0' gen_0':s3_0(+(x, 1)) <=> s(gen_0':s3_0(x)) The following defined symbols remain to be analysed: ge, half, log They will be analysed ascendingly in the following order: ge < half half < log ---------------------------------------- (17) RewriteLemmaProof (LOWER BOUND(ID)) Proved the following rewrite lemma: ge(gen_0':s3_0(n5_0), gen_0':s3_0(n5_0)) -> true, rt in Omega(1 + n5_0) Induction Base: ge(gen_0':s3_0(0), gen_0':s3_0(0)) ->_R^Omega(1) true Induction Step: ge(gen_0':s3_0(+(n5_0, 1)), gen_0':s3_0(+(n5_0, 1))) ->_R^Omega(1) ge(gen_0':s3_0(n5_0), gen_0':s3_0(n5_0)) ->_IH true We have rt in Omega(n^1) and sz in O(n). Thus, we have irc_R in Omega(n). ---------------------------------------- (18) Complex Obligation (BEST) ---------------------------------------- (19) Obligation: Proved the lower bound n^1 for the following obligation: Innermost TRS: Rules: half(x) -> if(ge(x, s(s(0'))), x) if(false, x) -> 0' if(true, x) -> s(half(p(p(x)))) p(0') -> 0' p(s(x)) -> x ge(x, 0') -> true ge(0', s(x)) -> false ge(s(x), s(y)) -> ge(x, y) log(0') -> 0' log(s(x)) -> s(log(half(s(x)))) Types: half :: 0':s -> 0':s if :: false:true -> 0':s -> 0':s ge :: 0':s -> 0':s -> false:true s :: 0':s -> 0':s 0' :: 0':s false :: false:true true :: false:true p :: 0':s -> 0':s log :: 0':s -> 0':s hole_0':s1_0 :: 0':s hole_false:true2_0 :: false:true gen_0':s3_0 :: Nat -> 0':s Generator Equations: gen_0':s3_0(0) <=> 0' gen_0':s3_0(+(x, 1)) <=> s(gen_0':s3_0(x)) The following defined symbols remain to be analysed: ge, half, log They will be analysed ascendingly in the following order: ge < half half < log ---------------------------------------- (20) LowerBoundPropagationProof (FINISHED) Propagated lower bound. ---------------------------------------- (21) BOUNDS(n^1, INF) ---------------------------------------- (22) Obligation: Innermost TRS: Rules: half(x) -> if(ge(x, s(s(0'))), x) if(false, x) -> 0' if(true, x) -> s(half(p(p(x)))) p(0') -> 0' p(s(x)) -> x ge(x, 0') -> true ge(0', s(x)) -> false ge(s(x), s(y)) -> ge(x, y) log(0') -> 0' log(s(x)) -> s(log(half(s(x)))) Types: half :: 0':s -> 0':s if :: false:true -> 0':s -> 0':s ge :: 0':s -> 0':s -> false:true s :: 0':s -> 0':s 0' :: 0':s false :: false:true true :: false:true p :: 0':s -> 0':s log :: 0':s -> 0':s hole_0':s1_0 :: 0':s hole_false:true2_0 :: false:true gen_0':s3_0 :: Nat -> 0':s Lemmas: ge(gen_0':s3_0(n5_0), gen_0':s3_0(n5_0)) -> true, rt in Omega(1 + n5_0) Generator Equations: gen_0':s3_0(0) <=> 0' gen_0':s3_0(+(x, 1)) <=> s(gen_0':s3_0(x)) The following defined symbols remain to be analysed: half, log They will be analysed ascendingly in the following order: half < log