Theorem: Int.fract_eq_zero_or_add_one_sub_ceil
File: Mathlib/Algebra/Order/Floor.lean

tactic: rcases eq_or_ne (fract a) 0 with ha | ha
state_before: F : Type u_1
α : Type u_2
β : Type u_3
inst✝¹ : LinearOrderedRing α
inst✝ : FloorRing α
z : ℤ
a✝ a : α
⊢ fract a = 0 ∨ fract a = a + 1 - ↑⌈a⌉
state_after: case inl
F : Type u_1
α : Type u_2
β : Type u_3
inst✝¹ : LinearOrderedRing α
inst✝ : FloorRing α
z : ℤ
a✝ a : α
ha : fract a = 0
⊢ fract a = 0 ∨ fract a = a + 1 - ↑⌈a⌉

case inr
F : Type u_1
α : Type u_2
β : Type u_3
inst✝¹ : LinearOrderedRing α
inst✝ : FloorRing α
z : ℤ
a✝ a : α
ha : fract a ≠ 0
⊢ fract a = 0 ∨ fract a = a + 1 - ↑⌈a⌉

tactic: right
state_before: case inr
F : Type u_1
α : Type u_2
β : Type u_3
inst✝¹ : LinearOrderedRing α
inst✝ : FloorRing α
z : ℤ
a✝ a : α
ha : fract a ≠ 0
⊢ fract a = 0 ∨ fract a = a + 1 - ↑⌈a⌉
state_after: case inr.h
F : Type u_1
α : Type u_2
β : Type u_3
inst✝¹ : LinearOrderedRing α
inst✝ : FloorRing α
z : ℤ
a✝ a : α
ha : fract a ≠ 0
⊢ fract a = a + 1 - ↑⌈a⌉

tactic: suffices (⌈a⌉ : α) = ⌊a⌋ + 1 by
  rw [this, ← self_sub_fract]
  abel
state_before: case inr.h
F : Type u_1
α : Type u_2
β : Type u_3
inst✝¹ : LinearOrderedRing α
inst✝ : FloorRing α
z : ℤ
a✝ a : α
ha : fract a ≠ 0
⊢ fract a = a + 1 - ↑⌈a⌉
state_after: case inr.h
F : Type u_1
α : Type u_2
β : Type u_3
inst✝¹ : LinearOrderedRing α
inst✝ : FloorRing α
z : ℤ
a✝ a : α
ha : fract a ≠ 0
⊢ ↑⌈a⌉ = ↑⌊a⌋ + 1

tactic: norm_cast
state_before: case inr.h
F : Type u_1
α : Type u_2
β : Type u_3
inst✝¹ : LinearOrderedRing α
inst✝ : FloorRing α
z : ℤ
a✝ a : α
ha : fract a ≠ 0
⊢ ↑⌈a⌉ = ↑⌊a⌋ + 1
state_after: case inr.h
F : Type u_1
α : Type u_2
β : Type u_3
inst✝¹ : LinearOrderedRing α
inst✝ : FloorRing α
z : ℤ
a✝ a : α
ha : fract a ≠ 0
⊢ ⌈a⌉ = ⌊a⌋ + 1

tactic: rw [ceil_eq_iff]
state_before: case inr.h
F : Type u_1
α : Type u_2
β : Type u_3
inst✝¹ : LinearOrderedRing α
inst✝ : FloorRing α
z : ℤ
a✝ a : α
ha : fract a ≠ 0
⊢ ⌈a⌉ = ⌊a⌋ + 1
state_after: case inr.h
F : Type u_1
α : Type u_2
β : Type u_3
inst✝¹ : LinearOrderedRing α
inst✝ : FloorRing α
z : ℤ
a✝ a : α
ha : fract a ≠ 0
⊢ ↑(⌊a⌋ + 1) - 1 < a ∧ a ≤ ↑(⌊a⌋ + 1)

tactic: refine ⟨?_, _root_.le_of_lt <| by simp⟩
state_before: case inr.h
F : Type u_1
α : Type u_2
β : Type u_3
inst✝¹ : LinearOrderedRing α
inst✝ : FloorRing α
z : ℤ
a✝ a : α
ha : fract a ≠ 0
⊢ ↑(⌊a⌋ + 1) - 1 < a ∧ a ≤ ↑(⌊a⌋ + 1)
state_after: case inr.h
F : Type u_1
α : Type u_2
β : Type u_3
inst✝¹ : LinearOrderedRing α
inst✝ : FloorRing α
z : ℤ
a✝ a : α
ha : fract a ≠ 0
⊢ ↑(⌊a⌋ + 1) - 1 < a

tactic: rw [cast_add, cast_one, add_tsub_cancel_right, ← self_sub_fract a, sub_lt_self_iff]
state_before: case inr.h
F : Type u_1
α : Type u_2
β : Type u_3
inst✝¹ : LinearOrderedRing α
inst✝ : FloorRing α
z : ℤ
a✝ a : α
ha : fract a ≠ 0
⊢ ↑(⌊a⌋ + 1) - 1 < a
state_after: case inr.h
F : Type u_1
α : Type u_2
β : Type u_3
inst✝¹ : LinearOrderedRing α
inst✝ : FloorRing α
z : ℤ
a✝ a : α
ha : fract a ≠ 0
⊢ 0 < fract a

tactic: exact ha.symm.lt_of_le (fract_nonneg a)
state_before: case inr.h
F : Type u_1
α : Type u_2
β : Type u_3
inst✝¹ : LinearOrderedRing α
inst✝ : FloorRing α
z : ℤ
a✝ a : α
ha : fract a ≠ 0
⊢ 0 < fract a
state_after: no goals

tactic: exact Or.inl ha
state_before: case inl
F : Type u_1
α : Type u_2
β : Type u_3
inst✝¹ : LinearOrderedRing α
inst✝ : FloorRing α
z : ℤ
a✝ a : α
ha : fract a = 0
⊢ fract a = 0 ∨ fract a = a + 1 - ↑⌈a⌉
state_after: no goals

tactic: rw [this, ← self_sub_fract]
state_before: F : Type u_1
α : Type u_2
β : Type u_3
inst✝¹ : LinearOrderedRing α
inst✝ : FloorRing α
z : ℤ
a✝ a : α
ha : fract a ≠ 0
this : ↑⌈a⌉ = ↑⌊a⌋ + 1
⊢ fract a = a + 1 - ↑⌈a⌉
state_after: F : Type u_1
α : Type u_2
β : Type u_3
inst✝¹ : LinearOrderedRing α
inst✝ : FloorRing α
z : ℤ
a✝ a : α
ha : fract a ≠ 0
this : ↑⌈a⌉ = ↑⌊a⌋ + 1
⊢ fract a = a + 1 - (a - fract a + 1)

tactic: abel
state_before: F : Type u_1
α : Type u_2
β : Type u_3
inst✝¹ : LinearOrderedRing α
inst✝ : FloorRing α
z : ℤ
a✝ a : α
ha : fract a ≠ 0
this : ↑⌈a⌉ = ↑⌊a⌋ + 1
⊢ fract a = a + 1 - (a - fract a + 1)
state_after: no goals

tactic: simp
state_before: F : Type u_1
α : Type u_2
β : Type u_3
inst✝¹ : LinearOrderedRing α
inst✝ : FloorRing α
z : ℤ
a✝ a : α
ha : fract a ≠ 0
⊢ a < ↑(⌊a⌋ + 1)
state_after: no goals