src/Pure/Isar/locale.ML
changeset 30773 6cc9964436c3
parent 30764 3e3e7aa0cc7a
child 30775 71f777103225
equal deleted inserted replaced
30772:dca52e229138 30773:6cc9964436c3
   243     val (dependencies, marked') = add thy 0 (name, morph) ([], []);
   243     val (dependencies, marked') = add thy 0 (name, morph) ([], []);
   244     (* Filter out exisiting fragments. *)
   244     (* Filter out exisiting fragments. *)
   245     val dependencies' = filter_out (fn (name, morph) =>
   245     val dependencies' = filter_out (fn (name, morph) =>
   246       member (ident_eq thy) marked (name, instance_of thy name morph)) dependencies;
   246       member (ident_eq thy) marked (name, instance_of thy name morph)) dependencies;
   247   in
   247   in
   248     (merge (ident_eq thy) (marked, marked'), input |> fold_rev (activate_dep thy) dependencies')
   248     (merge (ident_eq thy) (marked, marked'), input |> fold_rev activate_dep dependencies')
   249   end;
   249   end;
   250 
   250 
   251 end;
   251 end;
   252 
   252 
   253 
   253 
   283       (* FIXME type parameters *)
   283       (* FIXME type parameters *)
   284       (case asm of SOME A => activ_elem (Assumes [(Attrib.empty_binding, [(A, [])])]) | _ => I) |>
   284       (case asm of SOME A => activ_elem (Assumes [(Attrib.empty_binding, [(A, [])])]) | _ => I) |>
   285       (if not (null defs)
   285       (if not (null defs)
   286         then activ_elem (Defines (map (fn def => (Attrib.empty_binding, (def, []))) defs))
   286         then activ_elem (Defines (map (fn def => (Attrib.empty_binding, (def, []))) defs))
   287         else I);
   287         else I);
   288   in
   288     val activate = activate_notes activ_elem transfer thy;
   289     roundup thy (activate_notes activ_elem transfer) (name, Morphism.identity) (marked, input')
   289   in
       
   290     roundup thy activate (name, Morphism.identity) (marked, input')
   290   end;
   291   end;
   291 
   292 
   292 
   293 
   293 (** Public activation functions **)
   294 (** Public activation functions **)
   294 
   295 
   325 
   326 
   326 fun activate_declarations dep ctxt =
   327 fun activate_declarations dep ctxt =
   327   let
   328   let
   328     val context = Context.Proof ctxt;
   329     val context = Context.Proof ctxt;
   329     val thy = Context.theory_of context;
   330     val thy = Context.theory_of context;
   330     val context' = roundup thy (K activate_decls) dep (get_idents context, context) |-> put_idents;
   331     val context' = roundup thy activate_decls dep (get_idents context, context) |-> put_idents;
   331   in Context.the_proof context' end;
   332   in Context.the_proof context' end;
   332 
   333 
   333 fun activate_facts dep context =
   334 fun activate_facts dep context =
   334   let
   335   let
   335     val thy = Context.theory_of context;
   336     val thy = Context.theory_of context;
   336     val activate = activate_notes init_elem (Element.transfer_morphism o Context.theory_of);
   337     val activate = activate_notes init_elem (Element.transfer_morphism o Context.theory_of) thy;
   337   in roundup thy activate dep (get_idents context, context) |-> put_idents end;
   338   in roundup thy activate dep (get_idents context, context) |-> put_idents end;
   338 
   339 
   339 fun init name thy =
   340 fun init name thy =
   340   activate_all name thy init_elem (Element.transfer_morphism o Context.theory_of)
   341   activate_all name thy init_elem (Element.transfer_morphism o Context.theory_of)
   341     ([], Context.Proof (ProofContext.init thy)) |-> put_idents |> Context.proof_of;
   342     ([], Context.Proof (ProofContext.init thy)) |-> put_idents |> Context.proof_of;
   373 
   374 
   374 val get_registrations =
   375 val get_registrations =
   375   Registrations.get #> map (#1 #> apsnd op $>);
   376   Registrations.get #> map (#1 #> apsnd op $>);
   376 
   377 
   377 fun add_registration (name, (base_morph, export)) thy =
   378 fun add_registration (name, (base_morph, export)) thy =
   378   roundup thy (fn _ => fn (name', morph') =>
   379   roundup thy (fn (name', morph') => Registrations.map (cons ((name', (morph', export)), stamp ())))
   379     Registrations.map (cons ((name', (morph', export)), stamp ())))
       
   380     (name, base_morph) (get_idents (Context.Theory thy), thy) |> snd;
   380     (name, base_morph) (get_idents (Context.Theory thy), thy) |> snd;
   381     (* FIXME |-> put_global_idents ?*)
   381     (* FIXME |-> put_global_idents ?*)
   382 
   382 
   383 fun amend_registration morph (name, base_morph) thy =
   383 fun amend_registration morph (name, base_morph) thy =
   384   let
   384   let