/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: 794c25de1cacf0d048858bcd21c9a779e1221865 marcel 20200619 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, 137 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), 280 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), 1705 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: fac(s(x)) -> *(fac(p(s(x))), s(x)) p(s(0)) -> 0 p(s(s(x))) -> s(p(s(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^2). The TRS R consists of the following rules: fac(s(x)) -> *(fac(p(s(x))), s(x)) [1] p(s(0)) -> 0 [1] p(s(s(x))) -> s(p(s(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: fac(s(x)) -> *(fac(p(s(x))), s(x)) [1] p(s(0)) -> 0 [1] p(s(s(x))) -> s(p(s(x))) [1] The TRS has the following type information: fac :: s:0 -> * s :: s:0 -> s:0 * :: * -> s:0 -> * p :: s:0 -> s:0 0 :: s:0 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: fac(v0) -> null_fac [0] p(v0) -> null_p [0] And the following fresh constants: null_fac, null_p ---------------------------------------- (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: fac(s(x)) -> *(fac(p(s(x))), s(x)) [1] p(s(0)) -> 0 [1] p(s(s(x))) -> s(p(s(x))) [1] fac(v0) -> null_fac [0] p(v0) -> null_p [0] The TRS has the following type information: fac :: s:0:null_p -> *:null_fac s :: s:0:null_p -> s:0:null_p * :: *:null_fac -> s:0:null_p -> *:null_fac p :: s:0:null_p -> s:0:null_p 0 :: s:0:null_p null_fac :: *:null_fac null_p :: s:0:null_p 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_fac => 0 null_p => 0 ---------------------------------------- (8) Obligation: Complexity RNTS consisting of the following rules: fac(z) -{ 0 }-> 0 :|: v0 >= 0, z = v0 fac(z) -{ 1 }-> 1 + fac(p(1 + x)) + (1 + x) :|: x >= 0, z = 1 + x p(z) -{ 1 }-> 0 :|: z = 1 + 0 p(z) -{ 0 }-> 0 :|: v0 >= 0, z = v0 p(z) -{ 1 }-> 1 + p(1 + x) :|: x >= 0, z = 1 + (1 + 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),0,[fac(V, Out)],[V >= 0]). eq(start(V),0,[p(V, Out)],[V >= 0]). eq(fac(V, Out),1,[p(1 + V1, Ret010),fac(Ret010, Ret01)],[Out = 2 + Ret01 + V1,V1 >= 0,V = 1 + V1]). eq(p(V, Out),1,[],[Out = 0,V = 1]). eq(p(V, Out),1,[p(1 + V2, Ret1)],[Out = 1 + Ret1,V2 >= 0,V = 2 + V2]). eq(fac(V, Out),0,[],[Out = 0,V3 >= 0,V = V3]). eq(p(V, Out),0,[],[Out = 0,V4 >= 0,V = V4]). input_output_vars(fac(V,Out),[V],[Out]). input_output_vars(p(V,Out),[V],[Out]). CoFloCo proof output: Preprocessing Cost Relations ===================================== #### Computed strongly connected components 0. recursive : [p/2] 1. recursive : [fac/2] 2. non_recursive : [start/1] #### Obtained direct recursion through partial evaluation 0. SCC is partially evaluated into p/2 1. SCC is partially evaluated into fac/2 2. SCC is partially evaluated into start/1 Control-Flow Refinement of Cost Relations ===================================== ### Specialization of cost equations p/2 * CE 5 is refined into CE [8] * CE 7 is refined into CE [9] * CE 6 is refined into CE [10] ### Cost equations --> "Loop" of p/2 * CEs [10] --> Loop 6 * CEs [8,9] --> Loop 7 ### Ranking functions of CR p(V,Out) * RF of phase [6]: [V-1] #### Partial ranking functions of CR p(V,Out) * Partial RF of phase [6]: - RF of loop [6:1]: V-1 ### Specialization of cost equations fac/2 * CE 4 is refined into CE [11] * CE 3 is refined into CE [12,13] ### Cost equations --> "Loop" of fac/2 * CEs [13] --> Loop 8 * CEs [12] --> Loop 9 * CEs [11] --> Loop 10 ### Ranking functions of CR fac(V,Out) * RF of phase [8]: [V-1] #### Partial ranking functions of CR fac(V,Out) * Partial RF of phase [8]: - RF of loop [8:1]: V-1 ### Specialization of cost equations start/1 * CE 1 is refined into CE [14,15,16] * CE 2 is refined into CE [17,18] ### Cost equations --> "Loop" of start/1 * CEs [14,15,16,17,18] --> Loop 11 ### Ranking functions of CR start(V) #### Partial ranking functions of CR start(V) Computing Bounds ===================================== #### Cost of chains of p(V,Out): * Chain [[6],7]: 1*it(6)+1 Such that:it(6) =< Out with precondition: [Out>=1,V>=Out+1] * Chain [7]: 1 with precondition: [Out=0,V>=0] #### Cost of chains of fac(V,Out): * Chain [[8],10]: 2*it(8)+1*s(3)+0 Such that:aux(3) =< V it(8) =< aux(3) s(3) =< it(8)*aux(3) with precondition: [V>=2,Out>=V+1] * Chain [[8],9,10]: 2*it(8)+1*s(3)+2 Such that:aux(4) =< V it(8) =< aux(4) s(3) =< it(8)*aux(4) with precondition: [V>=2,Out>=V+3] * Chain [10]: 0 with precondition: [Out=0,V>=0] * Chain [9,10]: 2 with precondition: [V+1=Out,V>=1] #### Cost of chains of start(V): * Chain [11]: 5*s(11)+2*s(12)+2 Such that:aux(6) =< V s(11) =< aux(6) s(12) =< s(11)*aux(6) with precondition: [V>=0] Closed-form bounds of start(V): ------------------------------------- * Chain [11] with precondition: [V>=0] - Upper bound: 5*V+2+2*V*V - Complexity: n^2 ### Maximum cost of start(V): 5*V+2+2*V*V Asymptotic class: n^2 * Total analysis performed in 77 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: fac(s(x)) -> *'(fac(p(s(x))), s(x)) p(s(0')) -> 0' p(s(s(x))) -> s(p(s(x))) S is empty. Rewrite Strategy: INNERMOST ---------------------------------------- (13) SlicingProof (LOWER BOUND(ID)) Sliced the following arguments: *'/1 ---------------------------------------- (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: fac(s(x)) -> *'(fac(p(s(x)))) p(s(0')) -> 0' p(s(s(x))) -> s(p(s(x))) S is empty. Rewrite Strategy: INNERMOST ---------------------------------------- (15) TypeInferenceProof (BOTH BOUNDS(ID, ID)) Infered types. ---------------------------------------- (16) Obligation: Innermost TRS: Rules: fac(s(x)) -> *'(fac(p(s(x)))) p(s(0')) -> 0' p(s(s(x))) -> s(p(s(x))) Types: fac :: s:0' -> *' s :: s:0' -> s:0' *' :: *' -> *' p :: s:0' -> s:0' 0' :: s:0' hole_*'1_0 :: *' hole_s:0'2_0 :: s:0' gen_*'3_0 :: Nat -> *' gen_s:0'4_0 :: Nat -> s:0' ---------------------------------------- (17) OrderProof (LOWER BOUND(ID)) Heuristically decided to analyse the following defined symbols: fac, p They will be analysed ascendingly in the following order: p < fac ---------------------------------------- (18) Obligation: Innermost TRS: Rules: fac(s(x)) -> *'(fac(p(s(x)))) p(s(0')) -> 0' p(s(s(x))) -> s(p(s(x))) Types: fac :: s:0' -> *' s :: s:0' -> s:0' *' :: *' -> *' p :: s:0' -> s:0' 0' :: s:0' hole_*'1_0 :: *' hole_s:0'2_0 :: s:0' gen_*'3_0 :: Nat -> *' gen_s:0'4_0 :: Nat -> s:0' Generator Equations: gen_*'3_0(0) <=> hole_*'1_0 gen_*'3_0(+(x, 1)) <=> *'(gen_*'3_0(x)) gen_s:0'4_0(0) <=> 0' gen_s:0'4_0(+(x, 1)) <=> s(gen_s:0'4_0(x)) The following defined symbols remain to be analysed: p, fac They will be analysed ascendingly in the following order: p < fac ---------------------------------------- (19) RewriteLemmaProof (LOWER BOUND(ID)) Proved the following rewrite lemma: p(gen_s:0'4_0(+(1, n6_0))) -> gen_s:0'4_0(n6_0), rt in Omega(1 + n6_0) Induction Base: p(gen_s:0'4_0(+(1, 0))) ->_R^Omega(1) 0' Induction Step: p(gen_s:0'4_0(+(1, +(n6_0, 1)))) ->_R^Omega(1) s(p(s(gen_s:0'4_0(n6_0)))) ->_IH s(gen_s:0'4_0(c7_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: fac(s(x)) -> *'(fac(p(s(x)))) p(s(0')) -> 0' p(s(s(x))) -> s(p(s(x))) Types: fac :: s:0' -> *' s :: s:0' -> s:0' *' :: *' -> *' p :: s:0' -> s:0' 0' :: s:0' hole_*'1_0 :: *' hole_s:0'2_0 :: s:0' gen_*'3_0 :: Nat -> *' gen_s:0'4_0 :: Nat -> s:0' Generator Equations: gen_*'3_0(0) <=> hole_*'1_0 gen_*'3_0(+(x, 1)) <=> *'(gen_*'3_0(x)) gen_s:0'4_0(0) <=> 0' gen_s:0'4_0(+(x, 1)) <=> s(gen_s:0'4_0(x)) The following defined symbols remain to be analysed: p, fac They will be analysed ascendingly in the following order: p < fac ---------------------------------------- (22) LowerBoundPropagationProof (FINISHED) Propagated lower bound. ---------------------------------------- (23) BOUNDS(n^1, INF) ---------------------------------------- (24) Obligation: Innermost TRS: Rules: fac(s(x)) -> *'(fac(p(s(x)))) p(s(0')) -> 0' p(s(s(x))) -> s(p(s(x))) Types: fac :: s:0' -> *' s :: s:0' -> s:0' *' :: *' -> *' p :: s:0' -> s:0' 0' :: s:0' hole_*'1_0 :: *' hole_s:0'2_0 :: s:0' gen_*'3_0 :: Nat -> *' gen_s:0'4_0 :: Nat -> s:0' Lemmas: p(gen_s:0'4_0(+(1, n6_0))) -> gen_s:0'4_0(n6_0), rt in Omega(1 + n6_0) Generator Equations: gen_*'3_0(0) <=> hole_*'1_0 gen_*'3_0(+(x, 1)) <=> *'(gen_*'3_0(x)) gen_s:0'4_0(0) <=> 0' gen_s:0'4_0(+(x, 1)) <=> s(gen_s:0'4_0(x)) The following defined symbols remain to be analysed: fac ---------------------------------------- (25) RewriteLemmaProof (LOWER BOUND(ID)) Proved the following rewrite lemma: fac(gen_s:0'4_0(+(1, n221_0))) -> *5_0, rt in Omega(n221_0 + n221_0^2) Induction Base: fac(gen_s:0'4_0(+(1, 0))) Induction Step: fac(gen_s:0'4_0(+(1, +(n221_0, 1)))) ->_R^Omega(1) *'(fac(p(s(gen_s:0'4_0(+(1, n221_0)))))) ->_L^Omega(2 + n221_0) *'(fac(gen_s:0'4_0(+(1, n221_0)))) ->_IH *'(*5_0) 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: fac(s(x)) -> *'(fac(p(s(x)))) p(s(0')) -> 0' p(s(s(x))) -> s(p(s(x))) Types: fac :: s:0' -> *' s :: s:0' -> s:0' *' :: *' -> *' p :: s:0' -> s:0' 0' :: s:0' hole_*'1_0 :: *' hole_s:0'2_0 :: s:0' gen_*'3_0 :: Nat -> *' gen_s:0'4_0 :: Nat -> s:0' Lemmas: p(gen_s:0'4_0(+(1, n6_0))) -> gen_s:0'4_0(n6_0), rt in Omega(1 + n6_0) Generator Equations: gen_*'3_0(0) <=> hole_*'1_0 gen_*'3_0(+(x, 1)) <=> *'(gen_*'3_0(x)) gen_s:0'4_0(0) <=> 0' gen_s:0'4_0(+(x, 1)) <=> s(gen_s:0'4_0(x)) The following defined symbols remain to be analysed: fac ---------------------------------------- (27) LowerBoundPropagationProof (FINISHED) Propagated lower bound. ---------------------------------------- (28) BOUNDS(n^2, INF)