author | Christian Urban <urbanc@in.tum.de> |
Wed, 23 May 2012 23:57:27 +0100 | |
changeset 3174 | 8f51702e1f2e |
parent 3065 | 51ef8a3cb6ef |
child 3239 | 67370521c09c |
permissions | -rw-r--r-- |
2890 | 1 |
(* Author: Christian Urban |
2 |
||
3 |
data about nominal datatypes |
|
4 |
*) |
|
5 |
||
6 |
signature NOMINAL_DT_DATA = |
|
7 |
sig |
|
2957
01ff621599bc
code refactoring; introduced a record for raw_dt_info
Christian Urban <urbanc@in.tum.de>
parents:
2927
diff
changeset
|
8 |
(* info of raw binding functions *) |
01ff621599bc
code refactoring; introduced a record for raw_dt_info
Christian Urban <urbanc@in.tum.de>
parents:
2927
diff
changeset
|
9 |
type bn_info = term * int * (int * term option) list list |
01ff621599bc
code refactoring; introduced a record for raw_dt_info
Christian Urban <urbanc@in.tum.de>
parents:
2927
diff
changeset
|
10 |
|
01ff621599bc
code refactoring; introduced a record for raw_dt_info
Christian Urban <urbanc@in.tum.de>
parents:
2927
diff
changeset
|
11 |
(* binding modes and binding clauses *) |
01ff621599bc
code refactoring; introduced a record for raw_dt_info
Christian Urban <urbanc@in.tum.de>
parents:
2927
diff
changeset
|
12 |
datatype bmode = Lst | Res | Set |
01ff621599bc
code refactoring; introduced a record for raw_dt_info
Christian Urban <urbanc@in.tum.de>
parents:
2927
diff
changeset
|
13 |
datatype bclause = BC of bmode * (term option * int) list * int list |
01ff621599bc
code refactoring; introduced a record for raw_dt_info
Christian Urban <urbanc@in.tum.de>
parents:
2927
diff
changeset
|
14 |
|
2890 | 15 |
type info = |
2957
01ff621599bc
code refactoring; introduced a record for raw_dt_info
Christian Urban <urbanc@in.tum.de>
parents:
2927
diff
changeset
|
16 |
{inject : thm list, |
01ff621599bc
code refactoring; introduced a record for raw_dt_info
Christian Urban <urbanc@in.tum.de>
parents:
2927
diff
changeset
|
17 |
distinct : thm list, |
01ff621599bc
code refactoring; introduced a record for raw_dt_info
Christian Urban <urbanc@in.tum.de>
parents:
2927
diff
changeset
|
18 |
strong_inducts : thm list, |
01ff621599bc
code refactoring; introduced a record for raw_dt_info
Christian Urban <urbanc@in.tum.de>
parents:
2927
diff
changeset
|
19 |
strong_exhaust : thm list} |
2890 | 20 |
|
21 |
val get_all_info: Proof.context -> (string * info) list |
|
22 |
val get_info: Proof.context -> string -> info option |
|
23 |
val the_info: Proof.context -> string -> info |
|
24 |
val register_info: (string * info) -> Context.generic -> Context.generic |
|
25 |
val mk_infos: string list -> thm list -> thm list -> thm list -> thm list -> (string * info) list |
|
2927
116f9ba4f59f
combined distributed data for alpha in alpha_result (partially done)
Christian Urban <urbanc@in.tum.de>
parents:
2890
diff
changeset
|
26 |
|
2959 | 27 |
datatype user_data = UserData of |
3065
51ef8a3cb6ef
updated to lates changes in the datatype package
Christian Urban <urbanc@in.tum.de>
parents:
2959
diff
changeset
|
28 |
{dts : Datatype.spec list, |
2959 | 29 |
cn_names : string list, |
30 |
cn_tys : (string * string) list, |
|
31 |
bn_funs : (binding * typ * mixfix) list, |
|
32 |
bn_eqs : (Attrib.binding * term) list, |
|
33 |
bclauses : bclause list list list} |
|
34 |
||
2957
01ff621599bc
code refactoring; introduced a record for raw_dt_info
Christian Urban <urbanc@in.tum.de>
parents:
2927
diff
changeset
|
35 |
datatype raw_dt_info = RawDtInfo of |
01ff621599bc
code refactoring; introduced a record for raw_dt_info
Christian Urban <urbanc@in.tum.de>
parents:
2927
diff
changeset
|
36 |
{raw_dt_names : string list, |
3065
51ef8a3cb6ef
updated to lates changes in the datatype package
Christian Urban <urbanc@in.tum.de>
parents:
2959
diff
changeset
|
37 |
raw_dts : Datatype.spec list, |
2957
01ff621599bc
code refactoring; introduced a record for raw_dt_info
Christian Urban <urbanc@in.tum.de>
parents:
2927
diff
changeset
|
38 |
raw_tys : typ list, |
01ff621599bc
code refactoring; introduced a record for raw_dt_info
Christian Urban <urbanc@in.tum.de>
parents:
2927
diff
changeset
|
39 |
raw_ty_args : (string * sort) list, |
01ff621599bc
code refactoring; introduced a record for raw_dt_info
Christian Urban <urbanc@in.tum.de>
parents:
2927
diff
changeset
|
40 |
raw_cns_info : cns_info list, |
01ff621599bc
code refactoring; introduced a record for raw_dt_info
Christian Urban <urbanc@in.tum.de>
parents:
2927
diff
changeset
|
41 |
raw_all_cns : term list list, |
01ff621599bc
code refactoring; introduced a record for raw_dt_info
Christian Urban <urbanc@in.tum.de>
parents:
2927
diff
changeset
|
42 |
raw_inject_thms : thm list, |
01ff621599bc
code refactoring; introduced a record for raw_dt_info
Christian Urban <urbanc@in.tum.de>
parents:
2927
diff
changeset
|
43 |
raw_distinct_thms : thm list, |
01ff621599bc
code refactoring; introduced a record for raw_dt_info
Christian Urban <urbanc@in.tum.de>
parents:
2927
diff
changeset
|
44 |
raw_induct_thm : thm, |
01ff621599bc
code refactoring; introduced a record for raw_dt_info
Christian Urban <urbanc@in.tum.de>
parents:
2927
diff
changeset
|
45 |
raw_induct_thms : thm list, |
01ff621599bc
code refactoring; introduced a record for raw_dt_info
Christian Urban <urbanc@in.tum.de>
parents:
2927
diff
changeset
|
46 |
raw_exhaust_thms : thm list, |
01ff621599bc
code refactoring; introduced a record for raw_dt_info
Christian Urban <urbanc@in.tum.de>
parents:
2927
diff
changeset
|
47 |
raw_size_trms : term list, |
01ff621599bc
code refactoring; introduced a record for raw_dt_info
Christian Urban <urbanc@in.tum.de>
parents:
2927
diff
changeset
|
48 |
raw_size_thms : thm list} |
01ff621599bc
code refactoring; introduced a record for raw_dt_info
Christian Urban <urbanc@in.tum.de>
parents:
2927
diff
changeset
|
49 |
|
2927
116f9ba4f59f
combined distributed data for alpha in alpha_result (partially done)
Christian Urban <urbanc@in.tum.de>
parents:
2890
diff
changeset
|
50 |
datatype alpha_result = AlphaResult of |
116f9ba4f59f
combined distributed data for alpha in alpha_result (partially done)
Christian Urban <urbanc@in.tum.de>
parents:
2890
diff
changeset
|
51 |
{alpha_names : string list, |
116f9ba4f59f
combined distributed data for alpha in alpha_result (partially done)
Christian Urban <urbanc@in.tum.de>
parents:
2890
diff
changeset
|
52 |
alpha_trms : term list, |
116f9ba4f59f
combined distributed data for alpha in alpha_result (partially done)
Christian Urban <urbanc@in.tum.de>
parents:
2890
diff
changeset
|
53 |
alpha_tys : typ list, |
116f9ba4f59f
combined distributed data for alpha in alpha_result (partially done)
Christian Urban <urbanc@in.tum.de>
parents:
2890
diff
changeset
|
54 |
alpha_bn_names : string list, |
116f9ba4f59f
combined distributed data for alpha in alpha_result (partially done)
Christian Urban <urbanc@in.tum.de>
parents:
2890
diff
changeset
|
55 |
alpha_bn_trms : term list, |
116f9ba4f59f
combined distributed data for alpha in alpha_result (partially done)
Christian Urban <urbanc@in.tum.de>
parents:
2890
diff
changeset
|
56 |
alpha_bn_tys : typ list, |
116f9ba4f59f
combined distributed data for alpha in alpha_result (partially done)
Christian Urban <urbanc@in.tum.de>
parents:
2890
diff
changeset
|
57 |
alpha_intros : thm list, |
116f9ba4f59f
combined distributed data for alpha in alpha_result (partially done)
Christian Urban <urbanc@in.tum.de>
parents:
2890
diff
changeset
|
58 |
alpha_cases : thm list, |
116f9ba4f59f
combined distributed data for alpha in alpha_result (partially done)
Christian Urban <urbanc@in.tum.de>
parents:
2890
diff
changeset
|
59 |
alpha_raw_induct : thm} |
116f9ba4f59f
combined distributed data for alpha in alpha_result (partially done)
Christian Urban <urbanc@in.tum.de>
parents:
2890
diff
changeset
|
60 |
|
2890 | 61 |
end |
62 |
||
63 |
structure Nominal_Dt_Data: NOMINAL_DT_DATA = |
|
64 |
struct |
|
65 |
||
2957
01ff621599bc
code refactoring; introduced a record for raw_dt_info
Christian Urban <urbanc@in.tum.de>
parents:
2927
diff
changeset
|
66 |
|
01ff621599bc
code refactoring; introduced a record for raw_dt_info
Christian Urban <urbanc@in.tum.de>
parents:
2927
diff
changeset
|
67 |
(* term - is constant of the bn-function |
01ff621599bc
code refactoring; introduced a record for raw_dt_info
Christian Urban <urbanc@in.tum.de>
parents:
2927
diff
changeset
|
68 |
int - is datatype number over which the bn-function is defined |
01ff621599bc
code refactoring; introduced a record for raw_dt_info
Christian Urban <urbanc@in.tum.de>
parents:
2927
diff
changeset
|
69 |
int * term option - is number of the corresponding argument with possibly |
01ff621599bc
code refactoring; introduced a record for raw_dt_info
Christian Urban <urbanc@in.tum.de>
parents:
2927
diff
changeset
|
70 |
recursive call with bn-function term |
01ff621599bc
code refactoring; introduced a record for raw_dt_info
Christian Urban <urbanc@in.tum.de>
parents:
2927
diff
changeset
|
71 |
*) |
01ff621599bc
code refactoring; introduced a record for raw_dt_info
Christian Urban <urbanc@in.tum.de>
parents:
2927
diff
changeset
|
72 |
type bn_info = term * int * (int * term option) list list |
01ff621599bc
code refactoring; introduced a record for raw_dt_info
Christian Urban <urbanc@in.tum.de>
parents:
2927
diff
changeset
|
73 |
|
01ff621599bc
code refactoring; introduced a record for raw_dt_info
Christian Urban <urbanc@in.tum.de>
parents:
2927
diff
changeset
|
74 |
datatype bmode = Lst | Res | Set |
01ff621599bc
code refactoring; introduced a record for raw_dt_info
Christian Urban <urbanc@in.tum.de>
parents:
2927
diff
changeset
|
75 |
datatype bclause = BC of bmode * (term option * int) list * int list |
01ff621599bc
code refactoring; introduced a record for raw_dt_info
Christian Urban <urbanc@in.tum.de>
parents:
2927
diff
changeset
|
76 |
|
2927
116f9ba4f59f
combined distributed data for alpha in alpha_result (partially done)
Christian Urban <urbanc@in.tum.de>
parents:
2890
diff
changeset
|
77 |
|
2890 | 78 |
(* information generated by nominal_datatype *) |
79 |
type info = |
|
80 |
{inject : thm list, |
|
81 |
distinct : thm list, |
|
82 |
strong_inducts : thm list, |
|
83 |
strong_exhaust : thm list} |
|
84 |
||
85 |
structure NominalData = Generic_Data |
|
86 |
(type T = info Symtab.table |
|
87 |
val empty = Symtab.empty |
|
88 |
val extend = I |
|
89 |
val merge = Symtab.merge (K true)) |
|
90 |
||
91 |
val get_all_info = Symtab.dest o NominalData.get o Context.Proof |
|
92 |
val get_info = Symtab.lookup o NominalData.get o Context.Proof |
|
93 |
val register_info = NominalData.map o Symtab.update |
|
94 |
||
95 |
fun the_info thy name = |
|
96 |
(case get_info thy name of |
|
97 |
SOME info => info |
|
98 |
| NONE => error ("Unknown nominal datatype " ^ quote name)) |
|
99 |
||
100 |
fun mk_infos ty_names inject distinct strong_inducts strong_exhaust = |
|
101 |
let |
|
102 |
fun aux ty_name = |
|
103 |
(ty_name, {inject = inject, |
|
104 |
distinct = distinct, |
|
105 |
strong_inducts = strong_inducts, |
|
106 |
strong_exhaust = strong_exhaust |
|
107 |
}) |
|
108 |
in |
|
109 |
map aux ty_names |
|
110 |
end |
|
111 |
||
2957
01ff621599bc
code refactoring; introduced a record for raw_dt_info
Christian Urban <urbanc@in.tum.de>
parents:
2927
diff
changeset
|
112 |
|
2959 | 113 |
datatype user_data = UserData of |
3065
51ef8a3cb6ef
updated to lates changes in the datatype package
Christian Urban <urbanc@in.tum.de>
parents:
2959
diff
changeset
|
114 |
{dts : Datatype.spec list, |
2959 | 115 |
cn_names : string list, |
116 |
cn_tys : (string * string) list, |
|
117 |
bn_funs : (binding * typ * mixfix) list, |
|
118 |
bn_eqs : (Attrib.binding * term) list, |
|
119 |
bclauses : bclause list list list} |
|
120 |
||
2957
01ff621599bc
code refactoring; introduced a record for raw_dt_info
Christian Urban <urbanc@in.tum.de>
parents:
2927
diff
changeset
|
121 |
datatype raw_dt_info = RawDtInfo of |
01ff621599bc
code refactoring; introduced a record for raw_dt_info
Christian Urban <urbanc@in.tum.de>
parents:
2927
diff
changeset
|
122 |
{raw_dt_names : string list, |
3065
51ef8a3cb6ef
updated to lates changes in the datatype package
Christian Urban <urbanc@in.tum.de>
parents:
2959
diff
changeset
|
123 |
raw_dts : Datatype.spec list, |
2957
01ff621599bc
code refactoring; introduced a record for raw_dt_info
Christian Urban <urbanc@in.tum.de>
parents:
2927
diff
changeset
|
124 |
raw_tys : typ list, |
01ff621599bc
code refactoring; introduced a record for raw_dt_info
Christian Urban <urbanc@in.tum.de>
parents:
2927
diff
changeset
|
125 |
raw_ty_args : (string * sort) list, |
01ff621599bc
code refactoring; introduced a record for raw_dt_info
Christian Urban <urbanc@in.tum.de>
parents:
2927
diff
changeset
|
126 |
raw_cns_info : cns_info list, |
01ff621599bc
code refactoring; introduced a record for raw_dt_info
Christian Urban <urbanc@in.tum.de>
parents:
2927
diff
changeset
|
127 |
raw_all_cns : term list list, |
01ff621599bc
code refactoring; introduced a record for raw_dt_info
Christian Urban <urbanc@in.tum.de>
parents:
2927
diff
changeset
|
128 |
raw_inject_thms : thm list, |
01ff621599bc
code refactoring; introduced a record for raw_dt_info
Christian Urban <urbanc@in.tum.de>
parents:
2927
diff
changeset
|
129 |
raw_distinct_thms : thm list, |
01ff621599bc
code refactoring; introduced a record for raw_dt_info
Christian Urban <urbanc@in.tum.de>
parents:
2927
diff
changeset
|
130 |
raw_induct_thm : thm, |
01ff621599bc
code refactoring; introduced a record for raw_dt_info
Christian Urban <urbanc@in.tum.de>
parents:
2927
diff
changeset
|
131 |
raw_induct_thms : thm list, |
01ff621599bc
code refactoring; introduced a record for raw_dt_info
Christian Urban <urbanc@in.tum.de>
parents:
2927
diff
changeset
|
132 |
raw_exhaust_thms : thm list, |
01ff621599bc
code refactoring; introduced a record for raw_dt_info
Christian Urban <urbanc@in.tum.de>
parents:
2927
diff
changeset
|
133 |
raw_size_trms : term list, |
01ff621599bc
code refactoring; introduced a record for raw_dt_info
Christian Urban <urbanc@in.tum.de>
parents:
2927
diff
changeset
|
134 |
raw_size_thms : thm list} |
01ff621599bc
code refactoring; introduced a record for raw_dt_info
Christian Urban <urbanc@in.tum.de>
parents:
2927
diff
changeset
|
135 |
|
2927
116f9ba4f59f
combined distributed data for alpha in alpha_result (partially done)
Christian Urban <urbanc@in.tum.de>
parents:
2890
diff
changeset
|
136 |
datatype alpha_result = AlphaResult of |
116f9ba4f59f
combined distributed data for alpha in alpha_result (partially done)
Christian Urban <urbanc@in.tum.de>
parents:
2890
diff
changeset
|
137 |
{alpha_names : string list, |
116f9ba4f59f
combined distributed data for alpha in alpha_result (partially done)
Christian Urban <urbanc@in.tum.de>
parents:
2890
diff
changeset
|
138 |
alpha_trms : term list, |
116f9ba4f59f
combined distributed data for alpha in alpha_result (partially done)
Christian Urban <urbanc@in.tum.de>
parents:
2890
diff
changeset
|
139 |
alpha_tys : typ list, |
116f9ba4f59f
combined distributed data for alpha in alpha_result (partially done)
Christian Urban <urbanc@in.tum.de>
parents:
2890
diff
changeset
|
140 |
alpha_bn_names : string list, |
116f9ba4f59f
combined distributed data for alpha in alpha_result (partially done)
Christian Urban <urbanc@in.tum.de>
parents:
2890
diff
changeset
|
141 |
alpha_bn_trms : term list, |
116f9ba4f59f
combined distributed data for alpha in alpha_result (partially done)
Christian Urban <urbanc@in.tum.de>
parents:
2890
diff
changeset
|
142 |
alpha_bn_tys : typ list, |
116f9ba4f59f
combined distributed data for alpha in alpha_result (partially done)
Christian Urban <urbanc@in.tum.de>
parents:
2890
diff
changeset
|
143 |
alpha_intros : thm list, |
116f9ba4f59f
combined distributed data for alpha in alpha_result (partially done)
Christian Urban <urbanc@in.tum.de>
parents:
2890
diff
changeset
|
144 |
alpha_cases : thm list, |
116f9ba4f59f
combined distributed data for alpha in alpha_result (partially done)
Christian Urban <urbanc@in.tum.de>
parents:
2890
diff
changeset
|
145 |
alpha_raw_induct : thm} |
116f9ba4f59f
combined distributed data for alpha in alpha_result (partially done)
Christian Urban <urbanc@in.tum.de>
parents:
2890
diff
changeset
|
146 |
|
2890 | 147 |
end |