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

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

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

tactic: rw [quotient_norm_eq, abs_sub_round_eq_min]
state_before: x : ℝ
⊢ ‖↑x‖ = |x - ↑(round x)|
state_after: x : ℝ
⊢ sInf (norm '' {m | ↑m = ↑x}) = min (fract x) (1 - fract 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)
state_after: x : ℝ
h₁ : BddBelow (abs '' {m | ↑m = ↑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)
state_after: x : ℝ
h₁ : BddBelow (abs '' {m | ↑m = ↑x})
h₂ : (abs '' {m | ↑m = ↑x}).Nonempty
⊢ 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₂ : (abs '' {m | ↑m = ↑x}).Nonempty
⊢ sInf (norm '' {m | ↑m = ↑x}) = min (fract x) (1 - fract x)
state_after: case a
x : ℝ
h₁ : BddBelow (abs '' {m | ↑m = ↑x})
h₂ : (abs '' {m | ↑m = ↑x}).Nonempty
⊢ sInf (norm '' {m | ↑m = ↑x}) ≤ min (fract x) (1 - fract x)

case a
x : ℝ
h₁ : BddBelow (abs '' {m | ↑m = ↑x})
h₂ : (abs '' {m | ↑m = ↑x}).Nonempty
⊢ min (fract x) (1 - fract x) ≤ sInf (norm '' {m | ↑m = ↑x})

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

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

tactic: have hx := norm_coe_mul p x p⁻¹
state_before: case inr
p x : ℝ
this : ∀ (x : ℝ), ‖↑x‖ = |x - ↑(round x)|
hp : p ≠ 0
⊢ ‖↑x‖ = |x - ↑(round (p⁻¹ * x)) * p|
state_after: case inr
p x : ℝ
this : ∀ (x : ℝ), ‖↑x‖ = |x - ↑(round x)|
hp : p ≠ 0
hx : ‖↑(p⁻¹ * x)‖ = |p⁻¹| * ‖↑x‖
⊢ ‖↑x‖ = |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‖ = |x - ↑(round x)|
hp : p ≠ 0
hx : ‖↑(p⁻¹ * x)‖ = |p⁻¹| * ‖↑x‖
⊢ ‖↑x‖ = |x - ↑(round (p⁻¹ * x)) * p|
state_after: case inr
p x : ℝ
this : ∀ (x : ℝ), ‖↑x‖ = |x - ↑(round x)|
hp : p ≠ 0
hx : |p| * ‖↑(p⁻¹ * x)‖ = ‖↑x‖
⊢ ‖↑x‖ = |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‖ = |x - ↑(round x)|
hp : p ≠ 0
hx : |p| * ‖↑(p⁻¹ * x)‖ = ‖↑x‖
⊢ ‖↑x‖ = |x - ↑(round (p⁻¹ * x)) * p|
state_after: no goals

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

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

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₂ : (abs '' {m | ↑m = ↑x}).Nonempty
⊢ sInf (norm '' {m | ↑m = ↑x}) ≤ min (fract x) (1 - fract x)
state_after: case a
x : ℝ
h₁ : BddBelow (abs '' {m | ↑m = ↑x})
h₂ : (abs '' {m | ↑m = ↑x}).Nonempty
⊢ ∀ b ∈ lowerBounds (abs '' {m | ↑m = ↑x}), b ≤ fract x ∧ b ≤ 1 - fract x

tactic: intro b h
state_before: case a
x : ℝ
h₁ : BddBelow (abs '' {m | ↑m = ↑x})
h₂ : (abs '' {m | ↑m = ↑x}).Nonempty
⊢ ∀ b ∈ lowerBounds (abs '' {m | ↑m = ↑x}), b ≤ fract x ∧ b ≤ 1 - fract x
state_after: case a
x : ℝ
h₁ : BddBelow (abs '' {m | ↑m = ↑x})
h₂ : (abs '' {m | ↑m = ↑x}).Nonempty
b : ℝ
h : 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₂ : (abs '' {m | ↑m = ↑x}).Nonempty
b : ℝ
h : b ∈ lowerBounds (abs '' {m | ↑m = ↑x})
⊢ b ≤ fract x ∧ b ≤ 1 - fract x
state_after: case a.refine_1
x : ℝ
h₁ : BddBelow (abs '' {m | ↑m = ↑x})
h₂ : (abs '' {m | ↑m = ↑x}).Nonempty
b : ℝ
h : b ∈ lowerBounds (abs '' {m | ↑m = ↑x})
⊢ fract x ∈ {m | ↑m = ↑x}

case a.refine_2
x : ℝ
h₁ : BddBelow (abs '' {m | ↑m = ↑x})
h₂ : (abs '' {m | ↑m = ↑x}).Nonempty
b : ℝ
h : b ∈ lowerBounds (abs '' {m | ↑m = ↑x})
⊢ fract x - 1 ∈ {m | ↑m = ↑x}

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

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

tactic: simp only [mem_setOf, fract, sub_eq_self, QuotientAddGroup.mk_sub,
  QuotientAddGroup.eq_zero_iff, intCast_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₂ : (abs '' {m | ↑m = ↑x}).Nonempty
b : ℝ
h : b ∈ lowerBounds (abs '' {m | ↑m = ↑x})
⊢ fract x - 1 ∈ {m | ↑m = ↑x}
state_after: no goals

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

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₂ : (abs '' {m | ↑m = ↑x}).Nonempty
⊢ min (fract x) (1 - fract x) ≤ sInf (norm '' {m | ↑m = ↑x})
state_after: case a
x : ℝ
h₁ : BddBelow (abs '' {m | ↑m = ↑x})
h₂ : (abs '' {m | ↑m = ↑x}).Nonempty
⊢ ∀ b ∈ abs '' {m | ↑m = ↑x}, min (fract x) (1 - fract x) ≤ b

tactic: rintro b' ⟨b, hb, rfl⟩
state_before: case a
x : ℝ
h₁ : BddBelow (abs '' {m | ↑m = ↑x})
h₂ : (abs '' {m | ↑m = ↑x}).Nonempty
⊢ ∀ b ∈ abs '' {m | ↑m = ↑x}, min (fract x) (1 - fract x) ≤ b
state_after: case a.intro.intro
x : ℝ
h₁ : BddBelow (abs '' {m | ↑m = ↑x})
h₂ : (abs '' {m | ↑m = ↑x}).Nonempty
b : ℝ
hb : b ∈ {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_cast] at hb
state_before: case a.intro.intro
x : ℝ
h₁ : BddBelow (abs '' {m | ↑m = ↑x})
h₂ : (abs '' {m | ↑m = ↑x}).Nonempty
b : ℝ
hb : b ∈ {m | ↑m = ↑x}
⊢ min (fract x) (1 - fract x) ≤ |b|
state_after: case a.intro.intro
x : ℝ
h₁ : BddBelow (abs '' {m | ↑m = ↑x})
h₂ : (abs '' {m | ↑m = ↑x}).Nonempty
b : ℝ
hb : ∃ k, ↑k = b - x
⊢ min (fract x) (1 - fract x) ≤ |b|

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

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

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

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

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