Nominal/Ex/ExPS8.thy
author Christian Urban <urbanc@in.tum.de>
Wed, 11 Aug 2010 16:23:50 +0800
changeset 2394 e2759a4dad4b
parent 2120 2786ff1df475
child 2436 3885dc2669f9
permissions -rw-r--r--
updated to Isabelle 11 Aug

theory ExPS8
imports "../NewParser"
begin

(* example 8 from Peter Sewell's bestiary *)

atom_decl name

ML {* val _ = cheat_fv_rsp := true *}
ML {* val _ = cheat_equivp := true *}
ML {* val _ = cheat_alpha_bn_rsp := true *}

nominal_datatype exp =
  EVar name
| EUnit
| EPair exp exp
| ELetRec l::lrbs e::exp bind_set "b_lrbs l" in l e
and fnclause =
  K x::name p::pat f::exp bind_set "b_pat p" in f
and fnclauses =
  S fnclause
| ORs fnclause fnclauses
and lrb =
  Clause fnclauses
and lrbs =
  Single lrb
| More lrb lrbs
and pat =
  PVar name
| PUnit
| PPair pat pat
binder
  b_lrbs :: "lrbs \<Rightarrow> atom set" and
  b_pat :: "pat \<Rightarrow> atom set" and
  b_fnclauses :: "fnclauses \<Rightarrow> atom set" and
  b_fnclause :: "fnclause \<Rightarrow> atom set" and
  b_lrb :: "lrb \<Rightarrow> atom set"
where
  "b_lrbs (Single l) = b_lrb l"
| "b_lrbs (More l ls) = b_lrb l \<union> b_lrbs ls"
| "b_pat (PVar x) = {atom x}"
| "b_pat (PUnit) = {}"
| "b_pat (PPair p1 p2) = b_pat p1 \<union> b_pat p2"
| "b_fnclauses (S fc) = (b_fnclause fc)"
| "b_fnclauses (ORs fc fcs) = (b_fnclause fc) \<union> (b_fnclauses fcs)"
| "b_lrb (Clause fcs) = (b_fnclauses fcs)"
| "b_fnclause (K x pat exp) = {atom x}"

thm exp_fnclause_fnclauses_lrb_lrbs_pat.fv
thm exp_fnclause_fnclauses_lrb_lrbs_pat.eq_iff

end