168 |
168 |
169 val rsp_rel = Quotient_Term.equiv_relation lthy (fastype_of rhs, lhs_ty) |
169 val rsp_rel = Quotient_Term.equiv_relation lthy (fastype_of rhs, lhs_ty) |
170 val internal_rsp_tm = HOLogic.mk_Trueprop (Syntax.check_term lthy (rsp_rel $ rhs $ rhs)) |
170 val internal_rsp_tm = HOLogic.mk_Trueprop (Syntax.check_term lthy (rsp_rel $ rhs $ rhs)) |
171 val readable_rsp_thm_eq = mk_readable_rsp_thm_eq internal_rsp_tm lthy |
171 val readable_rsp_thm_eq = mk_readable_rsp_thm_eq internal_rsp_tm lthy |
172 val maybe_proven_rsp_thm = try_to_prove_refl readable_rsp_thm_eq |
172 val maybe_proven_rsp_thm = try_to_prove_refl readable_rsp_thm_eq |
173 val readable_rsp_tm = #1 (Logic.dest_implies (Thm.prop_of readable_rsp_thm_eq)) |
|
174 |
173 |
175 fun after_qed thm_list lthy = |
174 fun after_qed thm_list lthy = |
176 let |
175 let |
177 val internal_rsp_thm = |
176 val internal_rsp_thm = |
178 (case thm_list of |
177 (case thm_list of |
179 [] => the maybe_proven_rsp_thm |
178 [] => the maybe_proven_rsp_thm |
180 | [[thm]] => Goal.prove ctxt [] [] internal_rsp_tm |
179 | [[thm]] => Goal.prove ctxt [] [] internal_rsp_tm |
181 (fn _ => |
180 (fn _ => |
182 resolve_tac ctxt [readable_rsp_thm_eq] 1 THEN |
181 resolve_tac ctxt [readable_rsp_thm_eq] 1 THEN |
183 Proof_Context.fact_tac ctxt [thm] 1)) |
182 Proof_Context.fact_tac ctxt [thm] 1)) |
184 in |
183 in snd (add_quotient_def ((var, attr), (lhs, rhs)) internal_rsp_thm lthy) end |
185 snd (add_quotient_def ((var, attr), (lhs, rhs)) internal_rsp_thm lthy) |
184 val goal = |
186 end |
185 if is_some maybe_proven_rsp_thm then [] |
187 in |
186 else [[(#1 (Logic.dest_implies (Thm.prop_of readable_rsp_thm_eq)), [])]] |
188 (case maybe_proven_rsp_thm of |
187 in Proof.theorem NONE after_qed goal lthy end |
189 SOME _ => Proof.theorem NONE after_qed [] lthy |
|
190 | NONE => Proof.theorem NONE after_qed [[(readable_rsp_tm, [])]] lthy) |
|
191 end |
|
192 |
188 |
193 val quotient_def = gen_quotient_def Proof_Context.cert_var (K I) |
189 val quotient_def = gen_quotient_def Proof_Context.cert_var (K I) |
194 val quotient_def_cmd = gen_quotient_def Proof_Context.read_var Syntax.parse_term |
190 val quotient_def_cmd = gen_quotient_def Proof_Context.read_var Syntax.parse_term |
195 |
191 |
196 |
192 |