src/HOL/Library/Quotient_Set.thy
author kuncar
Mon May 13 13:59:04 2013 +0200 (2013-05-13)
changeset 51956 a4d81cdebf8b
parent 51377 7da251a6c16e
child 51994 82cc2aeb7d13
permissions -rw-r--r--
better support for domains in Lifting/Transfer = replace Domainp T by the actual invariant in a transferred goal
wenzelm@47455
     1
(*  Title:      HOL/Library/Quotient_Set.thy
kaliszyk@44413
     2
    Author:     Cezary Kaliszyk and Christian Urban
kaliszyk@44413
     3
*)
kaliszyk@44413
     4
kaliszyk@44413
     5
header {* Quotient infrastructure for the set type *}
kaliszyk@44413
     6
kaliszyk@44413
     7
theory Quotient_Set
kaliszyk@44413
     8
imports Main Quotient_Syntax
kaliszyk@44413
     9
begin
kaliszyk@44413
    10
huffman@47648
    11
subsection {* Relator for set type *}
huffman@47648
    12
huffman@47648
    13
definition set_rel :: "('a \<Rightarrow> 'b \<Rightarrow> bool) \<Rightarrow> 'a set \<Rightarrow> 'b set \<Rightarrow> bool"
huffman@47648
    14
  where "set_rel R = (\<lambda>A B. (\<forall>x\<in>A. \<exists>y\<in>B. R x y) \<and> (\<forall>y\<in>B. \<exists>x\<in>A. R x y))"
huffman@47648
    15
huffman@47648
    16
lemma set_relI:
huffman@47648
    17
  assumes "\<And>x. x \<in> A \<Longrightarrow> \<exists>y\<in>B. R x y"
huffman@47648
    18
  assumes "\<And>y. y \<in> B \<Longrightarrow> \<exists>x\<in>A. R x y"
huffman@47648
    19
  shows "set_rel R A B"
huffman@47648
    20
  using assms unfolding set_rel_def by simp
huffman@47648
    21
huffman@47648
    22
lemma set_rel_conversep: "set_rel (conversep R) = conversep (set_rel R)"
huffman@47648
    23
  unfolding set_rel_def by auto
huffman@47648
    24
kuncar@51377
    25
lemma set_rel_eq [relator_eq]: "set_rel (op =) = (op =)"
kuncar@51377
    26
  unfolding set_rel_def fun_eq_iff by auto
kuncar@51377
    27
kuncar@51377
    28
lemma set_rel_mono[relator_mono]:
kuncar@51377
    29
  assumes "A \<le> B"
kuncar@51377
    30
  shows "set_rel A \<le> set_rel B"
kuncar@51377
    31
using assms unfolding set_rel_def by blast
kuncar@51377
    32
kuncar@51377
    33
lemma set_rel_OO[relator_distr]: "set_rel R OO set_rel S = set_rel (R OO S)"
kuncar@51377
    34
  apply (rule sym)
huffman@47648
    35
  apply (intro ext, rename_tac X Z)
huffman@47648
    36
  apply (rule iffI)
huffman@47648
    37
  apply (rule_tac b="{y. (\<exists>x\<in>X. R x y) \<and> (\<exists>z\<in>Z. S y z)}" in relcomppI)
huffman@47648
    38
  apply (simp add: set_rel_def, fast)
huffman@47648
    39
  apply (simp add: set_rel_def, fast)
huffman@47648
    40
  apply (simp add: set_rel_def, fast)
huffman@47648
    41
  done
huffman@47648
    42
kuncar@51956
    43
lemma Domainp_set[relator_domain]:
kuncar@51956
    44
  assumes "Domainp T = R"
kuncar@51956
    45
  shows "Domainp (set_rel T) = (\<lambda>A. Ball A R)"
kuncar@51956
    46
using assms unfolding set_rel_def Domainp_iff[abs_def]
kuncar@51956
    47
apply (intro ext)
kuncar@51956
    48
