Documentation

Mathlib.Algebra.Order.Floor.Semiring

Lemmas on Nat.floor and Nat.ceil #

This file contains basic results on the natural-valued floor and ceiling functions.

TODO #

LinearOrderedSemiring can be relaxed to OrderedSemiring in many lemmas.

Tags #

rounding, floor, ceil

theorem Nat.floor_lt {R : Type u_1} [Semiring R] [LinearOrder R] [FloorSemiring R] {a : R} {n : } (ha : 0 a) :
a⌋₊ < n a < n
theorem Nat.floor_lt_one {R : Type u_1} [Semiring R] [LinearOrder R] [FloorSemiring R] {a : R} (ha : 0 a) :
a⌋₊ < 1 a < 1
theorem Nat.floor_le {R : Type u_1} [Semiring R] [LinearOrder R] [FloorSemiring R] {a : R} (ha : 0 a) :
theorem Nat.floor_eq_iff {R : Type u_1} [Semiring R] [LinearOrder R] [FloorSemiring R] {a : R} {n : } (ha : 0 a) :
a⌋₊ = n n a a < n + 1
theorem Nat.lt_of_floor_lt {R : Type u_1} [Semiring R] [LinearOrder R] [FloorSemiring R] {a : R} {n : } [IsStrictOrderedRing R] (h : a⌋₊ < n) :
a < n
@[simp]
theorem Nat.floor_of_nonpos {R : Type u_1} [Semiring R] [LinearOrder R] [FloorSemiring R] {a : R} [IsStrictOrderedRing R] (ha : a 0) :
theorem Nat.le_floor_iff' {R : Type u_1} [Semiring R] [LinearOrder R] [FloorSemiring R] {a : R} {n : } [IsStrictOrderedRing R] (hn : n 0) :
n a⌋₊ n a
@[simp]
theorem Nat.floor_lt' {R : Type u_1} [Semiring R] [LinearOrder R] [FloorSemiring R] {a : R} {n : } [IsStrictOrderedRing R] (hn : n 0) :
a⌋₊ < n a < n
theorem Nat.pos_of_floor_pos {R : Type u_1} [Semiring R] [LinearOrder R] [FloorSemiring R] {a : R} [IsStrictOrderedRing R] (h : 0 < a⌋₊) :
0 < a
theorem Nat.lt_of_lt_floor {R : Type u_1} [Semiring R] [LinearOrder R] [FloorSemiring R] {a : R} {n : } [IsStrictOrderedRing R] (h : n < a⌋₊) :
n < a
theorem Nat.floor_le_of_le {R : Type u_1} [Semiring R] [LinearOrder R] [FloorSemiring R] {a : R} {n : } [IsStrictOrderedRing R] (h : a n) :
@[simp]
theorem Nat.floor_eq_zero {R : Type u_1} [Semiring R] [LinearOrder R] [FloorSemiring R] {a : R} [IsStrictOrderedRing R] :
a⌋₊ = 0 a < 1
theorem Nat.floor_eq_iff' {R : Type u_1} [Semiring R] [LinearOrder R] [FloorSemiring R] {a : R} {n : } [IsStrictOrderedRing R] (hn : n 0) :
a⌋₊ = n n a a < n + 1
theorem Nat.floor_eq_on_Ico {R : Type u_1} [Semiring R] [LinearOrder R] [FloorSemiring R] [IsStrictOrderedRing R] (n : ) (a : R) :
a Set.Ico (↑n) (n + 1)a⌋₊ = n
theorem Nat.floor_eq_on_Ico' {R : Type u_1} [Semiring R] [LinearOrder R] [FloorSemiring R] [IsStrictOrderedRing R] (n : ) (a : R) :
a Set.Ico (↑n) (n + 1)a⌋₊ = n
theorem Nat.preimage_floor_of_ne_zero {R : Type u_1} [Semiring R] [LinearOrder R] [FloorSemiring R] [IsStrictOrderedRing R] {n : } (hn : n 0) :
floor ⁻¹' {n} = Set.Ico (↑n) (n + 1)

Ceil #

