ZFC Rational Numbers #
This file defines the rational numbers in ZFC, based on the integers and using the ZFInt type.
ℤ × ℤ⋆ equipped with qrel is a setoid.
Equations
- ZFSet.instSetoidZFIntZFInt' = { r := ZFSet.qrel, iseqv := ZFSet.qrel_eq }
Equations
Instances For
Equations
Instances For
Equations
Instances For
Equations
- ZFSet.ZFRat.instZero = { zero := ZFSet.ZFRat.zero }
Equations
- ZFSet.ZFRat.instOne = { one := ZFSet.ZFRat.one }
Equations
- ZFSet.ZFRat.instInhabited = { default := 0 }
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- ZFSet.ZFRat.instAdd = { add := ZFSet.ZFRat.add }
Equations
- n.neg = Quotient.liftOn n (fun (x : ZFSet.ZFInt × ZFSet.ZFInt') => match x with | (x, y) => ZFSet.ZFRat.mk (-x, y)) ZFSet.ZFRat.neg._proof_2
Instances For
Equations
- ZFSet.ZFRat.instNeg = { neg := ZFSet.ZFRat.neg }
Equations
- ZFSet.ZFRat.instSub = { sub := ZFSet.ZFRat.sub }
Equations
- ZFSet.ZFRat.nsmul 0 x✝ = 0
- ZFSet.ZFRat.nsmul n.succ x✝ = x✝ + ZFSet.ZFRat.nsmul n x✝
Instances For
Equations
- ZFSet.ZFRat.zsmul (Int.ofNat n_2) x = ZFSet.ZFRat.nsmul n_2 x
- ZFSet.ZFRat.zsmul (Int.negSucc n_2) x = -ZFSet.ZFRat.nsmul (n_2 + 1) x
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- ZFSet.ZFRat.instMul = { mul := ZFSet.ZFRat.mul }
Equations
- One or more equations did not get rendered due to their size.
Equations
- ZFSet.ZFRat.inv ⟨x_1, hx⟩ = ⟨ZFSet.ZFRat.mk (↑(Quotient.out x_1).2, ⟨(Quotient.out x_1).1, ⋯⟩), ⋯⟩
Instances For
Equations
- ZFSet.ZFRat.instInvZFRat' = { inv := ZFSet.ZFRat.inv }
Equations
- ZFSet.ZFRat.instInv = { inv := fun (x : ZFSet.ZFRat) => if hx : x ≠ 0 then ↑(ZFSet.ZFRat.inv ⟨x, hx⟩) else 0 }
Equations
- ZFSet.ZFRat.instHDivZFRat' = { hDiv := ZFSet.ZFRat.hdiv }
Equations
- ZFSet.ZFRat.instDiv = { div := ZFSet.ZFRat.div }
Equations
- ZFSet.ZFRat.qsmul k m = ↑k * m
Instances For
Equations
- ZFSet.ZFRat.nnqsmul ⟨k, property⟩ m = ZFSet.ZFRat.qsmul k m
Instances For
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.
A rational is positive iff numerator and denominator carry the same sign.
Well-defined because for equivalent reps (a,b) ≈ (c,d) (i.e. a*d = b*c),
multiplying both sides by b*d gives (a*b)*(d*d) = (b*b)*(c*d), and b*b,
d*d are both positive, so a*b and c*d share a sign.
Equations
- x.isPos = Quotient.liftOn x (fun (x : ZFSet.ZFInt × ZFSet.ZFInt') => match x with | (a, ⟨b, property⟩) => 0 < a * b) ZFSet.ZFRat.isPos._proof_1✝
Instances For
Equations
- ZFSet.ZFRat.instLT = { lt := ZFSet.ZFRat.lt }
Equations
- ZFSet.ZFRat.instLE = { le := fun (x y : ZFSet.ZFRat) => x < y ∨ x = y }
Equations
- One or more equations did not get rendered due to their size.
Transfer to ℚ #
ZFRat and ℚ are the same field: the ring morphism ℚ →+* ZFRat given by the RatCast
instance is injective because ZFRat has characteristic zero, and surjective because every
mk (a, b) is the quotient of the images of two integers. The resulting equivalence is
registered as a TransferEquiv, so that the transfer tactic reads a goal about ZFRat in ℚ:
example (x y : ZFRat) : x + y = y + x := by
transfer ZFRat → ℚ =>
rw [add_comm]
The field operations, the numerals and the casts travel through the generic map_… lemmas of
the transfer_simps simp set; the order relations are tagged below.
The canonical ring equivalence between the quotient construction ZFRat and Lean's ℚ.
Equations
Instances For
Equivalence used by the transfer tactic to move goals between ZFRat and ℚ.