src/HOL/Option.thy
changeset 36176 3fe7e97ccca8
parent 35719 99b6152aedf5
child 37880 3b9ca8d2c5fb
equal deleted inserted replaced
36175:5cec4ca719d1 36176:3fe7e97ccca8
    80 lemma option_map_o_sum_case [simp]:
    80 lemma option_map_o_sum_case [simp]:
    81     "map f o sum_case g h = sum_case (map f o g) (map f o h)"
    81     "map f o sum_case g h = sum_case (map f o g) (map f o h)"
    82   by (rule ext) (simp split: sum.split)
    82   by (rule ext) (simp split: sum.split)
    83 
    83 
    84 
    84 
    85 hide (open) const set map
    85 hide_const (open) set map
    86 
    86 
    87 subsubsection {* Code generator setup *}
    87 subsubsection {* Code generator setup *}
    88 
    88 
    89 definition is_none :: "'a option \<Rightarrow> bool" where
    89 definition is_none :: "'a option \<Rightarrow> bool" where
    90   [code_post]: "is_none x \<longleftrightarrow> x = None"
    90   [code_post]: "is_none x \<longleftrightarrow> x = None"
   100 
   100 
   101 lemma [code_unfold]:
   101 lemma [code_unfold]:
   102   "eq_class.eq x None \<longleftrightarrow> is_none x"
   102   "eq_class.eq x None \<longleftrightarrow> is_none x"
   103   by (simp add: eq is_none_none)
   103   by (simp add: eq is_none_none)
   104 
   104 
   105 hide (open) const is_none
   105 hide_const (open) is_none
   106 
   106 
   107 code_type option
   107 code_type option
   108   (SML "_ option")
   108   (SML "_ option")
   109   (OCaml "_ option")
   109   (OCaml "_ option")
   110   (Haskell "Maybe _")
   110   (Haskell "Maybe _")