Basic definitions around the rational numbers #
This file declares ℚ
notation for the rationals and defines the nonnegative rationals ℚ≥0
.
This file is eligible to upstreaming to Batteries.
Cast from NNRat
#
This section sets up the typeclasses necessary to declare the canonical embedding ℚ≥0
to any
semifield.
Typeclass for the canonical homomorphism ℚ≥0 → K
.
This should be considered as a notation typeclass. The sole purpose of this typeclass is to be
extended by DivisionSemiring
.
- nnratCast : ℚ≥0 → K
The canonical homomorphism
ℚ≥0 → K
.Do not use directly. Use the coercion instead.
Instances
Equations
- NNRat.instNNRatCast = { nnratCast := fun (q : ℚ≥0) => q }
Equations
- Rat.instNNRatCast = { nnratCast := Subtype.val }