src/HOL/Library/Executable_Set.thy
changeset 32705 04ce6bb14d85
parent 32680 faf6924430d9
parent 32702 457135bdd596
child 32881 13b153243ed4
equal deleted inserted replaced
32682:304a47739407 32705:04ce6bb14d85
     9 begin
     9 begin
    10 
    10 
    11 subsection {* Preprocessor setup *}
    11 subsection {* Preprocessor setup *}
    12 
    12 
    13 declare member [code] 
    13 declare member [code] 
       
    14 
       
    15 definition empty :: "'a set" where
       
    16   "empty = {}"
       
    17 
       
    18 declare empty_def [symmetric, code_unfold]
       
    19 
       
    20 definition inter :: "'a set \<Rightarrow> 'a set \<Rightarrow> 'a set" where
       
    21   "inter = op \<inter>"
       
    22 
       
    23 declare inter_def [symmetric, code_unfold]
       
    24 
       
    25 definition union :: "'a set \<Rightarrow> 'a set \<Rightarrow> 'a set" where
       
    26   "union = op \<union>"
       
    27 
       
    28 declare union_def [symmetric, code_unfold]
    14 
    29 
    15 definition subset :: "'a set \<Rightarrow> 'a set \<Rightarrow> bool" where
    30 definition subset :: "'a set \<Rightarrow> 'a set \<Rightarrow> bool" where
    16   "subset = op \<le>"
    31   "subset = op \<le>"
    17 
    32 
    18 declare subset_def [symmetric, code_unfold]
    33 declare subset_def [symmetric, code_unfold]
    64 
    79 
    65 consts_code
    80 consts_code
    66   Set ("\<module>Set")
    81   Set ("\<module>Set")
    67 
    82 
    68 consts_code
    83 consts_code
    69   "Set.empty"         ("{*Fset.empty*}")
    84   "empty"             ("{*Fset.empty*}")
    70   "List_Set.is_empty" ("{*Fset.is_empty*}")
    85   "List_Set.is_empty" ("{*Fset.is_empty*}")
    71   "Set.insert"        ("{*Fset.insert*}")
    86   "Set.insert"        ("{*Fset.insert*}")
    72   "List_Set.remove"   ("{*Fset.remove*}")
    87   "List_Set.remove"   ("{*Fset.remove*}")
    73   "Set.image"         ("{*Fset.map*}")
    88   "Set.image"         ("{*Fset.map*}")
    74   "List_Set.project"  ("{*Fset.filter*}")
    89   "List_Set.project"  ("{*Fset.filter*}")
    75   "Ball"              ("{*flip Fset.forall*}")
    90   "Ball"              ("{*flip Fset.forall*}")
    76   "Bex"               ("{*flip Fset.exists*}")
    91   "Bex"               ("{*flip Fset.exists*}")
    77   "op \<union>"              ("{*Fset.union*}")
    92   "union"             ("{*Fset.union*}")
    78   "op \<inter>"              ("{*Fset.inter*}")
    93   "inter"             ("{*Fset.inter*}")
    79   "op - \<Colon> 'a set \<Rightarrow> 'a set \<Rightarrow> 'a set" ("{*flip Fset.subtract*}")
    94   "op - \<Colon> 'a set \<Rightarrow> 'a set \<Rightarrow> 'a set" ("{*flip Fset.subtract*}")
    80   "Union"             ("{*Fset.Union*}")
    95   "Union"             ("{*Fset.Union*}")
    81   "Inter"             ("{*Fset.Inter*}")
    96   "Inter"             ("{*Fset.Inter*}")
    82   card                ("{*Fset.card*}")
    97   card                ("{*Fset.card*}")
    83   fold                ("{*foldl o flip*}")
    98   fold                ("{*foldl o flip*}")
    84 
    99 
    85 hide (open) const subset eq_set Inter Union flip
   100 hide (open) const empty inter union subset eq_set Inter Union flip
    86 
   101 
    87 end
   102 end