src/HOL/Library/RBT_Impl.thy
changeset 73212 87e3c180044a
parent 73211 bfa9f646f5ae
child 73526 a3cc9fa1295d
equal deleted inserted replaced
73211:bfa9f646f5ae 73212:87e3c180044a
  1881   "small_rbt t \<longleftrightarrow> bheight t < 4"
  1881   "small_rbt t \<longleftrightarrow> bheight t < 4"
  1882 
  1882 
  1883 definition flip_rbt :: "('a, 'b) rbt \<Rightarrow> ('a, 'b) rbt \<Rightarrow> bool" where
  1883 definition flip_rbt :: "('a, 'b) rbt \<Rightarrow> ('a, 'b) rbt \<Rightarrow> bool" where
  1884   "flip_rbt t1 t2 \<longleftrightarrow> bheight t2 < bheight t1"
  1884   "flip_rbt t1 t2 \<longleftrightarrow> bheight t2 < bheight t1"
  1885 
  1885 
  1886 abbreviation MR where "MR l a b r \<equiv> Branch RBT_Impl.R l a b r"
  1886 abbreviation (input) MR where "MR l a b r \<equiv> Branch RBT_Impl.R l a b r"
  1887 abbreviation MB where "MB l a b r \<equiv> Branch RBT_Impl.B l a b r"
  1887 abbreviation (input) MB where "MB l a b r \<equiv> Branch RBT_Impl.B l a b r"
  1888 
  1888 
  1889 fun rbt_baliL :: "('a, 'b) rbt \<Rightarrow> 'a \<Rightarrow> 'b \<Rightarrow> ('a, 'b) rbt \<Rightarrow> ('a, 'b) rbt" where
  1889 fun rbt_baliL :: "('a, 'b) rbt \<Rightarrow> 'a \<Rightarrow> 'b \<Rightarrow> ('a, 'b) rbt \<Rightarrow> ('a, 'b) rbt" where
  1890   "rbt_baliL (MR (MR t1 a b t2) a' b' t3) a'' b'' t4 = MR (MB t1 a b t2) a' b' (MB t3 a'' b'' t4)"
  1890   "rbt_baliL (MR (MR t1 a b t2) a' b' t3) a'' b'' t4 = MR (MB t1 a b t2) a' b' (MB t3 a'' b'' t4)"
  1891 | "rbt_baliL (MR t1 a b (MR t2 a' b' t3)) a'' b'' t4 = MR (MB t1 a b t2) a' b' (MB t3 a'' b'' t4)"
  1891 | "rbt_baliL (MR t1 a b (MR t2 a' b' t3)) a'' b'' t4 = MR (MB t1 a b t2) a' b' (MB t3 a'' b'' t4)"
  1892 | "rbt_baliL t1 a b t2 = MB t1 a b t2"
  1892 | "rbt_baliL t1 a b t2 = MB t1 a b t2"
  3080      (\<^const_name>\<open>rbt_union\<close>, SOME \<^typ>\<open>('a::linorder,'b) rbt \<Rightarrow> ('a,'b) rbt \<Rightarrow> ('a,'b) rbt\<close>),
  3080      (\<^const_name>\<open>rbt_union\<close>, SOME \<^typ>\<open>('a::linorder,'b) rbt \<Rightarrow> ('a,'b) rbt \<Rightarrow> ('a,'b) rbt\<close>),
  3081      (\<^const_name>\<open>rbt_map_entry\<close>, SOME \<^typ>\<open>'a::linorder \<Rightarrow> ('b \<Rightarrow> 'b) \<Rightarrow> ('a,'b) rbt \<Rightarrow> ('a,'b) rbt\<close>),
  3081      (\<^const_name>\<open>rbt_map_entry\<close>, SOME \<^typ>\<open>'a::linorder \<Rightarrow> ('b \<Rightarrow> 'b) \<Rightarrow> ('a,'b) rbt \<Rightarrow> ('a,'b) rbt\<close>),
  3082      (\<^const_name>\<open>rbt_bulkload\<close>, SOME \<^typ>\<open>('a \<times> 'b) list \<Rightarrow> ('a::linorder,'b) rbt\<close>)]
  3082      (\<^const_name>\<open>rbt_bulkload\<close>, SOME \<^typ>\<open>('a \<times> 'b) list \<Rightarrow> ('a::linorder,'b) rbt\<close>)]
  3083 \<close>
  3083 \<close>
  3084 
  3084 
  3085 hide_const (open) R B Empty entries keys fold gen_keys gen_entries
  3085 hide_const (open) MR MB R B Empty entries keys fold gen_keys gen_entries
  3086 
  3086 
  3087 end
  3087 end