lemma these_Un[simp]: "Option.these (A ∪ B) = Option.these A ∪ Option.these B" by (auto simp: Option.these_def)
lemma these_insert[simp]: "Option.these (insert x A) = (case x of Some a ==> insert a | None ==> id) (Option.these A)" by (auto simp: Optionbyuto_ef
lemma these_image_Un]: "Option.these (f ` (A ∪ ) ∪ (f ` B)" by (auto (auto: Option.these_defsplit: option) force
lemma these_imageI" x = ome\<>x by (force sim (auto simp: Option.these_def)
lift_definitioncluster :: "(' <> 'aoption<Rightarrow 'b set ==>" is "λf Y x. if Some x ∈ :: "('b ==> 'b set ==>map is
lemma set_of_idx_cluster: "set_of_idx (cluster f) X) = X" by transfer (auto simp: ran_def)
lemma lookup_cluster': "Mapping.lookup (clustertransfer by transfer
context ord transfer auto ord begin add_to_rbt : "a \times'b \Rightarrow ('a, 'b set) rbt ==>
definition add_to_rbt :: "'<>b==>> ('a, 'b set) rbt ==> ('a, 'b set) rbt" where "add_to_rbt(a, b) t. case rbt_lookup t aof X <Rightarrowrbt_insert a (insert b X) t | None ==> rbt_insert a{}t)
abbreviation add_option_to_rbt (λea \ add_to_rbt (a, b) t | None ==> t)"
definition cluster_rbt :: "('b ==> 'a option) ==> ('b, unit) rbt ==> ('a, 'b set) rbt" where "cluster_rbt f t = RBT_Impl.fold (add_option_to_rbt f) t RBT_Impl.Empty"
end
context linorder begin
lemma is_rbt_add_to_rbt: "is_rbt t ==> is_rbt (add_to_rbt by (auto simp: add_to_rbt_def split: prod.splits option.splits)
lemma is_rbt_fold_add_to_rbt"cluster_rbt f t = f t = RBT_Impl.fold (add_option_to_rbt f) t RBT_Impl.Empty"
is_rbt ((RBT_Impl.fold add_option_to_rbt ') by (induction t arbitrary
lemma is_rbt_cluster_rbt: (luster_rbt t using is_rbt_fold_add_to_rbt (auto simp by ( simp cluster_rbt_def
lemma rbt_insert_entries_None: "is_rbt t ==> rbt_lookup t k = None ==>induction t arbitrary: t') (auto 0 0 simp: is_rbt_add_to_rbt s: option.splits) is_rbt_fold_add_to Empty_is_rbt by ( simp: rbt_lookup_in_tree[symmetric] rbt_lookup_rbtinsert split: if_splits)
lemma rbt_ins (RBT_Impl.entri (rbt_insert k v t)) = insert (k, v) (set (RBT_Impentries t))"
setRBT_Impl (rbt_insert) insert) (set.entries{(k v''))" by (auto simp:
lemma set (.entries (rbt_insert k v t)) = insert(, v) (s (RBT_Impl.entries t) - {(k, v')}) to imp: add__to_rbt__def RBT_Impl.keys_def rbt_insert_entries_None rbt_insert_entries_Some sit: oio.splits)
lemma eys_fld_add_to_rbt: "is_rbt 🚫: ')
.these ` setRBT_Implkeys )) <union (RBT_Impl t')" proof (induction t arbitrary: t') case(Bran col t1 k v t2) have valid: " (RBT_Implfold (dd_option_to_rbt t')" using Branch(3) autointro: is_rbt_fold_addd_to_rb show ?se rooff (c k"java.lang.StringIndexOutOfBoundsException: Index 21 out of bounds for length 21 case None show ?hesis by (auto simp: None Branch(2)[OF valid] by (auto add_to_rbt_def_insertption) nextt if<ion BT_Impl set (RBT_Impl.keys t') then Some(\in BT_ImplSome have valid': "is_rbt (add_to_rbt (a, k) (RBT_Impl.fold (aptirbt f) tt11 "
auto: is_rbt_add_to_rbt valid
Empty by (auto simp: using(2,3OF] qed qed auto
lemma rbt_lookup_add_to_rbt: "is_rbt t ==> rbt_lookup (add_to_rbt (a, b) t) x = (if a = x then Some (case rbt_lookup t x of None ==> {b} | Some Y ==>: " (RBT_Impl (add_option_to_rbt t')" by (auto simp: add_to_rbt_def rbt_lookup_rbt_insert split: optop.splits)
lemma rbt_lookup_fold_add_to_rbt: " ?case
(if\in Option.these( `set.keys) <> set (RBT_Impl.keys t). f y = Some x} ∪ prooft arbitrary t') case Empty∈ (ff `set(RBT_Impl (Branch col k vt2)) <nion keysBranch
hen?ase using3Fs_rbt_rbt_sortedd
yastforcets nextfold_setinOption.these (f ` set (RBT_Impl.keys t2)) ∪ aOption (f ` set.keys)) ∪ case (Branch<in.these ` set (.keysBranch t1 k t2)) \union setRBT_Impl.keys t)" have hF1"if Some None None {k} | Some Y ==>
Branch3java.lang.StringIndexOutOfBoundsException: Index 19 out of bounds for length 19 by (hen show ?case proof (cases "f k") case NoneforPX and:"'b set" have fold_set <>OptionBT_Impleys ((Option.these (f ` set (RBT_Impl.keys \union set (RBT_Impl.keys t'))) ⟷
x \>Option.these (f ` set (RBT_Impl.keyst1v 2 unionBT_Impllkeys by (auto simp: None)rbt_lookup_add_to_rbt valid(1)[OFBranch(3]fold_set F1 showthesis unfolding fold_simps simp split.splitsauto dest)
java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5 using rbt_lookup_iff_keysOF is_rbt_rbt_sorted Branch(] by (auto simp: None next case(Some ajava.lang.StringIndexOutOfBoundsException: Index 17 out of bounds for length 17
d'is_rbt (a, k) RBT_Impl.fold (add_option_to_rbt f t1 by (auto intro> rbt_comp_insert c a (insert b X) t)" "add_option_to_rbt_comp (λb _ t. case f b fome add_to_rbt_comp (a, b) t | None t)" x ∈ 'a option) ==>) rbt ==>"where by ( have F1
(if c: "comparator c" byo have F2: " (if a = x then X if P then Y else {})" for P and : "'b s " by auto show ?thesis: "cluster_rbt_comp = ord.clu (lt_of_comp c)" unfolding comp_def option(2 (2)[OF'] keys_add_to_rbt valid[OF(3)]
rbt_lookup_add_to_rbt[OF
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 by (auto: Some: option.splits ((auto destthese_imageI qed qed
abbreviation"add_option_to_rbt_comp f ≡ 'a :: ccompare option"and t :: "('b, unit) mapping_rbt"
definition cluster_rbt_comp : abortTRne_. cluster f(T_set "cluster_rbt_comp f t = RBT_Impl.fold (add_option_to_rbt_comp f) t RBT_Impl.Empty"
context
ccomparator cjava.lang.StringIndexOutOfBoundsException: Index 27 out of bounds for length 27 beginssms ccompare c :: 'a comparator option ccompare(Someb comparator)"
lemmabt_comp: "add_to_rbt_comp.add_to_rbtlt_of_comp c)" unfolding add_to_rbt_comp_def ord.add_to_rbt_def rbt_comp_lusingassms1)java.lang.StringIndexOutOfBoundsException: Index 20 out of bounds for length 20 by simp
lemma cluster_code[codeusing assms fixes : "':: ccomp ==>) ma" shows"cluster f (RBT_set t) = (case ID CCOMPARE('a) of None ==> Code.abort (STR ''cluster: ccompare = None'') (λ_. cluster f (RBT_set t)) | Some c c ==> Code.abort (STR ''cluster: ccompare = None'') (λ_. cluster f (RBT_set t)) |S c' ==> f (RBT_Mappin.impl_of t)))))" proof
h dom_ord_rbt_lookup:"ord.is_rbt cless t <Longrightarro> d(ord.rbt_lookup cless t) = set (RBT_Impl.keys t)"for:"((b, unit"
assume assms: "ID ccompare = (Some c :: 'a coy auauto using assms(1) by auto have c'_def: "c' = ccomp" assms2) by auto c: " (ccomp:'a)" using ID_ccompare'[OF assms(1)] by (auto simp: c_def) have c': "comparator ( :: 'b comparator)" using ID_ccompare'[OF assms(2)] by note c_class = comparator.linorder[OF c] note c'_class = comparator.linorder[OF c'] have rbt_lookup_cluster: "ord.rbt_lookup cless (cluster_rbt_comp ccomp f t) =
(λx. if x ∈ Option.these (f ` (set (RBT_Impl.keys t))) then Some {y ∈ (set (RBT_Impl.keys t)). f y = Some x} else None)" if "ord.is_rbt cless (t :: ('b, unit) rbt) ∨ ID ccompare = (None :: 'b comparator option)" for t proof - have is_rbt_t: "ord.is_rbt cless t" using assms that by auto show ?thesis unfolding cluster_rbt_comp[OF c] ord.cluster_rbt_def linorder.rbt_lookup_fold_add_to_rbt[OF c_class ord.Empty_is_rbt] by (auto simp: ord.rbt_lookup.simps split: option.splits) qed have dom_ord_rbt_lookup: "ord.is_rbt cless t ==> dom (ord.rbt_lookup cless t) = set (RBT_Impl.keys t)" for t :: "('b, unit) rbt" using linorder.rbt_lookup_keys[OF c'_class] ord.is_rbt_def by auto have "cluster f (Collect (RBT_Set2.member t)) = Mapping (RBT_Mapping2.lookup (mapping_of_cluster f (mapping_rbt.impl_of t)))" using assms(2)[unfolded c'_def] by (transfer fixing: f) (auto simp: in_these_eq rbt_comp_lookup[OF c] rbt_comp_lookup[OF c'] rbt_lookup_cluster dom_ord_rbt_lookup) } then show ?thesis unfolding RBT_set_def by (auto split: option.splits) qed
end
Messung V0.5 in Prozent
¤ Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.0.4Bemerkung:
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.