apply (rule iffI) 
kuncar@51956
    49
apply blast
kuncar@51956
    50
apply (rename_tac A, rule_tac x="{y. \<exists>x\<in>A. T x y}" in exI, fast)
kuncar@51956
    51
done
kuncar@51956
    52
kuncar@47982
    53
lemma reflp_set_rel[reflexivity_rule]: "reflp R \<Longrightarrow> reflp (set_rel R)"
huffman@47648
    54
  unfolding reflp_def set_rel_def by fast
huffman@47648
    55
kuncar@47982
    56
lemma left_total_set_rel[reflexivity_rule]:
kuncar@47982
    57
  assumes lt_R: "left_total R"
kuncar@47982
    58
  shows "left_total (set_rel R)"
kuncar@47982
    59
proof -
kuncar@47982
    60
  {
kuncar@47982
    61
    fix A
kuncar@47982
    62
    let ?B = "{y. \<exists>x \<in> A. R x y}"
kuncar@47982
    63
    have "(\<forall>x\<in>A. \<exists>y\<in>?B. R x y) \<and> (\<forall>y\<in>?B. \<exists>x\<in>A. R x y)" using lt_R by(elim left_totalE) blast
kuncar@47982
    64
  }
kuncar@47982
    65
  then have "\<And>A. \<exists>B. (\<forall>x\<in>A. \<exists>y\<in>B. R x y) \<and> (\<forall>y\<in>B. \<exists>x\<in>A. R x y)" by blast
kuncar@47982
    66
  then show ?thesis by (auto simp: set_rel_def intro: left_totalI)
kuncar@47982
    67
qed
kuncar@47982
    68
huffman@47648
    69
lemma symp_set_rel: "symp R \<Longrightarrow> symp (set_rel R)"
huffman@47648
    70
  unfolding symp_def set_rel_def by fast
huffman@47648
    71
huffman@47648
    72
lemma transp_set_rel: "transp R \<Longrightarrow> transp (set_rel R)"
huffman@47648
    73
  unfolding transp_def set_rel_def by fast
huffman@47648
    74
huffman@47648
    75
lemma equivp_set_rel: "equivp R \<Longrightarrow> equivp (set_rel R)"
huffman@47648
    76
  by (blast intro: equivpI reflp_set_rel symp_set_rel transp_set_rel
huffman@47648
    77
    elim: equivpE)
huffman@47648
    78
huffman@47648
    79
lemma right_total_set_rel [transfer_rule]:
huffman@47648
    80
  "right_total A \<Longrightarrow> right_total (set_rel A)"
huffman@47648
    81
  unfolding right_total_def set_rel_def
huffman@47648
    82
  by (rule allI, rename_tac Y, rule_tac x="{x. \<exists>y\<in>Y. A x y}" in exI, fast)
huffman@47648
    83
huffman@47648
    84
lemma right_unique_set_rel [transfer_rule]:
huffman@47648
    85
  "right_unique A \<Longrightarrow> right_unique (set_rel A)"
huffman@47648
    86
  unfolding right_unique_def set_rel_def by fast
huffman@47648
    87
huffman@47648
    88
lemma bi_total_set_rel [transfer_rule]:
huffman@47648
    89
  "bi_total A \<Longrightarrow> bi_total (set_rel A)"
huffman@47648
    90
  unfolding bi_total_def set_rel_def
huffman@47648
    91
  apply safe
huffman@47648
    92
  apply (rename_tac X, rule_tac x="{y. \<exists>x\<in>X. A x y}" in exI, fast)
huffman@47648
    93
  apply (rename_tac Y, rule_tac x="{x. \<exists>y\<in>Y. A x y}" in exI, fast)
huffman@47648
    94
  done
huffman@47648
    95
huffman@47648
    96
lemma bi_unique_set_rel [transfer_rule]:
huffman@47648
    97
  "bi_unique A \<Longrightarrow> bi_unique (set_rel A)"
huffman@47648
    98
  unfolding bi_unique_def set_rel_def by fast
