Rational numbers for implementing decision procedures. We should not confuse them with the Mathlib rational numbers.
Equations
- Lean.instInhabitedRat = { default := { num := default, den := default } }
Equations
Equations
- One or more equations did not get rendered due to their size.
Equations
- One or more equations did not get rendered due to their size.
@[inline]
Equations
- Lean.Rat.normalize a = let n := Nat.gcd (Int.natAbs a.num) a.den; if (n == 1) = true then a else { num := a.num / Int.ofNat n, den := a.den / n }
Equations
- Lean.mkRat num den = if (den == 0) = true then { num := 0, den := 1 } else Lean.Rat.normalize { num := num, den := den }
Equations
- One or more equations did not get rendered due to their size.
Equations
- One or more equations did not get rendered due to their size.
Equations
- Lean.Rat.inv a = if a.num < 0 then { num := -Int.ofNat a.den, den := Int.natAbs a.num } else if (a.num == 0) = true then a else { num := Int.ofNat a.den, den := Int.natAbs a.num }
Equations
- Lean.Rat.div a b = Lean.Rat.mul a (Lean.Rat.inv b)
Equations
- One or more equations did not get rendered due to their size.
Equations
- One or more equations did not get rendered due to their size.
Equations
- Lean.Rat.neg a = { num := -a.num, den := a.den }
Equations
- Lean.Rat.instLTRat = { lt := fun a b => Lean.Rat.lt a b = true }
Equations
Equations
- Lean.Rat.instLERat = { le := fun a b => ¬b < a }
Equations
Equations
- Lean.Rat.instAddRat = { add := Lean.Rat.add }
Equations
- Lean.Rat.instSubRat = { sub := Lean.Rat.sub }
Equations
- Lean.Rat.instNegRat = { neg := Lean.Rat.neg }
Equations
- Lean.Rat.instMulRat = { mul := Lean.Rat.mul }
Equations
- Lean.Rat.instDivRat = { div := fun a b => a * Lean.Rat.inv b }
Equations
- Lean.Rat.instCoeIntRat = { coe := fun num => { num := num, den := 1 } }