/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: 48fb2092695e11cc9f56e44b17a92a5f88ffb256 marcel 20180622 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, 190 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: cond(true, x) -> cond(odd(x), p(x)) odd(0) -> false odd(s(0)) -> true odd(s(s(x))) -> odd(x) 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: cond(true, x) -> cond(odd(x), p(x)) [1] odd(0) -> false [1] odd(s(0)) -> true [1] odd(s(s(x))) -> odd(x) [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: cond(true, x) -> cond(odd(x), p(x)) [1] odd(0) -> false [1] odd(s(0)) -> true [1] odd(s(s(x))) -> odd(x) [1] p(0) -> 0 [1] p(s(x)) -> x [1] The TRS has the following type information: cond :: true:false -> 0:s -> cond true :: true:false odd :: 0:s -> true:false p :: 0:s -> 0:s 0 :: 0:s false :: true:false 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: cond(v0, v1) -> null_cond [0] And the following fresh constants: null_cond ---------------------------------------- (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: cond(true, x) -> cond(odd(x), p(x)) [1] odd(0) -> false [1] odd(s(0)) -> true [1] odd(s(s(x))) -> odd(x) [1] p(0) -> 0 [1] p(s(x)) -> x [1] cond(v0, v1) -> null_cond [0] The TRS has the following type information: cond :: true:false -> 0:s -> null_cond true :: true:false odd :: 0:s -> true:false p :: 0:s -> 0:s 0 :: 0:s false :: true:false s :: 0:s -> 0:s null_cond :: null_cond 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_cond => 0 ---------------------------------------- (8) Obligation: Complexity RNTS consisting of the following rules: cond(z, z') -{ 1 }-> cond(odd(x), p(x)) :|: z' = x, z = 1, x >= 0 cond(z, z') -{ 0 }-> 0 :|: v0 >= 0, v1 >= 0, z = v0, z' = v1 odd(z) -{ 1 }-> odd(x) :|: x >= 0, z = 1 + (1 + x) odd(z) -{ 1 }-> 1 :|: z = 1 + 0 odd(z) -{ 1 }-> 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),0,[cond(V1, V, Out)],[V1 >= 0,V >= 0]). eq(start(V1, V),0,[odd(V1, Out)],[V1 >= 0]). eq(start(V1, V),0,[p(V1, Out)],[V1 >= 0]). eq(cond(V1, V, Out),1,[odd(V2, Ret0),p(V2, Ret1),cond(Ret0, Ret1, Ret)],[Out = Ret,V = V2,V1 = 1,V2 >= 0]). eq(odd(V1, Out),1,[],[Out = 0,V1 = 0]). eq(odd(V1, Out),1,[],[Out = 1,V1 = 1]). eq(odd(V1, Out),1,[odd(V3, Ret2)],[Out = Ret2,V3 >= 0,V1 = 2 + V3]). eq(p(V1, Out),1,[],[Out = 0,V1 = 0]). eq(p(V1, Out),1,[],[Out = V4,V4 >= 0,V1 = 1 + V4]). eq(cond(V1, V, Out),0,[],[Out = 0,V6 >= 0,V5 >= 0,V1 = V6,V = V5]). input_output_vars(cond(V1,V,Out),[V1,V],[Out]). input_output_vars(odd(V1,Out),[V1],[Out]). input_output_vars(p(V1,Out),[V1],[Out]). CoFloCo proof output: Preprocessing Cost Relations ===================================== #### Computed strongly connected components 0. recursive : [odd/2] 1. non_recursive : [p/2] 2. recursive : [cond/3] 3. non_recursive : [start/2] #### Obtained direct recursion through partial evaluation 0. SCC is partially evaluated into odd/2 1. SCC is partially evaluated into p/2 2. SCC is partially evaluated into cond/3 3. SCC is partially evaluated into start/2 Control-Flow Refinement of Cost Relations ===================================== ### Specialization of cost equations odd/2 * CE 8 is refined into CE [11] * CE 7 is refined into CE [12] * CE 6 is refined into CE [13] ### Cost equations --> "Loop" of odd/2 * CEs [12] --> Loop 9 * CEs [13] --> Loop 10 * CEs [11] --> Loop 11 ### Ranking functions of CR odd(V1,Out) * RF of phase [11]: [V1-1] #### Partial ranking functions of CR odd(V1,Out) * Partial RF of phase [11]: - RF of loop [11:1]: V1-1 ### Specialization of cost equations p/2 * CE 10 is refined into CE [14] * CE 9 is refined into CE [15] ### Cost equations --> "Loop" of p/2 * CEs [14] --> Loop 12 * CEs [15] --> Loop 13 ### Ranking functions of CR p(V1,Out) #### Partial ranking functions of CR p(V1,Out) ### Specialization of cost equations cond/3 * CE 5 is refined into CE [16] * CE 4 is refined into CE [17,18,19,20] ### Cost equations --> "Loop" of cond/3 * CEs [20] --> Loop 14 * CEs [19] --> Loop 15 * CEs [18] --> Loop 16 * CEs [17] --> Loop 17 * CEs [16] --> Loop 18 ### Ranking functions of CR cond(V1,V,Out) * RF of phase [14]: [V-2] #### Partial ranking functions of CR cond(V1,V,Out) * Partial RF of phase [14]: - RF of loop [14:1]: V-2 ### Specialization of cost equations start/2 * CE 1 is refined into CE [21,22,23] * CE 2 is refined into CE [24,25,26,27] * CE 3 is refined into CE [28,29] ### Cost equations --> "Loop" of start/2 * CEs [21] --> Loop 19 * CEs [22,23,25,26,27,29] --> Loop 20 * CEs [24,28] --> Loop 21 ### Ranking functions of CR start(V1,V) #### Partial ranking functions of CR start(V1,V) Computing Bounds ===================================== #### Cost of chains of odd(V1,Out): * Chain [[11],10]: 1*it(11)+1 Such that:it(11) =< V1 with precondition: [Out=0,V1>=2] * Chain [[11],9]: 1*it(11)+1 Such that:it(11) =< V1 with precondition: [Out=1,V1>=3] * Chain [10]: 1 with precondition: [V1=0,Out=0] * Chain [9]: 1 with precondition: [V1=1,Out=1] #### Cost of chains of p(V1,Out): * Chain [13]: 1 with precondition: [V1=0,Out=0] * Chain [12]: 1 with precondition: [V1=Out+1,V1>=1] #### Cost of chains of cond(V1,V,Out): * Chain [[14],18]: 3*it(14)+1*s(3)+0 Such that:aux(3) =< V it(14) =< aux(3) s(3) =< it(14)*aux(3) with precondition: [V1=1,Out=0,V>=3] * Chain [[14],15,18]: 4*it(14)+1*s(3)+3 Such that:aux(4) =< V it(14) =< aux(4) s(3) =< it(14)*aux(4) with precondition: [V1=1,Out=0,V>=3] * Chain [18]: 0 with precondition: [Out=0,V1>=0,V>=0] * Chain [17,18]: 3 with precondition: [V1=1,V=0,Out=0] * Chain [16,18]: 3 with precondition: [V1=1,V=1,Out=0] * Chain [16,17,18]: 6 with precondition: [V1=1,V=1,Out=0] * Chain [15,18]: 1*s(4)+3 Such that:s(4) =< V with precondition: [V1=1,Out=0,V>=2] #### Cost of chains of start(V1,V): * Chain [21]: 1 with precondition: [V1=0] * Chain [20]: 8*s(13)+2*s(14)+2*s(15)+6 Such that:s(12) =< V aux(6) =< V1 s(15) =< aux(6) s(13) =< s(12) s(14) =< s(13)*s(12) with precondition: [V1>=1] * Chain [19]: 3 with precondition: [V1>=0,V>=0] Closed-form bounds of start(V1,V): ------------------------------------- * Chain [21] with precondition: [V1=0] - Upper bound: 1 - Complexity: constant * Chain [20] with precondition: [V1>=1] - Upper bound: 2*V1+6+nat(V)*8+nat(V)*2*nat(V) - Complexity: n^2 * Chain [19] with precondition: [V1>=0,V>=0] - Upper bound: 3 - Complexity: constant ### Maximum cost of start(V1,V): max([2,2*V1+5+nat(V)*8+nat(V)*2*nat(V)])+1 Asymptotic class: n^2 * Total analysis performed in 137 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: cond(true, x) -> cond(odd(x), p(x)) odd(0) -> false odd(s(0)) -> true odd(s(s(x))) -> odd(x) 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 odd(s(s(x))) ->^+ odd(x) gives rise to a decreasing loop by considering the right hand sides subterm at position []. The pumping substitution is [x / s(s(x))]. 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: cond(true, x) -> cond(odd(x), p(x)) odd(0) -> false odd(s(0)) -> true odd(s(s(x))) -> odd(x) 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: cond(true, x) -> cond(odd(x), p(x)) odd(0) -> false odd(s(0)) -> true odd(s(s(x))) -> odd(x) p(0) -> 0 p(s(x)) -> x S is empty. Rewrite Strategy: INNERMOST