equal
deleted
inserted
replaced
64 val cs = fold Term.add_const_names (Thm.prems_of thm) []; |
64 val cs = fold Term.add_const_names (Thm.prems_of thm) []; |
65 val rules = Symtab.lookup_list intros s; |
65 val rules = Symtab.lookup_list intros s; |
66 val nparms = (case optnparms of |
66 val nparms = (case optnparms of |
67 SOME k => k |
67 SOME k => k |
68 | NONE => (case rules of |
68 | NONE => (case rules of |
69 [] => (case try (Inductive.the_inductive (ProofContext.init thy)) s of |
69 [] => (case try (Inductive.the_inductive (ProofContext.init_global thy)) s of |
70 SOME (_, {raw_induct, ...}) => |
70 SOME (_, {raw_induct, ...}) => |
71 length (Inductive.params_of raw_induct) |
71 length (Inductive.params_of raw_induct) |
72 | NONE => 0) |
72 | NONE => 0) |
73 | xs => snd (snd (snd (split_last xs))))) |
73 | xs => snd (snd (snd (split_last xs))))) |
74 in CodegenData.put |
74 in CodegenData.put |
82 end) I); |
82 end) I); |
83 |
83 |
84 fun get_clauses thy s = |
84 fun get_clauses thy s = |
85 let val {intros, graph, ...} = CodegenData.get thy |
85 let val {intros, graph, ...} = CodegenData.get thy |
86 in case Symtab.lookup intros s of |
86 in case Symtab.lookup intros s of |
87 NONE => (case try (Inductive.the_inductive (ProofContext.init thy)) s of |
87 NONE => (case try (Inductive.the_inductive (ProofContext.init_global thy)) s of |
88 NONE => NONE |
88 NONE => NONE |
89 | SOME ({names, ...}, {intrs, raw_induct, ...}) => |
89 | SOME ({names, ...}, {intrs, raw_induct, ...}) => |
90 SOME (names, Codegen.thyname_of_const thy s, |
90 SOME (names, Codegen.thyname_of_const thy s, |
91 length (Inductive.params_of raw_induct), |
91 length (Inductive.params_of raw_induct), |
92 preprocess thy intrs)) |
92 preprocess thy intrs)) |