23 val abbrev: (string * bool -> binding * mixfix -> term * term -> |
23 val abbrev: (string * bool -> binding * mixfix -> term * term -> |
24 term list -> local_theory -> local_theory) -> |
24 term list -> local_theory -> local_theory) -> |
25 string * bool -> (binding * mixfix) * term -> local_theory -> (term * term) * local_theory |
25 string * bool -> (binding * mixfix) * term -> local_theory -> (term * term) * local_theory |
26 val background_declaration: declaration -> local_theory -> local_theory |
26 val background_declaration: declaration -> local_theory -> local_theory |
27 val locale_declaration: string -> bool -> declaration -> local_theory -> local_theory |
27 val locale_declaration: string -> bool -> declaration -> local_theory -> local_theory |
28 val standard_declaration: (int -> int -> bool) -> declaration -> local_theory -> local_theory |
28 val standard_declaration: (int * int -> bool) -> declaration -> local_theory -> local_theory |
29 val generic_const: bool -> Syntax.mode -> (binding * mixfix) * term -> |
29 val generic_const: bool -> Syntax.mode -> (binding * mixfix) * term -> |
30 Context.generic -> Context.generic |
30 Context.generic -> Context.generic |
31 val const_declaration: (int -> int -> bool) -> Syntax.mode -> (binding * mixfix) * term -> |
31 val const_declaration: (int * int -> bool) -> Syntax.mode -> (binding * mixfix) * term -> |
32 local_theory -> local_theory |
32 local_theory -> local_theory |
33 val background_foundation: ((binding * typ) * mixfix) * (binding * term) -> |
33 val background_foundation: ((binding * typ) * mixfix) * (binding * term) -> |
34 term list * term list -> local_theory -> (term * thm) * local_theory |
34 term list * term list -> local_theory -> (term * thm) * local_theory |
35 val theory_foundation: ((binding * typ) * mixfix) * (binding * term) -> |
35 val theory_foundation: ((binding * typ) * mixfix) * (binding * term) -> |
36 term list * term list -> local_theory -> (term * thm) * local_theory |
36 term list * term list -> local_theory -> (term * thm) * local_theory |
229 Locale.add_declaration locale syntax |
229 Locale.add_declaration locale syntax |
230 (Morphism.transform (Local_Theory.standard_morphism lthy ctxt) decl)); |
230 (Morphism.transform (Local_Theory.standard_morphism lthy ctxt) decl)); |
231 |
231 |
232 fun standard_declaration pred decl lthy = |
232 fun standard_declaration pred decl lthy = |
233 Local_Theory.map_contexts (fn level => fn ctxt => |
233 Local_Theory.map_contexts (fn level => fn ctxt => |
234 if pred (Local_Theory.level lthy) level |
234 if pred (Local_Theory.level lthy, level) |
235 then Context.proof_map (Local_Theory.standard_form lthy ctxt decl) ctxt |
235 then Context.proof_map (Local_Theory.standard_form lthy ctxt decl) ctxt |
236 else ctxt) lthy; |
236 else ctxt) lthy; |
237 |
237 |
238 |
238 |
239 (* const declaration *) |
239 (* const declaration *) |
306 in ((lhs, def), lthy3) end; |
306 in ((lhs, def), lthy3) end; |
307 |
307 |
308 fun theory_foundation (((b, U), mx), (b_def, rhs)) (type_params, term_params) = |
308 fun theory_foundation (((b, U), mx), (b_def, rhs)) (type_params, term_params) = |
309 background_foundation (((b, U), mx), (b_def, rhs)) (type_params, term_params) |
309 background_foundation (((b, U), mx), (b_def, rhs)) (type_params, term_params) |
310 #-> (fn (lhs, def) => |
310 #-> (fn (lhs, def) => |
311 const_declaration (fn this_level => fn level => level <> this_level) |
311 const_declaration (op <>) Syntax.mode_default ((b, mx), lhs) |
312 Syntax.mode_default ((b, mx), lhs) |
|
313 #> pair (lhs, def)); |
312 #> pair (lhs, def)); |
314 |
313 |
315 fun theory_notes kind global_facts local_facts = |
314 fun theory_notes kind global_facts local_facts = |
316 Local_Theory.background_theory (Attrib.global_notes kind global_facts #> snd) #> |
315 Local_Theory.background_theory (Attrib.global_notes kind global_facts #> snd) #> |
317 (fn lthy => lthy |> Local_Theory.map_contexts (fn level => fn ctxt => |
316 (fn lthy => lthy |> Local_Theory.map_contexts (fn level => fn ctxt => |
324 Local_Theory.background_theory_result |
323 Local_Theory.background_theory_result |
325 (Sign.add_abbrev (#1 prmode) (b, t) #-> |
324 (Sign.add_abbrev (#1 prmode) (b, t) #-> |
326 (fn (lhs, _) => (* FIXME type_params!? *) |
325 (fn (lhs, _) => (* FIXME type_params!? *) |
327 Sign.notation true prmode [(lhs, check_mixfix_global (b, null xs) mx)] #> pair lhs)) |
326 Sign.notation true prmode [(lhs, check_mixfix_global (b, null xs) mx)] #> pair lhs)) |
328 #-> (fn lhs => |
327 #-> (fn lhs => |
329 const_declaration (fn this_level => fn level => level <> this_level) prmode |
328 const_declaration (op <>) prmode |
330 ((b, if null xs then NoSyn else mx), Term.list_comb (Logic.unvarify_global lhs, xs))); |
329 ((b, if null xs then NoSyn else mx), Term.list_comb (Logic.unvarify_global lhs, xs))); |
331 |
330 |
332 fun theory_declaration decl = |
331 fun theory_declaration decl = |
333 background_declaration decl #> standard_declaration ((K o K) true) decl; |
332 background_declaration decl #> standard_declaration (K true) decl; |
334 |
333 |
335 end; |
334 end; |