Nominal/Nominal2_Base.thy
changeset 3245 017e33849f4d
parent 3244 a44479bde681
equal deleted inserted replaced
3244:a44479bde681 3245:017e33849f4d
     5     Nominal Isabelle. 
     5     Nominal Isabelle. 
     6 *)
     6 *)
     7 theory Nominal2_Base
     7 theory Nominal2_Base
     8 imports "~~/src/HOL/Library/Old_Datatype"
     8 imports "~~/src/HOL/Library/Old_Datatype"
     9         "~~/src/HOL/Library/Infinite_Set"
     9         "~~/src/HOL/Library/Infinite_Set"
    10         "~~/src/HOL/Quotient_Examples/FSet"
    10         "~~/src/HOL/Library/Multiset"
       
    11         "~~/src/HOL/Library/FSet"
    11         "~~/src/HOL/Library/FinFun"
    12         "~~/src/HOL/Library/FinFun"
    12 keywords
    13 keywords
    13   "atom_decl" "equivariance" :: thy_decl 
    14   "atom_decl" "equivariance" :: thy_decl 
    14 begin
    15 begin
    15 
    16 
    16 declare [[typedef_overloaded]]
    17 declare [[typedef_overloaded]]
    17 
    18 
    18 
    19 
    19 section {* Atoms and Sorts *}
    20 section {* Atoms and Sorts *}
    20 
    21 
    21 text {* A simple implementation for atom_sorts is strings. *}
    22 text {* A simple implementation for @{text atom_sorts} is strings. *}
    22 (* types atom_sort = string *)
    23 (* types atom_sort = string *)
    23 
    24 
    24 text {* To deal with Church-like binding we use trees of  
    25 text {* To deal with Church-like binding we use trees of  
    25   strings as sorts. *}
    26   strings as sorts. *}
    26 
    27 
   609 end
   610 end
   610 
   611 
   611 lemma permute_multiset [simp]:
   612 lemma permute_multiset [simp]:
   612   fixes M N::"('a::pt) multiset"
   613   fixes M N::"('a::pt) multiset"
   613   shows "(p \<bullet> {#}) = ({#} ::('a::pt) multiset)"
   614   shows "(p \<bullet> {#}) = ({#} ::('a::pt) multiset)"
   614   and   "(p \<bullet> {# x #}) = {# p \<bullet> x #}"
   615   and   "(p \<bullet> add_mset x M) = add_mset (p \<bullet> x) (p \<bullet> M)"
   615   and   "(p \<bullet> (M + N)) = (p \<bullet> M) + (p \<bullet> N)"
   616   and   "(p \<bullet> (M + N)) = (p \<bullet> M) + (p \<bullet> N)"
   616   unfolding permute_multiset_def
   617   unfolding permute_multiset_def
   617   by (simp_all)
   618   by (simp_all)
   618 
   619 
   619 
   620 
   620 subsection {* Permutations for @{typ "'a fset"} *}
   621 subsection {* Permutations for @{typ "'a fset"} *}
   621 
   622 
   622 lemma permute_fset_rsp[quot_respect]:
       
   623   shows "(op = ===> list_eq ===> list_eq) permute permute"
       
   624   unfolding rel_fun_def
       
   625   by (simp add: set_eqvt[symmetric])
       
   626 
       
   627 instantiation fset :: (pt) pt
   623 instantiation fset :: (pt) pt
   628 begin
   624 begin
   629 
   625 
   630 quotient_definition
   626 context includes fset.lifting begin
   631   "permute_fset :: perm \<Rightarrow> 'a fset \<Rightarrow> 'a fset"
   627 lift_definition
   632 is
   628   "permute_fset" :: "perm \<Rightarrow> 'a fset \<Rightarrow> 'a fset"
   633   "permute :: perm \<Rightarrow> 'a list \<Rightarrow> 'a list"
   629 is "permute :: perm \<Rightarrow> 'a set \<Rightarrow> 'a set" by simp
   634   by (simp add: set_eqvt[symmetric])
   630 end
   635 
   631 
       
   632 context includes fset.lifting begin
   636 instance 
   633 instance 
   637 proof
   634 proof
   638   fix x :: "'a fset" and p q :: "perm"
   635   fix x :: "'a fset" and p q :: "perm"
   639   show "0 \<bullet> x = x" by (descending) (simp)
   636   show "0 \<bullet> x = x" by transfer simp
   640   show "(p + q) \<bullet> x = p \<bullet> q \<bullet> x" by (descending) (simp)
   637   show "(p + q) \<bullet> x = p \<bullet> q \<bullet> x"  by transfer simp
   641 qed
   638 qed
   642 
       
   643 end
   639 end
   644 
   640 
       
   641 end
       
   642 
       
   643 context includes fset.lifting
       
   644 begin
   645 lemma permute_fset [simp]:
   645 lemma permute_fset [simp]:
   646   fixes S::"('a::pt) fset"
   646   fixes S::"('a::pt) fset"
   647   shows "(p \<bullet> {||}) = ({||} ::('a::pt) fset)"
   647   shows "(p \<bullet> {||}) = ({||} ::('a::pt) fset)"
   648   and   "(p \<bullet> insert_fset x S) = insert_fset (p \<bullet> x) (p \<bullet> S)"
   648   and   "(p \<bullet> finsert x S) = finsert (p \<bullet> x) (p \<bullet> S)"
   649   by (lifting permute_list.simps)
   649   apply (transfer, simp add: empty_eqvt)
       
   650   apply (transfer, simp add: insert_eqvt)
       
   651   done
   650 
   652 
   651 lemma fset_eqvt: 
   653 lemma fset_eqvt: 
   652   shows "p \<bullet> (fset S) = fset (p \<bullet> S)"
   654   shows "p \<bullet> (fset S) = fset (p \<bullet> S)"
   653   by (lifting set_eqvt)
   655   by transfer simp
       
   656 end
   654 
   657 
   655 
   658 
   656 subsection {* Permutations for @{typ "('a, 'b) finfun"} *}
   659 subsection {* Permutations for @{typ "('a, 'b) finfun"} *}
   657 
   660 
   658 instantiation finfun :: (pt, pt) pt
   661 instantiation finfun :: (pt, pt) pt
   760 
   763 
   761 instance int :: pure
   764 instance int :: pure
   762 proof qed (rule permute_int_def)
   765 proof qed (rule permute_int_def)
   763 
   766 
   764 
   767 
   765 section {* Infrastructure for Equivariance and Perm_simp *}
   768 section {* Infrastructure for Equivariance and @{text Perm_simp} *}
   766 
   769 
   767 subsection {* Basic functions about permutations *}
   770 subsection {* Basic functions about permutations *}
   768 
   771 
   769 ML_file "nominal_basics.ML"
   772 ML_file "nominal_basics.ML"
   770 
   773 
   790   permute_fset fset_eqvt
   793   permute_fset fset_eqvt
   791 
   794 
   792   (* multisets *)
   795   (* multisets *)
   793   permute_multiset
   796   permute_multiset
   794 
   797 
   795 subsection {* perm_simp infrastructure *}
   798 subsection {* @{text perm_simp} infrastructure *}
   796 
   799 
   797 definition
   800 definition
   798   "unpermute p = permute (- p)"
   801   "unpermute p = permute (- p)"
   799 
   802 
   800 lemma eqvt_apply:
   803 lemma eqvt_apply:
   810 
   813 
   811 lemma eqvt_bound:
   814 lemma eqvt_bound:
   812   shows "p \<bullet> unpermute p x \<equiv> x"
   815   shows "p \<bullet> unpermute p x \<equiv> x"
   813   unfolding unpermute_def by simp
   816   unfolding unpermute_def by simp
   814 
   817 
   815 text {* provides perm_simp methods *}
   818 text {* provides @{text perm_simp} methods *}
   816 
   819 
   817 ML_file "nominal_permeq.ML"
   820 ML_file "nominal_permeq.ML"
   818 
   821 
   819 method_setup perm_simp =
   822 method_setup perm_simp =
   820  {* Nominal_Permeq.args_parser >> Nominal_Permeq.perm_simp_meth *}
   823  {* Nominal_Permeq.args_parser >> Nominal_Permeq.perm_simp_meth *}
   972 lemma Collect_eqvt [eqvt]:
   975 lemma Collect_eqvt [eqvt]:
   973   shows "p \<bullet> {x. P x} = {x. (p \<bullet> P) x}"
   976   shows "p \<bullet> {x. P x} = {x. (p \<bullet> P) x}"
   974   unfolding permute_set_eq permute_fun_def
   977   unfolding permute_set_eq permute_fun_def
   975   by (auto simp: permute_bool_def)
   978   by (auto simp: permute_bool_def)
   976 
   979 
   977 lemma inter_eqvt [eqvt]:
       
   978   shows "p \<bullet> (A \<inter> B) = (p \<bullet> A) \<inter> (p \<bullet> B)"
       
   979   unfolding Int_def by simp
       
   980 
       
   981 lemma Bex_eqvt [eqvt]:
   980 lemma Bex_eqvt [eqvt]:
   982   shows "p \<bullet> (\<exists>x \<in> S. P x) = (\<exists>x \<in> (p \<bullet> S). (p \<bullet> P) x)"
   981   shows "p \<bullet> (\<exists>x \<in> S. P x) = (\<exists>x \<in> (p \<bullet> S). (p \<bullet> P) x)"
   983   unfolding Bex_def by simp
   982   unfolding Bex_def by simp
   984 
   983 
   985 lemma Ball_eqvt [eqvt]:
   984 lemma Ball_eqvt [eqvt]:
   997 lemma UNIV_eqvt [eqvt]:
   996 lemma UNIV_eqvt [eqvt]:
   998   shows "p \<bullet> UNIV = UNIV"
   997   shows "p \<bullet> UNIV = UNIV"
   999   unfolding UNIV_def 
   998   unfolding UNIV_def 
  1000   by (perm_simp) (rule refl)
   999   by (perm_simp) (rule refl)
  1001 
  1000 
       
  1001 lemma inter_eqvt [eqvt]:
       
  1002   shows "p \<bullet> (A \<inter> B) = (p \<bullet> A) \<inter> (p \<bullet> B)"
       
  1003   unfolding Int_def by simp
       
  1004 
       
  1005 lemma Inter_eqvt [eqvt]:
       
  1006   shows "p \<bullet> \<Inter>S = \<Inter>(p \<bullet> S)"
       
  1007   unfolding Inter_eq by simp
       
  1008 
  1002 lemma union_eqvt [eqvt]:
  1009 lemma union_eqvt [eqvt]:
  1003   shows "p \<bullet> (A \<union> B) = (p \<bullet> A) \<union> (p \<bullet> B)"
  1010   shows "p \<bullet> (A \<union> B) = (p \<bullet> A) \<union> (p \<bullet> B)"
  1004   unfolding Un_def by simp
  1011   unfolding Un_def by simp
  1005 
  1012 
  1006 lemma UNION_eqvt [eqvt]:
  1013 lemma Union_eqvt [eqvt]:
  1007   shows "p \<bullet> (UNION A f) = (UNION (p \<bullet> A) (p \<bullet> f))"
  1014   shows "p \<bullet> \<Union>A = \<Union>(p \<bullet> A)"
  1008 unfolding UNION_eq
  1015   unfolding Union_eq
  1009 by (perm_simp) (simp)
  1016   by perm_simp rule
  1010 
  1017 
  1011 lemma Diff_eqvt [eqvt]:
  1018 lemma Diff_eqvt [eqvt]:
  1012   fixes A B :: "'a::pt set"
  1019   fixes A B :: "'a::pt set"
  1013   shows "p \<bullet> (A - B) = (p \<bullet> A) - (p \<bullet> B)"
  1020   shows "p \<bullet> (A - B) = (p \<bullet> A) - (p \<bullet> B)"
  1014   unfolding set_diff_eq by simp
  1021   unfolding set_diff_eq by simp
  1027   unfolding psubset_eq by simp
  1034   unfolding psubset_eq by simp
  1028 
  1035 
  1029 lemma vimage_eqvt [eqvt]:
  1036 lemma vimage_eqvt [eqvt]:
  1030   shows "p \<bullet> (f -` A) = (p \<bullet> f) -` (p \<bullet> A)"
  1037   shows "p \<bullet> (f -` A) = (p \<bullet> f) -` (p \<bullet> A)"
  1031   unfolding vimage_def by simp
  1038   unfolding vimage_def by simp
  1032 
       
  1033 lemma Union_eqvt [eqvt]:
       
  1034   shows "p \<bullet> (\<Union> S) = \<Union> (p \<bullet> S)"
       
  1035   unfolding Union_eq by simp
       
  1036 
       
  1037 lemma Inter_eqvt [eqvt]:
       
  1038   shows "p \<bullet> (\<Inter> S) = \<Inter> (p \<bullet> S)"
       
  1039   unfolding Inter_eq by simp
       
  1040 
       
  1041 thm foldr.simps
       
  1042 
  1039 
  1043 lemma foldr_eqvt[eqvt]:
  1040 lemma foldr_eqvt[eqvt]:
  1044   "p \<bullet> foldr f xs = foldr (p \<bullet> f) (p \<bullet> xs)"
  1041   "p \<bullet> foldr f xs = foldr (p \<bullet> f) (p \<bullet> xs)"
  1045   apply(induct xs)
  1042   apply(induct xs)
  1046   apply(simp_all)
  1043   apply(simp_all)
  1050 
  1047 
  1051 (* FIXME: eqvt attribute *)
  1048 (* FIXME: eqvt attribute *)
  1052 lemma Sigma_eqvt:
  1049 lemma Sigma_eqvt:
  1053   shows "(p \<bullet> (X \<times> Y)) = (p \<bullet> X) \<times> (p \<bullet> Y)"
  1050   shows "(p \<bullet> (X \<times> Y)) = (p \<bullet> X) \<times> (p \<bullet> Y)"
  1054 unfolding Sigma_def
  1051 unfolding Sigma_def
  1055 unfolding SUP_def
       
  1056 by (perm_simp) (rule refl)
  1052 by (perm_simp) (rule refl)
  1057 
  1053 
  1058 text {* 
  1054 text {* 
  1059   In order to prove that lfp is equivariant we need two
  1055   In order to prove that lfp is equivariant we need two
  1060   auxiliary classes which specify that (op <=) and
  1056   auxiliary classes which specify that (op <=) and
  1107 instantiation "fun" :: (pt, inf_eqvt) inf_eqvt
  1103 instantiation "fun" :: (pt, inf_eqvt) inf_eqvt
  1108 begin
  1104 begin
  1109 
  1105 
  1110 instance 
  1106 instance 
  1111 apply standard
  1107 apply standard
  1112 unfolding Inf_fun_def INF_def
  1108 unfolding Inf_fun_def
  1113 apply(perm_simp)
  1109 apply(perm_simp)
  1114 apply(rule refl)
  1110 apply(rule refl)
  1115 done 
  1111 done 
  1116 
  1112 
  1117 end
  1113 end
  1198   by (cases x) (simp_all)
  1194   by (cases x) (simp_all)
  1199 
  1195 
  1200 
  1196 
  1201 subsubsection {* Equivariance for @{typ "'a fset"} *}
  1197 subsubsection {* Equivariance for @{typ "'a fset"} *}
  1202 
  1198 
       
  1199 context includes fset.lifting begin
  1203 lemma in_fset_eqvt [eqvt]:
  1200 lemma in_fset_eqvt [eqvt]:
  1204   shows "(p \<bullet> (x |\<in>| S)) = ((p \<bullet> x) |\<in>| (p \<bullet> S))"
  1201   shows "(p \<bullet> (x |\<in>| S)) = ((p \<bullet> x) |\<in>| (p \<bullet> S))"
  1205 unfolding in_fset by simp
  1202   by transfer simp
  1206 
  1203 
  1207 lemma union_fset_eqvt [eqvt]:
  1204 lemma union_fset_eqvt [eqvt]:
  1208   shows "(p \<bullet> (S |\<union>| T)) = ((p \<bullet> S) |\<union>| (p \<bullet> T))"
  1205   shows "(p \<bullet> (S |\<union>| T)) = ((p \<bullet> S) |\<union>| (p \<bullet> T))"
  1209   by (induct S) (simp_all)
  1206   by (induct S) (simp_all)
  1210 
  1207 
  1211 lemma inter_fset_eqvt [eqvt]:
  1208 lemma inter_fset_eqvt [eqvt]:
  1212   shows "(p \<bullet> (S |\<inter>| T)) = ((p \<bullet> S) |\<inter>| (p \<bullet> T))"
  1209   shows "(p \<bullet> (S |\<inter>| T)) = ((p \<bullet> S) |\<inter>| (p \<bullet> T))"
  1213   apply(descending)
  1210   by transfer simp
  1214   unfolding list_eq_def inter_list_def
       
  1215   apply(simp)
       
  1216   done
       
  1217 
  1211 
  1218 lemma subset_fset_eqvt [eqvt]:
  1212 lemma subset_fset_eqvt [eqvt]:
  1219   shows "(p \<bullet> (S |\<subseteq>| T)) = ((p \<bullet> S) |\<subseteq>| (p \<bullet> T))"
  1213   shows "(p \<bullet> (S |\<subseteq>| T)) = ((p \<bullet> S) |\<subseteq>| (p \<bullet> T))"
  1220   apply(descending)
  1214   by transfer simp
  1221   unfolding sub_list_def
       
  1222   apply(simp)
       
  1223   done
       
  1224   
  1215   
  1225 lemma map_fset_eqvt [eqvt]: 
  1216 lemma map_fset_eqvt [eqvt]: 
  1226   shows "p \<bullet> (map_fset f S) = map_fset (p \<bullet> f) (p \<bullet> S)"
  1217   shows "p \<bullet> (f |`| S) = (p \<bullet> f) |`| (p \<bullet> S)"
  1227   by (lifting map_eqvt)
  1218   by transfer simp
       
  1219 end
  1228 
  1220 
  1229 subsubsection {* Equivariance for @{typ "('a, 'b) finfun"} *}
  1221 subsubsection {* Equivariance for @{typ "('a, 'b) finfun"} *}
  1230 
  1222 
  1231 lemma finfun_update_eqvt [eqvt]:
  1223 lemma finfun_update_eqvt [eqvt]:
  1232   shows "(p \<bullet> (finfun_update f a b)) = finfun_update (p \<bullet> f) (p \<bullet> a) (p \<bullet> b)"
  1224   shows "(p \<bullet> (finfun_update f a b)) = finfun_update (p \<bullet> f) (p \<bullet> a) (p \<bullet> b)"
  1904       end  
  1896       end  
  1905     | (_, _) => NONE
  1897     | (_, _) => NONE
  1906   end
  1898   end
  1907 *}
  1899 *}
  1908 
  1900 
  1909 subsection {* helper functions for nominal_functions *}
  1901 subsection {* helper functions for @{text nominal_functions} *}
  1910 
  1902 
  1911 lemma THE_defaultI2:
  1903 lemma THE_defaultI2:
  1912   assumes "\<exists>!x. P x" "\<And>x. P x \<Longrightarrow> Q x"
  1904   assumes "\<exists>!x. P x" "\<And>x. P x \<Longrightarrow> Q x"
  1913   shows "Q (THE_default d P)"
  1905   shows "Q (THE_default d P)"
  1914 by (iprover intro: assms THE_defaultI')
  1906 by (iprover intro: assms THE_defaultI')
  2144   then show "finite (\<Union>{supp x | x. x \<in># M})"
  2136   then show "finite (\<Union>{supp x | x. x \<in># M})"
  2145     by (simp only: image_Collect)
  2137     by (simp only: image_Collect)
  2146 qed
  2138 qed
  2147 
  2139 
  2148 lemma Union_supports_multiset:
  2140 lemma Union_supports_multiset:
  2149   shows "\<Union>{supp x | x. x :# M} supports M"
  2141   shows "\<Union>{supp x | x. x \<in># M} supports M"
  2150 proof -
  2142 proof -
  2151   have sw: "\<And>a b. ((\<And>x. x :# M \<Longrightarrow> (a \<rightleftharpoons> b) \<bullet> x = x) \<Longrightarrow> (a \<rightleftharpoons> b) \<bullet> M = M)"
  2143   have sw: "\<And>a b. ((\<And>x. x \<in># M \<Longrightarrow> (a \<rightleftharpoons> b) \<bullet> x = x) \<Longrightarrow> (a \<rightleftharpoons> b) \<bullet> M = M)"
  2152     unfolding permute_multiset_def 
  2144     unfolding permute_multiset_def by (induct M) simp_all
  2153     apply(induct M)
  2145   have "(\<Union>x\<in>set_mset M. supp x) supports M"
  2154     apply(simp_all)
  2146     by (auto intro!: sw swap_fresh_fresh simp add: fresh_def supports_def)
  2155     done
  2147   also have "(\<Union>x\<in>set_mset M. supp x) = (\<Union>{supp x | x. x \<in># M})"
  2156   show "(\<Union>{supp x | x. x :# M}) supports M"
  2148     by auto
  2157     unfolding supports_def
  2149   finally show "(\<Union>{supp x | x. x \<in># M}) supports M" .
  2158     apply(clarify)
       
  2159     apply(rule sw)
       
  2160     apply(rule swap_fresh_fresh)
       
  2161     apply(simp_all only: fresh_def)
       
  2162     apply(auto)
       
  2163     apply(metis neq0_conv)+
       
  2164     done
       
  2165 qed
  2150 qed
  2166 
  2151 
  2167 lemma Union_included_multiset:
  2152 lemma Union_included_multiset:
  2168   fixes M::"('a::fs multiset)" 
  2153   fixes M::"('a::fs multiset)" 
  2169   shows "(\<Union>{supp x | x. x \<in># M}) \<subseteq> supp M"
  2154   shows "(\<Union>{supp x | x. x \<in># M}) \<subseteq> supp M"
  2170 proof -
  2155 proof -
  2171   have "(\<Union>{supp x | x. x \<in># M}) = (\<Union>{supp x | x. x \<in> set_mset M})" by simp
  2156   have "(\<Union>{supp x | x. x \<in># M}) = (\<Union>x \<in> set_mset M. supp x)" by auto
  2172   also have "... \<subseteq> (\<Union>x \<in> set_mset M. supp x)" by auto
       
  2173   also have "... = supp (set_mset M)"
  2157   also have "... = supp (set_mset M)"
  2174     by (simp add: supp_of_finite_sets)
  2158     by (simp add: supp_of_finite_sets)
  2175   also have " ... \<subseteq> supp M" by (rule supp_set_mset)
  2159   also have " ... \<subseteq> supp M" by (rule supp_set_mset)
  2176   finally show "(\<Union>{supp x | x. x \<in># M}) \<subseteq> supp M" .
  2160   finally show "(\<Union>{supp x | x. x \<in># M}) \<subseteq> supp M" .
  2177 qed
  2161 qed
  2178 
  2162 
  2179 lemma supp_of_multisets:
  2163 lemma supp_of_multisets:
  2180   fixes M::"('a::fs multiset)"
  2164   fixes M::"('a::fs multiset)"
  2181   shows "(supp M) = (\<Union>{supp x | x. x :# M})"
  2165   shows "(supp M) = (\<Union>{supp x | x. x \<in># M})"
  2182 apply(rule subset_antisym)
  2166 apply(rule subset_antisym)
  2183 apply(rule supp_is_subset)
  2167 apply(rule supp_is_subset)
  2184 apply(rule Union_supports_multiset)
  2168 apply(rule Union_supports_multiset)
  2185 apply(rule Union_finite_multiset)
  2169 apply(rule Union_finite_multiset)
  2186 apply(rule Union_included_multiset)
  2170 apply(rule Union_included_multiset)
  2219 lemma fresh_empty_fset:
  2203 lemma fresh_empty_fset:
  2220   shows "a \<sharp> {||}"
  2204   shows "a \<sharp> {||}"
  2221 unfolding fresh_def
  2205 unfolding fresh_def
  2222 by (simp)
  2206 by (simp)
  2223 
  2207 
  2224 lemma supp_insert_fset [simp]:
  2208 lemma supp_finsert [simp]:
  2225   fixes x::"'a::fs"
  2209   fixes x::"'a::fs"
  2226   and   S::"'a fset"
  2210   and   S::"'a fset"
  2227   shows "supp (insert_fset x S) = supp x \<union> supp S"
  2211   shows "supp (finsert x S) = supp x \<union> supp S"
  2228   apply(subst supp_fset[symmetric])
  2212   apply(subst supp_fset[symmetric])
  2229   apply(simp add: supp_of_finite_insert)
  2213   apply(simp add: supp_of_finite_insert)
  2230   done
  2214   done
  2231 
  2215 
  2232 lemma fresh_insert_fset:
  2216 lemma fresh_finsert:
  2233   fixes x::"'a::fs"
  2217   fixes x::"'a::fs"
  2234   and   S::"'a fset"
  2218   and   S::"'a fset"
  2235   shows "a \<sharp> insert_fset x S \<longleftrightarrow> a \<sharp> x \<and> a \<sharp> S"
  2219   shows "a \<sharp> finsert x S \<longleftrightarrow> a \<sharp> x \<and> a \<sharp> S"
  2236   unfolding fresh_def
  2220   unfolding fresh_def
  2237   by (simp)
  2221   by simp
  2238 
  2222 
  2239 lemma fset_finite_supp:
  2223 lemma fset_finite_supp:
  2240   fixes S::"('a::fs) fset"
  2224   fixes S::"('a::fs) fset"
  2241   shows "finite (supp S)"
  2225   shows "finite (supp S)"
  2242   by (induct S) (simp_all add: finite_supp)
  2226   by (induct S) (simp_all add: finite_supp)
  3119   unfolding flip_def
  3103   unfolding flip_def
  3120   unfolding atom_eq_iff [symmetric]
  3104   unfolding atom_eq_iff [symmetric]
  3121   unfolding atom_eqvt [symmetric]
  3105   unfolding atom_eqvt [symmetric]
  3122   by simp_all
  3106   by simp_all
  3123 
  3107 
  3124 text {* the following two lemmas do not hold for at_base, 
  3108 text {* the following two lemmas do not hold for @{text at_base}, 
  3125   only for single sort atoms from at *}
  3109   only for single sort atoms from at *}
  3126 
  3110 
  3127 lemma flip_triple:
  3111 lemma flip_triple:
  3128   fixes a b c::"'a::at"
  3112   fixes a b c::"'a::at"
  3129   assumes "a \<noteq> b" and "c \<noteq> b"
  3113   assumes "a \<noteq> b" and "c \<noteq> b"