An equation states that two expressions have the same value or meaning. In programming, it can relate two pieces of data or two pieces of code that behave identically. section 7.1 section 7.2
An equation shifts attention away from implementation details and toward what code should mean. Once two expressions are understood as equivalent, a complex expression can be substituted with a simpler one. section 7.2
Combining conflicting records
When duplicate rows conflict, write an equation that asks what it means to “add” two records. The equation does not prescribe lists, loops, or data structures; it isolates the meaning of the operation before implementation. The resulting meaning can support laws that apply to every possible input and tests that check whether the implementation is correct. section 7.1 section 7.2
Use equations to make software meaning explicit:
- Define the data being related and the operation applied to it. section 7.2
- Ask what the equation means independently of its implementation. section 7.2
- Turn the resulting laws into tests over possible inputs. section 7.1
Figure 7.3 An exciting first example!

A visual first example makes functional equivalence between two expressions concrete before introducing broader algebraic laws. section 7.2
