/export/starexec/sandbox2/solver/bin/starexec_run_complexity /export/starexec/sandbox2/benchmark/theBenchmark.xml /export/starexec/sandbox2/output/output_files -------------------------------------------------------------------------------- WORST_CASE(Omega(n^3), O(n^3)) 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^3, n^3). (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, 186 ms] (10) BOUNDS(1, n^3) (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), 302 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), 28 ms] (26) BEST (27) proven lower bound (28) LowerBoundPropagationProof [FINISHED, 0 ms] (29) BOUNDS(n^2, INF) (30) typed CpxTrs (31) RewriteLemmaProof [LOWER BOUND(ID), 0 ms] (32) proven lower bound (33) LowerBoundPropagationProof [FINISHED, 0 ms] (34) BOUNDS(n^3, INF) ---------------------------------------- (0) Obligation: The Runtime Complexity (innermost) of the given CpxTRS could be proven to be BOUNDS(n^3, n^3). The TRS R consists of the following rules: app(nil, y) -> y app(add(n, x), y) -> add(n, app(x, y)) reverse(nil) -> nil reverse(add(n, x)) -> app(reverse(x), add(n, nil)) shuffle(nil) -> nil shuffle(add(n, x)) -> add(n, shuffle(reverse(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^3). The TRS R consists of the following rules: app(nil, y) -> y [1] app(add(n, x), y) -> add(n, app(x, y)) [1] reverse(nil) -> nil [1] reverse(add(n, x)) -> app(reverse(x), add(n, nil)) [1] shuffle(nil) -> nil [1] shuffle(add(n, x)) -> add(n, shuffle(reverse(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: app(nil, y) -> y [1] app(add(n, x), y) -> add(n, app(x, y)) [1] reverse(nil) -> nil [1] reverse(add(n, x)) -> app(reverse(x), add(n, nil)) [1] shuffle(nil) -> nil [1] shuffle(add(n, x)) -> add(n, shuffle(reverse(x))) [1] The TRS has the following type information: app :: nil:add -> nil:add -> nil:add nil :: nil:add add :: a -> nil:add -> nil:add reverse :: nil:add -> nil:add shuffle :: nil:add -> nil:add 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: app(nil, y) -> y [1] app(add(n, x), y) -> add(n, app(x, y)) [1] reverse(nil) -> nil [1] reverse(add(n, x)) -> app(reverse(x), add(n, nil)) [1] shuffle(nil) -> nil [1] shuffle(add(n, x)) -> add(n, shuffle(reverse(x))) [1] The TRS has the following type information: app :: nil:add -> nil:add -> nil:add nil :: nil:add add :: a -> nil:add -> nil:add reverse :: nil:add -> nil:add shuffle :: nil:add -> nil:add 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 const => 0 ---------------------------------------- (8) Obligation: Complexity RNTS consisting of the following rules: app(z, z') -{ 1 }-> y :|: y >= 0, z = 0, z' = y app(z, z') -{ 1 }-> 1 + n + app(x, y) :|: n >= 0, x >= 0, y >= 0, z = 1 + n + x, z' = y reverse(z) -{ 1 }-> app(reverse(x), 1 + n + 0) :|: n >= 0, x >= 0, z = 1 + n + x reverse(z) -{ 1 }-> 0 :|: z = 0 shuffle(z) -{ 1 }-> 0 :|: z = 0 shuffle(z) -{ 1 }-> 1 + n + shuffle(reverse(x)) :|: n >= 0, x >= 0, z = 1 + n + 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(V1, V),0,[app(V1, V, Out)],[V1 >= 0,V >= 0]). eq(start(V1, V),0,[reverse(V1, Out)],[V1 >= 0]). eq(start(V1, V),0,[shuffle(V1, Out)],[V1 >= 0]). eq(app(V1, V, Out),1,[],[Out = V2,V2 >= 0,V1 = 0,V = V2]). eq(app(V1, V, Out),1,[app(V4, V5, Ret1)],[Out = 1 + Ret1 + V3,V3 >= 0,V4 >= 0,V5 >= 0,V1 = 1 + V3 + V4,V = V5]). eq(reverse(V1, Out),1,[],[Out = 0,V1 = 0]). eq(reverse(V1, Out),1,[reverse(V6, Ret0),app(Ret0, 1 + V7 + 0, Ret)],[Out = Ret,V7 >= 0,V6 >= 0,V1 = 1 + V6 + V7]). eq(shuffle(V1, Out),1,[],[Out = 0,V1 = 0]). eq(shuffle(V1, Out),1,[reverse(V8, Ret10),shuffle(Ret10, Ret11)],[Out = 1 + Ret11 + V9,V9 >= 0,V8 >= 0,V1 = 1 + V8 + V9]). input_output_vars(app(V1,V,Out),[V1,V],[Out]). input_output_vars(reverse(V1,Out),[V1],[Out]). input_output_vars(shuffle(V1,Out),[V1],[Out]). CoFloCo proof output: Preprocessing Cost Relations ===================================== #### Computed strongly connected components 0. recursive : [app/3] 1. recursive [non_tail] : [reverse/2] 2. recursive : [shuffle/2] 3. non_recursive : [start/2] #### Obtained direct recursion through partial evaluation 0. SCC is partially evaluated into app/3 1. SCC is partially evaluated into reverse/2 2. SCC is partially evaluated into shuffle/2 3. SCC is partially evaluated into start/2 Control-Flow Refinement of Cost Relations ===================================== ### Specialization of cost equations app/3 * CE 5 is refined into CE [10] * CE 4 is refined into CE [11] ### Cost equations --> "Loop" of app/3 * CEs [11] --> Loop 8 * CEs [10] --> Loop 9 ### Ranking functions of CR app(V1,V,Out) * RF of phase [9]: [V1] #### Partial ranking functions of CR app(V1,V,Out) * Partial RF of phase [9]: - RF of loop [9:1]: V1 ### Specialization of cost equations reverse/2 * CE 7 is refined into CE [12,13] * CE 6 is refined into CE [14] ### Cost equations --> "Loop" of reverse/2 * CEs [14] --> Loop 10 * CEs [13] --> Loop 11 * CEs [12] --> Loop 12 ### Ranking functions of CR reverse(V1,Out) * RF of phase [11]: [V1] #### Partial ranking functions of CR reverse(V1,Out) * Partial RF of phase [11]: - RF of loop [11:1]: V1 ### Specialization of cost equations shuffle/2 * CE 9 is refined into CE [15,16] * CE 8 is refined into CE [17] ### Cost equations --> "Loop" of shuffle/2 * CEs [17] --> Loop 13 * CEs [16] --> Loop 14 * CEs [15] --> Loop 15 ### Ranking functions of CR shuffle(V1,Out) * RF of phase [14]: [V1-1] #### Partial ranking functions of CR shuffle(V1,Out) * Partial RF of phase [14]: - RF of loop [14:1]: V1-1 ### 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] ### Cost equations --> "Loop" of start/2 * CEs [19,21,23] --> Loop 16 * CEs [18,20,22] --> Loop 17 ### Ranking functions of CR start(V1,V) #### Partial ranking functions of CR start(V1,V) Computing Bounds ===================================== #### Cost of chains of app(V1,V,Out): * Chain [[9],8]: 1*it(9)+1 Such that:it(9) =< -V+Out with precondition: [V+V1=Out,V1>=1,V>=0] * Chain [8]: 1 with precondition: [V1=0,V=Out,V>=0] #### Cost of chains of reverse(V1,Out): * Chain [[11],12,10]: 2*it(11)+1*s(3)+3 Such that:aux(3) =< Out it(11) =< aux(3) s(3) =< it(11)*aux(3) with precondition: [Out=V1,Out>=2] * Chain [12,10]: 3 with precondition: [V1=Out,V1>=1] * Chain [10]: 1 with precondition: [V1=0,Out=0] #### Cost of chains of shuffle(V1,Out): * Chain [[14],15,13]: 4*it(14)+2*s(13)+1*s(14)+3 Such that:aux(6) =< Out it(14) =< aux(6) aux(4) =< aux(6) s(15) =< it(14)*aux(4) s(13) =< s(15) s(14) =< s(13)*aux(6) with precondition: [V1=Out,V1>=2] * Chain [15,13]: 3 with precondition: [V1=Out,V1>=1] * Chain [13]: 1 with precondition: [V1=0,Out=0] #### Cost of chains of start(V1,V): * Chain [17]: 1 with precondition: [V1=0] * Chain [16]: 7*s(22)+1*s(25)+2*s(30)+1*s(31)+3 Such that:aux(7) =< V1 s(22) =< aux(7) s(25) =< s(22)*aux(7) s(28) =< aux(7) s(29) =< s(22)*s(28) s(30) =< s(29) s(31) =< s(30)*aux(7) with precondition: [V1>=1] Closed-form bounds of start(V1,V): ------------------------------------- * Chain [17] with precondition: [V1=0] - Upper bound: 1 - Complexity: constant * Chain [16] with precondition: [V1>=1] - Upper bound: 7*V1+3+3*V1*V1+V1*V1*V1 - Complexity: n^3 ### Maximum cost of start(V1,V): 7*V1+2+3*V1*V1+V1*V1*V1+1 Asymptotic class: n^3 * Total analysis performed in 128 ms. ---------------------------------------- (10) BOUNDS(1, n^3) ---------------------------------------- (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^3, INF). The TRS R consists of the following rules: app(nil, y) -> y app(add(n, x), y) -> add(n, app(x, y)) reverse(nil) -> nil reverse(add(n, x)) -> app(reverse(x), add(n, nil)) shuffle(nil) -> nil shuffle(add(n, x)) -> add(n, shuffle(reverse(x))) S is empty. Rewrite Strategy: INNERMOST ---------------------------------------- (13) SlicingProof (LOWER BOUND(ID)) Sliced the following arguments: add/0 ---------------------------------------- (14) Obligation: The Runtime Complexity (innermost) of the given CpxTRS could be proven to be BOUNDS(n^3, INF). The TRS R consists of the following rules: app(nil, y) -> y app(add(x), y) -> add(app(x, y)) reverse(nil) -> nil reverse(add(x)) -> app(reverse(x), add(nil)) shuffle(nil) -> nil shuffle(add(x)) -> add(shuffle(reverse(x))) S is empty. Rewrite Strategy: INNERMOST ---------------------------------------- (15) TypeInferenceProof (BOTH BOUNDS(ID, ID)) Infered types. ---------------------------------------- (16) Obligation: Innermost TRS: Rules: app(nil, y) -> y app(add(x), y) -> add(app(x, y)) reverse(nil) -> nil reverse(add(x)) -> app(reverse(x), add(nil)) shuffle(nil) -> nil shuffle(add(x)) -> add(shuffle(reverse(x))) Types: app :: nil:add -> nil:add -> nil:add nil :: nil:add add :: nil:add -> nil:add reverse :: nil:add -> nil:add shuffle :: nil:add -> nil:add hole_nil:add1_0 :: nil:add gen_nil:add2_0 :: Nat -> nil:add ---------------------------------------- (17) OrderProof (LOWER BOUND(ID)) Heuristically decided to analyse the following defined symbols: app, reverse, shuffle They will be analysed ascendingly in the following order: app < reverse reverse < shuffle ---------------------------------------- (18) Obligation: Innermost TRS: Rules: app(nil, y) -> y app(add(x), y) -> add(app(x, y)) reverse(nil) -> nil reverse(add(x)) -> app(reverse(x), add(nil)) shuffle(nil) -> nil shuffle(add(x)) -> add(shuffle(reverse(x))) Types: app :: nil:add -> nil:add -> nil:add nil :: nil:add add :: nil:add -> nil:add reverse :: nil:add -> nil:add shuffle :: nil:add -> nil:add hole_nil:add1_0 :: nil:add gen_nil:add2_0 :: Nat -> nil:add Generator Equations: gen_nil:add2_0(0) <=> nil gen_nil:add2_0(+(x, 1)) <=> add(gen_nil:add2_0(x)) The following defined symbols remain to be analysed: app, reverse, shuffle They will be analysed ascendingly in the following order: app < reverse reverse < shuffle ---------------------------------------- (19) RewriteLemmaProof (LOWER BOUND(ID)) Proved the following rewrite lemma: app(gen_nil:add2_0(n4_0), gen_nil:add2_0(b)) -> gen_nil:add2_0(+(n4_0, b)), rt in Omega(1 + n4_0) Induction Base: app(gen_nil:add2_0(0), gen_nil:add2_0(b)) ->_R^Omega(1) gen_nil:add2_0(b) Induction Step: app(gen_nil:add2_0(+(n4_0, 1)), gen_nil:add2_0(b)) ->_R^Omega(1) add(app(gen_nil:add2_0(n4_0), gen_nil:add2_0(b))) ->_IH add(gen_nil:add2_0(+(b, c5_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: app(nil, y) -> y app(add(x), y) -> add(app(x, y)) reverse(nil) -> nil reverse(add(x)) -> app(reverse(x), add(nil)) shuffle(nil) -> nil shuffle(add(x)) -> add(shuffle(reverse(x))) Types: app :: nil:add -> nil:add -> nil:add nil :: nil:add add :: nil:add -> nil:add reverse :: nil:add -> nil:add shuffle :: nil:add -> nil:add hole_nil:add1_0 :: nil:add gen_nil:add2_0 :: Nat -> nil:add Generator Equations: gen_nil:add2_0(0) <=> nil gen_nil:add2_0(+(x, 1)) <=> add(gen_nil:add2_0(x)) The following defined symbols remain to be analysed: app, reverse, shuffle They will be analysed ascendingly in the following order: app < reverse reverse < shuffle ---------------------------------------- (22) LowerBoundPropagationProof (FINISHED) Propagated lower bound. ---------------------------------------- (23) BOUNDS(n^1, INF) ---------------------------------------- (24) Obligation: Innermost TRS: Rules: app(nil, y) -> y app(add(x), y) -> add(app(x, y)) reverse(nil) -> nil reverse(add(x)) -> app(reverse(x), add(nil)) shuffle(nil) -> nil shuffle(add(x)) -> add(shuffle(reverse(x))) Types: app :: nil:add -> nil:add -> nil:add nil :: nil:add add :: nil:add -> nil:add reverse :: nil:add -> nil:add shuffle :: nil:add -> nil:add hole_nil:add1_0 :: nil:add gen_nil:add2_0 :: Nat -> nil:add Lemmas: app(gen_nil:add2_0(n4_0), gen_nil:add2_0(b)) -> gen_nil:add2_0(+(n4_0, b)), rt in Omega(1 + n4_0) Generator Equations: gen_nil:add2_0(0) <=> nil gen_nil:add2_0(+(x, 1)) <=> add(gen_nil:add2_0(x)) The following defined symbols remain to be analysed: reverse, shuffle They will be analysed ascendingly in the following order: reverse < shuffle ---------------------------------------- (25) RewriteLemmaProof (LOWER BOUND(ID)) Proved the following rewrite lemma: reverse(gen_nil:add2_0(n487_0)) -> gen_nil:add2_0(n487_0), rt in Omega(1 + n487_0 + n487_0^2) Induction Base: reverse(gen_nil:add2_0(0)) ->_R^Omega(1) nil Induction Step: reverse(gen_nil:add2_0(+(n487_0, 1))) ->_R^Omega(1) app(reverse(gen_nil:add2_0(n487_0)), add(nil)) ->_IH app(gen_nil:add2_0(c488_0), add(nil)) ->_L^Omega(1 + n487_0) gen_nil:add2_0(+(n487_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) Complex Obligation (BEST) ---------------------------------------- (27) Obligation: Proved the lower bound n^2 for the following obligation: Innermost TRS: Rules: app(nil, y) -> y app(add(x), y) -> add(app(x, y)) reverse(nil) -> nil reverse(add(x)) -> app(reverse(x), add(nil)) shuffle(nil) -> nil shuffle(add(x)) -> add(shuffle(reverse(x))) Types: app :: nil:add -> nil:add -> nil:add nil :: nil:add add :: nil:add -> nil:add reverse :: nil:add -> nil:add shuffle :: nil:add -> nil:add hole_nil:add1_0 :: nil:add gen_nil:add2_0 :: Nat -> nil:add Lemmas: app(gen_nil:add2_0(n4_0), gen_nil:add2_0(b)) -> gen_nil:add2_0(+(n4_0, b)), rt in Omega(1 + n4_0) Generator Equations: gen_nil:add2_0(0) <=> nil gen_nil:add2_0(+(x, 1)) <=> add(gen_nil:add2_0(x)) The following defined symbols remain to be analysed: reverse, shuffle They will be analysed ascendingly in the following order: reverse < shuffle ---------------------------------------- (28) LowerBoundPropagationProof (FINISHED) Propagated lower bound. ---------------------------------------- (29) BOUNDS(n^2, INF) ---------------------------------------- (30) Obligation: Innermost TRS: Rules: app(nil, y) -> y app(add(x), y) -> add(app(x, y)) reverse(nil) -> nil reverse(add(x)) -> app(reverse(x), add(nil)) shuffle(nil) -> nil shuffle(add(x)) -> add(shuffle(reverse(x))) Types: app :: nil:add -> nil:add -> nil:add nil :: nil:add add :: nil:add -> nil:add reverse :: nil:add -> nil:add shuffle :: nil:add -> nil:add hole_nil:add1_0 :: nil:add gen_nil:add2_0 :: Nat -> nil:add Lemmas: app(gen_nil:add2_0(n4_0), gen_nil:add2_0(b)) -> gen_nil:add2_0(+(n4_0, b)), rt in Omega(1 + n4_0) reverse(gen_nil:add2_0(n487_0)) -> gen_nil:add2_0(n487_0), rt in Omega(1 + n487_0 + n487_0^2) Generator Equations: gen_nil:add2_0(0) <=> nil gen_nil:add2_0(+(x, 1)) <=> add(gen_nil:add2_0(x)) The following defined symbols remain to be analysed: shuffle ---------------------------------------- (31) RewriteLemmaProof (LOWER BOUND(ID)) Proved the following rewrite lemma: shuffle(gen_nil:add2_0(n701_0)) -> gen_nil:add2_0(n701_0), rt in Omega(1 + n701_0 + n701_0^2 + n701_0^3) Induction Base: shuffle(gen_nil:add2_0(0)) ->_R^Omega(1) nil Induction Step: shuffle(gen_nil:add2_0(+(n701_0, 1))) ->_R^Omega(1) add(shuffle(reverse(gen_nil:add2_0(n701_0)))) ->_L^Omega(1 + n701_0 + n701_0^2) add(shuffle(gen_nil:add2_0(n701_0))) ->_IH add(gen_nil:add2_0(c702_0)) We have rt in Omega(n^3) and sz in O(n). Thus, we have irc_R in Omega(n^3). ---------------------------------------- (32) Obligation: Proved the lower bound n^3 for the following obligation: Innermost TRS: Rules: app(nil, y) -> y app(add(x), y) -> add(app(x, y)) reverse(nil) -> nil reverse(add(x)) -> app(reverse(x), add(nil)) shuffle(nil) -> nil shuffle(add(x)) -> add(shuffle(reverse(x))) Types: app :: nil:add -> nil:add -> nil:add nil :: nil:add add :: nil:add -> nil:add reverse :: nil:add -> nil:add shuffle :: nil:add -> nil:add hole_nil:add1_0 :: nil:add gen_nil:add2_0 :: Nat -> nil:add Lemmas: app(gen_nil:add2_0(n4_0), gen_nil:add2_0(b)) -> gen_nil:add2_0(+(n4_0, b)), rt in Omega(1 + n4_0) reverse(gen_nil:add2_0(n487_0)) -> gen_nil:add2_0(n487_0), rt in Omega(1 + n487_0 + n487_0^2) Generator Equations: gen_nil:add2_0(0) <=> nil gen_nil:add2_0(+(x, 1)) <=> add(gen_nil:add2_0(x)) The following defined symbols remain to be analysed: shuffle ---------------------------------------- (33) LowerBoundPropagationProof (FINISHED) Propagated lower bound. ---------------------------------------- (34) BOUNDS(n^3, INF)