theorem Nat.add_one_le_ceil_iff {R : Type u_1} [Semiring R] [LinearOrder R] [FloorSemiring R] {a : R} {n : } :
n + 1 a⌉₊ n < a
@[simp]
theorem Nat.one_le_ceil_iff {R : Type u_1} [Semiring R] [LinearOrder R] [FloorSemiring R] {a : R} :
theorem Nat.le_ceil {R : Type u_1} [Semiring R] [LinearOrder R] [FloorSemiring R] (a : R) :
theorem Nat.ceil_le_ceil {R : Type u_1} [Semiring R] [LinearOrder R] [FloorSemiring R] {a b : R} (hab : a b) :
@[simp]
theorem Nat.ceil_eq_zero {R : Type u_1} [Semiring R] [LinearOrder R] [FloorSemiring R] {a : R} :
theorem Nat.ceil_eq_iff {R : Type u_1} [Semiring R] [LinearOrder R] [FloorSemiring R] {a : R} {n : } (hn : n 0) :
a⌉₊ = n ↑(n - 1) < a a n
theorem Nat.preimage_ceil_of_ne_zero {R : Type u_1} [Semiring R] [LinearOrder R] [FloorSemiring R] {n : } (hn : n 0) :
ceil ⁻¹' {n} = Set.Ioc ↑(n - 1) n
@[simp]
@[simp]
theorem Nat.lt_of_ceil_lt {R : Type u_1} [Semiring R] [LinearOrder R] [FloorSemiring R] {a : R} {n : } [IsStrictOrderedRing R] (h : a⌉₊ < n) :
a < n
theorem Nat.le_of_ceil_le {R : Type u_1} [Semiring R] [LinearOrder R] [FloorSemiring R] {a : R} {n : } [IsStrictOrderedRing R] (h : a⌉₊ n) :
a n
theorem Nat.floor_lt_ceil_of_lt_of_pos {R : Type u_1} [Semiring R] [LinearOrder R] [FloorSemiring R] [IsStrictOrderedRing R] {a b : R} (h : a < b) (h' : 0 < b) :

Intervals #

@[simp]
theorem Nat.preimage_Ioo {R : Type u_1} [Semiring R] [LinearOrder R] [FloorSemiring R] {a b : R} (ha : 0 a) :
@[simp]
theorem Nat.preimage_Ioc {R : Type u_1} [Semiring R] [LinearOrder R] [FloorSemiring R] {a b : R} (ha : 0 a) (hb : 0 b) :
@[simp]
theorem Nat.preimage_Icc {R : Type u_1} [Semiring R] [LinearOrder R] [FloorSemiring R] {a b : R} (hb : 0 b) :
@[simp]
theorem Nat.preimage_Ioi {R : Type u_1} [Semiring R] [LinearOrder R] [FloorSemiring R] {a : R} (ha : 0 a) :
@[simp]
theorem Nat.preimage_Iic {R : Type u_1} [Semiring R] [LinearOrder R] [FloorSemiring R] {a : R} (ha : 0 a) :
theorem Nat.floor_add_natCast {R : Type u_1} [Semiring R] [LinearOrder R] [FloorSemiring R] {a : R} [IsStrictOrderedRing R] (ha : 0 a) (n : ) :
@[deprecated Nat.floor_add_natCast (since := "2025-04-01")]
theorem Nat.floor_add_nat {R : Type u_1} [Semiring R] [LinearOrder R] [FloorSemiring R] {a : R} [IsStrictOrderedRing R] (ha : 0 a) (n : ) :

Alias of Nat.floor_add_natCast.

theorem Nat.floor_add_one {R : Type u_1} [Semiring R] [LinearOrder R] [FloorSemiring R] {a : R} [IsStrictOrderedRing R] (ha : 0 a) :
@[simp]
theorem Nat.floor_sub_natCast {R : Type u_1} [Semiring R] [LinearOrder R] [FloorSemiring R] [IsStrictOrderedRing R] [Sub R] [OrderedSub R] [ExistsAddOfLE R] (a : R) (n : ) :
@[deprecated Nat.floor_sub_natCast (since := "2025-04-01")]
theorem Nat.floor_sub_nat {R : Type u_1} [Semiring R] [LinearOrder R] [FloorSemiring R] [IsStrictOrderedRing R] [Sub R] [OrderedSub R] [ExistsAddOfLE R] (a : R) (n : ) :

Alias of Nat.floor_sub_natCast.

theorem Nat.ceil_add_natCast {R : Type u_1} [Semiring R] [LinearOrder R] [FloorSemiring R] {a : R} [IsStrictOrderedRing R] (ha : 0 a) (n : ) :
@[deprecated Nat.ceil_add_natCast (since := "2025-04-01")]
theorem Nat.ceil_add_nat {R : Type u_1} [Semiring R] [LinearOrder R] [FloorSemiring R] {a : R} [IsStrictOrderedRing R] (ha : 0 a) (n : ) :

Alias of Nat.ceil_add_natCast.

theorem Nat.ceil_add_one {R : Type u_1} [Semiring R] [LinearOrder R] [FloorSemiring R] {a : R} [IsStrictOrderedRing R] (ha : 0 a) :
theorem Nat.ceil_lt_add_one {R : Type u_1} [Semiring R] [LinearOrder R] [FloorSemiring R] {a : R} [IsStrictOrderedRing R] (ha : 0 a) :
a⌉₊ < a + 1
theorem Nat.sub_one_lt_floor {R : Type u_1} [Ring R] [LinearOrder R] [IsStrictOrderedRing R] [FloorSemiring R] (a : R) :
a - 1 < a⌋₊
@[deprecated Nat.floor_div_natCast (since := "2025-04-01")]
theorem Nat.floor_div_nat {K : Type u_2} [Semifield K] [LinearOrder K] [IsStrictOrderedRing K] [FloorSemiring K] (a : K) (n : ) :

Alias of Nat.floor_div_natCast.

theorem Nat.floor_div_eq_div {K : Type u_2} [Semifield K] [LinearOrder K] [IsStrictOrderedRing K] [FloorSemiring K] (m n : ) :
m / n⌋₊ = m / n

Natural division is the floor of field division.

theorem Nat.mul_lt_floor {K : Type u_2} [Field K] [LinearOrder K] [IsStrictOrderedRing K] [FloorSemiring K] {a b : K} (hb₀ : 0 < b) (hb : b < 1) (hba : b / (1 - b)⌉₊ a) :
b * a < a⌋₊
theorem Nat.ceil_lt_mul {K : Type u_2} [Field K] [LinearOrder K] [IsStrictOrderedRing K] [FloorSemiring K] {a b : K} (hb : 1 < b) (hba : (b - 1)⁻¹⌉₊ / b < a) :
a⌉₊ < b * a
theorem Nat.ceil_le_mul {K : Type u_2} [Field K] [LinearOrder K] [IsStrictOrderedRing K] [FloorSemiring K] {a b : K} (hb : 1 < b) (hba : (b - 1)⁻¹⌉₊ / b a) :
a⌉₊ b * a
theorem Nat.div_two_lt_floor {K : Type u_2} [Field K] [LinearOrder K] [IsStrictOrderedRing K] [FloorSemiring K] {a : K} (ha : 1 a) :
a / 2 < a⌋₊
theorem Nat.ceil_lt_two_mul {K : Type u_2} [Field K] [LinearOrder K] [IsStrictOrderedRing K] [FloorSemiring K] {a : K} (ha : 2⁻¹ < a) :
a⌉₊ < 2 * a
theorem Nat.ceil_le_two_mul {K : Type u_2} [Field K] [LinearOrder K] [IsStrictOrderedRing K] [FloorSemiring K] {a : K} (ha : 2⁻¹ a) :
a⌉₊ 2 * a
theorem Nat.floor_congr {R : Type u_1} [Semiring R] [LinearOrder R] [FloorSemiring R] {a : R} {S : Type u_3} [Semiring S] [LinearOrder S] [FloorSemiring S] {b : S} [IsStrictOrderedRing R] [IsStrictOrderedRing S] (h : ∀ (n : ), n a n b) :
theorem Nat.ceil_congr {R : Type u_1} [Semiring R] [LinearOrder R] [FloorSemiring R] {a : R} {S : Type u_3} [Semiring S] [LinearOrder S] [FloorSemiring S] {b : S} (h : ∀ (n : ), a n b n) :
theorem Nat.map_floor {R : Type u_1} [Semiring R] [LinearOrder R] [FloorSemiring R] {S : Type u_3} [Semiring S] [LinearOrder S] [FloorSemiring S] {F : Type u_4} [FunLike F R S] [RingHomClass F R S] [IsStrictOrderedRing R] [IsStrictOrderedRing S] (f : F) (hf : StrictMono f) (a : R) :
theorem Nat.map_ceil {R : Type u_1} [Semiring R] [LinearOrder R] [FloorSemiring R] {S : Type u_3} [Semiring S] [LinearOrder S] [FloorSemiring S] {F : Type u_4} [FunLike F R S] [RingHomClass F R S] (f : F) (hf : StrictMono f) (a : R) :

There exists at most one FloorSemiring structure on a linear ordered semiring.