Inductive types for numbers, data, propositions. #
What makes the foundations we use work are that the mathematical objects we need as well as their properties can be constructed in terms of inductive types and dependent function types. Similarly, proofs and terms need only a few rules to be constructed.
We will see how to define inductive types for many basic constructions: natural numbers, products, sums (disjoint unions) etc. We will also see the logical connectives ∧
and or
as well as quantifiers constructed as inductive types. Further, we see how specific relations like ≤
can be defined as (indexed) inductive types.
The addition operation +
on natural numbers.
Equations
- MyNat.instAdd = { add := MyNat.add }
Addition on the left by zero. This is by definition.
Addition on the right by zero. This is by induction on n
.
Equations
- MyNat.«term_#+#_» = Lean.ParserDescr.trailingNode `MyNat.«term_#+#_» 65 66 (Lean.ParserDescr.binary `andthen (Lean.ParserDescr.symbol " #+# ") (Lean.ParserDescr.cat `term 66))