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
@[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}
[decidable_linear_ordered_comm_ring α]
[floor_ring α]
{x y : α} :
The fractional part fract r of r is just r - ⌊r⌋
@[simp]
@[simp]
@[simp]
@[simp]
@[simp]
@[simp]
@[simp]
@[simp]
@[simp]
@[simp]
@[simp]
theorem
nat_ceil_add_nat
{α : Type u_1}
[linear_ordered_ring α]
[floor_ring α]
{a : α}
(a_nonneg : 0 ≤ a)
(n : ℕ) :