huffman@47648
    99
huffman@47648
   100
subsection {* Transfer rules for transfer package *}
huffman@47648
   101
huffman@47648
   102
subsubsection {* Unconditional transfer rules *}
huffman@47648
   103
huffman@47648
   104
lemma empty_transfer [transfer_rule]: "(set_rel A) {} {}"
huffman@47648
   105
  unfolding set_rel_def by simp
huffman@47648
   106
huffman@47648
   107
lemma insert_transfer [transfer_rule]:
huffman@47648
   108
  "(A ===> set_rel A ===> set_rel A) insert insert"
huffman@47648
   109
  unfolding fun_rel_def set_rel_def by auto
huffman@47648
   110
huffman@47648
   111
lemma union_transfer [transfer_rule]:
huffman@47648
   112
  "(set_rel A ===> set_rel A ===> set_rel A) union union"
huffman@47648
   113
  unfolding fun_rel_def set_rel_def by auto
huffman@47648
   114
huffman@47648
   115
lemma Union_transfer [transfer_rule]:
huffman@47648
   116
  "(set_rel (set_rel A) ===> set_rel A) Union Union"
huffman@47648
   117
  unfolding fun_rel_def set_rel_def by simp fast
huffman@47648
   118
huffman@47648
   119
lemma image_transfer [transfer_rule]:
huffman@47648
   120
  "((A ===> B) ===> set_rel A ===> set_rel B) image image"
huffman@47648
   121
  unfolding fun_rel_def set_rel_def by simp fast
huffman@47648
   122
huffman@47660
   123
lemma UNION_transfer [transfer_rule]:
huffman@47660
   124
  "(set_rel A ===> (A ===> set_rel B) ===> set_rel B) UNION UNION"
huffman@47660
   125
  unfolding SUP_def [abs_def] by transfer_prover
huffman@47660
   126
huffman@47648
   127
lemma Ball_transfer [transfer_rule]:
huffman@47648
   128
  "(set_rel A ===> (A ===> op =) ===> op =) Ball Ball"
huffman@47648
   129
  unfolding set_rel_def fun_rel_def by fast
huffman@47648
   130
huffman@47648
   131
lemma Bex_transfer [transfer_rule]:
huffman@47648
   132
  "(set_rel A ===> (A ===> op =) ===> op =) Bex Bex"
huffman@47648
   133
  unfolding set_rel_def fun_rel_def by fast
huffman@47648
   134
huffman@47648
   135
lemma Pow_transfer [transfer_rule]:
huffman@47648
   136
  "(set_rel A ===> set_rel (set_rel A)) Pow Pow"
huffman@47648
   137
  apply (rule fun_relI, rename_tac X Y, rule set_relI)
huffman@47648
   138
  apply (rename_tac X', rule_tac x="{y\<in>Y. \<exists>x\<in>X'. A x y}" in rev_bexI, clarsimp)
huffman@47648
   139
  apply (simp add: set_rel_def, fast)
huffman@47648
   140
  apply (rename_tac Y', rule_tac x="{x\<in>X. \<exists>y\<in>Y'. A x y}" in rev_bexI, clarsimp)
huffman@47648
   141
  apply (simp add: set_rel_def, fast)
huffman@47648
   142
  done
huffman@47648
   143
huffman@47922
   144
lemma set_rel_transfer [transfer_rule]:
huffman@47922
   145
  "((A ===> B ===> op =) ===> set_rel A ===> set_rel B ===> op =)
huffman@47922
   146
    set_rel set_rel"
huffman@47922
   147
  unfolding fun_rel_def set_rel_def by fast
huffman@47922
   148
kuncar@51956
   149
kuncar@51956
   150
subsubsection {* Rules requiring bi-unique, bi-total or right-total relations *}
huffman@47648
   151
huffman@47648
   152
lemma member_transfer [transfer_rule]:
huffman@47648
   153
  assumes "bi_unique A"
