Search code examples
isabelle

Subst refl closing duplicate subgoals. What's going on?


In this thread Mathieu demonstrates that subst refl closes duplicate subgoals. How/Why is it doing that?


Solution

  • I'm not completely sure, but a quick look at the code suggests that subst calls distinct_subgoals_tac for some reason and does not restrict it to the subgoal it is working on:

    fun eqsubst_tac ctxt occs thms i st =
      let val nprems = Thm.nprems_of st in
        if nprems < i then Seq.empty else
        let
          val thmseq = Seq.of_list thms;
          fun apply_occ occ st =
            thmseq |> Seq.maps (fn r =>
              eqsubst_tac' ctxt
                (skip_first_occs_search occ searchf_lr_unify_valid) r
                (i + (Thm.nprems_of st - nprems)) st);
          val sorted_occs = Library.sort (rev_order o int_ord) occs;
        in
          Seq.maps distinct_subgoals_tac (Seq.EVERY (map apply_occ sorted_occs) st)
        end
      end;
    

    That does not seem like intended behaviour to me – probably an oversight in the implementation of subst. I'll write an email to the mailing list to ask about it.