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.
Rational numbers, implemented as a pair of integers num / den
such that the
denominator is positive and the numerator and denominator are coprime.
Equations
- termℚ = Lean.ParserDescr.node `termℚ 1024 (Lean.ParserDescr.symbol "ℚ")
Instances For
Nonnegative rational numbers.
Equations
- «termℚ≥0» = Lean.ParserDescr.node `termℚ≥0 1024 (Lean.ParserDescr.symbol "ℚ≥0")
Instances For
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 }