equal
deleted
inserted
replaced
160 NONE => NONE |
160 NONE => NONE |
161 | SOME (i, k, j) => SOME (swap_params_conv ctxt k j (K (swap_prems_conv i)) ct)); |
161 | SOME (i, k, j) => SOME (swap_params_conv ctxt k j (K (swap_prems_conv i)) ct)); |
162 |
162 |
163 val rearrange_eqs_simproc = |
163 val rearrange_eqs_simproc = |
164 Simplifier.simproc_global Pure.thy "rearrange_eqs" ["Pure.all t"] |
164 Simplifier.simproc_global Pure.thy "rearrange_eqs" ["Pure.all t"] |
165 (fn ctxt => fn t => mk_swap_rrule ctxt (Thm.cterm_of (Proof_Context.theory_of ctxt) t)); |
165 (fn ctxt => fn t => mk_swap_rrule ctxt (Thm.global_cterm_of (Proof_Context.theory_of ctxt) t)); |
166 |
166 |
167 |
167 |
168 (* rotate k premises to the left by j, skipping over first j premises *) |
168 (* rotate k premises to the left by j, skipping over first j premises *) |
169 |
169 |
170 fun rotate_conv 0 j 0 = Conv.all_conv |
170 fun rotate_conv 0 j 0 = Conv.all_conv |
392 |
392 |
393 (* prep_inst *) |
393 (* prep_inst *) |
394 |
394 |
395 fun prep_inst ctxt align tune (tm, ts) = |
395 fun prep_inst ctxt align tune (tm, ts) = |
396 let |
396 let |
397 val cert = Thm.cterm_of (Proof_Context.theory_of ctxt); |
397 val cert = Thm.global_cterm_of (Proof_Context.theory_of ctxt); |
398 fun prep_var (x, SOME t) = |
398 fun prep_var (x, SOME t) = |
399 let |
399 let |
400 val cx = cert x; |
400 val cx = cert x; |
401 val xT = Thm.typ_of_cterm cx; |
401 val xT = Thm.typ_of_cterm cx; |
402 val ct = cert (tune t); |
402 val ct = cert (tune t); |
569 |
569 |
570 local |
570 local |
571 |
571 |
572 fun dest_env thy env = |
572 fun dest_env thy env = |
573 let |
573 let |
574 val cert = Thm.cterm_of thy; |
574 val cert = Thm.global_cterm_of thy; |
575 val certT = Thm.ctyp_of thy; |
575 val certT = Thm.global_ctyp_of thy; |
576 val pairs = Vartab.dest (Envir.term_env env); |
576 val pairs = Vartab.dest (Envir.term_env env); |
577 val types = Vartab.dest (Envir.type_env env); |
577 val types = Vartab.dest (Envir.type_env env); |
578 val ts = map (cert o Envir.norm_term env o #2 o #2) pairs; |
578 val ts = map (cert o Envir.norm_term env o #2 o #2) pairs; |
579 val xs = map2 (curry (cert o Var)) (map #1 pairs) (map Thm.typ_of_cterm ts); |
579 val xs = map2 (curry (cert o Var)) (map #1 pairs) (map Thm.typ_of_cterm ts); |
580 in (map (fn (xi, (S, T)) => (certT (TVar (xi, S)), certT T)) types, xs ~~ ts) end; |
580 in (map (fn (xi, (S, T)) => (certT (TVar (xi, S)), certT T)) types, xs ~~ ts) end; |
653 | goal_params _ _ = 0; |
653 | goal_params _ _ = 0; |
654 |
654 |
655 fun meta_spec_tac ctxt n (x, T) = SUBGOAL (fn (goal, i) => |
655 fun meta_spec_tac ctxt n (x, T) = SUBGOAL (fn (goal, i) => |
656 let |
656 let |
657 val thy = Proof_Context.theory_of ctxt; |
657 val thy = Proof_Context.theory_of ctxt; |
658 val cert = Thm.cterm_of thy; |
658 val cert = Thm.global_cterm_of thy; |
659 |
659 |
660 val v = Free (x, T); |
660 val v = Free (x, T); |
661 fun spec_rule prfx (xs, body) = |
661 fun spec_rule prfx (xs, body) = |
662 @{thm Pure.meta_spec} |
662 @{thm Pure.meta_spec} |
663 |> Thm.rename_params_rule ([Name.clean (Variable.revert_fixed ctxt x)], 1) |
663 |> Thm.rename_params_rule ([Name.clean (Variable.revert_fixed ctxt x)], 1) |