Documentation

Mathlib.Algebra.Order.Floor.Semiring

Lemmas on Nat.floor and Nat.ceil for semirings #

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

TODO #

LinearOrder can be relaxed to PartialOrder 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 : ℕ} (h : ⌊a⌋₊ < n) :
a < ↑n
theorem Nat.lt_one_of_floor_lt_one {R : Type u_1} [Semiring R] [LinearOrder R] [FloorSemiring R] {a : R} (h : ⌊a⌋₊ < 1) :
a < 1
theorem Nat.lt_succ_floor {R : Type u_1} [Semiring R] [LinearOrder R] [FloorSemiring R] (a : R) :
theorem Nat.lt_floor_add_one {R : Type u_1} [Semiring R] [LinearOrder R] [FloorSemiring R] (a : R) :
a < ↑⌊a⌋₊ + 1
@[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)
theorem Nat.mul_cast_floor_div_cancel {R : Type u_1} [Semiring R] [LinearOrder R] [FloorSemiring R] [IsStrictOrderedRing R] {n : ℕ} (hn : n ≠ 0) (a : R) :
theorem Nat.cast_mul_floor_div_cancel {R : Type u_1} [Semiring R] [LinearOrder R] [FloorSemiring R] [IsStrictOrderedRing R] {n : ℕ} (hn : n ≠ 0) (a : R) :

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]
theorem Nat.ceil_intCast {R : Type u_2} [Ring R] [LinearOrder R] [IsOrderedRing R] [FloorSemiring R] (z : ℤ) :
@[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 : ℕ) :
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 : ℕ) :
theorem Nat.ceil_add_natCast {R : Type u_1} [Semiring R] [LinearOrder R] [FloorSemiring R] {a : R} [IsStrictOrderedRing R] (ha : 0 ≤ a) (n : ℕ) :
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
@[simp]
theorem Nat.ceil_sub_natCast {R : Type u_1} [Semiring R] [LinearOrder R] [FloorSemiring R] [IsStrictOrderedRing R] [Sub R] [OrderedSub R] [ExistsAddOfLE R] (a : R) (n : ℕ) :
theorem Nat.sub_one_lt_floor {R : Type u_1} [Ring R] [LinearOrder R] [IsStrictOrderedRing R] [FloorSemiring R] (a : R) :
a - 1 < ↑⌊a⌋₊
theorem Nat.zero_le_self_sub_floor {R : Type u_1} [Ring R] [LinearOrder R] [IsStrictOrderedRing R] [FloorSemiring R] {a : R} (ha : 0 ≤ a) :
0 ≤ a - ↑⌊a⌋₊
theorem Nat.abs_sub_floor_le {R : Type u_1} [Ring R] [LinearOrder R] [IsStrictOrderedRing R] [FloorSemiring R] {a : R} (ha : 0 ≤ a) :
|a - ↑⌊a⌋₊| ≤ 1
theorem Nat.abs_floor_sub_le {R : Type u_1} [Ring R] [LinearOrder R] [IsStrictOrderedRing R] [FloorSemiring R] {a : R} (ha : 0 ≤ a) :
|↑⌊a⌋₊ - a| ≤ 1
theorem Nat.abs_sub_ceil_le {R : Type u_1} [Ring R] [LinearOrder R] [IsStrictOrderedRing R] [FloorSemiring R] {a : R} (ha : 0 ≤ a) :
|a - ↑⌈a⌉₊| ≤ 1
theorem Nat.abs_ceil_sub_le {R : Type u_1} [Ring R] [LinearOrder R] [IsStrictOrderedRing R] [FloorSemiring R] {a : R} (ha : 0 ≤ a) :
|↑⌈a⌉₊ - a| ≤ 1
theorem Nat.floor_congr {R : Type u_1} [Semiring R] [LinearOrder R] [FloorSemiring R] {a : R} {S : Type u_2} [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_2} [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_2} [Semiring S] [LinearOrder S] [FloorSemiring S] {F : Type u_3} [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_2} [Semiring S] [LinearOrder S] [FloorSemiring S] {F : Type u_3} [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.