Nominal/Nominal2_FSet.thy
author Christian Urban <urbanc@in.tum.de>
Wed, 28 Apr 2010 08:32:33 +0200
changeset 1973 fc5ce7f22b74
parent 1933 9eab1dfc14d2
child 2004 b96e8cf86891
permissions -rw-r--r--
use the more general type-class at_base

theory Nominal2_FSet
imports "../Nominal-General/Nominal2_Supp"
        FSet 
begin

lemma permute_rsp_fset[quot_respect]:
  "(op = ===> list_eq ===> list_eq) permute permute"
  apply (simp add: eqvts[symmetric])
  apply clarify
  apply (subst permute_minus_cancel(1)[symmetric, of "xb"])
  apply (subst mem_eqvt[symmetric])
  apply (subst (2) permute_minus_cancel(1)[symmetric, of "xb"])
  apply (subst mem_eqvt[symmetric])
  apply (erule_tac x="- x \<bullet> xb" in allE)
  apply simp
  done

instantiation FSet.fset :: (pt) pt
begin

quotient_definition
  "permute_fset :: perm \<Rightarrow> 'a fset \<Rightarrow> 'a fset"
is
  "permute :: perm \<Rightarrow> 'a list \<Rightarrow> 'a list"

instance 
proof
  fix x :: "'a fset" and p q :: "perm"
  show "0 \<bullet> x = x"
    by (lifting permute_zero [where 'a="'a list"])
  show "(p + q) \<bullet> x = p \<bullet> q \<bullet> x"
    by (lifting permute_plus [where 'a="'a list"])
qed

end

lemma permute_fset[eqvt]:
  "(p \<bullet> {||}) = ({||} :: 'a::pt fset)"
  "p \<bullet> finsert (x :: 'a :: pt) xs = finsert (p \<bullet> x) (p \<bullet> xs)"
  by (lifting permute_list.simps)

lemma fmap_eqvt[eqvt]: 
  shows "p \<bullet> (fmap f l) = fmap (p \<bullet> f) (p \<bullet> l)"
  by (lifting map_eqvt)

lemma fset_to_set_eqvt[eqvt]: 
  shows "p \<bullet> (fset_to_set x) = fset_to_set (p \<bullet> x)"
  by (lifting set_eqvt)

lemma fin_fset_to_set:
  shows "finite (fset_to_set x)"
  by (induct x) (simp_all)

lemma supp_fset_to_set:
  "supp (fset_to_set x) = supp x"
  apply (simp add: supp_def)
  apply (simp add: eqvts)
  apply (simp add: fset_cong)
  done

lemma atom_fmap_cong:
  shows "(fmap atom x = fmap atom y) = (x = y)"
  apply(rule inj_fmap_eq_iff)
  apply(simp add: inj_on_def)
  done

lemma supp_fmap_atom:
  shows "supp (fmap atom x) = supp x"
  unfolding supp_def
  apply (perm_simp)
  apply (simp add: atom_fmap_cong)
  done

lemma supp_atom_finsert:
  "supp (finsert (x :: atom) S) = supp x \<union> supp S"
  apply (subst supp_fset_to_set[symmetric])
  apply (simp add: supp_finite_atom_set)
  apply (simp add: supp_atom_insert[OF fin_fset_to_set])
  apply (simp add: supp_fset_to_set)
  done

lemma supp_at_finsert:
  fixes a::"'a::at_base"
  shows "supp (finsert a S) = supp a \<union> supp S"
  apply (subst supp_fset_to_set[symmetric])
  apply (simp add: supp_finite_atom_set)
  apply (simp add: supp_at_base_insert[OF fin_fset_to_set])
  apply (simp add: supp_fset_to_set)
  done

lemma supp_fempty:
  "supp {||} = {}"
  by (simp add: supp_def eqvts)

instance fset :: (at_base) fs
  apply (default)
  apply (induct_tac x rule: fset_induct)
  apply (simp add: supp_fempty)
  apply (simp add: supp_at_finsert)
  apply (simp add: supp_at_base)
  done

lemma supp_at_fset:
  fixes S::"('a::at_base) fset"
  shows "supp S = fset_to_set (fmap atom S)"
  apply (induct S)
  apply (simp add: supp_fempty)
  apply (simp add: supp_at_finsert)
  apply (simp add: supp_at_base)
  done

end