95 fun occs_var x = Library.get_first (fn t => |
95 fun occs_var x = Library.get_first (fn t => |
96 ProofContext.find_free t (ProofContext.get_skolem fix_ctxt x)) asm_props; |
96 ProofContext.find_free t (ProofContext.get_skolem fix_ctxt x)) asm_props; |
97 val raw_parms = map occs_var xs; |
97 val raw_parms = map occs_var xs; |
98 val parms = mapfilter I raw_parms; |
98 val parms = mapfilter I raw_parms; |
99 val parm_names = |
99 val parm_names = |
100 mapfilter (fn (Some (Free a), x) => Some (a, x) | _ => None) (raw_parms ~~ xs); |
100 mapfilter (fn (SOME (Free a), x) => SOME (a, x) | _ => NONE) (raw_parms ~~ xs); |
101 |
101 |
102 val that_prop = |
102 val that_prop = |
103 Term.list_all_free (map #1 parm_names, Logic.list_implies (asm_props, bound_thesis)) |
103 Term.list_all_free (map #1 parm_names, Logic.list_implies (asm_props, bound_thesis)) |
104 |> Library.curry Logic.list_rename_params (map #2 parm_names); |
104 |> Library.curry Logic.list_rename_params (map #2 parm_names); |
105 val obtain_prop = |
105 val obtain_prop = |
106 Logic.list_rename_params ([AutoBind.thesisN], |
106 Logic.list_rename_params ([AutoBind.thesisN], |
107 Term.list_all_free ([bound_thesis_var], Logic.mk_implies (that_prop, bound_thesis))); |
107 Term.list_all_free ([bound_thesis_var], Logic.mk_implies (that_prop, bound_thesis))); |
108 |
108 |
109 fun after_qed st = st |
109 fun after_qed st = st |
110 |> Method.local_qed false None print |
110 |> Method.local_qed false NONE print |
111 |> Seq.map (fn st' => st' |
111 |> Seq.map (fn st' => st' |
112 |> Proof.fix_i vars |
112 |> Proof.fix_i vars |
113 |> Proof.assm_i (export_obtain state parms (Proof.the_fact st')) asms); |
113 |> Proof.assm_i (export_obtain state parms (Proof.the_fact st')) asms); |
114 in |
114 in |
115 state |
115 state |
116 |> Proof.enter_forward |
116 |> Proof.enter_forward |
117 |> Proof.have_i Seq.single true [(("", []), [(obtain_prop, ([], []))])] |
117 |> Proof.have_i Seq.single true [(("", []), [(obtain_prop, ([], []))])] |
118 |> Method.proof (Some (Method.Basic (K Method.succeed))) |> Seq.hd |
118 |> Method.proof (SOME (Method.Basic (K Method.succeed))) |> Seq.hd |
119 |> Proof.fix_i [([thesisN], None)] |
119 |> Proof.fix_i [([thesisN], NONE)] |
120 |> Proof.assume_i [((thatN, [ContextRules.intro_query_local None]), [(that_prop, ([], []))])] |
120 |> Proof.assume_i [((thatN, [ContextRules.intro_query_local NONE]), [(that_prop, ([], []))])] |
121 |> (fn state' => |
121 |> (fn state' => |
122 state' |
122 state' |
123 |> Proof.from_facts chain_facts |
123 |> Proof.from_facts chain_facts |
124 |> Proof.show_i (K I) after_qed false [(("", []), [(bound_thesis, ([], []))])] false |
124 |> Proof.show_i (K I) after_qed false [(("", []), [(bound_thesis, ([], []))])] false |
125 |> Method.refine (Method.Basic (K (Method.insert (Proof.the_facts state'))))) |
125 |> Method.refine (Method.Basic (K (Method.insert (Proof.the_facts state'))))) |