Floor and Ceil #
Summary #
We define floor, ceil, and nat_ceil functions on linear ordered rings.
Main Definitions #
floor_ringis a linear ordered ring with floor function.floor xis the greatest integerzsuch thatz ≤ x.fract xis the fractional part of x, that isx - floor x.ceil xis the smallest integerzsuch thatx ≤ z.nat_ceil xis the smallest nonnegative integernwithx ≤ n.
Notations #
Tags #
rounding
@[class]
A floor_ring is a linear ordered ring over α with a function
floor : α → ℤ satisfying ∀ (z : ℤ) (x : α), z ≤ floor x ↔ (z : α) ≤ x).
Instances
@[protected, instance]
floor x is the greatest integer z such that z ≤ x
Equations
@[simp]
@[simp]
theorem
abs_sub_lt_one_of_floor_eq_floor
{α : Type u_1}
[linear_ordered_comm_ring α]
[floor_ring α]
{x y : α}
(h : ⌊x⌋ = ⌊y⌋) :
theorem
floor_eq_on_Ico
{α : Type u_1}
[linear_ordered_ring α]
[floor_ring α]
(n : ℤ)
(x : α)
(H : x ∈ set.Ico ↑n (↑n + 1)) :
theorem
floor_eq_on_Ico'
{α : Type u_1}
[linear_ordered_ring α]
[floor_ring α]
(n : ℤ)
(x : α)
(H : x ∈ set.Ico ↑n (↑n + 1)) :
The fractional part fract r of r is just r - ⌊r⌋
@[simp]
@[simp]
@[simp]
@[simp]
@[simp]
@[simp]
@[simp]
@[simp]
@[simp]
theorem
ceil_eq_on_Ioc
{α : Type u_1}
[linear_ordered_ring α]
[floor_ring α]
(n : ℤ)
(x : α)
(H : x ∈ set.Ioc (↑n - 1) ↑n) :
theorem
ceil_eq_on_Ioc'
{α : Type u_1}
[linear_ordered_ring α]
[floor_ring α]
(n : ℤ)
(x : α)
(H : x ∈ set.Ioc (↑n - 1) ↑n) :
theorem
nat_ceil_mono
{α : Type u_1}
[linear_ordered_ring α]
[floor_ring α]
{a₁ a₂ : α}
(h : a₁ ≤ a₂) :
@[simp]
@[simp]
theorem
nat_ceil_add_nat
{α : Type u_1}
[linear_ordered_ring α]
[floor_ring α]
{a : α}
(a_nonneg : 0 ≤ a)
(n : ℕ) :
theorem
nat_ceil_lt_add_one
{α : Type u_1}
[linear_ordered_ring α]
[floor_ring α]
{a : α}
(a_nonneg : 0 ≤ a) :
theorem
lt_of_nat_ceil_lt
{α : Type u_1}
[linear_ordered_ring α]
[floor_ring α]
{x : α}
{n : ℕ}
(h : nat_ceil x < n) :
theorem
le_of_nat_ceil_le
{α : Type u_1}
[linear_ordered_ring α]
[floor_ring α]
{x : α}
{n : ℕ}
(h : nat_ceil x ≤ n) :
@[simp]
@[simp]
@[simp]
@[simp]
@[simp]
@[simp]
@[simp]
@[simp]