- Precondition (Validity predicate)
- The precondition defines the valid inputs, following the input constraints of the problem.
- Declarative postcondition (Ideal specification)
- The declarative postcondition characterizes the correct outputs independently of how they are computed.
- Executable postcondition (Decidable specification)
- The executable postcondition expresses the same condition in a form that is evaluated directly on test cases in Lean.
- Equivalence theorem (check_iff_spec)
- The equivalence theorem asserts that the two postconditions agree on valid inputs.
- Implementation (Main algorithm)
- The implementation is an algorithm that computes an output from a given input.
- Correctness theorem (Correctness)
- The correctness theorem asserts that the implementation satisfies the declarative postcondition.
- Test cases (Unit tests)
- Each test case is a #guard command, which fails at compilation when its expression is false. Layers L1 and L2 test the specification, L3 and L4 the implementation.