Lecture 8: Verification: Hoare Logic and WP
Week 8 | May 18 – May 24
L07 unrolled loops one iteration at a time. L08 cuts each loop at its invariant. With one annotation per loop, the engine verifies the program for every input.
L08 closes the Verification arc. Practice opens with Hoare logic on paper, motivates verification condition generation by walking a hand proof, then builds a WP-based VC Gen that proves the same sum_to_n loop L07 ran in BMC, for every input. Theory formalizes the WP rules, the loop-cut transformation, and proves WP soundness across the same six cases L07 used for SP. Studio is the R4 reading discussion on AI and formal methods, the closing entry in the reflection arc.
Practice: Building a WP-based verifier
We walk a Hoare-logic hand-proof, derive the WP rules that mechanize it, build the loop-cut transformation that handles while, and verify sum_to_n for every input with one invariant annotation.
Theory: WP rules, soundness, and the SP/WP duality
The engine in Practice emits one or more verification conditions per program. Theory names what those conditions mean, gives a diagnostic procedure for when the engine says NOT VALID, and shows what termination would take.
Studio: AI and formal methods
AI and formal methods, the closing reading discussion. Share what you read, argue about where the bottleneck actually is, and post your group's takeaway.