Sometimes in a proof I find myself needing to accumulate results, but also needing use the last result, so I end up using "also then" for that purpose:
proof
have ...
also then have ...
also then have ...
ultimately show ...
qed
I feel like there are more idiomatic ways to this that I don't know about. On the other hand, this might be the standard way to do it and encouraged by the community.
So in light of that, I have two questions:
- Is using "
also then" discouraged? - If so, what alternatives can I use to accumulate results while using them?
I will start by providing some background. You have breached the subject known as calculational reasoning in Isabelle. Calculation reasoning is described in subsection 1.2 of the document The Isabelle/Isar Reference Manual.
Two of the most common patterns for calculational reasoning are
(where
Ris a transitive relation, such as=, written using the infix notation) andThe commands like
alsoandmoreoveruse an additional factcalculationto store additional information. For example, as the calculation in the first example above proceeds, the factcalculationchanges in the following mannerIn this case, the transitivity rule of
Ris used for chaining the predicates. Thus, the final goal can be discharged by assumption. The situation is different for themoreover ... ultimatelypattern:In this case, the fact
calculationmerely accumulates all previous results.The implementation of the calculational reasoning is explained in subsection 6.3 of the document The Isabelle/Isar Reference Manual. However, I omit the details in this post.
I will now make an attempt to answer your questions in the context of what was stated above.
I believe that this is not, necessarily, discouraged and there are some instances of the use of this pattern in the AFP. However, I can imagine that for this specific pattern this would be a reasonably uncommon use case.
I believe that if you, indeed, need to merely accumulate results (while, possibly, using them in the intermittent steps), the best pattern to use would be
moreover ... ultimately. However, of course, this depends on what exactly is meant by the "accumulation of results".Remark 1
I hope that from the discussion above it is apparent that the use of
alsoin conjunction withultimatelyis very unconventional. In most cases, it makes little sense to use such a pattern.Remark 2
The pattern
also ... finallyis often used in conjunction with the abbreviation...:Of course, the benefits can only become apparent if
bandcare sufficiently long subterms.