22 ('c * ('a list * 'd) list) list -> ('c * ('b list * 'd) list) list |
22 ('c * ('a list * 'd) list) list -> ('c * ('b list * 'd) list) list |
23 val name_multi: string -> 'a list -> (string * 'a) list |
23 val name_multi: string -> 'a list -> (string * 'a) list |
24 val name_thm: bool -> bool -> Position.T -> string -> thm -> thm |
24 val name_thm: bool -> bool -> Position.T -> string -> thm -> thm |
25 val name_thms: bool -> bool -> Position.T -> string -> thm list -> thm list |
25 val name_thms: bool -> bool -> Position.T -> string -> thm list -> thm list |
26 val name_thmss: bool -> Position.T -> string -> (thm list * 'a) list -> (thm list * 'a) list |
26 val name_thmss: bool -> Position.T -> string -> (thm list * 'a) list -> (thm list * 'a) list |
27 val store_thms: bstring * thm list -> theory -> thm list * theory |
27 val store_thms: binding * thm list -> theory -> thm list * theory |
28 val store_thm: bstring * thm -> theory -> thm * theory |
28 val store_thm: binding * thm -> theory -> thm * theory |
29 val store_thm_open: bstring * thm -> theory -> thm * theory |
29 val store_thm_open: binding * thm -> theory -> thm * theory |
30 val add_thms: ((bstring * thm) * attribute list) list -> theory -> thm list * theory |
30 val add_thms: ((binding * thm) * attribute list) list -> theory -> thm list * theory |
31 val add_thm: (bstring * thm) * attribute list -> theory -> thm * theory |
31 val add_thm: (binding * thm) * attribute list -> theory -> thm * theory |
32 val add_thmss: ((bstring * thm list) * attribute list) list -> theory -> thm list list * theory |
32 val add_thmss: ((binding * thm list) * attribute list) list -> theory -> thm list list * theory |
33 val add_thms_dynamic: bstring * (Context.generic -> thm list) -> theory -> theory |
33 val add_thms_dynamic: binding * (Context.generic -> thm list) -> theory -> theory |
34 val note_thmss: string -> ((Binding.T * attribute list) * |
34 val note_thmss: string -> ((binding * attribute list) * |
35 (thm list * attribute list) list) list -> theory -> (string * thm list) list * theory |
35 (thm list * attribute list) list) list -> theory -> (string * thm list) list * theory |
36 val note_thmss_grouped: string -> string -> ((Binding.T * attribute list) * |
36 val note_thmss_grouped: string -> string -> ((binding * attribute list) * |
37 (thm list * attribute list) list) list -> theory -> (string * thm list) list * theory |
37 (thm list * attribute list) list) list -> theory -> (string * thm list) list * theory |
38 val add_axioms: ((bstring * term) * attribute list) list -> theory -> thm list * theory |
38 val add_axioms: ((binding * term) * attribute list) list -> theory -> thm list * theory |
39 val add_axioms_cmd: ((bstring * string) * attribute list) list -> theory -> thm list * theory |
39 val add_axioms_cmd: ((bstring * string) * attribute list) list -> theory -> thm list * theory |
40 val add_defs: bool -> ((bstring * term) * attribute list) list -> |
40 val add_defs: bool -> ((binding * term) * attribute list) list -> |
41 theory -> thm list * theory |
41 theory -> thm list * theory |
42 val add_defs_unchecked: bool -> ((bstring * term) * attribute list) list -> |
42 val add_defs_unchecked: bool -> ((binding * term) * attribute list) list -> |
|
43 theory -> thm list * theory |
|
44 val add_defs_cmd: bool -> ((bstring * string) * attribute list) list -> |
43 theory -> thm list * theory |
45 theory -> thm list * theory |
44 val add_defs_unchecked_cmd: bool -> ((bstring * string) * attribute list) list -> |
46 val add_defs_unchecked_cmd: bool -> ((bstring * string) * attribute list) list -> |
45 theory -> thm list * theory |
|
46 val add_defs_cmd: bool -> ((bstring * string) * attribute list) list -> |
|
47 theory -> thm list * theory |
47 theory -> thm list * theory |
48 val old_appl_syntax: theory -> bool |
48 val old_appl_syntax: theory -> bool |
49 val old_appl_syntax_setup: theory -> theory |
49 val old_appl_syntax_setup: theory -> theory |
50 end; |
50 end; |
51 |
51 |
161 in (thms'', thy'') end; |
161 in (thms'', thy'') end; |
162 |
162 |
163 |
163 |
164 (* store_thm(s) *) |
164 (* store_thm(s) *) |
165 |
165 |
166 fun store_thms (bname, thms) = enter_thms (name_thms true true Position.none) |
166 fun store_thms (b, thms) = enter_thms (name_thms true true Position.none) |
167 (name_thms false true Position.none) I (Binding.name bname, thms); |
167 (name_thms false true Position.none) I (b, thms); |
168 |
168 |
169 fun store_thm (bname, th) = store_thms (bname, [th]) #>> the_single; |
169 fun store_thm (b, th) = store_thms (b, [th]) #>> the_single; |
170 |
170 |
171 fun store_thm_open (bname, th) = |
171 fun store_thm_open (b, th) = |
172 enter_thms (name_thms true false Position.none) (name_thms false false Position.none) I |
172 enter_thms (name_thms true false Position.none) (name_thms false false Position.none) I |
173 (Binding.name bname, [th]) #>> the_single; |
173 (b, [th]) #>> the_single; |
174 |
174 |
175 |
175 |
176 (* add_thms(s) *) |
176 (* add_thms(s) *) |
177 |
177 |
178 fun add_thms_atts pre_name ((bname, thms), atts) = |
178 fun add_thms_atts pre_name ((b, thms), atts) = |
179 enter_thms pre_name (name_thms false true Position.none) |
179 enter_thms pre_name (name_thms false true Position.none) |
180 (foldl_map (Thm.theory_attributes atts)) (Binding.name bname, thms); |
180 (foldl_map (Thm.theory_attributes atts)) (b, thms); |
181 |
181 |
182 fun gen_add_thmss pre_name = |
182 fun gen_add_thmss pre_name = |
183 fold_map (add_thms_atts pre_name); |
183 fold_map (add_thms_atts pre_name); |
184 |
184 |
185 fun gen_add_thms pre_name args = |
185 fun gen_add_thms pre_name args = |
222 |
222 |
223 |
223 |
224 (* store axioms as theorems *) |
224 (* store axioms as theorems *) |
225 |
225 |
226 local |
226 local |
227 fun get_ax thy (name, _) = Thm.axiom thy (Sign.full_bname thy name); |
227 fun get_ax thy (b, _) = Thm.axiom thy (Sign.full_name thy b); |
228 fun get_axs thy named_axs = map (Thm.forall_elim_vars 0 o get_ax thy) named_axs; |
228 fun get_axs thy named_axs = map (Thm.forall_elim_vars 0 o get_ax thy) named_axs; |
229 fun add_axm add = fold_map (fn ((name, ax), atts) => fn thy => |
229 fun add_axm prep_b add = fold_map (fn ((b, ax), atts) => fn thy => |
230 let |
230 let |
231 val named_ax = [(name, ax)]; |
231 val named_ax = [(b, ax)]; |
232 val thy' = add named_ax thy; |
232 val thy' = add named_ax thy; |
233 val thm = hd (get_axs thy' named_ax); |
233 val thm = hd (get_axs thy' ((map o apfst) prep_b named_ax)); |
234 in apfst hd (gen_add_thms (K I) [((name, thm), atts)] thy') end); |
234 in apfst hd (gen_add_thms (K I) [((prep_b b, thm), atts)] thy') end); |
235 in |
235 in |
236 val add_defs = add_axm o Theory.add_defs_i false; |
236 val add_defs = add_axm I o Theory.add_defs_i false; |
237 val add_defs_unchecked = add_axm o Theory.add_defs_i true; |
237 val add_defs_unchecked = add_axm I o Theory.add_defs_i true; |
238 val add_axioms = add_axm Theory.add_axioms_i; |
238 val add_axioms = add_axm I Theory.add_axioms_i; |
239 val add_defs_cmd = add_axm o Theory.add_defs false; |
239 val add_defs_cmd = add_axm Binding.name o Theory.add_defs false; |
240 val add_defs_unchecked_cmd = add_axm o Theory.add_defs true; |
240 val add_defs_unchecked_cmd = add_axm Binding.name o Theory.add_defs true; |
241 val add_axioms_cmd = add_axm Theory.add_axioms; |
241 val add_axioms_cmd = add_axm Binding.name Theory.add_axioms; |
242 end; |
242 end; |
243 |
243 |
244 |
244 |
245 |
245 |
246 (*** Pure theory syntax and logical content ***) |
246 (*** Pure theory syntax and logical content ***) |
376 #> Sign.add_consts_i |
376 #> Sign.add_consts_i |
377 [("term", typ "'a => prop", NoSyn), |
377 [("term", typ "'a => prop", NoSyn), |
378 ("sort_constraint", typ "'a itself => prop", NoSyn), |
378 ("sort_constraint", typ "'a itself => prop", NoSyn), |
379 ("conjunction", typ "prop => prop => prop", NoSyn)] |
379 ("conjunction", typ "prop => prop => prop", NoSyn)] |
380 #> (add_defs false o map Thm.no_attributes) |
380 #> (add_defs false o map Thm.no_attributes) |
381 [("prop_def", prop "(CONST prop :: prop => prop) (A::prop) == A::prop"), |
381 [(Binding.name "prop_def", prop "(CONST prop :: prop => prop) (A::prop) == A::prop"), |
382 ("term_def", prop "(CONST Pure.term :: 'a => prop) (x::'a) == (!!A::prop. A ==> A)"), |
382 (Binding.name "term_def", prop "(CONST Pure.term :: 'a => prop) (x::'a) == (!!A::prop. A ==> A)"), |
383 ("sort_constraint_def", |
383 (Binding.name "sort_constraint_def", |
384 prop "(CONST Pure.sort_constraint :: 'a itself => prop) (CONST TYPE :: 'a itself) ==\ |
384 prop "(CONST Pure.sort_constraint :: 'a itself => prop) (CONST TYPE :: 'a itself) ==\ |
385 \ (CONST Pure.term :: 'a itself => prop) (CONST TYPE :: 'a itself)"), |
385 \ (CONST Pure.term :: 'a itself => prop) (CONST TYPE :: 'a itself)"), |
386 ("conjunction_def", prop "(A &&& B) == (!!C::prop. (A ==> B ==> C) ==> C)")] #> snd |
386 (Binding.name "conjunction_def", prop "(A &&& B) == (!!C::prop. (A ==> B ==> C) ==> C)")] #> snd |
387 #> Sign.hide_const false "Pure.term" |
387 #> Sign.hide_const false "Pure.term" |
388 #> Sign.hide_const false "Pure.sort_constraint" |
388 #> Sign.hide_const false "Pure.sort_constraint" |
389 #> Sign.hide_const false "Pure.conjunction" |
389 #> Sign.hide_const false "Pure.conjunction" |
390 #> add_thmss [(("nothing", []), [])] #> snd |
390 #> add_thmss [((Binding.name "nothing", []), [])] #> snd |
391 #> Theory.add_axioms_i Proofterm.equality_axms)); |
391 #> Theory.add_axioms_i ((map o apfst) Binding.name Proofterm.equality_axms))); |
392 |
392 |
393 end; |
393 end; |