2156 (list_comb (Const (name, T), args)))) |
2156 (list_comb (Const (name, T), args)))) |
2157 val lhs = Const (mode_cname, funT) |
2157 val lhs = Const (mode_cname, funT) |
2158 val def = Logic.mk_equals (lhs, predterm) |
2158 val def = Logic.mk_equals (lhs, predterm) |
2159 val ([definition], thy') = thy |> |
2159 val ([definition], thy') = thy |> |
2160 Sign.add_consts_i [(Binding.name mode_cbasename, funT, NoSyn)] |> |
2160 Sign.add_consts_i [(Binding.name mode_cbasename, funT, NoSyn)] |> |
2161 PureThy.add_defs false [((Binding.name (mode_cbasename ^ "_def"), def), [])] |
2161 Global_Theory.add_defs false [((Binding.name (mode_cbasename ^ "_def"), def), [])] |
2162 val ctxt' = ProofContext.init_global thy' |
2162 val ctxt' = ProofContext.init_global thy' |
2163 val rules as ((intro, elim), _) = |
2163 val rules as ((intro, elim), _) = |
2164 create_intro_elim_rule ctxt' mode definition mode_cname funT (Const (name, T)) |
2164 create_intro_elim_rule ctxt' mode definition mode_cname funT (Const (name, T)) |
2165 in thy' |
2165 in thy' |
2166 |> set_function_name Pred name mode mode_cname |
2166 |> set_function_name Pred name mode mode_cname |
2167 |> add_predfun_data name mode (definition, rules) |
2167 |> add_predfun_data name mode (definition, rules) |
2168 |> PureThy.store_thm (Binding.name (mode_cbasename ^ "I"), intro) |> snd |
2168 |> Global_Theory.store_thm (Binding.name (mode_cbasename ^ "I"), intro) |> snd |
2169 |> PureThy.store_thm (Binding.name (mode_cbasename ^ "E"), elim) |> snd |
2169 |> Global_Theory.store_thm (Binding.name (mode_cbasename ^ "E"), elim) |> snd |
2170 |> Theory.checkpoint |
2170 |> Theory.checkpoint |
2171 end; |
2171 end; |
2172 in |
2172 in |
2173 thy |> defined_function_of Pred name |> fold create_definition modes |
2173 thy |> defined_function_of Pred name |> fold create_definition modes |
2174 end; |
2174 end; |
2881 val qname = #qname (dest_steps steps) |
2881 val qname = #qname (dest_steps steps) |
2882 val attrib = fn thy => Attrib.attribute_i thy (Attrib.internal (K (Thm.declaration_attribute |
2882 val attrib = fn thy => Attrib.attribute_i thy (Attrib.internal (K (Thm.declaration_attribute |
2883 (fn thm => Context.mapping (Code.add_eqn thm) I)))) |
2883 (fn thm => Context.mapping (Code.add_eqn thm) I)))) |
2884 val thy''' = |
2884 val thy''' = |
2885 Output.cond_timeit (!Quickcheck.timing) "Setting code equations...." (fn _ => |
2885 Output.cond_timeit (!Quickcheck.timing) "Setting code equations...." (fn _ => |
2886 fold (fn (name, result_thms) => fn thy => snd (PureThy.add_thmss |
2886 fold (fn (name, result_thms) => fn thy => snd (Global_Theory.add_thmss |
2887 [((Binding.qualify true (Long_Name.base_name name) (Binding.name qname), result_thms), |
2887 [((Binding.qualify true (Long_Name.base_name name) (Binding.name qname), result_thms), |
2888 [attrib thy ])] thy)) |
2888 [attrib thy ])] thy)) |
2889 result_thms' thy'' |> Theory.checkpoint) |
2889 result_thms' thy'' |> Theory.checkpoint) |
2890 in |
2890 in |
2891 thy''' |
2891 thy''' |