src/HOL/Data_Structures/Interval_Tree.thy
changeset 72733 7b918b9f0122
parent 72586 e3ba2578ad9d
child 73655 26a1d66b9077
equal deleted inserted replaced
72732:bfd1022cd947 72733:7b918b9f0122
   263 
   263 
   264 locale Interval_Set = Set +
   264 locale Interval_Set = Set +
   265   fixes has_overlap :: "'t \<Rightarrow> 'a::linorder ivl \<Rightarrow> bool"
   265   fixes has_overlap :: "'t \<Rightarrow> 'a::linorder ivl \<Rightarrow> bool"
   266   assumes set_overlap: "invar s \<Longrightarrow> has_overlap s x = Interval_Tree.has_overlap (set s) x"
   266   assumes set_overlap: "invar s \<Longrightarrow> has_overlap s x = Interval_Tree.has_overlap (set s) x"
   267 
   267 
       
   268 fun invar :: "('a::{linorder,order_bot}) ivl_tree \<Rightarrow> bool" where
       
   269 "invar t = (inv_max_hi t \<and> sorted(inorder t))"
       
   270 
   268 interpretation S: Interval_Set
   271 interpretation S: Interval_Set
   269   where empty = Leaf and insert = insert and delete = delete
   272   where empty = Leaf and insert = insert and delete = delete
   270   and has_overlap = search and isin = isin and set = set_tree
   273   and has_overlap = search and isin = isin and set = set_tree
   271   and invar = "\<lambda>t. inv_max_hi t \<and> sorted (inorder t)"
   274   and invar = invar
   272 proof (standard, goal_cases)
   275 proof (standard, goal_cases)
   273   case 1
   276   case 1
   274   then show ?case by auto
   277   then show ?case by auto
   275 next
   278 next
   276   case 2
   279   case 2