EncounterActivity 1 of 8
Encounter
Lean's numbers, lists and even And and Or are not built in: they are inductive types,
defined by listing the ways to build a value (the constructors). You can define your own.
- A structure bundles fields: a point has an
xand ay. - An enumeration lists finitely many values: the days of the week.
- A recursive type builds values from smaller ones: a tree is a leaf, or a node with two smaller trees.
Whatever you define, Lean gives you two powers for free: pattern matching to compute, and cases/induction to prove.