/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^1)) proof of /export/starexec/sandbox2/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^1). (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), 4 ms] (10) CpxRNTS (11) CompleteCoflocoProof [FINISHED, 152 ms] (12) BOUNDS(1, n^1) (13) RenamingProof [BOTH BOUNDS(ID, ID), 0 ms] (14) CpxTRS (15) SlicingProof [LOWER BOUND(ID), 0 ms] (16) CpxTRS (17) TypeInferenceProof [BOTH BOUNDS(ID, ID), 0 ms] (18) typed CpxTrs (19) OrderProof [LOWER BOUND(ID), 0 ms] (20) typed CpxTrs (21) RewriteLemmaProof [LOWER BOUND(ID), 3804 ms] (22) proven lower bound (23) LowerBoundPropagationProof [FINISHED, 0 ms] (24) BOUNDS(n^1, INF) ---------------------------------------- (0) Obligation: The Runtime Complexity (full) of the given CpxTRS could be proven to be BOUNDS(n^1, n^1). The TRS R consists of the following rules: prime(0) -> false prime(s(0)) -> false prime(s(s(x))) -> prime1(s(s(x)), s(x)) prime1(x, 0) -> false prime1(x, s(0)) -> true prime1(x, s(s(y))) -> and(not(divp(s(s(y)), x)), prime1(x, s(y))) divp(x, y) -> =(rem(x, y), 0) S is empty. Rewrite Strategy: FULL ---------------------------------------- (1) RcToIrcProof (BOTH BOUNDS(ID, ID)) Converted rc-obligation to irc-obligation. As the TRS does not nest defined symbols, we have rc = irc. ---------------------------------------- (2) Obligation: The Runtime Complexity (innermost) of the given CpxTRS could be proven to be BOUNDS(1, n^1). The TRS R consists of the following rules: prime(0) -> false prime(s(0)) -> false prime(s(s(x))) -> prime1(s(s(x)), s(x)) prime1(x, 0) -> false prime1(x, s(0)) -> true prime1(x, s(s(y))) -> and(not(divp(s(s(y)), x)), prime1(x, s(y))) divp(x, y) -> =(rem(x, y), 0) 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^1). The TRS R consists of the following rules: prime(0) -> false [1] prime(s(0)) -> false [1] prime(s(s(x))) -> prime1(s(s(x)), s(x)) [1] prime1(x, 0) -> false [1] prime1(x, s(0)) -> true [1] prime1(x, s(s(y))) -> and(not(divp(s(s(y)), x)), prime1(x, s(y))) [1] divp(x, y) -> =(rem(x, y), 0) [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: prime(0) -> false [1] prime(s(0)) -> false [1] prime(s(s(x))) -> prime1(s(s(x)), s(x)) [1] prime1(x, 0) -> false [1] prime1(x, s(0)) -> true [1] prime1(x, s(s(y))) -> and(not(divp(s(s(y)), x)), prime1(x, s(y))) [1] divp(x, y) -> =(rem(x, y), 0) [1] The TRS has the following type information: prime :: 0:s -> false:true:and 0 :: 0:s false :: false:true:and s :: 0:s -> 0:s prime1 :: 0:s -> 0:s -> false:true:and true :: false:true:and and :: not -> false:true:and -> false:true:and not :: = -> not divp :: 0:s -> 0:s -> = = :: rem -> 0:s -> = rem :: 0:s -> 0:s -> rem 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: none And the following fresh constants: const, const1, const2 ---------------------------------------- (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: prime(0) -> false [1] prime(s(0)) -> false [1] prime(s(s(x))) -> prime1(s(s(x)), s(x)) [1] prime1(x, 0) -> false [1] prime1(x, s(0)) -> true [1] prime1(x, s(s(y))) -> and(not(divp(s(s(y)), x)), prime1(x, s(y))) [1] divp(x, y) -> =(rem(x, y), 0) [1] The TRS has the following type information: prime :: 0:s -> false:true:and 0 :: 0:s false :: false:true:and s :: 0:s -> 0:s prime1 :: 0:s -> 0:s -> false:true:and true :: false:true:and and :: not -> false:true:and -> false:true:and not :: = -> not divp :: 0:s -> 0:s -> = = :: rem -> 0:s -> = rem :: 0:s -> 0:s -> rem const :: not const1 :: = const2 :: rem 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: 0 => 0 false => 0 true => 1 const => 0 const1 => 0 const2 => 0 ---------------------------------------- (10) Obligation: Complexity RNTS consisting of the following rules: divp(z, z') -{ 1 }-> 1 + (1 + x + y) + 0 :|: x >= 0, y >= 0, z = x, z' = y prime(z) -{ 1 }-> prime1(1 + (1 + x), 1 + x) :|: x >= 0, z = 1 + (1 + x) prime(z) -{ 1 }-> 0 :|: z = 0 prime(z) -{ 1 }-> 0 :|: z = 1 + 0 prime1(z, z') -{ 1 }-> 1 :|: x >= 0, z' = 1 + 0, z = x prime1(z, z') -{ 1 }-> 0 :|: x >= 0, z = x, z' = 0 prime1(z, z') -{ 1 }-> 1 + (1 + divp(1 + (1 + y), x)) + prime1(x, 1 + y) :|: z' = 1 + (1 + y), x >= 0, y >= 0, z = x 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(V, V2),0,[prime(V, Out)],[V >= 0]). eq(start(V, V2),0,[prime1(V, V2, Out)],[V >= 0,V2 >= 0]). eq(start(V, V2),0,[divp(V, V2, Out)],[V >= 0,V2 >= 0]). eq(prime(V, Out),1,[],[Out = 0,V = 0]). eq(prime(V, Out),1,[],[Out = 0,V = 1]). eq(prime(V, Out),1,[prime1(1 + (1 + V1), 1 + V1, Ret)],[Out = Ret,V1 >= 0,V = 2 + V1]). eq(prime1(V, V2, Out),1,[],[Out = 0,V3 >= 0,V = V3,V2 = 0]). eq(prime1(V, V2, Out),1,[],[Out = 1,V4 >= 0,V2 = 1,V = V4]). eq(prime1(V, V2, Out),1,[divp(1 + (1 + V6), V5, Ret011),prime1(V5, 1 + V6, Ret1)],[Out = 2 + Ret011 + Ret1,V2 = 2 + V6,V5 >= 0,V6 >= 0,V = V5]). eq(divp(V, V2, Out),1,[],[Out = 2 + V7 + V8,V7 >= 0,V8 >= 0,V = V7,V2 = V8]). input_output_vars(prime(V,Out),[V],[Out]). input_output_vars(prime1(V,V2,Out),[V,V2],[Out]). input_output_vars(divp(V,V2,Out),[V,V2],[Out]). CoFloCo proof output: Preprocessing Cost Relations ===================================== #### Computed strongly connected components 0. non_recursive : [divp/3] 1. recursive : [prime1/3] 2. non_recursive : [prime/2] 3. non_recursive : [start/2] #### Obtained direct recursion through partial evaluation 0. SCC is completely evaluated into other SCCs 1. SCC is partially evaluated into prime1/3 2. SCC is partially evaluated into prime/2 3. SCC is partially evaluated into start/2 Control-Flow Refinement of Cost Relations ===================================== ### Specialization of cost equations prime1/3 * CE 9 is refined into CE [10] * CE 8 is refined into CE [11] * CE 7 is refined into CE [12] ### Cost equations --> "Loop" of prime1/3 * CEs [11] --> Loop 8 * CEs [12] --> Loop 9 * CEs [10] --> Loop 10 ### Ranking functions of CR prime1(V,V2,Out) * RF of phase [10]: [V2-1] #### Partial ranking functions of CR prime1(V,V2,Out) * Partial RF of phase [10]: - RF of loop [10:1]: V2-1 ### Specialization of cost equations prime/2 * CE 6 is refined into CE [13,14] * CE 5 is refined into CE [15] * CE 4 is refined into CE [16] ### Cost equations --> "Loop" of prime/2 * CEs [14] --> Loop 11 * CEs [13] --> Loop 12 * CEs [15] --> Loop 13 * CEs [16] --> Loop 14 ### Ranking functions of CR prime(V,Out) #### Partial ranking functions of CR prime(V,Out) ### Specialization of cost equations start/2 * CE 1 is refined into CE [17,18,19,20] * CE 2 is refined into CE [21,22,23] * CE 3 is refined into CE [24] ### Cost equations --> "Loop" of start/2 * CEs [20] --> Loop 15 * CEs [22] --> Loop 16 * CEs [21,23,24] --> Loop 17 * CEs [19] --> Loop 18 * CEs [18] --> Loop 19 * CEs [17] --> Loop 20 ### Ranking functions of CR start(V,V2) #### Partial ranking functions of CR start(V,V2) Computing Bounds ===================================== #### Cost of chains of prime1(V,V2,Out): * Chain [[10],8]: 2*it(10)+1 Such that:it(10) =< V2 with precondition: [V>=0,V2>=2,Out+7>=7*V2+V] * Chain [9]: 1 with precondition: [V2=0,Out=0,V>=0] * Chain [8]: 1 with precondition: [V2=1,Out=1,V>=0] #### Cost of chains of prime(V,Out): * Chain [14]: 1 with precondition: [V=0,Out=0] * Chain [13]: 1 with precondition: [V=1,Out=0] * Chain [12]: 2 with precondition: [V=2,Out=1] * Chain [11]: 2*s(1)+2 Such that:s(1) =< V with precondition: [V>=3,Out+14>=8*V] #### Cost of chains of start(V,V2): * Chain [20]: 1 with precondition: [V=0] * Chain [19]: 1 with precondition: [V=1] * Chain [18]: 2 with precondition: [V=2] * Chain [17]: 2*s(2)+1 Such that:s(2) =< V2 with precondition: [V>=0,V2>=0] * Chain [16]: 1 with precondition: [V2=1,V>=0] * Chain [15]: 2*s(3)+2 Such that:s(3) =< V with precondition: [V>=3] Closed-form bounds of start(V,V2): ------------------------------------- * Chain [20] with precondition: [V=0] - Upper bound: 1 - Complexity: constant * Chain [19] with precondition: [V=1] - Upper bound: 1 - Complexity: constant * Chain [18] with precondition: [V=2] - Upper bound: 2 - Complexity: constant * Chain [17] with precondition: [V>=0,V2>=0] - Upper bound: 2*V2+1 - Complexity: n * Chain [16] with precondition: [V2=1,V>=0] - Upper bound: 1 - Complexity: constant * Chain [15] with precondition: [V>=3] - Upper bound: 2*V+2 - Complexity: n ### Maximum cost of start(V,V2): max([2*V+1,nat(V2)*2])+1 Asymptotic class: n * Total analysis performed in 79 ms. ---------------------------------------- (12) BOUNDS(1, n^1) ---------------------------------------- (13) RenamingProof (BOTH BOUNDS(ID, ID)) Renamed function symbols to avoid clashes with predefined symbol. ---------------------------------------- (14) Obligation: The Runtime Complexity (full) of the given CpxTRS could be proven to be BOUNDS(n^1, INF). The TRS R consists of the following rules: prime(0') -> false prime(s(0')) -> false prime(s(s(x))) -> prime1(s(s(x)), s(x)) prime1(x, 0') -> false prime1(x, s(0')) -> true prime1(x, s(s(y))) -> and(not(divp(s(s(y)), x)), prime1(x, s(y))) divp(x, y) -> ='(rem(x, y), 0') S is empty. Rewrite Strategy: FULL ---------------------------------------- (15) SlicingProof (LOWER BOUND(ID)) Sliced the following arguments: prime1/0 divp/0 divp/1 ='/0 ='/1 rem/0 rem/1 ---------------------------------------- (16) Obligation: The Runtime Complexity (full) of the given CpxTRS could be proven to be BOUNDS(n^1, INF). The TRS R consists of the following rules: prime(0') -> false prime(s(0')) -> false prime(s(s(x))) -> prime1(s(x)) prime1(0') -> false prime1(s(0')) -> true prime1(s(s(y))) -> and(not(divp), prime1(s(y))) divp -> =' S is empty. Rewrite Strategy: FULL ---------------------------------------- (17) TypeInferenceProof (BOTH BOUNDS(ID, ID)) Infered types. ---------------------------------------- (18) Obligation: TRS: Rules: prime(0') -> false prime(s(0')) -> false prime(s(s(x))) -> prime1(s(x)) prime1(0') -> false prime1(s(0')) -> true prime1(s(s(y))) -> and(not(divp), prime1(s(y))) divp -> =' Types: prime :: 0':s -> false:true:and 0' :: 0':s false :: false:true:and s :: 0':s -> 0':s prime1 :: 0':s -> false:true:and true :: false:true:and and :: not -> false:true:and -> false:true:and not :: =' -> not divp :: =' =' :: =' hole_false:true:and1_0 :: false:true:and hole_0':s2_0 :: 0':s hole_not3_0 :: not hole_='4_0 :: =' gen_false:true:and5_0 :: Nat -> false:true:and gen_0':s6_0 :: Nat -> 0':s ---------------------------------------- (19) OrderProof (LOWER BOUND(ID)) Heuristically decided to analyse the following defined symbols: prime1 ---------------------------------------- (20) Obligation: TRS: Rules: prime(0') -> false prime(s(0')) -> false prime(s(s(x))) -> prime1(s(x)) prime1(0') -> false prime1(s(0')) -> true prime1(s(s(y))) -> and(not(divp), prime1(s(y))) divp -> =' Types: prime :: 0':s -> false:true:and 0' :: 0':s false :: false:true:and s :: 0':s -> 0':s prime1 :: 0':s -> false:true:and true :: false:true:and and :: not -> false:true:and -> false:true:and not :: =' -> not divp :: =' =' :: =' hole_false:true:and1_0 :: false:true:and hole_0':s2_0 :: 0':s hole_not3_0 :: not hole_='4_0 :: =' gen_false:true:and5_0 :: Nat -> false:true:and gen_0':s6_0 :: Nat -> 0':s Generator Equations: gen_false:true:and5_0(0) <=> false gen_false:true:and5_0(+(x, 1)) <=> and(not(='), gen_false:true:and5_0(x)) gen_0':s6_0(0) <=> 0' gen_0':s6_0(+(x, 1)) <=> s(gen_0':s6_0(x)) The following defined symbols remain to be analysed: prime1 ---------------------------------------- (21) RewriteLemmaProof (LOWER BOUND(ID)) Proved the following rewrite lemma: prime1(gen_0':s6_0(+(1, n8_0))) -> *7_0, rt in Omega(n8_0) Induction Base: prime1(gen_0':s6_0(+(1, 0))) Induction Step: prime1(gen_0':s6_0(+(1, +(n8_0, 1)))) ->_R^Omega(1) and(not(divp), prime1(s(gen_0':s6_0(n8_0)))) ->_R^Omega(1) and(not(='), prime1(s(gen_0':s6_0(n8_0)))) ->_IH and(not(='), *7_0) We have rt in Omega(n^1) and sz in O(n). Thus, we have irc_R in Omega(n). ---------------------------------------- (22) Obligation: Proved the lower bound n^1 for the following obligation: TRS: Rules: prime(0') -> false prime(s(0')) -> false prime(s(s(x))) -> prime1(s(x)) prime1(0') -> false prime1(s(0')) -> true prime1(s(s(y))) -> and(not(divp), prime1(s(y))) divp -> =' Types: prime :: 0':s -> false:true:and 0' :: 0':s false :: false:true:and s :: 0':s -> 0':s prime1 :: 0':s -> false:true:and true :: false:true:and and :: not -> false:true:and -> false:true:and not :: =' -> not divp :: =' =' :: =' hole_false:true:and1_0 :: false:true:and hole_0':s2_0 :: 0':s hole_not3_0 :: not hole_='4_0 :: =' gen_false:true:and5_0 :: Nat -> false:true:and gen_0':s6_0 :: Nat -> 0':s Generator Equations: gen_false:true:and5_0(0) <=> false gen_false:true:and5_0(+(x, 1)) <=> and(not(='), gen_false:true:and5_0(x)) gen_0':s6_0(0) <=> 0' gen_0':s6_0(+(x, 1)) <=> s(gen_0':s6_0(x)) The following defined symbols remain to be analysed: prime1 ---------------------------------------- (23) LowerBoundPropagationProof (FINISHED) Propagated lower bound. ---------------------------------------- (24) BOUNDS(n^1, INF)