src/Pure/Tools/rule_insts.ML
changeset 59829 4bce61dd88d2
parent 59828 0e9baaf0e0bb
child 59834 fc3d7eaa486e
equal deleted inserted replaced
59828:0e9baaf0e0bb 59829:4bce61dd88d2
    13     (binding * string option * mixfix) list -> thm -> thm
    13     (binding * string option * mixfix) list -> thm -> thm
    14   val read_instantiate: Proof.context ->
    14   val read_instantiate: Proof.context ->
    15     ((indexname * Position.T) * string) list -> string list -> thm -> thm
    15     ((indexname * Position.T) * string) list -> string list -> thm -> thm
    16   val read_term: string -> Proof.context -> term * Proof.context
    16   val read_term: string -> Proof.context -> term * Proof.context
    17   val schematic: bool Config.T
    17   val schematic: bool Config.T
    18   val goal_context: int -> thm -> Proof.context -> (string * typ) list * Proof.context
    18   val goal_context: term -> Proof.context -> (string * typ) list * Proof.context
    19   val res_inst_tac: Proof.context ->
    19   val res_inst_tac: Proof.context ->
    20     ((indexname * Position.T) * string) list -> (binding * string option * mixfix) list -> thm ->
    20     ((indexname * Position.T) * string) list -> (binding * string option * mixfix) list -> thm ->
    21     int -> tactic
    21     int -> tactic
    22   val eres_inst_tac: Proof.context ->
    22   val eres_inst_tac: Proof.context ->
    23     ((indexname * Position.T) * string) list -> (binding * string option * mixfix) list -> thm ->
    23     ((indexname * Position.T) * string) list -> (binding * string option * mixfix) list -> thm ->
   209 
   209 
   210 (* goal context *)
   210 (* goal context *)
   211 
   211 
   212 val schematic = Attrib.setup_config_bool @{binding rule_insts_schematic} (K true);
   212 val schematic = Attrib.setup_config_bool @{binding rule_insts_schematic} (K true);
   213 
   213 
   214 fun goal_context i st ctxt =
   214 fun goal_context goal ctxt =
   215   let
   215   let
   216     val goal = Thm.term_of (Thm.cprem_of st i);
       
   217     val ((_, params), ctxt') = ctxt
   216     val ((_, params), ctxt') = ctxt
   218       |> Thm.fold_terms Variable.declare_constraints st
   217       |> Variable.declare_constraints goal
   219       |> Variable.improper_fixes
   218       |> Variable.improper_fixes
   220       |> Variable.focus_params goal
   219       |> Variable.focus_params goal
   221       ||> Variable.restore_proper_fixes ctxt
   220       ||> Variable.restore_proper_fixes ctxt
   222       ||> Config.get ctxt schematic ? Proof_Context.set_mode Proof_Context.mode_schematic;
   221       ||> Config.get ctxt schematic ? Proof_Context.set_mode Proof_Context.mode_schematic;
   223   in (params, ctxt') end;
   222   in (params, ctxt') end;
   227 
   226 
   228 fun bires_inst_tac bires_flag ctxt mixed_insts fixes thm i st = CSUBGOAL (fn (cgoal, _) =>
   227 fun bires_inst_tac bires_flag ctxt mixed_insts fixes thm i st = CSUBGOAL (fn (cgoal, _) =>
   229   let
   228   let
   230     (* goal context *)
   229     (* goal context *)
   231 
   230 
   232     val (params, param_ctxt) = goal_context i st ctxt;
   231     val (params, param_ctxt) = goal_context (Thm.term_of cgoal) ctxt;
   233     val paramTs = map #2 params;
   232     val paramTs = map #2 params;
   234 
   233 
   235 
   234 
   236     (* local fixes *)
   235     (* local fixes *)
   237 
   236