src/HOL/Set.thy
changeset 63365 5340fb6633d0
parent 63316 dff40165618c
child 63398 6bf5a8c78175
equal deleted inserted replaced
63364:4fa441c2f20c 63365:5340fb6633d0
    80   then show ?thesis by simp
    80   then show ?thesis by simp
    81 qed
    81 qed
    82 
    82 
    83 lemma set_eq_iff: "A = B \<longleftrightarrow> (\<forall>x. x \<in> A \<longleftrightarrow> x \<in> B)"
    83 lemma set_eq_iff: "A = B \<longleftrightarrow> (\<forall>x. x \<in> A \<longleftrightarrow> x \<in> B)"
    84   by (auto intro:set_eqI)
    84   by (auto intro:set_eqI)
       
    85 
       
    86 lemma Collect_eqI:
       
    87   assumes "\<And>x. P x = Q x"
       
    88   shows "Collect P = Collect Q"
       
    89   using assms by (auto intro: set_eqI)
    85 
    90 
    86 text \<open>Lifting of predicate class instances\<close>
    91 text \<open>Lifting of predicate class instances\<close>
    87 
    92 
    88 instantiation set :: (type) boolean_algebra
    93 instantiation set :: (type) boolean_algebra
    89 begin
    94 begin
   971   by auto
   976   by auto
   972 
   977 
   973 lemma range_composition: "range (\<lambda>x. f (g x)) = f ` range g"
   978 lemma range_composition: "range (\<lambda>x. f (g x)) = f ` range g"
   974   by auto
   979   by auto
   975 
   980 
       
   981 lemma range_eq_singletonD:
       
   982   assumes "range f = {a}"
       
   983   shows "f x = a"
       
   984   using assms by auto
       
   985 
   976 
   986 
   977 subsubsection \<open>Some rules with \<open>if\<close>\<close>
   987 subsubsection \<open>Some rules with \<open>if\<close>\<close>
   978 
   988 
   979 text \<open>Elimination of \<open>{x. \<dots> \<and> x = t \<and> \<dots>}\<close>.\<close>
   989 text \<open>Elimination of \<open>{x. \<dots> \<and> x = t \<and> \<dots>}\<close>.\<close>
   980 
   990 
  1857 lemma pairwise_image: "pairwise r (f ` s) \<longleftrightarrow> pairwise (\<lambda>x y. (f x \<noteq> f y) \<longrightarrow> r (f x) (f y)) s"
  1867 lemma pairwise_image: "pairwise r (f ` s) \<longleftrightarrow> pairwise (\<lambda>x y. (f x \<noteq> f y) \<longrightarrow> r (f x) (f y)) s"
  1858   by (force simp: pairwise_def)
  1868   by (force simp: pairwise_def)
  1859 
  1869 
  1860 lemma Int_emptyI: "(\<And>x. x \<in> A \<Longrightarrow> x \<in> B \<Longrightarrow> False) \<Longrightarrow> A \<inter> B = {}"
  1870 lemma Int_emptyI: "(\<And>x. x \<in> A \<Longrightarrow> x \<in> B \<Longrightarrow> False) \<Longrightarrow> A \<inter> B = {}"
  1861   by blast
  1871   by blast
       
  1872 
       
  1873 lemma in_image_insert_iff:
       
  1874   assumes "\<And>C. C \<in> B \<Longrightarrow> x \<notin> C"
       
  1875   shows "A \<in> insert x ` B \<longleftrightarrow> x \<in> A \<and> A - {x} \<in> B" (is "?P \<longleftrightarrow> ?Q")
       
  1876 proof
       
  1877   assume ?P then show ?Q
       
  1878     using assms by auto
       
  1879 next
       
  1880   assume ?Q
       
  1881   then have "x \<in> A" and "A - {x} \<in> B"
       
  1882     by simp_all
       
  1883   from \<open>A - {x} \<in> B\<close> have "insert x (A - {x}) \<in> insert x ` B"
       
  1884     by (rule imageI)
       
  1885   also from \<open>x \<in> A\<close>
       
  1886   have "insert x (A - {x}) = A"
       
  1887     by auto
       
  1888   finally show ?P .
       
  1889 qed
  1862 
  1890 
  1863 hide_const (open) member not_member
  1891 hide_const (open) member not_member
  1864 
  1892 
  1865 lemmas equalityI = subset_antisym
  1893 lemmas equalityI = subset_antisym
  1866 
  1894 
  1918 val vimage_Int = @{thm vimage_Int}
  1946 val vimage_Int = @{thm vimage_Int}
  1919 val vimage_Un = @{thm vimage_Un}
  1947 val vimage_Un = @{thm vimage_Un}
  1920 \<close>
  1948 \<close>
  1921 
  1949 
  1922 end
  1950 end
  1923