src/Tools/eqsubst.ML
changeset 58318 f95754ca7082
parent 54742 7a86358a3c0b
child 58826 2ed2eaabe3df
equal deleted inserted replaced
58317:21fac057681e 58318:f95754ca7082
    27   (* tactics *)
    27   (* tactics *)
    28   val eqsubst_asm_tac: Proof.context -> int list -> thm list -> int -> tactic
    28   val eqsubst_asm_tac: Proof.context -> int list -> thm list -> int -> tactic
    29   val eqsubst_asm_tac': Proof.context ->
    29   val eqsubst_asm_tac': Proof.context ->
    30     (searchinfo -> int -> term -> match skipseq) -> int -> thm -> int -> tactic
    30     (searchinfo -> int -> term -> match skipseq) -> int -> thm -> int -> tactic
    31   val eqsubst_tac: Proof.context ->
    31   val eqsubst_tac: Proof.context ->
    32     int list -> (* list of occurences to rewrite, use [0] for any *)
    32     int list -> (* list of occurrences to rewrite, use [0] for any *)
    33     thm list -> int -> tactic
    33     thm list -> int -> tactic
    34   val eqsubst_tac': Proof.context ->
    34   val eqsubst_tac': Proof.context ->
    35     (searchinfo -> term -> match Seq.seq) (* search function *)
    35     (searchinfo -> term -> match Seq.seq) (* search function *)
    36     -> thm (* equation theorem to rewrite with *)
    36     -> thm (* equation theorem to rewrite with *)
    37     -> int (* subgoal number in goal theorem *)
    37     -> int (* subgoal number in goal theorem *)
   290         |> Seq.maps (apply_subst_in_concl ctxt i st cvfsconclthm r)
   290         |> Seq.maps (apply_subst_in_concl ctxt i st cvfsconclthm r)
   291       end;
   291       end;
   292   in stepthms |> Seq.maps rewrite_with_thm end;
   292   in stepthms |> Seq.maps rewrite_with_thm end;
   293 
   293 
   294 
   294 
   295 (* General substitution of multiple occurances using one of
   295 (* General substitution of multiple occurrences using one of
   296    the given theorems *)
   296    the given theorems *)
   297 
   297 
   298 fun skip_first_occs_search occ srchf sinfo lhs =
   298 fun skip_first_occs_search occ srchf sinfo lhs =
   299   (case skipto_skipseq occ (srchf sinfo lhs) of
   299   (case skipto_skipseq occ (srchf sinfo lhs) of
   300     SkipMore _ => Seq.empty
   300     SkipMore _ => Seq.empty
   301   | SkipSeq ss => Seq.flat ss);
   301   | SkipSeq ss => Seq.flat ss);
   302 
   302 
   303 (* The "occs" argument is a list of integers indicating which occurence
   303 (* The "occs" argument is a list of integers indicating which occurrence
   304 w.r.t. the search order, to rewrite. Backtracking will also find later
   304 w.r.t. the search order, to rewrite. Backtracking will also find later
   305 occurences, but all earlier ones are skipped. Thus you can use [0] to
   305 occurrences, but all earlier ones are skipped. Thus you can use [0] to
   306 just find all rewrites. *)
   306 just find all rewrites. *)
   307 
   307 
   308 fun eqsubst_tac ctxt occs thms i st =
   308 fun eqsubst_tac ctxt occs thms i st =
   309   let val nprems = Thm.nprems_of st in
   309   let val nprems = Thm.nprems_of st in
   310     if nprems < i then Seq.empty else
   310     if nprems < i then Seq.empty else