equal
deleted
inserted
replaced
47 |> Thm.varifyT_global |
47 |> Thm.varifyT_global |
48 end; |
48 end; |
49 |
49 |
50 fun mk_free_ctr_equations fcT ctrs inject_thms distinct_thms thy = |
50 fun mk_free_ctr_equations fcT ctrs inject_thms distinct_thms thy = |
51 let |
51 let |
52 fun mk_fcT_eq (t, u) = Const (@{const_name HOL.equal}, fcT --> fcT --> HOLogic.boolT) $ t $ u; |
52 fun mk_fcT_eq (t, u) = Const (\<^const_name>\<open>HOL.equal\<close>, fcT --> fcT --> HOLogic.boolT) $ t $ u; |
53 fun true_eq tu = HOLogic.mk_eq (mk_fcT_eq tu, @{term True}); |
53 fun true_eq tu = HOLogic.mk_eq (mk_fcT_eq tu, \<^term>\<open>True\<close>); |
54 fun false_eq tu = HOLogic.mk_eq (mk_fcT_eq tu, @{term False}); |
54 fun false_eq tu = HOLogic.mk_eq (mk_fcT_eq tu, \<^term>\<open>False\<close>); |
55 |
55 |
56 val monomorphic_prop_of = Thm.prop_of o Thm.unvarify_global thy o Drule.zero_var_indexes; |
56 val monomorphic_prop_of = Thm.prop_of o Thm.unvarify_global thy o Drule.zero_var_indexes; |
57 |
57 |
58 fun massage_inject (tp $ (eqv $ (_ $ t $ u) $ rhs)) = tp $ (eqv $ mk_fcT_eq (t, u) $ rhs); |
58 fun massage_inject (tp $ (eqv $ (_ $ t $ u) $ rhs)) = tp $ (eqv $ mk_fcT_eq (t, u) $ rhs); |
59 fun massage_distinct (tp $ (_ $ (_ $ t $ u))) = [tp $ false_eq (t, u), tp $ false_eq (u, t)]; |
59 fun massage_distinct (tp $ (_ $ (_ $ t $ u))) = [tp $ false_eq (t, u), tp $ false_eq (u, t)]; |
88 fun add_def lthy = |
88 fun add_def lthy = |
89 let |
89 let |
90 fun mk_side const_name = |
90 fun mk_side const_name = |
91 Const (const_name, fcT --> fcT --> HOLogic.boolT) $ Free ("x", fcT) $ Free ("y", fcT); |
91 Const (const_name, fcT --> fcT --> HOLogic.boolT) $ Free ("x", fcT) $ Free ("y", fcT); |
92 val spec = |
92 val spec = |
93 mk_Trueprop_eq (mk_side @{const_name HOL.equal}, mk_side @{const_name HOL.eq}) |
93 mk_Trueprop_eq (mk_side \<^const_name>\<open>HOL.equal\<close>, mk_side \<^const_name>\<open>HOL.eq\<close>) |
94 |> Syntax.check_term lthy; |
94 |> Syntax.check_term lthy; |
95 val ((_, (_, raw_def)), lthy') = |
95 val ((_, (_, raw_def)), lthy') = |
96 Specification.definition NONE [] [] (Binding.empty_atts, spec) lthy; |
96 Specification.definition NONE [] [] (Binding.empty_atts, spec) lthy; |
97 val thy_ctxt = Proof_Context.init_global (Proof_Context.theory_of lthy'); |
97 val thy_ctxt = Proof_Context.init_global (Proof_Context.theory_of lthy'); |
98 val def = singleton (Proof_Context.export lthy' thy_ctxt) raw_def; |
98 val def = singleton (Proof_Context.export lthy' thy_ctxt) raw_def; |