Skip to content

Commit 47ede36

Browse files
feat: a few Int.floor/Int.fract lemmas (leanprover-community#33408)
From sphere-eversion. Co-authored-by: Patrick Massot <patrickmassot@free.fr>
1 parent dc03377 commit 47ede36

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

Mathlib/Algebra/Order/Floor/Ring.lean

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -256,6 +256,9 @@ theorem abs_sub_lt_one_of_floor_eq_floor {R : Type*}
256256
lemma floor_eq_self_iff_mem (a : R) : ⌊a⌋ = a ↔ a ∈ Set.range Int.cast := by
257257
aesop
258258

259+
theorem floor_lt_self_iff {a : R} : ⌊a⌋ < a ↔ a ∉ range Int.cast :=
260+
(floor_le a).lt_iff_ne.trans <| (floor_eq_self_iff_mem _).not
261+
259262
section LinearOrderedRing
260263
variable {R : Type*} [Ring R] [LinearOrder R] [IsStrictOrderedRing R] [FloorRing R] {a b : R}
261264

@@ -452,6 +455,12 @@ theorem fract_eq_self {a : R} : fract a = a ↔ 0 ≤ a ∧ a < 1 :=
452455
theorem fract_fract (a : R) : fract (fract a) = fract a :=
453456
fract_eq_self.2 ⟨fract_nonneg _, fract_lt_one _⟩
454457

458+
theorem fract_eq_zero_iff {a : R} : fract a = 0 ↔ a ∈ range Int.cast := by
459+
simp [fract_eq_iff, eq_comm]
460+
461+
theorem fract_ne_zero_iff {a : R} : fract a ≠ 0 ↔ a ∉ range Int.cast :=
462+
fract_eq_zero_iff.not
463+
455464
theorem fract_neg {x : R} (hx : fract x ≠ 0) : fract (-x) = 1 - fract x := by
456465
rw [fract_eq_iff]
457466
constructor

0 commit comments

Comments
 (0)