I would like to know how to reorder goals in the following situation:
lemma "P=Q"
proof (rule iffI, (*here I would like to swap goal order*), rule ccontr)
oops
I would like a solution that doesn't involve changing the lemma statement. I realise that prefer
and defer
can be used in apply-style proofs, but I would like to have a method that can be used in the proof (...)
part.
Edit:
As Andreas Lochbihler says, writing rule iffI[rotated]
works in the above example. However, is it possible to swap the goal order in the following situation without changing the statement of the lemma?
lemma "P==>Q" "Q==>P"
proof ((*here I would like to swap goal order*), rule ccontr)
oops
This example may seem contrived, but I feel that there may be situations where it is inconvenient to change the statement of the lemma, or it is necessary to swap goal order when there is no previous application of a rule such as iffI
.
The order of the subgoals is determined by the order of the assumptions of the rule you apply. So it suffices to swap the assumptions of the
iffI
rule, e.g., using the attribute[rotated]
as inIn general, there is no proof method to change the order of the goals. And if you are thinking about using this with more sophisticated proof automation like
auto
, I'd heavily advise you against doing these kinds of things. Proof scripts with lots of automation in it should work independently of the order of the goals. Otherwise, your proofs will break easily when something in the proof automation setup changes.However, a few low-level proof tactics allow to use explicit goal addressing (mostly those that end on
_tac
). For example,applies the
ccontr
rule to the second subgoal instead of the first.