Theorem: AddCircle.norm_eq
File: Mathlib/Analysis/Normed/Group/AddCircle.lean

tactic: clear! x p
state_before: p x : ℝ
⊢ ∀ (x : ℝ), ‖↑x‖ = abs (x - ↑(round x))

tactic: intros x
state_before: ⊢ ∀ (x : ℝ), ‖↑x‖ = abs (x - ↑(round x))

tactic: rw [quotient_norm_eq, abs_sub_round_eq_min]
state_before: x : ℝ
⊢ ‖↑x‖ = abs (x - ↑(round x))

tactic: have h₁ : BddBelow (abs '' { m : ℝ | (m : AddCircle (1 : ℝ)) = x }) :=
  ⟨0, by simp [mem_lowerBounds]⟩
state_before: x : ℝ
⊢ sInf (norm '' {m | ↑m = ↑x}) = min (fract x) (1 - fract x)

tactic: have h₂ : (abs '' { m : ℝ | (m : AddCircle (1 : ℝ)) = x }).Nonempty := ⟨|x|, ⟨x, rfl, rfl⟩⟩
state_before: x : ℝ
h₁ : BddBelow (abs '' {m | ↑m = ↑x})
⊢ sInf (norm '' {m | ↑m = ↑x}) = min (fract x) (1 - fract x)

tactic: apply le_antisymm
state_before: x : ℝ
h₁ : BddBelow (abs '' {m | ↑m = ↑x})
h₂ : Set.Nonempty (abs '' {m | ↑m = ↑x})
⊢ sInf (norm '' {m | ↑m = ↑x}) = min (fract x) (1 - fract x)

tactic: rcases eq_or_ne p 0 with (rfl | hp)
state_before: p x : ℝ
this : ∀ (x : ℝ), ‖↑x‖ = abs (x - ↑(round x))
⊢ ‖↑x‖ = abs (x - ↑(round (p⁻¹ * x)) * p)

tactic: intros
state_before: case inr
p x : ℝ
this : ∀ (x : ℝ), ‖↑x‖ = abs (x - ↑(round x))
hp : p ≠ 0
⊢ ‖↑x‖ = abs (x - ↑(round (p⁻¹ * x)) * p)

tactic: have hx := norm_coe_mul p x p⁻¹
state_before: case inr
p x : ℝ
this : ∀ (x : ℝ), ‖↑x‖ = abs (x - ↑(round x))
hp : p ≠ 0
⊢ ‖↑x‖ = abs (x - ↑(round (p⁻¹ * x)) * p)

tactic: rw [abs_inv, eq_inv_mul_iff_mul_eq₀ ((not_congr abs_eq_zero).mpr hp)] at hx
state_before: case inr
p x : ℝ
this : ∀ (x : ℝ), ‖↑x‖ = abs (x - ↑(round x))
hp : p ≠ 0
hx : ‖↑(p⁻¹ * x)‖ = abs p⁻¹ * ‖↑x‖
⊢ ‖↑x‖ = abs (x - ↑(round (p⁻¹ * x)) * p)

tactic: rw [← hx, inv_mul_cancel hp, this, ← abs_mul, mul_sub, mul_inv_cancel_left₀ hp, mul_comm p]
state_before: case inr
p x : ℝ
this : ∀ (x : ℝ), ‖↑x‖ = abs (x - ↑(round x))
hp : p ≠ 0
hx : abs p * ‖↑(p⁻¹ * x)‖ = ‖↑x‖
⊢ ‖↑x‖ = abs (x - ↑(round (p⁻¹ * x)) * p)

tactic: simp
state_before: case inl
x : ℝ
this : ∀ (x : ℝ), ‖↑x‖ = abs (x - ↑(round x))
⊢ ‖↑x‖ = abs (x - ↑(round (0⁻¹ * x)) * 0)

tactic: simp [mem_lowerBounds]
state_before: x : ℝ
⊢ 0 ∈ lowerBounds (abs '' {m | ↑m = ↑x})

tactic: simp_rw [Real.norm_eq_abs, csInf_le_iff h₁ h₂, le_min_iff]
state_before: case a
x : ℝ
h₁ : BddBelow (abs '' {m | ↑m = ↑x})
h₂ : Set.Nonempty (abs '' {m | ↑m = ↑x})
⊢ sInf (norm '' {m | ↑m = ↑x}) ≤ min (fract x) (1 - fract x)

tactic: intro b h
state_before: case a
x : ℝ
h₁ : BddBelow (abs '' {m | ↑m = ↑x})
h₂ : Set.Nonempty (abs '' {m | ↑m = ↑x})
⊢ ∀ (b : ℝ), b ∈ lowerBounds (abs '' {m | ↑m = ↑x}) → b ≤ fract x ∧ b ≤ 1 - fract x

tactic: refine'
  ⟨mem_lowerBounds.1 h _ ⟨fract x, _, abs_fract⟩,
    mem_lowerBounds.1 h _ ⟨fract x - 1, _, by rw [abs_sub_comm, abs_one_sub_fract]⟩⟩
state_before: case a
x : ℝ
h₁ : BddBelow (abs '' {m | ↑m = ↑x})
h₂ : Set.Nonempty (abs '' {m | ↑m = ↑x})
b : ℝ
h : b ∈ lowerBounds (abs '' {m | ↑m = ↑x})
⊢ b ≤ fract x ∧ b ≤ 1 - fract x

