equal
deleted
inserted
replaced
104 fun inst_excluded_middle ctxt i_atom = |
104 fun inst_excluded_middle ctxt i_atom = |
105 let |
105 let |
106 val th = EXCLUDED_MIDDLE |
106 val th = EXCLUDED_MIDDLE |
107 val [vx] = Term.add_vars (Thm.prop_of th) [] |
107 val [vx] = Term.add_vars (Thm.prop_of th) [] |
108 in |
108 in |
109 infer_instantiate_vars ctxt [(vx, Thm.cterm_of ctxt i_atom)] th |
109 infer_instantiate_types ctxt [(vx, Thm.cterm_of ctxt i_atom)] th |
110 end |
110 end |
111 |
111 |
112 fun assume_inference ctxt type_enc concealed sym_tab atom = |
112 fun assume_inference ctxt type_enc concealed sym_tab atom = |
113 inst_excluded_middle ctxt |
113 inst_excluded_middle ctxt |
114 (singleton (hol_terms_of_metis ctxt type_enc concealed sym_tab) (Metis_Term.Fn atom)) |
114 (singleton (hol_terms_of_metis ctxt type_enc concealed sym_tab) (Metis_Term.Fn atom)) |
160 cat_lines ("subst_translations:" :: |
160 cat_lines ("subst_translations:" :: |
161 (substs' |> map (fn (x, y) => |
161 (substs' |> map (fn (x, y) => |
162 Syntax.string_of_term ctxt (Thm.term_of x) ^ " |-> " ^ |
162 Syntax.string_of_term ctxt (Thm.term_of x) ^ " |-> " ^ |
163 Syntax.string_of_term ctxt (Thm.term_of y))))) |
163 Syntax.string_of_term ctxt (Thm.term_of y))))) |
164 in |
164 in |
165 infer_instantiate_vars ctxt (map (apfst (dest_Var o Thm.term_of)) substs') i_th |
165 infer_instantiate_types ctxt (map (apfst (dest_Var o Thm.term_of)) substs') i_th |
166 end |
166 end |
167 handle THM (msg, _, _) => raise METIS_RECONSTRUCT ("inst_inference", msg) |
167 handle THM (msg, _, _) => raise METIS_RECONSTRUCT ("inst_inference", msg) |
168 | ERROR msg => raise METIS_RECONSTRUCT ("inst_inference", msg) |
168 | ERROR msg => raise METIS_RECONSTRUCT ("inst_inference", msg) |
169 |
169 |
170 (* INFERENCE RULE: RESOLVE *) |
170 (* INFERENCE RULE: RESOLVE *) |
306 fun refl_inference ctxt type_enc concealed sym_tab t = |
306 fun refl_inference ctxt type_enc concealed sym_tab t = |
307 let |
307 let |
308 val i_t = singleton (hol_terms_of_metis ctxt type_enc concealed sym_tab) t |
308 val i_t = singleton (hol_terms_of_metis ctxt type_enc concealed sym_tab) t |
309 val _ = trace_msg ctxt (fn () => " term: " ^ Syntax.string_of_term ctxt i_t) |
309 val _ = trace_msg ctxt (fn () => " term: " ^ Syntax.string_of_term ctxt i_t) |
310 val c_t = cterm_incr_types ctxt refl_idx i_t |
310 val c_t = cterm_incr_types ctxt refl_idx i_t |
311 in infer_instantiate_vars ctxt [(dest_Var (Thm.term_of refl_x), c_t)] REFL_THM end |
311 in infer_instantiate_types ctxt [(dest_Var (Thm.term_of refl_x), c_t)] REFL_THM end |
312 |
312 |
313 (* INFERENCE RULE: EQUALITY *) |
313 (* INFERENCE RULE: EQUALITY *) |
314 |
314 |
315 val subst_em = @{lemma "s = t ==> P s ==> ~ P t ==> False" by simp} |
315 val subst_em = @{lemma "s = t ==> P s ==> ~ P t ==> False" by simp} |
316 val ssubst_em = @{lemma "s = t ==> P t ==> ~ P s ==> False" by simp} |
316 val ssubst_em = @{lemma "s = t ==> P t ==> ~ P s ==> False" by simp} |
372 val _ = trace_msg ctxt (fn () => "subst' " ^ Display.string_of_thm ctxt subst') |
372 val _ = trace_msg ctxt (fn () => "subst' " ^ Display.string_of_thm ctxt subst') |
373 val eq_terms = |
373 val eq_terms = |
374 map (apply2 (Thm.cterm_of ctxt)) |
374 map (apply2 (Thm.cterm_of ctxt)) |
375 (ListPair.zip (Misc_Legacy.term_vars (Thm.prop_of subst'), [tm_abs, tm_subst, i_tm])) |
375 (ListPair.zip (Misc_Legacy.term_vars (Thm.prop_of subst'), [tm_abs, tm_subst, i_tm])) |
376 in |
376 in |
377 infer_instantiate_vars ctxt (map (apfst (dest_Var o Thm.term_of)) eq_terms) subst' |
377 infer_instantiate_types ctxt (map (apfst (dest_Var o Thm.term_of)) eq_terms) subst' |
378 end |
378 end |
379 |
379 |
380 val factor = Seq.hd o distinct_subgoals_tac |
380 val factor = Seq.hd o distinct_subgoals_tac |
381 |
381 |
382 fun one_step ctxt type_enc concealed sym_tab th_pairs p = |
382 fun one_step ctxt type_enc concealed sym_tab th_pairs p = |
518 |
518 |
519 val t_inst = |
519 val t_inst = |
520 [] |> try (unify_terms (prem, concl) #> map (apply2 (Thm.cterm_of ctxt))) |
520 [] |> try (unify_terms (prem, concl) #> map (apply2 (Thm.cterm_of ctxt))) |
521 |> the_default [] (* FIXME *) |
521 |> the_default [] (* FIXME *) |
522 in |
522 in |
523 infer_instantiate_vars ctxt (map (apfst (dest_Var o Thm.term_of)) t_inst) th |
523 infer_instantiate_types ctxt (map (apfst (dest_Var o Thm.term_of)) t_inst) th |
524 end |
524 end |
525 |
525 |
526 val copy_prem = @{lemma "P ==> (P ==> P ==> Q) ==> Q" by fast} |
526 val copy_prem = @{lemma "P ==> (P ==> P ==> Q) ==> Q" by fast} |
527 |
527 |
528 fun copy_prems_tac ctxt [] ns i = |
528 fun copy_prems_tac ctxt [] ns i = |