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, 102 ms] (10) BOUNDS(1, n^1) (11) RenamingProof [BOTH BOUNDS(ID, ID), 0 ms] (12) CpxTRS (13) SlicingProof [LOWER BOUND(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), 198 ms] (20) proven lower bound (21) LowerBoundPropagationProof [FINISHED, 0 ms] (22) BOUNDS(n^1, INF) ---------------------------------------- (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: from(X) -> cons(X, n__from(s(X))) after(0, XS) -> XS after(s(N), cons(X, XS)) -> after(N, activate(XS)) from(X) -> n__from(X) activate(n__from(X)) -> from(X) activate(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^1). The TRS R consists of the following rules: from(X) -> cons(X, n__from(s(X))) [1] after(0, XS) -> XS [1] after(s(N), cons(X, XS)) -> after(N, activate(XS)) [1] from(X) -> n__from(X) [1] activate(n__from(X)) -> from(X) [1] activate(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: from(X) -> cons(X, n__from(s(X))) [1] after(0, XS) -> XS [1] after(s(N), cons(X, XS)) -> after(N, activate(XS)) [1] from(X) -> n__from(X) [1] activate(n__from(X)) -> from(X) [1] activate(X) -> X [1] The TRS has the following type information: from :: s:0 -> n__from:cons cons :: s:0 -> n__from:cons -> n__from:cons n__from :: s:0 -> n__from:cons s :: s:0 -> s:0 after :: s:0 -> n__from:cons -> n__from:cons 0 :: s:0 activate :: n__from:cons -> n__from:cons 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: after(v0, v1) -> null_after [0] And the following fresh constants: null_after ---------------------------------------- (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: from(X) -> cons(X, n__from(s(X))) [1] after(0, XS) -> XS [1] after(s(N), cons(X, XS)) -> after(N, activate(XS)) [1] from(X) -> n__from(X) [1] activate(n__from(X)) -> from(X) [1] activate(X) -> X [1] after(v0, v1) -> null_after [0] The TRS has the following type information: from :: s:0 -> n__from:cons:null_after cons :: s:0 -> n__from:cons:null_after -> n__from:cons:null_after n__from :: s:0 -> n__from:cons:null_after s :: s:0 -> s:0 after :: s:0 -> n__from:cons:null_after -> n__from:cons:null_after 0 :: s:0 activate :: n__from:cons:null_after -> n__from:cons:null_after null_after :: n__from:cons:null_after 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 null_after => 0 ---------------------------------------- (8) Obligation: Complexity RNTS consisting of the following rules: activate(z) -{ 1 }-> X :|: X >= 0, z = X activate(z) -{ 1 }-> from(X) :|: z = 1 + X, X >= 0 after(z, z') -{ 1 }-> XS :|: z' = XS, z = 0, XS >= 0 after(z, z') -{ 1 }-> after(N, activate(XS)) :|: z = 1 + N, z' = 1 + X + XS, X >= 0, XS >= 0, N >= 0 after(z, z') -{ 0 }-> 0 :|: v0 >= 0, v1 >= 0, z = v0, z' = v1 from(z) -{ 1 }-> 1 + X :|: X >= 0, z = X from(z) -{ 1 }-> 1 + X + (1 + (1 + X)) :|: 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, V1),0,[from(V, Out)],[V >= 0]). eq(start(V, V1),0,[after(V, V1, Out)],[V >= 0,V1 >= 0]). eq(start(V, V1),0,[activate(V, Out)],[V >= 0]). eq(from(V, Out),1,[],[Out = 3 + 2*X1,X1 >= 0,V = X1]). eq(after(V, V1, Out),1,[],[Out = XS1,V1 = XS1,V = 0,XS1 >= 0]). eq(after(V, V1, Out),1,[activate(XS2, Ret1),after(N1, Ret1, Ret)],[Out = Ret,V = 1 + N1,V1 = 1 + X2 + XS2,X2 >= 0,XS2 >= 0,N1 >= 0]). eq(from(V, Out),1,[],[Out = 1 + X3,X3 >= 0,V = X3]). eq(activate(V, Out),1,[from(X4, Ret2)],[Out = Ret2,V = 1 + X4,X4 >= 0]). eq(activate(V, Out),1,[],[Out = X5,X5 >= 0,V = X5]). eq(after(V, V1, Out),0,[],[Out = 0,V3 >= 0,V2 >= 0,V = V3,V1 = V2]). input_output_vars(from(V,Out),[V],[Out]). input_output_vars(after(V,V1,Out),[V,V1],[Out]). input_output_vars(activate(V,Out),[V],[Out]). CoFloCo proof output: Preprocessing Cost Relations ===================================== #### Computed strongly connected components 0. non_recursive : [from/2] 1. non_recursive : [activate/2] 2. recursive : [after/3] 3. non_recursive : [start/2] #### Obtained direct recursion through partial evaluation 0. SCC is partially evaluated into from/2 1. SCC is partially evaluated into activate/2 2. SCC is partially evaluated into after/3 3. SCC is partially evaluated into start/2 Control-Flow Refinement of Cost Relations ===================================== ### Specialization of cost equations from/2 * CE 4 is refined into CE [11] * CE 5 is refined into CE [12] ### Cost equations --> "Loop" of from/2 * CEs [11] --> Loop 9 * CEs [12] --> Loop 10 ### Ranking functions of CR from(V,Out) #### Partial ranking functions of CR from(V,Out) ### Specialization of cost equations activate/2 * CE 9 is refined into CE [13,14] * CE 10 is refined into CE [15] ### Cost equations --> "Loop" of activate/2 * CEs [14] --> Loop 11 * CEs [13,15] --> Loop 12 ### Ranking functions of CR activate(V,Out) #### Partial ranking functions of CR activate(V,Out) ### Specialization of cost equations after/3 * CE 8 is refined into CE [16] * CE 6 is refined into CE [17] * CE 7 is refined into CE [18,19] ### Cost equations --> "Loop" of after/3 * CEs [19] --> Loop 13 * CEs [18] --> Loop 14 * CEs [16] --> Loop 15 * CEs [17] --> Loop 16 ### Ranking functions of CR after(V,V1,Out) * RF of phase [13,14]: [V] #### Partial ranking functions of CR after(V,V1,Out) * Partial RF of phase [13,14]: - RF of loop [13:1,14:1]: V - RF of loop [14:1]: V1 depends on loops [13:1] ### Specialization of cost equations start/2 * CE 1 is refined into CE [20,21] * CE 2 is refined into CE [22,23,24] * CE 3 is refined into CE [25,26] ### Cost equations --> "Loop" of start/2 * CEs [20,21,22,23,24,25,26] --> Loop 17 ### Ranking functions of CR start(V,V1) #### Partial ranking functions of CR start(V,V1) Computing Bounds ===================================== #### Cost of chains of from(V,Out): * Chain [10]: 1 with precondition: [V+1=Out,V>=0] * Chain [9]: 1 with precondition: [2*V+3=Out,V>=0] #### Cost of chains of activate(V,Out): * Chain [12]: 2 with precondition: [V=Out,V>=0] * Chain [11]: 2 with precondition: [2*V+1=Out,V>=1] #### Cost of chains of after(V,V1,Out): * Chain [[13,14],16]: 6*it(13)+1 Such that:aux(9) =< V it(13) =< aux(9) with precondition: [V>=1,V1>=1,Out>=0] * Chain [[13,14],15]: 6*it(13)+0 Such that:aux(10) =< V it(13) =< aux(10) with precondition: [Out=0,V>=1,V1>=1] * Chain [16]: 1 with precondition: [V=0,V1=Out,V1>=0] * Chain [15]: 0 with precondition: [Out=0,V>=0,V1>=0] #### Cost of chains of start(V,V1): * Chain [17]: 12*s(4)+2 Such that:aux(11) =< V s(4) =< aux(11) with precondition: [V>=0] Closed-form bounds of start(V,V1): ------------------------------------- * Chain [17] with precondition: [V>=0] - Upper bound: 12*V+2 - Complexity: n ### Maximum cost of start(V,V1): 12*V+2 Asymptotic class: n * Total analysis performed in 106 ms. ---------------------------------------- (10) BOUNDS(1, n^1) ---------------------------------------- (11) RenamingProof (BOTH BOUNDS(ID, ID)) Renamed function symbols to avoid clashes with predefined symbol. ---------------------------------------- (12) Obligation: The Runtime Complexity (innermost) of the given CpxTRS could be proven to be BOUNDS(n^1, INF). The TRS R consists of the following rules: from(X) -> cons(X, n__from(s(X))) after(0', XS) -> XS after(s(N), cons(X, XS)) -> after(N, activate(XS)) from(X) -> n__from(X) activate(n__from(X)) -> from(X) activate(X) -> X S is empty. Rewrite Strategy: INNERMOST ---------------------------------------- (13) SlicingProof (LOWER BOUND(ID)) Sliced the following arguments: from/0 cons/0 n__from/0 ---------------------------------------- (14) Obligation: The Runtime Complexity (innermost) of the given CpxTRS could be proven to be BOUNDS(n^1, INF). The TRS R consists of the following rules: from -> cons(n__from) after(0', XS) -> XS after(s(N), cons(XS)) -> after(N, activate(XS)) from -> n__from activate(n__from) -> from activate(X) -> X S is empty. Rewrite Strategy: INNERMOST ---------------------------------------- (15) TypeInferenceProof (BOTH BOUNDS(ID, ID)) Infered types. ---------------------------------------- (16) Obligation: Innermost TRS: Rules: from -> cons(n__from) after(0', XS) -> XS after(s(N), cons(XS)) -> after(N, activate(XS)) from -> n__from activate(n__from) -> from activate(X) -> X Types: from :: n__from:cons cons :: n__from:cons -> n__from:cons n__from :: n__from:cons after :: 0':s -> n__from:cons -> n__from:cons 0' :: 0':s s :: 0':s -> 0':s activate :: n__from:cons -> n__from:cons hole_n__from:cons1_0 :: n__from:cons hole_0':s2_0 :: 0':s gen_n__from:cons3_0 :: Nat -> n__from:cons gen_0':s4_0 :: Nat -> 0':s ---------------------------------------- (17) OrderProof (LOWER BOUND(ID)) Heuristically decided to analyse the following defined symbols: after ---------------------------------------- (18) Obligation: Innermost TRS: Rules: from -> cons(n__from) after(0', XS) -> XS after(s(N), cons(XS)) -> after(N, activate(XS)) from -> n__from activate(n__from) -> from activate(X) -> X Types: from :: n__from:cons cons :: n__from:cons -> n__from:cons n__from :: n__from:cons after :: 0':s -> n__from:cons -> n__from:cons 0' :: 0':s s :: 0':s -> 0':s activate :: n__from:cons -> n__from:cons hole_n__from:cons1_0 :: n__from:cons hole_0':s2_0 :: 0':s gen_n__from:cons3_0 :: Nat -> n__from:cons gen_0':s4_0 :: Nat -> 0':s Generator Equations: gen_n__from:cons3_0(0) <=> n__from gen_n__from:cons3_0(+(x, 1)) <=> cons(gen_n__from:cons3_0(x)) gen_0':s4_0(0) <=> 0' gen_0':s4_0(+(x, 1)) <=> s(gen_0':s4_0(x)) The following defined symbols remain to be analysed: after ---------------------------------------- (19) RewriteLemmaProof (LOWER BOUND(ID)) Proved the following rewrite lemma: after(gen_0':s4_0(n6_0), gen_n__from:cons3_0(1)) -> gen_n__from:cons3_0(1), rt in Omega(1 + n6_0) Induction Base: after(gen_0':s4_0(0), gen_n__from:cons3_0(1)) ->_R^Omega(1) gen_n__from:cons3_0(1) Induction Step: after(gen_0':s4_0(+(n6_0, 1)), gen_n__from:cons3_0(1)) ->_R^Omega(1) after(gen_0':s4_0(n6_0), activate(gen_n__from:cons3_0(0))) ->_R^Omega(1) after(gen_0':s4_0(n6_0), from) ->_R^Omega(1) after(gen_0':s4_0(n6_0), cons(n__from)) ->_IH gen_n__from:cons3_0(1) We have rt in Omega(n^1) and sz in O(n). Thus, we have irc_R in Omega(n). ---------------------------------------- (20) Obligation: Proved the lower bound n^1 for the following obligation: Innermost TRS: Rules: from -> cons(n__from) after(0', XS) -> XS after(s(N), cons(XS)) -> after(N, activate(XS)) from -> n__from activate(n__from) -> from activate(X) -> X Types: from :: n__from:cons cons :: n__from:cons -> n__from:cons n__from :: n__from:cons after :: 0':s -> n__from:cons -> n__from:cons 0' :: 0':s s :: 0':s -> 0':s activate :: n__from:cons -> n__from:cons hole_n__from:cons1_0 :: n__from:cons hole_0':s2_0 :: 0':s gen_n__from:cons3_0 :: Nat -> n__from:cons gen_0':s4_0 :: Nat -> 0':s Generator Equations: gen_n__from:cons3_0(0) <=> n__from gen_n__from:cons3_0(+(x, 1)) <=> cons(gen_n__from:cons3_0(x)) gen_0':s4_0(0) <=> 0' gen_0':s4_0(+(x, 1)) <=> s(gen_0':s4_0(x)) The following defined symbols remain to be analysed: after ---------------------------------------- (21) LowerBoundPropagationProof (FINISHED) Propagated lower bound. ---------------------------------------- (22) BOUNDS(n^1, INF)