/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), 0 ms] (8) CpxRNTS (9) CompleteCoflocoProof [FINISHED, 329 ms] (10) BOUNDS(1, n^1) (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^1). The TRS R consists of the following rules: minus(0, Y) -> 0 minus(s(X), s(Y)) -> minus(X, Y) geq(X, 0) -> true geq(0, s(Y)) -> false geq(s(X), s(Y)) -> geq(X, Y) div(0, s(Y)) -> 0 div(s(X), s(Y)) -> if(geq(X, Y), s(div(minus(X, Y), s(Y))), 0) if(true, X, Y) -> X if(false, X, Y) -> 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: minus(0, Y) -> 0 [1] minus(s(X), s(Y)) -> minus(X, Y) [1] geq(X, 0) -> true [1] geq(0, s(Y)) -> false [1] geq(s(X), s(Y)) -> geq(X, Y) [1] div(0, s(Y)) -> 0 [1] div(s(X), s(Y)) -> if(geq(X, Y), s(div(minus(X, Y), s(Y))), 0) [1] if(true, X, Y) -> X [1] if(false, X, Y) -> 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: minus(0, Y) -> 0 [1] minus(s(X), s(Y)) -> minus(X, Y) [1] geq(X, 0) -> true [1] geq(0, s(Y)) -> false [1] geq(s(X), s(Y)) -> geq(X, Y) [1] div(0, s(Y)) -> 0 [1] div(s(X), s(Y)) -> if(geq(X, Y), s(div(minus(X, Y), s(Y))), 0) [1] if(true, X, Y) -> X [1] if(false, X, Y) -> Y [1] The TRS has the following type information: minus :: 0:s -> 0:s -> 0:s 0 :: 0:s s :: 0:s -> 0:s geq :: 0:s -> 0:s -> true:false true :: true:false false :: true:false div :: 0:s -> 0:s -> 0:s if :: true:false -> 0: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: minus(v0, v1) -> null_minus [0] div(v0, v1) -> null_div [0] geq(v0, v1) -> null_geq [0] if(v0, v1, v2) -> null_if [0] And the following fresh constants: null_minus, null_div, null_geq, null_if ---------------------------------------- (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: minus(0, Y) -> 0 [1] minus(s(X), s(Y)) -> minus(X, Y) [1] geq(X, 0) -> true [1] geq(0, s(Y)) -> false [1] geq(s(X), s(Y)) -> geq(X, Y) [1] div(0, s(Y)) -> 0 [1] div(s(X), s(Y)) -> if(geq(X, Y), s(div(minus(X, Y), s(Y))), 0) [1] if(true, X, Y) -> X [1] if(false, X, Y) -> Y [1] minus(v0, v1) -> null_minus [0] div(v0, v1) -> null_div [0] geq(v0, v1) -> null_geq [0] if(v0, v1, v2) -> null_if [0] The TRS has the following type information: minus :: 0:s:null_minus:null_div:null_if -> 0:s:null_minus:null_div:null_if -> 0:s:null_minus:null_div:null_if 0 :: 0:s:null_minus:null_div:null_if s :: 0:s:null_minus:null_div:null_if -> 0:s:null_minus:null_div:null_if geq :: 0:s:null_minus:null_div:null_if -> 0:s:null_minus:null_div:null_if -> true:false:null_geq true :: true:false:null_geq false :: true:false:null_geq div :: 0:s:null_minus:null_div:null_if -> 0:s:null_minus:null_div:null_if -> 0:s:null_minus:null_div:null_if if :: true:false:null_geq -> 0:s:null_minus:null_div:null_if -> 0:s:null_minus:null_div:null_if -> 0:s:null_minus:null_div:null_if null_minus :: 0:s:null_minus:null_div:null_if null_div :: 0:s:null_minus:null_div:null_if null_geq :: true:false:null_geq null_if :: 0:s:null_minus:null_div:null_if 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: 0 => 0 true => 2 false => 1 null_minus => 0 null_div => 0 null_geq => 0 null_if => 0 ---------------------------------------- (8) Obligation: Complexity RNTS consisting of the following rules: div(z, z') -{ 1 }-> if(geq(X, Y), 1 + div(minus(X, Y), 1 + Y), 0) :|: z = 1 + X, Y >= 0, z' = 1 + Y, X >= 0 div(z, z') -{ 1 }-> 0 :|: Y >= 0, z' = 1 + Y, z = 0 div(z, z') -{ 0 }-> 0 :|: v0 >= 0, v1 >= 0, z = v0, z' = v1 geq(z, z') -{ 1 }-> geq(X, Y) :|: z = 1 + X, Y >= 0, z' = 1 + Y, X >= 0 geq(z, z') -{ 1 }-> 2 :|: X >= 0, z = X, z' = 0 geq(z, z') -{ 1 }-> 1 :|: Y >= 0, z' = 1 + Y, z = 0 geq(z, z') -{ 0 }-> 0 :|: v0 >= 0, v1 >= 0, z = v0, z' = v1 if(z, z', z'') -{ 1 }-> X :|: z = 2, z' = X, Y >= 0, z'' = Y, X >= 0 if(z, z', z'') -{ 1 }-> Y :|: z' = X, Y >= 0, z = 1, z'' = Y, X >= 0 if(z, z', z'') -{ 0 }-> 0 :|: v0 >= 0, z'' = v2, v1 >= 0, z = v0, z' = v1, v2 >= 0 minus(z, z') -{ 1 }-> minus(X, Y) :|: z = 1 + X, Y >= 0, z' = 1 + Y, X >= 0 minus(z, z') -{ 1 }-> 0 :|: z' = Y, Y >= 0, z = 0 minus(z, z') -{ 0 }-> 0 :|: v0 >= 0, v1 >= 0, z = v0, z' = v1 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,[minus(V1, V, Out)],[V1 >= 0,V >= 0]). eq(start(V1, V, V2),0,[geq(V1, V, Out)],[V1 >= 0,V >= 0]). eq(start(V1, V, V2),0,[div(V1, V, Out)],[V1 >= 0,V >= 0]). eq(start(V1, V, V2),0,[if(V1, V, V2, Out)],[V1 >= 0,V >= 0,V2 >= 0]). eq(minus(V1, V, Out),1,[],[Out = 0,V = Y1,Y1 >= 0,V1 = 0]). eq(minus(V1, V, Out),1,[minus(X1, Y2, Ret)],[Out = Ret,V1 = 1 + X1,Y2 >= 0,V = 1 + Y2,X1 >= 0]). eq(geq(V1, V, Out),1,[],[Out = 2,X2 >= 0,V1 = X2,V = 0]). eq(geq(V1, V, Out),1,[],[Out = 1,Y3 >= 0,V = 1 + Y3,V1 = 0]). eq(geq(V1, V, Out),1,[geq(X3, Y4, Ret1)],[Out = Ret1,V1 = 1 + X3,Y4 >= 0,V = 1 + Y4,X3 >= 0]). eq(div(V1, V, Out),1,[],[Out = 0,Y5 >= 0,V = 1 + Y5,V1 = 0]). eq(div(V1, V, Out),1,[geq(X4, Y6, Ret0),minus(X4, Y6, Ret110),div(Ret110, 1 + Y6, Ret11),if(Ret0, 1 + Ret11, 0, Ret2)],[Out = Ret2,V1 = 1 + X4,Y6 >= 0,V = 1 + Y6,X4 >= 0]). eq(if(V1, V, V2, Out),1,[],[Out = X5,V1 = 2,V = X5,Y7 >= 0,V2 = Y7,X5 >= 0]). eq(if(V1, V, V2, Out),1,[],[Out = Y8,V = X6,Y8 >= 0,V1 = 1,V2 = Y8,X6 >= 0]). eq(minus(V1, V, Out),0,[],[Out = 0,V4 >= 0,V3 >= 0,V1 = V4,V = V3]). eq(div(V1, V, Out),0,[],[Out = 0,V6 >= 0,V5 >= 0,V1 = V6,V = V5]). eq(geq(V1, V, Out),0,[],[Out = 0,V8 >= 0,V7 >= 0,V1 = V8,V = V7]). eq(if(V1, V, V2, Out),0,[],[Out = 0,V9 >= 0,V2 = V11,V10 >= 0,V1 = V9,V = V10,V11 >= 0]). input_output_vars(minus(V1,V,Out),[V1,V],[Out]). input_output_vars(geq(V1,V,Out),[V1,V],[Out]). input_output_vars(div(V1,V,Out),[V1,V],[Out]). input_output_vars(if(V1,V,V2,Out),[V1,V,V2],[Out]). CoFloCo proof output: Preprocessing Cost Relations ===================================== #### Computed strongly connected components 0. recursive : [geq/3] 1. non_recursive : [if/4] 2. recursive : [minus/3] 3. recursive [non_tail] : [(div)/3] 4. non_recursive : [start/3] #### Obtained direct recursion through partial evaluation 0. SCC is partially evaluated into geq/3 1. SCC is partially evaluated into if/4 2. SCC is partially evaluated into minus/3 3. SCC is partially evaluated into (div)/3 4. SCC is partially evaluated into start/3 Control-Flow Refinement of Cost Relations ===================================== ### Specialization of cost equations geq/3 * CE 11 is refined into CE [18] * CE 8 is refined into CE [19] * CE 9 is refined into CE [20] * CE 10 is refined into CE [21] ### Cost equations --> "Loop" of geq/3 * CEs [21] --> Loop 13 * CEs [18] --> Loop 14 * CEs [19] --> Loop 15 * CEs [20] --> Loop 16 ### Ranking functions of CR geq(V1,V,Out) * RF of phase [13]: [V,V1] #### Partial ranking functions of CR geq(V1,V,Out) * Partial RF of phase [13]: - RF of loop [13:1]: V V1 ### Specialization of cost equations if/4 * CE 17 is refined into CE [22] * CE 15 is refined into CE [23] * CE 16 is refined into CE [24] ### Cost equations --> "Loop" of if/4 * CEs [22] --> Loop 17 * CEs [23] --> Loop 18 * CEs [24] --> Loop 19 ### Ranking functions of CR if(V1,V,V2,Out) #### Partial ranking functions of CR if(V1,V,V2,Out) ### Specialization of cost equations minus/3 * CE 5 is refined into CE [25] * CE 7 is refined into CE [26] * CE 6 is refined into CE [27] ### Cost equations --> "Loop" of minus/3 * CEs [27] --> Loop 20 * CEs [25,26] --> Loop 21 ### Ranking functions of CR minus(V1,V,Out) * RF of phase [20]: [V,V1] #### Partial ranking functions of CR minus(V1,V,Out) * Partial RF of phase [20]: - RF of loop [20:1]: V V1 ### Specialization of cost equations (div)/3 * CE 12 is refined into CE [28] * CE 14 is refined into CE [29] * CE 13 is refined into CE [30,31,32,33,34,35,36,37,38] ### Cost equations --> "Loop" of (div)/3 * CEs [37] --> Loop 22 * CEs [38] --> Loop 23 * CEs [32] --> Loop 24 * CEs [33] --> Loop 25 * CEs [30,31,34,35,36] --> Loop 26 * CEs [28,29] --> Loop 27 ### Ranking functions of CR div(V1,V,Out) #### Partial ranking functions of CR div(V1,V,Out) ### Specialization of cost equations start/3 * CE 1 is refined into CE [39] * CE 2 is refined into CE [40,41,42,43,44] * CE 3 is refined into CE [45,46,47] * CE 4 is refined into CE [48,49,50] ### Cost equations --> "Loop" of start/3 * CEs [46] --> Loop 28 * CEs [41] --> Loop 29 * CEs [49] --> Loop 30 * CEs [48] --> Loop 31 * CEs [39,40,42,43,44,45,47,50] --> Loop 32 ### Ranking functions of CR start(V1,V,V2) #### Partial ranking functions of CR start(V1,V,V2) Computing Bounds ===================================== #### Cost of chains of geq(V1,V,Out): * Chain [[13],16]: 1*it(13)+1 Such that:it(13) =< V1 with precondition: [Out=1,V1>=1,V>=V1+1] * Chain [[13],15]: 1*it(13)+1 Such that:it(13) =< V with precondition: [Out=2,V>=1,V1>=V] * Chain [[13],14]: 1*it(13)+0 Such that:it(13) =< V with precondition: [Out=0,V1>=1,V>=1] * Chain [16]: 1 with precondition: [V1=0,Out=1,V>=1] * Chain [15]: 1 with precondition: [V=0,Out=2,V1>=0] * Chain [14]: 0 with precondition: [Out=0,V1>=0,V>=0] #### Cost of chains of if(V1,V,V2,Out): * Chain [19]: 1 with precondition: [V1=1,V2=Out,V>=0,V2>=0] * Chain [18]: 1 with precondition: [V1=2,V=Out,V>=0,V2>=0] * Chain [17]: 0 with precondition: [Out=0,V1>=0,V>=0,V2>=0] #### Cost of chains of minus(V1,V,Out): * Chain [[20],21]: 1*it(20)+1 Such that:it(20) =< V with precondition: [Out=0,V1>=1,V>=1] * Chain [21]: 1 with precondition: [Out=0,V1>=0,V>=0] #### Cost of chains of div(V1,V,Out): * Chain [27]: 1 with precondition: [Out=0,V1>=0,V>=0] * Chain [26,27]: 6*s(3)+2*s(7)+5 Such that:aux(2) =< V1 aux(4) =< V s(7) =< aux(2) s(3) =< aux(4) with precondition: [Out=0,V1>=1,V>=1] * Chain [25,27]: 4 with precondition: [V=1,Out=0,V1>=1] * Chain [24,27]: 5 with precondition: [V=1,Out=1,V1>=1] * Chain [23,27]: 2*s(13)+4 Such that:aux(5) =< V s(13) =< aux(5) with precondition: [Out=0,V>=2,V1>=V] * Chain [22,27]: 2*s(15)+5 Such that:aux(6) =< V s(15) =< aux(6) with precondition: [Out=1,V>=2,V1>=V] #### Cost of chains of start(V1,V,V2): * Chain [32]: 13*s(23)+3*s(25)+5 Such that:aux(8) =< V1 aux(9) =< V s(25) =< aux(8) s(23) =< aux(9) with precondition: [V1>=0,V>=0] * Chain [31]: 1 with precondition: [V1=1,V>=0,V2>=0] * Chain [30]: 1 with precondition: [V1=2,V>=0,V2>=0] * Chain [29]: 1 with precondition: [V=0,V1>=0] * Chain [28]: 5 with precondition: [V=1,V1>=1] Closed-form bounds of start(V1,V,V2): ------------------------------------- * Chain [32] with precondition: [V1>=0,V>=0] - Upper bound: 3*V1+13*V+5 - Complexity: n * Chain [31] with precondition: [V1=1,V>=0,V2>=0] - Upper bound: 1 - Complexity: constant * Chain [30] with precondition: [V1=2,V>=0,V2>=0] - Upper bound: 1 - Complexity: constant * Chain [29] with precondition: [V=0,V1>=0] - Upper bound: 1 - Complexity: constant * Chain [28] with precondition: [V=1,V1>=1] - Upper bound: 5 - Complexity: constant ### Maximum cost of start(V1,V,V2): 3*V1+13*V+5 Asymptotic class: n * Total analysis performed in 257 ms. ---------------------------------------- (10) BOUNDS(1, n^1) ---------------------------------------- (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^1). The TRS R consists of the following rules: minus(0, Y) -> 0 minus(s(X), s(Y)) -> minus(X, Y) geq(X, 0) -> true geq(0, s(Y)) -> false geq(s(X), s(Y)) -> geq(X, Y) div(0, s(Y)) -> 0 div(s(X), s(Y)) -> if(geq(X, Y), s(div(minus(X, Y), s(Y))), 0) if(true, X, Y) -> X if(false, X, Y) -> Y 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 minus(s(X), s(Y)) ->^+ minus(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^1). The TRS R consists of the following rules: minus(0, Y) -> 0 minus(s(X), s(Y)) -> minus(X, Y) geq(X, 0) -> true geq(0, s(Y)) -> false geq(s(X), s(Y)) -> geq(X, Y) div(0, s(Y)) -> 0 div(s(X), s(Y)) -> if(geq(X, Y), s(div(minus(X, Y), s(Y))), 0) if(true, X, Y) -> X if(false, X, Y) -> Y 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^1). The TRS R consists of the following rules: minus(0, Y) -> 0 minus(s(X), s(Y)) -> minus(X, Y) geq(X, 0) -> true geq(0, s(Y)) -> false geq(s(X), s(Y)) -> geq(X, Y) div(0, s(Y)) -> 0 div(s(X), s(Y)) -> if(geq(X, Y), s(div(minus(X, Y), s(Y))), 0) if(true, X, Y) -> X if(false, X, Y) -> Y S is empty. Rewrite Strategy: INNERMOST