src/HOL/Tools/inductive_codegen.ML
changeset 29287 5b0bfd63b5da
parent 29270 0eade173f77e
child 30190 479806475f3c
equal deleted inserted replaced
29286:5de880bda02d 29287:5b0bfd63b5da
    55              eqns = eqns |> Symtab.map_default (s, [])
    55              eqns = eqns |> Symtab.map_default (s, [])
    56                (AList.update Thm.eq_thm_prop (thm, thyname_of s))} thy
    56                (AList.update Thm.eq_thm_prop (thm, thyname_of s))} thy
    57       | _ => (warn thm; thy))
    57       | _ => (warn thm; thy))
    58     | SOME (Const (s, _), _) =>
    58     | SOME (Const (s, _), _) =>
    59         let
    59         let
    60           val cs = foldr OldTerm.add_term_consts [] (prems_of thm);
    60           val cs = fold Term.add_const_names (Thm.prems_of thm) [];
    61           val rules = Symtab.lookup_list intros s;
    61           val rules = Symtab.lookup_list intros s;
    62           val nparms = (case optnparms of
    62           val nparms = (case optnparms of
    63             SOME k => k
    63             SOME k => k
    64           | NONE => (case rules of
    64           | NONE => (case rules of
    65              [] => (case try (InductivePackage.the_inductive (ProofContext.init thy)) s of
    65              [] => (case try (InductivePackage.the_inductive (ProofContext.init thy)) s of
   488     else (case get_clauses thy name of
   488     else (case get_clauses thy name of
   489         NONE => gr
   489         NONE => gr
   490       | SOME (names, thyname, nparms, intrs) =>
   490       | SOME (names, thyname, nparms, intrs) =>
   491           mk_ind_def thy defs gr dep names (if_library thyname module)
   491           mk_ind_def thy defs gr dep names (if_library thyname module)
   492             [] (prep_intrs intrs) nparms))
   492             [] (prep_intrs intrs) nparms))
   493             (gr, foldr OldTerm.add_term_consts [] ts)
   493             (gr, fold Term.add_const_names ts [])
   494 
   494 
   495 and mk_ind_def thy defs gr dep names module modecs intrs nparms =
   495 and mk_ind_def thy defs gr dep names module modecs intrs nparms =
   496   add_edge_acyclic (hd names, dep) gr handle
   496   add_edge_acyclic (hd names, dep) gr handle
   497     Graph.CYCLES (xs :: _) =>
   497     Graph.CYCLES (xs :: _) =>
   498       error ("InductiveCodegen: illegal cyclic dependencies:\n" ^ commas xs)
   498       error ("InductiveCodegen: illegal cyclic dependencies:\n" ^ commas xs)