equal
deleted
inserted
replaced
145 |
145 |
146 fun inst_params thy (vs, p) th cts = |
146 fun inst_params thy (vs, p) th cts = |
147 let val env = Pattern.first_order_match thy (p, Thm.prop_of th) |
147 let val env = Pattern.first_order_match thy (p, Thm.prop_of th) |
148 (Vartab.empty, Vartab.empty) |
148 (Vartab.empty, Vartab.empty) |
149 in Thm.instantiate ([], |
149 in Thm.instantiate ([], |
150 map (Envir.subst_term env #> Thm.cterm_of thy) vs ~~ cts) th |
150 map (Envir.subst_term env #> Thm.global_cterm_of thy) vs ~~ cts) th |
151 end; |
151 end; |
152 |
152 |
153 fun prove_strong_ind s alt_name avoids ctxt = |
153 fun prove_strong_ind s alt_name avoids ctxt = |
154 let |
154 let |
155 val thy = Proof_Context.theory_of ctxt; |
155 val thy = Proof_Context.theory_of ctxt; |
228 val (fs_ctxt_tyname, _) = Name.variant "'n" (Variable.names_of ctxt'); |
228 val (fs_ctxt_tyname, _) = Name.variant "'n" (Variable.names_of ctxt'); |
229 val ([fs_ctxt_name], ctxt'') = Variable.variant_fixes ["z"] ctxt'; |
229 val ([fs_ctxt_name], ctxt'') = Variable.variant_fixes ["z"] ctxt'; |
230 val fsT = TFree (fs_ctxt_tyname, ind_sort); |
230 val fsT = TFree (fs_ctxt_tyname, ind_sort); |
231 |
231 |
232 val inductive_forall_def' = Drule.instantiate' |
232 val inductive_forall_def' = Drule.instantiate' |
233 [SOME (Thm.ctyp_of thy fsT)] [] inductive_forall_def; |
233 [SOME (Thm.global_ctyp_of thy fsT)] [] inductive_forall_def; |
234 |
234 |
235 fun lift_pred' t (Free (s, T)) ts = |
235 fun lift_pred' t (Free (s, T)) ts = |
236 list_comb (Free (s, fsT --> T), t :: ts); |
236 list_comb (Free (s, fsT --> T), t :: ts); |
237 val lift_pred = lift_pred' (Bound 0); |
237 val lift_pred = lift_pred' (Bound 0); |
238 |
238 |
317 val atom = fst (dest_Type T); |
317 val atom = fst (dest_Type T); |
318 val {at_inst, ...} = NominalAtoms.the_atom_info thy atom; |
318 val {at_inst, ...} = NominalAtoms.the_atom_info thy atom; |
319 val fs_atom = Global_Theory.get_thm thy |
319 val fs_atom = Global_Theory.get_thm thy |
320 ("fs_" ^ Long_Name.base_name atom ^ "1"); |
320 ("fs_" ^ Long_Name.base_name atom ^ "1"); |
321 val avoid_th = Drule.instantiate' |
321 val avoid_th = Drule.instantiate' |
322 [SOME (Thm.ctyp_of thy (fastype_of p))] [SOME (Thm.cterm_of thy p)] |
322 [SOME (Thm.global_ctyp_of thy (fastype_of p))] [SOME (Thm.global_cterm_of thy p)] |
323 ([at_inst, fin, fs_atom] MRS @{thm at_set_avoiding}); |
323 ([at_inst, fin, fs_atom] MRS @{thm at_set_avoiding}); |
324 val (([(_, cx)], th1 :: th2 :: ths), ctxt') = Obtain.result |
324 val (([(_, cx)], th1 :: th2 :: ths), ctxt') = Obtain.result |
325 (fn ctxt' => EVERY |
325 (fn ctxt' => EVERY |
326 [rtac avoid_th 1, |
326 [rtac avoid_th 1, |
327 full_simp_tac (put_simpset HOL_ss ctxt' addsimps [@{thm fresh_star_prod_set}]) 1, |
327 full_simp_tac (put_simpset HOL_ss ctxt' addsimps [@{thm fresh_star_prod_set}]) 1, |
397 else pi2 |
397 else pi2 |
398 end; |
398 end; |
399 val pis'' = fold_rev (concat_perm #> map) pis' pis; |
399 val pis'' = fold_rev (concat_perm #> map) pis' pis; |
400 val ihyp' = inst_params thy vs_ihypt ihyp |
400 val ihyp' = inst_params thy vs_ihypt ihyp |
401 (map (fold_rev (NominalDatatype.mk_perm []) |
401 (map (fold_rev (NominalDatatype.mk_perm []) |
402 (pis' @ pis) #> Thm.cterm_of thy) params' @ [Thm.cterm_of thy z]); |
402 (pis' @ pis) #> Thm.global_cterm_of thy) params' @ [Thm.global_cterm_of thy z]); |
403 fun mk_pi th = |
403 fun mk_pi th = |
404 Simplifier.simplify (put_simpset HOL_basic_ss ctxt' addsimps [@{thm id_apply}] |
404 Simplifier.simplify (put_simpset HOL_basic_ss ctxt' addsimps [@{thm id_apply}] |
405 addsimprocs [NominalDatatype.perm_simproc]) |
405 addsimprocs [NominalDatatype.perm_simproc]) |
406 (Simplifier.simplify (put_simpset eqvt_ss ctxt') |
406 (Simplifier.simplify (put_simpset eqvt_ss ctxt') |
407 (fold_rev (mk_perm_bool o Thm.cterm_of thy) |
407 (fold_rev (mk_perm_bool o Thm.global_cterm_of thy) |
408 (pis' @ pis) th)); |
408 (pis' @ pis) th)); |
409 val gprems2 = map (fn (th, t) => |
409 val gprems2 = map (fn (th, t) => |
410 if null (preds_of ps t) then mk_pi th |
410 if null (preds_of ps t) then mk_pi th |
411 else |
411 else |
412 mk_pi (the (map_thm ctxt' (inst_conj_all names ps (rev pis'')) |
412 mk_pi (the (map_thm ctxt' (inst_conj_all names ps (rev pis'')) |