Nominal-General/nominal_library.ML
author Christian Urban <urbanc@in.tum.de>
Wed, 14 Apr 2010 15:02:07 +0200
changeset 1834 9909cc3566c5
parent 1833 2050b5723c04
child 1871 c704d129862b
permissions -rw-r--r--
moved a couple of more functions to the library
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1833
2050b5723c04 added a library for basic nominal functions; separated nominal_eqvt file
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     1
(*  Title:      nominal_library.ML
2050b5723c04 added a library for basic nominal functions; separated nominal_eqvt file
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     2
    Author:     Christian Urban
2050b5723c04 added a library for basic nominal functions; separated nominal_eqvt file
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     3
2050b5723c04 added a library for basic nominal functions; separated nominal_eqvt file
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     4
  Basic function for nominal.
2050b5723c04 added a library for basic nominal functions; separated nominal_eqvt file
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     5
*)
2050b5723c04 added a library for basic nominal functions; separated nominal_eqvt file
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     6
2050b5723c04 added a library for basic nominal functions; separated nominal_eqvt file
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     7
signature NOMINAL_LIBRARY =
2050b5723c04 added a library for basic nominal functions; separated nominal_eqvt file
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     8
sig
2050b5723c04 added a library for basic nominal functions; separated nominal_eqvt file
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     9
  val mk_minus: term -> term
2050b5723c04 added a library for basic nominal functions; separated nominal_eqvt file
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    10
  val mk_perm: term -> term -> term
1834
9909cc3566c5 moved a couple of more functions to the library
Christian Urban <urbanc@in.tum.de>
parents: 1833
diff changeset
    11
  val dest_perm: term -> term * term
9909cc3566c5 moved a couple of more functions to the library
Christian Urban <urbanc@in.tum.de>
parents: 1833
diff changeset
    12
9909cc3566c5 moved a couple of more functions to the library
Christian Urban <urbanc@in.tum.de>
parents: 1833
diff changeset
    13
  val mk_equiv: thm -> thm
9909cc3566c5 moved a couple of more functions to the library
Christian Urban <urbanc@in.tum.de>
parents: 1833
diff changeset
    14
  val safe_mk_equiv: thm -> thm
1833
2050b5723c04 added a library for basic nominal functions; separated nominal_eqvt file
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    15
end
2050b5723c04 added a library for basic nominal functions; separated nominal_eqvt file
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    16
2050b5723c04 added a library for basic nominal functions; separated nominal_eqvt file
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    17
2050b5723c04 added a library for basic nominal functions; separated nominal_eqvt file
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    18
structure Nominal_Library: NOMINAL_LIBRARY =
2050b5723c04 added a library for basic nominal functions; separated nominal_eqvt file
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    19
struct
2050b5723c04 added a library for basic nominal functions; separated nominal_eqvt file
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    20
2050b5723c04 added a library for basic nominal functions; separated nominal_eqvt file
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    21
fun mk_minus p = 
2050b5723c04 added a library for basic nominal functions; separated nominal_eqvt file
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    22
 Const (@{const_name "uminus"}, @{typ "perm => perm"}) $ p
2050b5723c04 added a library for basic nominal functions; separated nominal_eqvt file
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    23
2050b5723c04 added a library for basic nominal functions; separated nominal_eqvt file
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    24
fun mk_perm p trm =
2050b5723c04 added a library for basic nominal functions; separated nominal_eqvt file
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    25
let
2050b5723c04 added a library for basic nominal functions; separated nominal_eqvt file
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    26
  val ty = fastype_of trm
2050b5723c04 added a library for basic nominal functions; separated nominal_eqvt file
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    27
in
2050b5723c04 added a library for basic nominal functions; separated nominal_eqvt file
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    28
  Const (@{const_name "permute"}, @{typ "perm"} --> ty --> ty) $ p $ trm
2050b5723c04 added a library for basic nominal functions; separated nominal_eqvt file
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    29
end
2050b5723c04 added a library for basic nominal functions; separated nominal_eqvt file
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    30
1834
9909cc3566c5 moved a couple of more functions to the library
Christian Urban <urbanc@in.tum.de>
parents: 1833
diff changeset
    31
fun dest_perm (Const (@{const_name "permute"}, _) $ p $ t) = (p, t)
9909cc3566c5 moved a couple of more functions to the library
Christian Urban <urbanc@in.tum.de>
parents: 1833
diff changeset
    32
  | dest_perm t = raise TERM ("dest_perm", [t])
1833
2050b5723c04 added a library for basic nominal functions; separated nominal_eqvt file
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    33
1834
9909cc3566c5 moved a couple of more functions to the library
Christian Urban <urbanc@in.tum.de>
parents: 1833
diff changeset
    34
fun mk_equiv r = r RS @{thm eq_reflection};
9909cc3566c5 moved a couple of more functions to the library
Christian Urban <urbanc@in.tum.de>
parents: 1833
diff changeset
    35
fun safe_mk_equiv r = mk_equiv r handle Thm.THM _ => r;
1833
2050b5723c04 added a library for basic nominal functions; separated nominal_eqvt file
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    36
2050b5723c04 added a library for basic nominal functions; separated nominal_eqvt file
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    37
end (* structure *)
2050b5723c04 added a library for basic nominal functions; separated nominal_eqvt file
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    38
2050b5723c04 added a library for basic nominal functions; separated nominal_eqvt file
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    39
open Nominal_Library;