/export/starexec/sandbox/solver/bin/starexec_run_complexity /export/starexec/sandbox/benchmark/theBenchmark.xml /export/starexec/sandbox/output/output_files -------------------------------------------------------------------------------- WORST_CASE(Omega(n^1), O(n^2)) proof of /export/starexec/sandbox/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^2). (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, 199 ms] (12) BOUNDS(1, n^2) (13) RenamingProof [BOTH BOUNDS(ID, ID), 0 ms] (14) CpxTRS (15) SlicingProof [LOWER BOUND(ID), 0 ms] (16) CpxTRS (17) TypeInferenceProof [BOTH BOUNDS(ID, ID), 0 ms] (18) typed CpxTrs (19) OrderProof [LOWER BOUND(ID), 0 ms] (20) typed CpxTrs (21) RewriteLemmaProof [LOWER BOUND(ID), 260 ms] (22) BEST (23) proven lower bound (24) LowerBoundPropagationProof [FINISHED, 0 ms] (25) BOUNDS(n^1, INF) (26) typed CpxTrs ---------------------------------------- (0) Obligation: The Runtime Complexity (full) of the given CpxTRS could be proven to be BOUNDS(n^1, n^2). The TRS R consists of the following rules: le(0, y) -> true le(s(x), 0) -> false le(s(x), s(y)) -> le(x, y) int(x, y) -> if(le(x, y), x, y) if(true, x, y) -> cons(x, int(s(x), y)) if(false, x, y) -> nil S is empty. Rewrite Strategy: FULL ---------------------------------------- (1) RcToIrcProof (BOTH BOUNDS(ID, ID)) Converted rc-obligation to irc-obligation. The duplicating contexts are: int([], y) int(x, []) if(true, [], y) The defined contexts are: if([], x1, x2) [] just represents basic- or constructor-terms in the following defined contexts: if([], x1, x2) 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^2). The TRS R consists of the following rules: le(0, y) -> true le(s(x), 0) -> false le(s(x), s(y)) -> le(x, y) int(x, y) -> if(le(x, y), x, y) if(true, x, y) -> cons(x, int(s(x), y)) if(false, x, y) -> nil 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^2). The TRS R consists of the following rules: le(0, y) -> true [1] le(s(x), 0) -> false [1] le(s(x), s(y)) -> le(x, y) [1] int(x, y) -> if(le(x, y), x, y) [1] if(true, x, y) -> cons(x, int(s(x), y)) [1] if(false, x, y) -> nil [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: le(0, y) -> true [1] le(s(x), 0) -> false [1] le(s(x), s(y)) -> le(x, y) [1] int(x, y) -> if(le(x, y), x, y) [1] if(true, x, y) -> cons(x, int(s(x), y)) [1] if(false, x, y) -> nil [1] The TRS has the following type information: le :: 0:s -> 0:s -> true:false 0 :: 0:s true :: true:false s :: 0:s -> 0:s false :: true:false int :: 0:s -> 0:s -> cons:nil if :: true:false -> 0:s -> 0:s -> cons:nil cons :: 0:s -> cons:nil -> cons:nil nil :: cons:nil 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: none And the following fresh constants: none ---------------------------------------- (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: le(0, y) -> true [1] le(s(x), 0) -> false [1] le(s(x), s(y)) -> le(x, y) [1] int(x, y) -> if(le(x, y), x, y) [1] if(true, x, y) -> cons(x, int(s(x), y)) [1] if(false, x, y) -> nil [1] The TRS has the following type information: le :: 0:s -> 0:s -> true:false 0 :: 0:s true :: true:false s :: 0:s -> 0:s false :: true:false int :: 0:s -> 0:s -> cons:nil if :: true:false -> 0:s -> 0:s -> cons:nil cons :: 0:s -> cons:nil -> cons:nil nil :: cons:nil 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 true => 1 false => 0 nil => 0 ---------------------------------------- (10) Obligation: Complexity RNTS consisting of the following rules: if(z, z', z'') -{ 1 }-> 0 :|: z' = x, z'' = y, x >= 0, y >= 0, z = 0 if(z, z', z'') -{ 1 }-> 1 + x + int(1 + x, y) :|: z' = x, z'' = y, z = 1, x >= 0, y >= 0 int(z, z') -{ 1 }-> if(le(x, y), x, y) :|: x >= 0, y >= 0, z = x, z' = y le(z, z') -{ 1 }-> le(x, y) :|: z' = 1 + y, x >= 0, y >= 0, z = 1 + x le(z, z') -{ 1 }-> 1 :|: y >= 0, z = 0, z' = y le(z, z') -{ 1 }-> 0 :|: x >= 0, z = 1 + x, z' = 0 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, V10),0,[le(V1, V, Out)],[V1 >= 0,V >= 0]). eq(start(V1, V, V10),0,[int(V1, V, Out)],[V1 >= 0,V >= 0]). eq(start(V1, V, V10),0,[if(V1, V, V10, Out)],[V1 >= 0,V >= 0,V10 >= 0]). eq(le(V1, V, Out),1,[],[Out = 1,V2 >= 0,V1 = 0,V = V2]). eq(le(V1, V, Out),1,[],[Out = 0,V3 >= 0,V1 = 1 + V3,V = 0]). eq(le(V1, V, Out),1,[le(V4, V5, Ret)],[Out = Ret,V = 1 + V5,V4 >= 0,V5 >= 0,V1 = 1 + V4]). eq(int(V1, V, Out),1,[le(V7, V6, Ret0),if(Ret0, V7, V6, Ret1)],[Out = Ret1,V7 >= 0,V6 >= 0,V1 = V7,V = V6]). eq(if(V1, V, V10, Out),1,[int(1 + V8, V9, Ret11)],[Out = 1 + Ret11 + V8,V = V8,V10 = V9,V1 = 1,V8 >= 0,V9 >= 0]). eq(if(V1, V, V10, Out),1,[],[Out = 0,V = V12,V10 = V11,V12 >= 0,V11 >= 0,V1 = 0]). input_output_vars(le(V1,V,Out),[V1,V],[Out]). input_output_vars(int(V1,V,Out),[V1,V],[Out]). input_output_vars(if(V1,V,V10,Out),[V1,V,V10],[Out]). CoFloCo proof output: Preprocessing Cost Relations ===================================== #### Computed strongly connected components 0. recursive : [le/3] 1. recursive : [if/4,int/3] 2. non_recursive : [start/3] #### Obtained direct recursion through partial evaluation 0. SCC is partially evaluated into le/3 1. SCC is partially evaluated into int/3 2. SCC is partially evaluated into start/3 Control-Flow Refinement of Cost Relations ===================================== ### Specialization of cost equations le/3 * CE 9 is refined into CE [10] * CE 8 is refined into CE [11] * CE 7 is refined into CE [12] ### Cost equations --> "Loop" of le/3 * CEs [11] --> Loop 8 * CEs [12] --> Loop 9 * CEs [10] --> Loop 10 ### Ranking functions of CR le(V1,V,Out) * RF of phase [10]: [V,V1] #### Partial ranking functions of CR le(V1,V,Out) * Partial RF of phase [10]: - RF of loop [10:1]: V V1 ### Specialization of cost equations int/3 * CE 6 is refined into CE [13,14] * CE 5 is refined into CE [15,16] ### Cost equations --> "Loop" of int/3 * CEs [16] --> Loop 11 * CEs [15] --> Loop 12 * CEs [14] --> Loop 13 * CEs [13] --> Loop 14 ### Ranking functions of CR int(V1,V,Out) * RF of phase [13]: [-V1+V+1] #### Partial ranking functions of CR int(V1,V,Out) * Partial RF of phase [13]: - RF of loop [13:1]: -V1+V+1 ### Specialization of cost equations start/3 * CE 2 is refined into CE [17,18,19] * CE 1 is refined into CE [20] * CE 3 is refined into CE [21,22,23,24] * CE 4 is refined into CE [25,26,27,28,29] ### Cost equations --> "Loop" of start/3 * CEs [23,28] --> Loop 15 * CEs [22,27] --> Loop 16 * CEs [18,24,29] --> Loop 17 * CEs [19] --> Loop 18 * CEs [17] --> Loop 19 * CEs [20,21,25,26] --> Loop 20 ### Ranking functions of CR start(V1,V,V10) #### Partial ranking functions of CR start(V1,V,V10) Computing Bounds ===================================== #### Cost of chains of le(V1,V,Out): * Chain [[10],9]: 1*it(10)+1 Such that:it(10) =< V1 with precondition: [Out=1,V1>=1,V>=V1] * Chain [[10],8]: 1*it(10)+1 Such that:it(10) =< V with precondition: [Out=0,V>=1,V1>=V+1] * Chain [9]: 1 with precondition: [V1=0,Out=1,V>=0] * Chain [8]: 1 with precondition: [V=0,Out=0,V1>=1] #### Cost of chains of int(V1,V,Out): * Chain [[13],11]: 3*it(13)+1*s(1)+1*s(4)+3 Such that:it(13) =< -V1+V+1 s(1) =< V aux(1) =< V+1 s(4) =< it(13)*aux(1) with precondition: [V1>=1,V>=V1,Out+2*V1>=3*V+1] * Chain [14,[13],11]: 4*it(13)+1*s(4)+6 Such that:aux(1) =< V+1 aux(2) =< V it(13) =< aux(2) s(4) =< it(13)*aux(1) with precondition: [V1=0,V>=1,Out>=3*V] * Chain [14,12]: 6 with precondition: [V1=0,V=0,Out=1] * Chain [12]: 3 with precondition: [V=0,Out=0,V1>=1] * Chain [11]: 1*s(1)+3 Such that:s(1) =< V with precondition: [Out=0,V>=1,V1>=V+1] #### Cost of chains of start(V1,V,V10): * Chain [20]: 4*s(7)+1*s(8)+6 Such that:s(6) =< V s(5) =< V+1 s(7) =< s(6) s(8) =< s(7)*s(5) with precondition: [V1=0,V>=0] * Chain [19]: 4 with precondition: [V1=1,V10=0,V>=0] * Chain [18]: 3*s(9)+1*s(10)+1*s(12)+4 Such that:s(9) =< -V+V10 s(10) =< V10 s(11) =< V10+1 s(12) =< s(9)*s(11) with precondition: [V1=1,V>=0,V10>=V+1] * Chain [17]: 1*s(13)+1*s(14)+3*s(15)+1*s(16)+1*s(18)+4 Such that:s(15) =< -V1+V+1 s(14) =< V1 s(16) =< V s(17) =< V+1 s(13) =< V10 s(18) =< s(15)*s(17) with precondition: [V1>=1,V>=V1] * Chain [16]: 3 with precondition: [V=0,V1>=1] * Chain [15]: 2*s(19)+3 Such that:aux(3) =< V s(19) =< aux(3) with precondition: [V>=1,V1>=V+1] Closed-form bounds of start(V1,V,V10): ------------------------------------- * Chain [20] with precondition: [V1=0,V>=0] - Upper bound: 4*V+6+(V+1)*V - Complexity: n^2 * Chain [19] with precondition: [V1=1,V10=0,V>=0] - Upper bound: 4 - Complexity: constant * Chain [18] with precondition: [V1=1,V>=0,V10>=V+1] - Upper bound: V10+4+(-V+V10)*(V10+1)+(-3*V+3*V10) - Complexity: n^2 * Chain [17] with precondition: [V1>=1,V>=V1] - Upper bound: V1+V+4+nat(V10)+(-V1+V+1)*(V+1)+(-3*V1+3*V+3) - Complexity: n^2 * Chain [16] with precondition: [V=0,V1>=1] - Upper bound: 3 - Complexity: constant * Chain [15] with precondition: [V>=1,V1>=V+1] - Upper bound: 2*V+3 - Complexity: n ### Maximum cost of start(V1,V,V10): max([max([1,nat(V10)+1+nat(-V+V10)*nat(V10+1)+nat(-V+V10)*3]),max([2*V+3+(V+1)*V+V,V1+1+nat(V10)+(V+1)*nat(-V1+V+1)+nat(-V1+V+1)*3])+V])+3 Asymptotic class: n^2 * Total analysis performed in 170 ms. ---------------------------------------- (12) BOUNDS(1, n^2) ---------------------------------------- (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: le(0', y) -> true le(s(x), 0') -> false le(s(x), s(y)) -> le(x, y) int(x, y) -> if(le(x, y), x, y) if(true, x, y) -> cons(x, int(s(x), y)) if(false, x, y) -> nil S is empty. Rewrite Strategy: FULL ---------------------------------------- (15) SlicingProof (LOWER BOUND(ID)) Sliced the following arguments: cons/0 ---------------------------------------- (16) 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: le(0', y) -> true le(s(x), 0') -> false le(s(x), s(y)) -> le(x, y) int(x, y) -> if(le(x, y), x, y) if(true, x, y) -> cons(int(s(x), y)) if(false, x, y) -> nil S is empty. Rewrite Strategy: FULL ---------------------------------------- (17) TypeInferenceProof (BOTH BOUNDS(ID, ID)) Infered types. ---------------------------------------- (18) Obligation: TRS: Rules: le(0', y) -> true le(s(x), 0') -> false le(s(x), s(y)) -> le(x, y) int(x, y) -> if(le(x, y), x, y) if(true, x, y) -> cons(int(s(x), y)) if(false, x, y) -> nil Types: le :: 0':s -> 0':s -> true:false 0' :: 0':s true :: true:false s :: 0':s -> 0':s false :: true:false int :: 0':s -> 0':s -> cons:nil if :: true:false -> 0':s -> 0':s -> cons:nil cons :: cons:nil -> cons:nil nil :: cons:nil hole_true:false1_0 :: true:false hole_0':s2_0 :: 0':s hole_cons:nil3_0 :: cons:nil gen_0':s4_0 :: Nat -> 0':s gen_cons:nil5_0 :: Nat -> cons:nil ---------------------------------------- (19) OrderProof (LOWER BOUND(ID)) Heuristically decided to analyse the following defined symbols: le, int They will be analysed ascendingly in the following order: le < int ---------------------------------------- (20) Obligation: TRS: Rules: le(0', y) -> true le(s(x), 0') -> false le(s(x), s(y)) -> le(x, y) int(x, y) -> if(le(x, y), x, y) if(true, x, y) -> cons(int(s(x), y)) if(false, x, y) -> nil Types: le :: 0':s -> 0':s -> true:false 0' :: 0':s true :: true:false s :: 0':s -> 0':s false :: true:false int :: 0':s -> 0':s -> cons:nil if :: true:false -> 0':s -> 0':s -> cons:nil cons :: cons:nil -> cons:nil nil :: cons:nil hole_true:false1_0 :: true:false hole_0':s2_0 :: 0':s hole_cons:nil3_0 :: cons:nil gen_0':s4_0 :: Nat -> 0':s gen_cons:nil5_0 :: Nat -> cons:nil Generator Equations: gen_0':s4_0(0) <=> 0' gen_0':s4_0(+(x, 1)) <=> s(gen_0':s4_0(x)) gen_cons:nil5_0(0) <=> nil gen_cons:nil5_0(+(x, 1)) <=> cons(gen_cons:nil5_0(x)) The following defined symbols remain to be analysed: le, int They will be analysed ascendingly in the following order: le < int ---------------------------------------- (21) RewriteLemmaProof (LOWER BOUND(ID)) Proved the following rewrite lemma: le(gen_0':s4_0(n7_0), gen_0':s4_0(n7_0)) -> true, rt in Omega(1 + n7_0) Induction Base: le(gen_0':s4_0(0), gen_0':s4_0(0)) ->_R^Omega(1) true Induction Step: le(gen_0':s4_0(+(n7_0, 1)), gen_0':s4_0(+(n7_0, 1))) ->_R^Omega(1) le(gen_0':s4_0(n7_0), gen_0':s4_0(n7_0)) ->_IH true We have rt in Omega(n^1) and sz in O(n). Thus, we have irc_R in Omega(n). ---------------------------------------- (22) Complex Obligation (BEST) ---------------------------------------- (23) Obligation: Proved the lower bound n^1 for the following obligation: TRS: Rules: le(0', y) -> true le(s(x), 0') -> false le(s(x), s(y)) -> le(x, y) int(x, y) -> if(le(x, y), x, y) if(true, x, y) -> cons(int(s(x), y)) if(false, x, y) -> nil Types: le :: 0':s -> 0':s -> true:false 0' :: 0':s true :: true:false s :: 0':s -> 0':s false :: true:false int :: 0':s -> 0':s -> cons:nil if :: true:false -> 0':s -> 0':s -> cons:nil cons :: cons:nil -> cons:nil nil :: cons:nil hole_true:false1_0 :: true:false hole_0':s2_0 :: 0':s hole_cons:nil3_0 :: cons:nil gen_0':s4_0 :: Nat -> 0':s gen_cons:nil5_0 :: Nat -> cons:nil Generator Equations: gen_0':s4_0(0) <=> 0' gen_0':s4_0(+(x, 1)) <=> s(gen_0':s4_0(x)) gen_cons:nil5_0(0) <=> nil gen_cons:nil5_0(+(x, 1)) <=> cons(gen_cons:nil5_0(x)) The following defined symbols remain to be analysed: le, int They will be analysed ascendingly in the following order: le < int ---------------------------------------- (24) LowerBoundPropagationProof (FINISHED) Propagated lower bound. ---------------------------------------- (25) BOUNDS(n^1, INF) ---------------------------------------- (26) Obligation: TRS: Rules: le(0', y) -> true le(s(x), 0') -> false le(s(x), s(y)) -> le(x, y) int(x, y) -> if(le(x, y), x, y) if(true, x, y) -> cons(int(s(x), y)) if(false, x, y) -> nil Types: le :: 0':s -> 0':s -> true:false 0' :: 0':s true :: true:false s :: 0':s -> 0':s false :: true:false int :: 0':s -> 0':s -> cons:nil if :: true:false -> 0':s -> 0':s -> cons:nil cons :: cons:nil -> cons:nil nil :: cons:nil hole_true:false1_0 :: true:false hole_0':s2_0 :: 0':s hole_cons:nil3_0 :: cons:nil gen_0':s4_0 :: Nat -> 0':s gen_cons:nil5_0 :: Nat -> cons:nil Lemmas: le(gen_0':s4_0(n7_0), gen_0':s4_0(n7_0)) -> true, rt in Omega(1 + n7_0) Generator Equations: gen_0':s4_0(0) <=> 0' gen_0':s4_0(+(x, 1)) <=> s(gen_0':s4_0(x)) gen_cons:nil5_0(0) <=> nil gen_cons:nil5_0(+(x, 1)) <=> cons(gen_cons:nil5_0(x)) The following defined symbols remain to be analysed: int