Prove Algorithm Correctness Using Formal Methods
8 weeks · 0 milestones
Write formal correctness proofs for 5 of your algorithm implementations using loop invariants, structural induction, or reduction to a known problem. Each proof must include: the invariant or inductive hypothesis, the proof that it holds at initialisation, the proof that it is maintained through each iteration or recursive step, and the proof that it implies the postcondition. Proof: the written proofs reviewed by a CS lecturer or engineer with formal methods background who asks you to prove correctness for a sixth algorithm you haven't prepared — you must apply your chosen proof technique to the new algorithm during the review session.
Milestone map
Milestone map
3 milestones
Study formal methods for proving algorithm correctness: loop invariants, structural induction, and mathematical induction. Apply these to at least five standard algorithms — binary search, insertion sort, merge sort, and two others of your choice. For each algorithm, write a formal correctness proof using the loop invariant method: initialisation, maintenance, and termination.
Proof required
Submit: five formal correctness proofs (one per algorithm) each following the loop invariant structure — initialisation (invariant holds before first iteration), maintenance (if it holds before iteration k, it holds before iteration k+1), and termination (invariant implies correctness when loop terminates). Each proof must be submitted as a typed document. Submit to a CS lecturer, researcher, or experienced software engineer, who must confirm in writing that the proofs are formally valid.
What gets checked
- All five proofs follow the loop invariant structure with all three components — initialisation, maintenance, and termination
- A CS lecturer, researcher, or senior engineer with formal methods experience has confirmed in writing that the proofs are valid
- Proofs are typed and clearly structured — not handwritten notes