/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 (full) of the given CpxTRS could be proven to be BOUNDS(n^1, n^1). (0) CpxTRS (1) RcToIrcProof [BOTH BOUNDS(ID, ID), 0 ms] (2) CpxTRS (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), 1 ms] (10) CpxRNTS (11) CompleteCoflocoProof [FINISHED, 149 ms] (12) BOUNDS(1, n^1) (13) RenamingProof [BOTH BOUNDS(ID, ID), 0 ms] (14) CpxTRS (15) TypeInferenceProof [BOTH BOUNDS(ID, ID), 0 ms] (16) typed CpxTrs (17) OrderProof [LOWER BOUND(ID), 0 ms] (18) typed CpxTrs (19) RewriteLemmaProof [LOWER BOUND(ID), 257 ms] (20) BEST (21) proven lower bound (22) LowerBoundPropagationProof [FINISHED, 0 ms] (23) BOUNDS(n^1, INF) (24) typed CpxTrs ---------------------------------------- (0) Obligation: The Runtime Complexity (full) of the given CpxTRS could be proven to be BOUNDS(n^1, n^1). The TRS R consists of the following rules: half(0) -> 0 half(s(s(x))) -> s(half(x)) log(s(0)) -> 0 log(s(s(x))) -> s(log(s(half(x)))) S is empty. Rewrite Strategy: FULL ---------------------------------------- (1) RcToIrcProof (BOTH BOUNDS(ID, ID)) Converted rc-obligation to irc-obligation. As the TRS is a non-duplicating overlay system, we have rc = irc. ---------------------------------------- (2) Obligation: The Runtime Complexity (innermost) of the given CpxTRS could be proven to be BOUNDS(1, n^1). The TRS R consists of the following rules: half(0) -> 0 half(s(s(x))) -> s(half(x)) log(s(0)) -> 0 log(s(s(x))) -> s(log(s(half(x)))) S is empty. 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: half(0) -> 0 [1] half(s(s(x))) -> s(half(x)) [1] log(s(0)) -> 0 [1] log(s(s(x))) -> s(log(s(half(x)))) [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: half(0) -> 0 [1] half(s(s(x))) -> s(half(x)) [1] log(s(0)) -> 0 [1] log(s(s(x))) -> s(log(s(half(x)))) [1] The TRS has the following type information: half :: 0:s -> 0:s 0 :: 0:s s :: 0:s -> 0:s log :: 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: half(v0) -> null_half [0] log(v0) -> null_log [0] And the following fresh constants: null_half, null_log ---------------------------------------- (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: half(0) -> 0 [1] half(s(s(x))) -> s(half(x)) [1] log(s(0)) -> 0 [1] log(s(s(x))) -> s(log(s(half(x)))) [1] half(v0) -> null_half [0] log(v0) -> null_log [0] The TRS has the following type information: half :: 0:s:null_half:null_log -> 0:s:null_half:null_log 0 :: 0:s:null_half:null_log s :: 0:s:null_half:null_log -> 0:s:null_half:null_log log :: 0:s:null_half:null_log -> 0:s:null_half:null_log null_half :: 0:s:null_half:null_log null_log :: 0:s:null_half:null_log 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 null_half => 0 null_log => 0 ---------------------------------------- (10) Obligation: Complexity RNTS consisting of the following rules: half(z) -{ 1 }-> 0 :|: z = 0 half(z) -{ 0 }-> 0 :|: v0 >= 0, z = v0 half(z) -{ 1 }-> 1 + half(x) :|: x >= 0, z = 1 + (1 + x) log(z) -{ 1 }-> 0 :|: z = 1 + 0 log(z) -{ 0 }-> 0 :|: v0 >= 0, z = v0 log(z) -{ 1 }-> 1 + log(1 + half(x)) :|: x >= 0, z = 1 + (1 + x) 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,[half(V, Out)],[V >= 0]). eq(start(V),0,[log(V, Out)],[V >= 0]). eq(half(V, Out),1,[],[Out = 0,V = 0]). eq(half(V, Out),1,[half(V1, Ret1)],[Out = 1 + Ret1,V1 >= 0,V = 2 + V1]). eq(log(V, Out),1,[],[Out = 0,V = 1]). eq(log(V, Out),1,[half(V2, Ret101),log(1 + Ret101, Ret11)],[Out = 1 + Ret11,V2 >= 0,V = 2 + V2]). eq(half(V, Out),0,[],[Out = 0,V3 >= 0,V = V3]). eq(log(V, Out),0,[],[Out = 0,V4 >= 0,V = V4]). input_output_vars(half(V,Out),[V],[Out]). input_output_vars(log(V,Out),[V],[Out]). CoFloCo proof output: Preprocessing Cost Relations ===================================== #### Computed strongly connected components 0. recursive : [half/2] 1. recursive : [log/2] 2. non_recursive : [start/1] #### Obtained direct recursion through partial evaluation 0. SCC is partially evaluated into half/2 1. SCC is partially evaluated into log/2 2. SCC is partially evaluated into start/1 Control-Flow Refinement of Cost Relations ===================================== ### Specialization of cost equations half/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 half/2 * CEs [11] --> Loop 6 * CEs [9,10] --> Loop 7 ### Ranking functions of CR half(V,Out) * RF of phase [6]: [V-1] #### Partial ranking functions of CR half(V,Out) * Partial RF of phase [6]: - RF of loop [6:1]: V-1 ### Specialization of cost equations log/2 * CE 6 is refined into CE [12] * CE 8 is refined into CE [13] * CE 7 is refined into CE [14,15] ### Cost equations --> "Loop" of log/2 * CEs [15] --> Loop 8 * CEs [14] --> Loop 9 * CEs [12,13] --> Loop 10 ### Ranking functions of CR log(V,Out) * RF of phase [8]: [V-3] #### Partial ranking functions of CR log(V,Out) * Partial RF of phase [8]: - RF of loop [8:1]: V-3 ### Specialization of cost equations start/1 * CE 1 is refined into CE [16,17] * CE 2 is refined into CE [18,19,20,21] ### Cost equations --> "Loop" of start/1 * CEs [16,17,18,19,20,21] --> Loop 11 ### Ranking functions of CR start(V) #### Partial ranking functions of CR start(V) Computing Bounds ===================================== #### Cost of chains of half(V,Out): * Chain [[6],7]: 1*it(6)+1 Such that:it(6) =< 2*Out with precondition: [Out>=1,V>=2*Out] * Chain [7]: 1 with precondition: [Out=0,V>=0] #### Cost of chains of log(V,Out): * Chain [[8],10]: 2*it(8)+1*s(3)+1 Such that:it(8) =< V s(3) =< 2*V with precondition: [Out>=1,V>=4*Out] * Chain [[8],9,10]: 2*it(8)+1*s(3)+3 Such that:it(8) =< V s(3) =< 2*V with precondition: [Out>=2,V+4>=4*Out] * Chain [10]: 1 with precondition: [Out=0,V>=0] * Chain [9,10]: 3 with precondition: [Out=1,V>=2] #### Cost of chains of start(V): * Chain [11]: 5*s(4)+2*s(6)+3 Such that:aux(1) =< V aux(2) =< 2*V s(4) =< aux(1) s(6) =< aux(2) with precondition: [V>=0] Closed-form bounds of start(V): ------------------------------------- * Chain [11] with precondition: [V>=0] - Upper bound: 9*V+3 - Complexity: n ### Maximum cost of start(V): 9*V+3 Asymptotic class: n * Total analysis performed in 82 ms. ---------------------------------------- (12) BOUNDS(1, n^1) ---------------------------------------- (13) RenamingProof (BOTH BOUNDS(ID, ID)) Renamed function symbols to avoid clashes with predefined symbol. ---------------------------------------- (14) Obligation: The Runtime Complexity (full) of the given CpxTRS could be proven to be BOUNDS(n^1, INF). The TRS R consists of the following rules: half(0') -> 0' half(s(s(x))) -> s(half(x)) log(s(0')) -> 0' log(s(s(x))) -> s(log(s(half(x)))) S is empty. Rewrite Strategy: FULL ---------------------------------------- (15) TypeInferenceProof (BOTH BOUNDS(ID, ID)) Infered types. ---------------------------------------- (16) Obligation: TRS: Rules: half(0') -> 0' half(s(s(x))) -> s(half(x)) log(s(0')) -> 0' log(s(s(x))) -> s(log(s(half(x)))) Types: half :: 0':s -> 0':s 0' :: 0':s s :: 0':s -> 0':s log :: 0':s -> 0':s hole_0':s1_0 :: 0':s gen_0':s2_0 :: Nat -> 0':s ---------------------------------------- (17) OrderProof (LOWER BOUND(ID)) Heuristically decided to analyse the following defined symbols: half, log They will be analysed ascendingly in the following order: half < log ---------------------------------------- (18) Obligation: TRS: Rules: half(0') -> 0' half(s(s(x))) -> s(half(x)) log(s(0')) -> 0' log(s(s(x))) -> s(log(s(half(x)))) Types: half :: 0':s -> 0':s 0' :: 0':s s :: 0':s -> 0':s log :: 0':s -> 0':s hole_0':s1_0 :: 0':s gen_0':s2_0 :: Nat -> 0':s Generator Equations: gen_0':s2_0(0) <=> 0' gen_0':s2_0(+(x, 1)) <=> s(gen_0':s2_0(x)) The following defined symbols remain to be analysed: half, log They will be analysed ascendingly in the following order: half < log ---------------------------------------- (19) RewriteLemmaProof (LOWER BOUND(ID)) Proved the following rewrite lemma: half(gen_0':s2_0(*(2, n4_0))) -> gen_0':s2_0(n4_0), rt in Omega(1 + n4_0) Induction Base: half(gen_0':s2_0(*(2, 0))) ->_R^Omega(1) 0' Induction Step: half(gen_0':s2_0(*(2, +(n4_0, 1)))) ->_R^Omega(1) s(half(gen_0':s2_0(*(2, n4_0)))) ->_IH s(gen_0':s2_0(c5_0)) We have rt in Omega(n^1) and sz in O(n). Thus, we have irc_R in Omega(n). ---------------------------------------- (20) Complex Obligation (BEST) ---------------------------------------- (21) Obligation: Proved the lower bound n^1 for the following obligation: TRS: Rules: half(0') -> 0' half(s(s(x))) -> s(half(x)) log(s(0')) -> 0' log(s(s(x))) -> s(log(s(half(x)))) Types: half :: 0':s -> 0':s 0' :: 0':s s :: 0':s -> 0':s log :: 0':s -> 0':s hole_0':s1_0 :: 0':s gen_0':s2_0 :: Nat -> 0':s Generator Equations: gen_0':s2_0(0) <=> 0' gen_0':s2_0(+(x, 1)) <=> s(gen_0':s2_0(x)) The following defined symbols remain to be analysed: half, log They will be analysed ascendingly in the following order: half < log ---------------------------------------- (22) LowerBoundPropagationProof (FINISHED) Propagated lower bound. ---------------------------------------- (23) BOUNDS(n^1, INF) ---------------------------------------- (24) Obligation: TRS: Rules: half(0') -> 0' half(s(s(x))) -> s(half(x)) log(s(0')) -> 0' log(s(s(x))) -> s(log(s(half(x)))) Types: half :: 0':s -> 0':s 0' :: 0':s s :: 0':s -> 0':s log :: 0':s -> 0':s hole_0':s1_0 :: 0':s gen_0':s2_0 :: Nat -> 0':s Lemmas: half(gen_0':s2_0(*(2, n4_0))) -> gen_0':s2_0(n4_0), rt in Omega(1 + n4_0) Generator Equations: gen_0':s2_0(0) <=> 0' gen_0':s2_0(+(x, 1)) <=> s(gen_0':s2_0(x)) The following defined symbols remain to be analysed: log