/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 (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), 0 ms] (10) CpxRNTS (11) CompleteCoflocoProof [FINISHED, 272 ms] (12) BOUNDS(1, n^1) (13) RenamingProof [BOTH BOUNDS(ID, ID), 0 ms] (14) CpxTRS (15) TypeInferenceProof [BOTH BOUNDS(ID, ID), 0 ms] (16) typed CpxTrs (17) OrderProof [LOWER BOUND(ID), 0 ms] (18) typed CpxTrs (19) RewriteLemmaProof [LOWER BOUND(ID), 988 ms] (20) BEST (21) proven lower bound (22) LowerBoundPropagationProof [FINISHED, 0 ms] (23) BOUNDS(n^1, INF) (24) typed CpxTrs (25) RewriteLemmaProof [LOWER BOUND(ID), 4 ms] (26) BOUNDS(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: pred(s(x)) -> x minus(x, 0) -> x minus(x, s(y)) -> pred(minus(x, y)) quot(0, s(y)) -> 0 quot(s(x), s(y)) -> s(quot(minus(x, y), s(y))) S is empty. Rewrite Strategy: FULL ---------------------------------------- (1) RcToIrcProof (BOTH BOUNDS(ID, ID)) Converted rc-obligation to irc-obligation. The duplicating contexts are: quot(s(x), s([])) The defined contexts are: quot([], s(x1)) pred([]) minus([], 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^1). The TRS R consists of the following rules: pred(s(x)) -> x minus(x, 0) -> x minus(x, s(y)) -> pred(minus(x, y)) quot(0, s(y)) -> 0 quot(s(x), s(y)) -> s(quot(minus(x, y), s(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^1). The TRS R consists of the following rules: pred(s(x)) -> x [1] minus(x, 0) -> x [1] minus(x, s(y)) -> pred(minus(x, y)) [1] quot(0, s(y)) -> 0 [1] quot(s(x), s(y)) -> s(quot(minus(x, y), s(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: pred(s(x)) -> x [1] minus(x, 0) -> x [1] minus(x, s(y)) -> pred(minus(x, y)) [1] quot(0, s(y)) -> 0 [1] quot(s(x), s(y)) -> s(quot(minus(x, y), s(y))) [1] The TRS has the following type information: pred :: s:0 -> s:0 s :: s:0 -> s:0 minus :: s:0 -> s:0 -> s:0 0 :: s:0 quot :: s:0 -> s:0 -> s:0 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: pred(v0) -> null_pred [0] quot(v0, v1) -> null_quot [0] minus(v0, v1) -> null_minus [0] And the following fresh constants: null_pred, null_quot, null_minus ---------------------------------------- (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: pred(s(x)) -> x [1] minus(x, 0) -> x [1] minus(x, s(y)) -> pred(minus(x, y)) [1] quot(0, s(y)) -> 0 [1] quot(s(x), s(y)) -> s(quot(minus(x, y), s(y))) [1] pred(v0) -> null_pred [0] quot(v0, v1) -> null_quot [0] minus(v0, v1) -> null_minus [0] The TRS has the following type information: pred :: s:0:null_pred:null_quot:null_minus -> s:0:null_pred:null_quot:null_minus s :: s:0:null_pred:null_quot:null_minus -> s:0:null_pred:null_quot:null_minus minus :: s:0:null_pred:null_quot:null_minus -> s:0:null_pred:null_quot:null_minus -> s:0:null_pred:null_quot:null_minus 0 :: s:0:null_pred:null_quot:null_minus quot :: s:0:null_pred:null_quot:null_minus -> s:0:null_pred:null_quot:null_minus -> s:0:null_pred:null_quot:null_minus null_pred :: s:0:null_pred:null_quot:null_minus null_quot :: s:0:null_pred:null_quot:null_minus null_minus :: s:0:null_pred:null_quot:null_minus 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 null_pred => 0 null_quot => 0 null_minus => 0 ---------------------------------------- (10) Obligation: Complexity RNTS consisting of the following rules: minus(z, z') -{ 1 }-> x :|: x >= 0, z = x, z' = 0 minus(z, z') -{ 1 }-> pred(minus(x, y)) :|: z' = 1 + y, x >= 0, y >= 0, z = x minus(z, z') -{ 0 }-> 0 :|: v0 >= 0, v1 >= 0, z = v0, z' = v1 pred(z) -{ 1 }-> x :|: x >= 0, z = 1 + x pred(z) -{ 0 }-> 0 :|: v0 >= 0, z = v0 quot(z, z') -{ 1 }-> 0 :|: z' = 1 + y, y >= 0, z = 0 quot(z, z') -{ 0 }-> 0 :|: v0 >= 0, v1 >= 0, z = v0, z' = v1 quot(z, z') -{ 1 }-> 1 + quot(minus(x, y), 1 + y) :|: z' = 1 + y, x >= 0, y >= 0, z = 1 + 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,[pred(V, Out)],[V >= 0]). eq(start(V, V2),0,[minus(V, V2, Out)],[V >= 0,V2 >= 0]). eq(start(V, V2),0,[quot(V, V2, Out)],[V >= 0,V2 >= 0]). eq(pred(V, Out),1,[],[Out = V1,V1 >= 0,V = 1 + V1]). eq(minus(V, V2, Out),1,[],[Out = V3,V3 >= 0,V = V3,V2 = 0]). eq(minus(V, V2, Out),1,[minus(V4, V5, Ret0),pred(Ret0, Ret)],[Out = Ret,V2 = 1 + V5,V4 >= 0,V5 >= 0,V = V4]). eq(quot(V, V2, Out),1,[],[Out = 0,V2 = 1 + V6,V6 >= 0,V = 0]). eq(quot(V, V2, Out),1,[minus(V7, V8, Ret10),quot(Ret10, 1 + V8, Ret1)],[Out = 1 + Ret1,V2 = 1 + V8,V7 >= 0,V8 >= 0,V = 1 + V7]). eq(pred(V, Out),0,[],[Out = 0,V9 >= 0,V = V9]). eq(quot(V, V2, Out),0,[],[Out = 0,V11 >= 0,V10 >= 0,V = V11,V2 = V10]). eq(minus(V, V2, Out),0,[],[Out = 0,V13 >= 0,V12 >= 0,V = V13,V2 = V12]). input_output_vars(pred(V,Out),[V],[Out]). input_output_vars(minus(V,V2,Out),[V,V2],[Out]). input_output_vars(quot(V,V2,Out),[V,V2],[Out]). CoFloCo proof output: Preprocessing Cost Relations ===================================== #### Computed strongly connected components 0. non_recursive : [pred/2] 1. recursive [non_tail] : [minus/3] 2. recursive : [quot/3] 3. non_recursive : [start/2] #### Obtained direct recursion through partial evaluation 0. SCC is partially evaluated into pred/2 1. SCC is partially evaluated into minus/3 2. SCC is partially evaluated into quot/3 3. SCC is partially evaluated into start/2 Control-Flow Refinement of Cost Relations ===================================== ### Specialization of cost equations pred/2 * CE 4 is refined into CE [12] * CE 5 is refined into CE [13] ### Cost equations --> "Loop" of pred/2 * CEs [12] --> Loop 9 * CEs [13] --> Loop 10 ### Ranking functions of CR pred(V,Out) #### Partial ranking functions of CR pred(V,Out) ### Specialization of cost equations minus/3 * CE 8 is refined into CE [14] * CE 6 is refined into CE [15] * CE 7 is refined into CE [16,17] ### Cost equations --> "Loop" of minus/3 * CEs [17] --> Loop 11 * CEs [16] --> Loop 12 * CEs [14] --> Loop 13 * CEs [15] --> Loop 14 ### Ranking functions of CR minus(V,V2,Out) * RF of phase [11]: [V2] * RF of phase [12]: [V2] #### Partial ranking functions of CR minus(V,V2,Out) * Partial RF of phase [11]: - RF of loop [11:1]: V2 * Partial RF of phase [12]: - RF of loop [12:1]: V2 ### Specialization of cost equations quot/3 * CE 9 is refined into CE [18] * CE 11 is refined into CE [19] * CE 10 is refined into CE [20,21,22] ### Cost equations --> "Loop" of quot/3 * CEs [22] --> Loop 15 * CEs [21] --> Loop 16 * CEs [20] --> Loop 17 * CEs [18,19] --> Loop 18 ### Ranking functions of CR quot(V,V2,Out) * RF of phase [15]: [V-1,V-V2+1] * RF of phase [17]: [V] #### Partial ranking functions of CR quot(V,V2,Out) * Partial RF of phase [15]: - RF of loop [15:1]: V-1 V-V2+1 * Partial RF of phase [17]: - RF of loop [17:1]: V ### Specialization of cost equations start/2 * CE 1 is refined into CE [23,24] * CE 2 is refined into CE [25,26,27] * CE 3 is refined into CE [28,29,30,31,32] ### Cost equations --> "Loop" of start/2 * CEs [28] --> Loop 19 * CEs [23,24,25,26,27,29,30,31,32] --> Loop 20 ### Ranking functions of CR start(V,V2) #### Partial ranking functions of CR start(V,V2) Computing Bounds ===================================== #### Cost of chains of pred(V,Out): * Chain [10]: 0 with precondition: [Out=0,V>=0] * Chain [9]: 1 with precondition: [V=Out+1,V>=1] #### Cost of chains of minus(V,V2,Out): * Chain [[12],[11],14]: 3*it(11)+1 Such that:aux(1) =< V2 it(11) =< aux(1) with precondition: [Out=0,V>=1,V2>=2] * Chain [[12],14]: 1*it(12)+1 Such that:it(12) =< V2 with precondition: [Out=0,V>=0,V2>=1] * Chain [[12],13]: 1*it(12)+0 Such that:it(12) =< V2 with precondition: [Out=0,V>=0,V2>=1] * Chain [[11],14]: 2*it(11)+1 Such that:it(11) =< V2 with precondition: [V=Out+V2,V2>=1,V>=V2] * Chain [14]: 1 with precondition: [V2=0,V=Out,V>=0] * Chain [13]: 0 with precondition: [Out=0,V>=0,V2>=0] #### Cost of chains of quot(V,V2,Out): * Chain [[17],18]: 2*it(17)+1 Such that:it(17) =< Out with precondition: [V2=1,Out>=1,V>=Out] * Chain [[17],16,18]: 2*it(17)+5*s(6)+3 Such that:s(5) =< 1 it(17) =< Out s(6) =< s(5) with precondition: [V2=1,Out>=2,V>=Out] * Chain [[15],18]: 2*it(15)+2*s(9)+1 Such that:it(15) =< V-V2+1 aux(5) =< V it(15) =< aux(5) s(9) =< aux(5) with precondition: [V2>=2,Out>=1,V+2>=2*Out+V2] * Chain [[15],16,18]: 2*it(15)+5*s(6)+2*s(9)+3 Such that:it(15) =< V-V2+1 s(5) =< V2 aux(6) =< V s(6) =< s(5) it(15) =< aux(6) s(9) =< aux(6) with precondition: [V2>=2,Out>=2,V+3>=2*Out+V2] * Chain [18]: 1 with precondition: [Out=0,V>=0,V2>=0] * Chain [16,18]: 5*s(6)+3 Such that:s(5) =< V2 s(6) =< s(5) with precondition: [Out=1,V>=1,V2>=1] #### Cost of chains of start(V,V2): * Chain [20]: 17*s(15)+4*s(19)+4*s(21)+3 Such that:aux(8) =< V aux(9) =< V-V2+1 aux(10) =< V2 s(19) =< aux(9) s(15) =< aux(10) s(19) =< aux(8) s(21) =< aux(8) with precondition: [V>=0] * Chain [19]: 4*s(29)+5*s(30)+3 Such that:s(27) =< 1 s(28) =< V s(29) =< s(28) s(30) =< s(27) with precondition: [V2=1,V>=1] Closed-form bounds of start(V,V2): ------------------------------------- * Chain [20] with precondition: [V>=0] - Upper bound: 4*V+3+nat(V2)*17+nat(V-V2+1)*4 - Complexity: n * Chain [19] with precondition: [V2=1,V>=1] - Upper bound: 4*V+8 - Complexity: n ### Maximum cost of start(V,V2): 4*V+3+max([5,nat(V-V2+1)*4+nat(V2)*17]) Asymptotic class: n * Total analysis performed in 200 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: pred(s(x)) -> x minus(x, 0') -> x minus(x, s(y)) -> pred(minus(x, y)) quot(0', s(y)) -> 0' quot(s(x), s(y)) -> s(quot(minus(x, y), s(y))) S is empty. Rewrite Strategy: FULL ---------------------------------------- (15) TypeInferenceProof (BOTH BOUNDS(ID, ID)) Infered types. ---------------------------------------- (16) Obligation: TRS: Rules: pred(s(x)) -> x minus(x, 0') -> x minus(x, s(y)) -> pred(minus(x, y)) quot(0', s(y)) -> 0' quot(s(x), s(y)) -> s(quot(minus(x, y), s(y))) Types: pred :: s:0' -> s:0' s :: s:0' -> s:0' minus :: s:0' -> s:0' -> s:0' 0' :: s:0' quot :: s:0' -> s:0' -> s:0' hole_s:0'1_0 :: s:0' gen_s:0'2_0 :: Nat -> s:0' ---------------------------------------- (17) OrderProof (LOWER BOUND(ID)) Heuristically decided to analyse the following defined symbols: minus, quot They will be analysed ascendingly in the following order: minus < quot ---------------------------------------- (18) Obligation: TRS: Rules: pred(s(x)) -> x minus(x, 0') -> x minus(x, s(y)) -> pred(minus(x, y)) quot(0', s(y)) -> 0' quot(s(x), s(y)) -> s(quot(minus(x, y), s(y))) Types: pred :: s:0' -> s:0' s :: s:0' -> s:0' minus :: s:0' -> s:0' -> s:0' 0' :: s:0' quot :: s:0' -> s:0' -> s:0' hole_s:0'1_0 :: s:0' gen_s:0'2_0 :: Nat -> s:0' Generator Equations: gen_s:0'2_0(0) <=> 0' gen_s:0'2_0(+(x, 1)) <=> s(gen_s:0'2_0(x)) The following defined symbols remain to be analysed: minus, quot They will be analysed ascendingly in the following order: minus < quot ---------------------------------------- (19) RewriteLemmaProof (LOWER BOUND(ID)) Proved the following rewrite lemma: minus(gen_s:0'2_0(a), gen_s:0'2_0(+(1, n4_0))) -> *3_0, rt in Omega(n4_0) Induction Base: minus(gen_s:0'2_0(a), gen_s:0'2_0(+(1, 0))) Induction Step: minus(gen_s:0'2_0(a), gen_s:0'2_0(+(1, +(n4_0, 1)))) ->_R^Omega(1) pred(minus(gen_s:0'2_0(a), gen_s:0'2_0(+(1, n4_0)))) ->_IH pred(*3_0) We have rt in Omega(n^1) and sz in O(n). Thus, we have irc_R in Omega(n). ---------------------------------------- (20) Complex Obligation (BEST) ---------------------------------------- (21) Obligation: Proved the lower bound n^1 for the following obligation: TRS: Rules: pred(s(x)) -> x minus(x, 0') -> x minus(x, s(y)) -> pred(minus(x, y)) quot(0', s(y)) -> 0' quot(s(x), s(y)) -> s(quot(minus(x, y), s(y))) Types: pred :: s:0' -> s:0' s :: s:0' -> s:0' minus :: s:0' -> s:0' -> s:0' 0' :: s:0' quot :: s:0' -> s:0' -> s:0' hole_s:0'1_0 :: s:0' gen_s:0'2_0 :: Nat -> s:0' Generator Equations: gen_s:0'2_0(0) <=> 0' gen_s:0'2_0(+(x, 1)) <=> s(gen_s:0'2_0(x)) The following defined symbols remain to be analysed: minus, quot They will be analysed ascendingly in the following order: minus < quot ---------------------------------------- (22) LowerBoundPropagationProof (FINISHED) Propagated lower bound. ---------------------------------------- (23) BOUNDS(n^1, INF) ---------------------------------------- (24) Obligation: TRS: Rules: pred(s(x)) -> x minus(x, 0') -> x minus(x, s(y)) -> pred(minus(x, y)) quot(0', s(y)) -> 0' quot(s(x), s(y)) -> s(quot(minus(x, y), s(y))) Types: pred :: s:0' -> s:0' s :: s:0' -> s:0' minus :: s:0' -> s:0' -> s:0' 0' :: s:0' quot :: s:0' -> s:0' -> s:0' hole_s:0'1_0 :: s:0' gen_s:0'2_0 :: Nat -> s:0' Lemmas: minus(gen_s:0'2_0(a), gen_s:0'2_0(+(1, n4_0))) -> *3_0, rt in Omega(n4_0) Generator Equations: gen_s:0'2_0(0) <=> 0' gen_s:0'2_0(+(x, 1)) <=> s(gen_s:0'2_0(x)) The following defined symbols remain to be analysed: quot ---------------------------------------- (25) RewriteLemmaProof (LOWER BOUND(ID)) Proved the following rewrite lemma: quot(gen_s:0'2_0(n1821_0), gen_s:0'2_0(1)) -> gen_s:0'2_0(n1821_0), rt in Omega(1 + n1821_0) Induction Base: quot(gen_s:0'2_0(0), gen_s:0'2_0(1)) ->_R^Omega(1) 0' Induction Step: quot(gen_s:0'2_0(+(n1821_0, 1)), gen_s:0'2_0(1)) ->_R^Omega(1) s(quot(minus(gen_s:0'2_0(n1821_0), gen_s:0'2_0(0)), s(gen_s:0'2_0(0)))) ->_R^Omega(1) s(quot(gen_s:0'2_0(n1821_0), s(gen_s:0'2_0(0)))) ->_IH s(gen_s:0'2_0(c1822_0)) We have rt in Omega(n^1) and sz in O(n). Thus, we have irc_R in Omega(n). ---------------------------------------- (26) BOUNDS(1, INF)