/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, 199 ms] (10) BOUNDS(1, n^1) (11) RelTrsToDecreasingLoopProblemProof [LOWER BOUND(ID), 0 ms] (12) TRS for Loop Detection (13) DecreasingLoopProof [LOWER BOUND(ID), 47 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: nonZero(0) -> false nonZero(s(x)) -> true p(0) -> 0 p(s(x)) -> x id_inc(x) -> x id_inc(x) -> s(x) random(x) -> rand(x, 0) rand(x, y) -> if(nonZero(x), x, y) if(false, x, y) -> y if(true, x, y) -> rand(p(x), id_inc(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: nonZero(0) -> false [1] nonZero(s(x)) -> true [1] p(0) -> 0 [1] p(s(x)) -> x [1] id_inc(x) -> x [1] id_inc(x) -> s(x) [1] random(x) -> rand(x, 0) [1] rand(x, y) -> if(nonZero(x), x, y) [1] if(false, x, y) -> y [1] if(true, x, y) -> rand(p(x), id_inc(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: nonZero(0) -> false [1] nonZero(s(x)) -> true [1] p(0) -> 0 [1] p(s(x)) -> x [1] id_inc(x) -> x [1] id_inc(x) -> s(x) [1] random(x) -> rand(x, 0) [1] rand(x, y) -> if(nonZero(x), x, y) [1] if(false, x, y) -> y [1] if(true, x, y) -> rand(p(x), id_inc(y)) [1] The TRS has the following type information: nonZero :: 0:s -> false:true 0 :: 0:s false :: false:true s :: 0:s -> 0:s true :: false:true p :: 0:s -> 0:s id_inc :: 0:s -> 0:s random :: 0:s -> 0:s rand :: 0:s -> 0:s -> 0:s if :: false:true -> 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: none And the following fresh constants: none ---------------------------------------- (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: nonZero(0) -> false [1] nonZero(s(x)) -> true [1] p(0) -> 0 [1] p(s(x)) -> x [1] id_inc(x) -> x [1] id_inc(x) -> s(x) [1] random(x) -> rand(x, 0) [1] rand(x, y) -> if(nonZero(x), x, y) [1] if(false, x, y) -> y [1] if(true, x, y) -> rand(p(x), id_inc(y)) [1] The TRS has the following type information: nonZero :: 0:s -> false:true 0 :: 0:s false :: false:true s :: 0:s -> 0:s true :: false:true p :: 0:s -> 0:s id_inc :: 0:s -> 0:s random :: 0:s -> 0:s rand :: 0:s -> 0:s -> 0:s if :: false:true -> 0:s -> 0:s -> 0:s 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 false => 0 true => 1 ---------------------------------------- (8) Obligation: Complexity RNTS consisting of the following rules: id_inc(z) -{ 1 }-> x :|: x >= 0, z = x id_inc(z) -{ 1 }-> 1 + x :|: x >= 0, z = x if(z, z', z'') -{ 1 }-> y :|: z' = x, z'' = y, x >= 0, y >= 0, z = 0 if(z, z', z'') -{ 1 }-> rand(p(x), id_inc(y)) :|: z' = x, z'' = y, z = 1, x >= 0, y >= 0 nonZero(z) -{ 1 }-> 1 :|: x >= 0, z = 1 + x nonZero(z) -{ 1 }-> 0 :|: z = 0 p(z) -{ 1 }-> x :|: x >= 0, z = 1 + x p(z) -{ 1 }-> 0 :|: z = 0 rand(z, z') -{ 1 }-> if(nonZero(x), x, y) :|: x >= 0, y >= 0, z = x, z' = y random(z) -{ 1 }-> rand(x, 0) :|: x >= 0, z = x 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(V, V6, V9),0,[nonZero(V, Out)],[V >= 0]). eq(start(V, V6, V9),0,[p(V, Out)],[V >= 0]). eq(start(V, V6, V9),0,[fun(V, Out)],[V >= 0]). eq(start(V, V6, V9),0,[random(V, Out)],[V >= 0]). eq(start(V, V6, V9),0,[rand(V, V6, Out)],[V >= 0,V6 >= 0]). eq(start(V, V6, V9),0,[if(V, V6, V9, Out)],[V >= 0,V6 >= 0,V9 >= 0]). eq(nonZero(V, Out),1,[],[Out = 0,V = 0]). eq(nonZero(V, Out),1,[],[Out = 1,V1 >= 0,V = 1 + V1]). eq(p(V, Out),1,[],[Out = 0,V = 0]). eq(p(V, Out),1,[],[Out = V2,V2 >= 0,V = 1 + V2]). eq(fun(V, Out),1,[],[Out = V3,V3 >= 0,V = V3]). eq(fun(V, Out),1,[],[Out = 1 + V4,V4 >= 0,V = V4]). eq(random(V, Out),1,[rand(V5, 0, Ret)],[Out = Ret,V5 >= 0,V = V5]). eq(rand(V, V6, Out),1,[nonZero(V7, Ret0),if(Ret0, V7, V8, Ret1)],[Out = Ret1,V7 >= 0,V8 >= 0,V = V7,V6 = V8]). eq(if(V, V6, V9, Out),1,[],[Out = V11,V6 = V10,V9 = V11,V10 >= 0,V11 >= 0,V = 0]). eq(if(V, V6, V9, Out),1,[p(V13, Ret01),fun(V12, Ret11),rand(Ret01, Ret11, Ret2)],[Out = Ret2,V6 = V13,V9 = V12,V = 1,V13 >= 0,V12 >= 0]). input_output_vars(nonZero(V,Out),[V],[Out]). input_output_vars(p(V,Out),[V],[Out]). input_output_vars(fun(V,Out),[V],[Out]). input_output_vars(random(V,Out),[V],[Out]). input_output_vars(rand(V,V6,Out),[V,V6],[Out]). input_output_vars(if(V,V6,V9,Out),[V,V6,V9],[Out]). CoFloCo proof output: Preprocessing Cost Relations ===================================== #### Computed strongly connected components 0. non_recursive : [fun/2] 1. non_recursive : [p/2] 2. non_recursive : [nonZero/2] 3. recursive : [if/4,rand/3] 4. non_recursive : [random/2] 5. non_recursive : [start/3] #### Obtained direct recursion through partial evaluation 0. SCC is partially evaluated into fun/2 1. SCC is partially evaluated into p/2 2. SCC is partially evaluated into nonZero/2 3. SCC is partially evaluated into rand/3 4. SCC is completely evaluated into other SCCs 5. SCC is partially evaluated into start/3 Control-Flow Refinement of Cost Relations ===================================== ### Specialization of cost equations fun/2 * CE 10 is refined into CE [16] * CE 11 is refined into CE [17] ### Cost equations --> "Loop" of fun/2 * CEs [16] --> Loop 11 * CEs [17] --> Loop 12 ### Ranking functions of CR fun(V,Out) #### Partial ranking functions of CR fun(V,Out) ### Specialization of cost equations p/2 * CE 9 is refined into CE [18] * CE 8 is refined into CE [19] ### Cost equations --> "Loop" of p/2 * CEs [18] --> Loop 13 * CEs [19] --> Loop 14 ### Ranking functions of CR p(V,Out) #### Partial ranking functions of CR p(V,Out) ### Specialization of cost equations nonZero/2 * CE 15 is refined into CE [20] * CE 14 is refined into CE [21] ### Cost equations --> "Loop" of nonZero/2 * CEs [20] --> Loop 15 * CEs [21] --> Loop 16 ### Ranking functions of CR nonZero(V,Out) #### Partial ranking functions of CR nonZero(V,Out) ### Specialization of cost equations rand/3 * CE 13 is refined into CE [22] * CE 12 is refined into CE [23,24] ### Cost equations --> "Loop" of rand/3 * CEs [24] --> Loop 17 * CEs [23] --> Loop 18 * CEs [22] --> Loop 19 ### Ranking functions of CR rand(V,V6,Out) * RF of phase [17,18]: [V] #### Partial ranking functions of CR rand(V,V6,Out) * Partial RF of phase [17,18]: - RF of loop [17:1,18:1]: V ### Specialization of cost equations start/3 * CE 1 is refined into CE [25,26,27,28,29,30] * CE 2 is refined into CE [31] * CE 3 is refined into CE [32,33] * CE 4 is refined into CE [34,35] * CE 5 is refined into CE [36,37] * CE 6 is refined into CE [38,39] * CE 7 is refined into CE [40,41] ### Cost equations --> "Loop" of start/3 * CEs [28,30] --> Loop 20 * CEs [27,29] --> Loop 21 * CEs [25,26] --> Loop 22 * CEs [31,32,33,34,35,36,37,38,39,40,41] --> Loop 23 ### Ranking functions of CR start(V,V6,V9) #### Partial ranking functions of CR start(V,V6,V9) Computing Bounds ===================================== #### Cost of chains of fun(V,Out): * Chain [12]: 1 with precondition: [V+1=Out,V>=0] * Chain [11]: 1 with precondition: [V=Out,V>=0] #### Cost of chains of p(V,Out): * Chain [14]: 1 with precondition: [V=0,Out=0] * Chain [13]: 1 with precondition: [V=Out+1,V>=1] #### Cost of chains of nonZero(V,Out): * Chain [16]: 1 with precondition: [V=0,Out=0] * Chain [15]: 1 with precondition: [Out=1,V>=1] #### Cost of chains of rand(V,V6,Out): * Chain [[17,18],19]: 10*it(17)+3 Such that:aux(3) =< V it(17) =< aux(3) with precondition: [V>=1,V6>=0,Out>=V6,V+V6>=Out] * Chain [19]: 3 with precondition: [V=0,V6=Out,V6>=0] #### Cost of chains of start(V,V6,V9): * Chain [23]: 20*s(2)+4 Such that:aux(4) =< V s(2) =< aux(4) with precondition: [V>=0] * Chain [22]: 6 with precondition: [V=1,V6=0,V9>=0] * Chain [21]: 6 with precondition: [V=1,V6=1,V9>=0] * Chain [20]: 20*s(6)+6 Such that:aux(5) =< V6 s(6) =< aux(5) with precondition: [V=1,V6>=2,V9>=0] Closed-form bounds of start(V,V6,V9): ------------------------------------- * Chain [23] with precondition: [V>=0] - Upper bound: 20*V+4 - Complexity: n * Chain [22] with precondition: [V=1,V6=0,V9>=0] - Upper bound: 6 - Complexity: constant * Chain [21] with precondition: [V=1,V6=1,V9>=0] - Upper bound: 6 - Complexity: constant * Chain [20] with precondition: [V=1,V6>=2,V9>=0] - Upper bound: 20*V6+6 - Complexity: n ### Maximum cost of start(V,V6,V9): max([20*V,2,nat(V6)*20+2])+4 Asymptotic class: n * Total analysis performed in 135 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: nonZero(0) -> false nonZero(s(x)) -> true p(0) -> 0 p(s(x)) -> x id_inc(x) -> x id_inc(x) -> s(x) random(x) -> rand(x, 0) rand(x, y) -> if(nonZero(x), x, y) if(false, x, y) -> y if(true, x, y) -> rand(p(x), id_inc(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 rand(s(x1_0), y) ->^+ rand(x1_0, id_inc(y)) gives rise to a decreasing loop by considering the right hand sides subterm at position []. The pumping substitution is [x1_0 / s(x1_0)]. The result substitution is [y / id_inc(y)]. ---------------------------------------- (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: nonZero(0) -> false nonZero(s(x)) -> true p(0) -> 0 p(s(x)) -> x id_inc(x) -> x id_inc(x) -> s(x) random(x) -> rand(x, 0) rand(x, y) -> if(nonZero(x), x, y) if(false, x, y) -> y if(true, x, y) -> rand(p(x), id_inc(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: nonZero(0) -> false nonZero(s(x)) -> true p(0) -> 0 p(s(x)) -> x id_inc(x) -> x id_inc(x) -> s(x) random(x) -> rand(x, 0) rand(x, y) -> if(nonZero(x), x, y) if(false, x, y) -> y if(true, x, y) -> rand(p(x), id_inc(y)) S is empty. Rewrite Strategy: INNERMOST