src/HOL/Option.thy
changeset 58895 de0a4a76d7aa
parent 58889 5b7a9633cfa8
child 58916 229765cc3414
equal deleted inserted replaced
58894:447972249785 58895:de0a4a76d7aa
   127 lemma bind_rzero[simp]: "bind x (\<lambda>x. None) = None"
   127 lemma bind_rzero[simp]: "bind x (\<lambda>x. None) = None"
   128 by (cases x) auto
   128 by (cases x) auto
   129 
   129 
   130 lemma bind_cong: "x = y \<Longrightarrow> (\<And>a. y = Some a \<Longrightarrow> f a = g a) \<Longrightarrow> bind x f = bind y g"
   130 lemma bind_cong: "x = y \<Longrightarrow> (\<And>a. y = Some a \<Longrightarrow> f a = g a) \<Longrightarrow> bind x f = bind y g"
   131 by (cases x) auto
   131 by (cases x) auto
       
   132 
       
   133 lemma bind_split: "P (bind m f) 
       
   134   \<longleftrightarrow> (m = None \<longrightarrow> P None) \<and> (\<forall>v. m=Some v \<longrightarrow> P (f v))"
       
   135     by (cases m) auto
       
   136 
       
   137 lemma bind_split_asm: "P (bind m f) = (\<not>(
       
   138     m=None \<and> \<not>P None 
       
   139   \<or> (\<exists>x. m=Some x \<and> \<not>P (f x))))"
       
   140   by (cases m) auto
       
   141 
       
   142 lemmas bind_splits = bind_split bind_split_asm
   132 
   143 
   133 definition these :: "'a option set \<Rightarrow> 'a set"
   144 definition these :: "'a option set \<Rightarrow> 'a set"
   134 where
   145 where
   135   "these A = the ` {x \<in> A. x \<noteq> None}"
   146   "these A = the ` {x \<in> A. x \<noteq> None}"
   136 
   147