src/Pure/more_thm.ML
changeset 49011 9c68e43502ce
parent 49010 72808e956879
child 49058 2924a83a4a0b
equal deleted inserted replaced
49010:72808e956879 49011:9c68e43502ce
    93   val lemmaK: string
    93   val lemmaK: string
    94   val corollaryK: string
    94   val corollaryK: string
    95   val legacy_get_kind: thm -> string
    95   val legacy_get_kind: thm -> string
    96   val kind_rule: string -> thm -> thm
    96   val kind_rule: string -> thm -> thm
    97   val kind: string -> attribute
    97   val kind: string -> attribute
    98   val register_proofs: thm list -> theory -> theory
    98   val register_proofs: thm list -> Context.generic -> Context.generic
    99   val begin_recent_proofs: theory -> theory
    99   val begin_proofs: Context.generic -> Context.generic
       
   100   val join_local_proofs: Proof.context -> unit
   100   val join_recent_proofs: theory -> unit
   101   val join_recent_proofs: theory -> unit
   101   val join_all_proofs: theory -> unit
   102   val join_theory_proofs: theory -> unit
   102 end;
   103 end;
   103 
   104 
   104 structure Thm: THM =
   105 structure Thm: THM =
   105 struct
   106 struct
   106 
   107 
   468 
   469 
   469 fun kind_rule k = tag_rule (Markup.kindN, k) o untag_rule Markup.kindN;
   470 fun kind_rule k = tag_rule (Markup.kindN, k) o untag_rule Markup.kindN;
   470 fun kind k = rule_attribute (K (k <> "" ? kind_rule k));
   471 fun kind k = rule_attribute (K (k <> "" ? kind_rule k));
   471 
   472 
   472 
   473 
   473 (* forked proofs within the context *)
   474 (* forked proofs *)
   474 
   475 
   475 type proofs = thm list * unit lazy;  (*accumulated thms, persistent join*)
   476 type proofs = thm list * unit lazy;  (*accumulated thms, persistent join*)
   476 
   477 
   477 val empty_proofs: proofs = ([], Lazy.value ());
   478 val empty_proofs: proofs = ([], Lazy.value ());
   478 
   479 
   480   let val thms' = fold cons more_thms thms
   481   let val thms' = fold cons more_thms thms
   481   in (thms', Lazy.lazy (fn () => Thm.join_proofs (rev thms'))) end;
   482   in (thms', Lazy.lazy (fn () => Thm.join_proofs (rev thms'))) end;
   482 
   483 
   483 fun force_proofs ((_, prfs): proofs) = Lazy.force prfs;
   484 fun force_proofs ((_, prfs): proofs) = Lazy.force prfs;
   484 
   485 
   485 structure Proofs = Theory_Data
   486 structure Proofs = Generic_Data
   486 (
   487 (
   487   type T = proofs * proofs;  (*recent proofs, all proofs of theory node*)
   488   type T = proofs * proofs;  (*recent proofs since last begin, all proofs of theory node*)
   488   val empty = (empty_proofs, empty_proofs);
   489   val empty = (empty_proofs, empty_proofs);
   489   fun extend _ = empty;
   490   fun extend _ = empty;
   490   fun merge _ = empty;
   491   fun merge _ = empty;
   491 );
   492 );
   492 
   493 
       
   494 val begin_proofs = Proofs.map (apfst (K empty_proofs));
   493 val register_proofs = Proofs.map o pairself o add_proofs;
   495 val register_proofs = Proofs.map o pairself o add_proofs;
   494 val begin_recent_proofs = Proofs.map (apfst (K empty_proofs));
   496 
   495 
   497 val join_local_proofs = force_proofs o #1 o Proofs.get o Context.Proof;
   496 val join_recent_proofs = force_proofs o #1 o Proofs.get;
   498 val join_recent_proofs = force_proofs o #1 o Proofs.get o Context.Theory;
   497 val join_all_proofs = force_proofs o #2 o Proofs.get;
   499 val join_theory_proofs = force_proofs o #2 o Proofs.get o Context.Theory;
   498 
   500 
   499 
   501 
   500 open Thm;
   502 open Thm;
   501 
   503 
   502 end;
   504 end;