/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), 0 ms] (10) CpxRNTS (11) CompleteCoflocoProof [FINISHED, 293 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), 1070 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), 0 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: minus(X, 0) -> X minus(s(X), s(Y)) -> p(minus(X, Y)) p(s(X)) -> X div(0, s(Y)) -> 0 div(s(X), s(Y)) -> s(div(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: div(s(X), s([])) The defined contexts are: p([]) div([], s(x1)) 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: minus(X, 0) -> X minus(s(X), s(Y)) -> p(minus(X, Y)) p(s(X)) -> X div(0, s(Y)) -> 0 div(s(X), s(Y)) -> s(div(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: minus(X, 0) -> X [1] minus(s(X), s(Y)) -> p(minus(X, Y)) [1] p(s(X)) -> X [1] div(0, s(Y)) -> 0 [1] div(s(X), s(Y)) -> s(div(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: minus(X, 0) -> X [1] minus(s(X), s(Y)) -> p(minus(X, Y)) [1] p(s(X)) -> X [1] div(0, s(Y)) -> 0 [1] div(s(X), s(Y)) -> s(div(minus(X, Y), s(Y))) [1] The TRS has the following type information: minus :: 0:s -> 0:s -> 0:s 0 :: 0:s s :: 0:s -> 0:s p :: 0:s -> 0:s div :: 0:s -> 0:s -> 0:s 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: minus(v0, v1) -> null_minus [0] p(v0) -> null_p [0] div(v0, v1) -> null_div [0] And the following fresh constants: null_minus, null_p, null_div ---------------------------------------- (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: minus(X, 0) -> X [1] minus(s(X), s(Y)) -> p(minus(X, Y)) [1] p(s(X)) -> X [1] div(0, s(Y)) -> 0 [1] div(s(X), s(Y)) -> s(div(minus(X, Y), s(Y))) [1] minus(v0, v1) -> null_minus [0] p(v0) -> null_p [0] div(v0, v1) -> null_div [0] The TRS has the following type information: minus :: 0:s:null_minus:null_p:null_div -> 0:s:null_minus:null_p:null_div -> 0:s:null_minus:null_p:null_div 0 :: 0:s:null_minus:null_p:null_div s :: 0:s:null_minus:null_p:null_div -> 0:s:null_minus:null_p:null_div p :: 0:s:null_minus:null_p:null_div -> 0:s:null_minus:null_p:null_div div :: 0:s:null_minus:null_p:null_div -> 0:s:null_minus:null_p:null_div -> 0:s:null_minus:null_p:null_div null_minus :: 0:s:null_minus:null_p:null_div null_p :: 0:s:null_minus:null_p:null_div null_div :: 0:s:null_minus:null_p:null_div 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_minus => 0 null_p => 0 null_div => 0 ---------------------------------------- (10) Obligation: Complexity RNTS consisting of the following rules: 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 div(z, z') -{ 1 }-> 1 + div(minus(X, Y), 1 + Y) :|: z = 1 + X, Y >= 0, z' = 1 + Y, X >= 0 minus(z, z') -{ 1 }-> X :|: X >= 0, z = X, z' = 0 minus(z, z') -{ 1 }-> p(minus(X, Y)) :|: z = 1 + X, Y >= 0, z' = 1 + Y, X >= 0 minus(z, z') -{ 0 }-> 0 :|: v0 >= 0, v1 >= 0, z = v0, z' = v1 p(z) -{ 1 }-> X :|: z = 1 + X, X >= 0 p(z) -{ 0 }-> 0 :|: v0 >= 0, z = v0 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(V1, V),0,[minus(V1, V, Out)],[V1 >= 0,V >= 0]). eq(start(V1, V),0,[p(V1, Out)],[V1 >= 0]). eq(start(V1, V),0,[div(V1, V, Out)],[V1 >= 0,V >= 0]). eq(minus(V1, V, Out),1,[],[Out = X1,X1 >= 0,V1 = X1,V = 0]). eq(minus(V1, V, Out),1,[minus(X2, Y1, Ret0),p(Ret0, Ret)],[Out = Ret,V1 = 1 + X2,Y1 >= 0,V = 1 + Y1,X2 >= 0]). eq(p(V1, Out),1,[],[Out = X3,V1 = 1 + X3,X3 >= 0]). eq(div(V1, V, Out),1,[],[Out = 0,Y2 >= 0,V = 1 + Y2,V1 = 0]). eq(div(V1, V, Out),1,[minus(X4, Y3, Ret10),div(Ret10, 1 + Y3, Ret1)],[Out = 1 + Ret1,V1 = 1 + X4,Y3 >= 0,V = 1 + Y3,X4 >= 0]). eq(minus(V1, V, Out),0,[],[Out = 0,V3 >= 0,V2 >= 0,V1 = V3,V = V2]). eq(p(V1, Out),0,[],[Out = 0,V4 >= 0,V1 = V4]). eq(div(V1, V, Out),0,[],[Out = 0,V6 >= 0,V5 >= 0,V1 = V6,V = V5]). input_output_vars(minus(V1,V,Out),[V1,V],[Out]). input_output_vars(p(V1,Out),[V1],[Out]). input_output_vars(div(V1,V,Out),[V1,V],[Out]). CoFloCo proof output: Preprocessing Cost Relations ===================================== #### Computed strongly connected components 0. non_recursive : [p/2] 1. recursive [non_tail] : [minus/3] 2. recursive : [(div)/3] 3. non_recursive : [start/2] #### Obtained direct recursion through partial evaluation 0. SCC is partially evaluated into p/2 1. SCC is partially evaluated into minus/3 2. SCC is partially evaluated into (div)/3 3. SCC is partially evaluated into start/2 Control-Flow Refinement of Cost Relations ===================================== ### Specialization of cost equations p/2 * CE 7 is refined into CE [12] * CE 8 is refined into CE [13] ### Cost equations --> "Loop" of p/2 * CEs [12] --> Loop 9 * CEs [13] --> Loop 10 ### Ranking functions of CR p(V1,Out) #### Partial ranking functions of CR p(V1,Out) ### Specialization of cost equations minus/3 * CE 6 is refined into CE [14] * CE 4 is refined into CE [15] * CE 5 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(V1,V,Out) * RF of phase [11]: [V,V1] * RF of phase [12]: [V,V1] #### Partial ranking functions of CR minus(V1,V,Out) * Partial RF of phase [11]: - RF of loop [11:1]: V V1 * Partial RF of phase [12]: - RF of loop [12:1]: V V1 ### Specialization of cost equations (div)/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 (div)/3 * CEs [22] --> Loop 15 * CEs [21] --> Loop 16 * CEs [20] --> Loop 17 * CEs [18,19] --> Loop 18 ### Ranking functions of CR div(V1,V,Out) * RF of phase [15]: [V1/3-2/3,V1/3-2/3*V+2/3] * RF of phase [17]: [V1] #### Partial ranking functions of CR div(V1,V,Out) * Partial RF of phase [15]: - RF of loop [15:1]: V1/3-2/3 V1/3-2/3*V+2/3 * Partial RF of phase [17]: - RF of loop [17:1]: V1 ### Specialization of cost equations start/2 * CE 1 is refined into CE [23,24,25] * CE 2 is refined into CE [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(V1,V) #### Partial ranking functions of CR start(V1,V) Computing Bounds ===================================== #### Cost of chains of p(V1,Out): * Chain [10]: 0 with precondition: [Out=0,V1>=0] * Chain [9]: 1 with precondition: [V1=Out+1,V1>=1] #### Cost of chains of minus(V1,V,Out): * Chain [[12],[11],14]: 3*it(11)+1 Such that:aux(1) =< V it(11) =< aux(1) with precondition: [Out=0,V>=2,V1>=V+1] * Chain [[12],14]: 1*it(12)+1 Such that:it(12) =< V with precondition: [Out=0,V>=1,V1>=V] * Chain [[12],13]: 1*it(12)+0 Such that:it(12) =< V with precondition: [Out=0,V1>=1,V>=1] * Chain [[11],14]: 2*it(11)+1 Such that:it(11) =< V with precondition: [V1=2*V+Out,V>=1,V1>=2*V] * Chain [14]: 1 with precondition: [V=0,V1=Out,V1>=0] * Chain [13]: 0 with precondition: [Out=0,V1>=0,V>=0] #### Cost of chains of div(V1,V,Out): * Chain [[17],18]: 2*it(17)+1 Such that:it(17) =< Out with precondition: [V=1,Out>=1,V1>=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: [V=1,Out>=2,V1>=Out] * Chain [[15],18]: 2*it(15)+2*s(9)+1 Such that:it(15) =< V1/3-2/3*V+2/3 s(9) =< 2/3*V1-V/3+2/3 with precondition: [V>=2,Out>=1,V1+4>=3*Out+2*V] * Chain [[15],16,18]: 2*it(15)+5*s(6)+2*s(9)+3 Such that:it(15) =< V1/3-2/3*V+2/3 s(9) =< 2/3*V1 s(5) =< V s(6) =< s(5) with precondition: [V>=2,Out>=2,V1+6>=3*Out+2*V] * Chain [18]: 1 with precondition: [Out=0,V1>=0,V>=0] * Chain [16,18]: 5*s(6)+3 Such that:s(5) =< V s(6) =< s(5) with precondition: [Out=1,V1>=1,V>=1] #### Cost of chains of start(V1,V): * Chain [20]: 17*s(15)+4*s(19)+2*s(20)+2*s(22)+3 Such that:s(22) =< 2/3*V1 s(20) =< 2/3*V1-V/3+2/3 aux(4) =< V1/3-2/3*V+2/3 aux(5) =< V s(19) =< aux(4) s(15) =< aux(5) with precondition: [V1>=0] * Chain [19]: 4*s(27)+5*s(28)+3 Such that:s(25) =< 1 s(26) =< V1 s(27) =< s(26) s(28) =< s(25) with precondition: [V=1,V1>=1] Closed-form bounds of start(V1,V): ------------------------------------- * Chain [20] with precondition: [V1>=0] - Upper bound: nat(V)*17+3+4/3*V1+nat(2/3*V1-V/3+2/3)*2+nat(V1/3-2/3*V+2/3)*4 - Complexity: n * Chain [19] with precondition: [V=1,V1>=1] - Upper bound: 4*V1+8 - Complexity: n ### Maximum cost of start(V1,V): max([4*V1+5,4/3*V1+nat(V)*17+nat(2/3*V1-V/3+2/3)*2+nat(V1/3-2/3*V+2/3)*4])+3 Asymptotic class: n * Total analysis performed in 217 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: minus(X, 0') -> X minus(s(X), s(Y)) -> p(minus(X, Y)) p(s(X)) -> X div(0', s(Y)) -> 0' div(s(X), s(Y)) -> s(div(minus(X, Y), s(Y))) S is empty. Rewrite Strategy: FULL ---------------------------------------- (15) TypeInferenceProof (BOTH BOUNDS(ID, ID)) Infered types. ---------------------------------------- (16) Obligation: TRS: Rules: minus(X, 0') -> X minus(s(X), s(Y)) -> p(minus(X, Y)) p(s(X)) -> X div(0', s(Y)) -> 0' div(s(X), s(Y)) -> s(div(minus(X, Y), s(Y))) Types: minus :: 0':s -> 0':s -> 0':s 0' :: 0':s s :: 0':s -> 0':s p :: 0':s -> 0':s div :: 0':s -> 0':s -> 0':s hole_0':s1_0 :: 0':s gen_0':s2_0 :: Nat -> 0':s ---------------------------------------- (17) OrderProof (LOWER BOUND(ID)) Heuristically decided to analyse the following defined symbols: minus, div They will be analysed ascendingly in the following order: minus < div ---------------------------------------- (18) Obligation: TRS: Rules: minus(X, 0') -> X minus(s(X), s(Y)) -> p(minus(X, Y)) p(s(X)) -> X div(0', s(Y)) -> 0' div(s(X), s(Y)) -> s(div(minus(X, Y), s(Y))) Types: minus :: 0':s -> 0':s -> 0':s 0' :: 0':s s :: 0':s -> 0':s p :: 0':s -> 0':s div :: 0':s -> 0':s -> 0':s hole_0':s1_0 :: 0':s gen_0':s2_0 :: Nat -> 0':s Generator Equations: gen_0':s2_0(0) <=> 0' gen_0':s2_0(+(x, 1)) <=> s(gen_0':s2_0(x)) The following defined symbols remain to be analysed: minus, div They will be analysed ascendingly in the following order: minus < div ---------------------------------------- (19) RewriteLemmaProof (LOWER BOUND(ID)) Proved the following rewrite lemma: minus(gen_0':s2_0(+(1, n4_0)), gen_0':s2_0(+(1, n4_0))) -> *3_0, rt in Omega(n4_0) Induction Base: minus(gen_0':s2_0(+(1, 0)), gen_0':s2_0(+(1, 0))) Induction Step: minus(gen_0':s2_0(+(1, +(n4_0, 1))), gen_0':s2_0(+(1, +(n4_0, 1)))) ->_R^Omega(1) p(minus(gen_0':s2_0(+(1, n4_0)), gen_0':s2_0(+(1, n4_0)))) ->_IH p(*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: minus(X, 0') -> X minus(s(X), s(Y)) -> p(minus(X, Y)) p(s(X)) -> X div(0', s(Y)) -> 0' div(s(X), s(Y)) -> s(div(minus(X, Y), s(Y))) Types: minus :: 0':s -> 0':s -> 0':s 0' :: 0':s s :: 0':s -> 0':s p :: 0':s -> 0':s div :: 0':s -> 0':s -> 0':s hole_0':s1_0 :: 0':s gen_0':s2_0 :: Nat -> 0':s Generator Equations: gen_0':s2_0(0) <=> 0' gen_0':s2_0(+(x, 1)) <=> s(gen_0':s2_0(x)) The following defined symbols remain to be analysed: minus, div They will be analysed ascendingly in the following order: minus < div ---------------------------------------- (22) LowerBoundPropagationProof (FINISHED) Propagated lower bound. ---------------------------------------- (23) BOUNDS(n^1, INF) ---------------------------------------- (24) Obligation: TRS: Rules: minus(X, 0') -> X minus(s(X), s(Y)) -> p(minus(X, Y)) p(s(X)) -> X div(0', s(Y)) -> 0' div(s(X), s(Y)) -> s(div(minus(X, Y), s(Y))) Types: minus :: 0':s -> 0':s -> 0':s 0' :: 0':s s :: 0':s -> 0':s p :: 0':s -> 0':s div :: 0':s -> 0':s -> 0':s hole_0':s1_0 :: 0':s gen_0':s2_0 :: Nat -> 0':s Lemmas: minus(gen_0':s2_0(+(1, n4_0)), gen_0':s2_0(+(1, n4_0))) -> *3_0, rt in Omega(n4_0) Generator Equations: gen_0':s2_0(0) <=> 0' gen_0':s2_0(+(x, 1)) <=> s(gen_0':s2_0(x)) The following defined symbols remain to be analysed: div ---------------------------------------- (25) RewriteLemmaProof (LOWER BOUND(ID)) Proved the following rewrite lemma: div(gen_0':s2_0(n1747_0), gen_0':s2_0(1)) -> gen_0':s2_0(n1747_0), rt in Omega(1 + n1747_0) Induction Base: div(gen_0':s2_0(0), gen_0':s2_0(1)) ->_R^Omega(1) 0' Induction Step: div(gen_0':s2_0(+(n1747_0, 1)), gen_0':s2_0(1)) ->_R^Omega(1) s(div(minus(gen_0':s2_0(n1747_0), gen_0':s2_0(0)), s(gen_0':s2_0(0)))) ->_R^Omega(1) s(div(gen_0':s2_0(n1747_0), s(gen_0':s2_0(0)))) ->_IH s(gen_0':s2_0(c1748_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)