582 |
592 |
583 instance |
593 instance |
584 by (default) (induct_tac [!] x, simp_all) |
594 by (default) (induct_tac [!] x, simp_all) |
585 |
595 |
586 end |
596 end |
|
597 |
|
598 |
|
599 subsection {* Permutations for fsets *} |
|
600 |
|
601 lemma permute_fset_rsp[quot_respect]: |
|
602 shows "(op = ===> list_eq ===> list_eq) permute permute" |
|
603 unfolding fun_rel_def |
|
604 by (simp add: set_eqvt[symmetric]) |
|
605 |
|
606 instantiation fset :: (pt) pt |
|
607 begin |
|
608 |
|
609 quotient_definition |
|
610 "permute_fset :: perm \<Rightarrow> 'a fset \<Rightarrow> 'a fset" |
|
611 is |
|
612 "permute :: perm \<Rightarrow> 'a list \<Rightarrow> 'a list" |
|
613 |
|
614 instance |
|
615 proof |
|
616 fix x :: "'a fset" and p q :: "perm" |
|
617 show "0 \<bullet> x = x" by (descending) (simp) |
|
618 show "(p + q) \<bullet> x = p \<bullet> q \<bullet> x" by (descending) (simp) |
|
619 qed |
|
620 |
|
621 end |
|
622 |
|
623 lemma permute_fset [simp]: |
|
624 fixes S::"('a::pt) fset" |
|
625 shows "(p \<bullet> {||}) = ({||} ::('a::pt) fset)" |
|
626 and "(p \<bullet> insert_fset x S) = insert_fset (p \<bullet> x) (p \<bullet> S)" |
|
627 by (lifting permute_list.simps) |
|
628 |
|
629 |
587 |
630 |
588 subsection {* Permutations for @{typ char}, @{typ nat}, and @{typ int} *} |
631 subsection {* Permutations for @{typ char}, @{typ nat}, and @{typ int} *} |
589 |
632 |
590 instantiation char :: pt |
633 instantiation char :: pt |
591 begin |
634 begin |
1034 by (simp add: supp_def) |
1078 by (simp add: supp_def) |
1035 |
1079 |
1036 lemma fresh_Unit: |
1080 lemma fresh_Unit: |
1037 shows "a \<sharp> ()" |
1081 shows "a \<sharp> ()" |
1038 by (simp add: fresh_def supp_Unit) |
1082 by (simp add: fresh_def supp_Unit) |
1039 |
|
1040 |
|
1041 |
1083 |
1042 instance prod :: (fs, fs) fs |
1084 instance prod :: (fs, fs) fs |
1043 apply default |
1085 apply default |
1044 apply (induct_tac x) |
1086 apply (induct_tac x) |
1045 apply (simp add: supp_Pair finite_supp) |
1087 apply (simp add: supp_Pair finite_supp) |
1046 done |
1088 done |
1047 |
1089 |
|
1090 |
1048 subsection {* Type @{typ "'a + 'b"} is finitely supported *} |
1091 subsection {* Type @{typ "'a + 'b"} is finitely supported *} |
1049 |
1092 |
1050 lemma supp_Inl: |
1093 lemma supp_Inl: |
1051 shows "supp (Inl x) = supp x" |
1094 shows "supp (Inl x) = supp x" |
1052 by (simp add: supp_def) |
1095 by (simp add: supp_def) |
1188 then show "(\<Union>x \<in> S. supp x) supports S" |
1233 then show "(\<Union>x \<in> S. supp x) supports S" |
1189 unfolding supports_def |
1234 unfolding supports_def |
1190 by (simp add: fresh_def[symmetric] swap_fresh_fresh) |
1235 by (simp add: fresh_def[symmetric] swap_fresh_fresh) |
1191 qed |
1236 qed |
1192 |
1237 |
1193 lemma Union_of_fin_supp_sets: |
1238 lemma Union_of_finite_supp_sets: |
1194 fixes S::"('a::fs set)" |
1239 fixes S::"('a::fs set)" |
1195 assumes fin: "finite S" |
1240 assumes fin: "finite S" |
1196 shows "finite (\<Union>x\<in>S. supp x)" |
1241 shows "finite (\<Union>x\<in>S. supp x)" |
1197 using fin by (induct) (auto simp add: finite_supp) |
1242 using fin by (induct) (auto simp add: finite_supp) |
1198 |
1243 |
1201 assumes fin: "finite S" |
1246 assumes fin: "finite S" |
1202 shows "(\<Union>x\<in>S. supp x) \<subseteq> supp S" |
1247 shows "(\<Union>x\<in>S. supp x) \<subseteq> supp S" |
1203 proof - |
1248 proof - |
1204 have "(\<Union>x\<in>S. supp x) = supp (\<Union>x\<in>S. supp x)" |
1249 have "(\<Union>x\<in>S. supp x) = supp (\<Union>x\<in>S. supp x)" |
1205 by (rule supp_finite_atom_set[symmetric]) |
1250 by (rule supp_finite_atom_set[symmetric]) |
1206 (rule Union_of_fin_supp_sets[OF fin]) |
1251 (rule Union_of_finite_supp_sets[OF fin]) |
1207 also have "\<dots> \<subseteq> supp S" |
1252 also have "\<dots> \<subseteq> supp S" |
1208 by (rule supp_subset_fresh) |
1253 by (rule supp_subset_fresh) |
1209 (simp add: Union_fresh) |
1254 (simp add: Union_fresh) |
1210 finally show "(\<Union>x\<in>S. supp x) \<subseteq> supp S" . |
1255 finally show "(\<Union>x\<in>S. supp x) \<subseteq> supp S" . |
1211 qed |
1256 qed |
1212 |
1257 |
1213 lemma supp_of_fin_sets: |
1258 lemma supp_of_finite_sets: |
1214 fixes S::"('a::fs set)" |
1259 fixes S::"('a::fs set)" |
1215 assumes fin: "finite S" |
1260 assumes fin: "finite S" |
1216 shows "(supp S) = (\<Union>x\<in>S. supp x)" |
1261 shows "(supp S) = (\<Union>x\<in>S. supp x)" |
1217 apply(rule subset_antisym) |
1262 apply(rule subset_antisym) |
1218 apply(rule supp_is_subset) |
1263 apply(rule supp_is_subset) |
1219 apply(rule Union_supports_set) |
1264 apply(rule Union_supports_set) |
1220 apply(rule Union_of_fin_supp_sets[OF fin]) |
1265 apply(rule Union_of_finite_supp_sets[OF fin]) |
1221 apply(rule Union_included_in_supp[OF fin]) |
1266 apply(rule Union_included_in_supp[OF fin]) |
1222 done |
1267 done |
1223 |
1268 |
1224 lemma supp_of_fin_union: |
1269 lemma finite_sets_supp: |
|
1270 fixes S::"('a::fs set)" |
|
1271 assumes "finite S" |
|
1272 shows "finite (supp S)" |
|
1273 using assms |
|
1274 by (simp only: supp_of_finite_sets Union_of_finite_supp_sets) |
|
1275 |
|
1276 lemma supp_of_finite_union: |
1225 fixes S T::"('a::fs) set" |
1277 fixes S T::"('a::fs) set" |
1226 assumes fin1: "finite S" |
1278 assumes fin1: "finite S" |
1227 and fin2: "finite T" |
1279 and fin2: "finite T" |
1228 shows "supp (S \<union> T) = supp S \<union> supp T" |
1280 shows "supp (S \<union> T) = supp S \<union> supp T" |
1229 using fin1 fin2 |
1281 using fin1 fin2 |
1230 by (simp add: supp_of_fin_sets) |
1282 by (simp add: supp_of_finite_sets) |
1231 |
1283 |
1232 lemma supp_of_fin_insert: |
1284 lemma supp_of_finite_insert: |
1233 fixes S::"('a::fs) set" |
1285 fixes S::"('a::fs) set" |
1234 assumes fin: "finite S" |
1286 assumes fin: "finite S" |
1235 shows "supp (insert x S) = supp x \<union> supp S" |
1287 shows "supp (insert x S) = supp x \<union> supp S" |
1236 using fin |
1288 using fin |
1237 by (simp add: supp_of_fin_sets) |
1289 by (simp add: supp_of_finite_sets) |
|
1290 |
|
1291 |
|
1292 subsection {* Type @{typ "'a fset"} is finitely supported *} |
|
1293 |
|
1294 lemma fset_eqvt: |
|
1295 shows "p \<bullet> (fset S) = fset (p \<bullet> S)" |
|
1296 by (lifting set_eqvt) |
|
1297 |
|
1298 lemma supp_fset [simp]: |
|
1299 shows "supp (fset S) = supp S" |
|
1300 unfolding supp_def |
|
1301 by (simp add: fset_eqvt fset_cong) |
|
1302 |
|
1303 lemma supp_empty_fset [simp]: |
|
1304 shows "supp {||} = {}" |
|
1305 unfolding supp_def |
|
1306 by simp |
|
1307 |
|
1308 lemma supp_insert_fset [simp]: |
|
1309 fixes x::"'a::fs" |
|
1310 and S::"'a fset" |
|
1311 shows "supp (insert_fset x S) = supp x \<union> supp S" |
|
1312 apply(subst supp_fset[symmetric]) |
|
1313 apply(simp add: supp_fset supp_of_finite_insert) |
|
1314 done |
|
1315 |
|
1316 lemma fset_finite_supp: |
|
1317 fixes S::"('a::fs) fset" |
|
1318 shows "finite (supp S)" |
|
1319 by (induct S) (simp_all add: finite_supp) |
|
1320 |
|
1321 |
|
1322 instance fset :: (fs) fs |
|
1323 apply (default) |
|
1324 apply (rule fset_finite_supp) |
|
1325 done |
1238 |
1326 |
1239 |
1327 |
1240 section {* Fresh-Star *} |
1328 section {* Fresh-Star *} |
1241 |
1329 |
1242 |
1330 |