l3lab/ntp-mathlib huggingface dataset:
/-- The product of two `TopologicalSpace.PositiveCompacts`, as a `TopologicalSpace.PositiveCompacts`
in the product space. -/
protected def prod (K : PositiveCompacts α) (L : PositiveCompacts β) :
    PositiveCompacts (α × β) where
  toCompacts := K.toCompacts.prod L.toCompacts
  interior_nonempty' := by
    simp only [Compacts.carrier_eq_coe, Compacts.coe_prod, interior_prod_eq]
    

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
inst✝² : TopologicalSpace α
inst✝¹ : TopologicalSpace β
inst✝ : TopologicalSpace γ
K : PositiveCompacts α
L : PositiveCompacts β
⊢ Set.Nonempty (interior ↑K.toCompacts ×ˢ interior ↑L.toCompacts)

Next tactic:
exact K.interior_nonempty.prod L.interior_nonempty
instance : SetLike (CompactOpens α) α where
  coe s := s.carrier
  coe_injective' s t h := by
    

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
inst✝² : TopologicalSpace α
inst✝¹ : TopologicalSpace β
inst✝ : TopologicalSpace γ
s t : CompactOpens α
h : (fun s => s.carrier) s = (fun s => s.carrier) t
⊢ s = t

Next tactic:
obtain ⟨⟨_, _⟩, _⟩ := s
instance : SetLike (CompactOpens α) α where
  coe s := s.carrier
  coe_injective' s t h := by
    obtain ⟨⟨_, _⟩, _⟩ := s
    

Proof state:
case mk.mk
α : Type u_1
β : Type u_2
γ : Type u_3
inst✝² : TopologicalSpace α
inst✝¹ : TopologicalSpace β
inst✝ : TopologicalSpace γ
t : CompactOpens α
carrier✝ : Set α
isCompact'✝ : IsCompact carrier✝
isOpen'✝ : IsOpen { carrier := carrier✝, isCompact' := isCompact'✝ }.carrier
h :
  (fun s => s.carrier) { toCompacts := { carrier := carrier✝, isCompact' := isCompact'✝ }, isOpen' := isOpen'✝ } =
    (fun s => s.carrier) t
⊢ { toCompacts := { carrier := carrier✝, isCompact' := isCompact'✝ }, isOpen' := isOpen'✝ } = t

Next tactic:
obtain ⟨⟨_, _⟩, _⟩ := t
instance : SetLike (CompactOpens α) α where
  coe s := s.carrier
  coe_injective' s t h := by
    obtain ⟨⟨_, _⟩, _⟩ := s
    obtain ⟨⟨_, _⟩, _⟩ := t
    

Proof state:
case mk.mk.mk.mk
α : Type u_1
β : Type u_2
γ : Type u_3
inst✝² : TopologicalSpace α
inst✝¹ : TopologicalSpace β
inst✝ : TopologicalSpace γ
carrier✝¹ : Set α
isCompact'✝¹ : IsCompact carrier✝¹
isOpen'✝¹ : IsOpen { carrier := carrier✝¹, isCompact' := isCompact'✝¹ }.carrier
carrier✝ : Set α
isCompact'✝ : IsCompact carrier✝
isOpen'✝ : IsOpen { carrier := carrier✝, isCompact' := isCompact'✝ }.carrier
h :
  (fun s => s.carrier) { toCompacts := { carrier := carrier✝¹, isCompact' := isCompact'✝¹ }, isOpen' := isOpen'✝¹ } =
    (fun s => s.carrier) { toCompacts := { carrier := carrier✝, isCompact' := isCompact'✝ }, isOpen' := isOpen'✝ }
⊢ { toCompacts := { carrier := carrier✝¹, isCompact' := isCompact'✝¹ }, isOpen' := isOpen'✝¹ } =
    { toCompacts := { carrier := carrier✝, isCompact' := isCompact'✝ }, isOpen' := isOpen'✝ }

Next tactic:
congr
theorem Real.uniformContinuous_neg : UniformContinuous (@Neg.neg ℝ _) :=
  Metric.uniformContinuous_iff.2 fun ε ε0 =>
    ⟨_, ε0, fun h => by 

Proof state:
α : Type u
β : Type v
γ : Type w
ε : ℝ
ε0 : ε > 0
a✝ b✝ : ℝ
h : dist a✝ b✝ < ε
⊢ dist (-a✝) (-b✝) < ε

Next tactic:
rw [dist_comm] at h
theorem Real.uniformContinuous_neg : UniformContinuous (@Neg.neg ℝ _) :=
  Metric.uniformContinuous_iff.2 fun ε ε0 =>
    ⟨_, ε0, fun h => by rw [dist_comm] at h; 

Proof state:
α : Type u
β : Type v
γ : Type w
ε : ℝ
ε0 : ε > 0
a✝ b✝ : ℝ
h : dist b✝ a✝ < ε
⊢ dist (-a✝) (-b✝) < ε

