equal
deleted
inserted
replaced
14 val add_primrec_global: (binding * typ option * mixfix) list -> |
14 val add_primrec_global: (binding * typ option * mixfix) list -> |
15 (Attrib.binding * term) list -> theory -> thm list * theory |
15 (Attrib.binding * term) list -> theory -> thm list * theory |
16 val add_primrec_overloaded: (string * (string * typ) * bool) list -> |
16 val add_primrec_overloaded: (string * (string * typ) * bool) list -> |
17 (binding * typ option * mixfix) list -> |
17 (binding * typ option * mixfix) list -> |
18 (Attrib.binding * term) list -> theory -> thm list * theory |
18 (Attrib.binding * term) list -> theory -> thm list * theory |
19 val add_primrec_simple: ((binding * typ) * mixfix) list -> (binding * term) list -> |
19 val add_primrec_simple: ((binding * typ) * mixfix) list -> term list -> |
20 local_theory -> (string * thm list list) * local_theory |
20 local_theory -> (string * thm list list) * local_theory |
21 end; |
21 end; |
22 |
22 |
23 structure PrimrecPackage : PRIMREC_PACKAGE = |
23 structure PrimrecPackage : PRIMREC_PACKAGE = |
24 struct |
24 struct |
250 | NONE => "")); |
250 | NONE => "")); |
251 |
251 |
252 |
252 |
253 (* primrec definition *) |
253 (* primrec definition *) |
254 |
254 |
255 fun add_primrec_simple fixes spec lthy = |
255 fun add_primrec_simple fixes ts lthy = |
256 let |
256 let |
257 val ((prefix, (fs, defs)), prove) = distill lthy fixes (map snd spec); |
257 val ((prefix, (fs, defs)), prove) = distill lthy fixes ts; |
258 in |
258 in |
259 lthy |
259 lthy |
260 |> fold_map (LocalTheory.define Thm.definitionK) defs |
260 |> fold_map (LocalTheory.define Thm.definitionK) defs |
261 |-> (fn defs => `(fn lthy => (prefix, prove lthy defs))) |
261 |-> (fn defs => `(fn lthy => (prefix, prove lthy defs))) |
262 end; |
262 end; |
272 map (Attrib.internal o K) |
272 map (Attrib.internal o K) |
273 [Simplifier.simp_add, Nitpick_Const_Simp_Thms.add, Quickcheck_RecFun_Simp_Thms.add]); |
273 [Simplifier.simp_add, Nitpick_Const_Simp_Thms.add, Quickcheck_RecFun_Simp_Thms.add]); |
274 in |
274 in |
275 lthy |
275 lthy |
276 |> set_group ? LocalTheory.set_group (serial_string ()) |
276 |> set_group ? LocalTheory.set_group (serial_string ()) |
277 |> add_primrec_simple fixes spec |
277 |> add_primrec_simple fixes (map snd spec) |
278 |-> (fn (prefix, simps) => fold_map (LocalTheory.note Thm.generatedK) |
278 |-> (fn (prefix, simps) => fold_map (LocalTheory.note Thm.generatedK) |
279 (attr_bindings prefix ~~ simps) |
279 (attr_bindings prefix ~~ simps) |
280 #-> (fn simps' => LocalTheory.note Thm.generatedK |
280 #-> (fn simps' => LocalTheory.note Thm.generatedK |
281 (simp_attr_binding prefix, maps snd simps'))) |
281 (simp_attr_binding prefix, maps snd simps'))) |
282 |>> snd |
282 |>> snd |