Nominal/Ex/LetFun.thy
author Christian Urban <urbanc@in.tum.de>
Sun, 29 Aug 2010 13:36:03 +0800
changeset 2454 9ffee4eb1ae1
child 2475 486d4647bb37
permissions -rw-r--r--
renamed NewParser to Nominal2
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2454
9ffee4eb1ae1 renamed NewParser to Nominal2
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     1
theory LetFun
9ffee4eb1ae1 renamed NewParser to Nominal2
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     2
imports "../Nominal2"
9ffee4eb1ae1 renamed NewParser to Nominal2
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     3
begin
9ffee4eb1ae1 renamed NewParser to Nominal2
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     4
9ffee4eb1ae1 renamed NewParser to Nominal2
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     5
atom_decl name
9ffee4eb1ae1 renamed NewParser to Nominal2
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     6
9ffee4eb1ae1 renamed NewParser to Nominal2
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     7
(* x is bound in both e1 and e2
9ffee4eb1ae1 renamed NewParser to Nominal2
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     8
   names in p are bound only in e1 *)
9ffee4eb1ae1 renamed NewParser to Nominal2
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     9
9ffee4eb1ae1 renamed NewParser to Nominal2
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    10
nominal_datatype exp =
9ffee4eb1ae1 renamed NewParser to Nominal2
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    11
  Var name
9ffee4eb1ae1 renamed NewParser to Nominal2
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    12
| Pair exp exp
9ffee4eb1ae1 renamed NewParser to Nominal2
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    13
| LetRec x::name p::pat e1::exp e2::exp  bind x in e2, bind x "bp p" in e1
9ffee4eb1ae1 renamed NewParser to Nominal2
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    14
and pat =
9ffee4eb1ae1 renamed NewParser to Nominal2
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    15
  PVar name
9ffee4eb1ae1 renamed NewParser to Nominal2
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    16
| PUnit
9ffee4eb1ae1 renamed NewParser to Nominal2
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    17
| PPair pat pat
9ffee4eb1ae1 renamed NewParser to Nominal2
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    18
binder
9ffee4eb1ae1 renamed NewParser to Nominal2
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    19
  bp :: "pat \<Rightarrow> atom list"
9ffee4eb1ae1 renamed NewParser to Nominal2
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    20
where
9ffee4eb1ae1 renamed NewParser to Nominal2
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    21
  "bp (PVar x) = [atom x]"
9ffee4eb1ae1 renamed NewParser to Nominal2
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    22
| "bp (PUnit) = []"
9ffee4eb1ae1 renamed NewParser to Nominal2
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    23
| "bp (PPair p1 p2) = bp p1 @ bp p2"
9ffee4eb1ae1 renamed NewParser to Nominal2
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    24
9ffee4eb1ae1 renamed NewParser to Nominal2
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    25
end