src/HOL/Library/FSet.thy
author kuncar
Fri, 27 Sep 2013 14:43:26 +0200
changeset 53953 2f103a894ebe
child 53963 51e81874b6f6
permissions -rw-r--r--
new theory of finite sets as a subtype
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
53953
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
     1
(*  Title:      HOL/Library/FSet.thy
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
     2
    Author:     Ondrej Kuncar, TU Muenchen
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
     3
    Author:     Cezary Kaliszyk and Christian Urban
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
     4
*)
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
     5
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
     6
header {* Type of finite sets defined as a subtype of sets *}
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
     7
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
     8
theory FSet
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
     9
imports Main Conditionally_Complete_Lattices
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
    10
begin
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
    11
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
    12
subsection {* Definition of the type *}
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
    13
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
    14
typedef 'a fset = "{A :: 'a set. finite A}"  morphisms fset Abs_fset
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
    15
by auto
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
    16
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
    17
setup_lifting type_definition_fset
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
    18
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
    19
subsection {* Basic operations and type class instantiations *}
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
    20
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
    21
(* FIXME transfer and right_total vs. bi_total *)
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
    22
instantiation fset :: (finite) finite
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
    23
begin
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
    24
instance by default (transfer, simp)
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
    25
end
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
    26
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
    27
instantiation fset :: (type) "{bounded_lattice_bot, distrib_lattice, minus}"
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
    28
begin
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
    29
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
    30
interpretation lifting_syntax .
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
    31
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
    32
lift_definition bot_fset :: "'a fset" is "{}" parametric empty_transfer by simp 
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
    33
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
    34
lift_definition less_eq_fset :: "'a fset \<Rightarrow> 'a fset \<Rightarrow> bool" is subset_eq parametric subset_transfer 
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
    35
  by simp
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
    36
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
    37
definition less_fset :: "'a fset \<Rightarrow> 'a fset \<Rightarrow> bool" where "xs < ys \<equiv> xs \<le> ys \<and> xs \<noteq> (ys::'a fset)"
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
    38
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
    39
lemma less_fset_transfer[transfer_rule]:
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
    40
  assumes [transfer_rule]: "bi_unique A" 
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
    41
  shows "((pcr_fset A) ===> (pcr_fset A) ===> op =) op \<subset> op <"
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
    42
  unfolding less_fset_def[abs_def] psubset_eq[abs_def] by transfer_prover
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
    43
  
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
    44
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
    45
lift_definition sup_fset :: "'a fset \<Rightarrow> 'a fset \<Rightarrow> 'a fset" is union parametric union_transfer
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
    46
  by simp
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
    47
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
    48
lift_definition inf_fset :: "'a fset \<Rightarrow> 'a fset \<Rightarrow> 'a fset" is inter parametric inter_transfer
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
    49
  by simp
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
    50
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
    51
lift_definition minus_fset :: "'a fset \<Rightarrow> 'a fset \<Rightarrow> 'a fset" is minus parametric Diff_transfer
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
    52
  by simp
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
    53
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
    54
instance
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
    55
by default (transfer, auto)+
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
    56
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
    57
end
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
    58
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
    59
abbreviation fempty :: "'a fset" ("{||}") where "{||} \<equiv> bot"
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
    60
abbreviation fsubset_eq :: "'a fset \<Rightarrow> 'a fset \<Rightarrow> bool" (infix "|\<subseteq>|" 50) where "xs |\<subseteq>| ys \<equiv> xs \<le> ys"
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
    61
abbreviation fsubset :: "'a fset \<Rightarrow> 'a fset \<Rightarrow> bool" (infix "|\<subset>|" 50) where "xs |\<subset>| ys \<equiv> xs < ys"
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
    62
abbreviation funion :: "'a fset \<Rightarrow> 'a fset \<Rightarrow> 'a fset" (infixl "|\<union>|" 65) where "xs |\<union>| ys \<equiv> sup xs ys"
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
    63
abbreviation finter :: "'a fset \<Rightarrow> 'a fset \<Rightarrow> 'a fset" (infixl "|\<inter>|" 65) where "xs |\<inter>| ys \<equiv> inf xs ys"
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
    64
abbreviation fminus :: "'a fset \<Rightarrow> 'a fset \<Rightarrow> 'a fset" (infixl "|-|" 65) where "xs |-| ys \<equiv> minus xs ys"
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
    65
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
    66
instantiation fset :: (type) conditionally_complete_lattice
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
    67
begin
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
    68
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
    69
interpretation lifting_syntax .
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
    70
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
    71
lemma right_total_Inf_fset_transfer:
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
    72
  assumes [transfer_rule]: "bi_unique A" and [transfer_rule]: "right_total A"
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
    73
  shows "(set_rel (set_rel A) ===> set_rel A) 
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
    74
    (\<lambda>S. if finite (Inter S \<inter> Collect (Domainp A)) then Inter S \<inter> Collect (Domainp A) else {}) 
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
    75
      (\<lambda>S. if finite (Inf S) then Inf S else {})"
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
    76
    by transfer_prover
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
    77
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
    78
lemma Inf_fset_transfer:
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
    79
  assumes [transfer_rule]: "bi_unique A" and [transfer_rule]: "bi_total A"
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
    80
  shows "(set_rel (set_rel A) ===> set_rel A) (\<lambda>A. if finite (Inf A) then Inf A else {}) 
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
    81
    (\<lambda>A. if finite (Inf A) then Inf A else {})"
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
    82
  by transfer_prover
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
    83
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
    84
lift_definition Inf_fset :: "'a fset set \<Rightarrow> 'a fset" is "\<lambda>A. if finite (Inf A) then Inf A else {}" 
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
    85
parametric right_total_Inf_fset_transfer Inf_fset_transfer by simp
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
    86
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
    87
lemma Sup_fset_transfer:
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
    88
  assumes [transfer_rule]: "bi_unique A"
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
    89
  shows "(set_rel (set_rel A) ===> set_rel A) (\<lambda>A. if finite (Sup A) then Sup A else {})
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
    90
  (\<lambda>A. if finite (Sup A) then Sup A else {})" by transfer_prover
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
    91
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
    92
lift_definition Sup_fset :: "'a fset set \<Rightarrow> 'a fset" is "\<lambda>A. if finite (Sup A) then Sup A else {}"
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
    93
parametric Sup_fset_transfer by simp
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
    94
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
    95
lemma finite_Sup: "\<exists>z. finite z \<and> (\<forall>a. a \<in> X \<longrightarrow> a \<le> z) \<Longrightarrow> finite (Sup X)"
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
    96
by (auto intro: finite_subset)
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
    97
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
    98
instance
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
    99
