src/HOL/Library/reify_data.ML
author wenzelm
Mon, 16 Mar 2009 18:24:30 +0100
changeset 30549 d2d7874648bd
parent 30528 7173bf123335
child 33518 24563731b9b2
permissions -rw-r--r--
simplified method setup;
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
30528
7173bf123335 simplified attribute setup;
wenzelm
parents: 29650
diff changeset
    35
val setup =
7173bf123335 simplified attribute setup;
wenzelm
parents: 29650
diff changeset
    36
  Attrib.setup @{binding reify} (Attrib.add_del add del) "reify data" #>
7173bf123335 simplified attribute setup;
wenzelm
parents: 29650
diff changeset
    37
  Attrib.setup @{binding reflection} (Attrib.add_del 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;