Next tactic:
simpa only [Real.dist_eq, neg_sub_neg] using h
instance : TopologicalAddGroup ℝ := by 

Proof state:
α : Type u
β : Type v
γ : Type w
⊢ TopologicalAddGroup ℝ

Next tactic:
infer_instance
instance : ProperSpace ℝ where
  isCompact_closedBall x r := by
    

Proof state:
α : Type u
β : Type v
γ : Type w
x r : ℝ
⊢ IsCompact (closedBall x r)

Next tactic:
rw [Real.closedBall_eq_Icc]
instance : ProperSpace ℝ where
  isCompact_closedBall x r := by
    rw [Real.closedBall_eq_Icc]
    

Proof state:
α : Type u
β : Type v
γ : Type w
x r : ℝ
⊢ IsCompact (Icc (x - r) (x + r))

Next tactic:
apply isCompact_Icc
theorem Real.isTopologicalBasis_Ioo_rat :
    @IsTopologicalBasis ℝ _ (⋃ (a : ℚ) (b : ℚ) (_ : a < b), {Ioo (a : ℝ) b}) :=
  isTopologicalBasis_of_isOpen_of_nhds (by 

Proof state:
α : Type u
β : Type v
γ : Type w
⊢ ∀ u ∈ ⋃ a, ⋃ b, ⋃ (_ : a < b), {Ioo ↑a ↑b}, IsOpen u

Next tactic:
simp (config := { contextual := true }) [isOpen_Ioo]
theorem Real.isTopologicalBasis_Ioo_rat :
    @IsTopologicalBasis ℝ _ (⋃ (a : ℚ) (b : ℚ) (_ : a < b), {Ioo (a : ℝ) b}) :=
  isTopologicalBasis_of_isOpen_of_nhds (by simp (config := { contextual := true }) [isOpen_Ioo])
    fun a v hav hv =>
    let ⟨l, u, ⟨hl, hu⟩, h⟩ := mem_nhds_iff_exists_Ioo_subset.mp (IsOpen.mem_nhds hv hav)
    let ⟨q, hlq, hqa⟩ := exists_rat_btwn hl
    let ⟨p, hap, hpu⟩ := exists_rat_btwn hu
    ⟨Ioo q p, by
      

Proof state:
α : Type u
β : Type v
γ : Type w
a : ℝ
v : Set ℝ
hav : a ∈ v
hv : IsOpen v
l u : ℝ
hl : l < a
hu : a < u
h : Ioo l u ⊆ v
q : ℚ
hlq : l < ↑q
hqa : ↑q < a
p : ℚ
hap : a < ↑p
hpu : ↑p < u
⊢ Ioo ↑q ↑p ∈ ⋃ a, ⋃ b, ⋃ (_ : a < b), {Ioo ↑a ↑b}

Next tactic:
simp only [mem_iUnion]
theorem Real.isTopologicalBasis_Ioo_rat :
    @IsTopologicalBasis ℝ _ (⋃ (a : ℚ) (b : ℚ) (_ : a < b), {Ioo (a : ℝ) b}) :=
  isTopologicalBasis_of_isOpen_of_nhds (by simp (config := { contextual := true }) [isOpen_Ioo])
    fun a v hav hv =>
    let ⟨l, u, ⟨hl, hu⟩, h⟩ := mem_nhds_iff_exists_Ioo_subset.mp (IsOpen.mem_nhds hv hav)
    let ⟨q, hlq, hqa⟩ := exists_rat_btwn hl
    let ⟨p, hap, hpu⟩ := exists_rat_btwn hu
    ⟨Ioo q p, by
      simp only [mem_iUnion]
      

Proof state:
α : Type u
β : Type v
γ : Type w
a : ℝ
v : Set ℝ
hav : a ∈ v
hv : IsOpen v
l u : ℝ
hl : l < a
hu : a < u
h : Ioo l u ⊆ v
q : ℚ
hlq : l < ↑q
hqa : ↑q < a
p : ℚ
hap : a < ↑p
hpu : ↑p < u
⊢ ∃ i i_1, ∃ (_ : i < i_1), Ioo ↑q ↑p ∈ {Ioo ↑i ↑i_1}

Next tactic:
exact ⟨q, p, Rat.cast_lt.1 <| hqa.trans hap, rfl⟩
@[simp]
theorem Real.cobounded_eq : cobounded ℝ = atBot ⊔ atTop := by
  

Proof state:
α : Type u
β : Type v
γ : Type w
⊢ cobounded ℝ = atBot ⊔ atTop

Next tactic:
simp only [← comap_dist_right_atTop (0 : ℝ), Real.dist_eq, sub_zero, comap_abs_atTop]
@[simp]
theorem Real.cocompact_eq : cocompact ℝ = atBot ⊔ atTop := by
  

Proof state:
α : Type u
β : Type v
γ : Type w
⊢ cocompact ℝ = atBot ⊔ atTop

Next tactic:
rw [← cobounded_eq_cocompact, cobounded_eq]
theorem Real.atBot_le_cocompact : atBot ≤ cocompact ℝ := by 

Proof state:
α : Type u
β : Type v
γ : Type w
⊢ atBot ≤ cocompact ℝ

Next tactic:
simp
theorem Real.atTop_le_cocompact : atTop ≤ cocompact ℝ := by 

Proof state:
α : Type u
β : Type v
γ : Type w
⊢ atTop ≤ cocompact ℝ

Next tactic:
simp
theorem Real.mem_closure_iff {s : Set ℝ} {x : ℝ} : x ∈ closure s ↔ ∀ ε > 0, ∃ y ∈ s, |y - x| < ε :=
  by 

Proof state:
α : Type u
β : Type v
γ : Type w
s : Set ℝ
x : ℝ
⊢ x ∈ closure s ↔ ∀ ε > 0, ∃ y ∈ s, |y - x| < ε

Next tactic:
simp [mem_closure_iff_nhds_basis nhds_basis_ball, Real.dist_eq]
instance : CompleteSpace ℝ := by
  

Proof state:
α : Type u
β : Type v
γ : Type w
⊢ CompleteSpace ℝ

Next tactic:
apply complete_of_cauchySeq_tendsto
instance : CompleteSpace ℝ := by
  apply complete_of_cauchySeq_tendsto
  

Proof state:
case a
α : Type u
β : Type v
γ : Type w
⊢ ∀ (u : ℕ → ℝ), CauchySeq u → ∃ a, Tendsto u atTop (𝓝 a)

Next tactic:
intro u hu
instance : CompleteSpace ℝ := by
  apply complete_of_cauchySeq_tendsto
  intro u hu
  

Proof state:
case a
α : Type u
β : Type v
γ : Type w
u : ℕ → ℝ
hu : CauchySeq u
⊢ ∃ a, Tendsto u atTop (𝓝 a)

Next tactic:
let c : CauSeq ℝ abs := ⟨u, Metric.cauchySeq_iff'.1 hu⟩
instance : CompleteSpace ℝ := by
  apply complete_of_cauchySeq_tendsto
  intro u hu
  let c : CauSeq ℝ abs := ⟨u, Metric.cauchySeq_iff'.1 hu⟩
  

Proof state:
case a
α : Type u
β : Type v
γ : Type w
u : ℕ → ℝ
hu : CauchySeq u
c : CauSeq ℝ abs := { val := u, property := (_ : ∀ ε > 0, ∃ N, ∀ n ≥ N, dist (u n) (u N) < ε) }
⊢ ∃ a, Tendsto u atTop (𝓝 a)

Next tactic:
refine' ⟨c.lim, fun s h => _⟩
instance : CompleteSpace ℝ := by
  apply complete_of_cauchySeq_tendsto
  intro u hu
  let c : CauSeq ℝ abs := ⟨u, Metric.cauchySeq_iff'.1 hu⟩
  refine' ⟨c.lim, fun s h => _⟩
  

Proof state:
case a
α : Type u
β : Type v
γ : Type w
u : ℕ → ℝ
hu : CauchySeq u
c : CauSeq ℝ abs := { val := u, property := (_ : ∀ ε > 0, ∃ N, ∀ n ≥ N, dist (u n) (u N) < ε) }
s : Set ℝ
h : s ∈ 𝓝 (CauSeq.lim c)
⊢ s ∈ map u atTop

Next tactic:
rcases Metric.mem_nhds_iff.1 h with ⟨ε, ε0, hε⟩
instance : CompleteSpace ℝ := by
  apply complete_of_cauchySeq_tendsto
  intro u hu
  let c : CauSeq ℝ abs := ⟨u, Metric.cauchySeq_iff'.1 hu⟩
  refine' ⟨c.lim, fun s h => _⟩
  rcases Metric.mem_nhds_iff.1 h with ⟨ε, ε0, hε⟩
  

Proof state:
case a.intro.intro
α : Type u
β : Type v
γ : Type w
u : ℕ → ℝ
hu : CauchySeq u
c : CauSeq ℝ abs := { val := u, property := (_ : ∀ ε > 0, ∃ N, ∀ n ≥ N, dist (u n) (u N) < ε) }
s : Set ℝ
h : s ∈ 𝓝 (CauSeq.lim c)
ε : ℝ
ε0 : ε > 0
hε : ball (CauSeq.lim c) ε ⊆ s
⊢ s ∈ map u atTop

Next tactic:
have := c.equiv_lim ε ε0
instance : CompleteSpace ℝ := by
  apply complete_of_cauchySeq_tendsto
  intro u hu
  let c : CauSeq ℝ abs := ⟨u, Metric.cauchySeq_iff'.1 hu⟩
  refine' ⟨c.lim, fun s h => _⟩
  rcases Metric.mem_nhds_iff.1 h with ⟨ε, ε0, hε⟩
  have := c.equiv_lim ε ε0
  

Proof state:
case a.intro.intro
α : Type u
β : Type v
γ : Type w
u : ℕ → ℝ
hu : CauchySeq u
c : CauSeq ℝ abs := { val := u, property := (_ : ∀ ε > 0, ∃ N, ∀ n ≥ N, dist (u n) (u N) < ε) }
s : Set ℝ
h : s ∈ 𝓝 (CauSeq.lim c)
ε : ℝ
ε0 : ε > 0
hε : ball (CauSeq.lim c) ε ⊆ s
this : ∃ i, ∀ j ≥ i, |↑(c - CauSeq.const abs (CauSeq.lim c)) j| < ε
⊢ s ∈ map u atTop

Next tactic:
simp only [mem_map, mem_atTop_sets, mem_setOf_eq]
instance : CompleteSpace ℝ := by
  apply complete_of_cauchySeq_tendsto
  intro u hu
  let c : CauSeq ℝ abs := ⟨u, Metric.cauchySeq_iff'.1 hu⟩
  refine' ⟨c.lim, fun s h => _⟩
  rcases Metric.mem_nhds_iff.1 h with ⟨ε, ε0, hε⟩
  have := c.equiv_lim ε ε0
  simp only [mem_map, mem_atTop_sets, mem_setOf_eq]
  

Proof state:
case a.intro.intro
α : Type u
β : Type v
γ : Type w
u : ℕ → ℝ
hu : CauchySeq u
c : CauSeq ℝ abs := { val := u, property := (_ : ∀ ε > 0, ∃ N, ∀ n ≥ N, dist (u n) (u N) < ε) }
s : Set ℝ
h : s ∈ 𝓝 (CauSeq.lim c)
ε : ℝ
ε0 : ε > 0
hε : ball (CauSeq.lim c) ε ⊆ s
this : ∃ i, ∀ j ≥ i, |↑(c - CauSeq.const abs (CauSeq.lim c)) j| < ε
⊢ ∃ a, ∀ b ≥ a, b ∈ u ⁻¹' s

Next tactic:
refine' this.imp fun N hN n hn => hε (hN n hn)
theorem Real.totallyBounded_ball (x ε : ℝ) : TotallyBounded (ball x ε) := by
  

Proof state:
α : Type u
β : Type v
γ : Type w
x ε : ℝ
⊢ TotallyBounded (ball x ε)

Next tactic:
rw [Real.ball_eq_Ioo]
theorem Real.totallyBounded_ball (x ε : ℝ) : TotallyBounded (ball x ε) := by
  rw [Real.ball_eq_Ioo]; 

Proof state:
α : Type u
β : Type v
γ : Type w
x ε : ℝ
⊢ TotallyBounded (Ioo (x - ε) (x + ε))

Next tactic:
apply totallyBounded_Ioo
theorem closure_of_rat_image_lt {q : ℚ} :
    closure (((↑) : ℚ → ℝ) '' { x | q < x }) = { r | ↑q ≤ r } :=
  Subset.antisymm
    ((isClosed_ge' _).closure_subset_iff.2
      (image_subset_iff.2 fun p h => le_of_lt <| (@Rat.cast_lt ℝ _ _ _).2 h))
    fun x hx => mem_closure_iff_nhds.2 fun t ht =>
      let ⟨ε, ε0, hε⟩ := Metric.mem_nhds_iff.1 ht
      let ⟨p, h₁, h₂⟩ := exists_rat_btwn ((lt_add_iff_pos_right x).2 ε0)
      ⟨p, hε <| by 

Proof state:
α : Type u
β : Type v
γ : Type w
q : ℚ
x : ℝ
hx : x ∈ {r | ↑q ≤ r}
t : Set ℝ
ht : t ∈ 𝓝 x
ε : ℝ
ε0 : ε > 0
hε : ball x ε ⊆ t
p : ℚ
h₁ : x < ↑p
h₂ : ↑p < x + ε
⊢ ↑p ∈ ball x ε

Next tactic:
rwa [mem_ball, Real.dist_eq, abs_of_pos (sub_pos.2 h₁), sub_lt_iff_lt_add']
theorem Real.isBounded_iff_bddBelow_bddAbove {s : Set ℝ} : IsBounded s ↔ BddBelow s ∧ BddAbove s :=
  ⟨fun bdd ↦ by
    

Proof state:
α : Type u
β : Type v
γ : Type w
s : Set ℝ
bdd : IsBounded s
⊢ BddBelow s ∧ BddAbove s

Next tactic:
obtain ⟨r, hr⟩ : ∃ r : ℝ, s ⊆ Icc (-r) r := by
      simpa [Real.closedBall_eq_Icc] using bdd.subset_closedBall 0
theorem Real.isBounded_iff_bddBelow_bddAbove {s : Set ℝ} : IsBounded s ↔ BddBelow s ∧ BddAbove s :=
  ⟨fun bdd ↦ by
    obtain ⟨r, hr⟩ : ∃ r : ℝ, s ⊆ Icc (-r) r := by
      

Proof state:
α : Type u
β : Type v
γ : Type w
s : Set ℝ
bdd : IsBounded s
⊢ ∃ r, s ⊆ Icc (-r) r

Next tactic:
simpa [Real.closedBall_eq_Icc] using bdd.subset_closedBall 0
theorem Real.isBounded_iff_bddBelow_bddAbove {s : Set ℝ} : IsBounded s ↔ BddBelow s ∧ BddAbove s :=
  ⟨fun bdd ↦ by
    obtain ⟨r, hr⟩ : ∃ r : ℝ, s ⊆ Icc (-r) r := by
      simpa [Real.closedBall_eq_Icc] using bdd.subset_closedBall 0
    

Proof state:
case intro
α : Type u
β : Type v
γ : Type w
s : Set ℝ
bdd : IsBounded s
r : ℝ
hr : s ⊆ Icc (-r) r
⊢ BddBelow s ∧ BddAbove s

Next tactic:
exact ⟨bddBelow_Icc.mono hr, bddAbove_Icc.mono hr⟩
/-- A continuous, periodic function has compact range. -/
theorem Periodic.compact_of_continuous [TopologicalSpace α] {f : ℝ → α} {c : ℝ} (hp : Periodic f c)
    (hc : c ≠ 0) (hf : Continuous f) : IsCompact (range f) := by
  

Proof state:
α : Type u
β : Type v
γ : Type w
inst✝ : TopologicalSpace α
f : ℝ → α
c : ℝ
hp : Periodic f c
hc : c ≠ 0
hf : Continuous f
⊢ IsCompact (range f)

Next tactic:
rw [← hp.image_uIcc hc 0]
/-- A continuous, periodic function has compact range. -/
theorem Periodic.compact_of_continuous [TopologicalSpace α] {f : ℝ → α} {c : ℝ} (hp : Periodic f c)
    (hc : c ≠ 0) (hf : Continuous f) : IsCompact (range f) := by
  rw [← hp.image_uIcc hc 0]
  

Proof state:
α : Type u
β : Type v
γ : Type w
inst✝ : TopologicalSpace α
f : ℝ → α
c : ℝ
hp : Periodic f c
hc : c ≠ 0
hf : Continuous f
⊢ IsCompact (f '' [[0, 0 + c]])

Next tactic:
exact isCompact_uIcc.image hf
/-- This is a special case of `NormedSpace.discreteTopology_zmultiples`. It exists only to simplify
dependencies. -/
instance {a : ℝ} : DiscreteTopology (AddSubgroup.zmultiples a) := by
  

Proof state:
α : Type u
β : Type v
γ : Type w
a : ℝ
⊢ DiscreteTopology ↥(AddSubgroup.zmultiples a)

Next tactic:
rcases eq_or_ne a 0 with (rfl | ha)
/-- This is a special case of `NormedSpace.discreteTopology_zmultiples`. It exists only to simplify
dependencies. -/
instance {a : ℝ} : DiscreteTopology (AddSubgroup.zmultiples a) := by
  rcases eq_or_ne a 0 with (rfl | ha)
  · 

Proof state:
case inl
α : Type u
β : Type v
γ : Type w
⊢ DiscreteTopology ↥(AddSubgroup.zmultiples 0)

Next tactic:
rw [AddSubgroup.zmultiples_zero_eq_bot]
/-- This is a special case of `NormedSpace.discreteTopology_zmultiples`. It exists only to simplify
dependencies. -/
instance {a : ℝ} : DiscreteTopology (AddSubgroup.zmultiples a) := by
  rcases eq_or_ne a 0 with (rfl | ha)
  · rw [AddSubgroup.zmultiples_zero_eq_bot]
    

Proof state:
case inl
α : Type u
β : Type v
γ : Type w
⊢ DiscreteTopology ↥⊥

Next tactic:
exact Subsingleton.discreteTopology (α := (⊥ : Submodule ℤ ℝ))
/-- This is a special case of `NormedSpace.discreteTopology_zmultiples`. It exists only to simplify
dependencies. -/
instance {a : ℝ} : DiscreteTopology (AddSubgroup.zmultiples a) := by
  rcases eq_or_ne a 0 with (rfl | ha)
  · rw [AddSubgroup.zmultiples_zero_eq_bot]
    exact Subsingleton.discreteTopology (α := (⊥ : Submodule ℤ ℝ))
  

Proof state:
case inr
α : Type u
β : Type v
γ : Type w
a : ℝ
ha : a ≠ 0
⊢ DiscreteTopology ↥(AddSubgroup.zmultiples a)

Next tactic:
rw [discreteTopology_iff_isOpen_singleton_zero, isOpen_induced_iff]
/-- This is a special case of `NormedSpace.discreteTopology_zmultiples`. It exists only to simplify
dependencies. -/
instance {a : ℝ} : DiscreteTopology (AddSubgroup.zmultiples a) := by
  rcases eq_or_ne a 0 with (rfl | ha)
  · rw [AddSubgroup.zmultiples_zero_eq_bot]
    exact Subsingleton.discreteTopology (α := (⊥ : Submodule ℤ ℝ))
  rw [discreteTopology_iff_isOpen_singleton_zero, isOpen_induced_iff]
  

Proof state:
case inr
α : Type u
β : Type v
γ : Type w
a : ℝ
ha : a ≠ 0
⊢ ∃ t, IsOpen t ∧ Subtype.val ⁻¹' t = {0}

Next tactic:
refine' ⟨ball 0 |a|, isOpen_ball, _⟩
/-- This is a special case of `NormedSpace.discreteTopology_zmultiples`. It exists only to simplify
dependencies. -/
instance {a : ℝ} : DiscreteTopology (AddSubgroup.zmultiples a) := by
  rcases eq_or_ne a 0 with (rfl | ha)
  · rw [AddSubgroup.zmultiples_zero_eq_bot]
    exact Subsingleton.discreteTopology (α := (⊥ : Submodule ℤ ℝ))
  rw [discreteTopology_iff_isOpen_singleton_zero, isOpen_induced_iff]
  refine' ⟨ball 0 |a|, isOpen_ball, _⟩
  

Proof state:
case inr
α : Type u
β : Type v
γ : Type w
a : ℝ
ha : a ≠ 0
⊢ Subtype.val ⁻¹' ball 0 |a| = {0}

Next tactic:
ext ⟨x, hx⟩
/-- This is a special case of `NormedSpace.discreteTopology_zmultiples`. It exists only to simplify
dependencies. -/
instance {a : ℝ} : DiscreteTopology (AddSubgroup.zmultiples a) := by
  rcases eq_or_ne a 0 with (rfl | ha)
  · rw [AddSubgroup.zmultiples_zero_eq_bot]
    exact Subsingleton.discreteTopology (α := (⊥ : Submodule ℤ ℝ))
  rw [discreteTopology_iff_isOpen_singleton_zero, isOpen_induced_iff]
  refine' ⟨ball 0 |a|, isOpen_ball, _⟩
  ext ⟨x, hx⟩
  

Proof state:
case inr.h.mk
α : Type u
β : Type v
γ : Type w
a : ℝ
ha : a ≠ 0
x : ℝ
hx : x ∈ AddSubgroup.zmultiples a
⊢ { val := x, property := hx } ∈ Subtype.val ⁻¹' ball 0 |a| ↔ { val := x, property := hx } ∈ {0}

Next tactic:
obtain ⟨k, rfl⟩ := AddSubgroup.mem_zmultiples_iff.mp hx
/-- This is a special case of `NormedSpace.discreteTopology_zmultiples`. It exists only to simplify
dependencies. -/
instance {a : ℝ} : DiscreteTopology (AddSubgroup.zmultiples a) := by
  rcases eq_or_ne a 0 with (rfl | ha)
  · rw [AddSubgroup.zmultiples_zero_eq_bot]
    exact Subsingleton.discreteTopology (α := (⊥ : Submodule ℤ ℝ))
  rw [discreteTopology_iff_isOpen_singleton_zero, isOpen_induced_iff]
  refine' ⟨ball 0 |a|, isOpen_ball, _⟩
  ext ⟨x, hx⟩
  obtain ⟨k, rfl⟩ := AddSubgroup.mem_zmultiples_iff.mp hx
  

Proof state:
case inr.h.mk.intro
α : Type u
β : Type v
γ : Type w
a : ℝ
ha : a ≠ 0
k : ℤ
hx : k • a ∈ AddSubgroup.zmultiples a
⊢ { val := k • a, property := hx } ∈ Subtype.val ⁻¹' ball 0 |a| ↔ { val := k • a, property := hx } ∈ {0}

Next tactic:
simp [ha, Real.dist_eq, abs_mul, (by norm_cast : |(k : ℝ)| < 1 ↔ |k| < 1)]
/-- This is a special case of `NormedSpace.discreteTopology_zmultiples`. It exists only to simplify
dependencies. -/
instance {a : ℝ} : DiscreteTopology (AddSubgroup.zmultiples a) := by
  rcases eq_or_ne a 0 with (rfl | ha)
  · rw [AddSubgroup.zmultiples_zero_eq_bot]
    exact Subsingleton.discreteTopology (α := (⊥ : Submodule ℤ ℝ))
  rw [discreteTopology_iff_isOpen_singleton_zero, isOpen_induced_iff]
  refine' ⟨ball 0 |a|, isOpen_ball, _⟩
  ext ⟨x, hx⟩
  obtain ⟨k, rfl⟩ := AddSubgroup.mem_zmultiples_iff.mp hx
  simp [ha, Real.dist_eq, abs_mul, (by 

Proof state:
α : Type u
β : Type v
γ : Type w
a : ℝ
ha : a ≠ 0
k : ℤ
hx : k • a ∈ AddSubgroup.zmultiples a
⊢ |↑k| < 1 ↔ |k| < 1

Next tactic:
norm_cast
/-- Under the coercion from `ℤ` to `ℝ`, inverse images of compact sets are finite. -/
theorem tendsto_coe_cofinite : Tendsto ((↑) : ℤ → ℝ) cofinite (cocompact ℝ) := by
  

Proof state:
α : Type u
β : Type v
γ : Type w
⊢ Tendsto Int.cast Filter.cofinite (cocompact ℝ)

Next tactic:
apply (castAddHom ℝ).tendsto_coe_cofinite_of_discrete cast_injective
/-- Under the coercion from `ℤ` to `ℝ`, inverse images of compact sets are finite. -/
theorem tendsto_coe_cofinite : Tendsto ((↑) : ℤ → ℝ) cofinite (cocompact ℝ) := by
  apply (castAddHom ℝ).tendsto_coe_cofinite_of_discrete cast_injective
  

Proof state:
α : Type u
β : Type v
γ : Type w
⊢ DiscreteTopology ↥(AddMonoidHom.range (castAddHom ℝ))

Next tactic:
rw [range_castAddHom]
/-- Under the coercion from `ℤ` to `ℝ`, inverse images of compact sets are finite. -/
theorem tendsto_coe_cofinite : Tendsto ((↑) : ℤ → ℝ) cofinite (cocompact ℝ) := by
  apply (castAddHom ℝ).tendsto_coe_cofinite_of_discrete cast_injective
  rw [range_castAddHom]
  

Proof state:
α : Type u
β : Type v
γ : Type w
⊢ DiscreteTopology ↥(AddSubgroup.zmultiples 1)

Next tactic:
infer_instance
/-- For nonzero `a`, the "multiples of `a`" map `zmultiplesHom` from `ℤ` to `ℝ` is discrete, i.e.
inverse images of compact sets are finite. -/
theorem tendsto_zmultiplesHom_cofinite {a : ℝ} (ha : a ≠ 0) :
    Tendsto (zmultiplesHom ℝ a) cofinite (cocompact ℝ) := by
  

Proof state:
α : Type u
β : Type v
γ : Type w
a : ℝ
ha : a ≠ 0
⊢ Tendsto (⇑((zmultiplesHom ℝ) a)) Filter.cofinite (cocompact ℝ)

Next tactic:
apply (zmultiplesHom ℝ a).tendsto_coe_cofinite_of_discrete $ smul_left_injective ℤ ha
/-- For nonzero `a`, the "multiples of `a`" map `zmultiplesHom` from `ℤ` to `ℝ` is discrete, i.e.
inverse images of compact sets are finite. -/
theorem tendsto_zmultiplesHom_cofinite {a : ℝ} (ha : a ≠ 0) :
    Tendsto (zmultiplesHom ℝ a) cofinite (cocompact ℝ) := by
  apply (zmultiplesHom ℝ a).tendsto_coe_cofinite_of_discrete $ smul_left_injective ℤ ha
  

Proof state:
α : Type u
β : Type v
γ : Type w
a : ℝ
ha : a ≠ 0
⊢ DiscreteTopology ↥(AddMonoidHom.range ((zmultiplesHom ℝ) a))

Next tactic:
rw [AddSubgroup.range_zmultiplesHom]
/-- For nonzero `a`, the "multiples of `a`" map `zmultiplesHom` from `ℤ` to `ℝ` is discrete, i.e.
inverse images of compact sets are finite. -/
theorem tendsto_zmultiplesHom_cofinite {a : ℝ} (ha : a ≠ 0) :
    Tendsto (zmultiplesHom ℝ a) cofinite (cocompact ℝ) := by
  apply (zmultiplesHom ℝ a).tendsto_coe_cofinite_of_discrete $ smul_left_injective ℤ ha
  rw [AddSubgroup.range_zmultiplesHom]
  

Proof state:
α : Type u
β : Type v
γ : Type w
a : ℝ
ha : a ≠ 0
⊢ DiscreteTopology ↥(AddSubgroup.zmultiples a)

Next tactic:
infer_instance
@[simp]
theorem tail_cons : tail (cons y s) = s :=
  ext fun k => by 

Proof state:
n : ℕ
i : Fin n
M : Type u_1
inst✝ : Zero M
y : M
t : Fin (n + 1) →₀ M
s : Fin n →₀ M
k : Fin n
⊢ (tail (cons y s)) k = s k

Next tactic:
simp only [tail_apply, cons_succ]
@[simp]
theorem cons_tail : cons (t 0) (tail t) = t := by
  

Proof state:
n : ℕ
i : Fin n
M : Type u_1
inst✝ : Zero M
y : M
t : Fin (n + 1) →₀ M
s : Fin n →₀ M
⊢ cons (t 0) (tail t) = t

Next tactic:
ext a
@[simp]
theorem cons_tail : cons (t 0) (tail t) = t := by
  ext a
  

Proof state:
case h
n : ℕ
i : Fin n
M : Type u_1
inst✝ : Zero M
y : M
t : Fin (n + 1) →₀ M
s : Fin n →₀ M
a : Fin (n + 1)
⊢ (cons (t 0) (tail t)) a = t a

Next tactic:
by_cases c_a : a = 0
@[simp]
theorem cons_tail : cons (t 0) (tail t) = t := by
  ext a
  by_cases c_a : a = 0
  · 

Proof state:
case pos
n : ℕ
i : Fin n
M : Type u_1
inst✝ : Zero M
y : M
t : Fin (n + 1) →₀ M
s : Fin n →₀ M
a : Fin (n + 1)
c_a : a = 0
⊢ (cons (t 0) (tail t)) a = t a

Next tactic:
rw [c_a, cons_zero]
@[simp]
theorem cons_tail : cons (t 0) (tail t) = t := by
  ext a
  by_cases c_a : a = 0
  · rw [c_a, cons_zero]
  · 

Proof state:
case neg
n : ℕ
i : Fin n
M : Type u_1
inst✝ : Zero M
y : M
t : Fin (n + 1) →₀ M
s : Fin n →₀ M
a : Fin (n + 1)
c_a : ¬a = 0
⊢ (cons (t 0) (tail t)) a = t a

Next tactic:
rw [← Fin.succ_pred a c_a, cons_succ, ← tail_apply]
@[simp]
theorem cons_zero_zero : cons 0 (0 : Fin n →₀ M) = 0 := by
  

Proof state:
n : ℕ
i : Fin n
M : Type u_1
inst✝ : Zero M
y : M
t : Fin (n + 1) →₀ M
s : Fin n →₀ M
⊢ cons 0 0 = 0

Next tactic:
ext a
@[simp]
theorem cons_zero_zero : cons 0 (0 : Fin n →₀ M) = 0 := by
  ext a
  

Proof state:
case h
n : ℕ
i : Fin n
M : Type u_1
inst✝ : Zero M
y : M
t : Fin (n + 1) →₀ M
s : Fin n →₀ M
a : Fin (n + 1)
⊢ (cons 0 0) a = 0 a

Next tactic:
by_cases c : a = 0
@[simp]
theorem cons_zero_zero : cons 0 (0 : Fin n →₀ M) = 0 := by
  ext a
  by_cases c : a = 0
  · 

Proof state:
case pos
n : ℕ
i : Fin n
M : Type u_1
inst✝ : Zero M
y : M
t : Fin (n + 1) →₀ M
s : Fin n →₀ M
a : Fin (n + 1)
c : a = 0
⊢ (cons 0 0) a = 0 a

Next tactic:
simp [c]
@[simp]
theorem cons_zero_zero : cons 0 (0 : Fin n →₀ M) = 0 := by
  ext a
  by_cases c : a = 0
  · simp [c]
  · 

Proof state:
case neg
n : ℕ
i : Fin n
M : Type u_1
inst✝ : Zero M
y : M
t : Fin (n + 1) →₀ M
s : Fin n →₀ M
a : Fin (n + 1)
c : ¬a = 0
⊢ (cons 0 0) a = 0 a

Next tactic:
rw [← Fin.succ_pred a c, cons_succ]
@[simp]
theorem cons_zero_zero : cons 0 (0 : Fin n →₀ M) = 0 := by
  ext a
  by_cases c : a = 0
  · simp [c]
  · rw [← Fin.succ_pred a c, cons_succ]
    

Proof state:
case neg
n : ℕ
i : Fin n
M : Type u_1
inst✝ : Zero M
y : M
t : Fin (n + 1) →₀ M
s : Fin n →₀ M
a : Fin (n + 1)
c : ¬a = 0
⊢ 0 (Fin.pred a c) = 0 (Fin.succ (Fin.pred a c))

Next tactic:
simp
theorem cons_ne_zero_of_left (h : y ≠ 0) : cons y s ≠ 0 := by
  

Proof state:
n : ℕ
i : Fin n
M : Type u_1
inst✝ : Zero M
y : M
t : Fin (n + 1) →₀ M
s : Fin n →₀ M
h : y ≠ 0
⊢ cons y s ≠ 0

Next tactic:
contrapose! h with c