src/HOL/Enum.thy
changeset 40683 a3f37b3d303a
parent 40659 b26afaa55a75
child 40898 882e860a1e83
equal deleted inserted replaced
40682:1e761b5cd097 40683:a3f37b3d303a
    17 subclass finite proof
    17 subclass finite proof
    18 qed (simp add: UNIV_enum)
    18 qed (simp add: UNIV_enum)
    19 
    19 
    20 lemma enum_all: "set enum = UNIV" unfolding UNIV_enum ..
    20 lemma enum_all: "set enum = UNIV" unfolding UNIV_enum ..
    21 
    21 
    22 lemma in_enum [intro]: "x \<in> set enum"
    22 lemma in_enum: "x \<in> set enum"
    23   unfolding enum_all by auto
    23   unfolding enum_all by auto
    24 
    24 
    25 lemma enum_eq_I:
    25 lemma enum_eq_I:
    26   assumes "\<And>x. x \<in> set xs"
    26   assumes "\<And>x. x \<in> set xs"
    27   shows "set enum = set xs"
    27   shows "set enum = set xs"
   165 instance proof
   165 instance proof
   166   show "UNIV = set (enum \<Colon> ('a \<Rightarrow> 'b) list)"
   166   show "UNIV = set (enum \<Colon> ('a \<Rightarrow> 'b) list)"
   167   proof (rule UNIV_eq_I)
   167   proof (rule UNIV_eq_I)
   168     fix f :: "'a \<Rightarrow> 'b"
   168     fix f :: "'a \<Rightarrow> 'b"
   169     have "f = the \<circ> map_of (zip (enum \<Colon> 'a\<Colon>enum list) (map f enum))"
   169     have "f = the \<circ> map_of (zip (enum \<Colon> 'a\<Colon>enum list) (map f enum))"
   170       by (auto simp add: map_of_zip_map fun_eq_iff)
   170       by (auto simp add: map_of_zip_map fun_eq_iff intro: in_enum)
   171     then show "f \<in> set enum"
   171     then show "f \<in> set enum"
   172       by (auto simp add: enum_fun_def set_n_lists)
   172       by (auto simp add: enum_fun_def set_n_lists intro: in_enum)
   173   qed
   173   qed
   174 next
   174 next
   175   from map_of_zip_enum_inject
   175   from map_of_zip_enum_inject
   176   show "distinct (enum \<Colon> ('a \<Rightarrow> 'b) list)"
   176   show "distinct (enum \<Colon> ('a \<Rightarrow> 'b) list)"
   177     by (auto intro!: inj_onI simp add: enum_fun_def
   177     by (auto intro!: inj_onI simp add: enum_fun_def