src/HOL/Library/reify_data.ML
author huffman
Wed, 18 Feb 2009 19:32:26 -0800
changeset 29985 57975b45ab70
parent 29650 cc3958d31b1d
child 30528 7173bf123335
permissions -rw-r--r--
split polynomial-related stuff from Deriv.thy into Library/Poly_Deriv.thy
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
29650
cc3958d31b1d Reflection.thy now in HOL/Library
haftmann
parents: 25979
diff changeset
     1
(*  Title:      HOL/Library/reflection_data.ML
23545
2fddae6056ab Context Data for the reflection and reification methods
chaieb
parents:
diff changeset
     2
    Author:     Amine Chaieb, TU Muenchen
2fddae6056ab Context Data for the reflection and reification methods
chaieb
parents:
diff changeset
     3
24045
bead02a55952 renamed Drule.add/del/merge_rules to Thm.add/del/merge_thms;
wenzelm
parents: 23647
diff changeset
     4
Data for the reification and reflection methods.
23545
2fddae6056ab Context Data for the reflection and reification methods
chaieb
parents:
diff changeset
     5
*)
2fddae6056ab Context Data for the reflection and reification methods
chaieb
parents:
diff changeset
     6
2fddae6056ab Context Data for the reflection and reification methods
chaieb
parents:
diff changeset
     7
signature REIFY_DATA =
2fddae6056ab Context Data for the reflection and reification methods
chaieb
parents:
diff changeset
     8
sig
29650
cc3958d31b1d Reflection.thy now in HOL/Library
haftmann
parents: 25979
diff changeset
     9
  val get: Proof.context -> thm list * thm list
cc3958d31b1d Reflection.thy now in HOL/Library
haftmann
parents: 25979
diff changeset
    10
  val add: attribute
23606
60950b22dcbf Cleaned add and del attributes
chaieb
parents: 23545
diff changeset
    11
  val del: attribute
29650
cc3958d31b1d Reflection.thy now in HOL/Library
haftmann
parents: 25979
diff changeset
    12
  val radd: attribute
cc3958d31b1d Reflection.thy now in HOL/Library
haftmann
parents: 25979
diff changeset
    13
  val rdel: attribute
23545
2fddae6056ab Context Data for the reflection and reification methods
chaieb
parents:
diff changeset
    14
  val setup: theory -> theory
2fddae6056ab Context Data for the reflection and reification methods
chaieb
parents:
diff changeset
    15
end;
2fddae6056ab Context Data for the reflection and reification methods
chaieb
parents:
diff changeset
    16
2fddae6056ab Context Data for the reflection and reification methods
chaieb
parents:
diff changeset
    17
structure Reify_Data : REIFY_DATA =
2fddae6056ab Context Data for the reflection and reification methods
chaieb
parents:
diff changeset
    18
struct
2fddae6056ab Context Data for the reflection and reification methods
chaieb
parents:
diff changeset
    19
2fddae6056ab Context Data for the reflection and reification methods
chaieb
parents:
diff changeset
    20
structure Data = GenericDataFun
24045
bead02a55952 renamed Drule.add/del/merge_rules to Thm.add/del/merge_thms;
wenzelm
parents: 23647
diff changeset
    21
(
29650
cc3958d31b1d Reflection.thy now in HOL/Library
haftmann
parents: 25979
diff changeset
    22
  type T = thm list * thm list;
cc3958d31b1d Reflection.thy now in HOL/Library
haftmann
parents: 25979
diff changeset
    23
  val empty = ([], []);
cc3958d31b1d Reflection.thy now in HOL/Library
haftmann
parents: 25979
diff changeset
    24
  val extend = I;
cc3958d31b1d Reflection.thy now in HOL/Library
haftmann
parents: 25979
diff changeset
    25
  fun merge _ = pairself Thm.merge_thms;
24045
bead02a55952 renamed Drule.add/del/merge_rules to Thm.add/del/merge_thms;
wenzelm
parents: 23647
diff changeset
    26
);
23545
2fddae6056ab Context Data for the reflection and reification methods
chaieb
parents:
diff changeset
    27
2fddae6056ab Context Data for the reflection and reification methods
chaieb
parents:
diff changeset
    28
val get = Data.get o Context.Proof;
2fddae6056ab Context Data for the reflection and reification methods
chaieb
parents:
diff changeset
    29
29650
cc3958d31b1d Reflection.thy now in HOL/Library
haftmann
parents: 25979
diff changeset
    30
val add = Thm.declaration_attribute (Data.map o apfst o Thm.add_thm);
cc3958d31b1d Reflection.thy now in HOL/Library
haftmann
parents: 25979
diff changeset
    31
val del = Thm.declaration_attribute (Data.map o apfst o Thm.del_thm);
cc3958d31b1d Reflection.thy now in HOL/Library
haftmann
parents: 25979
diff changeset
    32
val radd = Thm.declaration_attribute (Data.map o apsnd o Thm.add_thm);
cc3958d31b1d Reflection.thy now in HOL/Library
haftmann
parents: 25979
diff changeset
    33
val rdel = Thm.declaration_attribute (Data.map o apsnd o Thm.del_thm);
23545
2fddae6056ab Context Data for the reflection and reification methods
chaieb
parents:
diff changeset
    34
29650
cc3958d31b1d Reflection.thy now in HOL/Library
haftmann
parents: 25979
diff changeset
    35
val setup = Attrib.add_attributes
cc3958d31b1d Reflection.thy now in HOL/Library
haftmann
parents: 25979
diff changeset
    36
  [("reify", Attrib.add_del_args add del, "Reify data"),
cc3958d31b1d Reflection.thy now in HOL/Library
haftmann
parents: 25979
diff changeset
    37
   ("reflection", Attrib.add_del_args radd rdel, "Reflection data")];
23545
2fddae6056ab Context Data for the reflection and reification methods
chaieb
parents:
diff changeset
    38
2fddae6056ab Context Data for the reflection and reification methods
chaieb
parents:
diff changeset
    39
end;