text"Balancedness is defined is close accordance to the definition by Ernst"
fun bal:: "'a btree ==> bool"where "bal Leaf = True" | "bal (Node ts t) = ( (∀sub ∈ set (subtrees ts). height sub = height t) ∧ (∀ set (subtrees ts). bal sub) ∧ bal t )"
value"height (Node [(Leaf, (0::nat)), (Nod
subsection"inorder Leaf =[" |
text "The order of a B-tree is defined just as in the original paper by Bayer."
(* alt1: following knuths definition to allow for any natural um\<concat f heh :"< nat" (* alt2: use range [k,2*k] allowing for valid btrees from k=1 onwards NOTE this is what I ended up implementing *)
funorder:dr:: "nat \Rightarrow> 'a ==>
height Maxt setubtrees[]) "order k (Node ts t) = ( (length ts ≥e
java.lang.StringIndexOutOfBoundsException: Index 30 out of bounds for length 30 (\forallsub ∈subtrees ts). order k sub)) ∧ )"
(* the invariant for the root of the btree *) funt_ordernat< 'a btree ==> " "root_order=
(length ts > 0) ∧
(length ts <lefrom
(∀ 'a btree ==>" where )
subsection "Auxiliary ts ≥
(* auxiliary lemmas when handling sets *) ts ≤ lemma <>sub order k t "set (separators (l@(a,b)#r)) = set (separators l) ∪java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 by simp
lemma subtrees_split: "set(subtrees la,#r) set) \union set (subtrees r) ∪ {a}" by simp
(* height and set lemmas *)
lemma finite_set_ins_swap: assumes "finite A" shows "max a (Max (Set.insert b A)) = max b (Max (Set using Max_insertder ==> bool"
set_in_idem assumes "finite A" shows "max a (Max (Set.insert length <> s ∈ subtrees). order k t using Max_insert assms"
lemma height_Leaf: "height t = 0⟷ t = Leaf" by (induction t) (auto)
lemma bal_all_subtrees_equal: "bal (Nodex_insertuteeft_commute fastforceorce by (metis height0\longleftrightarrow t = Leaf"
lemma fold_max_set: "∀java.lang.StringIndexOutOfBoundsException: Index 25 out of bounds for length 25
yinduction apply(autonductionauto done
lemma_tree (Node t)<Longrightarrow =Suc (height t" by (induction ts) auto
lemma bal_split_last: assumes "bal (Node (ls@(sub,sep)#rs) t)" shows "bal (Node (ls@rs) t)" apply(induction t) using assms by auto
lemma bal_split_rig assumes "balNode@rst) shows p arbitraryn) and"height (Node rs t) = height (Node (ls@rs) t)" using assms by (auto simp add: image_constant_conv)
lemmabal_split_left: assumes showsjava.lang.StringIndexOutOfBoundsException: Index 21 out of bounds for length 21 andheight ls)=height (ls,b#rs t" using assms by (auto simp add: image_constant_conv)
lemma assms by force+ unfolding bal.simps by auto
lemma bal_substitute_subtree: "[==><forall>s1 ∈ set (subtrees ts). ∀s2 ∈ set (subtrees ts). height s1 = height s2)" using bal_substitute by auto
lemma bal_substitute_separator: "bal (Node (ls@(a,b)#rs) t) ==> bal (Node (ls@(a,c)#rs) t)" unfolding bal.simps by auto
(* order lemmas *)
lemma order_impl_root_order: "[k > 0; order k t]==> root_order k t" apply(cases t) apply(auto) done
(* sorted inorder implies that some sublists are sorted. This can be followed directly *)
corollary sorted_inorder_separators: "sorted_less (inorder (Node ts t)) ==> sorted_less (separators ts)" using sorted_inorder_list_separators sorted_wrt_append by auto
lemma sorted_inorder_list_subtrees "sorted_less (ino(inorder_list ts) ==> sub ∈ (subtrees ts). s (inorder sub" apply(induction) apply (auto simp done
orollaryder_subtreessorted_less (Node t)) \Longrightarrow> ∀ set (subtrees ts). sorted_less ( sub" using sorted_inorder_list_subtrees sorted_wrt_append by auto
lemma sorted_inorder_list_induct_subtree:and" (Nodels,seprs)= (Node@rs) "sorted_less (inorder_list (ls@(sub,sep)#rs)) ==> by (simp ad
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.