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