src/Pure/Thy/thy_parse.ML
changeset 1555 a5f48457dfd5
parent 1539 f21c8fab7c3c
child 1705 19fe0ab646b4
equal deleted inserted replaced
1554:4ee99a973be4 1555:a5f48457dfd5
   349 fun mk_axiom_decls axms = (mk_axms axms, map fst axms);
   349 fun mk_axiom_decls axms = (mk_axms axms, map fst axms);
   350 
   350 
   351 val axiom_decls = repeat1 (ident -- !! string) >> mk_axiom_decls;
   351 val axiom_decls = repeat1 (ident -- !! string) >> mk_axiom_decls;
   352 
   352 
   353 
   353 
       
   354 (* combined consts and axioms *)
       
   355 
       
   356 fun mk_constaxiom_decls x =
       
   357   let
       
   358     val (axms_defs, axms_names) =
       
   359       mk_axiom_decls (map (fn ((id, _), def) => (id ^ "_def", def)) x);
       
   360   in ((mk_big_list o map mk_triple2 o map (apfst quote o fst)) x ^
       
   361        "\n\n|> add_defs\n" ^ axms_defs, axms_names)
       
   362   end;
       
   363 
       
   364 val constaxiom_decls =
       
   365   repeat1 (ident --$$ "::" -- !!
       
   366            ((string || const_type false >> quote) -- opt_mixfix) -- !!
       
   367            string) >> mk_constaxiom_decls;
       
   368 
       
   369 
   354 (* axclass *)
   370 (* axclass *)
   355 
   371 
   356 fun mk_axclass_decl ((c, cs), axms) =
   372 fun mk_axclass_decl ((c, cs), axms) =
   357   (mk_pair (c, cs) ^ "\n" ^ mk_axms axms,
   373   (mk_pair (c, cs) ^ "\n" ^ mk_axms axms,
   358     (strip_quotes c ^ "I") :: map fst axms);
   374     (strip_quotes c ^ "I") :: map fst axms);
   514   section "translations" "|> add_trrules" trans_decls,
   530   section "translations" "|> add_trrules" trans_decls,
   515   section "MLtrans" "|> add_trfuns" mltrans,
   531   section "MLtrans" "|> add_trfuns" mltrans,
   516   section "MLtext" "" verbatim,
   532   section "MLtext" "" verbatim,
   517   axm_section "rules" "|> add_axioms" axiom_decls,
   533   axm_section "rules" "|> add_axioms" axiom_decls,
   518   axm_section "defs" "|> add_defs" axiom_decls,
   534   axm_section "defs" "|> add_defs" axiom_decls,
       
   535   axm_section "constdefs" "|> add_consts" constaxiom_decls,
   519   axm_section "axclass" "|> AxClass.add_axclass" axclass_decl,
   536   axm_section "axclass" "|> AxClass.add_axclass" axclass_decl,
   520   section "instance" "" instance_decl];
   537   section "instance" "" instance_decl];
   521 
   538 
   522 end;
   539 end;