huffman@47648
   154
  shows "(A ===> set_rel A ===> op =) (op \<in>) (op \<in>)"
huffman@47648
   155
  using assms unfolding fun_rel_def set_rel_def bi_unique_def by fast
huffman@47648
   156
kuncar@51956
   157
lemma right_total_Collect_transfer[transfer_rule]:
kuncar@51956
   158
  assumes "right_total A"
kuncar@51956
   159
  shows "((A ===> op =) ===> set_rel A) (\<lambda>P. Collect (\<lambda>x. P x \<and> Domainp A x)) Collect"
kuncar@51956
   160
  using assms unfolding right_total_def set_rel_def fun_rel_def Domainp_iff by fast
kuncar@51956
   161
huffman@47648
   162
lemma Collect_transfer [transfer_rule]:
huffman@47648
   163
  assumes "bi_total A"
huffman@47648
   164
  shows "((A ===> op =) ===> set_rel A) Collect Collect"
huffman@47648
   165
  using assms unfolding fun_rel_def set_rel_def bi_total_def by fast
huffman@47648
   166
huffman@47648
   167
lemma inter_transfer [transfer_rule]:
huffman@47648
   168
  assumes "bi_unique A"
huffman@47648
   169
  shows "(set_rel A ===> set_rel A ===> set_rel A) inter inter"
huffman@47648
   170
  using assms unfolding fun_rel_def set_rel_def bi_unique_def by fast
huffman@47648
   171
huffman@47680
   172
lemma Diff_transfer [transfer_rule]:
huffman@47680
   173
  assumes "bi_unique A"
huffman@47680
   174
  shows "(set_rel A ===> set_rel A ===> set_rel A) (op -) (op -)"
huffman@47680
   175
  using assms unfolding fun_rel_def set_rel_def bi_unique_def
huffman@47680
   176
  unfolding Ball_def Bex_def Diff_eq
huffman@47680
   177
  by (safe, simp, metis, simp, metis)
huffman@47680
   178
huffman@47648
   179
lemma subset_transfer [transfer_rule]:
huffman@47648
   180
  assumes [transfer_rule]: "bi_unique A"
huffman@47648
   181
  shows "(set_rel A ===> set_rel A ===> op =) (op \<subseteq>) (op \<subseteq>)"
huffman@47648
   182
  unfolding subset_eq [abs_def] by transfer_prover
huffman@47648
   183
kuncar@51956
   184
lemma right_total_UNIV_transfer[transfer_rule]: 
kuncar@51956
   185
  assumes "right_total A"
kuncar@51956
   186
  shows "(set_rel A) (Collect (Domainp A)) UNIV"
kuncar@51956
   187
  using assms unfolding right_total_def set_rel_def Domainp_iff by blast
kuncar@51956
   188
huffman@47648
   189
lemma UNIV_transfer [transfer_rule]:
huffman@47648
   190
  assumes "bi_total A"
huffman@47648
   191
  shows "(set_rel A) UNIV UNIV"
huffman@47648
   192
  using assms unfolding set_rel_def bi_total_def by simp
huffman@47648
   193
kuncar@51956
   194
lemma right_total_Compl_transfer [transfer_rule]:
kuncar@51956
   195
  assumes [transfer_rule]: "bi_unique A" and [transfer_rule]: "right_total A"
kuncar@51956
   196
  shows "(set_rel A ===> set_rel A) (\<lambda>S. uminus S \<inter> Collect (Domainp A)) uminus"
kuncar@51956
   197
  unfolding Compl_eq [abs_def]
kuncar@51956
   198
  by (subst Collect_conj_eq[symmetric]) transfer_prover
kuncar@51956
   199
huffman@47648
   200
lemma Compl_transfer [transfer_rule]:
huffman@47648
   201
  assumes [transfer_rule]: "bi_unique A" and [transfer_rule]: "bi_total A"
huffman@47648
   202
  shows "(set_rel A ===> set_rel A) uminus uminus"
