/export/starexec/sandbox2/solver/bin/starexec_run_complexity /export/starexec/sandbox2/benchmark/theBenchmark.xml /export/starexec/sandbox2/output/output_files -------------------------------------------------------------------------------- WORST_CASE(Omega(n^2), 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^2, 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, 167 ms] (10) BOUNDS(1, n^2) (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), 312 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), 49 ms] (26) proven lower bound (27) LowerBoundPropagationProof [FINISHED, 0 ms] (28) BOUNDS(n^2, INF) ---------------------------------------- (0) Obligation: The Runtime Complexity (innermost) of the given CpxTRS could be proven to be BOUNDS(n^2, n^2). The TRS R consists of the following rules: naiverev(Cons(x, xs)) -> app(naiverev(xs), Cons(x, Nil)) app(Cons(x, xs), ys) -> Cons(x, app(xs, ys)) notEmpty(Cons(x, xs)) -> True notEmpty(Nil) -> False naiverev(Nil) -> Nil app(Nil, ys) -> ys goal(xs) -> naiverev(xs) 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: naiverev(Cons(x, xs)) -> app(naiverev(xs), Cons(x, Nil)) [1] app(Cons(x, xs), ys) -> Cons(x, app(xs, ys)) [1] notEmpty(Cons(x, xs)) -> True [1] notEmpty(Nil) -> False [1] naiverev(Nil) -> Nil [1] app(Nil, ys) -> ys [1] goal(xs) -> naiverev(xs) [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: naiverev(Cons(x, xs)) -> app(naiverev(xs), Cons(x, Nil)) [1] app(Cons(x, xs), ys) -> Cons(x, app(xs, ys)) [1] notEmpty(Cons(x, xs)) -> True [1] notEmpty(Nil) -> False [1] naiverev(Nil) -> Nil [1] app(Nil, ys) -> ys [1] goal(xs) -> naiverev(xs) [1] The TRS has the following type information: naiverev :: Cons:Nil -> Cons:Nil Cons :: a -> Cons:Nil -> Cons:Nil app :: Cons:Nil -> Cons:Nil -> Cons:Nil Nil :: Cons:Nil notEmpty :: Cons:Nil -> True:False True :: True:False False :: True:False goal :: Cons:Nil -> Cons:Nil 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: none And the following fresh constants: const ---------------------------------------- (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: naiverev(Cons(x, xs)) -> app(naiverev(xs), Cons(x, Nil)) [1] app(Cons(x, xs), ys) -> Cons(x, app(xs, ys)) [1] notEmpty(Cons(x, xs)) -> True [1] notEmpty(Nil) -> False [1] naiverev(Nil) -> Nil [1] app(Nil, ys) -> ys [1] goal(xs) -> naiverev(xs) [1] The TRS has the following type information: naiverev :: Cons:Nil -> Cons:Nil Cons :: a -> Cons:Nil -> Cons:Nil app :: Cons:Nil -> Cons:Nil -> Cons:Nil Nil :: Cons:Nil notEmpty :: Cons:Nil -> True:False True :: True:False False :: True:False goal :: Cons:Nil -> Cons:Nil const :: a 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: Nil => 0 True => 1 False => 0 const => 0 ---------------------------------------- (8) Obligation: Complexity RNTS consisting of the following rules: app(z, z') -{ 1 }-> ys :|: z' = ys, ys >= 0, z = 0 app(z, z') -{ 1 }-> 1 + x + app(xs, ys) :|: z = 1 + x + xs, xs >= 0, z' = ys, ys >= 0, x >= 0 goal(z) -{ 1 }-> naiverev(xs) :|: xs >= 0, z = xs naiverev(z) -{ 1 }-> app(naiverev(xs), 1 + x + 0) :|: z = 1 + x + xs, xs >= 0, x >= 0 naiverev(z) -{ 1 }-> 0 :|: z = 0 notEmpty(z) -{ 1 }-> 1 :|: z = 1 + x + xs, xs >= 0, x >= 0 notEmpty(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(V, V3),0,[naiverev(V, Out)],[V >= 0]). eq(start(V, V3),0,[app(V, V3, Out)],[V >= 0,V3 >= 0]). eq(start(V, V3),0,[notEmpty(V, Out)],[V >= 0]). eq(start(V, V3),0,[goal(V, Out)],[V >= 0]). eq(naiverev(V, Out),1,[naiverev(V1, Ret0),app(Ret0, 1 + V2 + 0, Ret)],[Out = Ret,V = 1 + V1 + V2,V1 >= 0,V2 >= 0]). eq(app(V, V3, Out),1,[app(V5, V6, Ret1)],[Out = 1 + Ret1 + V4,V = 1 + V4 + V5,V5 >= 0,V3 = V6,V6 >= 0,V4 >= 0]). eq(notEmpty(V, Out),1,[],[Out = 1,V = 1 + V7 + V8,V8 >= 0,V7 >= 0]). eq(notEmpty(V, Out),1,[],[Out = 0,V = 0]). eq(naiverev(V, Out),1,[],[Out = 0,V = 0]). eq(app(V, V3, Out),1,[],[Out = V9,V3 = V9,V9 >= 0,V = 0]). eq(goal(V, Out),1,[naiverev(V10, Ret2)],[Out = Ret2,V10 >= 0,V = V10]). input_output_vars(naiverev(V,Out),[V],[Out]). input_output_vars(app(V,V3,Out),[V,V3],[Out]). input_output_vars(notEmpty(V,Out),[V],[Out]). input_output_vars(goal(V,Out),[V],[Out]). CoFloCo proof output: Preprocessing Cost Relations ===================================== #### Computed strongly connected components 0. recursive : [app/3] 1. recursive [non_tail] : [naiverev/2] 2. non_recursive : [goal/2] 3. non_recursive : [notEmpty/2] 4. non_recursive : [start/2] #### Obtained direct recursion through partial evaluation 0. SCC is partially evaluated into app/3 1. SCC is partially evaluated into naiverev/2 2. SCC is completely evaluated into other SCCs 3. SCC is partially evaluated into notEmpty/2 4. SCC is partially evaluated into start/2 Control-Flow Refinement of Cost Relations ===================================== ### Specialization of cost equations app/3 * CE 8 is refined into CE [11] * CE 7 is refined into CE [12] ### Cost equations --> "Loop" of app/3 * CEs [12] --> Loop 8 * CEs [11] --> Loop 9 ### Ranking functions of CR app(V,V3,Out) * RF of phase [8]: [V] #### Partial ranking functions of CR app(V,V3,Out) * Partial RF of phase [8]: - RF of loop [8:1]: V ### Specialization of cost equations naiverev/2 * CE 6 is refined into CE [13] * CE 5 is refined into CE [14,15] ### Cost equations --> "Loop" of naiverev/2 * CEs [15] --> Loop 10 * CEs [14] --> Loop 11 * CEs [13] --> Loop 12 ### Ranking functions of CR naiverev(V,Out) * RF of phase [10]: [V] #### Partial ranking functions of CR naiverev(V,Out) * Partial RF of phase [10]: - RF of loop [10:1]: V ### Specialization of cost equations notEmpty/2 * CE 9 is refined into CE [16] * CE 10 is refined into CE [17] ### Cost equations --> "Loop" of notEmpty/2 * CEs [16] --> Loop 13 * CEs [17] --> Loop 14 ### Ranking functions of CR notEmpty(V,Out) #### Partial ranking functions of CR notEmpty(V,Out) ### Specialization of cost equations start/2 * CE 1 is refined into CE [18,19] * CE 2 is refined into CE [20,21] * CE 3 is refined into CE [22,23] * CE 4 is refined into CE [24,25] ### Cost equations --> "Loop" of start/2 * CEs [19,21,23,25] --> Loop 15 * CEs [18,20,22,24] --> Loop 16 ### Ranking functions of CR start(V,V3) #### Partial ranking functions of CR start(V,V3) Computing Bounds ===================================== #### Cost of chains of app(V,V3,Out): * Chain [[8],9]: 1*it(8)+1 Such that:it(8) =< -V3+Out with precondition: [V+V3=Out,V>=1,V3>=0] * Chain [9]: 1 with precondition: [V=0,V3=Out,V3>=0] #### Cost of chains of naiverev(V,Out): * Chain [[10],11,12]: 2*it(10)+1*s(3)+3 Such that:aux(3) =< Out it(10) =< aux(3) s(3) =< it(10)*aux(3) with precondition: [Out=V,Out>=2] * Chain [12]: 1 with precondition: [V=0,Out=0] * Chain [11,12]: 3 with precondition: [V=Out,V>=1] #### Cost of chains of notEmpty(V,Out): * Chain [14]: 1 with precondition: [V=0,Out=0] * Chain [13]: 1 with precondition: [Out=1,V>=1] #### Cost of chains of start(V,V3): * Chain [16]: 2 with precondition: [V=0] * Chain [15]: 5*s(8)+2*s(9)+4 Such that:aux(4) =< V s(8) =< aux(4) s(9) =< s(8)*aux(4) with precondition: [V>=1] Closed-form bounds of start(V,V3): ------------------------------------- * Chain [16] with precondition: [V=0] - Upper bound: 2 - Complexity: constant * Chain [15] with precondition: [V>=1] - Upper bound: 5*V+4+2*V*V - Complexity: n^2 ### Maximum cost of start(V,V3): 5*V+2+2*V*V+2 Asymptotic class: n^2 * Total analysis performed in 100 ms. ---------------------------------------- (10) BOUNDS(1, n^2) ---------------------------------------- (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^2, INF). The TRS R consists of the following rules: naiverev(Cons(x, xs)) -> app(naiverev(xs), Cons(x, Nil)) app(Cons(x, xs), ys) -> Cons(x, app(xs, ys)) notEmpty(Cons(x, xs)) -> True notEmpty(Nil) -> False naiverev(Nil) -> Nil app(Nil, ys) -> ys goal(xs) -> naiverev(xs) S is empty. Rewrite Strategy: INNERMOST ---------------------------------------- (13) SlicingProof (LOWER BOUND(ID)) Sliced the following arguments: Cons/0 ---------------------------------------- (14) Obligation: The Runtime Complexity (innermost) of the given CpxTRS could be proven to be BOUNDS(n^2, INF). The TRS R consists of the following rules: naiverev(Cons(xs)) -> app(naiverev(xs), Cons(Nil)) app(Cons(xs), ys) -> Cons(app(xs, ys)) notEmpty(Cons(xs)) -> True notEmpty(Nil) -> False naiverev(Nil) -> Nil app(Nil, ys) -> ys goal(xs) -> naiverev(xs) S is empty. Rewrite Strategy: INNERMOST ---------------------------------------- (15) TypeInferenceProof (BOTH BOUNDS(ID, ID)) Infered types. ---------------------------------------- (16) Obligation: Innermost TRS: Rules: naiverev(Cons(xs)) -> app(naiverev(xs), Cons(Nil)) app(Cons(xs), ys) -> Cons(app(xs, ys)) notEmpty(Cons(xs)) -> True notEmpty(Nil) -> False naiverev(Nil) -> Nil app(Nil, ys) -> ys goal(xs) -> naiverev(xs) Types: naiverev :: Cons:Nil -> Cons:Nil Cons :: Cons:Nil -> Cons:Nil app :: Cons:Nil -> Cons:Nil -> Cons:Nil Nil :: Cons:Nil notEmpty :: Cons:Nil -> True:False True :: True:False False :: True:False goal :: Cons:Nil -> Cons:Nil hole_Cons:Nil1_0 :: Cons:Nil hole_True:False2_0 :: True:False gen_Cons:Nil3_0 :: Nat -> Cons:Nil ---------------------------------------- (17) OrderProof (LOWER BOUND(ID)) Heuristically decided to analyse the following defined symbols: naiverev, app They will be analysed ascendingly in the following order: app < naiverev ---------------------------------------- (18) Obligation: Innermost TRS: Rules: naiverev(Cons(xs)) -> app(naiverev(xs), Cons(Nil)) app(Cons(xs), ys) -> Cons(app(xs, ys)) notEmpty(Cons(xs)) -> True notEmpty(Nil) -> False naiverev(Nil) -> Nil app(Nil, ys) -> ys goal(xs) -> naiverev(xs) Types: naiverev :: Cons:Nil -> Cons:Nil Cons :: Cons:Nil -> Cons:Nil app :: Cons:Nil -> Cons:Nil -> Cons:Nil Nil :: Cons:Nil notEmpty :: Cons:Nil -> True:False True :: True:False False :: True:False goal :: Cons:Nil -> Cons:Nil hole_Cons:Nil1_0 :: Cons:Nil hole_True:False2_0 :: True:False gen_Cons:Nil3_0 :: Nat -> Cons:Nil Generator Equations: gen_Cons:Nil3_0(0) <=> Nil gen_Cons:Nil3_0(+(x, 1)) <=> Cons(gen_Cons:Nil3_0(x)) The following defined symbols remain to be analysed: app, naiverev They will be analysed ascendingly in the following order: app < naiverev ---------------------------------------- (19) RewriteLemmaProof (LOWER BOUND(ID)) Proved the following rewrite lemma: app(gen_Cons:Nil3_0(n5_0), gen_Cons:Nil3_0(b)) -> gen_Cons:Nil3_0(+(n5_0, b)), rt in Omega(1 + n5_0) Induction Base: app(gen_Cons:Nil3_0(0), gen_Cons:Nil3_0(b)) ->_R^Omega(1) gen_Cons:Nil3_0(b) Induction Step: app(gen_Cons:Nil3_0(+(n5_0, 1)), gen_Cons:Nil3_0(b)) ->_R^Omega(1) Cons(app(gen_Cons:Nil3_0(n5_0), gen_Cons:Nil3_0(b))) ->_IH Cons(gen_Cons:Nil3_0(+(b, c6_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: Innermost TRS: Rules: naiverev(Cons(xs)) -> app(naiverev(xs), Cons(Nil)) app(Cons(xs), ys) -> Cons(app(xs, ys)) notEmpty(Cons(xs)) -> True notEmpty(Nil) -> False naiverev(Nil) -> Nil app(Nil, ys) -> ys goal(xs) -> naiverev(xs) Types: naiverev :: Cons:Nil -> Cons:Nil Cons :: Cons:Nil -> Cons:Nil app :: Cons:Nil -> Cons:Nil -> Cons:Nil Nil :: Cons:Nil notEmpty :: Cons:Nil -> True:False True :: True:False False :: True:False goal :: Cons:Nil -> Cons:Nil hole_Cons:Nil1_0 :: Cons:Nil hole_True:False2_0 :: True:False gen_Cons:Nil3_0 :: Nat -> Cons:Nil Generator Equations: gen_Cons:Nil3_0(0) <=> Nil gen_Cons:Nil3_0(+(x, 1)) <=> Cons(gen_Cons:Nil3_0(x)) The following defined symbols remain to be analysed: app, naiverev They will be analysed ascendingly in the following order: app < naiverev ---------------------------------------- (22) LowerBoundPropagationProof (FINISHED) Propagated lower bound. ---------------------------------------- (23) BOUNDS(n^1, INF) ---------------------------------------- (24) Obligation: Innermost TRS: Rules: naiverev(Cons(xs)) -> app(naiverev(xs), Cons(Nil)) app(Cons(xs), ys) -> Cons(app(xs, ys)) notEmpty(Cons(xs)) -> True notEmpty(Nil) -> False naiverev(Nil) -> Nil app(Nil, ys) -> ys goal(xs) -> naiverev(xs) Types: naiverev :: Cons:Nil -> Cons:Nil Cons :: Cons:Nil -> Cons:Nil app :: Cons:Nil -> Cons:Nil -> Cons:Nil Nil :: Cons:Nil notEmpty :: Cons:Nil -> True:False True :: True:False False :: True:False goal :: Cons:Nil -> Cons:Nil hole_Cons:Nil1_0 :: Cons:Nil hole_True:False2_0 :: True:False gen_Cons:Nil3_0 :: Nat -> Cons:Nil Lemmas: app(gen_Cons:Nil3_0(n5_0), gen_Cons:Nil3_0(b)) -> gen_Cons:Nil3_0(+(n5_0, b)), rt in Omega(1 + n5_0) Generator Equations: gen_Cons:Nil3_0(0) <=> Nil gen_Cons:Nil3_0(+(x, 1)) <=> Cons(gen_Cons:Nil3_0(x)) The following defined symbols remain to be analysed: naiverev ---------------------------------------- (25) RewriteLemmaProof (LOWER BOUND(ID)) Proved the following rewrite lemma: naiverev(gen_Cons:Nil3_0(n489_0)) -> gen_Cons:Nil3_0(n489_0), rt in Omega(1 + n489_0 + n489_0^2) Induction Base: naiverev(gen_Cons:Nil3_0(0)) ->_R^Omega(1) Nil Induction Step: naiverev(gen_Cons:Nil3_0(+(n489_0, 1))) ->_R^Omega(1) app(naiverev(gen_Cons:Nil3_0(n489_0)), Cons(Nil)) ->_IH app(gen_Cons:Nil3_0(c490_0), Cons(Nil)) ->_L^Omega(1 + n489_0) gen_Cons:Nil3_0(+(n489_0, +(0, 1))) We have rt in Omega(n^2) and sz in O(n). Thus, we have irc_R in Omega(n^2). ---------------------------------------- (26) Obligation: Proved the lower bound n^2 for the following obligation: Innermost TRS: Rules: naiverev(Cons(xs)) -> app(naiverev(xs), Cons(Nil)) app(Cons(xs), ys) -> Cons(app(xs, ys)) notEmpty(Cons(xs)) -> True notEmpty(Nil) -> False naiverev(Nil) -> Nil app(Nil, ys) -> ys goal(xs) -> naiverev(xs) Types: naiverev :: Cons:Nil -> Cons:Nil Cons :: Cons:Nil -> Cons:Nil app :: Cons:Nil -> Cons:Nil -> Cons:Nil Nil :: Cons:Nil notEmpty :: Cons:Nil -> True:False True :: True:False False :: True:False goal :: Cons:Nil -> Cons:Nil hole_Cons:Nil1_0 :: Cons:Nil hole_True:False2_0 :: True:False gen_Cons:Nil3_0 :: Nat -> Cons:Nil Lemmas: app(gen_Cons:Nil3_0(n5_0), gen_Cons:Nil3_0(b)) -> gen_Cons:Nil3_0(+(n5_0, b)), rt in Omega(1 + n5_0) Generator Equations: gen_Cons:Nil3_0(0) <=> Nil gen_Cons:Nil3_0(+(x, 1)) <=> Cons(gen_Cons:Nil3_0(x)) The following defined symbols remain to be analysed: naiverev ---------------------------------------- (27) LowerBoundPropagationProof (FINISHED) Propagated lower bound. ---------------------------------------- (28) BOUNDS(n^2, INF)