/export/starexec/sandbox2/solver/bin/starexec_run_rcdcRelativeAlsoLower /export/starexec/sandbox2/benchmark/theBenchmark.xml /export/starexec/sandbox2/output/output_files -------------------------------------------------------------------------------- WORST_CASE(?, O(n^2)) proof of /export/starexec/sandbox2/benchmark/theBenchmark.xml # AProVE Commit ID: 794c25de1cacf0d048858bcd21c9a779e1221865 marcel 20200619 unpublished dirty The Derivational Complexity (innermost) of the given DCpxTrs could be proven to be BOUNDS(1, n^2). (0) DCpxTrs (1) DerivationalComplexityToRuntimeComplexityProof [BOTH BOUNDS(ID, ID), 0 ms] (2) CpxRelTRS (3) SInnermostTerminationProof [BOTH CONCRETE BOUNDS(ID, ID), 159 ms] (4) CpxRelTRS (5) NonCtorToCtorProof [UPPER BOUND(ID), 0 ms] (6) CpxRelTRS (7) RelTrsToWeightedTrsProof [BOTH BOUNDS(ID, ID), 0 ms] (8) CpxWeightedTrs (9) TypeInferenceProof [BOTH BOUNDS(ID, ID), 0 ms] (10) CpxTypedWeightedTrs (11) CompletionProof [UPPER BOUND(ID), 0 ms] (12) CpxTypedWeightedCompleteTrs (13) CpxTypedWeightedTrsToRntsProof [UPPER BOUND(ID), 0 ms] (14) CpxRNTS (15) CompleteCoflocoProof [FINISHED, 462 ms] (16) BOUNDS(1, n^2) ---------------------------------------- (0) Obligation: The Derivational Complexity (innermost) of the given DCpxTrs could be proven to be BOUNDS(1, n^2). The TRS R consists of the following rules: f(g(x), x, y) -> f(y, y, g(y)) g(g(x)) -> g(x) S is empty. Rewrite Strategy: INNERMOST ---------------------------------------- (1) DerivationalComplexityToRuntimeComplexityProof (BOTH BOUNDS(ID, ID)) The following rules have been added to S to convert the given derivational complexity problem to a runtime complexity problem: encArg(cons_f(x_1, x_2, x_3)) -> f(encArg(x_1), encArg(x_2), encArg(x_3)) encArg(cons_g(x_1)) -> g(encArg(x_1)) encode_f(x_1, x_2, x_3) -> f(encArg(x_1), encArg(x_2), encArg(x_3)) encode_g(x_1) -> g(encArg(x_1)) ---------------------------------------- (2) Obligation: The Runtime Complexity (innermost) of the given CpxRelTRS could be proven to be BOUNDS(1, n^2). The TRS R consists of the following rules: f(g(x), x, y) -> f(y, y, g(y)) g(g(x)) -> g(x) The (relative) TRS S consists of the following rules: encArg(cons_f(x_1, x_2, x_3)) -> f(encArg(x_1), encArg(x_2), encArg(x_3)) encArg(cons_g(x_1)) -> g(encArg(x_1)) encode_f(x_1, x_2, x_3) -> f(encArg(x_1), encArg(x_2), encArg(x_3)) encode_g(x_1) -> g(encArg(x_1)) Rewrite Strategy: INNERMOST ---------------------------------------- (3) SInnermostTerminationProof (BOTH CONCRETE BOUNDS(ID, ID)) proved innermost termination of relative rules ---------------------------------------- (4) Obligation: The Runtime Complexity (innermost) of the given CpxRelTRS could be proven to be BOUNDS(1, n^2). The TRS R consists of the following rules: f(g(x), x, y) -> f(y, y, g(y)) g(g(x)) -> g(x) The (relative) TRS S consists of the following rules: encArg(cons_f(x_1, x_2, x_3)) -> f(encArg(x_1), encArg(x_2), encArg(x_3)) encArg(cons_g(x_1)) -> g(encArg(x_1)) encode_f(x_1, x_2, x_3) -> f(encArg(x_1), encArg(x_2), encArg(x_3)) encode_g(x_1) -> g(encArg(x_1)) Rewrite Strategy: INNERMOST ---------------------------------------- (5) NonCtorToCtorProof (UPPER BOUND(ID)) transformed non-ctor to ctor-system ---------------------------------------- (6) Obligation: The Runtime Complexity (innermost) of the given CpxRelTRS could be proven to be BOUNDS(1, n^2). The TRS R consists of the following rules: f(c_g(x), x, y) -> f(y, y, g(y)) g(c_g(x)) -> g(x) The (relative) TRS S consists of the following rules: encArg(cons_f(x_1, x_2, x_3)) -> f(encArg(x_1), encArg(x_2), encArg(x_3)) encArg(cons_g(x_1)) -> g(encArg(x_1)) encode_f(x_1, x_2, x_3) -> f(encArg(x_1), encArg(x_2), encArg(x_3)) encode_g(x_1) -> g(encArg(x_1)) g(x0) -> c_g(x0) Rewrite Strategy: INNERMOST ---------------------------------------- (7) RelTrsToWeightedTrsProof (BOTH BOUNDS(ID, ID)) Transformed relative TRS to weighted TRS ---------------------------------------- (8) 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(c_g(x), x, y) -> f(y, y, g(y)) [1] g(c_g(x)) -> g(x) [1] encArg(cons_f(x_1, x_2, x_3)) -> f(encArg(x_1), encArg(x_2), encArg(x_3)) [0] encArg(cons_g(x_1)) -> g(encArg(x_1)) [0] encode_f(x_1, x_2, x_3) -> f(encArg(x_1), encArg(x_2), encArg(x_3)) [0] encode_g(x_1) -> g(encArg(x_1)) [0] g(x0) -> c_g(x0) [0] Rewrite Strategy: INNERMOST ---------------------------------------- (9) TypeInferenceProof (BOTH BOUNDS(ID, ID)) Infered types. ---------------------------------------- (10) Obligation: Runtime Complexity Weighted TRS with Types. The TRS R consists of the following rules: f(c_g(x), x, y) -> f(y, y, g(y)) [1] g(c_g(x)) -> g(x) [1] encArg(cons_f(x_1, x_2, x_3)) -> f(encArg(x_1), encArg(x_2), encArg(x_3)) [0] encArg(cons_g(x_1)) -> g(encArg(x_1)) [0] encode_f(x_1, x_2, x_3) -> f(encArg(x_1), encArg(x_2), encArg(x_3)) [0] encode_g(x_1) -> g(encArg(x_1)) [0] g(x0) -> c_g(x0) [0] The TRS has the following type information: f :: c_g -> c_g -> c_g -> c_g c_g :: c_g -> c_g g :: c_g -> c_g encArg :: cons_f:cons_g -> c_g cons_f :: cons_f:cons_g -> cons_f:cons_g -> cons_f:cons_g -> cons_f:cons_g cons_g :: cons_f:cons_g -> cons_f:cons_g encode_f :: cons_f:cons_g -> cons_f:cons_g -> cons_f:cons_g -> c_g encode_g :: cons_f:cons_g -> c_g Rewrite Strategy: INNERMOST ---------------------------------------- (11) 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: encArg(v0) -> null_encArg [0] encode_f(v0, v1, v2) -> null_encode_f [0] encode_g(v0) -> null_encode_g [0] g(v0) -> null_g [0] f(v0, v1, v2) -> null_f [0] And the following fresh constants: null_encArg, null_encode_f, null_encode_g, null_g, null_f, const ---------------------------------------- (12) 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(c_g(x), x, y) -> f(y, y, g(y)) [1] g(c_g(x)) -> g(x) [1] encArg(cons_f(x_1, x_2, x_3)) -> f(encArg(x_1), encArg(x_2), encArg(x_3)) [0] encArg(cons_g(x_1)) -> g(encArg(x_1)) [0] encode_f(x_1, x_2, x_3) -> f(encArg(x_1), encArg(x_2), encArg(x_3)) [0] encode_g(x_1) -> g(encArg(x_1)) [0] g(x0) -> c_g(x0) [0] encArg(v0) -> null_encArg [0] encode_f(v0, v1, v2) -> null_encode_f [0] encode_g(v0) -> null_encode_g [0] g(v0) -> null_g [0] f(v0, v1, v2) -> null_f [0] The TRS has the following type information: f :: c_g:null_encArg:null_encode_f:null_encode_g:null_g:null_f -> c_g:null_encArg:null_encode_f:null_encode_g:null_g:null_f -> c_g:null_encArg:null_encode_f:null_encode_g:null_g:null_f -> c_g:null_encArg:null_encode_f:null_encode_g:null_g:null_f c_g :: c_g:null_encArg:null_encode_f:null_encode_g:null_g:null_f -> c_g:null_encArg:null_encode_f:null_encode_g:null_g:null_f g :: c_g:null_encArg:null_encode_f:null_encode_g:null_g:null_f -> c_g:null_encArg:null_encode_f:null_encode_g:null_g:null_f encArg :: cons_f:cons_g -> c_g:null_encArg:null_encode_f:null_encode_g:null_g:null_f cons_f :: cons_f:cons_g -> cons_f:cons_g -> cons_f:cons_g -> cons_f:cons_g cons_g :: cons_f:cons_g -> cons_f:cons_g encode_f :: cons_f:cons_g -> cons_f:cons_g -> cons_f:cons_g -> c_g:null_encArg:null_encode_f:null_encode_g:null_g:null_f encode_g :: cons_f:cons_g -> c_g:null_encArg:null_encode_f:null_encode_g:null_g:null_f null_encArg :: c_g:null_encArg:null_encode_f:null_encode_g:null_g:null_f null_encode_f :: c_g:null_encArg:null_encode_f:null_encode_g:null_g:null_f null_encode_g :: c_g:null_encArg:null_encode_f:null_encode_g:null_g:null_f null_g :: c_g:null_encArg:null_encode_f:null_encode_g:null_g:null_f null_f :: c_g:null_encArg:null_encode_f:null_encode_g:null_g:null_f const :: cons_f:cons_g Rewrite Strategy: INNERMOST ---------------------------------------- (13) CpxTypedWeightedTrsToRntsProof (UPPER BOUND(ID)) Transformed the TRS into an over-approximating RNTS by (improved) Size Abstraction. The constant constructors are abstracted as follows: null_encArg => 0 null_encode_f => 0 null_encode_g => 0 null_g => 0 null_f => 0 const => 0 ---------------------------------------- (14) Obligation: Complexity RNTS consisting of the following rules: encArg(z) -{ 0 }-> g(encArg(x_1)) :|: z = 1 + x_1, x_1 >= 0 encArg(z) -{ 0 }-> f(encArg(x_1), encArg(x_2), encArg(x_3)) :|: x_1 >= 0, z = 1 + x_1 + x_2 + x_3, x_3 >= 0, x_2 >= 0 encArg(z) -{ 0 }-> 0 :|: v0 >= 0, z = v0 encode_f(z, z', z'') -{ 0 }-> f(encArg(x_1), encArg(x_2), encArg(x_3)) :|: x_1 >= 0, x_3 >= 0, x_2 >= 0, z = x_1, z' = x_2, z'' = x_3 encode_f(z, z', z'') -{ 0 }-> 0 :|: v0 >= 0, z'' = v2, v1 >= 0, z = v0, z' = v1, v2 >= 0 encode_g(z) -{ 0 }-> g(encArg(x_1)) :|: x_1 >= 0, z = x_1 encode_g(z) -{ 0 }-> 0 :|: v0 >= 0, z = v0 f(z, z', z'') -{ 1 }-> f(y, y, g(y)) :|: z' = x, z'' = y, x >= 0, y >= 0, z = 1 + x f(z, z', z'') -{ 0 }-> 0 :|: v0 >= 0, z'' = v2, v1 >= 0, z = v0, z' = v1, v2 >= 0 g(z) -{ 1 }-> g(x) :|: x >= 0, z = 1 + x g(z) -{ 0 }-> 0 :|: v0 >= 0, z = v0 g(z) -{ 0 }-> 1 + x0 :|: z = x0, x0 >= 0 Only complete derivations are relevant for the runtime complexity. ---------------------------------------- (15) CompleteCoflocoProof (FINISHED) Transformed the RNTS (where only complete derivations are relevant) into cost relations for CoFloCo: eq(start(V1, V, V2),0,[f(V1, V, V2, Out)],[V1 >= 0,V >= 0,V2 >= 0]). eq(start(V1, V, V2),0,[g(V1, Out)],[V1 >= 0]). eq(start(V1, V, V2),0,[encArg(V1, Out)],[V1 >= 0]). eq(start(V1, V, V2),0,[fun(V1, V, V2, Out)],[V1 >= 0,V >= 0,V2 >= 0]). eq(start(V1, V, V2),0,[fun1(V1, Out)],[V1 >= 0]). eq(f(V1, V, V2, Out),1,[g(V3, Ret2),f(V3, V3, Ret2, Ret)],[Out = Ret,V = V4,V2 = V3,V4 >= 0,V3 >= 0,V1 = 1 + V4]). eq(g(V1, Out),1,[g(V5, Ret1)],[Out = Ret1,V5 >= 0,V1 = 1 + V5]). eq(encArg(V1, Out),0,[encArg(V8, Ret0),encArg(V7, Ret11),encArg(V6, Ret21),f(Ret0, Ret11, Ret21, Ret3)],[Out = Ret3,V8 >= 0,V1 = 1 + V6 + V7 + V8,V6 >= 0,V7 >= 0]). eq(encArg(V1, Out),0,[encArg(V9, Ret01),g(Ret01, Ret4)],[Out = Ret4,V1 = 1 + V9,V9 >= 0]). eq(fun(V1, V, V2, Out),0,[encArg(V10, Ret02),encArg(V12, Ret12),encArg(V11, Ret22),f(Ret02, Ret12, Ret22, Ret5)],[Out = Ret5,V10 >= 0,V11 >= 0,V12 >= 0,V1 = V10,V = V12,V2 = V11]). eq(fun1(V1, Out),0,[encArg(V13, Ret03),g(Ret03, Ret6)],[Out = Ret6,V13 >= 0,V1 = V13]). eq(g(V1, Out),0,[],[Out = 1 + V14,V1 = V14,V14 >= 0]). eq(encArg(V1, Out),0,[],[Out = 0,V15 >= 0,V1 = V15]). eq(fun(V1, V, V2, Out),0,[],[Out = 0,V17 >= 0,V2 = V18,V16 >= 0,V1 = V17,V = V16,V18 >= 0]). eq(fun1(V1, Out),0,[],[Out = 0,V19 >= 0,V1 = V19]). eq(g(V1, Out),0,[],[Out = 0,V20 >= 0,V1 = V20]). eq(f(V1, V, V2, Out),0,[],[Out = 0,V21 >= 0,V2 = V22,V23 >= 0,V1 = V21,V = V23,V22 >= 0]). input_output_vars(f(V1,V,V2,Out),[V1,V,V2],[Out]). input_output_vars(g(V1,Out),[V1],[Out]). input_output_vars(encArg(V1,Out),[V1],[Out]). input_output_vars(fun(V1,V,V2,Out),[V1,V,V2],[Out]). input_output_vars(fun1(V1,Out),[V1],[Out]). CoFloCo proof output: Preprocessing Cost Relations ===================================== #### Computed strongly connected components 0. recursive : [g/2] 1. recursive : [f/4] 2. recursive [non_tail,multiple] : [encArg/2] 3. non_recursive : [fun/4] 4. non_recursive : [fun1/2] 5. non_recursive : [start/3] #### Obtained direct recursion through partial evaluation 0. SCC is partially evaluated into g/2 1. SCC is partially evaluated into f/4 2. SCC is partially evaluated into encArg/2 3. SCC is partially evaluated into fun/4 4. SCC is partially evaluated into fun1/2 5. SCC is partially evaluated into start/3 Control-Flow Refinement of Cost Relations ===================================== ### Specialization of cost equations g/2 * CE 9 is refined into CE [18] * CE 10 is refined into CE [19] * CE 8 is refined into CE [20] ### Cost equations --> "Loop" of g/2 * CEs [20] --> Loop 12 * CEs [18] --> Loop 13 * CEs [19] --> Loop 14 ### Ranking functions of CR g(V1,Out) * RF of phase [12]: [V1] #### Partial ranking functions of CR g(V1,Out) * Partial RF of phase [12]: - RF of loop [12:1]: V1 ### Specialization of cost equations f/4 * CE 7 is refined into CE [21] * CE 6 is refined into CE [22,23,24] ### Cost equations --> "Loop" of f/4 * CEs [24] --> Loop 15 * CEs [23] --> Loop 16 * CEs [22] --> Loop 17 * CEs [21] --> Loop 18 ### Ranking functions of CR f(V1,V,V2,Out) #### Partial ranking functions of CR f(V1,V,V2,Out) ### Specialization of cost equations encArg/2 * CE 13 is refined into CE [25] * CE 12 is refined into CE [26,27,28] * CE 11 is refined into CE [29] ### Cost equations --> "Loop" of encArg/2 * CEs [29] --> Loop 19 * CEs [28] --> Loop 20 * CEs [27] --> Loop 21 * CEs [26] --> Loop 22 * CEs [25] --> Loop 23 ### Ranking functions of CR encArg(V1,Out) * RF of phase [19,20,21,22]: [V1] #### Partial ranking functions of CR encArg(V1,Out) * Partial RF of phase [19,20,21,22]: - RF of loop [19:1,19:2,19:3,20:1,21:1,22:1]: V1 ### Specialization of cost equations fun/4 * CE 14 is refined into CE [30,31,32,33,34,35,36,37] * CE 15 is refined into CE [38] ### Cost equations --> "Loop" of fun/4 * CEs [30,31,32,33,34,35,36,37,38] --> Loop 24 ### Ranking functions of CR fun(V1,V,V2,Out) #### Partial ranking functions of CR fun(V1,V,V2,Out) ### Specialization of cost equations fun1/2 * CE 16 is refined into CE [39,40,41,42,43] * CE 17 is refined into CE [44] ### Cost equations --> "Loop" of fun1/2 * CEs [42,43] --> Loop 25 * CEs [40] --> Loop 26 * CEs [39,41,44] --> Loop 27 ### Ranking functions of CR fun1(V1,Out) #### Partial ranking functions of CR fun1(V1,Out) ### Specialization of cost equations start/3 * CE 1 is refined into CE [45] * CE 2 is refined into CE [46,47,48] * CE 3 is refined into CE [49,50] * CE 4 is refined into CE [51] * CE 5 is refined into CE [52,53,54] ### Cost equations --> "Loop" of start/3 * CEs [45,46,47,48,49,50,51,52,53,54] --> Loop 28 ### Ranking functions of CR start(V1,V,V2) #### Partial ranking functions of CR start(V1,V,V2) Computing Bounds ===================================== #### Cost of chains of g(V1,Out): * Chain [[12],14]: 1*it(12)+0 Such that:it(12) =< V1 with precondition: [Out=0,V1>=1] * Chain [[12],13]: 1*it(12)+0 Such that:it(12) =< V1-Out+1 with precondition: [Out>=1,V1>=Out] * Chain [14]: 0 with precondition: [Out=0,V1>=0] * Chain [13]: 0 with precondition: [V1+1=Out,V1>=0] #### Cost of chains of f(V1,V,V2,Out): * Chain [18]: 0 with precondition: [Out=0,V1>=0,V>=0,V2>=0] * Chain [17,18]: 1*s(2)+1 Such that:s(2) =< V2 with precondition: [Out=0,V1=V+1,V1>=1,V2>=0] * Chain [16,18]: 1 with precondition: [Out=0,V1=V+1,V1>=1,V2>=0] * Chain [15,18]: 1*s(3)+1 Such that:s(3) =< V2 with precondition: [Out=0,V1=V+1,V1>=1,V2>=1] #### Cost of chains of encArg(V1,Out): * Chain [23]: 0 with precondition: [Out=0,V1>=0] * Chain [multiple([19,20,21,22],[[23]])]: 1*it(19)+2*s(14)+1*s(16)+1*s(17)+0 Such that:aux(5) =< V1 it(19) =< aux(5) it(20) =< aux(5) aux(4) =< aux(5)+1 aux(3) =< aux(5) s(15) =< it(19)*aux(5) s(17) =< it(20)*aux(4) s(16) =< it(20)*aux(3) s(14) =< s(15) with precondition: [V1>=1,Out>=0,V1>=Out] #### Cost of chains of fun(V1,V,V2,Out): * Chain [24]: 12*s(21)+4*s(26)+4*s(27)+8*s(28)+4*s(32)+4*s(37)+4*s(38)+8*s(39)+4*s(63)+4*s(68)+4*s(69)+8*s(70)+1 Such that:aux(10) =< V1 aux(11) =< V aux(12) =< V2 s(63) =< aux(10) s(65) =< aux(10)+1 s(66) =< aux(10) s(67) =< s(63)*aux(10) s(68) =< aux(10)*s(65) s(69) =< aux(10)*s(66) s(70) =< s(67) s(21) =< aux(12) s(23) =< aux(12)+1 s(24) =< aux(12) s(25) =< s(21)*aux(12) s(26) =< aux(12)*s(23) s(27) =< aux(12)*s(24) s(28) =< s(25) s(32) =< aux(11) s(34) =< aux(11)+1 s(35) =< aux(11) s(36) =< s(32)*aux(11) s(37) =< aux(11)*s(34) s(38) =< aux(11)*s(35) s(39) =< s(36) with precondition: [Out=0,V1>=0,V>=0,V2>=0] #### Cost of chains of fun1(V1,Out): * Chain [27]: 2*s(144)+1*s(149)+1*s(150)+2*s(151)+0 Such that:aux(13) =< V1 s(144) =< aux(13) s(146) =< aux(13)+1 s(147) =< aux(13) s(148) =< s(144)*aux(13) s(149) =< aux(13)*s(146) s(150) =< aux(13)*s(147) s(151) =< s(148) with precondition: [Out=0,V1>=0] * Chain [26]: 0 with precondition: [Out=1,V1>=0] * Chain [25]: 3*s(154)+2*s(159)+2*s(160)+4*s(161)+0 Such that:aux(15) =< V1 s(154) =< aux(15) s(156) =< aux(15)+1 s(157) =< aux(15) s(158) =< s(154)*aux(15) s(159) =< aux(15)*s(156) s(160) =< aux(15)*s(157) s(161) =< s(158) with precondition: [V1>=1,Out>=1,V1+1>=Out] #### Cost of chains of start(V1,V,V2): * Chain [28]: 14*s(173)+12*s(174)+8*s(182)+8*s(183)+16*s(184)+4*s(199)+4*s(200)+8*s(201)+4*s(202)+4*s(206)+4*s(207)+8*s(208)+1 Such that:s(186) =< V aux(16) =< V1 aux(17) =< V2 s(174) =< aux(16) s(179) =< aux(16)+1 s(180) =< aux(16) s(181) =< s(174)*aux(16) s(182) =< aux(16)*s(179) s(183) =< aux(16)*s(180) s(184) =< s(181) s(173) =< aux(17) s(196) =< aux(17)+1 s(197) =< aux(17) s(198) =< s(173)*aux(17) s(199) =< aux(17)*s(196) s(200) =< aux(17)*s(197) s(201) =< s(198) s(202) =< s(186) s(203) =< s(186)+1 s(204) =< s(186) s(205) =< s(202)*s(186) s(206) =< s(186)*s(203) s(207) =< s(186)*s(204) s(208) =< s(205) with precondition: [V1>=0] Closed-form bounds of start(V1,V,V2): ------------------------------------- * Chain [28] with precondition: [V1>=0] - Upper bound: 20*V1+1+32*V1*V1+nat(V)*8+nat(V)*16*nat(V)+nat(V2)*18+nat(V2)*16*nat(V2) - Complexity: n^2 ### Maximum cost of start(V1,V,V2): 20*V1+1+32*V1*V1+nat(V)*8+nat(V)*16*nat(V)+nat(V2)*18+nat(V2)*16*nat(V2) Asymptotic class: n^2 * Total analysis performed in 370 ms. ---------------------------------------- (16) BOUNDS(1, n^2)