/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^2)) 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^2). (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), 0 ms] (8) CpxRNTS (9) CompleteCoflocoProof [FINISHED, 450 ms] (10) BOUNDS(1, n^2) (11) RelTrsToDecreasingLoopProblemProof [LOWER BOUND(ID), 0 ms] (12) TRS for Loop Detection (13) DecreasingLoopProof [LOWER BOUND(ID), 0 ms] (14) BEST (15) proven lower bound (16) LowerBoundPropagationProof [FINISHED, 0 ms] (17) BOUNDS(n^1, INF) (18) TRS for Loop Detection ---------------------------------------- (0) Obligation: The Runtime Complexity (innermost) of the given CpxTRS could be proven to be BOUNDS(n^1, n^2). The TRS R consists of the following rules: cond1(true, x, y) -> cond2(gr(x, y), x, y) cond2(true, x, y) -> cond1(gr(x, 0), y, y) cond2(false, x, y) -> cond1(gr(x, 0), p(x), y) gr(0, x) -> false gr(s(x), 0) -> true gr(s(x), s(y)) -> gr(x, y) p(0) -> 0 p(s(x)) -> 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: cond1(true, x, y) -> cond2(gr(x, y), x, y) [1] cond2(true, x, y) -> cond1(gr(x, 0), y, y) [1] cond2(false, x, y) -> cond1(gr(x, 0), p(x), y) [1] gr(0, x) -> false [1] gr(s(x), 0) -> true [1] gr(s(x), s(y)) -> gr(x, y) [1] p(0) -> 0 [1] p(s(x)) -> 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: cond1(true, x, y) -> cond2(gr(x, y), x, y) [1] cond2(true, x, y) -> cond1(gr(x, 0), y, y) [1] cond2(false, x, y) -> cond1(gr(x, 0), p(x), y) [1] gr(0, x) -> false [1] gr(s(x), 0) -> true [1] gr(s(x), s(y)) -> gr(x, y) [1] p(0) -> 0 [1] p(s(x)) -> x [1] The TRS has the following type information: cond1 :: true:false -> 0:s -> 0:s -> cond1:cond2 true :: true:false cond2 :: true:false -> 0:s -> 0:s -> cond1:cond2 gr :: 0:s -> 0:s -> true:false 0 :: 0:s false :: true:false p :: 0:s -> 0:s 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: cond1(v0, v1, v2) -> null_cond1 [0] And the following fresh constants: null_cond1 ---------------------------------------- (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: cond1(true, x, y) -> cond2(gr(x, y), x, y) [1] cond2(true, x, y) -> cond1(gr(x, 0), y, y) [1] cond2(false, x, y) -> cond1(gr(x, 0), p(x), y) [1] gr(0, x) -> false [1] gr(s(x), 0) -> true [1] gr(s(x), s(y)) -> gr(x, y) [1] p(0) -> 0 [1] p(s(x)) -> x [1] cond1(v0, v1, v2) -> null_cond1 [0] The TRS has the following type information: cond1 :: true:false -> 0:s -> 0:s -> null_cond1 true :: true:false cond2 :: true:false -> 0:s -> 0:s -> null_cond1 gr :: 0:s -> 0:s -> true:false 0 :: 0:s false :: true:false p :: 0:s -> 0:s s :: 0:s -> 0:s null_cond1 :: null_cond1 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_cond1 => 0 ---------------------------------------- (8) Obligation: Complexity RNTS consisting of the following rules: cond1(z, z', z'') -{ 1 }-> cond2(gr(x, y), x, y) :|: z' = x, z'' = y, z = 1, x >= 0, y >= 0 cond1(z, z', z'') -{ 0 }-> 0 :|: v0 >= 0, z'' = v2, v1 >= 0, z = v0, z' = v1, v2 >= 0 cond2(z, z', z'') -{ 1 }-> cond1(gr(x, 0), y, y) :|: z' = x, z'' = y, z = 1, x >= 0, y >= 0 cond2(z, z', z'') -{ 1 }-> cond1(gr(x, 0), p(x), y) :|: z' = x, z'' = y, x >= 0, y >= 0, z = 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 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(V1, V, V2),0,[cond1(V1, V, V2, Out)],[V1 >= 0,V >= 0,V2 >= 0]). eq(start(V1, V, V2),0,[cond2(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,[p(V1, Out)],[V1 >= 0]). eq(cond1(V1, V, V2, Out),1,[gr(V4, V3, Ret0),cond2(Ret0, V4, V3, Ret)],[Out = Ret,V = V4,V2 = V3,V1 = 1,V4 >= 0,V3 >= 0]). eq(cond2(V1, V, V2, Out),1,[gr(V5, 0, Ret01),cond1(Ret01, V6, V6, Ret1)],[Out = Ret1,V = V5,V2 = V6,V1 = 1,V5 >= 0,V6 >= 0]). eq(cond2(V1, V, V2, Out),1,[gr(V8, 0, Ret02),p(V8, Ret11),cond1(Ret02, Ret11, V7, Ret2)],[Out = Ret2,V = V8,V2 = V7,V8 >= 0,V7 >= 0,V1 = 0]). eq(gr(V1, V, Out),1,[],[Out = 0,V = V9,V9 >= 0,V1 = 0]). eq(gr(V1, V, Out),1,[],[Out = 1,V10 >= 0,V1 = 1 + V10,V = 0]). eq(gr(V1, V, Out),1,[gr(V12, V11, Ret3)],[Out = Ret3,V = 1 + V11,V12 >= 0,V11 >= 0,V1 = 1 + V12]). eq(p(V1, Out),1,[],[Out = 0,V1 = 0]). eq(p(V1, Out),1,[],[Out = V13,V13 >= 0,V1 = 1 + V13]). eq(cond1(V1, V, V2, Out),0,[],[Out = 0,V15 >= 0,V2 = V16,V14 >= 0,V1 = V15,V = V14,V16 >= 0]). input_output_vars(cond1(V1,V,V2,Out),[V1,V,V2],[Out]). input_output_vars(cond2(V1,V,V2,Out),[V1,V,V2],[Out]). input_output_vars(gr(V1,V,Out),[V1,V],[Out]). input_output_vars(p(V1,Out),[V1],[Out]). CoFloCo proof output: Preprocessing Cost Relations ===================================== #### Computed strongly connected components 0. recursive : [gr/3] 1. non_recursive : [p/2] 2. recursive : [cond1/4,cond2/4] 3. non_recursive : [start/3] #### Obtained direct recursion through partial evaluation 0. SCC is partially evaluated into gr/3 1. SCC is partially evaluated into p/2 2. SCC is partially evaluated into cond2/4 3. SCC is partially evaluated into start/3 Control-Flow Refinement of Cost Relations ===================================== ### Specialization of cost equations gr/3 * CE 8 is refined into CE [15] * CE 7 is refined into CE [16] * CE 6 is refined into CE [17] ### Cost equations --> "Loop" of gr/3 * CEs [16] --> Loop 11 * CEs [17] --> Loop 12 * CEs [15] --> 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 p/2 * CE 14 is refined into CE [18] * CE 13 is refined into CE [19] ### Cost equations --> "Loop" of p/2 * CEs [18] --> Loop 14 * CEs [19] --> Loop 15 ### Ranking functions of CR p(V1,Out) #### Partial ranking functions of CR p(V1,Out) ### Specialization of cost equations cond2/4 * CE 12 is refined into CE [20,21] * CE 11 is refined into CE [22,23,24,25] * CE 10 is refined into CE [26,27] * CE 9 is refined into CE [28,29] ### Cost equations --> "Loop" of cond2/4 * CEs [27] --> Loop 16 * CEs [26] --> Loop 17 * CEs [29] --> Loop 18 * CEs [28] --> Loop 19 * CEs [21] --> Loop 20 * CEs [20] --> Loop 21 * CEs [25] --> Loop 22 * CEs [24] --> Loop 23 * CEs [23] --> Loop 24 * CEs [22] --> Loop 25 ### Ranking functions of CR cond2(V1,V,V2,Out) * RF of phase [23]: [V-1] #### Partial ranking functions of CR cond2(V1,V,V2,Out) * Partial RF of phase [23]: - RF of loop [23:1]: V-1 ### Specialization of cost equations start/3 * CE 1 is refined into CE [30] * CE 2 is refined into CE [31,32,33,34,35] * CE 3 is refined into CE [36,37,38,39,40,41,42] * CE 4 is refined into CE [43,44,45,46] * CE 5 is refined into CE [47,48] ### Cost equations --> "Loop" of start/3 * CEs [35,42] --> Loop 26 * CEs [30,32,33,34,41] --> Loop 27 * CEs [31,40,44,45,46,48] --> Loop 28 * CEs [36,37,38,39,43,47] --> Loop 29 ### Ranking functions of CR start(V1,V,V2) #### Partial ranking functions of CR start(V1,V,V2) Computing Bounds ===================================== #### 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 p(V1,Out): * Chain [15]: 1 with precondition: [V1=0,Out=0] * Chain [14]: 1 with precondition: [V1=Out+1,V1>=1] #### Cost of chains of cond2(V1,V,V2,Out): * Chain [[23],25,19]: 5*it(23)+1*s(3)+8 Such that:aux(3) =< V it(23) =< aux(3) s(3) =< it(23)*aux(3) with precondition: [V1=0,Out=0,V>=2,V2+1>=V] * Chain [[23],18]: 5*it(23)+1*s(3)+3 Such that:aux(4) =< V it(23) =< aux(4) s(3) =< it(23)*aux(4) with precondition: [V1=0,Out=0,V>=2,V2+1>=V] * Chain [25,19]: 8 with precondition: [V1=0,V=1,Out=0,V2>=0] * Chain [24,21,19]: 12 with precondition: [V1=0,V2=0,Out=0,V>=2] * Chain [24,16]: 7 with precondition: [V1=0,V2=0,Out=0,V>=2] * Chain [22,20,[23],25,19]: 7*it(23)+1*s(3)+17 Such that:aux(6) =< V2 it(23) =< aux(6) s(3) =< it(23)*aux(6) with precondition: [V1=0,Out=0,V2>=2,V>=V2+2] * Chain [22,20,[23],18]: 7*it(23)+1*s(3)+12 Such that:aux(8) =< V2 it(23) =< aux(8) s(3) =< it(23)*aux(8) with precondition: [V1=0,Out=0,V2>=2,V>=V2+2] * Chain [22,20,25,19]: 2*s(4)+17 Such that:aux(9) =< 1 s(4) =< aux(9) with precondition: [V1=0,V2=1,Out=0,V>=3] * Chain [22,20,18]: 2*s(4)+12 Such that:aux(10) =< V2 s(4) =< aux(10) with precondition: [V1=0,Out=0,V2>=1,V>=V2+2] * Chain [22,16]: 1*s(5)+7 Such that:s(5) =< V2 with precondition: [V1=0,Out=0,V2>=1,V>=V2+2] * Chain [21,19]: 7 with precondition: [V1=1,V2=0,Out=0,V>=1] * Chain [20,[23],25,19]: 6*it(23)+1*s(3)+12 Such that:aux(5) =< V2 it(23) =< aux(5) s(3) =< it(23)*aux(5) with precondition: [V1=1,Out=0,V>=1,V2>=2] * Chain [20,[23],18]: 6*it(23)+1*s(3)+7 Such that:aux(7) =< V2 it(23) =< aux(7) s(3) =< it(23)*aux(7) with precondition: [V1=1,Out=0,V>=1,V2>=2] * Chain [20,25,19]: 1*s(4)+12 Such that:s(4) =< 1 with precondition: [V1=1,V2=1,Out=0,V>=1] * Chain [20,18]: 1*s(4)+7 Such that:s(4) =< V2 with precondition: [V1=1,Out=0,V>=1,V2>=1] * Chain [19]: 3 with precondition: [V1=0,V=0,Out=0,V2>=0] * Chain [18]: 3 with precondition: [V1=0,Out=0,V>=1,V2>=0] * Chain [17]: 2 with precondition: [V1=1,V=0,Out=0,V2>=0] * Chain [16]: 2 with precondition: [V1=1,Out=0,V>=1,V2>=0] #### Cost of chains of start(V1,V,V2): * Chain [29]: 17*s(30)+10*s(31)+2*s(32)+2*s(33)+2*s(35)+17 Such that:s(34) =< 1 s(28) =< V s(29) =< V2 s(35) =< s(34) s(30) =< s(29) s(31) =< s(28) s(32) =< s(31)*s(28) s(33) =< s(30)*s(29) with precondition: [V1=0] * Chain [28]: 1*s(36)+1*s(37)+5 Such that:s(36) =< V1 s(37) =< V with precondition: [V1>=1] * Chain [27]: 11*s(41)+44*s(44)+2*s(46)+6*s(47)+19 Such that:aux(14) =< V aux(16) =< V2 s(44) =< aux(16) s(47) =< s(44)*aux(16) s(41) =< aux(14) s(46) =< s(41)*aux(14) with precondition: [V1>=0,V>=0,V2>=0] * Chain [26]: 17 with precondition: [V1=1,V2=1,V>=1] Closed-form bounds of start(V1,V,V2): ------------------------------------- * Chain [29] with precondition: [V1=0] - Upper bound: nat(V)*10+19+nat(V)*2*nat(V)+nat(V2)*17+nat(V2)*2*nat(V2) - Complexity: n^2 * Chain [28] with precondition: [V1>=1] - Upper bound: V1+5+nat(V) - Complexity: n * Chain [27] with precondition: [V1>=0,V>=0,V2>=0] - Upper bound: 11*V+19+2*V*V+44*V2+6*V2*V2 - Complexity: n^2 * Chain [26] with precondition: [V1=1,V2=1,V>=1] - Upper bound: 17 - Complexity: constant ### Maximum cost of start(V1,V,V2): max([12,nat(V)+max([V1,nat(V)*9+14+nat(V)*2*nat(V)+nat(V2)*17+nat(V2)*2*nat(V2)+(nat(V2)*27+nat(V)+nat(V2)*4*nat(V2))])])+5 Asymptotic class: n^2 * Total analysis performed in 363 ms. ---------------------------------------- (10) BOUNDS(1, n^2) ---------------------------------------- (11) RelTrsToDecreasingLoopProblemProof (LOWER BOUND(ID)) Transformed a relative TRS into a decreasing-loop problem. ---------------------------------------- (12) Obligation: Analyzing the following TRS for decreasing loops: The Runtime Complexity (innermost) of the given CpxTRS could be proven to be BOUNDS(n^1, n^2). The TRS R consists of the following rules: cond1(true, x, y) -> cond2(gr(x, y), x, y) cond2(true, x, y) -> cond1(gr(x, 0), y, y) cond2(false, x, y) -> cond1(gr(x, 0), p(x), y) gr(0, x) -> false gr(s(x), 0) -> true gr(s(x), s(y)) -> gr(x, y) p(0) -> 0 p(s(x)) -> x S is empty. Rewrite Strategy: INNERMOST ---------------------------------------- (13) DecreasingLoopProof (LOWER BOUND(ID)) The following loop(s) give(s) rise to the lower bound Omega(n^1): The rewrite sequence gr(s(x), s(y)) ->^+ gr(x, y) gives rise to a decreasing loop by considering the right hand sides subterm at position []. The pumping substitution is [x / s(x), y / s(y)]. The result substitution is [ ]. ---------------------------------------- (14) Complex Obligation (BEST) ---------------------------------------- (15) Obligation: Proved the lower bound n^1 for the following obligation: The Runtime Complexity (innermost) of the given CpxTRS could be proven to be BOUNDS(n^1, n^2). The TRS R consists of the following rules: cond1(true, x, y) -> cond2(gr(x, y), x, y) cond2(true, x, y) -> cond1(gr(x, 0), y, y) cond2(false, x, y) -> cond1(gr(x, 0), p(x), y) gr(0, x) -> false gr(s(x), 0) -> true gr(s(x), s(y)) -> gr(x, y) p(0) -> 0 p(s(x)) -> x S is empty. Rewrite Strategy: INNERMOST ---------------------------------------- (16) LowerBoundPropagationProof (FINISHED) Propagated lower bound. ---------------------------------------- (17) BOUNDS(n^1, INF) ---------------------------------------- (18) Obligation: Analyzing the following TRS for decreasing loops: The Runtime Complexity (innermost) of the given CpxTRS could be proven to be BOUNDS(n^1, n^2). The TRS R consists of the following rules: cond1(true, x, y) -> cond2(gr(x, y), x, y) cond2(true, x, y) -> cond1(gr(x, 0), y, y) cond2(false, x, y) -> cond1(gr(x, 0), p(x), y) gr(0, x) -> false gr(s(x), 0) -> true gr(s(x), s(y)) -> gr(x, y) p(0) -> 0 p(s(x)) -> x S is empty. Rewrite Strategy: INNERMOST