equal
deleted
inserted
replaced
48 val proper_subthy: theory * theory -> bool |
48 val proper_subthy: theory * theory -> bool |
49 val subthy_id: theory_id * theory_id -> bool |
49 val subthy_id: theory_id * theory_id -> bool |
50 val subthy: theory * theory -> bool |
50 val subthy: theory * theory -> bool |
51 val finish_thy: theory -> theory |
51 val finish_thy: theory -> theory |
52 val begin_thy: string -> theory list -> theory |
52 val begin_thy: string -> theory list -> theory |
|
53 val theory_data_size: theory -> (Position.T * int) list |
53 (*proof context*) |
54 (*proof context*) |
54 val raw_transfer: theory -> Proof.context -> Proof.context |
55 val raw_transfer: theory -> Proof.context -> Proof.context |
55 (*certificate*) |
56 (*certificate*) |
56 datatype certificate = Certificate of theory | Certificate_Id of theory_id |
57 datatype certificate = Certificate of theory | Certificate_Id of theory_id |
57 val certificate_theory: certificate -> theory |
58 val certificate_theory: certificate -> theory |
263 else f kind x |
264 else f kind x |
264 | NONE => raise Fail "Invalid theory data identifier"); |
265 | NONE => raise Fail "Invalid theory data identifier"); |
265 |
266 |
266 in |
267 in |
267 |
268 |
|
269 fun invoke_pos k = invoke "" (K o #pos) k (); |
268 fun invoke_empty k = invoke "" (K o #empty) k (); |
270 fun invoke_empty k = invoke "" (K o #empty) k (); |
269 val invoke_extend = invoke "extend" #extend; |
271 val invoke_extend = invoke "extend" #extend; |
270 fun invoke_merge thys = invoke "merge" (fn kind => #merge kind thys); |
272 fun invoke_merge thys = invoke "merge" (fn kind => #merge kind thys); |
271 |
273 |
272 fun declare_theory_data pos empty extend merge = |
274 fun declare_theory_data pos empty extend merge = |
367 SOME x => x |
369 SOME x => x |
368 | NONE => invoke_empty k) |> dest; |
370 | NONE => invoke_empty k) |> dest; |
369 |
371 |
370 fun put k mk x = update_thy (Datatab.update (k, mk x)); |
372 fun put k mk x = update_thy (Datatab.update (k, mk x)); |
371 |
373 |
372 end; |
374 fun obj_size k thy = |
|
375 Datatab.lookup (data_of thy) k |> Option.map ML_Heap.obj_size; |
|
376 |
|
377 end; |
|
378 |
|
379 fun theory_data_size thy = |
|
380 (data_of thy, []) |-> Datatab.fold_rev (fn (k, _) => |
|
381 (case Theory_Data.obj_size k thy of |
|
382 NONE => I |
|
383 | SOME n => (cons (invoke_pos k, n)))); |
373 |
384 |
374 |
385 |
375 |
386 |
376 (*** proof context ***) |
387 (*** proof context ***) |
377 |
388 |