Theorem: round_eq
File: Mathlib/Algebra/Order/Floor.lean

tactic: simp_rw [round, (by simp only [lt_div_iff', two_pos] : 2 * fract x < 1 ↔ fract x < 1 / 2)]
state_before: F : Type u_1
α : Type u_2
β : Type u_3
inst✝¹ : LinearOrderedField α
inst✝ : FloorRing α
x : α
⊢ round x = ⌊x + 1 / 2⌋
state_after: F : Type u_1
α : Type u_2
β : Type u_3
inst✝¹ : LinearOrderedField α
inst✝ : FloorRing α
x : α
⊢ (if fract x < 1 / 2 then ⌊x⌋ else ⌈x⌉) = ⌊x + 1 / 2⌋

tactic: cases' lt_or_le (fract x) (1 / 2) with hx hx
state_before: F : Type u_1
α : Type u_2
β : Type u_3
inst✝¹ : LinearOrderedField α
inst✝ : FloorRing α
x : α
⊢ (if fract x < 1 / 2 then ⌊x⌋ else ⌈x⌉) = ⌊x + 1 / 2⌋
state_after: case inl
F : Type u_1
α : Type u_2
β : Type u_3
inst✝¹ : LinearOrderedField α
inst✝ : FloorRing α
x : α
hx : fract x < 1 / 2
⊢ (if fract x < 1 / 2 then ⌊x⌋ else ⌈x⌉) = ⌊x + 1 / 2⌋

case inr
F : Type u_1
α : Type u_2
β : Type u_3
inst✝¹ : LinearOrderedField α
inst✝ : FloorRing α
x : α
hx : 1 / 2 ≤ fract x
⊢ (if fract x < 1 / 2 then ⌊x⌋ else ⌈x⌉) = ⌊x + 1 / 2⌋

tactic: simp only [lt_div_iff', two_pos]
state_before: F : Type u_1
α : Type u_2
β : Type u_3
inst✝¹ : LinearOrderedField α
inst✝ : FloorRing α
x : α
⊢ 2 * fract x < 1 ↔ fract x < 1 / 2
state_after: no goals

tactic: conv_rhs => rw [← fract_add_floor x, add_assoc, add_left_comm, floor_int_add]
state_before: case inl
F : Type u_1
α : Type u_2
β : Type u_3
inst✝¹ : LinearOrderedField α
inst✝ : FloorRing α
x : α
hx : fract x < 1 / 2
⊢ (if fract x < 1 / 2 then ⌊x⌋ else ⌈x⌉) = ⌊x + 1 / 2⌋
state_after: case inl
F : Type u_1
α : Type u_2
β : Type u_3
inst✝¹ : LinearOrderedField α
inst✝ : FloorRing α
x : α
hx : fract x < 1 / 2
⊢ (if fract x < 1 / 2 then ⌊x⌋ else ⌈x⌉) = ⌊x⌋ + ⌊fract x + 1 / 2⌋

tactic: rw [if_pos hx, self_eq_add_right, floor_eq_iff, cast_zero, zero_add]
state_before: case inl
F : Type u_1
α : Type u_2
β : Type u_3
inst✝¹ : LinearOrderedField α
inst✝ : FloorRing α
x : α
hx : fract x < 1 / 2
⊢ (if fract x < 1 / 2 then ⌊x⌋ else ⌈x⌉) = ⌊x⌋ + ⌊fract x + 1 / 2⌋
state_after: case inl
F : Type u_1
α : Type u_2
β : Type u_3
inst✝¹ : LinearOrderedField α
inst✝ : FloorRing α
x : α
hx : fract x < 1 / 2
⊢ 0 ≤ fract x + 1 / 2 ∧ fract x + 1 / 2 < 1

tactic: constructor
state_before: case inl
F : Type u_1
α : Type u_2
β : Type u_3
inst✝¹ : LinearOrderedField α
inst✝ : FloorRing α
x : α
hx : fract x < 1 / 2
⊢ 0 ≤ fract x + 1 / 2 ∧ fract x + 1 / 2 < 1
state_after: case inl.left
F : Type u_1
α : Type u_2
β : Type u_3
inst✝¹ : LinearOrderedField α
inst✝ : FloorRing α
x : α
hx : fract x < 1 / 2
⊢ 0 ≤ fract x + 1 / 2

case inl.right
F : Type u_1
α : Type u_2
β : Type u_3
inst✝¹ : LinearOrderedField α
inst✝ : FloorRing α
x : α
hx : fract x < 1 / 2
⊢ fract x + 1 / 2 < 1

tactic: linarith [fract_nonneg x]
state_before: case inl.left
F : Type u_1
α : Type u_2
β : Type u_3
inst✝¹ : LinearOrderedField α
inst✝ : FloorRing α
x : α
hx : fract x < 1 / 2
⊢ 0 ≤ fract x + 1 / 2
state_after: no goals

tactic: linarith
state_before: case inl.right
F : Type u_1
α : Type u_2
β : Type u_3
inst✝¹ : LinearOrderedField α
inst✝ : FloorRing α
x : α
hx : fract x < 1 / 2
⊢ fract x + 1 / 2 < 1
state_after: no goals

tactic: rw [if_neg (not_lt.mpr hx), ← fract_add_floor x, add_assoc, add_left_comm, floor_int_add,
  ceil_add_int, add_comm _ ⌊x⌋, add_right_inj, ceil_eq_iff, this, cast_one, sub_self]
state_before: case inr
F : Type u_1
α : Type u_2
β : Type u_3
inst✝¹ : LinearOrderedField α
inst✝ : FloorRing α
x : α
hx : 1 / 2 ≤ fract x
this : ⌊fract x + 1 / 2⌋ = 1
⊢ (if fract x < 1 / 2 then ⌊x⌋ else ⌈x⌉) = ⌊x + 1 / 2⌋
state_after: case inr
F : Type u_1
α : Type u_2
β : Type u_3
inst✝¹ : LinearOrderedField α
inst✝ : FloorRing α
x : α
hx : 1 / 2 ≤ fract x
this : ⌊fract x + 1 / 2⌋ = 1
⊢ 0 < fract x ∧ fract x ≤ 1

tactic: constructor
state_before: case inr
F : Type u_1
α : Type u_2
β : Type u_3
inst✝¹ : LinearOrderedField α
inst✝ : FloorRing α
x : α
hx : 1 / 2 ≤ fract x
this : ⌊fract x + 1 / 2⌋ = 1
⊢ 0 < fract x ∧ fract x ≤ 1
state_after: case inr.left
F : Type u_1
α : Type u_2
β : Type u_3
inst✝¹ : LinearOrderedField α
inst✝ : FloorRing α
x : α
hx : 1 / 2 ≤ fract x
this : ⌊fract x + 1 / 2⌋ = 1
⊢ 0 < fract x

case inr.right
F : Type u_1
α : Type u_2
β : Type u_3
inst✝¹ : LinearOrderedField α
inst✝ : FloorRing α
x : α
hx : 1 / 2 ≤ fract x
this : ⌊fract x + 1 / 2⌋ = 1
⊢ fract x ≤ 1

tactic: rw [floor_eq_iff]
state_before: F : Type u_1
α : Type u_2
β : Type u_3
inst✝¹ : LinearOrderedField α
inst✝ : FloorRing α
x : α
hx : 1 / 2 ≤ fract x
⊢ ⌊fract x + 1 / 2⌋ = 1
state_after: F : Type u_1
α : Type u_2
β : Type u_3
inst✝¹ : LinearOrderedField α
inst✝ : FloorRing α
x : α
hx : 1 / 2 ≤ fract x
⊢ ↑1 ≤ fract x + 1 / 2 ∧ fract x + 1 / 2 < ↑1 + 1

tactic: constructor
state_before: F : Type u_1
α : Type u_2
β : Type u_3
inst✝¹ : LinearOrderedField α
inst✝ : FloorRing α
x : α
hx : 1 / 2 ≤ fract x
⊢ ↑1 ≤ fract x + 1 / 2 ∧ fract x + 1 / 2 < ↑1 + 1
state_after: case left
F : Type u_1
α : Type u_2
β : Type u_3
inst✝¹ : LinearOrderedField α
inst✝ : FloorRing α
x : α
hx : 1 / 2 ≤ fract x
⊢ ↑1 ≤ fract x + 1 / 2

case right
F : Type u_1
α : Type u_2
β : Type u_3
inst✝¹ : LinearOrderedField α
inst✝ : FloorRing α
x : α
hx : 1 / 2 ≤ fract x
⊢ fract x + 1 / 2 < ↑1 + 1

tactic: norm_num
state_before: case left
F : Type u_1
α : Type u_2
β : Type u_3
inst✝¹ : LinearOrderedField α
inst✝ : FloorRing α
x : α
hx : 1 / 2 ≤ fract x
⊢ ↑1 ≤ fract x + 1 / 2
state_after: case left
F : Type u_1
α : Type u_2
β : Type u_3
inst✝¹ : LinearOrderedField α
inst✝ : FloorRing α
x : α
hx : 1 / 2 ≤ fract x
⊢ 1 ≤ fract x + 1 / 2

tactic: linarith
state_before: case left
F : Type u_1
α : Type u_2
β : Type u_3
inst✝¹ : LinearOrderedField α
inst✝ : FloorRing α
x : α
hx : 1 / 2 ≤ fract x
⊢ 1 ≤ fract x + 1 / 2
state_after: no goals

tactic: norm_num
state_before: case right
F : Type u_1
α : Type u_2
β : Type u_3
inst✝¹ : LinearOrderedField α
inst✝ : FloorRing α
x : α
hx : 1 / 2 ≤ fract x
⊢ fract x + 1 / 2 < ↑1 + 1
state_after: case right
F : Type u_1
α : Type u_2
β : Type u_3
inst✝¹ : LinearOrderedField α
inst✝ : FloorRing α
x : α
hx : 1 / 2 ≤ fract x
⊢ fract x + 1 / 2 < 2

tactic: linarith [fract_lt_one x]
state_before: case right
F : Type u_1
α : Type u_2
β : Type u_3
inst✝¹ : LinearOrderedField α
inst✝ : FloorRing α
x : α
hx : 1 / 2 ≤ fract x
⊢ fract x + 1 / 2 < 2
state_after: no goals

tactic: linarith
state_before: case inr.left
F : Type u_1
α : Type u_2
β : Type u_3
inst✝¹ : LinearOrderedField α
inst✝ : FloorRing α
x : α
hx : 1 / 2 ≤ fract x
this : ⌊fract x + 1 / 2⌋ = 1
⊢ 0 < fract x
state_after: no goals

tactic: linarith [fract_lt_one x]
state_before: case inr.right
F : Type u_1
α : Type u_2
β : Type u_3
inst✝¹ : LinearOrderedField α
inst✝ : FloorRing α
x : α
hx : 1 / 2 ≤ fract x
this : ⌊fract x + 1 / 2⌋ = 1
⊢ fract x ≤ 1
state_after: no goals