src/Pure/Tools/named_thms.ML
author haftmann
Sun, 18 Jan 2009 21:12:06 +0100
changeset 29554 7e5e5ebb7bf7
parent 26724 ff6ff3a9010e
child 29579 cb520b766e00
permissions -rw-r--r--
added churn script
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
24047
47b588ce11ec Named collections of theorems in canonical order.
wenzelm
parents:
diff changeset
     1
(*  Title:      Pure/Tools/named_thms.ML
47b588ce11ec Named collections of theorems in canonical order.
wenzelm
parents:
diff changeset
     2
    ID:         $Id$
47b588ce11ec Named collections of theorems in canonical order.
wenzelm
parents:
diff changeset
     3
    Author:     Makarius
47b588ce11ec Named collections of theorems in canonical order.
wenzelm
parents:
diff changeset
     4
47b588ce11ec Named collections of theorems in canonical order.
wenzelm
parents:
diff changeset
     5
Named collections of theorems in canonical order.
47b588ce11ec Named collections of theorems in canonical order.
wenzelm
parents:
diff changeset
     6
*)
47b588ce11ec Named collections of theorems in canonical order.
wenzelm
parents:
diff changeset
     7
47b588ce11ec Named collections of theorems in canonical order.
wenzelm
parents:
diff changeset
     8
signature NAMED_THMS =
47b588ce11ec Named collections of theorems in canonical order.
wenzelm
parents:
diff changeset
     9
sig
47b588ce11ec Named collections of theorems in canonical order.
wenzelm
parents:
diff changeset
    10
  val get: Proof.context -> thm list
26363
9d95309f8069 export add/del_thm;
wenzelm
parents: 24867
diff changeset
    11
  val add_thm: thm -> Context.generic -> Context.generic
9d95309f8069 export add/del_thm;
wenzelm
parents: 24867
diff changeset
    12
  val del_thm: thm -> Context.generic -> Context.generic
24047
47b588ce11ec Named collections of theorems in canonical order.
wenzelm
parents:
diff changeset
    13
  val add: attribute
47b588ce11ec Named collections of theorems in canonical order.
wenzelm
parents:
diff changeset
    14
  val del: attribute
47b588ce11ec Named collections of theorems in canonical order.
wenzelm
parents:
diff changeset
    15
  val setup: theory -> theory
47b588ce11ec Named collections of theorems in canonical order.
wenzelm
parents:
diff changeset
    16
end;
47b588ce11ec Named collections of theorems in canonical order.
wenzelm
parents:
diff changeset
    17
47b588ce11ec Named collections of theorems in canonical order.
wenzelm
parents:
diff changeset
    18
functor NamedThmsFun(val name: string val description: string): NAMED_THMS =
47b588ce11ec Named collections of theorems in canonical order.
wenzelm
parents:
diff changeset
    19
struct
47b588ce11ec Named collections of theorems in canonical order.
wenzelm
parents:
diff changeset
    20
47b588ce11ec Named collections of theorems in canonical order.
wenzelm
parents:
diff changeset
    21
structure Data = GenericDataFun
47b588ce11ec Named collections of theorems in canonical order.
wenzelm
parents:
diff changeset
    22
(
47b588ce11ec Named collections of theorems in canonical order.
wenzelm
parents:
diff changeset
    23
  type T = thm list;
47b588ce11ec Named collections of theorems in canonical order.
wenzelm
parents:
diff changeset
    24
  val empty = [];
47b588ce11ec Named collections of theorems in canonical order.
wenzelm
parents:
diff changeset
    25
  val extend = I;
47b588ce11ec Named collections of theorems in canonical order.
wenzelm
parents:
diff changeset
    26
  fun merge _ = Thm.merge_thms;
47b588ce11ec Named collections of theorems in canonical order.
wenzelm
parents:
diff changeset
    27
);
47b588ce11ec Named collections of theorems in canonical order.
wenzelm
parents:
diff changeset
    28
47b588ce11ec Named collections of theorems in canonical order.
wenzelm
parents:
diff changeset
    29
val get = Data.get o Context.Proof;
47b588ce11ec Named collections of theorems in canonical order.
wenzelm
parents:
diff changeset
    30
26363
9d95309f8069 export add/del_thm;
wenzelm
parents: 24867
diff changeset
    31
val add_thm = Data.map o Thm.add_thm;
9d95309f8069 export add/del_thm;
wenzelm
parents: 24867
diff changeset
    32
val del_thm = Data.map o Thm.del_thm;
9d95309f8069 export add/del_thm;
wenzelm
parents: 24867
diff changeset
    33
9d95309f8069 export add/del_thm;
wenzelm
parents: 24867
diff changeset
    34
val add = Thm.declaration_attribute add_thm;
9d95309f8069 export add/del_thm;
wenzelm
parents: 24867
diff changeset
    35
val del = Thm.declaration_attribute del_thm;
24047
47b588ce11ec Named collections of theorems in canonical order.
wenzelm
parents:
diff changeset
    36
47b588ce11ec Named collections of theorems in canonical order.
wenzelm
parents:
diff changeset
    37
val setup =
26397
df68e8dfd0e3 add dynamic fact binding;
wenzelm
parents: 26363
diff changeset
    38
  Attrib.add_attributes [(name, Attrib.add_del_args add del, "declaration of " ^ description)] #>
df68e8dfd0e3 add dynamic fact binding;
wenzelm
parents: 26363
diff changeset
    39
  PureThy.add_thms_dynamic (name, Data.get);
24047
47b588ce11ec Named collections of theorems in canonical order.
wenzelm
parents:
diff changeset
    40
47b588ce11ec Named collections of theorems in canonical order.
wenzelm
parents:
diff changeset
    41
end;