/export/starexec/sandbox/solver/bin/starexec_run_complexity /export/starexec/sandbox/benchmark/theBenchmark.xml /export/starexec/sandbox/output/output_files -------------------------------------------------------------------------------- WORST_CASE(Omega(n^2), O(n^2)) 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^2, n^2). (0) CpxTRS (1) RelTrsToWeightedTrsProof [BOTH BOUNDS(ID, ID), 0 ms] (2) CpxWeightedTrs (3) CpxWeightedTrsRenamingProof [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, 294 ms] (12) BOUNDS(1, n^2) (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), 296 ms] (20) BEST (21) proven lower bound (22) LowerBoundPropagationProof [FINISHED, 0 ms] (23) BOUNDS(n^1, INF) (24) typed CpxTrs (25) RewriteLemmaProof [LOWER BOUND(ID), 814 ms] (26) proven lower bound (27) LowerBoundPropagationProof [FINISHED, 0 ms] (28) BOUNDS(n^2, INF) ---------------------------------------- (0) Obligation: The Runtime Complexity (innermost) of the given CpxTRS could be proven to be BOUNDS(n^2, n^2). The TRS R consists of the following rules: f(0) -> 1 f(s(x)) -> g(x, s(x)) g(0, y) -> y g(s(x), y) -> g(x, +(y, s(x))) +(x, 0) -> x +(x, s(y)) -> s(+(x, y)) g(s(x), y) -> g(x, s(+(y, 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^2). The TRS R consists of the following rules: f(0) -> 1 [1] f(s(x)) -> g(x, s(x)) [1] g(0, y) -> y [1] g(s(x), y) -> g(x, +(y, s(x))) [1] +(x, 0) -> x [1] +(x, s(y)) -> s(+(x, y)) [1] g(s(x), y) -> g(x, s(+(y, x))) [1] Rewrite Strategy: INNERMOST ---------------------------------------- (3) CpxWeightedTrsRenamingProof (BOTH BOUNDS(ID, ID)) Renamed defined symbols to avoid conflicts with arithmetic symbols: + => plus ---------------------------------------- (4) Obligation: The Runtime Complexity (innermost) of the given CpxWeightedTrs could be proven to be BOUNDS(1, n^2). The TRS R consists of the following rules: f(0) -> 1 [1] f(s(x)) -> g(x, s(x)) [1] g(0, y) -> y [1] g(s(x), y) -> g(x, plus(y, s(x))) [1] plus(x, 0) -> x [1] plus(x, s(y)) -> s(plus(x, y)) [1] g(s(x), y) -> g(x, s(plus(y, 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: f(0) -> 1 [1] f(s(x)) -> g(x, s(x)) [1] g(0, y) -> y [1] g(s(x), y) -> g(x, plus(y, s(x))) [1] plus(x, 0) -> x [1] plus(x, s(y)) -> s(plus(x, y)) [1] g(s(x), y) -> g(x, s(plus(y, x))) [1] The TRS has the following type information: f :: 0:1:s -> 0:1:s 0 :: 0:1:s 1 :: 0:1:s s :: 0:1:s -> 0:1:s g :: 0:1:s -> 0:1:s -> 0:1:s plus :: 0:1:s -> 0:1:s -> 0:1: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: f(v0) -> null_f [0] g(v0, v1) -> null_g [0] plus(v0, v1) -> null_plus [0] And the following fresh constants: null_f, null_g, null_plus ---------------------------------------- (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) -> 1 [1] f(s(x)) -> g(x, s(x)) [1] g(0, y) -> y [1] g(s(x), y) -> g(x, plus(y, s(x))) [1] plus(x, 0) -> x [1] plus(x, s(y)) -> s(plus(x, y)) [1] g(s(x), y) -> g(x, s(plus(y, x))) [1] f(v0) -> null_f [0] g(v0, v1) -> null_g [0] plus(v0, v1) -> null_plus [0] The TRS has the following type information: f :: 0:1:s:null_f:null_g:null_plus -> 0:1:s:null_f:null_g:null_plus 0 :: 0:1:s:null_f:null_g:null_plus 1 :: 0:1:s:null_f:null_g:null_plus s :: 0:1:s:null_f:null_g:null_plus -> 0:1:s:null_f:null_g:null_plus g :: 0:1:s:null_f:null_g:null_plus -> 0:1:s:null_f:null_g:null_plus -> 0:1:s:null_f:null_g:null_plus plus :: 0:1:s:null_f:null_g:null_plus -> 0:1:s:null_f:null_g:null_plus -> 0:1:s:null_f:null_g:null_plus null_f :: 0:1:s:null_f:null_g:null_plus null_g :: 0:1:s:null_f:null_g:null_plus null_plus :: 0:1:s:null_f:null_g:null_plus 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 1 => 1 null_f => 0 null_g => 0 null_plus => 0 ---------------------------------------- (10) Obligation: Complexity RNTS consisting of the following rules: f(z) -{ 1 }-> g(x, 1 + x) :|: x >= 0, z = 1 + x f(z) -{ 1 }-> 1 :|: z = 0 f(z) -{ 0 }-> 0 :|: v0 >= 0, z = v0 g(z, z') -{ 1 }-> y :|: y >= 0, z = 0, z' = y g(z, z') -{ 1 }-> g(x, plus(y, 1 + x)) :|: x >= 0, y >= 0, z = 1 + x, z' = y g(z, z') -{ 1 }-> g(x, 1 + plus(y, x)) :|: x >= 0, y >= 0, z = 1 + x, z' = y g(z, z') -{ 0 }-> 0 :|: v0 >= 0, v1 >= 0, z = v0, z' = v1 plus(z, z') -{ 1 }-> x :|: x >= 0, z = x, z' = 0 plus(z, z') -{ 0 }-> 0 :|: v0 >= 0, v1 >= 0, z = v0, z' = v1 plus(z, z') -{ 1 }-> 1 + plus(x, y) :|: z' = 1 + y, x >= 0, y >= 0, z = 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, V2),0,[f(V, Out)],[V >= 0]). eq(start(V, V2),0,[g(V, V2, Out)],[V >= 0,V2 >= 0]). eq(start(V, V2),0,[plus(V, V2, Out)],[V >= 0,V2 >= 0]). eq(f(V, Out),1,[],[Out = 1,V = 0]). eq(f(V, Out),1,[g(V1, 1 + V1, Ret)],[Out = Ret,V1 >= 0,V = 1 + V1]). eq(g(V, V2, Out),1,[],[Out = V3,V3 >= 0,V = 0,V2 = V3]). eq(g(V, V2, Out),1,[plus(V5, 1 + V4, Ret1),g(V4, Ret1, Ret2)],[Out = Ret2,V4 >= 0,V5 >= 0,V = 1 + V4,V2 = V5]). eq(plus(V, V2, Out),1,[],[Out = V6,V6 >= 0,V = V6,V2 = 0]). eq(plus(V, V2, Out),1,[plus(V7, V8, Ret11)],[Out = 1 + Ret11,V2 = 1 + V8,V7 >= 0,V8 >= 0,V = V7]). eq(g(V, V2, Out),1,[plus(V10, V9, Ret111),g(V9, 1 + Ret111, Ret3)],[Out = Ret3,V9 >= 0,V10 >= 0,V = 1 + V9,V2 = V10]). eq(f(V, Out),0,[],[Out = 0,V11 >= 0,V = V11]). eq(g(V, V2, Out),0,[],[Out = 0,V13 >= 0,V12 >= 0,V = V13,V2 = V12]). eq(plus(V, V2, Out),0,[],[Out = 0,V15 >= 0,V14 >= 0,V = V15,V2 = V14]). input_output_vars(f(V,Out),[V],[Out]). input_output_vars(g(V,V2,Out),[V,V2],[Out]). input_output_vars(plus(V,V2,Out),[V,V2],[Out]). CoFloCo proof output: Preprocessing Cost Relations ===================================== #### Computed strongly connected components 0. recursive : [plus/3] 1. recursive : [g/3] 2. non_recursive : [f/2] 3. non_recursive : [start/2] #### Obtained direct recursion through partial evaluation 0. SCC is partially evaluated into plus/3 1. SCC is partially evaluated into g/3 2. SCC is partially evaluated into f/2 3. SCC is partially evaluated into start/2 Control-Flow Refinement of Cost Relations ===================================== ### Specialization of cost equations plus/3 * CE 13 is refined into CE [14] * CE 11 is refined into CE [15] * CE 12 is refined into CE [16] ### Cost equations --> "Loop" of plus/3 * CEs [16] --> Loop 11 * CEs [14] --> Loop 12 * CEs [15] --> Loop 13 ### Ranking functions of CR plus(V,V2,Out) * RF of phase [11]: [V2] #### Partial ranking functions of CR plus(V,V2,Out) * Partial RF of phase [11]: - RF of loop [11:1]: V2 ### Specialization of cost equations g/3 * CE 10 is refined into CE [17] * CE 7 is refined into CE [18] * CE 8 is refined into CE [19,20,21] * CE 9 is refined into CE [22,23,24,25] ### Cost equations --> "Loop" of g/3 * CEs [21,23,25] --> Loop 14 * CEs [19] --> Loop 15 * CEs [20,22,24] --> Loop 16 * CEs [17] --> Loop 17 * CEs [18] --> Loop 18 ### Ranking functions of CR g(V,V2,Out) * RF of phase [14,15,16]: [V] #### Partial ranking functions of CR g(V,V2,Out) * Partial RF of phase [14,15,16]: - RF of loop [14:1,15:1,16:1]: V ### Specialization of cost equations f/2 * CE 5 is refined into CE [26,27,28] * CE 6 is refined into CE [29] * CE 4 is refined into CE [30] ### Cost equations --> "Loop" of f/2 * CEs [28] --> Loop 19 * CEs [27,29] --> Loop 20 * CEs [26] --> Loop 21 * CEs [30] --> Loop 22 ### Ranking functions of CR f(V,Out) #### Partial ranking functions of CR f(V,Out) ### Specialization of cost equations start/2 * CE 1 is refined into CE [31,32,33,34] * CE 2 is refined into CE [35,36,37] * CE 3 is refined into CE [38,39,40,41] ### Cost equations --> "Loop" of start/2 * CEs [38] --> Loop 23 * CEs [32] --> Loop 24 * CEs [31,33,34,35,36,37,39,40,41] --> Loop 25 ### Ranking functions of CR start(V,V2) #### Partial ranking functions of CR start(V,V2) Computing Bounds ===================================== #### Cost of chains of plus(V,V2,Out): * Chain [[11],13]: 1*it(11)+1 Such that:it(11) =< V2 with precondition: [V+V2=Out,V>=0,V2>=1] * Chain [[11],12]: 1*it(11)+0 Such that:it(11) =< Out with precondition: [V>=0,Out>=1,V2>=Out] * Chain [13]: 1 with precondition: [V2=0,V=Out,V>=0] * Chain [12]: 0 with precondition: [Out=0,V>=0,V2>=0] #### Cost of chains of g(V,V2,Out): * Chain [[14,15,16],18]: 4*it(14)+2*s(9)+1*s(11)+1*s(12)+1 Such that:aux(7) =< V it(14) =< aux(7) aux(4) =< aux(7)-1 aux(3) =< aux(7) s(10) =< it(14)*aux(7) s(12) =< it(14)*aux(4) s(11) =< it(14)*aux(3) s(9) =< s(10) with precondition: [V>=1,V2>=0,Out>=0] * Chain [[14,15,16],17]: 4*it(14)+2*s(9)+1*s(11)+1*s(12)+0 Such that:aux(8) =< V it(14) =< aux(8) aux(4) =< aux(8)-1 aux(3) =< aux(8) s(10) =< it(14)*aux(8) s(12) =< it(14)*aux(4) s(11) =< it(14)*aux(3) s(9) =< s(10) with precondition: [Out=0,V>=1,V2>=0] * Chain [18]: 1 with precondition: [V=0,V2=Out,V2>=0] * Chain [17]: 0 with precondition: [Out=0,V>=0,V2>=0] #### Cost of chains of f(V,Out): * Chain [22]: 1 with precondition: [V=0,Out=1] * Chain [21]: 2 with precondition: [V=1,Out=1] * Chain [20]: 4*s(22)+1*s(26)+1*s(27)+2*s(28)+1 Such that:s(21) =< V s(22) =< s(21) s(23) =< s(21)-1 s(24) =< s(21) s(25) =< s(22)*s(21) s(26) =< s(22)*s(23) s(27) =< s(22)*s(24) s(28) =< s(25) with precondition: [Out=0,V>=0] * Chain [19]: 4*s(30)+1*s(34)+1*s(35)+2*s(36)+2 Such that:s(29) =< V s(30) =< s(29) s(31) =< s(29)-1 s(32) =< s(29) s(33) =< s(30)*s(29) s(34) =< s(30)*s(31) s(35) =< s(30)*s(32) s(36) =< s(33) with precondition: [V>=2,Out>=0] #### Cost of chains of start(V,V2): * Chain [25]: 16*s(38)+4*s(42)+4*s(43)+8*s(44)+2*s(69)+2 Such that:aux(9) =< V aux(10) =< V2 s(69) =< aux(10) s(38) =< aux(9) s(39) =< aux(9)-1 s(40) =< aux(9) s(41) =< s(38)*aux(9) s(42) =< s(38)*s(39) s(43) =< s(38)*s(40) s(44) =< s(41) with precondition: [V>=0] * Chain [24]: 2 with precondition: [V=1] * Chain [23]: 1 with precondition: [V2=0,V>=0] Closed-form bounds of start(V,V2): ------------------------------------- * Chain [25] with precondition: [V>=0] - Upper bound: 16*V+2+12*V*V+4*V*nat(V-1)+nat(V2)*2 - Complexity: n^2 * Chain [24] with precondition: [V=1] - Upper bound: 2 - Complexity: constant * Chain [23] with precondition: [V2=0,V>=0] - Upper bound: 1 - Complexity: constant ### Maximum cost of start(V,V2): max([1,16*V+1+12*V*V+4*V*nat(V-1)+nat(V2)*2])+1 Asymptotic class: n^2 * Total analysis performed in 206 ms. ---------------------------------------- (12) BOUNDS(1, n^2) ---------------------------------------- (13) RenamingProof (BOTH BOUNDS(ID, ID)) Renamed function symbols to avoid clashes with predefined symbol. ---------------------------------------- (14) Obligation: The Runtime Complexity (innermost) of the given CpxTRS could be proven to be BOUNDS(n^2, INF). The TRS R consists of the following rules: f(0') -> 1' f(s(x)) -> g(x, s(x)) g(0', y) -> y g(s(x), y) -> g(x, +'(y, s(x))) +'(x, 0') -> x +'(x, s(y)) -> s(+'(x, y)) g(s(x), y) -> g(x, s(+'(y, x))) S is empty. Rewrite Strategy: INNERMOST ---------------------------------------- (15) TypeInferenceProof (BOTH BOUNDS(ID, ID)) Infered types. ---------------------------------------- (16) Obligation: Innermost TRS: Rules: f(0') -> 1' f(s(x)) -> g(x, s(x)) g(0', y) -> y g(s(x), y) -> g(x, +'(y, s(x))) +'(x, 0') -> x +'(x, s(y)) -> s(+'(x, y)) g(s(x), y) -> g(x, s(+'(y, x))) Types: f :: 0':1':s -> 0':1':s 0' :: 0':1':s 1' :: 0':1':s s :: 0':1':s -> 0':1':s g :: 0':1':s -> 0':1':s -> 0':1':s +' :: 0':1':s -> 0':1':s -> 0':1':s hole_0':1':s1_0 :: 0':1':s gen_0':1':s2_0 :: Nat -> 0':1':s ---------------------------------------- (17) OrderProof (LOWER BOUND(ID)) Heuristically decided to analyse the following defined symbols: g, +' They will be analysed ascendingly in the following order: +' < g ---------------------------------------- (18) Obligation: Innermost TRS: Rules: f(0') -> 1' f(s(x)) -> g(x, s(x)) g(0', y) -> y g(s(x), y) -> g(x, +'(y, s(x))) +'(x, 0') -> x +'(x, s(y)) -> s(+'(x, y)) g(s(x), y) -> g(x, s(+'(y, x))) Types: f :: 0':1':s -> 0':1':s 0' :: 0':1':s 1' :: 0':1':s s :: 0':1':s -> 0':1':s g :: 0':1':s -> 0':1':s -> 0':1':s +' :: 0':1':s -> 0':1':s -> 0':1':s hole_0':1':s1_0 :: 0':1':s gen_0':1':s2_0 :: Nat -> 0':1':s Generator Equations: gen_0':1':s2_0(0) <=> 0' gen_0':1':s2_0(+(x, 1)) <=> s(gen_0':1':s2_0(x)) The following defined symbols remain to be analysed: +', g They will be analysed ascendingly in the following order: +' < g ---------------------------------------- (19) RewriteLemmaProof (LOWER BOUND(ID)) Proved the following rewrite lemma: +'(gen_0':1':s2_0(a), gen_0':1':s2_0(n4_0)) -> gen_0':1':s2_0(+(n4_0, a)), rt in Omega(1 + n4_0) Induction Base: +'(gen_0':1':s2_0(a), gen_0':1':s2_0(0)) ->_R^Omega(1) gen_0':1':s2_0(a) Induction Step: +'(gen_0':1':s2_0(a), gen_0':1':s2_0(+(n4_0, 1))) ->_R^Omega(1) s(+'(gen_0':1':s2_0(a), gen_0':1':s2_0(n4_0))) ->_IH s(gen_0':1':s2_0(+(a, 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: Innermost TRS: Rules: f(0') -> 1' f(s(x)) -> g(x, s(x)) g(0', y) -> y g(s(x), y) -> g(x, +'(y, s(x))) +'(x, 0') -> x +'(x, s(y)) -> s(+'(x, y)) g(s(x), y) -> g(x, s(+'(y, x))) Types: f :: 0':1':s -> 0':1':s 0' :: 0':1':s 1' :: 0':1':s s :: 0':1':s -> 0':1':s g :: 0':1':s -> 0':1':s -> 0':1':s +' :: 0':1':s -> 0':1':s -> 0':1':s hole_0':1':s1_0 :: 0':1':s gen_0':1':s2_0 :: Nat -> 0':1':s Generator Equations: gen_0':1':s2_0(0) <=> 0' gen_0':1':s2_0(+(x, 1)) <=> s(gen_0':1':s2_0(x)) The following defined symbols remain to be analysed: +', g They will be analysed ascendingly in the following order: +' < g ---------------------------------------- (22) LowerBoundPropagationProof (FINISHED) Propagated lower bound. ---------------------------------------- (23) BOUNDS(n^1, INF) ---------------------------------------- (24) Obligation: Innermost TRS: Rules: f(0') -> 1' f(s(x)) -> g(x, s(x)) g(0', y) -> y g(s(x), y) -> g(x, +'(y, s(x))) +'(x, 0') -> x +'(x, s(y)) -> s(+'(x, y)) g(s(x), y) -> g(x, s(+'(y, x))) Types: f :: 0':1':s -> 0':1':s 0' :: 0':1':s 1' :: 0':1':s s :: 0':1':s -> 0':1':s g :: 0':1':s -> 0':1':s -> 0':1':s +' :: 0':1':s -> 0':1':s -> 0':1':s hole_0':1':s1_0 :: 0':1':s gen_0':1':s2_0 :: Nat -> 0':1':s Lemmas: +'(gen_0':1':s2_0(a), gen_0':1':s2_0(n4_0)) -> gen_0':1':s2_0(+(n4_0, a)), rt in Omega(1 + n4_0) Generator Equations: gen_0':1':s2_0(0) <=> 0' gen_0':1':s2_0(+(x, 1)) <=> s(gen_0':1':s2_0(x)) The following defined symbols remain to be analysed: g ---------------------------------------- (25) RewriteLemmaProof (LOWER BOUND(ID)) Proved the following rewrite lemma: g(gen_0':1':s2_0(n513_0), gen_0':1':s2_0(b)) -> *3_0, rt in Omega(n513_0 + n513_0^2) Induction Base: g(gen_0':1':s2_0(0), gen_0':1':s2_0(b)) Induction Step: g(gen_0':1':s2_0(+(n513_0, 1)), gen_0':1':s2_0(b)) ->_R^Omega(1) g(gen_0':1':s2_0(n513_0), +'(gen_0':1':s2_0(b), s(gen_0':1':s2_0(n513_0)))) ->_L^Omega(2 + n513_0) g(gen_0':1':s2_0(n513_0), gen_0':1':s2_0(+(+(n513_0, 1), b))) ->_IH *3_0 We have rt in Omega(n^2) and sz in O(n). Thus, we have irc_R in Omega(n^2). ---------------------------------------- (26) Obligation: Proved the lower bound n^2 for the following obligation: Innermost TRS: Rules: f(0') -> 1' f(s(x)) -> g(x, s(x)) g(0', y) -> y g(s(x), y) -> g(x, +'(y, s(x))) +'(x, 0') -> x +'(x, s(y)) -> s(+'(x, y)) g(s(x), y) -> g(x, s(+'(y, x))) Types: f :: 0':1':s -> 0':1':s 0' :: 0':1':s 1' :: 0':1':s s :: 0':1':s -> 0':1':s g :: 0':1':s -> 0':1':s -> 0':1':s +' :: 0':1':s -> 0':1':s -> 0':1':s hole_0':1':s1_0 :: 0':1':s gen_0':1':s2_0 :: Nat -> 0':1':s Lemmas: +'(gen_0':1':s2_0(a), gen_0':1':s2_0(n4_0)) -> gen_0':1':s2_0(+(n4_0, a)), rt in Omega(1 + n4_0) Generator Equations: gen_0':1':s2_0(0) <=> 0' gen_0':1':s2_0(+(x, 1)) <=> s(gen_0':1':s2_0(x)) The following defined symbols remain to be analysed: g ---------------------------------------- (27) LowerBoundPropagationProof (FINISHED) Propagated lower bound. ---------------------------------------- (28) BOUNDS(n^2, INF)