Inductive Types #
The main type construction in Lean is the inductive type. We will see how to define inductive types and how to define functions by recursion on these types.
We have already seen one special case of inductive types: structures. We will now see two other special cases before the general case. Thus, we see:
- Enumerated types
- Non-recursive Inductive types
- Recursive Inductive types
Equations
- instInhabitedShortAnswer = { default := ShortAnswer.yes }
Equations
- instReprShortAnswer = { reprPrec := reprShortAnswer✝ }
Equations
- instDecidableEqShortAnswer x✝ y✝ = if h : x✝.toCtorIdx = y✝.toCtorIdx then isTrue ⋯ else isFalse ⋯