/export/starexec/sandbox/solver/bin/starexec_run_complexity /export/starexec/sandbox/benchmark/theBenchmark.xml /export/starexec/sandbox/output/output_files -------------------------------------------------------------------------------- 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), 0 ms] (4) CpxTypedWeightedTrs (5) CompletionProof [UPPER BOUND(ID), 0 ms] (6) CpxTypedWeightedCompleteTrs (7) CpxTypedWeightedTrsToRntsProof [UPPER BOUND(ID), 5 ms] (8) CpxRNTS (9) CompleteCoflocoProof [FINISHED, 273 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), 290 ms] (18) BEST (19) proven lower bound (20) LowerBoundPropagationProof [FINISHED, 0 ms] (21) BOUNDS(n^1, INF) (22) typed CpxTrs (23) RewriteLemmaProof [LOWER BOUND(ID), 41 ms] (24) 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: cond(true, x, y) -> cond(gr(x, y), x, add(x, y)) gr(0, x) -> false gr(s(x), 0) -> true gr(s(x), s(y)) -> gr(x, y) add(0, x) -> x add(s(x), y) -> s(add(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^1). The TRS R consists of the following rules: cond(true, x, y) -> cond(gr(x, y), x, add(x, y)) [1] gr(0, x) -> false [1] gr(s(x), 0) -> true [1] gr(s(x), s(y)) -> gr(x, y) [1] add(0, x) -> x [1] add(s(x), y) -> s(add(x, y)) [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: cond(true, x, y) -> cond(gr(x, y), x, add(x, y)) [1] gr(0, x) -> false [1] gr(s(x), 0) -> true [1] gr(s(x), s(y)) -> gr(x, y) [1] add(0, x) -> x [1] add(s(x), y) -> s(add(x, y)) [1] The TRS has the following type information: cond :: true:false -> 0:s -> 0:s -> cond true :: true:false gr :: 0:s -> 0:s -> true:false add :: 0:s -> 0:s -> 0:s 0 :: 0:s false :: true:false s :: 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: cond(v0, v1, v2) -> null_cond [0] And the following fresh constants: null_cond ---------------------------------------- (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: cond(true, x, y) -> cond(gr(x, y), x, add(x, y)) [1] gr(0, x) -> false [1] gr(s(x), 0) -> true [1] gr(s(x), s(y)) -> gr(x, y) [1] add(0, x) -> x [1] add(s(x), y) -> s(add(x, y)) [1] cond(v0, v1, v2) -> null_cond [0] The TRS has the following type information: cond :: true:false -> 0:s -> 0:s -> null_cond true :: true:false gr :: 0:s -> 0:s -> true:false add :: 0:s -> 0:s -> 0:s 0 :: 0:s false :: true:false s :: 0:s -> 0:s null_cond :: null_cond 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: true => 1 0 => 0 false => 0 null_cond => 0 ---------------------------------------- (8) Obligation: Complexity RNTS consisting of the following rules: add(z, z') -{ 1 }-> x :|: z' = x, x >= 0, z = 0 add(z, z') -{ 1 }-> 1 + add(x, y) :|: x >= 0, y >= 0, z = 1 + x, z' = y cond(z, z', z'') -{ 1 }-> cond(gr(x, y), x, add(x, y)) :|: z' = x, z'' = y, z = 1, x >= 0, y >= 0 cond(z, z', z'') -{ 0 }-> 0 :|: v0 >= 0, z'' = v2, v1 >= 0, z = v0, z' = v1, v2 >= 0 gr(z, z') -{ 1 }-> gr(x, y) :|: z' = 1 + y, x >= 0, y >= 0, z = 1 + x gr(z, z') -{ 1 }-> 1 :|: x >= 0, z = 1 + x, z' = 0 gr(z, z') -{ 1 }-> 0 :|: z' = x, x >= 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(V1, V, V2),0,[cond(V1, V, V2, Out)],[V1 >= 0,V >= 0,V2 >= 0]). eq(start(V1, V, V2),0,[gr(V1, V, Out)],[V1 >= 0,V >= 0]). eq(start(V1, V, V2),0,[add(V1, V, Out)],[V1 >= 0,V >= 0]). eq(cond(V1, V, V2, Out),1,[gr(V4, V3, Ret0),add(V4, V3, Ret2),cond(Ret0, V4, Ret2, Ret)],[Out = Ret,V = V4,V2 = V3,V1 = 1,V4 >= 0,V3 >= 0]). eq(gr(V1, V, Out),1,[],[Out = 0,V = V5,V5 >= 0,V1 = 0]). eq(gr(V1, V, Out),1,[],[Out = 1,V6 >= 0,V1 = 1 + V6,V = 0]). eq(gr(V1, V, Out),1,[gr(V7, V8, Ret1)],[Out = Ret1,V = 1 + V8,V7 >= 0,V8 >= 0,V1 = 1 + V7]). eq(add(V1, V, Out),1,[],[Out = V9,V = V9,V9 >= 0,V1 = 0]). eq(add(V1, V, Out),1,[add(V11, V10, Ret11)],[Out = 1 + Ret11,V11 >= 0,V10 >= 0,V1 = 1 + V11,V = V10]). eq(cond(V1, V, V2, Out),0,[],[Out = 0,V13 >= 0,V2 = V14,V12 >= 0,V1 = V13,V = V12,V14 >= 0]). input_output_vars(cond(V1,V,V2,Out),[V1,V,V2],[Out]). input_output_vars(gr(V1,V,Out),[V1,V],[Out]). input_output_vars(add(V1,V,Out),[V1,V],[Out]). CoFloCo proof output: Preprocessing Cost Relations ===================================== #### Computed strongly connected components 0. recursive : [add/3] 1. recursive : [gr/3] 2. recursive : [cond/4] 3. non_recursive : [start/3] #### Obtained direct recursion through partial evaluation 0. SCC is partially evaluated into add/3 1. SCC is partially evaluated into gr/3 2. SCC is partially evaluated into cond/4 3. SCC is partially evaluated into start/3 Control-Flow Refinement of Cost Relations ===================================== ### Specialization of cost equations add/3 * CE 10 is refined into CE [11] * CE 9 is refined into CE [12] ### Cost equations --> "Loop" of add/3 * CEs [12] --> Loop 9 * CEs [11] --> Loop 10 ### Ranking functions of CR add(V1,V,Out) * RF of phase [10]: [V1] #### Partial ranking functions of CR add(V1,V,Out) * Partial RF of phase [10]: - RF of loop [10:1]: V1 ### Specialization of cost equations gr/3 * CE 8 is refined into CE [13] * CE 7 is refined into CE [14] * CE 6 is refined into CE [15] ### Cost equations --> "Loop" of gr/3 * CEs [14] --> Loop 11 * CEs [15] --> Loop 12 * CEs [13] --> Loop 13 ### Ranking functions of CR gr(V1,V,Out) * RF of phase [13]: [V,V1] #### Partial ranking functions of CR gr(V1,V,Out) * Partial RF of phase [13]: - RF of loop [13:1]: V V1 ### Specialization of cost equations cond/4 * CE 5 is refined into CE [16] * CE 4 is refined into CE [17,18,19,20] ### Cost equations --> "Loop" of cond/4 * CEs [20] --> Loop 14 * CEs [19] --> Loop 15 * CEs [18] --> Loop 16 * CEs [17] --> Loop 17 * CEs [16] --> Loop 18 ### Ranking functions of CR cond(V1,V,V2,Out) #### Partial ranking functions of CR cond(V1,V,V2,Out) ### Specialization of cost equations start/3 * CE 1 is refined into CE [21,22,23,24] * CE 2 is refined into CE [25,26,27,28] * CE 3 is refined into CE [29,30] ### Cost equations --> "Loop" of start/3 * CEs [26] --> Loop 19 * CEs [24] --> Loop 20 * CEs [23,27,28,30] --> Loop 21 * CEs [21,22] --> Loop 22 * CEs [25,29] --> Loop 23 ### Ranking functions of CR start(V1,V,V2) #### Partial ranking functions of CR start(V1,V,V2) Computing Bounds ===================================== #### Cost of chains of add(V1,V,Out): * Chain [[10],9]: 1*it(10)+1 Such that:it(10) =< -V+Out with precondition: [V+V1=Out,V1>=1,V>=0] * Chain [9]: 1 with precondition: [V1=0,V=Out,V>=0] #### Cost of chains of gr(V1,V,Out): * Chain [[13],12]: 1*it(13)+1 Such that:it(13) =< V1 with precondition: [Out=0,V1>=1,V>=V1] * Chain [[13],11]: 1*it(13)+1 Such that:it(13) =< V with precondition: [Out=1,V>=1,V1>=V+1] * Chain [12]: 1 with precondition: [V1=0,Out=0,V>=0] * Chain [11]: 1 with precondition: [V=0,Out=1,V1>=1] #### Cost of chains of cond(V1,V,V2,Out): * Chain [18]: 0 with precondition: [Out=0,V1>=0,V>=0,V2>=0] * Chain [17,18]: 3 with precondition: [V1=1,V=0,Out=0,V2>=0] * Chain [16,18]: 1*s(1)+3 Such that:s(1) =< V with precondition: [V1=1,V2=0,Out=0,V>=1] * Chain [16,15,18]: 3*s(1)+6 Such that:aux(2) =< V s(1) =< aux(2) with precondition: [V1=1,V2=0,Out=0,V>=1] * Chain [15,18]: 2*s(2)+3 Such that:aux(1) =< V s(2) =< aux(1) with precondition: [V1=1,Out=0,V>=1,V2>=V] * Chain [14,18]: 1*s(4)+1*s(5)+3 Such that:s(5) =< V s(4) =< V2 with precondition: [V1=1,Out=0,V2>=1,V>=V2+1] * Chain [14,15,18]: 3*s(2)+1*s(4)+6 Such that:s(4) =< V2 aux(3) =< V s(2) =< aux(3) with precondition: [V1=1,Out=0,V2>=1,V>=V2+1] #### Cost of chains of start(V1,V,V2): * Chain [23]: 1 with precondition: [V1=0,V>=0] * Chain [22]: 4*s(15)+6 Such that:s(14) =< V s(15) =< s(14) with precondition: [V1>=0,V>=0,V2>=0] * Chain [21]: 3*s(17)+2*s(18)+3 Such that:aux(7) =< V1 aux(8) =< V s(18) =< aux(7) s(17) =< aux(8) with precondition: [V1>=1,V>=0] * Chain [20]: 4*s(23)+2*s(24)+6 Such that:s(21) =< V s(22) =< V2 s(23) =< s(21) s(24) =< s(22) with precondition: [V1=1,V2>=1,V>=V2+1] * Chain [19]: 1 with precondition: [V=0,V1>=1] Closed-form bounds of start(V1,V,V2): ------------------------------------- * Chain [23] with precondition: [V1=0,V>=0] - Upper bound: 1 - Complexity: constant * Chain [22] with precondition: [V1>=0,V>=0,V2>=0] - Upper bound: 4*V+6 - Complexity: n * Chain [21] with precondition: [V1>=1,V>=0] - Upper bound: 2*V1+3*V+3 - Complexity: n * Chain [20] with precondition: [V1=1,V2>=1,V>=V2+1] - Upper bound: 4*V+2*V2+6 - Complexity: n * Chain [19] with precondition: [V=0,V1>=1] - Upper bound: 1 - Complexity: constant ### Maximum cost of start(V1,V,V2): 3*V+2+max([2*V1,V+3+nat(V2)*2])+1 Asymptotic class: n * Total analysis performed in 205 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: cond(true, x, y) -> cond(gr(x, y), x, add(x, y)) gr(0', x) -> false gr(s(x), 0') -> true gr(s(x), s(y)) -> gr(x, y) add(0', x) -> x add(s(x), y) -> s(add(x, y)) S is empty. Rewrite Strategy: INNERMOST ---------------------------------------- (13) TypeInferenceProof (BOTH BOUNDS(ID, ID)) Infered types. ---------------------------------------- (14) Obligation: Innermost TRS: Rules: cond(true, x, y) -> cond(gr(x, y), x, add(x, y)) gr(0', x) -> false gr(s(x), 0') -> true gr(s(x), s(y)) -> gr(x, y) add(0', x) -> x add(s(x), y) -> s(add(x, y)) Types: cond :: true:false -> 0':s -> 0':s -> cond true :: true:false gr :: 0':s -> 0':s -> true:false add :: 0':s -> 0':s -> 0':s 0' :: 0':s false :: true:false s :: 0':s -> 0':s hole_cond1_0 :: cond hole_true:false2_0 :: true:false hole_0':s3_0 :: 0':s gen_0':s4_0 :: Nat -> 0':s ---------------------------------------- (15) OrderProof (LOWER BOUND(ID)) Heuristically decided to analyse the following defined symbols: cond, gr, add They will be analysed ascendingly in the following order: gr < cond add < cond ---------------------------------------- (16) Obligation: Innermost TRS: Rules: cond(true, x, y) -> cond(gr(x, y), x, add(x, y)) gr(0', x) -> false gr(s(x), 0') -> true gr(s(x), s(y)) -> gr(x, y) add(0', x) -> x add(s(x), y) -> s(add(x, y)) Types: cond :: true:false -> 0':s -> 0':s -> cond true :: true:false gr :: 0':s -> 0':s -> true:false add :: 0':s -> 0':s -> 0':s 0' :: 0':s false :: true:false s :: 0':s -> 0':s hole_cond1_0 :: cond hole_true:false2_0 :: true:false hole_0':s3_0 :: 0':s gen_0':s4_0 :: Nat -> 0':s Generator Equations: gen_0':s4_0(0) <=> 0' gen_0':s4_0(+(x, 1)) <=> s(gen_0':s4_0(x)) The following defined symbols remain to be analysed: gr, cond, add They will be analysed ascendingly in the following order: gr < cond add < cond ---------------------------------------- (17) RewriteLemmaProof (LOWER BOUND(ID)) Proved the following rewrite lemma: gr(gen_0':s4_0(n6_0), gen_0':s4_0(n6_0)) -> false, rt in Omega(1 + n6_0) Induction Base: gr(gen_0':s4_0(0), gen_0':s4_0(0)) ->_R^Omega(1) false Induction Step: gr(gen_0':s4_0(+(n6_0, 1)), gen_0':s4_0(+(n6_0, 1))) ->_R^Omega(1) gr(gen_0':s4_0(n6_0), gen_0':s4_0(n6_0)) ->_IH false 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: cond(true, x, y) -> cond(gr(x, y), x, add(x, y)) gr(0', x) -> false gr(s(x), 0') -> true gr(s(x), s(y)) -> gr(x, y) add(0', x) -> x add(s(x), y) -> s(add(x, y)) Types: cond :: true:false -> 0':s -> 0':s -> cond true :: true:false gr :: 0':s -> 0':s -> true:false add :: 0':s -> 0':s -> 0':s 0' :: 0':s false :: true:false s :: 0':s -> 0':s hole_cond1_0 :: cond hole_true:false2_0 :: true:false hole_0':s3_0 :: 0':s gen_0':s4_0 :: Nat -> 0':s Generator Equations: gen_0':s4_0(0) <=> 0' gen_0':s4_0(+(x, 1)) <=> s(gen_0':s4_0(x)) The following defined symbols remain to be analysed: gr, cond, add They will be analysed ascendingly in the following order: gr < cond add < cond ---------------------------------------- (20) LowerBoundPropagationProof (FINISHED) Propagated lower bound. ---------------------------------------- (21) BOUNDS(n^1, INF) ---------------------------------------- (22) Obligation: Innermost TRS: Rules: cond(true, x, y) -> cond(gr(x, y), x, add(x, y)) gr(0', x) -> false gr(s(x), 0') -> true gr(s(x), s(y)) -> gr(x, y) add(0', x) -> x add(s(x), y) -> s(add(x, y)) Types: cond :: true:false -> 0':s -> 0':s -> cond true :: true:false gr :: 0':s -> 0':s -> true:false add :: 0':s -> 0':s -> 0':s 0' :: 0':s false :: true:false s :: 0':s -> 0':s hole_cond1_0 :: cond hole_true:false2_0 :: true:false hole_0':s3_0 :: 0':s gen_0':s4_0 :: Nat -> 0':s Lemmas: gr(gen_0':s4_0(n6_0), gen_0':s4_0(n6_0)) -> false, rt in Omega(1 + n6_0) Generator Equations: gen_0':s4_0(0) <=> 0' gen_0':s4_0(+(x, 1)) <=> s(gen_0':s4_0(x)) The following defined symbols remain to be analysed: add, cond They will be analysed ascendingly in the following order: add < cond ---------------------------------------- (23) RewriteLemmaProof (LOWER BOUND(ID)) Proved the following rewrite lemma: add(gen_0':s4_0(n241_0), gen_0':s4_0(b)) -> gen_0':s4_0(+(n241_0, b)), rt in Omega(1 + n241_0) Induction Base: add(gen_0':s4_0(0), gen_0':s4_0(b)) ->_R^Omega(1) gen_0':s4_0(b) Induction Step: add(gen_0':s4_0(+(n241_0, 1)), gen_0':s4_0(b)) ->_R^Omega(1) s(add(gen_0':s4_0(n241_0), gen_0':s4_0(b))) ->_IH s(gen_0':s4_0(+(b, c242_0))) We have rt in Omega(n^1) and sz in O(n). Thus, we have irc_R in Omega(n). ---------------------------------------- (24) Obligation: Innermost TRS: Rules: cond(true, x, y) -> cond(gr(x, y), x, add(x, y)) gr(0', x) -> false gr(s(x), 0') -> true gr(s(x), s(y)) -> gr(x, y) add(0', x) -> x add(s(x), y) -> s(add(x, y)) Types: cond :: true:false -> 0':s -> 0':s -> cond true :: true:false gr :: 0':s -> 0':s -> true:false add :: 0':s -> 0':s -> 0':s 0' :: 0':s false :: true:false s :: 0':s -> 0':s hole_cond1_0 :: cond hole_true:false2_0 :: true:false hole_0':s3_0 :: 0':s gen_0':s4_0 :: Nat -> 0':s Lemmas: gr(gen_0':s4_0(n6_0), gen_0':s4_0(n6_0)) -> false, rt in Omega(1 + n6_0) add(gen_0':s4_0(n241_0), gen_0':s4_0(b)) -> gen_0':s4_0(+(n241_0, b)), rt in Omega(1 + n241_0) Generator Equations: gen_0':s4_0(0) <=> 0' gen_0':s4_0(+(x, 1)) <=> s(gen_0':s4_0(x)) The following defined symbols remain to be analysed: cond