Algebraic instances for the natural numbers #
This file contains algebraic instances on the natural numbers and a few lemmas about them.
Implementation note #
Std has a home-baked development of the algebraic and order theoretic theory of ℕ
which, in
particular, is not typeclass-mediated. This is useful to set up the algebra and finiteness libraries
in mathlib (naturals show up as indices in lists, cardinality in finsets, powers in groups, ...).
This home-baked development is pursued in Data.Nat.Defs
.
Less basic uses of ℕ
should however use the typeclass-mediated development. This file is the one
giving access to the algebraic instances. Data.Nat.Order.Basic
is the one giving access to the
algebraic order instances.
TODO #
The names of this file, Data.Nat.Defs
and Data.Nat.Order.Basic
are archaic and don't match up
with reality anymore. Rename them.
Instances #
Equations
Extra instances to short-circuit type class resolution and ensure computability
Equations
- Nat.addCommSemigroup = inferInstance
Equations
- Nat.cancelCommMonoidWithZero = let __src := inferInstance; CancelCommMonoidWithZero.mk