proof 
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   100
  fix x z :: "'a fset"
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   101
  fix X :: "'a fset set"
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   102
  {
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   103
    assume "x \<in> X" "(\<And>a. a \<in> X \<Longrightarrow> z |\<subseteq>| a)" 
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   104
    then show "Inf X |\<subseteq>| x"  by transfer auto
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   105
  next
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   106
    assume "X \<noteq> {}" "(\<And>x. x \<in> X \<Longrightarrow> z |\<subseteq>| x)"
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   107
    then show "z |\<subseteq>| Inf X" by transfer (clarsimp, blast)
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   108
  next
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   109
    assume "x \<in> X" "(\<And>a. a \<in> X \<Longrightarrow> a |\<subseteq>| z)"
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   110
    then show "x |\<subseteq>| Sup X" by transfer (auto intro!: finite_Sup)
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   111
  next
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   112
    assume "X \<noteq> {}" "(\<And>x. x \<in> X \<Longrightarrow> x |\<subseteq>| z)"
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   113
    then show "Sup X |\<subseteq>| z" by transfer (clarsimp, blast)
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   114
  }
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   115
qed
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   116
end
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   117
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   118
instantiation fset :: (finite) complete_lattice 
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   119
begin
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   120
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   121
lift_definition top_fset :: "'a fset" is UNIV parametric right_total_UNIV_transfer UNIV_transfer by simp
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   122
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   123
instance by default (transfer, auto)+
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   124
end
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   125
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   126
instantiation fset :: (finite) complete_boolean_algebra
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   127
begin
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   128
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   129
lift_definition uminus_fset :: "'a fset \<Rightarrow> 'a fset" is uminus 
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   130
  parametric right_total_Compl_transfer Compl_transfer by simp
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   131
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   132
instance by (default, simp_all only: INF_def SUP_def) (transfer, auto)+
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   133
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   134
end
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   135
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   136
abbreviation fUNIV :: "'a::finite fset" where "fUNIV \<equiv> top"
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   137
abbreviation fuminus :: "'a::finite fset \<Rightarrow> 'a fset" ("|-| _" [81] 80) where "|-| x \<equiv> uminus x"
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   138
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   139
subsection {* Other operations *}
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   140
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   141
lift_definition finsert :: "'a \<Rightarrow> 'a fset \<Rightarrow> 'a fset" is insert parametric Lifting_Set.insert_transfer
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   142
  by simp
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   143
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   144
syntax
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   145
  "_insert_fset"     :: "args => 'a fset"  ("{|(_)|}")
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   146
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   147
translations
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   148
  "{|x, xs|}" == "CONST finsert x {|xs|}"
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   149
  "{|x|}"     == "CONST finsert x {||}"
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   150
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   151
lift_definition fmember :: "'a \<Rightarrow> 'a fset \<Rightarrow> bool" (infix "|\<in>|" 50) is Set.member 
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   152
  parametric member_transfer by simp
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   153
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   154
abbreviation notin_fset :: "'a \<Rightarrow> 'a fset \<Rightarrow> bool" (infix "|\<notin>|" 50) where "x |\<notin>| S \<equiv> \<not> (x |\<in>| S)"
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   155
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   156
context
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   157
begin
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   158
interpretation lifting_syntax .
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   159
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   160
lift_definition ffilter :: "('a \<Rightarrow> bool) \<Rightarrow> 'a fset \<Rightarrow> 'a fset" is Set.filter 
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   161
  parametric Lifting_Set.filter_transfer unfolding Set.filter_def by simp
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   162
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   163
lemma compose_rel_to_Domainp:
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   164
  assumes "left_unique R"
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   165
  assumes "(R ===> op=) P P'"
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   166
  shows "(R OO Lifting.invariant P' OO R\<inverse>\<inverse>) x y \<longleftrightarrow> Domainp R x \<and> P x \<and> x = y"
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   167
using assms unfolding OO_def conversep_iff Domainp_iff left_unique_def fun_rel_def invariant_def
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   168
by blast
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   169
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   170
lift_definition fPow :: "'a fset \<Rightarrow> 'a fset fset" is Pow parametric Pow_transfer 
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   171
by (subst compose_rel_to_Domainp [OF _ finite_transfer]) (auto intro: transfer_raw finite_subset 
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   172
  simp add: fset.pcr_cr_eq[symmetric] Domainp_set fset.domain_eq)
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   173
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   174
lift_definition fcard :: "'a fset \<Rightarrow> nat" is card parametric card_transfer by simp
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   175
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   176
lift_definition fimage :: "('a \<Rightarrow> 'b) \<Rightarrow> 'a fset \<Rightarrow> 'b fset" (infixr "|`|" 90) is image 
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   177
  parametric image_transfer by simp
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   178
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   179
lift_definition fthe_elem :: "'a fset \<Rightarrow> 'a" is the_elem ..
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   180
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   181
(* FIXME why is not invariant here unfolded ? *)
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   182
lift_definition fbind :: "'a fset \<Rightarrow> ('a \<Rightarrow> 'b fset) \<Rightarrow> 'b fset" is Set.bind parametric bind_transfer
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   183
unfolding invariant_def Set.bind_def by clarsimp metis
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   184
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   185
lift_definition ffUnion :: "'a fset fset \<Rightarrow> 'a fset" is Union parametric Union_transfer
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   186
by (subst(asm) compose_rel_to_Domainp [OF _ finite_transfer])
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   187
  (auto intro: transfer_raw simp add: fset.pcr_cr_eq[symmetric] Domainp_set fset.domain_eq invariant_def)
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   188
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   189
lift_definition fBall :: "'a fset \<Rightarrow> ('a \<Rightarrow> bool) \<Rightarrow> bool" is Ball parametric Ball_transfer ..
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   190
lift_definition fBex :: "'a fset \<Rightarrow> ('a \<Rightarrow> bool) \<Rightarrow> bool" is Bex parametric Bex_transfer ..
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   191
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   192
subsection {* Transferred lemmas from Set.thy *}
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   193
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   194
lemmas fset_eqI = set_eqI[Transfer.transferred]
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   195
lemmas fset_eq_iff[no_atp] = set_eq_iff[Transfer.transferred]
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   196
lemmas fBallI[intro!] = ballI[Transfer.transferred]
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   197
lemmas fbspec[dest?] = bspec[Transfer.transferred]
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   198
lemmas fBallE[elim] = ballE[Transfer.transferred]
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   199
lemmas fBexI[intro] = bexI[Transfer.transferred]
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   200
lemmas rev_fBexI[intro?] = rev_bexI[Transfer.transferred]
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   201
lemmas fBexCI = bexCI[Transfer.transferred]
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   202
lemmas fBexE[elim!] = bexE[Transfer.transferred]
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   203
lemmas fBall_triv[simp] = ball_triv[Transfer.transferred]
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   204
lemmas fBex_triv[simp] = bex_triv[Transfer.transferred]
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   205
lemmas fBex_triv_one_point1[simp] = bex_triv_one_point1[Transfer.transferred]
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   206
lemmas fBex_triv_one_point2[simp] = bex_triv_one_point2[Transfer.transferred]
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   207
lemmas fBex_one_point1[simp] = bex_one_point1[Transfer.transferred]
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   208
lemmas fBex_one_point2[simp] = bex_one_point2[Transfer.transferred]
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   209
lemmas fBall_one_point1[simp] = ball_one_point1[Transfer.transferred]
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   210
lemmas fBall_one_point2[simp] = ball_one_point2[Transfer.transferred]
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   211
lemmas fBall_conj_distrib = ball_conj_distrib[Transfer.transferred]
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   212
lemmas fBex_disj_distrib = bex_disj_distrib[Transfer.transferred]
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   213
lemmas fBall_cong = ball_cong[Transfer.transferred]
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   214
lemmas fBex_cong = bex_cong[Transfer.transferred]
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   215
lemmas subfsetI[intro!] = subsetI[Transfer.transferred]
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   216
lemmas subfsetD[elim, intro?] = subsetD[Transfer.transferred]
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   217
lemmas rev_subfsetD[no_atp,intro?] = rev_subsetD[Transfer.transferred]
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   218
lemmas subfsetCE[no_atp,elim] = subsetCE[Transfer.transferred]
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   219
lemmas subfset_eq[no_atp] = subset_eq[Transfer.transferred]
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   220
lemmas contra_subfsetD[no_atp] = contra_subsetD[Transfer.transferred]
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   221
lemmas subfset_refl = subset_refl[Transfer.transferred]
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   222
lemmas subfset_trans = subset_trans[Transfer.transferred]
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   223
lemmas fset_rev_mp = set_rev_mp[Transfer.transferred]
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   224
lemmas fset_mp = set_mp[Transfer.transferred]
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   225
lemmas subfset_not_subfset_eq[code] = subset_not_subset_eq[Transfer.transferred]
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   226
lemmas eq_fmem_trans = eq_mem_trans[Transfer.transferred]
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   227
lemmas subfset_antisym[intro!] = subset_antisym[Transfer.transferred]
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   228
lemmas fequalityD1 = equalityD1[Transfer.transferred]
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   229
lemmas fequalityD2 = equalityD2[Transfer.transferred]
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   230
lemmas fequalityE = equalityE[Transfer.transferred]
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   231
lemmas fequalityCE[elim] = equalityCE[Transfer.transferred]
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   232
lemmas eqfset_imp_iff = eqset_imp_iff[Transfer.transferred]
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   233
lemmas eqfelem_imp_iff = eqelem_imp_iff[Transfer.transferred]
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   234
lemmas fempty_iff[simp] = empty_iff[Transfer.transferred]
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   235
lemmas fempty_subfsetI[iff] = empty_subsetI[Transfer.transferred]
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   236
lemmas equalsffemptyI = equals0I[Transfer.transferred]
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   237
lemmas equalsffemptyD = equals0D[Transfer.transferred]
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   238
lemmas fBall_fempty[simp] = ball_empty[Transfer.transferred]
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   239
lemmas fBex_fempty[simp] = bex_empty[Transfer.transferred]
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   240
lemmas fPow_iff[iff] = Pow_iff[Transfer.transferred]
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   241
lemmas fPowI = PowI[Transfer.transferred]
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   242
lemmas fPowD = PowD[Transfer.transferred]
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   243
lemmas fPow_bottom = Pow_bottom[Transfer.transferred]
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   244
lemmas fPow_top = Pow_top[Transfer.transferred]
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   245
lemmas fPow_not_fempty = Pow_not_empty[Transfer.transferred]
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   246
lemmas finter_iff[simp] = Int_iff[Transfer.transferred]
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   247
lemmas finterI[intro!] = IntI[Transfer.transferred]
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   248
lemmas finterD1 = IntD1[Transfer.transferred]
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   249
lemmas finterD2 = IntD2[Transfer.transferred]
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   250
lemmas finterE[elim!] = IntE[Transfer.transferred]
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   251
lemmas funion_iff[simp] = Un_iff[Transfer.transferred]
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   252
lemmas funionI1[elim?] = UnI1[Transfer.transferred]
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   253
lemmas funionI2[elim?] = UnI2[Transfer.transferred]
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   254
lemmas funionCI[intro!] = UnCI[Transfer.transferred]
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   255
lemmas funionE[elim!] = UnE[Transfer.transferred]
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   256
lemmas fminus_iff[simp] = Diff_iff[Transfer.transferred]
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   257
lemmas fminusI[intro!] = DiffI[Transfer.transferred]
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   258
lemmas fminusD1 = DiffD1[Transfer.transferred]
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   259
lemmas fminusD2 = DiffD2[Transfer.transferred]
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   260
lemmas fminusE[elim!] = DiffE[Transfer.transferred]
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   261
lemmas finsert_iff[simp] = insert_iff[Transfer.transferred]
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   262
lemmas finsertI1 = insertI1[Transfer.transferred]
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   263
lemmas finsertI2 = insertI2[Transfer.transferred]
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   264
lemmas finsertE[elim!] = insertE[Transfer.transferred]
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   265
lemmas finsertCI[intro!] = insertCI[Transfer.transferred]
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   266
lemmas subfset_finsert_iff = subset_insert_iff[Transfer.transferred]
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   267
lemmas finsert_ident = insert_ident[Transfer.transferred]
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   268
lemmas fsingletonI[intro!,no_atp] = singletonI[Transfer.transferred]
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   269
lemmas fsingletonD[dest!,no_atp] = singletonD[Transfer.transferred]
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   270
lemmas fsingleton_iff = singleton_iff[Transfer.transferred]
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   271
lemmas fsingleton_inject[dest!] = singleton_inject[Transfer.transferred]
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   272
lemmas fsingleton_finsert_inj_eq[iff,no_atp] = singleton_insert_inj_eq[Transfer.transferred]
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   273
lemmas fsingleton_finsert_inj_eq'[iff,no_atp] = singleton_insert_inj_eq'[Transfer.transferred]
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   274
lemmas subfset_fsingletonD = subset_singletonD[Transfer.transferred]
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   275
lemmas fminus_single_finsert = diff_single_insert[Transfer.transferred]
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   276
lemmas fdoubleton_eq_iff = doubleton_eq_iff[Transfer.transferred]
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   277
lemmas funion_fsingleton_iff = Un_singleton_iff[Transfer.transferred]
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   278
lemmas fsingleton_funion_iff = singleton_Un_iff[Transfer.transferred]
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   279
lemmas fimage_eqI[simp, intro] = image_eqI[Transfer.transferred]
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   280
lemmas fimageI = imageI[Transfer.transferred]
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   281
lemmas rev_fimage_eqI = rev_image_eqI[Transfer.transferred]
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   282
lemmas fimageE[elim!] = imageE[Transfer.transferred]
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   283
lemmas Compr_fimage_eq = Compr_image_eq[Transfer.transferred]
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   284
lemmas fimage_funion = image_Un[Transfer.transferred]
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   285
lemmas fimage_iff = image_iff[Transfer.transferred]
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   286
lemmas fimage_subfset_iff[no_atp] = image_subset_iff[Transfer.transferred]
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   287
lemmas fimage_subfsetI = image_subsetI[Transfer.transferred]
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   288
lemmas fimage_ident[simp] = image_ident[Transfer.transferred]
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   289
lemmas split_if_fmem1 = split_if_mem1[Transfer.transferred]
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   290
lemmas split_if_fmem2 = split_if_mem2[Transfer.transferred]
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   291
lemmas psubfsetI[intro!,no_atp] = psubsetI[Transfer.transferred]
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   292
lemmas psubfsetE[elim!,no_atp] = psubsetE[Transfer.transferred]
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   293
lemmas psubfset_finsert_iff = psubset_insert_iff[Transfer.transferred]
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   294
lemmas psubfset_eq = psubset_eq[Transfer.transferred]
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   295
lemmas psubfset_imp_subfset = psubset_imp_subset[Transfer.transferred]
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   296
lemmas psubfset_trans = psubset_trans[Transfer.transferred]
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   297
lemmas psubfsetD = psubsetD[Transfer.transferred]
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   298
lemmas psubfset_subfset_trans = psubset_subset_trans[Transfer.transferred]
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   299
lemmas subfset_psubfset_trans = subset_psubset_trans[Transfer.transferred]
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   300
lemmas psubfset_imp_ex_fmem = psubset_imp_ex_mem[Transfer.transferred]
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   301
lemmas fimage_fPow_mono = image_Pow_mono[Transfer.transferred]
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   302
lemmas fimage_fPow_surj = image_Pow_surj[Transfer.transferred]
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   303
lemmas subfset_finsertI = subset_insertI[Transfer.transferred]
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   304
lemmas subfset_finsertI2 = subset_insertI2[Transfer.transferred]
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   305
lemmas subfset_finsert = subset_insert[Transfer.transferred]
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   306
lemmas funion_upper1 = Un_upper1[Transfer.transferred]
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   307
lemmas funion_upper2 = Un_upper2[Transfer.transferred]
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   308
lemmas funion_least = Un_least[Transfer.transferred]
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   309
lemmas finter_lower1 = Int_lower1[Transfer.transferred]
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   310
lemmas finter_lower2 = Int_lower2[Transfer.transferred]
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   311
lemmas finter_greatest = Int_greatest[Transfer.transferred]
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   312
lemmas fminus_subfset = Diff_subset[Transfer.transferred]
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   313
lemmas fminus_subfset_conv = Diff_subset_conv[Transfer.transferred]
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   314
lemmas subfset_fempty[simp] = subset_empty[Transfer.transferred]
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   315
lemmas not_psubfset_fempty[iff] = not_psubset_empty[Transfer.transferred]
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   316
lemmas finsert_is_funion = insert_is_Un[Transfer.transferred]
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   317
lemmas finsert_not_fempty[simp] = insert_not_empty[Transfer.transferred]
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   318
lemmas fempty_not_finsert = empty_not_insert[Transfer.transferred]
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   319
lemmas finsert_absorb = insert_absorb[Transfer.transferred]
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   320
lemmas finsert_absorb2[simp] = insert_absorb2[Transfer.transferred]
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   321
lemmas finsert_commute = insert_commute[Transfer.transferred]
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   322
lemmas finsert_subfset[simp] = insert_subset[Transfer.transferred]
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   323
lemmas finsert_inter_finsert[simp] = insert_inter_insert[Transfer.transferred]
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   324
lemmas finsert_disjoint[simp,no_atp] = insert_disjoint[Transfer.transferred]
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   325
lemmas disjoint_finsert[simp,no_atp] = disjoint_insert[Transfer.transferred]
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   326
lemmas fimage_fempty[simp] = image_empty[Transfer.transferred]
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   327
lemmas fimage_finsert[simp] = image_insert[Transfer.transferred]
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   328
lemmas fimage_constant = image_constant[Transfer.transferred]
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   329
lemmas fimage_constant_conv = image_constant_conv[Transfer.transferred]
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   330
lemmas fimage_fimage = image_image[Transfer.transferred]
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   331
lemmas finsert_fimage[simp] = insert_image[Transfer.transferred]
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   332
lemmas fimage_is_fempty[iff] = image_is_empty[Transfer.transferred]
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   333
lemmas fempty_is_fimage[iff] = empty_is_image[Transfer.transferred]
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   334
lemmas fimage_cong = image_cong[Transfer.transferred]
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   335
lemmas fimage_finter_subfset = image_Int_subset[Transfer.transferred]
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   336
lemmas fimage_fminus_subfset = image_diff_subset[Transfer.transferred]
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   337
lemmas finter_absorb = Int_absorb[Transfer.transferred]
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   338
lemmas finter_left_absorb = Int_left_absorb[Transfer.transferred]
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   339
lemmas finter_commute = Int_commute[Transfer.transferred]
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   340
lemmas finter_left_commute = Int_left_commute[Transfer.transferred]
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   341
lemmas finter_assoc = Int_assoc[Transfer.transferred]
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   342
lemmas finter_ac = Int_ac[Transfer.transferred]
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   343
lemmas finter_absorb1 = Int_absorb1[Transfer.transferred]
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   344
lemmas finter_absorb2 = Int_absorb2[Transfer.transferred]
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   345
lemmas finter_fempty_left = Int_empty_left[Transfer.transferred]
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   346
lemmas finter_fempty_right = Int_empty_right[Transfer.transferred]
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   347
lemmas disjoint_iff_fnot_equal = disjoint_iff_not_equal[Transfer.transferred]
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   348
lemmas finter_funion_distrib = Int_Un_distrib[Transfer.transferred]
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   349
lemmas finter_funion_distrib2 = Int_Un_distrib2[Transfer.transferred]
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   350
lemmas finter_subfset_iff[no_atp, simp] = Int_subset_iff[Transfer.transferred]
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   351
lemmas funion_absorb = Un_absorb[Transfer.transferred]
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   352
lemmas funion_left_absorb = Un_left_absorb[Transfer.transferred]
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   353
lemmas funion_commute = Un_commute[Transfer.transferred]
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   354
lemmas funion_left_commute = Un_left_commute[Transfer.transferred]
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   355
lemmas funion_assoc = Un_assoc[Transfer.transferred]
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   356
lemmas funion_ac = Un_ac[Transfer.transferred]
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   357
lemmas funion_absorb1 = Un_absorb1[Transfer.transferred]
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   358
lemmas funion_absorb2 = Un_absorb2[Transfer.transferred]
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   359
lemmas funion_fempty_left = Un_empty_left[Transfer.transferred]
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   360
lemmas funion_fempty_right = Un_empty_right[Transfer.transferred]
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   361
lemmas funion_finsert_left[simp] = Un_insert_left[Transfer.transferred]
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   362
lemmas funion_finsert_right[simp] = Un_insert_right[Transfer.transferred]
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   363
lemmas finter_finsert_left = Int_insert_left[Transfer.transferred]
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   364
lemmas finter_finsert_left_ifffempty[simp] = Int_insert_left_if0[Transfer.transferred]
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   365
lemmas finter_finsert_left_if1[simp] = Int_insert_left_if1[Transfer.transferred]
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   366
lemmas finter_finsert_right = Int_insert_right[Transfer.transferred]
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   367
lemmas finter_finsert_right_ifffempty[simp] = Int_insert_right_if0[Transfer.transferred]
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   368
lemmas finter_finsert_right_if1[simp] = Int_insert_right_if1[Transfer.transferred]
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   369
lemmas funion_finter_distrib = Un_Int_distrib[Transfer.transferred]
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   370
lemmas funion_finter_distrib2 = Un_Int_distrib2[Transfer.transferred]
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   371
lemmas funion_finter_crazy = Un_Int_crazy[Transfer.transferred]
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   372
lemmas subfset_funion_eq = subset_Un_eq[Transfer.transferred]
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   373
lemmas funion_fempty[iff] = Un_empty[Transfer.transferred]
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   374
lemmas funion_subfset_iff[no_atp, simp] = Un_subset_iff[Transfer.transferred]
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   375
lemmas funion_fminus_finter = Un_Diff_Int[Transfer.transferred]
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   376
lemmas fminus_finter2 = Diff_Int2[Transfer.transferred]
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   377
lemmas funion_finter_assoc_eq = Un_Int_assoc_eq[Transfer.transferred]
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   378
lemmas fBall_funion = ball_Un[Transfer.transferred]
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   379
lemmas fBex_funion = bex_Un[Transfer.transferred]
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   380
lemmas fminus_eq_fempty_iff[simp,no_atp] = Diff_eq_empty_iff[Transfer.transferred]
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   381
lemmas fminus_cancel[simp] = Diff_cancel[Transfer.transferred]
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   382
lemmas fminus_idemp[simp] = Diff_idemp[Transfer.transferred]
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   383
lemmas fminus_triv = Diff_triv[Transfer.transferred]
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   384
lemmas fempty_fminus[simp] = empty_Diff[Transfer.transferred]
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   385
lemmas fminus_fempty[simp] = Diff_empty[Transfer.transferred]
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   386
lemmas fminus_finsertffempty[simp,no_atp] = Diff_insert0[Transfer.transferred]
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   387
lemmas fminus_finsert = Diff_insert[Transfer.transferred]
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   388
lemmas fminus_finsert2 = Diff_insert2[Transfer.transferred]
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   389
lemmas finsert_fminus_if = insert_Diff_if[Transfer.transferred]
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   390
lemmas finsert_fminus1[simp] = insert_Diff1[Transfer.transferred]
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   391
lemmas finsert_fminus_single[simp] = insert_Diff_single[Transfer.transferred]
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   392
lemmas finsert_fminus = insert_Diff[Transfer.transferred]
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   393
lemmas fminus_finsert_absorb = Diff_insert_absorb[Transfer.transferred]
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   394
lemmas fminus_disjoint[simp] = Diff_disjoint[Transfer.transferred]
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   395
lemmas fminus_partition = Diff_partition[Transfer.transferred]
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   396
lemmas double_fminus = double_diff[Transfer.transferred]
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   397
lemmas funion_fminus_cancel[simp] = Un_Diff_cancel[Transfer.transferred]
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   398
lemmas funion_fminus_cancel2[simp] = Un_Diff_cancel2[Transfer.transferred]
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   399
lemmas fminus_funion = Diff_Un[Transfer.transferred]
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   400
lemmas fminus_finter = Diff_Int[Transfer.transferred]
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   401
lemmas funion_fminus = Un_Diff[Transfer.transferred]
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   402
lemmas finter_fminus = Int_Diff[Transfer.transferred]
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   403
lemmas fminus_finter_distrib = Diff_Int_distrib[Transfer.transferred]
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   404
lemmas fminus_finter_distrib2 = Diff_Int_distrib2[Transfer.transferred]
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   405
lemmas fUNIV_bool[no_atp] = UNIV_bool[Transfer.transferred]
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   406
lemmas fPow_fempty[simp] = Pow_empty[Transfer.transferred]
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   407
lemmas fPow_finsert = Pow_insert[Transfer.transferred]
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   408
lemmas funion_fPow_subfset = Un_Pow_subset[Transfer.transferred]
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   409
lemmas fPow_finter_eq[simp] = Pow_Int_eq[Transfer.transferred]
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   410
lemmas fset_eq_subfset = set_eq_subset[Transfer.transferred]
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   411
lemmas subfset_iff[no_atp] = subset_iff[Transfer.transferred]
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   412
lemmas subfset_iff_psubfset_eq = subset_iff_psubset_eq[Transfer.transferred]
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   413
lemmas all_not_fin_conv[simp] = all_not_in_conv[Transfer.transferred]
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   414
lemmas ex_fin_conv = ex_in_conv[Transfer.transferred]
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   415
lemmas fimage_mono = image_mono[Transfer.transferred]
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   416
lemmas fPow_mono = Pow_mono[Transfer.transferred]
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   417
lemmas finsert_mono = insert_mono[Transfer.transferred]
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   418
lemmas funion_mono = Un_mono[Transfer.transferred]
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   419
lemmas finter_mono = Int_mono[Transfer.transferred]
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   420
lemmas fminus_mono = Diff_mono[Transfer.transferred]
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   421
lemmas fin_mono = in_mono[Transfer.transferred]
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   422
lemmas fthe_felem_eq[simp] = the_elem_eq[Transfer.transferred]
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   423
lemmas fLeast_mono = Least_mono[Transfer.transferred]
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   424
lemmas fbind_fbind = bind_bind[Transfer.transferred]
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   425
lemmas fempty_fbind[simp] = empty_bind[Transfer.transferred]
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   426
lemmas nonfempty_fbind_const = nonempty_bind_const[Transfer.transferred]
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   427
lemmas fbind_const = bind_const[Transfer.transferred]
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   428
lemmas ffmember_filter[simp] = member_filter[Transfer.transferred]
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   429
lemmas fequalityI = equalityI[Transfer.transferred]
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   430
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   431
subsection {* Additional lemmas*}
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   432
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   433
subsubsection {* fsingleton *}
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   434
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   435
lemmas fsingletonE = fsingletonD [elim_format]
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   436
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   437
subsubsection {* femepty *}
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   438
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   439
lemma fempty_ffilter[simp]: "ffilter (\<lambda>_. False) A = {||}"
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   440
by transfer auto
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   441
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   442
(* FIXME, transferred doesn't work here *)
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   443
lemma femptyE [elim!]: "a |\<in>| {||} \<Longrightarrow> P"
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   444
  by simp
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   445
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   446
subsubsection {* fset *}
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   447
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   448
lemmas fset_simp[simp] = bot_fset.rep_eq finsert.rep_eq
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   449
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   450
lemma finite_fset [simp]: 
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   451
  shows "finite (fset S)"
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   452
  by transfer simp
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   453
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   454
lemmas fset_cong[simp] = fset_inject
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   455
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   456
lemma filter_fset [simp]:
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   457
  shows "fset (ffilter P xs) = Collect P \<inter> fset xs"
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   458
  by transfer auto
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   459
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   460
lemmas inter_fset [simp] = inf_fset.rep_eq
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   461
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   462
lemmas union_fset [simp] = sup_fset.rep_eq
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   463
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   464
lemmas minus_fset [simp] = minus_fset.rep_eq
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   465
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   466
subsubsection {* filter_fset *}
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   467
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   468
lemma subset_ffilter: 
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   469
  "ffilter P A |\<subseteq>| ffilter Q A = (\<forall> x. x |\<in>| A \<longrightarrow> P x \<longrightarrow> Q x)"
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   470
  by transfer auto
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   471
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   472
lemma eq_ffilter: 
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   473
  "(ffilter P A = ffilter Q A) = (\<forall>x. x |\<in>| A \<longrightarrow> P x = Q x)"
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   474
  by transfer auto
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   475
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   476
lemma psubset_ffilter:
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   477
  "(\<And>x. x |\<in>| A \<Longrightarrow> P x \<Longrightarrow> Q x) \<Longrightarrow> (x |\<in>| A & \<not> P x & Q x) \<Longrightarrow> 
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   478
    ffilter P A |\<subset>| ffilter Q A"
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   479
  unfolding less_fset_def by (auto simp add: subset_ffilter eq_ffilter)
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   480
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   481
subsubsection {* insert *}
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   482
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   483
(* FIXME, transferred doesn't work here *)
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   484
lemma set_finsert:
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   485
  assumes "x |\<in>| A"
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   486
  obtains B where "A = finsert x B" and "x |\<notin>| B"
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   487
using assms by transfer (metis Set.set_insert finite_insert)
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   488
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   489
lemma mk_disjoint_finsert: "a |\<in>| A \<Longrightarrow> \<exists>B. A = finsert a B \<and> a |\<notin>| B"
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   490
  by (rule_tac x = "A |-| {|a|}" in exI, blast)
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   491
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   492
subsubsection {* image *}
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   493
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   494
lemma subset_fimage_iff: "(B |\<subseteq>| f|`|A) = (\<exists> AA. AA |\<subseteq>| A \<and> B = f|`|AA)"
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   495
by transfer (metis mem_Collect_eq rev_finite_subset subset_image_iff)
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   496
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   497
subsubsection {* bounded quantification *}
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   498
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   499
lemma bex_simps [simp, no_atp]:
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   500
  "\<And>A P Q. fBex A (\<lambda>x. P x \<and> Q) = (fBex A P \<and> Q)" 
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   501
  "\<And>A P Q. fBex A (\<lambda>x. P \<and> Q x) = (P \<and> fBex A Q)"
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   502
  "\<And>P. fBex {||} P = False" 
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   503
  "\<And>a B P. fBex (finsert a B) P = (P a \<or> fBex B P)"
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   504
  "\<And>A P f. fBex (f |`| A) P = fBex A (\<lambda>x. P (f x))"
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   505
  "\<And>A P. (\<not> fBex A P) = fBall A (\<lambda>x. \<not> P x)"
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   506
by auto
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   507
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   508
lemma ball_simps [simp, no_atp]:
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   509
  "\<And>A P Q. fBall A (\<lambda>x. P x \<or> Q) = (fBall A P \<or> Q)"
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   510
  "\<And>A P Q. fBall A (\<lambda>x. P \<or> Q x) = (P \<or> fBall A Q)"
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   511
  "\<And>A P Q. fBall A (\<lambda>x. P \<longrightarrow> Q x) = (P \<longrightarrow> fBall A Q)"
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   512
  "\<And>A P Q. fBall A (\<lambda>x. P x \<longrightarrow> Q) = (fBex A P \<longrightarrow> Q)"
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   513
  "\<And>P. fBall {||} P = True"
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   514
  "\<And>a B P. fBall (finsert a B) P = (P a \<and> fBall B P)"
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   515
  "\<And>A P f. fBall (f |`| A) P = fBall A (\<lambda>x. P (f x))"
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   516
  "\<And>A P. (\<not> fBall A P) = fBex A (\<lambda>x. \<not> P x)"
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   517
by auto
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   518
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   519
lemma atomize_fBall:
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   520
    "(\<And>x. x |\<in>| A ==> P x) == Trueprop (fBall A (\<lambda>x. P x))"
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   521
apply (simp only: atomize_all atomize_imp)
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   522
apply (rule equal_intr_rule)
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   523
by (transfer, simp)+
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   524
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   525
subsection {* Choice in fsets *}
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   526
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   527
lemma fset_choice: 
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   528
  assumes "\<forall>x. x |\<in>| A \<longrightarrow> (\<exists>y. P x y)"
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   529
  shows "\<exists>f. \<forall>x. x |\<in>| A \<longrightarrow> P x (f x)"
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   530
  using assms by transfer metis
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   531
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   532
subsection {* Induction and Cases rules for fsets *}
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   533
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   534
lemma fset_exhaust [case_names empty insert, cases type: fset]:
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   535
  assumes fempty_case: "S = {||} \<Longrightarrow> P" 
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   536
  and     finsert_case: "\<And>x S'. S = finsert x S' \<Longrightarrow> P"
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   537
  shows "P"
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   538
  using assms by transfer blast
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   539
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   540
lemma fset_induct [case_names empty insert]:
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   541
  assumes fempty_case: "P {||}"
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   542
  and     finsert_case: "\<And>x S. P S \<Longrightarrow> P (finsert x S)"
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   543
  shows "P S"
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   544
proof -
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   545
  (* FIXME transfer and right_total vs. bi_total *)
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   546
  note Domainp_forall_transfer[transfer_rule]
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   547
  show ?thesis
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   548
  using assms by transfer (auto intro: finite_induct)
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   549
qed
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   550
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   551
lemma fset_induct_stronger [case_names empty insert, induct type: fset]:
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   552
  assumes empty_fset_case: "P {||}"
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   553
  and     insert_fset_case: "\<And>x S. \<lbrakk>x |\<notin>| S; P S\<rbrakk> \<Longrightarrow> P (finsert x S)"
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   554
  shows "P S"
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   555
proof -
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   556
  (* FIXME transfer and right_total vs. bi_total *)
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   557
  note Domainp_forall_transfer[transfer_rule]
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   558
  show ?thesis
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   559
  using assms by transfer (auto intro: finite_induct)
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   560
qed
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   561
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   562
lemma fset_card_induct:
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   563
  assumes empty_fset_case: "P {||}"
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   564
  and     card_fset_Suc_case: "\<And>S T. Suc (fcard S) = (fcard T) \<Longrightarrow> P S \<Longrightarrow> P T"
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   565
  shows "P S"
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   566
proof (induct S)
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   567
  case empty
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   568
  show "P {||}" by (rule empty_fset_case)
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   569
next
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   570
  case (insert x S)
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   571
  have h: "P S" by fact
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   572
  have "x |\<notin>| S" by fact
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   573
  then have "Suc (fcard S) = fcard (finsert x S)" 
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   574
    by transfer auto
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   575
  then show "P (finsert x S)" 
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   576
    using h card_fset_Suc_case by simp
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   577
qed
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   578
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   579
lemma fset_strong_cases:
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   580
  obtains "xs = {||}"
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   581
    | ys x where "x |\<notin>| ys" and "xs = finsert x ys"
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   582
by transfer blast
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   583
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   584
lemma fset_induct2:
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   585
  "P {||} {||} \<Longrightarrow>
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   586
  (\<And>x xs. x |\<notin>| xs \<Longrightarrow> P (finsert x xs) {||}) \<Longrightarrow>
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   587
  (\<And>y ys. y |\<notin>| ys \<Longrightarrow> P {||} (finsert y ys)) \<Longrightarrow>
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   588
  (\<And>x xs y ys. \<lbrakk>P xs ys; x |\<notin>| xs; y |\<notin>| ys\<rbrakk> \<Longrightarrow> P (finsert x xs) (finsert y ys)) \<Longrightarrow>
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   589
  P xsa ysa"
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   590
  apply (induct xsa arbitrary: ysa)
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   591
  apply (induct_tac x rule: fset_induct_stronger)
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   592
  apply simp_all
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   593
  apply (induct_tac xa rule: fset_induct_stronger)
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   594
  apply simp_all
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   595
  done
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   596
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   597
subsection {* Setup for Lifting/Transfer *}
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   598
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   599
subsubsection {* Relator and predicator properties *}
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   600
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   601
lift_definition fset_rel :: "('a \<Rightarrow> 'b \<Rightarrow> bool) \<Rightarrow> 'a fset \<Rightarrow> 'b fset \<Rightarrow> bool" is set_rel
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   602
parametric set_rel_transfer ..
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   603
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   604
lemma fset_rel_alt_def: "fset_rel R = (\<lambda>A B. (\<forall>x.\<exists>y. x|\<in>|A \<longrightarrow> y|\<in>|B \<and> R x y) 
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   605
  \<and> (\<forall>y. \<exists>x. y|\<in>|B \<longrightarrow> x|\<in>|A \<and> R x y))"
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   606
apply (rule ext)+
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   607
apply transfer'
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   608
apply (subst set_rel_def[unfolded fun_eq_iff]) 
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   609
by blast
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   610
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   611
lemma fset_rel_conversep: "fset_rel (conversep R) = conversep (fset_rel R)"
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   612
  unfolding fset_rel_alt_def by auto
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   613
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   614
lemmas fset_rel_eq [relator_eq] = set_rel_eq[Transfer.transferred]
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   615
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   616
lemma fset_rel_mono[relator_mono]: "A \<le> B \<Longrightarrow> fset_rel A \<le> fset_rel B"
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   617
unfolding fset_rel_alt_def by blast
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   618
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   619
lemma finite_set_rel:
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   620
  assumes fin: "finite X" "finite Z"
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   621
  assumes R_S: "set_rel (R OO S) X Z"
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   622
  shows "\<exists>Y. finite Y \<and> set_rel R X Y \<and> set_rel S Y Z"
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   623
proof -
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   624
  obtain f where f: "\<forall>x\<in>X. R x (f x) \<and> (\<exists>z\<in>Z. S (f x) z)"
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   625
  apply atomize_elim
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   626
  apply (subst bchoice_iff[symmetric])
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   627
  using R_S[unfolded set_rel_def OO_def] by blast
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   628
  
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   629
  obtain g where g: "\<forall>z\<in>Z. S (g z) z \<and> (\<exists>x\<in>X. R  x (g z))"
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   630
  apply atomize_elim
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   631
  apply (subst bchoice_iff[symmetric])
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   632
  using R_S[unfolded set_rel_def OO_def] by blast
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   633
  
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   634
  let ?Y = "f ` X \<union> g ` Z"
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   635
  have "finite ?Y" by (simp add: fin)
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   636
  moreover have "set_rel R X ?Y"
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   637
    unfolding set_rel_def
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   638
    using f g by clarsimp blast
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   639
  moreover have "set_rel S ?Y Z"
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   640
    unfolding set_rel_def
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   641
    using f g by clarsimp blast
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   642
  ultimately show ?thesis by metis
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   643
qed
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   644
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   645
lemma fset_rel_OO[relator_distr]: "fset_rel R OO fset_rel S = fset_rel (R OO S)"
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   646
apply (rule ext)+
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   647
by transfer (auto intro: finite_set_rel set_rel_OO[unfolded fun_eq_iff, rule_format, THEN iffD1])
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   648
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   649
lemma Domainp_fset[relator_domain]:
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   650
  assumes "Domainp T = P"
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   651
  shows "Domainp (fset_rel T) = (\<lambda>A. fBall A P)"
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   652
proof -
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   653
  from assms obtain f where f: "\<forall>x\<in>Collect P. T x (f x)"
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   654
    unfolding Domainp_iff[abs_def]
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   655
    apply atomize_elim
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   656
    by (subst bchoice_iff[symmetric]) auto
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   657
  from assms f show ?thesis
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   658
    unfolding fun_eq_iff fset_rel_alt_def Domainp_iff
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   659
    apply clarify
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   660
    apply (rule iffI)
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   661
      apply blast
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   662
    by (rename_tac A, rule_tac x="f |`| A" in exI, blast)
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   663
qed
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   664
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   665
lemmas reflp_fset_rel[reflexivity_rule] = reflp_set_rel[Transfer.transferred]
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   666
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   667
lemma right_total_fset_rel[transfer_rule]: "right_total A \<Longrightarrow> right_total (fset_rel A)"
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   668
unfolding right_total_def 
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   669
apply transfer
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   670
apply (subst(asm) choice_iff)
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   671
apply clarsimp
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   672
apply (rename_tac A f y, rule_tac x = "f ` y" in exI)
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   673
by (auto simp add: set_rel_def)
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   674
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   675
lemma left_total_fset_rel[reflexivity_rule]: "left_total A \<Longrightarrow> left_total (fset_rel A)"
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   676
unfolding left_total_def 
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   677
apply transfer
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   678
apply (subst(asm) choice_iff)
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   679
apply clarsimp
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   680
apply (rename_tac A f y, rule_tac x = "f ` y" in exI)
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   681
by (auto simp add: set_rel_def)
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   682
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   683
lemmas right_unique_fset_rel[transfer_rule] = right_unique_set_rel[Transfer.transferred]
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   684
lemmas left_unique_fset_rel[reflexivity_rule] = left_unique_set_rel[Transfer.transferred]
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   685
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   686
thm right_unique_fset_rel left_unique_fset_rel
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   687
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   688
lemma bi_unique_fset_rel[transfer_rule]: "bi_unique A \<Longrightarrow> bi_unique (fset_rel A)"
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   689
by (auto intro: right_unique_fset_rel left_unique_fset_rel iff: bi_unique_iff)
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   690
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   691
lemma bi_total_fset_rel[transfer_rule]: "bi_total A \<Longrightarrow> bi_total (fset_rel A)"
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   692
by (auto intro: right_total_fset_rel left_total_fset_rel iff: bi_total_iff)
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   693
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   694
lemmas fset_invariant_commute [invariant_commute] = set_invariant_commute[Transfer.transferred]
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   695
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   696
subsubsection {* Quotient theorem for the Lifting package *}
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   697
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   698
lemma Quotient_fset_map[quot_map]:
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   699
  assumes "Quotient R Abs Rep T"
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   700
  shows "Quotient (fset_rel R) (fimage Abs) (fimage Rep) (fset_rel T)"
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   701
  using assms unfolding Quotient_alt_def4
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   702
  by (simp add: fset_rel_OO[symmetric] fset_rel_conversep) (simp add: fset_rel_alt_def, blast)
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   703
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   704
subsubsection {* Transfer rules for the Transfer package *}
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   705
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   706
text {* Unconditional transfer rules *}
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   707
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   708
lemmas fempty_transfer [transfer_rule] = empty_transfer[Transfer.transferred]
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   709
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   710
lemma finsert_transfer [transfer_rule]:
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   711
  "(A ===> fset_rel A ===> fset_rel A) finsert finsert"
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   712
  unfolding fun_rel_def fset_rel_alt_def by blast
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   713
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   714
lemma funion_transfer [transfer_rule]:
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   715
  "(fset_rel A ===> fset_rel A ===> fset_rel A) funion funion"
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   716
  unfolding fun_rel_def fset_rel_alt_def by blast
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   717
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   718
lemma ffUnion_transfer [transfer_rule]:
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   719
  "(fset_rel (fset_rel A) ===> fset_rel A) ffUnion ffUnion"
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   720
  unfolding fun_rel_def fset_rel_alt_def by transfer (simp, fast)
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   721
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   722
lemma fimage_transfer [transfer_rule]:
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   723
  "((A ===> B) ===> fset_rel A ===> fset_rel B) fimage fimage"
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   724
  unfolding fun_rel_def fset_rel_alt_def by simp blast
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   725
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   726
lemma fBall_transfer [transfer_rule]:
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   727
  "(fset_rel A ===> (A ===> op =) ===> op =) fBall fBall"
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   728
  unfolding fset_rel_alt_def fun_rel_def by blast
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   729
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   730
lemma fBex_transfer [transfer_rule]:
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   731
  "(fset_rel A ===> (A ===> op =) ===> op =) fBex fBex"
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   732
  unfolding fset_rel_alt_def fun_rel_def by blast
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   733
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   734
(* FIXME transfer doesn't work here *)
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   735
lemma fPow_transfer [transfer_rule]:
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   736
  "(fset_rel A ===> fset_rel (fset_rel A)) fPow fPow"
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   737
  unfolding fun_rel_def
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   738
  using Pow_transfer[unfolded fun_rel_def, rule_format, Transfer.transferred]
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   739
  by blast
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   740
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   741
lemma fset_rel_transfer [transfer_rule]:
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   742
  "((A ===> B ===> op =) ===> fset_rel A ===> fset_rel B ===> op =)
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   743
    fset_rel fset_rel"
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   744
  unfolding fun_rel_def
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   745
  using set_rel_transfer[unfolded fun_rel_def,rule_format, Transfer.transferred, where A = A and B = B]
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   746
  by simp
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   747
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   748
lemma bind_transfer [transfer_rule]:
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   749
  "(fset_rel A ===> (A ===> fset_rel B) ===> fset_rel B) fbind fbind"
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   750
  using assms unfolding fun_rel_def
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   751
  using bind_transfer[unfolded fun_rel_def, rule_format, Transfer.transferred] by blast
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   752
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   753
text {* Rules requiring bi-unique, bi-total or right-total relations *}
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   754
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   755
lemma fmember_transfer [transfer_rule]:
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   756
  assumes "bi_unique A"
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   757
  shows "(A ===> fset_rel A ===> op =) (op |\<in>|) (op |\<in>|)"
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   758
  using assms unfolding fun_rel_def fset_rel_alt_def bi_unique_def by metis
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   759
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   760
lemma finter_transfer [transfer_rule]:
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   761
  assumes "bi_unique A"
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   762
  shows "(fset_rel A ===> fset_rel A ===> fset_rel A) finter finter"
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   763
  using assms unfolding fun_rel_def
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   764
  using inter_transfer[unfolded fun_rel_def, rule_format, Transfer.transferred] by blast
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   765
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   766
lemma fDiff_transfer [transfer_rule]:
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   767
  assumes "bi_unique A"
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   768
  shows "(fset_rel A ===> fset_rel A ===> fset_rel A) (op |-|) (op |-|)"
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   769
  using assms unfolding fun_rel_def
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   770
  using Diff_transfer[unfolded fun_rel_def, rule_format, Transfer.transferred] by blast
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   771
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   772
lemma fsubset_transfer [transfer_rule]:
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   773
  assumes "bi_unique A"
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   774
  shows "(fset_rel A ===> fset_rel A ===> op =) (op |\<subseteq>|) (op |\<subseteq>|)"
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   775
  using assms unfolding fun_rel_def
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   776
  using subset_transfer[unfolded fun_rel_def, rule_format, Transfer.transferred] by blast
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   777
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   778
lemma fSup_transfer [transfer_rule]:
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   779
  "bi_unique A \<Longrightarrow> (set_rel (fset_rel A) ===> fset_rel A) Sup Sup"
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   780
  using assms unfolding fun_rel_def
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   781
  apply clarify
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   782
  apply transfer'
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   783
  using Sup_fset_transfer[unfolded fun_rel_def] by blast
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   784
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   785
(* FIXME: add right_total_fInf_transfer *)
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   786
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   787
lemma fInf_transfer [transfer_rule]:
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   788
  assumes "bi_unique A" and "bi_total A"
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   789
  shows "(set_rel (fset_rel A) ===> fset_rel A) Inf Inf"
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   790
  using assms unfolding fun_rel_def
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   791
  apply clarify
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   792
  apply transfer'
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   793
  using Inf_fset_transfer[unfolded fun_rel_def] by blast
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   794
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   795
lemma ffilter_transfer [transfer_rule]:
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   796
  assumes "bi_unique A"
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   797
  shows "((A ===> op=) ===> fset_rel A ===> fset_rel A) ffilter ffilter"
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   798
  using assms unfolding fun_rel_def
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   799
  using Lifting_Set.filter_transfer[unfolded fun_rel_def, rule_format, Transfer.transferred] by blast
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   800
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   801
lemma card_transfer [transfer_rule]:
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   802
  "bi_unique A \<Longrightarrow> (fset_rel A ===> op =) fcard fcard"
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   803
  using assms unfolding fun_rel_def
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   804
  using card_transfer[unfolded fun_rel_def, rule_format, Transfer.transferred] by blast
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   805
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   806
end
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   807
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   808
lifting_update fset.lifting
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   809
lifting_forget fset.lifting
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   810
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   811
end
2f103a894ebe new theory of finite sets as a subtype
kuncar
parents:
diff changeset
   812