Nominal/Nominal2_Base.thy
changeset 2614 0d7a1703fe28
parent 2611 3d101f2f817c
child 2632 e8732350a29f
equal deleted inserted replaced
2613:1803104d76c9 2614:0d7a1703fe28
  1067     }
  1067     }
  1068     ultimately show "(p + q) \<bullet> a = (q + p) \<bullet> a" 
  1068     ultimately show "(p + q) \<bullet> a = (q + p) \<bullet> a" 
  1069       using asm by blast
  1069       using asm by blast
  1070   qed
  1070   qed
  1071 qed
  1071 qed
       
  1072 
       
  1073 lemma supp_plus_perm_eq:
       
  1074   fixes p q::perm
       
  1075   assumes asm: "supp p \<inter> supp q = {}"
       
  1076   shows "supp (p + q) = supp p \<union> supp q"
       
  1077 proof -
       
  1078   { fix a::"atom"
       
  1079     assume "a \<in> supp p"
       
  1080     then have "a \<notin> supp q" using asm by auto
       
  1081     then have "a \<in> supp (p + q)" using `a \<in> supp p` 
       
  1082       by (simp add: supp_perm)
       
  1083   }
       
  1084   moreover
       
  1085   { fix a::"atom"
       
  1086     assume "a \<in> supp q"
       
  1087     then have "a \<notin> supp p" using asm by auto
       
  1088     then have "a \<in> supp (q + p)" using `a \<in> supp q` 
       
  1089       by (simp add: supp_perm)
       
  1090     then have "a \<in> supp (p + q)" using asm plus_perm_eq
       
  1091       by metis
       
  1092   }
       
  1093   ultimately have "supp p \<union> supp q \<subseteq> supp (p + q)"
       
  1094     by blast
       
  1095   then show "supp (p + q) = supp p \<union> supp q" using supp_plus_perm
       
  1096     by blast
       
  1097 qed
       
  1098 
  1072 
  1099 
  1073 section {* Finite Support instances for other types *}
  1100 section {* Finite Support instances for other types *}
  1074 
  1101 
  1075 
  1102 
  1076 subsection {* Type @{typ "'a \<times> 'b"} is finitely-supported. *}
  1103 subsection {* Type @{typ "'a \<times> 'b"} is finitely-supported. *}
  1604 lemma at_set_avoiding_aux:
  1631 lemma at_set_avoiding_aux:
  1605   fixes Xs::"atom set"
  1632   fixes Xs::"atom set"
  1606   and   As::"atom set"
  1633   and   As::"atom set"
  1607   assumes b: "Xs \<subseteq> As"
  1634   assumes b: "Xs \<subseteq> As"
  1608   and     c: "finite As"
  1635   and     c: "finite As"
  1609   shows "\<exists>p. (p \<bullet> Xs) \<inter> As = {} \<and> (supp p) \<subseteq> (Xs \<union> (p \<bullet> Xs))"
  1636   shows "\<exists>p. (p \<bullet> Xs) \<inter> As = {} \<and> (supp p) = (Xs \<union> (p \<bullet> Xs))"
  1610 proof -
  1637 proof -
  1611   from b c have "finite Xs" by (rule finite_subset)
  1638   from b c have "finite Xs" by (rule finite_subset)
  1612   then show ?thesis using b
  1639   then show ?thesis using b
  1613   proof (induct rule: finite_subset_induct)
  1640   proof (induct rule: finite_subset_induct)
  1614     case empty
  1641     case empty
  1615     have "0 \<bullet> {} \<inter> As = {}" by simp
  1642     have "0 \<bullet> {} \<inter> As = {}" by simp
  1616     moreover
  1643     moreover
  1617     have "supp (0::perm) \<subseteq> {} \<union> 0 \<bullet> {}" by (simp add: supp_zero_perm)
  1644     have "supp (0::perm) = {} \<union> 0 \<bullet> {}" by (simp add: supp_zero_perm)
  1618     ultimately show ?case by blast
  1645     ultimately show ?case by blast
  1619   next
  1646   next
  1620     case (insert x Xs)
  1647     case (insert x Xs)
  1621     then obtain p where
  1648     then obtain p where
  1622       p1: "(p \<bullet> Xs) \<inter> As = {}" and 
  1649       p1: "(p \<bullet> Xs) \<inter> As = {}" and 
  1623       p2: "supp p \<subseteq> (Xs \<union> (p \<bullet> Xs))" by blast
  1650       p2: "supp p = (Xs \<union> (p \<bullet> Xs))" by blast
  1624     from `x \<in> As` p1 have "x \<notin> p \<bullet> Xs" by fast
  1651     from `x \<in> As` p1 have "x \<notin> p \<bullet> Xs" by fast
  1625     with `x \<notin> Xs` p2 have "x \<notin> supp p" by fast
  1652     with `x \<notin> Xs` p2 have "x \<notin> supp p" by fast
  1626     hence px: "p \<bullet> x = x" unfolding supp_perm by simp
  1653     hence px: "p \<bullet> x = x" unfolding supp_perm by simp
  1627     have "finite (As \<union> p \<bullet> Xs)"
  1654     have "finite (As \<union> p \<bullet> Xs \<union> supp p)"
  1628       using `finite As` `finite Xs`
  1655       using `finite As` `finite Xs`
  1629       by (simp add: permute_set_eq_image)
  1656       by (simp add: permute_set_eq_image finite_supp)
  1630     then obtain y where "y \<notin> (As \<union> p \<bullet> Xs)" "sort_of y = sort_of x"
  1657     then obtain y where "y \<notin> (As \<union> p \<bullet> Xs \<union> supp p)" "sort_of y = sort_of x"
  1631       by (rule obtain_atom)
  1658       by (rule obtain_atom)
  1632     hence y: "y \<notin> As" "y \<notin> p \<bullet> Xs" "sort_of y = sort_of x"
  1659     hence y: "y \<notin> As" "y \<notin> p \<bullet> Xs" "y \<notin> supp p" "sort_of y = sort_of x"
  1633       by simp_all
  1660       by simp_all
       
  1661     hence py: "p \<bullet> y = y" "x \<noteq> y" using `x \<in> As`
       
  1662       by (auto simp add: supp_perm)
  1634     let ?q = "(x \<rightleftharpoons> y) + p"
  1663     let ?q = "(x \<rightleftharpoons> y) + p"
  1635     have q: "?q \<bullet> insert x Xs = insert y (p \<bullet> Xs)"
  1664     have q: "?q \<bullet> insert x Xs = insert y (p \<bullet> Xs)"
  1636       unfolding insert_eqvt
  1665       unfolding insert_eqvt
  1637       using `p \<bullet> x = x` `sort_of y = sort_of x`
  1666       using `p \<bullet> x = x` `sort_of y = sort_of x`
  1638       using `x \<notin> p \<bullet> Xs` `y \<notin> p \<bullet> Xs`
  1667       using `x \<notin> p \<bullet> Xs` `y \<notin> p \<bullet> Xs`
  1639       by (simp add: swap_atom swap_set_not_in)
  1668       by (simp add: swap_atom swap_set_not_in)
  1640     have "?q \<bullet> insert x Xs \<inter> As = {}"
  1669     have "?q \<bullet> insert x Xs \<inter> As = {}"
  1641       using `y \<notin> As` `p \<bullet> Xs \<inter> As = {}`
  1670       using `y \<notin> As` `p \<bullet> Xs \<inter> As = {}`
  1642       unfolding q by simp
  1671       unfolding q by simp
  1643     moreover
  1672     moreover
  1644     have "supp ?q \<subseteq> insert x Xs \<union> ?q \<bullet> insert x Xs"
  1673     have "supp (x \<rightleftharpoons> y) \<inter> supp p = {}" using px py `sort_of y = sort_of x`
  1645       using p2 unfolding q
  1674       unfolding supp_swap by (simp add: supp_perm)
  1646       by (intro subset_trans [OF supp_plus_perm])
  1675     then have "supp ?q = (supp (x \<rightleftharpoons> y) \<union> supp p)" 
  1647          (auto simp add: supp_swap)
  1676       by (simp add: supp_plus_perm_eq)
       
  1677     then have "supp ?q = insert x Xs \<union> ?q \<bullet> insert x Xs"
       
  1678       using p2 `sort_of y = sort_of x` `x \<noteq> y` unfolding q supp_swap
       
  1679       by auto
  1648     ultimately show ?case by blast
  1680     ultimately show ?case by blast
  1649   qed
  1681   qed
  1650 qed
  1682 qed
  1651 
  1683 
  1652 lemma at_set_avoiding:
  1684 lemma at_set_avoiding:
  1653   assumes a: "finite Xs"
  1685   assumes a: "finite Xs"
  1654   and     b: "finite (supp c)"
  1686   and     b: "finite (supp c)"
  1655   obtains p::"perm" where "(p \<bullet> Xs)\<sharp>*c" and "(supp p) \<subseteq> (Xs \<union> (p \<bullet> Xs))"
  1687   obtains p::"perm" where "(p \<bullet> Xs)\<sharp>*c" and "(supp p) = (Xs \<union> (p \<bullet> Xs))"
  1656   using a b at_set_avoiding_aux [where Xs="Xs" and As="Xs \<union> supp c"]
  1688   using a b at_set_avoiding_aux [where Xs="Xs" and As="Xs \<union> supp c"]
  1657   unfolding fresh_star_def fresh_def by blast
  1689   unfolding fresh_star_def fresh_def by blast
  1658 
  1690 
  1659 lemma at_set_avoiding1:
  1691 lemma at_set_avoiding1:
  1660   assumes "finite xs"
  1692   assumes "finite xs"
  1681 
  1713 
  1682 lemma at_set_avoiding3:
  1714 lemma at_set_avoiding3:
  1683   assumes "finite xs"
  1715   assumes "finite xs"
  1684   and     "finite (supp c)" "finite (supp x)"
  1716   and     "finite (supp c)" "finite (supp x)"
  1685   and     "xs \<sharp>* x"
  1717   and     "xs \<sharp>* x"
  1686   shows "\<exists>p. (p \<bullet> xs) \<sharp>* c \<and> supp x \<sharp>* p \<and> supp p \<subseteq> xs \<union> (p \<bullet> xs)"
  1718   shows "\<exists>p. (p \<bullet> xs) \<sharp>* c \<and> supp x \<sharp>* p \<and> supp p = xs \<union> (p \<bullet> xs)"
  1687 using assms
  1719 using assms
  1688 apply(erule_tac c="(c, x)" in at_set_avoiding)
  1720 apply(erule_tac c="(c, x)" in at_set_avoiding)
  1689 apply(simp add: supp_Pair)
  1721 apply(simp add: supp_Pair)
  1690 apply(rule_tac x="p" in exI)
  1722 apply(rule_tac x="p" in exI)
  1691 apply(simp add: fresh_star_Pair)
  1723 apply(simp add: fresh_star_Pair)
  1692 apply(rule fresh_star_supp_conv)
  1724 apply(rule fresh_star_supp_conv)
  1693 apply(auto simp add: fresh_star_def)
  1725 apply(auto simp add: fresh_star_def)
  1694 done
  1726 done
  1695 
       
  1696 
  1727 
  1697 lemma at_set_avoiding2_atom:
  1728 lemma at_set_avoiding2_atom:
  1698   assumes "finite (supp c)" "finite (supp x)"
  1729   assumes "finite (supp c)" "finite (supp x)"
  1699   and     b: "a \<sharp> x"
  1730   and     b: "a \<sharp> x"
  1700   shows "\<exists>p. (p \<bullet> a) \<sharp> c \<and> supp x \<sharp>* p"
  1731   shows "\<exists>p. (p \<bullet> a) \<sharp> c \<and> supp x \<sharp>* p"
  1706     unfolding fresh_star_def Ball_def 
  1737     unfolding fresh_star_def Ball_def 
  1707     by(erule_tac x="p \<bullet> a" in allE) (simp add: permute_set_eq)
  1738     by(erule_tac x="p \<bullet> a" in allE) (simp add: permute_set_eq)
  1708   hence "p \<bullet> a \<sharp> c \<and> supp x \<sharp>* p" using p2 by blast
  1739   hence "p \<bullet> a \<sharp> c \<and> supp x \<sharp>* p" using p2 by blast
  1709   then show "\<exists>p. (p \<bullet> a) \<sharp> c \<and> supp x \<sharp>* p" by blast
  1740   then show "\<exists>p. (p \<bullet> a) \<sharp> c \<and> supp x \<sharp>* p" by blast
  1710 qed
  1741 qed
       
  1742 
  1711 
  1743 
  1712 section {* Renaming permutations *}
  1744 section {* Renaming permutations *}
  1713 
  1745 
  1714 lemma set_renaming_perm:
  1746 lemma set_renaming_perm:
  1715   assumes a: "p \<bullet> bs \<inter> bs = {}" 
  1747   assumes a: "p \<bullet> bs \<inter> bs = {}"