src/HOL/Tools/BNF/bnf_tactics.ML
changeset 64413 c0d5e78eb647
parent 63399 d1742d1b7f0f
child 64629 a331208010b6
equal deleted inserted replaced
64412:2ed3da32bf41 64413:c0d5e78eb647
    15   val subst_asm_tac: Proof.context -> int list option -> thm list -> int -> tactic
    15   val subst_asm_tac: Proof.context -> int list option -> thm list -> int -> tactic
    16 
    16 
    17   val mk_rotate_eq_tac: Proof.context -> (int -> tactic) -> thm -> thm -> thm -> thm -> ''a list ->
    17   val mk_rotate_eq_tac: Proof.context -> (int -> tactic) -> thm -> thm -> thm -> thm -> ''a list ->
    18     ''a list -> int -> tactic
    18     ''a list -> int -> tactic
    19 
    19 
    20   val mk_pointfree: Proof.context -> thm -> thm
    20   val mk_pointfree2: Proof.context -> thm -> thm
    21 
    21 
    22   val mk_Abs_bij_thm: Proof.context -> thm -> thm -> thm
    22   val mk_Abs_bij_thm: Proof.context -> thm -> thm -> thm
    23   val mk_Abs_inj_thm: thm -> thm
    23   val mk_Abs_inj_thm: thm -> thm
    24 
    24 
    25   val mk_map_comp_id_tac: Proof.context -> thm -> tactic
    25   val mk_map_comp_id_tac: Proof.context -> thm -> tactic
    45 
    45 
    46 (*unlike "unfold_thms_tac", it succeed when the RHS contains schematic variables not in the LHS*)
    46 (*unlike "unfold_thms_tac", it succeed when the RHS contains schematic variables not in the LHS*)
    47 fun subst_tac ctxt = EqSubst.eqsubst_tac ctxt o the_default [0];
    47 fun subst_tac ctxt = EqSubst.eqsubst_tac ctxt o the_default [0];
    48 fun subst_asm_tac ctxt = EqSubst.eqsubst_asm_tac ctxt o the_default [0];
    48 fun subst_asm_tac ctxt = EqSubst.eqsubst_asm_tac ctxt o the_default [0];
    49 
    49 
    50 
       
    51 (*transforms f (g x) = h (k x) into f o g = h o k using first order matches for f, g, h, and k*)
    50 (*transforms f (g x) = h (k x) into f o g = h o k using first order matches for f, g, h, and k*)
    52 fun mk_pointfree ctxt thm = thm
    51 fun mk_pointfree2 ctxt thm = thm
    53   |> Thm.prop_of |> HOLogic.dest_Trueprop |> HOLogic.dest_eq
    52   |> Thm.prop_of |> HOLogic.dest_Trueprop |> HOLogic.dest_eq
    54   |> apply2 (dest_comb #> apsnd (dest_comb #> fst) #> HOLogic.mk_comp)
    53   |> apply2 (dest_comb #> apsnd (dest_comb #> fst) #> HOLogic.mk_comp)
    55   |> mk_Trueprop_eq
    54   |> mk_Trueprop_eq
    56   |> (fn goal => Goal.prove_sorry ctxt [] [] goal
    55   |> (fn goal => Goal.prove_sorry ctxt [] [] goal
    57     (K (rtac ctxt @{thm ext} 1 THEN
    56     (K (rtac ctxt ext 1 THEN
    58         unfold_thms_tac ctxt ([o_apply, unfold_thms ctxt [o_apply] (mk_sym thm)]) THEN
    57         unfold_thms_tac ctxt ([o_apply, unfold_thms ctxt [o_apply] (mk_sym thm)]) THEN
    59         rtac ctxt refl 1)))
    58         rtac ctxt refl 1)))
    60   |> Thm.close_derivation;
    59   |> Thm.close_derivation;
    61 
    60 
    62 
    61 
    63 (* Theorems for open typedefs with UNIV as representing set *)
    62 (* Theorems for open typedefs with UNIV as representing set *)
    64 
    63 
    65 fun mk_Abs_inj_thm inj = inj OF (replicate 2 @{thm UNIV_I});
    64 fun mk_Abs_inj_thm inj = inj OF (replicate 2 @{thm UNIV_I});
    66 fun mk_Abs_bij_thm ctxt Abs_inj_thm surj = rule_by_tactic ctxt ((rtac ctxt surj THEN' etac ctxt exI) 1)
    65 fun mk_Abs_bij_thm ctxt Abs_inj_thm surj = rule_by_tactic ctxt ((rtac ctxt surj THEN' etac ctxt exI) 1)
    67   (Abs_inj_thm RS @{thm bijI'});
    66   (Abs_inj_thm RS @{thm bijI'});
    68 
       
    69 
    67 
    70 
    68 
    71 (* General tactic generators *)
    69 (* General tactic generators *)
    72 
    70 
    73 (*applies assoc rule to the lhs of an equation as long as possible*)
    71 (*applies assoc rule to the lhs of an equation as long as possible*)