Nominal/Ex/Ex2.thy
author Christian Urban <urbanc@in.tum.de>
Mon, 07 Jun 2010 16:17:35 +0200
changeset 2216 1a9dbfe04f7d
parent 2177 9b566c5dc1f5
child 2301 8732ff59068b
permissions -rw-r--r--
new title for POPL paper

theory Ex2
imports "../NewParser"
begin

text {* example 2 *}

atom_decl name

nominal_datatype trm =
  Var "name"
| App "trm" "trm"
| Lam x::"name" t::"trm"          bind_set x in t
| Let p::"pat" "trm" t::"trm"     bind "f p" in t
and pat =
  PN
| PS "name"
| PD "name" "name"
binder
  f::"pat \<Rightarrow> atom list"
where
  "f PN = []"
| "f (PS x) = [atom x]"
| "f (PD x y) = [atom x, atom y]"

thm trm_pat.bn
thm trm_pat.perm
thm trm_pat.induct
thm trm_pat.distinct
thm trm_pat.fv[simplified trm_pat.supp(1-2)]

lemma lets_overlap1:
  "atom a \<noteq> atom b \<Longrightarrow> Let (PD a a) x y \<noteq> Let (PD a b) x y"
  by (simp add: trm_pat.eq_iff alphas)

lemma lets_overlap2:
  "atom a \<notin> supp y \<Longrightarrow> atom b \<notin> supp y \<Longrightarrow> Let (PD a a) x y = Let (PD b b) x y"
  apply (simp add: trm_pat.eq_iff alphas trm_pat.supp)
  apply (rule_tac x="(a\<leftrightarrow>b)" in exI)
  apply (simp add: eqvts)
  apply (rule conjI)
  prefer 2
  apply (rule Nominal2_Supp.supp_perm_eq)
  apply (unfold fresh_star_def)
  apply (unfold fresh_def)
  apply (unfold flip_def)
  apply (simp_all add: supp_swap)
  apply auto
  done

end