src/Pure/Tools/rule_insts.ML
changeset 58950 d07464875dd4
parent 58027 dc58ab4d9f44
child 58956 a816aa3ff391
equal deleted inserted replaced
58949:e9559088ba29 58950:d07464875dd4
    22     (binding * string option * mixfix) list -> thm -> thm
    22     (binding * string option * mixfix) list -> thm -> thm
    23   val of_rule: Proof.context -> string option list * string option list ->
    23   val of_rule: Proof.context -> string option list * string option list ->
    24     (binding * string option * mixfix) list -> thm -> thm
    24     (binding * string option * mixfix) list -> thm -> thm
    25   val read_instantiate: Proof.context -> (indexname * string) list -> string list -> thm -> thm
    25   val read_instantiate: Proof.context -> (indexname * string) list -> string list -> thm -> thm
    26   val instantiate_tac: Proof.context -> (indexname * string) list -> string list -> tactic
    26   val instantiate_tac: Proof.context -> (indexname * string) list -> string list -> tactic
    27   val make_elim_preserve: thm -> thm
    27   val make_elim_preserve: Proof.context -> thm -> thm
    28   val method: (Proof.context -> (indexname * string) list -> thm -> int -> tactic) ->
    28   val method: (Proof.context -> (indexname * string) list -> thm -> int -> tactic) ->
    29     (Proof.context -> thm list -> int -> tactic) -> (Proof.context -> Proof.method) context_parser
    29     (Proof.context -> thm list -> int -> tactic) -> (Proof.context -> Proof.method) context_parser
    30 end;
    30 end;
    31 
    31 
    32 structure Rule_Insts: RULE_INSTS =
    32 structure Rule_Insts: RULE_INSTS =
   278 val eres_inst_tac = bires_inst_tac true;
   278 val eres_inst_tac = bires_inst_tac true;
   279 
   279 
   280 
   280 
   281 (* forward resolution *)
   281 (* forward resolution *)
   282 
   282 
   283 fun make_elim_preserve rl =
   283 fun make_elim_preserve ctxt rl =
   284   let
   284   let
   285     val cert = Thm.cterm_of (Thm.theory_of_thm rl);
   285     val cert = Thm.cterm_of (Thm.theory_of_thm rl);
   286     val maxidx = Thm.maxidx_of rl;
   286     val maxidx = Thm.maxidx_of rl;
   287     fun cvar xi = cert (Var (xi, propT));
   287     fun cvar xi = cert (Var (xi, propT));
   288     val revcut_rl' =
   288     val revcut_rl' =
   289       Drule.instantiate_normalize ([], [(cvar ("V", 0), cvar ("V", maxidx + 1)),
   289       Drule.instantiate_normalize ([], [(cvar ("V", 0), cvar ("V", maxidx + 1)),
   290         (cvar ("W", 0), cvar ("W", maxidx + 1))]) Drule.revcut_rl;
   290         (cvar ("W", 0), cvar ("W", maxidx + 1))]) Drule.revcut_rl;
   291   in
   291   in
   292     (case Seq.list_of
   292     (case Seq.list_of
   293       (Thm.bicompose {flatten = true, match = false, incremented = false}
   293       (Thm.bicompose (SOME ctxt) {flatten = true, match = false, incremented = false}
   294         (false, rl, Thm.nprems_of rl) 1 revcut_rl')
   294         (false, rl, Thm.nprems_of rl) 1 revcut_rl')
   295      of
   295      of
   296       [th] => th
   296       [th] => th
   297     | _ => raise THM ("make_elim_preserve", 1, [rl]))
   297     | _ => raise THM ("make_elim_preserve", 1, [rl]))
   298   end;
   298   end;
   299 
   299 
   300 (*instantiate and cut -- for atomic fact*)
   300 (*instantiate and cut -- for atomic fact*)
   301 fun cut_inst_tac ctxt insts rule = res_inst_tac ctxt insts (make_elim_preserve rule);
   301 fun cut_inst_tac ctxt insts rule = res_inst_tac ctxt insts (make_elim_preserve ctxt rule);
   302 
   302 
   303 (*forward tactic applies a rule to an assumption without deleting it*)
   303 (*forward tactic applies a rule to an assumption without deleting it*)
   304 fun forw_inst_tac ctxt insts rule = cut_inst_tac ctxt insts rule THEN' assume_tac;
   304 fun forw_inst_tac ctxt insts rule = cut_inst_tac ctxt insts rule THEN' assume_tac;
   305 
   305 
   306 (*dresolve tactic applies a rule to replace an assumption*)
   306 (*dresolve tactic applies a rule to replace an assumption*)
   307 fun dres_inst_tac ctxt insts rule = eres_inst_tac ctxt insts (make_elim_preserve rule);
   307 fun dres_inst_tac ctxt insts rule = eres_inst_tac ctxt insts (make_elim_preserve ctxt rule);
   308 
   308 
   309 
   309 
   310 (* derived tactics *)
   310 (* derived tactics *)
   311 
   311 
   312 (*deletion of an assumption*)
   312 (*deletion of an assumption*)