huffman@47648
   203
  unfolding Compl_eq [abs_def] by transfer_prover
huffman@47648
   204
kuncar@51956
   205
lemma right_total_Inter_transfer [transfer_rule]:
kuncar@51956
   206
  assumes [transfer_rule]: "bi_unique A" and [transfer_rule]: "right_total A"
kuncar@51956
   207
  shows "(set_rel (set_rel A) ===> set_rel A) (\<lambda>S. Inter S \<inter> Collect (Domainp A)) Inter"
kuncar@51956
   208
  unfolding Inter_eq[abs_def]
kuncar@51956
   209
  by (subst Collect_conj_eq[symmetric]) transfer_prover
kuncar@51956
   210
huffman@47648
   211
lemma Inter_transfer [transfer_rule]:
huffman@47648
   212
  assumes [transfer_rule]: "bi_unique A" and [transfer_rule]: "bi_total A"
huffman@47648
   213
  shows "(set_rel (set_rel A) ===> set_rel A) Inter Inter"
huffman@47648
   214
  unfolding Inter_eq [abs_def] by transfer_prover
huffman@47648
   215
kuncar@51956
   216
lemma filter_transfer [transfer_rule]:
kuncar@51956
   217
  assumes [transfer_rule]: "bi_unique A"
kuncar@51956
   218
  shows "((A ===> op=) ===> set_rel A ===> set_rel A) Set.filter Set.filter"
kuncar@51956
   219
  unfolding Set.filter_def[abs_def] fun_rel_def set_rel_def by blast
kuncar@51956
   220
huffman@47648
   221
lemma finite_transfer [transfer_rule]:
huffman@47648
   222
  assumes "bi_unique A"
huffman@47648
   223
  shows "(set_rel A ===> op =) finite finite"
huffman@47648
   224
  apply (rule fun_relI, rename_tac X Y)
huffman@47648
   225
  apply (rule iffI)
huffman@47648
   226
  apply (subgoal_tac "Y \<subseteq> (\<lambda>x. THE y. A x y) ` X")
huffman@47648
   227
  apply (erule finite_subset, erule finite_imageI)
huffman@47648
   228
  apply (rule subsetI, rename_tac y)
huffman@47648
   229
  apply (clarsimp simp add: set_rel_def)
huffman@47648
   230
  apply (drule (1) bspec, clarify)
huffman@47648
   231
  apply (rule image_eqI)
huffman@47648
   232
  apply (rule the_equality [symmetric])
huffman@47648
   233
  apply assumption
huffman@47648
   234
  apply (simp add: assms [unfolded bi_unique_def])
huffman@47648
   235
  apply assumption
huffman@47648
   236
  apply (subgoal_tac "X \<subseteq> (\<lambda>y. THE x. A x y) ` Y")
huffman@47648
   237
  apply (erule finite_subset, erule finite_imageI)
huffman@47648
   238
  apply (rule subsetI, rename_tac x)
huffman@47648
   239
  apply (clarsimp simp add: set_rel_def)
huffman@47648
   240
  apply (drule (1) bspec, clarify)
huffman@47648
   241
  apply (rule image_eqI)
huffman@47648
   242
  apply (rule the_equality [symmetric])
huffman@47648
   243
  apply assumption
huffman@47648
   244
  apply (simp add: assms [unfolded bi_unique_def])
huffman@47648
   245
  apply assumption
huffman@47648
   246
  done
huffman@47648
   247
huffman@47648
   248
subsection {* Setup for lifting package *}
huffman@47648
   249
kuncar@47777
   250
lemma Quotient_set[quot_map]:
huffman@47648
   251
  assumes "Quotient R Abs Rep T"
huffman@47648
   252
  shows "Quotient (set_rel R) (image Abs) (image Rep) (set_rel T)"
huffman@47648
   253
  using assms unfolding Quotient_alt_def4
kuncar@51377
   254
  apply (simp add: set_rel_OO[symmetric] set_rel_conversep)
