author | Christian Urban <urbanc@in.tum.de> |
Tue, 15 Jun 2010 08:56:13 +0200 | |
changeset 2269 | e4699a240d2c |
parent 2138 | 2e514a0aca63 |
permissions | -rw-r--r-- |
1941 | 1 |
theory NewParser |
1971
8daf6ff5e11a
simpliied and moved the remaining lemmas about the atom-function to Nominal2_Base
Christian Urban <urbanc@in.tum.de>
parents:
1970
diff
changeset
|
2 |
imports "../Nominal-General/Nominal2_Base" |
1941 | 3 |
"../Nominal-General/Nominal2_Eqvt" |
4 |
"../Nominal-General/Nominal2_Supp" |
|
2001
7c8242a02f39
NewParser with Parser functionality, but some cheats included since the order of datayupes is wrong.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2000
diff
changeset
|
5 |
"Perm" "NewFv" "NewAlpha" "Tacs" "Equivp" "Lift" |
1941 | 6 |
begin |
7 |
||
8 |
section{* Interface for nominal_datatype *} |
|
9 |
||
10 |
||
11 |
ML {* |
|
12 |
(* nominal datatype parser *) |
|
13 |
local |
|
14 |
structure P = OuterParse; |
|
15 |
structure S = Scan |
|
16 |
||
17 |
fun triple1 ((x, y), z) = (x, y, z) |
|
18 |
fun triple2 (x, (y, z)) = (x, y, z) |
|
19 |
fun tuple ((x, y, z), u) = (x, y, z, u) |
|
20 |
fun tswap (((x, y), z), u) = (x, y, u, z) |
|
21 |
in |
|
22 |
||
23 |
val _ = OuterKeyword.keyword "bind" |
|
24 |
val _ = OuterKeyword.keyword "bind_set" |
|
25 |
val _ = OuterKeyword.keyword "bind_res" |
|
26 |
||
1943 | 27 |
val anno_typ = S.option (P.name --| P.$$$ "::") -- P.typ |
1941 | 28 |
|
29 |
val bind_mode = P.$$$ "bind" || P.$$$ "bind_set" || P.$$$ "bind_res" |
|
30 |
||
31 |
val bind_clauses = |
|
32 |
P.enum "," (bind_mode -- S.repeat1 P.term -- (P.$$$ "in" |-- S.repeat1 P.name) >> triple1) |
|
33 |
||
34 |
val cnstr_parser = |
|
1943 | 35 |
P.binding -- S.repeat anno_typ -- bind_clauses -- P.opt_mixfix >> tswap |
1941 | 36 |
|
37 |
(* datatype parser *) |
|
38 |
val dt_parser = |
|
39 |
(P.type_args -- P.binding -- P.opt_mixfix >> triple1) -- |
|
1943 | 40 |
(P.$$$ "=" |-- P.enum1 "|" cnstr_parser) >> tuple |
1941 | 41 |
|
42 |
(* binding function parser *) |
|
43 |
val bnfun_parser = |
|
1944 | 44 |
S.optional (P.$$$ "binder" |-- P.fixes -- SpecParse.where_alt_specs) ([], []) |
1941 | 45 |
|
46 |
(* main parser *) |
|
47 |
val main_parser = |
|
1944 | 48 |
P.and_list1 dt_parser -- bnfun_parser >> triple2 |
1941 | 49 |
|
50 |
end |
|
51 |
*} |
|
52 |
||
53 |
ML {* |
|
54 |
fun get_cnstrs dts = |
|
55 |
map (fn (_, _, _, constrs) => constrs) dts |
|
56 |
||
57 |
fun get_typed_cnstrs dts = |
|
58 |
flat (map (fn (_, bn, _, constrs) => |
|
59 |
(map (fn (bn', _, _) => (Binding.name_of bn, Binding.name_of bn')) constrs)) dts) |
|
60 |
||
61 |
fun get_cnstr_strs dts = |
|
62 |
map (fn (bn, _, _) => Binding.name_of bn) (flat (get_cnstrs dts)) |
|
63 |
||
64 |
fun get_bn_fun_strs bn_funs = |
|
65 |
map (fn (bn_fun, _, _) => Binding.name_of bn_fun) bn_funs |
|
66 |
*} |
|
67 |
||
2106
409ecb7284dd
properly exported defined bn-functions
Christian Urban <urbanc@in.tum.de>
parents:
2105
diff
changeset
|
68 |
|
1941 | 69 |
ML {* |
70 |
fun add_primrec_wrapper funs eqs lthy = |
|
71 |
if null funs then (([], []), lthy) |
|
72 |
else |
|
73 |
let |
|
74 |
val eqs' = map (fn (_, eq) => (Attrib.empty_binding, eq)) eqs |
|
75 |
val funs' = map (fn (bn, ty, mx) => (bn, SOME ty, mx)) funs |
|
2106
409ecb7284dd
properly exported defined bn-functions
Christian Urban <urbanc@in.tum.de>
parents:
2105
diff
changeset
|
76 |
val ((funs'', eqs''), lthy') = Primrec.add_primrec funs' eqs' lthy |
409ecb7284dd
properly exported defined bn-functions
Christian Urban <urbanc@in.tum.de>
parents:
2105
diff
changeset
|
77 |
val phi = ProofContext.export_morphism lthy' lthy |
1941 | 78 |
in |
2106
409ecb7284dd
properly exported defined bn-functions
Christian Urban <urbanc@in.tum.de>
parents:
2105
diff
changeset
|
79 |
((map (Morphism.term phi) funs'', map (Morphism.thm phi) eqs''), lthy') |
1941 | 80 |
end |
81 |
*} |
|
82 |
||
83 |
ML {* |
|
84 |
fun add_datatype_wrapper dt_names dts = |
|
85 |
let |
|
86 |
val conf = Datatype.default_config |
|
87 |
in |
|
88 |
Local_Theory.theory_result (Datatype.add_datatype conf dt_names dts) |
|
89 |
end |
|
90 |
*} |
|
91 |
||
1944 | 92 |
|
93 |
text {* Infrastructure for adding "_raw" to types and terms *} |
|
94 |
||
1941 | 95 |
ML {* |
96 |
fun add_raw s = s ^ "_raw" |
|
97 |
fun add_raws ss = map add_raw ss |
|
98 |
fun raw_bind bn = Binding.suffix_name "_raw" bn |
|
99 |
||
100 |
fun replace_str ss s = |
|
101 |
case (AList.lookup (op=) ss s) of |
|
102 |
SOME s' => s' |
|
103 |
| NONE => s |
|
104 |
||
105 |
fun replace_typ ty_ss (Type (a, Ts)) = Type (replace_str ty_ss a, map (replace_typ ty_ss) Ts) |
|
106 |
| replace_typ ty_ss T = T |
|
107 |
||
108 |
fun raw_dts ty_ss dts = |
|
109 |
let |
|
110 |
fun raw_dts_aux1 (bind, tys, mx) = |
|
111 |
(raw_bind bind, map (replace_typ ty_ss) tys, mx) |
|
112 |
||
113 |
fun raw_dts_aux2 (ty_args, bind, mx, constrs) = |
|
114 |
(ty_args, raw_bind bind, mx, map raw_dts_aux1 constrs) |
|
115 |
in |
|
116 |
map raw_dts_aux2 dts |
|
117 |
end |
|
118 |
||
119 |
fun replace_aterm trm_ss (Const (a, T)) = Const (replace_str trm_ss a, T) |
|
120 |
| replace_aterm trm_ss (Free (a, T)) = Free (replace_str trm_ss a, T) |
|
121 |
| replace_aterm trm_ss trm = trm |
|
122 |
||
123 |
fun replace_term trm_ss ty_ss trm = |
|
124 |
trm |> Term.map_aterms (replace_aterm trm_ss) |> map_types (replace_typ ty_ss) |
|
125 |
*} |
|
126 |
||
127 |
ML {* |
|
128 |
fun rawify_dts dt_names dts dts_env = |
|
129 |
let |
|
130 |
val raw_dts = raw_dts dts_env dts |
|
131 |
val raw_dt_names = add_raws dt_names |
|
132 |
in |
|
133 |
(raw_dt_names, raw_dts) |
|
134 |
end |
|
135 |
*} |
|
136 |
||
137 |
ML {* |
|
138 |
fun rawify_bn_funs dts_env cnstrs_env bn_fun_env bn_funs bn_eqs = |
|
139 |
let |
|
140 |
val bn_funs' = map (fn (bn, ty, mx) => |
|
141 |
(raw_bind bn, replace_typ dts_env ty, mx)) bn_funs |
|
142 |
||
143 |
val bn_eqs' = map (fn (attr, trm) => |
|
144 |
(attr, replace_term (cnstrs_env @ bn_fun_env) dts_env trm)) bn_eqs |
|
145 |
in |
|
146 |
(bn_funs', bn_eqs') |
|
147 |
end |
|
148 |
*} |
|
149 |
||
150 |
ML {* |
|
151 |
fun rawify_bclauses dts_env cnstrs_env bn_fun_env bclauses = |
|
152 |
let |
|
153 |
fun rawify_bnds bnds = |
|
154 |
map (apfst (Option.map (replace_term (cnstrs_env @ bn_fun_env) dts_env))) bnds |
|
155 |
||
156 |
fun rawify_bclause (BEmy n) = BEmy n |
|
157 |
| rawify_bclause (BLst (bnds, bdys)) = BLst (rawify_bnds bnds, bdys) |
|
158 |
| rawify_bclause (BSet (bnds, bdys)) = BSet (rawify_bnds bnds, bdys) |
|
159 |
| rawify_bclause (BRes (bnds, bdys)) = BRes (rawify_bnds bnds, bdys) |
|
160 |
in |
|
161 |
map (map (map rawify_bclause)) bclauses |
|
162 |
end |
|
163 |
*} |
|
164 |
||
2027 | 165 |
(* strip_bn_fun takes a bn function defined by the user as a union or |
166 |
append of elements and returns those elements together with bn functions |
|
167 |
applied *) |
|
1941 | 168 |
ML {* |
169 |
fun strip_bn_fun t = |
|
170 |
case t of |
|
171 |
Const (@{const_name sup}, _) $ l $ r => strip_bn_fun l @ strip_bn_fun r |
|
172 |
| Const (@{const_name append}, _) $ l $ r => strip_bn_fun l @ strip_bn_fun r |
|
173 |
| Const (@{const_name insert}, _) $ (Const (@{const_name atom}, _) $ Bound i) $ y => |
|
174 |
(i, NONE) :: strip_bn_fun y |
|
175 |
| Const (@{const_name Cons}, _) $ (Const (@{const_name atom}, _) $ Bound i) $ y => |
|
176 |
(i, NONE) :: strip_bn_fun y |
|
177 |
| Const (@{const_name bot}, _) => [] |
|
178 |
| Const (@{const_name Nil}, _) => [] |
|
179 |
| (f as Free _) $ Bound i => [(i, SOME f)] |
|
180 |
| _ => error ("Unsupported binding function: " ^ (PolyML.makestring t)) |
|
181 |
*} |
|
182 |
||
183 |
ML {* |
|
184 |
fun find [] _ = error ("cannot find element") |
|
185 |
| find ((x, z)::xs) y = if (Long_Name.base_name x) = y then z else find xs y |
|
186 |
*} |
|
187 |
||
188 |
ML {* |
|
2122
24ca435ead14
added term4 back to the examples
Christian Urban <urbanc@in.tum.de>
parents:
2119
diff
changeset
|
189 |
fun prep_bn lthy dt_names dts eqs = |
1941 | 190 |
let |
191 |
fun aux eq = |
|
192 |
let |
|
193 |
val (lhs, rhs) = eq |
|
194 |
|> strip_qnt_body "all" |
|
195 |
|> HOLogic.dest_Trueprop |
|
196 |
|> HOLogic.dest_eq |
|
197 |
val (bn_fun, [cnstr]) = strip_comb lhs |
|
198 |
val (_, ty) = dest_Free bn_fun |
|
199 |
val (ty_name, _) = dest_Type (domain_type ty) |
|
200 |
val dt_index = find_index (fn x => x = ty_name) dt_names |
|
201 |
val (cnstr_head, cnstr_args) = strip_comb cnstr |
|
202 |
val rhs_elements = strip_bn_fun rhs |
|
203 |
val included = map (apfst (fn i => length (cnstr_args) - i - 1)) rhs_elements |
|
204 |
in |
|
205 |
(dt_index, (bn_fun, (cnstr_head, included))) |
|
2122
24ca435ead14
added term4 back to the examples
Christian Urban <urbanc@in.tum.de>
parents:
2119
diff
changeset
|
206 |
end |
24ca435ead14
added term4 back to the examples
Christian Urban <urbanc@in.tum.de>
parents:
2119
diff
changeset
|
207 |
fun aux2 eq = |
24ca435ead14
added term4 back to the examples
Christian Urban <urbanc@in.tum.de>
parents:
2119
diff
changeset
|
208 |
let |
24ca435ead14
added term4 back to the examples
Christian Urban <urbanc@in.tum.de>
parents:
2119
diff
changeset
|
209 |
val (lhs, rhs) = eq |
24ca435ead14
added term4 back to the examples
Christian Urban <urbanc@in.tum.de>
parents:
2119
diff
changeset
|
210 |
|> strip_qnt_body "all" |
24ca435ead14
added term4 back to the examples
Christian Urban <urbanc@in.tum.de>
parents:
2119
diff
changeset
|
211 |
|> HOLogic.dest_Trueprop |
24ca435ead14
added term4 back to the examples
Christian Urban <urbanc@in.tum.de>
parents:
2119
diff
changeset
|
212 |
|> HOLogic.dest_eq |
24ca435ead14
added term4 back to the examples
Christian Urban <urbanc@in.tum.de>
parents:
2119
diff
changeset
|
213 |
val (bn_fun, [cnstr]) = strip_comb lhs |
24ca435ead14
added term4 back to the examples
Christian Urban <urbanc@in.tum.de>
parents:
2119
diff
changeset
|
214 |
val (_, ty) = dest_Free bn_fun |
24ca435ead14
added term4 back to the examples
Christian Urban <urbanc@in.tum.de>
parents:
2119
diff
changeset
|
215 |
val (ty_name, _) = dest_Type (domain_type ty) |
24ca435ead14
added term4 back to the examples
Christian Urban <urbanc@in.tum.de>
parents:
2119
diff
changeset
|
216 |
val dt_index = find_index (fn x => x = ty_name) dt_names |
24ca435ead14
added term4 back to the examples
Christian Urban <urbanc@in.tum.de>
parents:
2119
diff
changeset
|
217 |
val (cnstr_head, cnstr_args) = strip_comb cnstr |
24ca435ead14
added term4 back to the examples
Christian Urban <urbanc@in.tum.de>
parents:
2119
diff
changeset
|
218 |
val rhs_elements = strip_bn_fun rhs |
24ca435ead14
added term4 back to the examples
Christian Urban <urbanc@in.tum.de>
parents:
2119
diff
changeset
|
219 |
val included = map (apfst (fn i => length (cnstr_args) - i - 1)) rhs_elements |
24ca435ead14
added term4 back to the examples
Christian Urban <urbanc@in.tum.de>
parents:
2119
diff
changeset
|
220 |
in |
24ca435ead14
added term4 back to the examples
Christian Urban <urbanc@in.tum.de>
parents:
2119
diff
changeset
|
221 |
(bn_fun, dt_index, (cnstr_head, included)) |
1941 | 222 |
end |
223 |
fun order dts i ts = |
|
224 |
let |
|
225 |
val dt = nth dts i |
|
226 |
val cts = map (fn (x, _, _) => Binding.name_of x) ((fn (_, _, _, x) => x) dt) |
|
227 |
val ts' = map (fn (x, y) => (fst (dest_Const x), y)) ts |
|
228 |
in |
|
229 |
map (find ts') cts |
|
230 |
end |
|
231 |
||
232 |
val unordered = AList.group (op=) (map aux eqs) |
|
233 |
val unordered' = map (fn (x, y) => (x, AList.group (op=) y)) unordered |
|
234 |
val ordered = map (fn (x, y) => (x, map (fn (v, z) => (v, order dts x z)) y)) unordered' |
|
2118
0e52851acac4
moved the data-transformation into the parser
Christian Urban <urbanc@in.tum.de>
parents:
2107
diff
changeset
|
235 |
val ordered' = flat (map (fn (ith, l) => map (fn (bn, data) => (bn, ith, data)) l) ordered) |
2122
24ca435ead14
added term4 back to the examples
Christian Urban <urbanc@in.tum.de>
parents:
2119
diff
changeset
|
236 |
|
24ca435ead14
added term4 back to the examples
Christian Urban <urbanc@in.tum.de>
parents:
2119
diff
changeset
|
237 |
val _ = tracing ("eqs\n" ^ cat_lines (map (Syntax.string_of_term lthy) eqs)) |
24ca435ead14
added term4 back to the examples
Christian Urban <urbanc@in.tum.de>
parents:
2119
diff
changeset
|
238 |
val _ = tracing ("map eqs\n" ^ @{make_string} (map aux2 eqs)) |
24ca435ead14
added term4 back to the examples
Christian Urban <urbanc@in.tum.de>
parents:
2119
diff
changeset
|
239 |
val _ = tracing ("ordered'\n" ^ @{make_string} ordered') |
1941 | 240 |
in |
2125
60ee289a8c63
made out of STEPS a configuration value so that it can be set individually in each file
Christian Urban <urbanc@in.tum.de>
parents:
2122
diff
changeset
|
241 |
ordered' |
1941 | 242 |
end |
243 |
*} |
|
244 |
||
2138
2e514a0aca63
started a new file for the parser to make some experiments
Christian Urban <urbanc@in.tum.de>
parents:
2125
diff
changeset
|
245 |
|
1941 | 246 |
ML {* |
247 |
fun raw_nominal_decls dts bn_funs bn_eqs binds lthy = |
|
248 |
let |
|
249 |
val thy = ProofContext.theory_of lthy |
|
250 |
val thy_name = Context.theory_name thy |
|
251 |
||
252 |
val dt_names = map (fn (_, s, _, _) => Binding.name_of s) dts |
|
253 |
val dt_full_names = map (Long_Name.qualify thy_name) dt_names |
|
254 |
val dt_full_names' = add_raws dt_full_names |
|
255 |
val dts_env = dt_full_names ~~ dt_full_names' |
|
256 |
||
257 |
val cnstrs = get_cnstr_strs dts |
|
258 |
val cnstrs_ty = get_typed_cnstrs dts |
|
259 |
val cnstrs_full_names = map (Long_Name.qualify thy_name) cnstrs |
|
260 |
val cnstrs_full_names' = map (fn (x, y) => Long_Name.qualify thy_name |
|
261 |
(Long_Name.qualify (add_raw x) (add_raw y))) cnstrs_ty |
|
262 |
val cnstrs_env = cnstrs_full_names ~~ cnstrs_full_names' |
|
263 |
||
264 |
val bn_fun_strs = get_bn_fun_strs bn_funs |
|
265 |
val bn_fun_strs' = add_raws bn_fun_strs |
|
266 |
val bn_fun_env = bn_fun_strs ~~ bn_fun_strs' |
|
267 |
val bn_fun_full_env = map (pairself (Long_Name.qualify thy_name)) |
|
268 |
(bn_fun_strs ~~ bn_fun_strs') |
|
269 |
||
270 |
val (raw_dt_names, raw_dts) = rawify_dts dt_names dts dts_env |
|
271 |
||
272 |
val (raw_bn_funs, raw_bn_eqs) = rawify_bn_funs dts_env cnstrs_env bn_fun_env bn_funs bn_eqs |
|
273 |
||
274 |
val raw_bclauses = rawify_bclauses dts_env cnstrs_env bn_fun_full_env binds |
|
275 |
||
2122
24ca435ead14
added term4 back to the examples
Christian Urban <urbanc@in.tum.de>
parents:
2119
diff
changeset
|
276 |
val raw_bns = prep_bn lthy dt_full_names' raw_dts (map snd raw_bn_eqs) |
1941 | 277 |
in |
278 |
lthy |
|
279 |
|> add_datatype_wrapper raw_dt_names raw_dts |
|
280 |
||>> add_primrec_wrapper raw_bn_funs raw_bn_eqs |
|
281 |
||>> pair raw_bclauses |
|
282 |
||>> pair raw_bns |
|
283 |
end |
|
284 |
*} |
|
285 |
||
2017
6a4049e1d68d
Add explicit cheats in NewParser and comment out the examples for outside use.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2016
diff
changeset
|
286 |
lemma equivp_hack: "equivp x" |
6a4049e1d68d
Add explicit cheats in NewParser and comment out the examples for outside use.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2016
diff
changeset
|
287 |
sorry |
6a4049e1d68d
Add explicit cheats in NewParser and comment out the examples for outside use.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2016
diff
changeset
|
288 |
ML {* |
6a4049e1d68d
Add explicit cheats in NewParser and comment out the examples for outside use.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2016
diff
changeset
|
289 |
fun equivp_hack ctxt rel = |
6a4049e1d68d
Add explicit cheats in NewParser and comment out the examples for outside use.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2016
diff
changeset
|
290 |
let |
6a4049e1d68d
Add explicit cheats in NewParser and comment out the examples for outside use.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2016
diff
changeset
|
291 |
val thy = ProofContext.theory_of ctxt |
6a4049e1d68d
Add explicit cheats in NewParser and comment out the examples for outside use.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2016
diff
changeset
|
292 |
val ty = domain_type (fastype_of rel) |
6a4049e1d68d
Add explicit cheats in NewParser and comment out the examples for outside use.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2016
diff
changeset
|
293 |
val cty = ctyp_of thy ty |
6a4049e1d68d
Add explicit cheats in NewParser and comment out the examples for outside use.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2016
diff
changeset
|
294 |
val ct = cterm_of thy rel |
6a4049e1d68d
Add explicit cheats in NewParser and comment out the examples for outside use.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2016
diff
changeset
|
295 |
in |
6a4049e1d68d
Add explicit cheats in NewParser and comment out the examples for outside use.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2016
diff
changeset
|
296 |
Drule.instantiate' [SOME cty] [SOME ct] @{thm equivp_hack} |
6a4049e1d68d
Add explicit cheats in NewParser and comment out the examples for outside use.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2016
diff
changeset
|
297 |
end |
6a4049e1d68d
Add explicit cheats in NewParser and comment out the examples for outside use.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2016
diff
changeset
|
298 |
*} |
6a4049e1d68d
Add explicit cheats in NewParser and comment out the examples for outside use.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2016
diff
changeset
|
299 |
|
2023 | 300 |
ML {* val cheat_equivp = Unsynchronized.ref false *} |
301 |
ML {* val cheat_fv_rsp = Unsynchronized.ref false *} |
|
302 |
ML {* val cheat_alpha_bn_rsp = Unsynchronized.ref false *} |
|
303 |
ML {* val cheat_supp_eq = Unsynchronized.ref false *} |
|
2008
1bddffddc03f
attempted to remove dependency on (old) Fv and (old) Parser; lifting still uses Fv.thy; the examples do not work at the moment (with equivp proofs failing)
Christian Urban <urbanc@in.tum.de>
parents:
2007
diff
changeset
|
304 |
|
2025
070ba8972e97
Register only non-looping rules in eq_iff
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2023
diff
changeset
|
305 |
ML {* |
070ba8972e97
Register only non-looping rules in eq_iff
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2023
diff
changeset
|
306 |
fun remove_loop t = |
070ba8972e97
Register only non-looping rules in eq_iff
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2023
diff
changeset
|
307 |
let val _ = HOLogic.dest_eq (HOLogic.dest_Trueprop (prop_of t)) in t end |
070ba8972e97
Register only non-looping rules in eq_iff
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2023
diff
changeset
|
308 |
handle TERM _ => @{thm eqTrueI} OF [t] |
070ba8972e97
Register only non-looping rules in eq_iff
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2023
diff
changeset
|
309 |
*} |
070ba8972e97
Register only non-looping rules in eq_iff
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2023
diff
changeset
|
310 |
|
2008
1bddffddc03f
attempted to remove dependency on (old) Fv and (old) Parser; lifting still uses Fv.thy; the examples do not work at the moment (with equivp proofs failing)
Christian Urban <urbanc@in.tum.de>
parents:
2007
diff
changeset
|
311 |
text {* |
1bddffddc03f
attempted to remove dependency on (old) Fv and (old) Parser; lifting still uses Fv.thy; the examples do not work at the moment (with equivp proofs failing)
Christian Urban <urbanc@in.tum.de>
parents:
2007
diff
changeset
|
312 |
nominal_datatype2 does the following things in order: |
1bddffddc03f
attempted to remove dependency on (old) Fv and (old) Parser; lifting still uses Fv.thy; the examples do not work at the moment (with equivp proofs failing)
Christian Urban <urbanc@in.tum.de>
parents:
2007
diff
changeset
|
313 |
|
1bddffddc03f
attempted to remove dependency on (old) Fv and (old) Parser; lifting still uses Fv.thy; the examples do not work at the moment (with equivp proofs failing)
Christian Urban <urbanc@in.tum.de>
parents:
2007
diff
changeset
|
314 |
Parser.thy/raw_nominal_decls |
1bddffddc03f
attempted to remove dependency on (old) Fv and (old) Parser; lifting still uses Fv.thy; the examples do not work at the moment (with equivp proofs failing)
Christian Urban <urbanc@in.tum.de>
parents:
2007
diff
changeset
|
315 |
1) define the raw datatype |
1bddffddc03f
attempted to remove dependency on (old) Fv and (old) Parser; lifting still uses Fv.thy; the examples do not work at the moment (with equivp proofs failing)
Christian Urban <urbanc@in.tum.de>
parents:
2007
diff
changeset
|
316 |
2) define the raw binding functions |
1bddffddc03f
attempted to remove dependency on (old) Fv and (old) Parser; lifting still uses Fv.thy; the examples do not work at the moment (with equivp proofs failing)
Christian Urban <urbanc@in.tum.de>
parents:
2007
diff
changeset
|
317 |
|
1bddffddc03f
attempted to remove dependency on (old) Fv and (old) Parser; lifting still uses Fv.thy; the examples do not work at the moment (with equivp proofs failing)
Christian Urban <urbanc@in.tum.de>
parents:
2007
diff
changeset
|
318 |
Perm.thy/define_raw_perms |
1bddffddc03f
attempted to remove dependency on (old) Fv and (old) Parser; lifting still uses Fv.thy; the examples do not work at the moment (with equivp proofs failing)
Christian Urban <urbanc@in.tum.de>
parents:
2007
diff
changeset
|
319 |
3) define permutations of the raw datatype and show that the raw type is |
1bddffddc03f
attempted to remove dependency on (old) Fv and (old) Parser; lifting still uses Fv.thy; the examples do not work at the moment (with equivp proofs failing)
Christian Urban <urbanc@in.tum.de>
parents:
2007
diff
changeset
|
320 |
in the pt typeclass |
1bddffddc03f
attempted to remove dependency on (old) Fv and (old) Parser; lifting still uses Fv.thy; the examples do not work at the moment (with equivp proofs failing)
Christian Urban <urbanc@in.tum.de>
parents:
2007
diff
changeset
|
321 |
|
1bddffddc03f
attempted to remove dependency on (old) Fv and (old) Parser; lifting still uses Fv.thy; the examples do not work at the moment (with equivp proofs failing)
Christian Urban <urbanc@in.tum.de>
parents:
2007
diff
changeset
|
322 |
Lift.thy/define_fv_alpha_export, Fv.thy/define_fv & define_alpha |
1bddffddc03f
attempted to remove dependency on (old) Fv and (old) Parser; lifting still uses Fv.thy; the examples do not work at the moment (with equivp proofs failing)
Christian Urban <urbanc@in.tum.de>
parents:
2007
diff
changeset
|
323 |
4) define fv and fv_bn |
1bddffddc03f
attempted to remove dependency on (old) Fv and (old) Parser; lifting still uses Fv.thy; the examples do not work at the moment (with equivp proofs failing)
Christian Urban <urbanc@in.tum.de>
parents:
2007
diff
changeset
|
324 |
5) define alpha and alpha_bn |
1bddffddc03f
attempted to remove dependency on (old) Fv and (old) Parser; lifting still uses Fv.thy; the examples do not work at the moment (with equivp proofs failing)
Christian Urban <urbanc@in.tum.de>
parents:
2007
diff
changeset
|
325 |
|
1bddffddc03f
attempted to remove dependency on (old) Fv and (old) Parser; lifting still uses Fv.thy; the examples do not work at the moment (with equivp proofs failing)
Christian Urban <urbanc@in.tum.de>
parents:
2007
diff
changeset
|
326 |
Perm.thy/distinct_rel |
1bddffddc03f
attempted to remove dependency on (old) Fv and (old) Parser; lifting still uses Fv.thy; the examples do not work at the moment (with equivp proofs failing)
Christian Urban <urbanc@in.tum.de>
parents:
2007
diff
changeset
|
327 |
6) prove alpha_distincts (C1 x \<notsimeq> C2 y ...) (Proof by cases; simp) |
1bddffddc03f
attempted to remove dependency on (old) Fv and (old) Parser; lifting still uses Fv.thy; the examples do not work at the moment (with equivp proofs failing)
Christian Urban <urbanc@in.tum.de>
parents:
2007
diff
changeset
|
328 |
|
1bddffddc03f
attempted to remove dependency on (old) Fv and (old) Parser; lifting still uses Fv.thy; the examples do not work at the moment (with equivp proofs failing)
Christian Urban <urbanc@in.tum.de>
parents:
2007
diff
changeset
|
329 |
Tacs.thy/build_rel_inj |
1bddffddc03f
attempted to remove dependency on (old) Fv and (old) Parser; lifting still uses Fv.thy; the examples do not work at the moment (with equivp proofs failing)
Christian Urban <urbanc@in.tum.de>
parents:
2007
diff
changeset
|
330 |
6) prove alpha_eq_iff (C1 x = C2 y \<leftrightarrow> P x y ...) |
1bddffddc03f
attempted to remove dependency on (old) Fv and (old) Parser; lifting still uses Fv.thy; the examples do not work at the moment (with equivp proofs failing)
Christian Urban <urbanc@in.tum.de>
parents:
2007
diff
changeset
|
331 |
(left-to-right by intro rule, right-to-left by cases; simp) |
1bddffddc03f
attempted to remove dependency on (old) Fv and (old) Parser; lifting still uses Fv.thy; the examples do not work at the moment (with equivp proofs failing)
Christian Urban <urbanc@in.tum.de>
parents:
2007
diff
changeset
|
332 |
Equivp.thy/prove_eqvt |
1bddffddc03f
attempted to remove dependency on (old) Fv and (old) Parser; lifting still uses Fv.thy; the examples do not work at the moment (with equivp proofs failing)
Christian Urban <urbanc@in.tum.de>
parents:
2007
diff
changeset
|
333 |
7) prove bn_eqvt (common induction on the raw datatype) |
1bddffddc03f
attempted to remove dependency on (old) Fv and (old) Parser; lifting still uses Fv.thy; the examples do not work at the moment (with equivp proofs failing)
Christian Urban <urbanc@in.tum.de>
parents:
2007
diff
changeset
|
334 |
8) prove fv_eqvt (common induction on the raw datatype with help of above) |
1bddffddc03f
attempted to remove dependency on (old) Fv and (old) Parser; lifting still uses Fv.thy; the examples do not work at the moment (with equivp proofs failing)
Christian Urban <urbanc@in.tum.de>
parents:
2007
diff
changeset
|
335 |
Rsp.thy/build_alpha_eqvts |
1bddffddc03f
attempted to remove dependency on (old) Fv and (old) Parser; lifting still uses Fv.thy; the examples do not work at the moment (with equivp proofs failing)
Christian Urban <urbanc@in.tum.de>
parents:
2007
diff
changeset
|
336 |
9) prove alpha_eqvt and alpha_bn_eqvt |
1bddffddc03f
attempted to remove dependency on (old) Fv and (old) Parser; lifting still uses Fv.thy; the examples do not work at the moment (with equivp proofs failing)
Christian Urban <urbanc@in.tum.de>
parents:
2007
diff
changeset
|
337 |
(common alpha-induction, unfolding alpha_gen, permute of #* and =) |
1bddffddc03f
attempted to remove dependency on (old) Fv and (old) Parser; lifting still uses Fv.thy; the examples do not work at the moment (with equivp proofs failing)
Christian Urban <urbanc@in.tum.de>
parents:
2007
diff
changeset
|
338 |
Equivp.thy/build_alpha_refl & Equivp.thy/build_equivps |
1bddffddc03f
attempted to remove dependency on (old) Fv and (old) Parser; lifting still uses Fv.thy; the examples do not work at the moment (with equivp proofs failing)
Christian Urban <urbanc@in.tum.de>
parents:
2007
diff
changeset
|
339 |
10) prove that alpha and alpha_bn are equivalence relations |
1bddffddc03f
attempted to remove dependency on (old) Fv and (old) Parser; lifting still uses Fv.thy; the examples do not work at the moment (with equivp proofs failing)
Christian Urban <urbanc@in.tum.de>
parents:
2007
diff
changeset
|
340 |
(common induction and application of 'compose' lemmas) |
1bddffddc03f
attempted to remove dependency on (old) Fv and (old) Parser; lifting still uses Fv.thy; the examples do not work at the moment (with equivp proofs failing)
Christian Urban <urbanc@in.tum.de>
parents:
2007
diff
changeset
|
341 |
Lift.thy/define_quotient_types |
1bddffddc03f
attempted to remove dependency on (old) Fv and (old) Parser; lifting still uses Fv.thy; the examples do not work at the moment (with equivp proofs failing)
Christian Urban <urbanc@in.tum.de>
parents:
2007
diff
changeset
|
342 |
11) define quotient types |
1bddffddc03f
attempted to remove dependency on (old) Fv and (old) Parser; lifting still uses Fv.thy; the examples do not work at the moment (with equivp proofs failing)
Christian Urban <urbanc@in.tum.de>
parents:
2007
diff
changeset
|
343 |
Rsp.thy/build_fvbv_rsps |
1bddffddc03f
attempted to remove dependency on (old) Fv and (old) Parser; lifting still uses Fv.thy; the examples do not work at the moment (with equivp proofs failing)
Christian Urban <urbanc@in.tum.de>
parents:
2007
diff
changeset
|
344 |
12) prove bn respects (common induction and simp with alpha_gen) |
1bddffddc03f
attempted to remove dependency on (old) Fv and (old) Parser; lifting still uses Fv.thy; the examples do not work at the moment (with equivp proofs failing)
Christian Urban <urbanc@in.tum.de>
parents:
2007
diff
changeset
|
345 |
Rsp.thy/prove_const_rsp |
1bddffddc03f
attempted to remove dependency on (old) Fv and (old) Parser; lifting still uses Fv.thy; the examples do not work at the moment (with equivp proofs failing)
Christian Urban <urbanc@in.tum.de>
parents:
2007
diff
changeset
|
346 |
13) prove fv respects (common induction and simp with alpha_gen) |
1bddffddc03f
attempted to remove dependency on (old) Fv and (old) Parser; lifting still uses Fv.thy; the examples do not work at the moment (with equivp proofs failing)
Christian Urban <urbanc@in.tum.de>
parents:
2007
diff
changeset
|
347 |
14) prove permute respects (unfolds to alpha_eqvt) |
1bddffddc03f
attempted to remove dependency on (old) Fv and (old) Parser; lifting still uses Fv.thy; the examples do not work at the moment (with equivp proofs failing)
Christian Urban <urbanc@in.tum.de>
parents:
2007
diff
changeset
|
348 |
Rsp.thy/prove_alpha_bn_rsp |
1bddffddc03f
attempted to remove dependency on (old) Fv and (old) Parser; lifting still uses Fv.thy; the examples do not work at the moment (with equivp proofs failing)
Christian Urban <urbanc@in.tum.de>
parents:
2007
diff
changeset
|
349 |
15) prove alpha_bn respects |
1bddffddc03f
attempted to remove dependency on (old) Fv and (old) Parser; lifting still uses Fv.thy; the examples do not work at the moment (with equivp proofs failing)
Christian Urban <urbanc@in.tum.de>
parents:
2007
diff
changeset
|
350 |
(alpha_induct then cases then sym and trans of the relations) |
1bddffddc03f
attempted to remove dependency on (old) Fv and (old) Parser; lifting still uses Fv.thy; the examples do not work at the moment (with equivp proofs failing)
Christian Urban <urbanc@in.tum.de>
parents:
2007
diff
changeset
|
351 |
Rsp.thy/prove_alpha_alphabn |
1bddffddc03f
attempted to remove dependency on (old) Fv and (old) Parser; lifting still uses Fv.thy; the examples do not work at the moment (with equivp proofs failing)
Christian Urban <urbanc@in.tum.de>
parents:
2007
diff
changeset
|
352 |
16) show that alpha implies alpha_bn (by unduction, needed in following step) |
1bddffddc03f
attempted to remove dependency on (old) Fv and (old) Parser; lifting still uses Fv.thy; the examples do not work at the moment (with equivp proofs failing)
Christian Urban <urbanc@in.tum.de>
parents:
2007
diff
changeset
|
353 |
Rsp.thy/prove_const_rsp |
1bddffddc03f
attempted to remove dependency on (old) Fv and (old) Parser; lifting still uses Fv.thy; the examples do not work at the moment (with equivp proofs failing)
Christian Urban <urbanc@in.tum.de>
parents:
2007
diff
changeset
|
354 |
17) prove respects for all datatype constructors |
1bddffddc03f
attempted to remove dependency on (old) Fv and (old) Parser; lifting still uses Fv.thy; the examples do not work at the moment (with equivp proofs failing)
Christian Urban <urbanc@in.tum.de>
parents:
2007
diff
changeset
|
355 |
(unfold eq_iff and alpha_gen; introduce zero permutations; simp) |
1bddffddc03f
attempted to remove dependency on (old) Fv and (old) Parser; lifting still uses Fv.thy; the examples do not work at the moment (with equivp proofs failing)
Christian Urban <urbanc@in.tum.de>
parents:
2007
diff
changeset
|
356 |
Perm.thy/quotient_lift_consts_export |
1bddffddc03f
attempted to remove dependency on (old) Fv and (old) Parser; lifting still uses Fv.thy; the examples do not work at the moment (with equivp proofs failing)
Christian Urban <urbanc@in.tum.de>
parents:
2007
diff
changeset
|
357 |
18) define lifted constructors, fv, bn, alpha_bn, permutations |
1bddffddc03f
attempted to remove dependency on (old) Fv and (old) Parser; lifting still uses Fv.thy; the examples do not work at the moment (with equivp proofs failing)
Christian Urban <urbanc@in.tum.de>
parents:
2007
diff
changeset
|
358 |
Perm.thy/define_lifted_perms |
1bddffddc03f
attempted to remove dependency on (old) Fv and (old) Parser; lifting still uses Fv.thy; the examples do not work at the moment (with equivp proofs failing)
Christian Urban <urbanc@in.tum.de>
parents:
2007
diff
changeset
|
359 |
19) lift permutation zero and add properties to show that quotient type is in the pt typeclass |
1bddffddc03f
attempted to remove dependency on (old) Fv and (old) Parser; lifting still uses Fv.thy; the examples do not work at the moment (with equivp proofs failing)
Christian Urban <urbanc@in.tum.de>
parents:
2007
diff
changeset
|
360 |
Lift.thy/lift_thm |
1bddffddc03f
attempted to remove dependency on (old) Fv and (old) Parser; lifting still uses Fv.thy; the examples do not work at the moment (with equivp proofs failing)
Christian Urban <urbanc@in.tum.de>
parents:
2007
diff
changeset
|
361 |
20) lift permutation simplifications |
1bddffddc03f
attempted to remove dependency on (old) Fv and (old) Parser; lifting still uses Fv.thy; the examples do not work at the moment (with equivp proofs failing)
Christian Urban <urbanc@in.tum.de>
parents:
2007
diff
changeset
|
362 |
21) lift induction |
1bddffddc03f
attempted to remove dependency on (old) Fv and (old) Parser; lifting still uses Fv.thy; the examples do not work at the moment (with equivp proofs failing)
Christian Urban <urbanc@in.tum.de>
parents:
2007
diff
changeset
|
363 |
22) lift fv |
1bddffddc03f
attempted to remove dependency on (old) Fv and (old) Parser; lifting still uses Fv.thy; the examples do not work at the moment (with equivp proofs failing)
Christian Urban <urbanc@in.tum.de>
parents:
2007
diff
changeset
|
364 |
23) lift bn |
1bddffddc03f
attempted to remove dependency on (old) Fv and (old) Parser; lifting still uses Fv.thy; the examples do not work at the moment (with equivp proofs failing)
Christian Urban <urbanc@in.tum.de>
parents:
2007
diff
changeset
|
365 |
24) lift eq_iff |
1bddffddc03f
attempted to remove dependency on (old) Fv and (old) Parser; lifting still uses Fv.thy; the examples do not work at the moment (with equivp proofs failing)
Christian Urban <urbanc@in.tum.de>
parents:
2007
diff
changeset
|
366 |
25) lift alpha_distincts |
1bddffddc03f
attempted to remove dependency on (old) Fv and (old) Parser; lifting still uses Fv.thy; the examples do not work at the moment (with equivp proofs failing)
Christian Urban <urbanc@in.tum.de>
parents:
2007
diff
changeset
|
367 |
26) lift fv and bn eqvts |
1bddffddc03f
attempted to remove dependency on (old) Fv and (old) Parser; lifting still uses Fv.thy; the examples do not work at the moment (with equivp proofs failing)
Christian Urban <urbanc@in.tum.de>
parents:
2007
diff
changeset
|
368 |
Equivp.thy/prove_supports |
1bddffddc03f
attempted to remove dependency on (old) Fv and (old) Parser; lifting still uses Fv.thy; the examples do not work at the moment (with equivp proofs failing)
Christian Urban <urbanc@in.tum.de>
parents:
2007
diff
changeset
|
369 |
27) prove that union of arguments supports constructors |
1bddffddc03f
attempted to remove dependency on (old) Fv and (old) Parser; lifting still uses Fv.thy; the examples do not work at the moment (with equivp proofs failing)
Christian Urban <urbanc@in.tum.de>
parents:
2007
diff
changeset
|
370 |
Equivp.thy/prove_fs |
1bddffddc03f
attempted to remove dependency on (old) Fv and (old) Parser; lifting still uses Fv.thy; the examples do not work at the moment (with equivp proofs failing)
Christian Urban <urbanc@in.tum.de>
parents:
2007
diff
changeset
|
371 |
28) show that the lifted type is in fs typeclass (* by q_induct, supports *) |
1bddffddc03f
attempted to remove dependency on (old) Fv and (old) Parser; lifting still uses Fv.thy; the examples do not work at the moment (with equivp proofs failing)
Christian Urban <urbanc@in.tum.de>
parents:
2007
diff
changeset
|
372 |
Equivp.thy/supp_eq |
1bddffddc03f
attempted to remove dependency on (old) Fv and (old) Parser; lifting still uses Fv.thy; the examples do not work at the moment (with equivp proofs failing)
Christian Urban <urbanc@in.tum.de>
parents:
2007
diff
changeset
|
373 |
29) prove supp = fv |
1bddffddc03f
attempted to remove dependency on (old) Fv and (old) Parser; lifting still uses Fv.thy; the examples do not work at the moment (with equivp proofs failing)
Christian Urban <urbanc@in.tum.de>
parents:
2007
diff
changeset
|
374 |
*} |
1bddffddc03f
attempted to remove dependency on (old) Fv and (old) Parser; lifting still uses Fv.thy; the examples do not work at the moment (with equivp proofs failing)
Christian Urban <urbanc@in.tum.de>
parents:
2007
diff
changeset
|
375 |
|
2046
73c50e913db6
tuned and added some comments to the code; added also an exception for early exit of the nominal2_cmd function
Christian Urban <urbanc@in.tum.de>
parents:
2037
diff
changeset
|
376 |
ML {* |
73c50e913db6
tuned and added some comments to the code; added also an exception for early exit of the nominal2_cmd function
Christian Urban <urbanc@in.tum.de>
parents:
2037
diff
changeset
|
377 |
(* for testing porposes - to exit the procedure early *) |
73c50e913db6
tuned and added some comments to the code; added also an exception for early exit of the nominal2_cmd function
Christian Urban <urbanc@in.tum.de>
parents:
2037
diff
changeset
|
378 |
exception TEST of Proof.context |
73c50e913db6
tuned and added some comments to the code; added also an exception for early exit of the nominal2_cmd function
Christian Urban <urbanc@in.tum.de>
parents:
2037
diff
changeset
|
379 |
|
2125
60ee289a8c63
made out of STEPS a configuration value so that it can be set individually in each file
Christian Urban <urbanc@in.tum.de>
parents:
2122
diff
changeset
|
380 |
val (STEPS, STEPS_setup) = Attrib.config_int "STEPS" (K 10); |
60ee289a8c63
made out of STEPS a configuration value so that it can be set individually in each file
Christian Urban <urbanc@in.tum.de>
parents:
2122
diff
changeset
|
381 |
|
60ee289a8c63
made out of STEPS a configuration value so that it can be set individually in each file
Christian Urban <urbanc@in.tum.de>
parents:
2122
diff
changeset
|
382 |
fun get_STEPS ctxt = Config.get ctxt STEPS |
2046
73c50e913db6
tuned and added some comments to the code; added also an exception for early exit of the nominal2_cmd function
Christian Urban <urbanc@in.tum.de>
parents:
2037
diff
changeset
|
383 |
*} |
2008
1bddffddc03f
attempted to remove dependency on (old) Fv and (old) Parser; lifting still uses Fv.thy; the examples do not work at the moment (with equivp proofs failing)
Christian Urban <urbanc@in.tum.de>
parents:
2007
diff
changeset
|
384 |
|
2125
60ee289a8c63
made out of STEPS a configuration value so that it can be set individually in each file
Christian Urban <urbanc@in.tum.de>
parents:
2122
diff
changeset
|
385 |
setup STEPS_setup |
60ee289a8c63
made out of STEPS a configuration value so that it can be set individually in each file
Christian Urban <urbanc@in.tum.de>
parents:
2122
diff
changeset
|
386 |
|
60ee289a8c63
made out of STEPS a configuration value so that it can be set individually in each file
Christian Urban <urbanc@in.tum.de>
parents:
2122
diff
changeset
|
387 |
|
1941 | 388 |
ML {* |
389 |
fun nominal_datatype2 dts bn_funs bn_eqs bclauses lthy = |
|
390 |
let |
|
2008
1bddffddc03f
attempted to remove dependency on (old) Fv and (old) Parser; lifting still uses Fv.thy; the examples do not work at the moment (with equivp proofs failing)
Christian Urban <urbanc@in.tum.de>
parents:
2007
diff
changeset
|
391 |
(* definition of the raw datatype and raw bn-functions *) |
2106
409ecb7284dd
properly exported defined bn-functions
Christian Urban <urbanc@in.tum.de>
parents:
2105
diff
changeset
|
392 |
val ((((raw_dt_names, (raw_bn_funs, raw_bn_eqs)), raw_bclauses), raw_bns), lthy1) = |
2125
60ee289a8c63
made out of STEPS a configuration value so that it can be set individually in each file
Christian Urban <urbanc@in.tum.de>
parents:
2122
diff
changeset
|
393 |
if get_STEPS lthy > 1 then raw_nominal_decls dts bn_funs bn_eqs bclauses lthy |
2046
73c50e913db6
tuned and added some comments to the code; added also an exception for early exit of the nominal2_cmd function
Christian Urban <urbanc@in.tum.de>
parents:
2037
diff
changeset
|
394 |
else raise TEST lthy |
1941 | 395 |
|
1945
93e5a31ba230
added definition of raw-permutations to the new-parser
Christian Urban <urbanc@in.tum.de>
parents:
1944
diff
changeset
|
396 |
val dtinfo = Datatype.the_info (ProofContext.theory_of lthy1) (hd raw_dt_names); |
93e5a31ba230
added definition of raw-permutations to the new-parser
Christian Urban <urbanc@in.tum.de>
parents:
1944
diff
changeset
|
397 |
val {descr, sorts, ...} = dtinfo; |
2011
12ce87b55f97
tried to add some comments in the huge(!) nominal2_cmd function
Christian Urban <urbanc@in.tum.de>
parents:
2008
diff
changeset
|
398 |
val raw_tys = map (fn (i, _) => nth_dtyp descr sorts i) descr; |
1945
93e5a31ba230
added definition of raw-permutations to the new-parser
Christian Urban <urbanc@in.tum.de>
parents:
1944
diff
changeset
|
399 |
|
2047
31ba33a199c7
fixed my error with define_raw_fv
Christian Urban <urbanc@in.tum.de>
parents:
2046
diff
changeset
|
400 |
val induct_thm = #induct dtinfo; |
1999
4df3441aa0b4
more parser/new parser synchronization.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1996
diff
changeset
|
401 |
|
2008
1bddffddc03f
attempted to remove dependency on (old) Fv and (old) Parser; lifting still uses Fv.thy; the examples do not work at the moment (with equivp proofs failing)
Christian Urban <urbanc@in.tum.de>
parents:
2007
diff
changeset
|
402 |
(* definitions of raw permutations *) |
1945
93e5a31ba230
added definition of raw-permutations to the new-parser
Christian Urban <urbanc@in.tum.de>
parents:
1944
diff
changeset
|
403 |
val ((raw_perm_def, raw_perm_simps, perms), lthy2) = |
2125
60ee289a8c63
made out of STEPS a configuration value so that it can be set individually in each file
Christian Urban <urbanc@in.tum.de>
parents:
2122
diff
changeset
|
404 |
if get_STEPS lthy > 2 |
60ee289a8c63
made out of STEPS a configuration value so that it can be set individually in each file
Christian Urban <urbanc@in.tum.de>
parents:
2122
diff
changeset
|
405 |
then Local_Theory.theory_result (define_raw_perms descr sorts induct_thm (length dts)) lthy1 |
2046
73c50e913db6
tuned and added some comments to the code; added also an exception for early exit of the nominal2_cmd function
Christian Urban <urbanc@in.tum.de>
parents:
2037
diff
changeset
|
406 |
else raise TEST lthy1 |
1960
47e2e91705f3
Rewrote FV code and included the function package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1945
diff
changeset
|
407 |
|
2106
409ecb7284dd
properly exported defined bn-functions
Christian Urban <urbanc@in.tum.de>
parents:
2105
diff
changeset
|
408 |
(* definition of raw fv_functions *) |
1960
47e2e91705f3
Rewrote FV code and included the function package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1945
diff
changeset
|
409 |
val morphism_2_0 = ProofContext.export_morphism lthy2 lthy |
2118
0e52851acac4
moved the data-transformation into the parser
Christian Urban <urbanc@in.tum.de>
parents:
2107
diff
changeset
|
410 |
fun export_fun f (t, n , l) = (f t, n, map (map (apsnd (Option.map f))) l); |
0e52851acac4
moved the data-transformation into the parser
Christian Urban <urbanc@in.tum.de>
parents:
2107
diff
changeset
|
411 |
val bn_funs_decls = map (export_fun (Morphism.term morphism_2_0)) raw_bns; |
0e52851acac4
moved the data-transformation into the parser
Christian Urban <urbanc@in.tum.de>
parents:
2107
diff
changeset
|
412 |
|
2138
2e514a0aca63
started a new file for the parser to make some experiments
Christian Urban <urbanc@in.tum.de>
parents:
2125
diff
changeset
|
413 |
val thy = Local_Theory.exit_global lthy2; |
2001
7c8242a02f39
NewParser with Parser functionality, but some cheats included since the order of datayupes is wrong.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2000
diff
changeset
|
414 |
val thy_name = Context.theory_name thy |
2011
12ce87b55f97
tried to add some comments in the huge(!) nominal2_cmd function
Christian Urban <urbanc@in.tum.de>
parents:
2008
diff
changeset
|
415 |
|
1960
47e2e91705f3
Rewrote FV code and included the function package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1945
diff
changeset
|
416 |
val lthy3 = Theory_Target.init NONE thy; |
2000
f18b8e8a4909
Merged nominal_datatype into NewParser until eqvts
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1999
diff
changeset
|
417 |
val raw_bn_funs = map (fn (f, _, _) => f) bn_funs_decls; |
1960
47e2e91705f3
Rewrote FV code and included the function package.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1945
diff
changeset
|
418 |
|
2106
409ecb7284dd
properly exported defined bn-functions
Christian Urban <urbanc@in.tum.de>
parents:
2105
diff
changeset
|
419 |
val _ = tracing ("raw_bns\n" ^ @{make_string} raw_bns) |
409ecb7284dd
properly exported defined bn-functions
Christian Urban <urbanc@in.tum.de>
parents:
2105
diff
changeset
|
420 |
val _ = tracing ("bn_funs\n" ^ @{make_string} bn_funs_decls) |
2118
0e52851acac4
moved the data-transformation into the parser
Christian Urban <urbanc@in.tum.de>
parents:
2107
diff
changeset
|
421 |
|
2046
73c50e913db6
tuned and added some comments to the code; added also an exception for early exit of the nominal2_cmd function
Christian Urban <urbanc@in.tum.de>
parents:
2037
diff
changeset
|
422 |
val ((fv, fvbn), fv_def, lthy3a) = |
2125
60ee289a8c63
made out of STEPS a configuration value so that it can be set individually in each file
Christian Urban <urbanc@in.tum.de>
parents:
2122
diff
changeset
|
423 |
if get_STEPS lthy > 3 |
60ee289a8c63
made out of STEPS a configuration value so that it can be set individually in each file
Christian Urban <urbanc@in.tum.de>
parents:
2122
diff
changeset
|
424 |
then define_raw_fv descr sorts bn_funs_decls raw_bclauses lthy3 |
2046
73c50e913db6
tuned and added some comments to the code; added also an exception for early exit of the nominal2_cmd function
Christian Urban <urbanc@in.tum.de>
parents:
2037
diff
changeset
|
425 |
else raise TEST lthy3 |
2011
12ce87b55f97
tried to add some comments in the huge(!) nominal2_cmd function
Christian Urban <urbanc@in.tum.de>
parents:
2008
diff
changeset
|
426 |
|
1941 | 427 |
in |
2138
2e514a0aca63
started a new file for the parser to make some experiments
Christian Urban <urbanc@in.tum.de>
parents:
2125
diff
changeset
|
428 |
(0, lthy3a) |
2046
73c50e913db6
tuned and added some comments to the code; added also an exception for early exit of the nominal2_cmd function
Christian Urban <urbanc@in.tum.de>
parents:
2037
diff
changeset
|
429 |
end handle TEST ctxt => (0, ctxt) |
1941 | 430 |
*} |
431 |
||
432 |
section {* Preparing and parsing of the specification *} |
|
433 |
||
434 |
ML {* |
|
435 |
(* parsing the datatypes and declaring *) |
|
436 |
(* constructors in the local theory *) |
|
437 |
fun prepare_dts dt_strs lthy = |
|
438 |
let |
|
439 |
val thy = ProofContext.theory_of lthy |
|
440 |
||
441 |
fun mk_type full_tname tvrs = |
|
442 |
Type (full_tname, map (fn a => TVar ((a, 0), [])) tvrs) |
|
443 |
||
444 |
fun prep_cnstr full_tname tvs (cname, anno_tys, mx, _) = |
|
445 |
let |
|
446 |
val tys = map (Syntax.read_typ lthy o snd) anno_tys |
|
447 |
val ty = mk_type full_tname tvs |
|
448 |
in |
|
449 |
((cname, tys ---> ty, mx), (cname, tys, mx)) |
|
450 |
end |
|
451 |
||
452 |
fun prep_dt (tvs, tname, mx, cnstrs) = |
|
453 |
let |
|
454 |
val full_tname = Sign.full_name thy tname |
|
455 |
val (cnstrs', cnstrs'') = |
|
456 |
split_list (map (prep_cnstr full_tname tvs) cnstrs) |
|
457 |
in |
|
458 |
(cnstrs', (tvs, tname, mx, cnstrs'')) |
|
459 |
end |
|
460 |
||
461 |
val (cnstrs, dts) = split_list (map prep_dt dt_strs) |
|
462 |
in |
|
463 |
lthy |
|
464 |
|> Local_Theory.theory (Sign.add_consts_i (flat cnstrs)) |
|
465 |
|> pair dts |
|
466 |
end |
|
467 |
*} |
|
468 |
||
469 |
ML {* |
|
470 |
(* parsing the binding function specification and *) |
|
471 |
(* declaring the functions in the local theory *) |
|
472 |
fun prepare_bn_funs bn_fun_strs bn_eq_strs lthy = |
|
473 |
let |
|
474 |
val ((bn_funs, bn_eqs), _) = |
|
475 |
Specification.read_spec bn_fun_strs bn_eq_strs lthy |
|
476 |
||
477 |
fun prep_bn_fun ((bn, T), mx) = (bn, T, mx) |
|
478 |
||
479 |
val bn_funs' = map prep_bn_fun bn_funs |
|
480 |
in |
|
481 |
lthy |
|
482 |
|> Local_Theory.theory (Sign.add_consts_i bn_funs') |
|
483 |
|> pair (bn_funs', bn_eqs) |
|
484 |
end |
|
485 |
*} |
|
486 |
||
487 |
text {* associates every SOME with the index in the list; drops NONEs *} |
|
488 |
ML {* |
|
489 |
fun indexify xs = |
|
490 |
let |
|
491 |
fun mapp _ [] = [] |
|
492 |
| mapp i (NONE :: xs) = mapp (i + 1) xs |
|
493 |
| mapp i (SOME x :: xs) = (x, i) :: mapp (i + 1) xs |
|
494 |
in |
|
495 |
mapp 0 xs |
|
496 |
end |
|
497 |
||
498 |
fun index_lookup xs x = |
|
499 |
case AList.lookup (op=) xs x of |
|
500 |
SOME x => x |
|
501 |
| NONE => error ("Cannot find " ^ x ^ " as argument annotation."); |
|
502 |
*} |
|
503 |
||
504 |
ML {* |
|
505 |
fun prepare_bclauses dt_strs lthy = |
|
506 |
let |
|
507 |
val annos_bclauses = |
|
508 |
get_cnstrs dt_strs |
|
509 |
|> map (map (fn (_, antys, _, bns) => (map fst antys, bns))) |
|
510 |
||
511 |
fun prep_binder env bn_str = |
|
512 |
case (Syntax.read_term lthy bn_str) of |
|
513 |
Free (x, _) => (NONE, index_lookup env x) |
|
514 |
| Const (a, T) $ Free (x, _) => (SOME (Const (a, T)), index_lookup env x) |
|
515 |
| _ => error ("The term " ^ bn_str ^ " is not allowed as binding function.") |
|
516 |
||
517 |
fun prep_body env bn_str = index_lookup env bn_str |
|
518 |
||
519 |
fun prep_mode "bind" = BLst |
|
520 |
| prep_mode "bind_set" = BSet |
|
521 |
| prep_mode "bind_res" = BRes |
|
522 |
||
523 |
fun prep_bclause env (mode, binders, bodies) = |
|
524 |
let |
|
525 |
val binders' = map (prep_binder env) binders |
|
526 |
val bodies' = map (prep_body env) bodies |
|
527 |
in |
|
528 |
prep_mode mode (binders', bodies') |
|
529 |
end |
|
530 |
||
531 |
fun prep_bclauses (annos, bclause_strs) = |
|
532 |
let |
|
533 |
val env = indexify annos (* for every label, associate the index *) |
|
534 |
in |
|
535 |
map (prep_bclause env) bclause_strs |
|
536 |
end |
|
537 |
in |
|
538 |
map (map prep_bclauses) annos_bclauses |
|
539 |
end |
|
540 |
*} |
|
541 |
||
1943 | 542 |
text {* |
543 |
adds an empty binding clause for every argument |
|
544 |
that is not already part of a binding clause |
|
545 |
*} |
|
546 |
||
1941 | 547 |
ML {* |
548 |
fun included i bcs = |
|
549 |
let |
|
550 |
fun incl (BEmy j) = i = j |
|
2076 | 551 |
| incl (BLst (bns, bds)) = (member (op =) (map snd bns) i) orelse (member (op =) bds i) |
552 |
| incl (BSet (bns, bds)) = (member (op =) (map snd bns) i) orelse (member (op =) bds i) |
|
553 |
| incl (BRes (bns, bds)) = (member (op =) (map snd bns) i) orelse (member (op =) bds i) |
|
1941 | 554 |
in |
555 |
exists incl bcs |
|
556 |
end |
|
557 |
*} |
|
558 |
||
559 |
ML {* |
|
560 |
fun complete dt_strs bclauses = |
|
561 |
let |
|
562 |
val args = |
|
563 |
get_cnstrs dt_strs |
|
564 |
|> map (map (fn (_, antys, _, _) => length antys)) |
|
565 |
||
566 |
fun complt n bcs = |
|
567 |
let |
|
568 |
fun add bcs i = (if included i bcs then [] else [BEmy i]) |
|
569 |
in |
|
570 |
bcs @ (flat (map_range (add bcs) n)) |
|
571 |
end |
|
572 |
in |
|
573 |
map2 (map2 complt) args bclauses |
|
574 |
end |
|
575 |
*} |
|
576 |
||
577 |
ML {* |
|
578 |
fun nominal_datatype2_cmd (dt_strs, bn_fun_strs, bn_eq_strs) lthy = |
|
579 |
let |
|
580 |
fun prep_typ (tvs, tname, mx, _) = (tname, length tvs, mx) |
|
581 |
val lthy0 = |
|
582 |
Local_Theory.theory (Sign.add_types (map prep_typ dt_strs)) lthy |
|
1944 | 583 |
val (dts, lthy1) = prepare_dts dt_strs lthy0 |
584 |
val ((bn_funs, bn_eqs), lthy2) = prepare_bn_funs bn_fun_strs bn_eq_strs lthy1 |
|
1941 | 585 |
val bclauses = prepare_bclauses dt_strs lthy2 |
586 |
val bclauses' = complete dt_strs bclauses |
|
587 |
in |
|
588 |
nominal_datatype2 dts bn_funs bn_eqs bclauses' lthy |> snd |
|
589 |
end |
|
590 |
||
591 |
||
592 |
(* Command Keyword *) |
|
593 |
||
594 |
val _ = OuterSyntax.local_theory "nominal_datatype" "test" OuterKeyword.thy_decl |
|
595 |
(main_parser >> nominal_datatype2_cmd) |
|
596 |
*} |
|
597 |
||
2046
73c50e913db6
tuned and added some comments to the code; added also an exception for early exit of the nominal2_cmd function
Christian Urban <urbanc@in.tum.de>
parents:
2037
diff
changeset
|
598 |
(* |
2035
3622cae9b10e
to my best knowledge the number of datatypes is equal to the length of the dt_descr; so we can save one argument in define_raw_perm
Christian Urban <urbanc@in.tum.de>
parents:
2027
diff
changeset
|
599 |
atom_decl name |
1941 | 600 |
|
1971
8daf6ff5e11a
simpliied and moved the remaining lemmas about the atom-function to Nominal2_Base
Christian Urban <urbanc@in.tum.de>
parents:
1970
diff
changeset
|
601 |
nominal_datatype lam = |
8daf6ff5e11a
simpliied and moved the remaining lemmas about the atom-function to Nominal2_Base
Christian Urban <urbanc@in.tum.de>
parents:
1970
diff
changeset
|
602 |
Var name |
8daf6ff5e11a
simpliied and moved the remaining lemmas about the atom-function to Nominal2_Base
Christian Urban <urbanc@in.tum.de>
parents:
1970
diff
changeset
|
603 |
| App lam lam |
8daf6ff5e11a
simpliied and moved the remaining lemmas about the atom-function to Nominal2_Base
Christian Urban <urbanc@in.tum.de>
parents:
1970
diff
changeset
|
604 |
| Lam x::name t::lam bind_set x in t |
8daf6ff5e11a
simpliied and moved the remaining lemmas about the atom-function to Nominal2_Base
Christian Urban <urbanc@in.tum.de>
parents:
1970
diff
changeset
|
605 |
| Let p::pt t::lam bind_set "bn p" in t |
8daf6ff5e11a
simpliied and moved the remaining lemmas about the atom-function to Nominal2_Base
Christian Urban <urbanc@in.tum.de>
parents:
1970
diff
changeset
|
606 |
and pt = |
8daf6ff5e11a
simpliied and moved the remaining lemmas about the atom-function to Nominal2_Base
Christian Urban <urbanc@in.tum.de>
parents:
1970
diff
changeset
|
607 |
P1 name |
8daf6ff5e11a
simpliied and moved the remaining lemmas about the atom-function to Nominal2_Base
Christian Urban <urbanc@in.tum.de>
parents:
1970
diff
changeset
|
608 |
| P2 pt pt |
8daf6ff5e11a
simpliied and moved the remaining lemmas about the atom-function to Nominal2_Base
Christian Urban <urbanc@in.tum.de>
parents:
1970
diff
changeset
|
609 |
binder |
1981
9f9c4965b608
Include support of unknown datatypes in new fv
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1971
diff
changeset
|
610 |
bn::"pt \<Rightarrow> atom set" |
1971
8daf6ff5e11a
simpliied and moved the remaining lemmas about the atom-function to Nominal2_Base
Christian Urban <urbanc@in.tum.de>
parents:
1970
diff
changeset
|
611 |
where |
8daf6ff5e11a
simpliied and moved the remaining lemmas about the atom-function to Nominal2_Base
Christian Urban <urbanc@in.tum.de>
parents:
1970
diff
changeset
|
612 |
"bn (P1 x) = {atom x}" |
8daf6ff5e11a
simpliied and moved the remaining lemmas about the atom-function to Nominal2_Base
Christian Urban <urbanc@in.tum.de>
parents:
1970
diff
changeset
|
613 |
| "bn (P2 p1 p2) = bn p1 \<union> bn p2" |
8daf6ff5e11a
simpliied and moved the remaining lemmas about the atom-function to Nominal2_Base
Christian Urban <urbanc@in.tum.de>
parents:
1970
diff
changeset
|
614 |
|
2046
73c50e913db6
tuned and added some comments to the code; added also an exception for early exit of the nominal2_cmd function
Christian Urban <urbanc@in.tum.de>
parents:
2037
diff
changeset
|
615 |
find_theorems Var_raw |
73c50e913db6
tuned and added some comments to the code; added also an exception for early exit of the nominal2_cmd function
Christian Urban <urbanc@in.tum.de>
parents:
2037
diff
changeset
|
616 |
|
73c50e913db6
tuned and added some comments to the code; added also an exception for early exit of the nominal2_cmd function
Christian Urban <urbanc@in.tum.de>
parents:
2037
diff
changeset
|
617 |
|
73c50e913db6
tuned and added some comments to the code; added also an exception for early exit of the nominal2_cmd function
Christian Urban <urbanc@in.tum.de>
parents:
2037
diff
changeset
|
618 |
|
2001
7c8242a02f39
NewParser with Parser functionality, but some cheats included since the order of datayupes is wrong.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2000
diff
changeset
|
619 |
thm lam_pt.bn |
7c8242a02f39
NewParser with Parser functionality, but some cheats included since the order of datayupes is wrong.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2000
diff
changeset
|
620 |
thm lam_pt.fv[simplified lam_pt.supp(1-2)] |
7c8242a02f39
NewParser with Parser functionality, but some cheats included since the order of datayupes is wrong.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2000
diff
changeset
|
621 |
thm lam_pt.eq_iff |
7c8242a02f39
NewParser with Parser functionality, but some cheats included since the order of datayupes is wrong.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2000
diff
changeset
|
622 |
thm lam_pt.induct |
7c8242a02f39
NewParser with Parser functionality, but some cheats included since the order of datayupes is wrong.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2000
diff
changeset
|
623 |
thm lam_pt.perm |
1941 | 624 |
|
625 |
nominal_datatype exp = |
|
626 |
EVar name |
|
627 |
| EUnit |
|
1988
4444d52201dc
Fixing the definitions in the Parser.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1981
diff
changeset
|
628 |
| EPair q1::exp q2::exp |
1941 | 629 |
| ELetRec l::lrbs e::exp bind "b_lrbs l" in e l |
630 |
||
631 |
and fnclause = |
|
1988
4444d52201dc
Fixing the definitions in the Parser.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1981
diff
changeset
|
632 |
K x::name p::pat f::exp bind_res "b_pat p" in f |
1941 | 633 |
|
634 |
and fnclauses = |
|
635 |
S fnclause |
|
636 |
| ORs fnclause fnclauses |
|
637 |
||
638 |
and lrb = |
|
639 |
Clause fnclauses |
|
640 |
||
641 |
and lrbs = |
|
642 |
Single lrb |
|
643 |
| More lrb lrbs |
|
644 |
||
645 |
and pat = |
|
646 |
PVar name |
|
647 |
| PUnit |
|
648 |
| PPair pat pat |
|
649 |
||
650 |
binder |
|
1988
4444d52201dc
Fixing the definitions in the Parser.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1981
diff
changeset
|
651 |
b_lrbs :: "lrbs \<Rightarrow> atom list" and |
1941 | 652 |
b_pat :: "pat \<Rightarrow> atom set" and |
1988
4444d52201dc
Fixing the definitions in the Parser.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1981
diff
changeset
|
653 |
b_fnclauses :: "fnclauses \<Rightarrow> atom list" and |
4444d52201dc
Fixing the definitions in the Parser.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1981
diff
changeset
|
654 |
b_fnclause :: "fnclause \<Rightarrow> atom list" and |
4444d52201dc
Fixing the definitions in the Parser.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1981
diff
changeset
|
655 |
b_lrb :: "lrb \<Rightarrow> atom list" |
1941 | 656 |
|
657 |
where |
|
658 |
"b_lrbs (Single l) = b_lrb l" |
|
1988
4444d52201dc
Fixing the definitions in the Parser.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1981
diff
changeset
|
659 |
| "b_lrbs (More l ls) = append (b_lrb l) (b_lrbs ls)" |
1941 | 660 |
| "b_pat (PVar x) = {atom x}" |
661 |
| "b_pat (PUnit) = {}" |
|
662 |
| "b_pat (PPair p1 p2) = b_pat p1 \<union> b_pat p2" |
|
663 |
| "b_fnclauses (S fc) = (b_fnclause fc)" |
|
1988
4444d52201dc
Fixing the definitions in the Parser.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1981
diff
changeset
|
664 |
| "b_fnclauses (ORs fc fcs) = append (b_fnclause fc) (b_fnclauses fcs)" |
1941 | 665 |
| "b_lrb (Clause fcs) = (b_fnclauses fcs)" |
1988
4444d52201dc
Fixing the definitions in the Parser.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1981
diff
changeset
|
666 |
| "b_fnclause (K x pat exp) = [atom x]" |
1941 | 667 |
|
2001
7c8242a02f39
NewParser with Parser functionality, but some cheats included since the order of datayupes is wrong.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2000
diff
changeset
|
668 |
thm exp_fnclause_fnclauses_lrb_lrbs_pat.bn |
7c8242a02f39
NewParser with Parser functionality, but some cheats included since the order of datayupes is wrong.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2000
diff
changeset
|
669 |
thm exp_fnclause_fnclauses_lrb_lrbs_pat.fv |
7c8242a02f39
NewParser with Parser functionality, but some cheats included since the order of datayupes is wrong.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2000
diff
changeset
|
670 |
thm exp_fnclause_fnclauses_lrb_lrbs_pat.eq_iff |
7c8242a02f39
NewParser with Parser functionality, but some cheats included since the order of datayupes is wrong.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2000
diff
changeset
|
671 |
thm exp_fnclause_fnclauses_lrb_lrbs_pat.induct |
7c8242a02f39
NewParser with Parser functionality, but some cheats included since the order of datayupes is wrong.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2000
diff
changeset
|
672 |
thm exp_fnclause_fnclauses_lrb_lrbs_pat.perm |
1945
93e5a31ba230
added definition of raw-permutations to the new-parser
Christian Urban <urbanc@in.tum.de>
parents:
1944
diff
changeset
|
673 |
|
1988
4444d52201dc
Fixing the definitions in the Parser.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1981
diff
changeset
|
674 |
nominal_datatype ty = |
2001
7c8242a02f39
NewParser with Parser functionality, but some cheats included since the order of datayupes is wrong.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2000
diff
changeset
|
675 |
Vr "name" |
7c8242a02f39
NewParser with Parser functionality, but some cheats included since the order of datayupes is wrong.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2000
diff
changeset
|
676 |
| Fn "ty" "ty" |
7c8242a02f39
NewParser with Parser functionality, but some cheats included since the order of datayupes is wrong.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2000
diff
changeset
|
677 |
and tys = |
7c8242a02f39
NewParser with Parser functionality, but some cheats included since the order of datayupes is wrong.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2000
diff
changeset
|
678 |
Al xs::"name fset" t::"ty" bind_res xs in t |
7c8242a02f39
NewParser with Parser functionality, but some cheats included since the order of datayupes is wrong.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2000
diff
changeset
|
679 |
|
7c8242a02f39
NewParser with Parser functionality, but some cheats included since the order of datayupes is wrong.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2000
diff
changeset
|
680 |
thm ty_tys.fv[simplified ty_tys.supp] |
7c8242a02f39
NewParser with Parser functionality, but some cheats included since the order of datayupes is wrong.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2000
diff
changeset
|
681 |
thm ty_tys.eq_iff |
2011
12ce87b55f97
tried to add some comments in the huge(!) nominal2_cmd function
Christian Urban <urbanc@in.tum.de>
parents:
2008
diff
changeset
|
682 |
|
2017
6a4049e1d68d
Add explicit cheats in NewParser and comment out the examples for outside use.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2016
diff
changeset
|
683 |
*) |
2001
7c8242a02f39
NewParser with Parser functionality, but some cheats included since the order of datayupes is wrong.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2000
diff
changeset
|
684 |
|
7c8242a02f39
NewParser with Parser functionality, but some cheats included since the order of datayupes is wrong.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2000
diff
changeset
|
685 |
(* some further tests *) |
7c8242a02f39
NewParser with Parser functionality, but some cheats included since the order of datayupes is wrong.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2000
diff
changeset
|
686 |
|
2008
1bddffddc03f
attempted to remove dependency on (old) Fv and (old) Parser; lifting still uses Fv.thy; the examples do not work at the moment (with equivp proofs failing)
Christian Urban <urbanc@in.tum.de>
parents:
2007
diff
changeset
|
687 |
(* |
1bddffddc03f
attempted to remove dependency on (old) Fv and (old) Parser; lifting still uses Fv.thy; the examples do not work at the moment (with equivp proofs failing)
Christian Urban <urbanc@in.tum.de>
parents:
2007
diff
changeset
|
688 |
nominal_datatype ty2 = |
1bddffddc03f
attempted to remove dependency on (old) Fv and (old) Parser; lifting still uses Fv.thy; the examples do not work at the moment (with equivp proofs failing)
Christian Urban <urbanc@in.tum.de>
parents:
2007
diff
changeset
|
689 |
Vr2 "name" |
1bddffddc03f
attempted to remove dependency on (old) Fv and (old) Parser; lifting still uses Fv.thy; the examples do not work at the moment (with equivp proofs failing)
Christian Urban <urbanc@in.tum.de>
parents:
2007
diff
changeset
|
690 |
| Fn2 "ty2" "ty2" |
1988
4444d52201dc
Fixing the definitions in the Parser.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1981
diff
changeset
|
691 |
|
2008
1bddffddc03f
attempted to remove dependency on (old) Fv and (old) Parser; lifting still uses Fv.thy; the examples do not work at the moment (with equivp proofs failing)
Christian Urban <urbanc@in.tum.de>
parents:
2007
diff
changeset
|
692 |
nominal_datatype tys2 = |
1bddffddc03f
attempted to remove dependency on (old) Fv and (old) Parser; lifting still uses Fv.thy; the examples do not work at the moment (with equivp proofs failing)
Christian Urban <urbanc@in.tum.de>
parents:
2007
diff
changeset
|
693 |
All2 xs::"name fset" ty::"ty2" bind_res xs in ty |
1964
209ee65b2395
added some further problemetic tests
Christian Urban <urbanc@in.tum.de>
parents:
1963
diff
changeset
|
694 |
|
1971
8daf6ff5e11a
simpliied and moved the remaining lemmas about the atom-function to Nominal2_Base
Christian Urban <urbanc@in.tum.de>
parents:
1970
diff
changeset
|
695 |
nominal_datatype lam2 = |
8daf6ff5e11a
simpliied and moved the remaining lemmas about the atom-function to Nominal2_Base
Christian Urban <urbanc@in.tum.de>
parents:
1970
diff
changeset
|
696 |
Var2 "name" |
8daf6ff5e11a
simpliied and moved the remaining lemmas about the atom-function to Nominal2_Base
Christian Urban <urbanc@in.tum.de>
parents:
1970
diff
changeset
|
697 |
| App2 "lam2" "lam2 list" |
8daf6ff5e11a
simpliied and moved the remaining lemmas about the atom-function to Nominal2_Base
Christian Urban <urbanc@in.tum.de>
parents:
1970
diff
changeset
|
698 |
| Lam2 x::"name" t::"lam2" bind x in t |
2008
1bddffddc03f
attempted to remove dependency on (old) Fv and (old) Parser; lifting still uses Fv.thy; the examples do not work at the moment (with equivp proofs failing)
Christian Urban <urbanc@in.tum.de>
parents:
2007
diff
changeset
|
699 |
*) |
1964
209ee65b2395
added some further problemetic tests
Christian Urban <urbanc@in.tum.de>
parents:
1963
diff
changeset
|
700 |
|
1941 | 701 |
|
702 |
||
703 |
end |
|
704 |
||
705 |
||
706 |