Theory Tree23_Set
section ‹2-3 Tree Implementation of Sets›
theory Tree23_Set
imports
Tree23
Cmp
Set_Specs
begin
declare sorted_wrt.simps(2)[simp del]
definition empty :: "'a tree23" where
"empty = Leaf"
fun isin :: "'a::linorder tree23 ⇒ 'a ⇒ bool" where
"isin Leaf x = False" |
"isin (Node2 l a r) x =
(case cmp x a of
LT ⇒ isin l x |
EQ ⇒ True |
GT ⇒ isin r x)" |
"isin (Node3 l a m b r) x =
(case cmp x a of
LT ⇒ isin l x |
EQ ⇒ True |
GT ⇒
(case cmp x b of
LT ⇒ isin m x |
EQ ⇒ True |
GT ⇒ isin r x))"