huffman@47648
   255
  apply (simp add: set_rel_def, fast)
huffman@47648
   256
  done
huffman@47648
   257
huffman@47648
   258
lemma set_invariant_commute [invariant_commute]:
huffman@47648
   259
  "set_rel (Lifting.invariant P) = Lifting.invariant (\<lambda>A. Ball A P)"
huffman@47648
   260
  unfolding fun_eq_iff set_rel_def Lifting.invariant_def Ball_def by fast
huffman@47648
   261
huffman@47648
   262
subsection {* Contravariant set map (vimage) and set relator *}
huffman@47626
   263
huffman@47647
   264
definition "vset_rel R xs ys \<equiv> \<forall>x y. R x y \<longrightarrow> x \<in> xs \<longleftrightarrow> y \<in> ys"
huffman@47626
   265
huffman@47647
   266
lemma vset_rel_eq [id_simps]:
huffman@47647
   267
  "vset_rel op = = op ="
huffman@47647
   268
  by (subst fun_eq_iff, subst fun_eq_iff) (simp add: set_eq_iff vset_rel_def)
huffman@47626
   269
huffman@47647
   270
lemma vset_rel_equivp:
huffman@47626
   271
  assumes e: "equivp R"
huffman@47647
   272
  shows "vset_rel R xs ys \<longleftrightarrow> xs = ys \<and> (\<forall>x y. x \<in> xs \<longrightarrow> R x y \<longrightarrow> y \<in> xs)"
huffman@47647
   273
  unfolding vset_rel_def
huffman@47626
   274
  using equivp_reflp[OF e]
huffman@47626
   275
  by auto (metis, metis equivp_symp[OF e])
huffman@47626
   276
kaliszyk@44413
   277
lemma set_quotient [quot_thm]:
kuncar@47308
   278
  assumes "Quotient3 R Abs Rep"
huffman@47647
   279
  shows "Quotient3 (vset_rel R) (vimage Rep) (vimage Abs)"
kuncar@47308
   280
proof (rule Quotient3I)
kuncar@47308
   281
  from assms have "\<And>x. Abs (Rep x) = x" by (rule Quotient3_abs_rep)
kaliszyk@44413
   282
  then show "\<And>xs. Rep -` (Abs -` xs) = xs"
kaliszyk@44413
   283
    unfolding vimage_def by auto
kaliszyk@44413
   284
next
huffman@47647
   285
  show "\<And>xs. vset_rel R (Abs -` xs) (Abs -` xs)"
huffman@47647
   286
    unfolding vset_rel_def vimage_def
kuncar@47308
   287
    by auto (metis Quotient3_rel_abs[OF assms])+
kaliszyk@44413
   288
next
kaliszyk@44413
   289
  fix r s
huffman@47647
   290
  show "vset_rel R r s = (vset_rel R r r \<and> vset_rel R s s \<and> Rep -` r = Rep -` s)"
huffman@47647
   291
    unfolding vset_rel_def vimage_def set_eq_iff
kuncar@47308
   292
    by auto (metis rep_abs_rsp[OF assms] assms[simplified Quotient3_def])+
kaliszyk@44413
   293
qed
kaliszyk@44413
   294
huffman@47647
   295
declare [[mapQ3 set = (vset_rel, set_quotient)]]
kuncar@47094
   296
kaliszyk@44413
   297
lemma empty_set_rsp[quot_respect]:
huffman@47647
   298
  "vset_rel R {} {}"
huffman@47647
   299
  unfolding vset_rel_def by simp
kaliszyk@44413
   300
kaliszyk@44413
   301
lemma collect_rsp[quot_respect]:
kuncar@47308
   302
  assumes "Quotient3 R Abs Rep"
huffman@47647
   303
  shows "((R ===> op =) ===> vset_rel R) Collect Collect"
huffman@47647
   304
  by (intro fun_relI) (simp add: fun_rel_def vset_rel_def)
kaliszyk@44413
   305
kaliszyk@44413
   306
