src/Pure/Isar/locale.ML
changeset 21393 c648e24fd7ee
parent 21370 d9dd7b4e5e69
child 21441 940ef3e85c5a
equal deleted inserted replaced
21392:e571e84cbe89 21393:c648e24fd7ee
  1769                    val (axs1, axs2) = chop (length ts) axs;
  1769                    val (axs1, axs2) = chop (length ts) axs;
  1770                  in (axs2, ((id, Assumed axs1), elems)) end)
  1770                  in (axs2, ((id, Assumed axs1), elems)) end)
  1771         |> snd;
  1771         |> snd;
  1772     val (ctxt, (_, facts)) = activate_facts true (K I)
  1772     val (ctxt, (_, facts)) = activate_facts true (K I)
  1773       (ProofContext.init pred_thy, axiomify predicate_axioms elemss');
  1773       (ProofContext.init pred_thy, axiomify predicate_axioms elemss');
  1774     val export = singleton (ProofContext.export_standard
  1774     val view_ctxt = Assumption.add_view thy_ctxt predicate_statement ctxt;
  1775         (Assumption.add_view thy_ctxt predicate_statement ctxt) thy_ctxt);
  1775     val export = singleton (ProofContext.export_standard view_ctxt thy_ctxt);
  1776     val facts' = facts |> map (fn (a, ths) => ((a, []), [(map export ths, [])]));
  1776     val facts' = facts |> map (fn (a, ths) => ((a, []), [(map export ths, [])]));
  1777     val elems' = maps #2 (filter (equal "" o #1 o #1) elemss');
  1777     val elems' = maps #2 (filter (equal "" o #1 o #1) elemss');
  1778     val elems'' = map_filter (fn (Fixes _) => NONE | e => SOME e) elems';
  1778     val elems'' = map_filter (fn (Fixes _) => NONE | e => SOME e) elems';
  1779     val axs' = map (Element.assume_witness pred_thy) stmt';
  1779     val axs' = map (Element.assume_witness pred_thy) stmt';
  1780     val ctxt' = ctxt |> ProofContext.theory (fn pred_thy => pred_thy
  1780     val loc_ctxt = pred_thy
  1781       |> PureThy.note_thmss_qualified "" bname facts' |> snd
  1781       |> PureThy.note_thmss_qualified "" bname facts' |> snd
  1782       |> declare_locale name
  1782       |> declare_locale name
  1783       |> put_locale name
  1783       |> put_locale name
  1784        {axiom = axs',
  1784        {axiom = axs',
  1785         import = import,
  1785         import = import,
  1786         elems = map (fn e => (e, stamp ())) elems'',
  1786         elems = map (fn e => (e, stamp ())) elems'',
  1787         params = params_of elemss' |> map (fn (x, SOME T) => ((x, T), the (Symtab.lookup syn x))),
  1787         params = params_of elemss' |> map (fn (x, SOME T) => ((x, T), the (Symtab.lookup syn x))),
  1788         lparams = map #1 (params_of' body_elemss),
  1788         lparams = map #1 (params_of' body_elemss),
  1789         term_syntax = [],
  1789         term_syntax = [],
  1790         regs = regs,
  1790         regs = regs,
  1791         intros = intros});
  1791         intros = intros}
  1792   in (name, ctxt') end;
  1792       |> init name;
       
  1793   in (name, loc_ctxt) end;
  1793 
  1794 
  1794 in
  1795 in
  1795 
  1796 
  1796 val add_locale = gen_add_locale read_context intern_expr;
  1797 val add_locale = gen_add_locale read_context intern_expr;
  1797 val add_locale_i = gen_add_locale cert_context (K I);
  1798 val add_locale_i = gen_add_locale cert_context (K I);