hw2
hw2
QUESTIONS:
1- Write an example of a lemma in Dafny, test it to ensure it works, and use calculation (calc)
blocks to detail the steps. Provide a brief explanation of each step in your answer. At the end of
the answer, include your full code within the document.
2- Introduce the concept of loop invariants. Illustrate this using an example that operates on
arrays. Describe your preconditions and postconditions. At the end of the answer, include your
full code within the document.