Floor Function for Rational Numbers #
Summary #
We define the FloorRing instance on ℚ. Some technical lemmas relating floor to integer
division and modulo arithmetic are derived as well as some simple inequalities.
Tags #
rat, rationals, ℚ, floor
@[instance_reducible]
@[simp]
theorem Rat.floor_cast {α : Type u_1} [Field α] [LinearOrder α] [IsStrictOrderedRing α] [FloorRing α] (x : ℚ) :
@[simp]
theorem Rat.ceil_cast {α : Type u_1} [Field α] [LinearOrder α] [IsStrictOrderedRing α] [FloorRing α] (x : ℚ) :
@[simp]
theorem Rat.round_cast {α : Type u_1} [Field α] [LinearOrder α] [IsStrictOrderedRing α] [FloorRing α] (x : ℚ) :
@[simp]
theorem Rat.cast_fract {α : Type u_1} [Field α] [LinearOrder α] [IsStrictOrderedRing α] [FloorRing α] (x : ℚ) :
theorem Rat.isNat_intFloor_ofIsNNRat {α : Type u_1} [Field α] [LinearOrder α] [IsStrictOrderedRing α] [FloorRing α] (r : α) (n d : ℕ) :
Mathlib.Meta.NormNum.IsNNRat r n d → Mathlib.Meta.NormNum.IsNat ⌊r⌋ (n / d)
theorem Rat.isInt_intFloor_ofIsRat_neg {α : Type u_1} [Field α] [LinearOrder α] [IsStrictOrderedRing α] [FloorRing α] (r : α) (n d : ℕ) :
Mathlib.Meta.NormNum.IsRat r (Int.negOfNat n) d → Mathlib.Meta.NormNum.IsInt ⌊r⌋ (Int.negOfNat (-(-↑n / ↑d)).toNat)
theorem Rat.isNat_intCeil_ofIsNNRat {α : Type u_1} [Field α] [LinearOrder α] [IsStrictOrderedRing α] [FloorRing α] (r : α) (n d : ℕ) :
Mathlib.Meta.NormNum.IsNNRat r n d → Mathlib.Meta.NormNum.IsNat ⌈r⌉ (-(-↑n / ↑d)).toNat
theorem Rat.isInt_intCeil_ofIsRat_neg {α : Type u_1} [Field α] [LinearOrder α] [IsStrictOrderedRing α] [FloorRing α] (r : α) (n d : ℕ) :
Mathlib.Meta.NormNum.IsRat r (Int.negOfNat n) d → Mathlib.Meta.NormNum.IsInt ⌈r⌉ (Int.negOfNat (n / d))
theorem Rat.isNat_intFract_of_isNat {R : Type u_2} [Ring R] [LinearOrder R] [FloorRing R] (r : R) (m : ℕ) :
theorem Rat.isNat_intFract_of_isInt {R : Type u_2} [Ring R] [LinearOrder R] [FloorRing R] (r : R) (m : ℤ) :
theorem Rat.isNNRat_intFract_of_isNNRat {α : Type u_1} [Field α] [LinearOrder α] [IsStrictOrderedRing α] [FloorRing α] (r : α) (n d : ℕ) :
Mathlib.Meta.NormNum.IsNNRat r n d → Mathlib.Meta.NormNum.IsNNRat (Int.fract r) (n % d) d
theorem Rat.isRat_intFract_of_isRat_negOfNat {α : Type u_1} [Field α] [LinearOrder α] [IsStrictOrderedRing α] [FloorRing α] (r : α) (n d : ℕ) :
Mathlib.Meta.NormNum.IsRat r (Int.negOfNat n) d → Mathlib.Meta.NormNum.IsRat (Int.fract r) (-↑n % ↑d) d
theorem Rat.IsRat.isInt_round {R : Type u_3} [Field R] [LinearOrder R] [IsStrictOrderedRing R] [FloorRing R] (r : R) (n : ℤ) (d : ℕ) (res : ℤ) (hres : round (↑n / ↑d) = res) :
Mathlib.Meta.NormNum.IsRat r n d → Mathlib.Meta.NormNum.IsInt (round r) res