149 lthy') |
149 lthy') |
150 end |
150 end |
151 |
151 |
152 fun in_context ctxt (f, pre_qs, pre_gs, pre_args, pre_rhs) F = |
152 fun in_context ctxt (f, pre_qs, pre_gs, pre_args, pre_rhs) F = |
153 let |
153 let |
154 val thy = ProofContext.theory_of ctxt |
154 val thy = Proof_Context.theory_of ctxt |
155 |
155 |
156 val oqnames = map fst pre_qs |
156 val oqnames = map fst pre_qs |
157 val (qs, _) = Variable.variant_fixes oqnames ctxt |
157 val (qs, _) = Variable.variant_fixes oqnames ctxt |
158 |>> map2 (fn (_, T) => fn n => Free (n, T)) pre_qs |
158 |>> map2 (fn (_, T) => fn n => Free (n, T)) pre_qs |
159 |
159 |
196 |> export |
196 |> export |
197 end |
197 end |
198 |
198 |
199 fun mk_applied_form ctxt caTs thm = |
199 fun mk_applied_form ctxt caTs thm = |
200 let |
200 let |
201 val thy = ProofContext.theory_of ctxt |
201 val thy = Proof_Context.theory_of ctxt |
202 val xs = map_index (fn (i,T) => cterm_of thy (Free ("x" ^ string_of_int i, T))) caTs (* FIXME: Bind xs properly *) |
202 val xs = map_index (fn (i,T) => cterm_of thy (Free ("x" ^ string_of_int i, T))) caTs (* FIXME: Bind xs properly *) |
203 in |
203 in |
204 fold (fn x => fn thm => Thm.combination thm (Thm.reflexive x)) xs thm |
204 fold (fn x => fn thm => Thm.combination thm (Thm.reflexive x)) xs thm |
205 |> Conv.fconv_rule (Thm.beta_conversion true) |
205 |> Conv.fconv_rule (Thm.beta_conversion true) |
206 |> fold_rev Thm.forall_intr xs |
206 |> fold_rev Thm.forall_intr xs |
207 |> Thm.forall_elim_vars 0 |
207 |> Thm.forall_elim_vars 0 |
208 end |
208 end |
209 |
209 |
210 fun mutual_induct_rules lthy induct all_f_defs (Mutual {n, ST, parts, ...}) = |
210 fun mutual_induct_rules lthy induct all_f_defs (Mutual {n, ST, parts, ...}) = |
211 let |
211 let |
212 val cert = cterm_of (ProofContext.theory_of lthy) |
212 val cert = cterm_of (Proof_Context.theory_of lthy) |
213 val newPs = |
213 val newPs = |
214 map2 (fn Pname => fn MutualPart {cargTs, ...} => |
214 map2 (fn Pname => fn MutualPart {cargTs, ...} => |
215 Free (Pname, cargTs ---> HOLogic.boolT)) |
215 Free (Pname, cargTs ---> HOLogic.boolT)) |
216 (mutual_induct_Pnames (length parts)) parts |
216 (mutual_induct_Pnames (length parts)) parts |
217 |
217 |