/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^1)) 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^1). (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), 6 ms] (10) CpxRNTS (11) CompleteCoflocoProof [FINISHED, 251 ms] (12) BOUNDS(1, n^1) (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), 203 ms] (22) proven lower bound (23) LowerBoundPropagationProof [FINISHED, 0 ms] (24) BOUNDS(n^1, INF) ---------------------------------------- (0) Obligation: The Runtime Complexity (full) of the given CpxTRS could be proven to be BOUNDS(n^1, n^1). The TRS R consists of the following rules: or(true, y) -> true or(x, true) -> true or(false, false) -> false mem(x, nil) -> false mem(x, set(y)) -> =(x, y) mem(x, union(y, z)) -> or(mem(x, y), mem(x, z)) S is empty. Rewrite Strategy: FULL ---------------------------------------- (1) RcToIrcProof (BOTH BOUNDS(ID, ID)) Converted rc-obligation to irc-obligation. The duplicating contexts are: mem([], union(y, z)) The defined contexts are: or([], x1) or(x0, []) 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^1). The TRS R consists of the following rules: or(true, y) -> true or(x, true) -> true or(false, false) -> false mem(x, nil) -> false mem(x, set(y)) -> =(x, y) mem(x, union(y, z)) -> or(mem(x, y), mem(x, z)) 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^1). The TRS R consists of the following rules: or(true, y) -> true [1] or(x, true) -> true [1] or(false, false) -> false [1] mem(x, nil) -> false [1] mem(x, set(y)) -> =(x, y) [1] mem(x, union(y, z)) -> or(mem(x, y), mem(x, z)) [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: or(true, y) -> true [1] or(x, true) -> true [1] or(false, false) -> false [1] mem(x, nil) -> false [1] mem(x, set(y)) -> =(x, y) [1] mem(x, union(y, z)) -> or(mem(x, y), mem(x, z)) [1] The TRS has the following type information: or :: true:false:= -> true:false:= -> true:false:= true :: true:false:= false :: true:false:= mem :: a -> nil:set:union -> true:false:= nil :: nil:set:union set :: b -> nil:set:union = :: a -> b -> true:false:= union :: nil:set:union -> nil:set:union -> nil:set:union 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: or(v0, v1) -> null_or [0] And the following fresh constants: null_or, const, const1 ---------------------------------------- (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: or(true, y) -> true [1] or(x, true) -> true [1] or(false, false) -> false [1] mem(x, nil) -> false [1] mem(x, set(y)) -> =(x, y) [1] mem(x, union(y, z)) -> or(mem(x, y), mem(x, z)) [1] or(v0, v1) -> null_or [0] The TRS has the following type information: or :: true:false:=:null_or -> true:false:=:null_or -> true:false:=:null_or true :: true:false:=:null_or false :: true:false:=:null_or mem :: a -> nil:set:union -> true:false:=:null_or nil :: nil:set:union set :: b -> nil:set:union = :: a -> b -> true:false:=:null_or union :: nil:set:union -> nil:set:union -> nil:set:union null_or :: true:false:=:null_or const :: a const1 :: b 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: true => 1 false => 0 nil => 0 null_or => 0 const => 0 const1 => 0 ---------------------------------------- (10) Obligation: Complexity RNTS consisting of the following rules: mem(z', z'') -{ 1 }-> or(mem(x, y), mem(x, z)) :|: z >= 0, z' = x, x >= 0, y >= 0, z'' = 1 + y + z mem(z', z'') -{ 1 }-> 0 :|: z'' = 0, z' = x, x >= 0 mem(z', z'') -{ 1 }-> 1 + x + y :|: z' = x, x >= 0, y >= 0, z'' = 1 + y or(z', z'') -{ 1 }-> 1 :|: z'' = y, y >= 0, z' = 1 or(z', z'') -{ 1 }-> 1 :|: z' = x, x >= 0, z'' = 1 or(z', z'') -{ 1 }-> 0 :|: z'' = 0, z' = 0 or(z', z'') -{ 0 }-> 0 :|: v0 >= 0, v1 >= 0, z'' = v1, z' = v0 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(V, V1),0,[or(V, V1, Out)],[V >= 0,V1 >= 0]). eq(start(V, V1),0,[mem(V, V1, Out)],[V >= 0,V1 >= 0]). eq(or(V, V1, Out),1,[],[Out = 1,V1 = V2,V2 >= 0,V = 1]). eq(or(V, V1, Out),1,[],[Out = 1,V = V3,V3 >= 0,V1 = 1]). eq(or(V, V1, Out),1,[],[Out = 0,V1 = 0,V = 0]). eq(mem(V, V1, Out),1,[],[Out = 0,V1 = 0,V = V4,V4 >= 0]). eq(mem(V, V1, Out),1,[],[Out = 1 + V5 + V6,V = V5,V5 >= 0,V6 >= 0,V1 = 1 + V6]). eq(mem(V, V1, Out),1,[mem(V7, V8, Ret0),mem(V7, V9, Ret1),or(Ret0, Ret1, Ret)],[Out = Ret,V9 >= 0,V = V7,V7 >= 0,V8 >= 0,V1 = 1 + V8 + V9]). eq(or(V, V1, Out),0,[],[Out = 0,V11 >= 0,V10 >= 0,V1 = V10,V = V11]). input_output_vars(or(V,V1,Out),[V,V1],[Out]). input_output_vars(mem(V,V1,Out),[V,V1],[Out]). CoFloCo proof output: Preprocessing Cost Relations ===================================== #### Computed strongly connected components 0. non_recursive : [or/3] 1. recursive [non_tail,multiple] : [mem/3] 2. non_recursive : [start/2] #### Obtained direct recursion through partial evaluation 0. SCC is partially evaluated into or/3 1. SCC is partially evaluated into mem/3 2. SCC is partially evaluated into start/2 Control-Flow Refinement of Cost Relations ===================================== ### Specialization of cost equations or/3 * CE 4 is refined into CE [10] * CE 3 is refined into CE [11] * CE 5 is refined into CE [12] * CE 6 is refined into CE [13] ### Cost equations --> "Loop" of or/3 * CEs [10] --> Loop 8 * CEs [11] --> Loop 9 * CEs [12,13] --> Loop 10 ### Ranking functions of CR or(V,V1,Out) #### Partial ranking functions of CR or(V,V1,Out) ### Specialization of cost equations mem/3 * CE 9 is refined into CE [14,15,16] * CE 8 is refined into CE [17] * CE 7 is refined into CE [18] ### Cost equations --> "Loop" of mem/3 * CEs [17] --> Loop 11 * CEs [18] --> Loop 12 * CEs [15] --> Loop 13 * CEs [14] --> Loop 14 * CEs [16] --> Loop 15 ### Ranking functions of CR mem(V,V1,Out) * RF of phase [13,14,15]: [V1] #### Partial ranking functions of CR mem(V,V1,Out) * Partial RF of phase [13,14,15]: - RF of loop [13:1,13:2,14:1,14:2,15:1,15:2]: V1 ### Specialization of cost equations start/2 * CE 1 is refined into CE [19,20,21] * CE 2 is refined into CE [22,23,24] ### Cost equations --> "Loop" of start/2 * CEs [20] --> Loop 16 * CEs [22] --> Loop 17 * CEs [19,21,23,24] --> Loop 18 ### Ranking functions of CR start(V,V1) #### Partial ranking functions of CR start(V,V1) Computing Bounds ===================================== #### Cost of chains of or(V,V1,Out): * Chain [10]: 1 with precondition: [Out=0,V>=0,V1>=0] * Chain [9]: 1 with precondition: [V=1,Out=1,V1>=0] * Chain [8]: 1 with precondition: [V1=1,Out=1,V>=0] #### Cost of chains of mem(V,V1,Out): * Chain [12]: 1 with precondition: [V1=0,Out=0,V>=0] * Chain [11]: 1 with precondition: [V+V1=Out,V>=0,V1>=1] * Chain [multiple([13,14,15],[[12],[11]])]: 6*it(13)+1*it([11])+1*it([12])+0 Such that:it([12]) =< V1+1 it([11]) =< V1/2+1/2 aux(1) =< V1 it(13) =< aux(1) it([11]) =< aux(1) with precondition: [1>=Out,V>=0,V1>=1,Out>=0,V+V1>=Out+1] #### Cost of chains of start(V,V1): * Chain [18]: 1*s(1)+1*s(2)+6*s(4)+1 Such that:s(3) =< V1 s(1) =< V1+1 s(2) =< V1/2+1/2 s(4) =< s(3) s(2) =< s(3) with precondition: [V>=0,V1>=0] * Chain [17]: 1 with precondition: [V1=0,V>=0] * Chain [16]: 1 with precondition: [V1=1,V>=0] Closed-form bounds of start(V,V1): ------------------------------------- * Chain [18] with precondition: [V>=0,V1>=0] - Upper bound: 15/2*V1+5/2 - Complexity: n * Chain [17] with precondition: [V1=0,V>=0] - Upper bound: 1 - Complexity: constant * Chain [16] with precondition: [V1=1,V>=0] - Upper bound: 1 - Complexity: constant ### Maximum cost of start(V,V1): 15/2*V1+5/2 Asymptotic class: n * Total analysis performed in 170 ms. ---------------------------------------- (12) BOUNDS(1, n^1) ---------------------------------------- (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: or(true, y) -> true or(x, true) -> true or(false, false) -> false mem(x, nil) -> false mem(x, set(y)) -> ='(x, y) mem(x, union(y, z)) -> or(mem(x, y), mem(x, z)) S is empty. Rewrite Strategy: FULL ---------------------------------------- (15) SlicingProof (LOWER BOUND(ID)) Sliced the following arguments: mem/0 set/0 ='/0 ='/1 ---------------------------------------- (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: or(true, y) -> true or(x, true) -> true or(false, false) -> false mem(nil) -> false mem(set) -> =' mem(union(y, z)) -> or(mem(y), mem(z)) S is empty. Rewrite Strategy: FULL ---------------------------------------- (17) TypeInferenceProof (BOTH BOUNDS(ID, ID)) Infered types. ---------------------------------------- (18) Obligation: TRS: Rules: or(true, y) -> true or(x, true) -> true or(false, false) -> false mem(nil) -> false mem(set) -> =' mem(union(y, z)) -> or(mem(y), mem(z)) Types: or :: true:false:=' -> true:false:=' -> true:false:=' true :: true:false:=' false :: true:false:=' mem :: nil:set:union -> true:false:=' nil :: nil:set:union set :: nil:set:union =' :: true:false:=' union :: nil:set:union -> nil:set:union -> nil:set:union hole_true:false:='1_0 :: true:false:=' hole_nil:set:union2_0 :: nil:set:union gen_nil:set:union3_0 :: Nat -> nil:set:union ---------------------------------------- (19) OrderProof (LOWER BOUND(ID)) Heuristically decided to analyse the following defined symbols: mem ---------------------------------------- (20) Obligation: TRS: Rules: or(true, y) -> true or(x, true) -> true or(false, false) -> false mem(nil) -> false mem(set) -> =' mem(union(y, z)) -> or(mem(y), mem(z)) Types: or :: true:false:=' -> true:false:=' -> true:false:=' true :: true:false:=' false :: true:false:=' mem :: nil:set:union -> true:false:=' nil :: nil:set:union set :: nil:set:union =' :: true:false:=' union :: nil:set:union -> nil:set:union -> nil:set:union hole_true:false:='1_0 :: true:false:=' hole_nil:set:union2_0 :: nil:set:union gen_nil:set:union3_0 :: Nat -> nil:set:union Generator Equations: gen_nil:set:union3_0(0) <=> nil gen_nil:set:union3_0(+(x, 1)) <=> union(nil, gen_nil:set:union3_0(x)) The following defined symbols remain to be analysed: mem ---------------------------------------- (21) RewriteLemmaProof (LOWER BOUND(ID)) Proved the following rewrite lemma: mem(gen_nil:set:union3_0(n5_0)) -> false, rt in Omega(1 + n5_0) Induction Base: mem(gen_nil:set:union3_0(0)) ->_R^Omega(1) false Induction Step: mem(gen_nil:set:union3_0(+(n5_0, 1))) ->_R^Omega(1) or(mem(nil), mem(gen_nil:set:union3_0(n5_0))) ->_R^Omega(1) or(false, mem(gen_nil:set:union3_0(n5_0))) ->_IH or(false, false) ->_R^Omega(1) false We have rt in Omega(n^1) and sz in O(n). Thus, we have irc_R in Omega(n). ---------------------------------------- (22) Obligation: Proved the lower bound n^1 for the following obligation: TRS: Rules: or(true, y) -> true or(x, true) -> true or(false, false) -> false mem(nil) -> false mem(set) -> =' mem(union(y, z)) -> or(mem(y), mem(z)) Types: or :: true:false:=' -> true:false:=' -> true:false:=' true :: true:false:=' false :: true:false:=' mem :: nil:set:union -> true:false:=' nil :: nil:set:union set :: nil:set:union =' :: true:false:=' union :: nil:set:union -> nil:set:union -> nil:set:union hole_true:false:='1_0 :: true:false:=' hole_nil:set:union2_0 :: nil:set:union gen_nil:set:union3_0 :: Nat -> nil:set:union Generator Equations: gen_nil:set:union3_0(0) <=> nil gen_nil:set:union3_0(+(x, 1)) <=> union(nil, gen_nil:set:union3_0(x)) The following defined symbols remain to be analysed: mem ---------------------------------------- (23) LowerBoundPropagationProof (FINISHED) Propagated lower bound. ---------------------------------------- (24) BOUNDS(n^1, INF)