Nominal-General/nominal_library.ML
author Cezary Kaliszyk <kaliszyk@in.tum.de>
Mon, 19 Apr 2010 10:00:52 +0200
changeset 1876 b2efe803f1da
parent 1871 c704d129862b
child 1896 996d4411e95e
permissions -rw-r--r--
merge
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
1871
c704d129862b moved some general function into nominal_library.ML
Christian Urban <urbanc@in.tum.de>
parents: 1834
diff changeset
    10
  val mk_perm_ty: typ -> term -> term -> term
1833
2050b5723c04 added a library for basic nominal functions; separated nominal_eqvt file
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    11
  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
    12
  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
    13
9909cc3566c5 moved a couple of more functions to the library
Christian Urban <urbanc@in.tum.de>
parents: 1833
diff changeset
    14
  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
    15
  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
    16
end
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
2050b5723c04 added a library for basic nominal functions; separated nominal_eqvt file
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    19
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
    20
struct
2050b5723c04 added a library for basic nominal functions; separated nominal_eqvt file
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    21
2050b5723c04 added a library for basic nominal functions; separated nominal_eqvt file
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    22
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
    23
 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
    24
1871
c704d129862b moved some general function into nominal_library.ML
Christian Urban <urbanc@in.tum.de>
parents: 1834
diff changeset
    25
fun mk_perm_ty ty p trm =
1833
2050b5723c04 added a library for basic nominal functions; separated nominal_eqvt file
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    26
  Const (@{const_name "permute"}, @{typ "perm"} --> ty --> ty) $ p $ trm
1871
c704d129862b moved some general function into nominal_library.ML
Christian Urban <urbanc@in.tum.de>
parents: 1834
diff changeset
    27
c704d129862b moved some general function into nominal_library.ML
Christian Urban <urbanc@in.tum.de>
parents: 1834
diff changeset
    28
fun mk_perm p trm = mk_perm_ty (fastype_of trm) p trm
1833
2050b5723c04 added a library for basic nominal functions; separated nominal_eqvt file
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    29
1834
9909cc3566c5 moved a couple of more functions to the library
Christian Urban <urbanc@in.tum.de>
parents: 1833
diff changeset
    30
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
    31
  | 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
    32
1834
9909cc3566c5 moved a couple of more functions to the library
Christian Urban <urbanc@in.tum.de>
parents: 1833
diff changeset
    33
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
    34
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
    35
2050b5723c04 added a library for basic nominal functions; separated nominal_eqvt file
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    36
end (* structure *)
2050b5723c04 added a library for basic nominal functions; separated nominal_eqvt file
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    37
2050b5723c04 added a library for basic nominal functions; separated nominal_eqvt file
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    38
open Nominal_Library;