tactic: rw [abs_sub_comm, abs_one_sub_fract]
state_before: x : ℝ
h₁ : BddBelow (abs '' {m | ↑m = ↑x})
h₂ : Set.Nonempty (abs '' {m | ↑m = ↑x})
b : ℝ
h : b ∈ lowerBounds (abs '' {m | ↑m = ↑x})
⊢ abs (fract x - 1) = 1 - fract x

tactic: simp only [mem_setOf, fract, sub_eq_self, QuotientAddGroup.mk_sub,
  QuotientAddGroup.eq_zero_iff, int_cast_mem_zmultiples_one]
state_before: case a.refine'_1
x : ℝ
h₁ : BddBelow (abs '' {m | ↑m = ↑x})
h₂ : Set.Nonempty (abs '' {m | ↑m = ↑x})
b : ℝ
h : b ∈ lowerBounds (abs '' {m | ↑m = ↑x})
⊢ fract x ∈ {m | ↑m = ↑x}

tactic: simp only [mem_setOf, fract, sub_eq_self, QuotientAddGroup.mk_sub,
  QuotientAddGroup.eq_zero_iff, int_cast_mem_zmultiples_one, sub_sub,
  (by norm_cast : (⌊x⌋ : ℝ) + 1 = (↑(⌊x⌋ + 1) : ℝ))]
state_before: case a.refine'_2
x : ℝ
h₁ : BddBelow (abs '' {m | ↑m = ↑x})
h₂ : Set.Nonempty (abs '' {m | ↑m = ↑x})
b : ℝ
h : b ∈ lowerBounds (abs '' {m | ↑m = ↑x})
⊢ fract x - 1 ∈ {m | ↑m = ↑x}

tactic: norm_cast
state_before: x : ℝ
h₁ : BddBelow (abs '' {m | ↑m = ↑x})
h₂ : Set.Nonempty (abs '' {m | ↑m = ↑x})
b : ℝ
h : b ∈ lowerBounds (abs '' {m | ↑m = ↑x})
⊢ ↑⌊x⌋ + 1 = ↑(⌊x⌋ + 1)

tactic: simp only [QuotientAddGroup.mk'_apply, Real.norm_eq_abs, le_csInf_iff h₁ h₂]
state_before: case a
x : ℝ
h₁ : BddBelow (abs '' {m | ↑m = ↑x})
h₂ : Set.Nonempty (abs '' {m | ↑m = ↑x})
⊢ min (fract x) (1 - fract x) ≤ sInf (norm '' {m | ↑m = ↑x})

tactic: rintro b' ⟨b, hb, rfl⟩
state_before: case a
x : ℝ
h₁ : BddBelow (abs '' {m | ↑m = ↑x})
h₂ : Set.Nonempty (abs '' {m | ↑m = ↑x})
⊢ ∀ (b : ℝ), b ∈ abs '' {m | ↑m = ↑x} → min (fract x) (1 - fract x) ≤ b

tactic: simp only [mem_setOf, QuotientAddGroup.eq_iff_sub_mem, mem_zmultiples_iff,
  smul_one_eq_coe] at hb
state_before: case a.intro.intro
x : ℝ
h₁ : BddBelow (abs '' {m | ↑m = ↑x})
h₂ : Set.Nonempty (abs '' {m | ↑m = ↑x})
b : ℝ
hb : b ∈ {m | ↑m = ↑x}
⊢ min (fract x) (1 - fract x) ≤ abs b

tactic: obtain ⟨z, hz⟩ := hb
state_before: case a.intro.intro
x : ℝ
h₁ : BddBelow (abs '' {m | ↑m = ↑x})
h₂ : Set.Nonempty (abs '' {m | ↑m = ↑x})
b : ℝ
hb : ∃ k, ↑k = b - x
⊢ min (fract x) (1 - fract x) ≤ abs b

tactic: rw [(by rw [hz]; abel : x = b - z), fract_sub_int, ← abs_sub_round_eq_min]
state_before: case a.intro.intro.intro
x : ℝ
h₁ : BddBelow (abs '' {m | ↑m = ↑x})
h₂ : Set.Nonempty (abs '' {m | ↑m = ↑x})
b : ℝ
z : ℤ
hz : ↑z = b - x
⊢ min (fract x) (1 - fract x) ≤ abs b

tactic: convert round_le b 0
state_before: case a.intro.intro.intro
x : ℝ
h₁ : BddBelow (abs '' {m | ↑m = ↑x})
h₂ : Set.Nonempty (abs '' {m | ↑m = ↑x})
b : ℝ
z : ℤ
hz : ↑z = b - x
⊢ abs (b - ↑(round b)) ≤ abs b

tactic: simp
state_before: case h.e'_4.h.e'_3
x : ℝ
h₁ : BddBelow (abs '' {m | ↑m = ↑x})
h₂ : Set.Nonempty (abs '' {m | ↑m = ↑x})
b : ℝ
z : ℤ
hz : ↑z = b - x
⊢ b = b - ↑0

tactic: rw [hz]
state_before: x : ℝ
h₁ : BddBelow (abs '' {m | ↑m = ↑x})
h₂ : Set.Nonempty (abs '' {m | ↑m = ↑x})
b : ℝ
z : ℤ
hz : ↑z = b - x
⊢ x = b - ↑z

tactic: abel
state_before: x : ℝ
h₁ : BddBelow (abs '' {m | ↑m = ↑x})
h₂ : Set.Nonempty (abs '' {m | ↑m = ↑x})
b : ℝ
z : ℤ
hz : ↑z = b - x
⊢ x = b - (b - x)