4 questions to test your understanding
What does the Hoare triple {x > 0} x := x - 1 {x >= 0} assert?
Hoare logic's rule for assignment is {Q[x/E]} x := E {Q}, where Q[x/E] substitutes E for x in Q. This rule works backward from the postcondition, not forward from the precondition.
What is the difference between partial correctness and total correctness in Hoare logic, and which does the standard Hoare triple {P} C {Q} assert?
In Hoare logic, the rule of consequence allows strengthening the precondition and weakening the postcondition. Why is this sound?