src/HOL/Library/Quotient_Set.thy
changeset 44413 80d460bc6fa8
child 44459 079ccfb074d9
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/src/HOL/Library/Quotient_Set.thy	Tue Aug 23 03:34:17 2011 +0900
     1.3 @@ -0,0 +1,77 @@
     1.4 +(*  Title:      HOL/Library/Quotient_Set.thy
     1.5 +    Author:     Cezary Kaliszyk and Christian Urban
     1.6 +*)
     1.7 +
     1.8 +header {* Quotient infrastructure for the set type *}
     1.9 +
    1.10 +theory Quotient_Set
    1.11 +imports Main Quotient_Syntax
    1.12 +begin
    1.13 +
    1.14 +lemma set_quotient [quot_thm]:
    1.15 +  assumes "Quotient R Abs Rep"
    1.16 +  shows "Quotient (set_rel R) (vimage Rep) (vimage Abs)"
    1.17 +proof (rule QuotientI)
    1.18 +  from assms have "\<And>x. Abs (Rep x) = x" by (rule Quotient_abs_rep)
    1.19 +  then show "\<And>xs. Rep -` (Abs -` xs) = xs"
    1.20 +    unfolding vimage_def by auto
    1.21 +next
    1.22 +  show "\<And>xs. set_rel R (Abs -` xs) (Abs -` xs)"
    1.23 +    unfolding set_rel_def vimage_def
    1.24 +    by auto (metis Quotient_rel_abs[OF assms])+
    1.25 +next
    1.26 +  fix r s
    1.27 +  show "set_rel R r s = (set_rel R r r \<and> set_rel R s s \<and> Rep -` r = Rep -` s)"
    1.28 +    unfolding set_rel_def vimage_def set_eq_iff
    1.29 +    by auto (metis rep_abs_rsp[OF assms] assms[simplified Quotient_def])+
    1.30 +qed
    1.31 +
    1.32 +lemma empty_set_rsp[quot_respect]:
    1.33 +  "set_rel R {} {}"
    1.34 +  unfolding set_rel_def by simp
    1.35 +
    1.36 +lemma collect_rsp[quot_respect]:
    1.37 +  assumes "Quotient R Abs Rep"
    1.38 +  shows "((R ===> op =) ===> set_rel R) Collect Collect"
    1.39 +  by (auto intro!: fun_relI simp add: fun_rel_def set_rel_def)
    1.40 +
    1.41 +lemma collect_prs[quot_preserve]:
    1.42 +  assumes "Quotient R Abs Rep"
    1.43 +  shows "((Abs ---> id) ---> op -` Rep) Collect = Collect"
    1.44 +  unfolding fun_eq_iff
    1.45 +  by (simp add: Quotient_abs_rep[OF assms])
    1.46 +
    1.47 +lemma union_rsp[quot_respect]:
    1.48 +  assumes "Quotient R Abs Rep"
    1.49 +  shows "(set_rel R ===> set_rel R ===> set_rel R) op \<union> op \<union>"
    1.50 +  by (intro fun_relI) (auto simp add: set_rel_def)
    1.51 +
    1.52 +lemma union_prs[quot_preserve]:
    1.53 +  assumes "Quotient R Abs Rep"
    1.54 +  shows "(op -` Abs ---> op -` Abs ---> op -` Rep) op \<union> = op \<union>"
    1.55 +  unfolding fun_eq_iff
    1.56 +  by (simp add: Quotient_abs_rep[OF set_quotient[OF assms]])
    1.57 +
    1.58 +lemma diff_rsp[quot_respect]:
    1.59 +  assumes "Quotient R Abs Rep"
    1.60 +  shows "(set_rel R ===> set_rel R ===> set_rel R) op - op -"
    1.61 +  by (intro fun_relI) (auto simp add: set_rel_def)
    1.62 +
    1.63 +lemma diff_prs[quot_preserve]:
    1.64 +  assumes "Quotient R Abs Rep"
    1.65 +  shows "(op -` Abs ---> op -` Abs ---> op -` Rep) op - = op -"
    1.66 +  unfolding fun_eq_iff
    1.67 +  by (simp add: Quotient_abs_rep[OF set_quotient[OF assms]] vimage_Diff)
    1.68 +
    1.69 +lemma inter_rsp[quot_respect]:
    1.70 +  assumes "Quotient R Abs Rep"
    1.71 +  shows "(set_rel R ===> set_rel R ===> set_rel R) op \<inter> op \<inter>"
    1.72 +  by (intro fun_relI) (auto simp add: set_rel_def)
    1.73 +
    1.74 +lemma inter_prs[quot_preserve]:
    1.75 +  assumes "Quotient R Abs Rep"
    1.76 +  shows "(op -` Abs ---> op -` Abs ---> op -` Rep) op \<inter> = op \<inter>"
    1.77 +  unfolding fun_eq_iff
    1.78 +  by (simp add: Quotient_abs_rep[OF set_quotient[OF assms]])
    1.79 +
    1.80 +end