lemma collect_prs[quot_preserve]:
kuncar@47308
   307
  assumes "Quotient3 R Abs Rep"
kaliszyk@44413
   308
  shows "((Abs ---> id) ---> op -` Rep) Collect = Collect"
kaliszyk@44413
   309
  unfolding fun_eq_iff
kuncar@47308
   310
  by (simp add: Quotient3_abs_rep[OF assms])
kaliszyk@44413
   311
kaliszyk@44413
   312
lemma union_rsp[quot_respect]:
kuncar@47308
   313
  assumes "Quotient3 R Abs Rep"
huffman@47647
   314
  shows "(vset_rel R ===> vset_rel R ===> vset_rel R) op \<union> op \<union>"
huffman@47647
   315
  by (intro fun_relI) (simp add: vset_rel_def)
kaliszyk@44413
   316
kaliszyk@44413
   317
lemma union_prs[quot_preserve]:
kuncar@47308
   318
  assumes "Quotient3 R Abs Rep"
kaliszyk@44413
   319
  shows "(op -` Abs ---> op -` Abs ---> op -` Rep) op \<union> = op \<union>"
kaliszyk@44413
   320
  unfolding fun_eq_iff
kuncar@47308
   321
  by (simp add: Quotient3_abs_rep[OF set_quotient[OF assms]])
kaliszyk@44413
   322
kaliszyk@44413
   323
lemma diff_rsp[quot_respect]:
kuncar@47308
   324
  assumes "Quotient3 R Abs Rep"
huffman@47647
   325
  shows "(vset_rel R ===> vset_rel R ===> vset_rel R) op - op -"
huffman@47647
   326
  by (intro fun_relI) (simp add: vset_rel_def)
kaliszyk@44413
   327
kaliszyk@44413
   328
lemma diff_prs[quot_preserve]:
kuncar@47308
   329
  assumes "Quotient3 R Abs Rep"
kaliszyk@44413
   330
  shows "(op -` Abs ---> op -` Abs ---> op -` Rep) op - = op -"
kaliszyk@44413
   331
  unfolding fun_eq_iff
kuncar@47308
   332
  by (simp add: Quotient3_abs_rep[OF set_quotient[OF assms]] vimage_Diff)
kaliszyk@44413
   333
kaliszyk@44413
   334
lemma inter_rsp[quot_respect]:
kuncar@47308
   335
  assumes "Quotient3 R Abs Rep"
huffman@47647
   336
  shows "(vset_rel R ===> vset_rel R ===> vset_rel R) op \<inter> op \<inter>"
huffman@47647
   337
  by (intro fun_relI) (auto simp add: vset_rel_def)
kaliszyk@44413
   338
kaliszyk@44413
   339
lemma inter_prs[quot_preserve]:
kuncar@47308
   340
  assumes "Quotient3 R Abs Rep"
kaliszyk@44413
   341
  shows "(op -` Abs ---> op -` Abs ---> op -` Rep) op \<inter> = op \<inter>"
kaliszyk@44413
   342
  unfolding fun_eq_iff
kuncar@47308
   343
  by (simp add: Quotient3_abs_rep[OF set_quotient[OF assms]])
kaliszyk@44413
   344
kaliszyk@44459
   345
lemma mem_prs[quot_preserve]:
kuncar@47308
   346
  assumes "Quotient3 R Abs Rep"
kaliszyk@44459
   347
  shows "(Rep ---> op -` Abs ---> id) op \<in> = op \<in>"
kuncar@47308
   348
  by (simp add: fun_eq_iff Quotient3_abs_rep[OF assms])
kaliszyk@44459
   349
haftmann@45970
   350
lemma mem_rsp[quot_respect]:
huffman@47647
   351
  shows "(R ===> vset_rel R ===> op =) op \<in> op \<in>"
huffman@47647
   352
  by (intro fun_relI) (simp add: vset_rel_def)
kaliszyk@44459
   353
kaliszyk@44413
   354
end