Sum, a small algebra of choices
Defining Sum
The constructors
This post introduces a tiny sum type. The companion post on using Sum
uses the definition in a different piece of writing, while the PostSource
reference demonstrates a link from English prose to a generated Lean declaration.
Visualizing the choice
The value is always on exactly one side:
flowchart LR
Value --> Left[Sum.left]
Value --> Right[Sum.right]