Proving a Conditional by Splitting on Its Test
Each branch can be proved under the conditions allowing it to run. Together the cases support a claim for the whole conditional.
- Source
- Anbloq
- Language
- English
- Created
- Updated
- Chapters
- 2
- Reading time
- 1 min
In this article2 chapters
Trace an absolute value function
When x is negative, returning its mathematical negative gives a positive result. When x is nonnegative, returning x preserves nonnegativity. See a proof by cases.
Check shared outcomes
An optional third branch for unsupported input needs its own documented result. A function postcondition states the claim every successful branch should meet.[1]