src/HOL/Library/Executable_Set.thy
changeset 28939 08004ce1b167
parent 28522 eacb54d9e78d
child 29107 e70b9c2bee14
equal deleted inserted replaced
28927:7e631979922f 28939:08004ce1b167
    14 definition subset :: "'a set \<Rightarrow> 'a set \<Rightarrow> bool" where
    14 definition subset :: "'a set \<Rightarrow> 'a set \<Rightarrow> bool" where
    15   "subset = op \<le>"
    15   "subset = op \<le>"
    16 
    16 
    17 declare subset_def [symmetric, code unfold]
    17 declare subset_def [symmetric, code unfold]
    18 
    18 
    19 lemma "subset A B \<longleftrightarrow> (\<forall>x\<in>A. x \<in> B)"
    19 lemma [code]: "subset A B \<longleftrightarrow> (\<forall>x\<in>A. x \<in> B)"
    20   unfolding subset_def subset_eq ..
    20   unfolding subset_def subset_eq ..
    21 
    21 
    22 definition is_empty :: "'a set \<Rightarrow> bool" where
    22 definition is_empty :: "'a set \<Rightarrow> bool" where
    23   "is_empty A \<longleftrightarrow> A = {}"
    23   "is_empty A \<longleftrightarrow> A = {}"
    24 
    24 
    30 
    30 
    31 lemma [code]:
    31 lemma [code]:
    32   "a \<in> A \<longleftrightarrow> (\<exists>x\<in>A. x = a)"
    32   "a \<in> A \<longleftrightarrow> (\<exists>x\<in>A. x = a)"
    33   unfolding bex_triv_one_point1 ..
    33   unfolding bex_triv_one_point1 ..
    34 
    34 
    35 definition
    35 definition filter_set :: "('a \<Rightarrow> bool) \<Rightarrow> 'a set \<Rightarrow> 'a set" where
    36   filter_set :: "('a \<Rightarrow> bool) \<Rightarrow> 'a set \<Rightarrow> 'a set" where
       
    37   "filter_set P xs = {x\<in>xs. P x}"
    36   "filter_set P xs = {x\<in>xs. P x}"
    38 
    37 
    39 
    38 
    40 subsection {* Operations on lists *}
    39 subsection {* Operations on lists *}
    41 
    40