l3lab/ntp-mathlib huggingface dataset:
theorem continuous_right_toIcoMod : ContinuousWithinAt (toIcoMod hp a) (Ici x) x := by
  intro s h
  rw [Filter.mem_map, mem_nhdsWithin_iff_exists_mem_nhds_inter]
  haveI : Nontrivial 𝕜 := ⟨⟨0, p, hp.ne⟩⟩
  

Proof state:
𝕜 : Type u_1
B : Type u_2
inst✝³ : LinearOrderedAddCommGroup 𝕜
inst✝² : Archimedean 𝕜
inst✝¹ : TopologicalSpace 𝕜
inst✝ : OrderTopology 𝕜
p : 𝕜
hp : 0 < p
a x : 𝕜
s : Set 𝕜
h : s ∈ 𝓝 (toIcoMod hp a x)
this : Nontrivial 𝕜
⊢ ∃ u ∈ 𝓝 x, u ∩ Ici x ⊆ toIcoMod hp a ⁻¹' s

Next tactic:
simp_rw [mem_nhds_iff_exists_Ioo_subset] at h ⊢
theorem continuous_right_toIcoMod : ContinuousWithinAt (toIcoMod hp a) (Ici x) x := by
  intro s h
  rw [Filter.mem_map, mem_nhdsWithin_iff_exists_mem_nhds_inter]
  haveI : Nontrivial 𝕜 := ⟨⟨0, p, hp.ne⟩⟩
  simp_rw [mem_nhds_iff_exists_Ioo_subset] at h ⊢
  

Proof state:
𝕜 : Type u_1
B : Type u_2
inst✝³ : LinearOrderedAddCommGroup 𝕜
inst✝² : Archimedean 𝕜
inst✝¹ : TopologicalSpace 𝕜
inst✝ : OrderTopology 𝕜
p : 𝕜
hp : 0 < p
a x : 𝕜
s : Set 𝕜
this : Nontrivial 𝕜
h : ∃ l u, toIcoMod hp a x ∈ Ioo l u ∧ Ioo l u ⊆ s
⊢ ∃ u, (∃ l u_1, x ∈ Ioo l u_1 ∧ Ioo l u_1 ⊆ u) ∧ u ∩ Ici x ⊆ toIcoMod hp a ⁻¹' s

Next tactic:
obtain ⟨l, u, hxI, hIs⟩ := h
theorem continuous_right_toIcoMod : ContinuousWithinAt (toIcoMod hp a) (Ici x) x := by
  intro s h
  rw [Filter.mem_map, mem_nhdsWithin_iff_exists_mem_nhds_inter]
  haveI : Nontrivial 𝕜 := ⟨⟨0, p, hp.ne⟩⟩
  simp_rw [mem_nhds_iff_exists_Ioo_subset] at h ⊢
  obtain ⟨l, u, hxI, hIs⟩ := h
  

Proof state:
case intro.intro.intro
𝕜 : Type u_1
B : Type u_2
inst✝³ : LinearOrderedAddCommGroup 𝕜
inst✝² : Archimedean 𝕜
inst✝¹ : TopologicalSpace 𝕜
inst✝ : OrderTopology 𝕜
p : 𝕜
hp : 0 < p
a x : 𝕜
s : Set 𝕜
this : Nontrivial 𝕜
l u : 𝕜
hxI : toIcoMod hp a x ∈ Ioo l u
hIs : Ioo l u ⊆ s
⊢ ∃ u, (∃ l u_1, x ∈ Ioo l u_1 ∧ Ioo l u_1 ⊆ u) ∧ u ∩ Ici x ⊆ toIcoMod hp a ⁻¹' s

Next tactic:
let d := toIcoDiv hp a x • p
theorem continuous_right_toIcoMod : ContinuousWithinAt (toIcoMod hp a) (Ici x) x := by
  intro s h
  rw [Filter.mem_map, mem_nhdsWithin_iff_exists_mem_nhds_inter]
  haveI : Nontrivial 𝕜 := ⟨⟨0, p, hp.ne⟩⟩
  simp_rw [mem_nhds_iff_exists_Ioo_subset] at h ⊢
  obtain ⟨l, u, hxI, hIs⟩ := h
  let d := toIcoDiv hp a x • p
  

Proof state:
case intro.intro.intro
𝕜 : Type u_1
B : Type u_2
inst✝³ : LinearOrderedAddCommGroup 𝕜
inst✝² : Archimedean 𝕜
inst✝¹ : TopologicalSpace 𝕜
inst✝ : OrderTopology 𝕜
p : 𝕜
hp : 0 < p
a x : 𝕜
s : Set 𝕜
this : Nontrivial 𝕜
l u : 𝕜
hxI : toIcoMod hp a x ∈ Ioo l u
hIs : Ioo l u ⊆ s
d : 𝕜 := toIcoDiv hp a x • p
⊢ ∃ u, (∃ l u_1, x ∈ Ioo l u_1 ∧ Ioo l u_1 ⊆ u) ∧ u ∩ Ici x ⊆ toIcoMod hp a ⁻¹' s

Next tactic:
have hd := toIcoMod_mem_Ico hp a x
theorem continuous_right_toIcoMod : ContinuousWithinAt (toIcoMod hp a) (Ici x) x := by
  intro s h
  rw [Filter.mem_map, mem_nhdsWithin_iff_exists_mem_nhds_inter]
  haveI : Nontrivial 𝕜 := ⟨⟨0, p, hp.ne⟩⟩
  simp_rw [mem_nhds_iff_exists_Ioo_subset] at h ⊢
  obtain ⟨l, u, hxI, hIs⟩ := h
  let d := toIcoDiv hp a x • p
  have hd := toIcoMod_mem_Ico hp a x
  

Proof state:
case intro.intro.intro
𝕜 : Type u_1
B : Type u_2
inst✝³ : LinearOrderedAddCommGroup 𝕜
inst✝² : Archimedean 𝕜
inst✝¹ : TopologicalSpace 𝕜
inst✝ : OrderTopology 𝕜
p : 𝕜
hp : 0 < p
a x : 𝕜
s : Set 𝕜
this : Nontrivial 𝕜
l u : 𝕜
hxI : toIcoMod hp a x ∈ Ioo l u
hIs : Ioo l u ⊆ s
d : 𝕜 := toIcoDiv hp a x • p
hd : toIcoMod hp a x ∈ Ico a (a + p)
⊢ ∃ u, (∃ l u_1, x ∈ Ioo l u_1 ∧ Ioo l u_1 ⊆ u) ∧ u ∩ Ici x ⊆ toIcoMod hp a ⁻¹' s

Next tactic:
simp_rw [subset_def, mem_inter_iff]
theorem continuous_right_toIcoMod : ContinuousWithinAt (toIcoMod hp a) (Ici x) x := by
  intro s h
  rw [Filter.mem_map, mem_nhdsWithin_iff_exists_mem_nhds_inter]
  haveI : Nontrivial 𝕜 := ⟨⟨0, p, hp.ne⟩⟩
  simp_rw [mem_nhds_iff_exists_Ioo_subset] at h ⊢
  obtain ⟨l, u, hxI, hIs⟩ := h
  let d := toIcoDiv hp a x • p
  have hd := toIcoMod_mem_Ico hp a x
  simp_rw [subset_def, mem_inter_iff]
  

Proof state:
case intro.intro.intro
𝕜 : Type u_1
B : Type u_2
inst✝³ : LinearOrderedAddCommGroup 𝕜
inst✝² : Archimedean 𝕜
inst✝¹ : TopologicalSpace 𝕜
inst✝ : OrderTopology 𝕜
p : 𝕜
hp : 0 < p
a x : 𝕜
s : Set 𝕜
this : Nontrivial 𝕜
l u : 𝕜
hxI : toIcoMod hp a x ∈ Ioo l u
hIs : Ioo l u ⊆ s
d : 𝕜 := toIcoDiv hp a x • p
hd : toIcoMod hp a x ∈ Ico a (a + p)
⊢ ∃ u,
    (∃ l u_1, x ∈ Ioo l u_1 ∧ ∀ x ∈ Ioo l u_1, x ∈ u) ∧ ∀ (x_1 : 𝕜), x_1 ∈ u ∧ x_1 ∈ Ici x → x_1 ∈ toIcoMod hp a ⁻¹' s

Next tactic:
refine' ⟨_, ⟨l + d, min (a + p) u + d, _, fun x => id⟩, fun y => _⟩
theorem continuous_right_toIcoMod : ContinuousWithinAt (toIcoMod hp a) (Ici x) x := by
  intro s h
  rw [Filter.mem_map, mem_nhdsWithin_iff_exists_mem_nhds_inter]
  haveI : Nontrivial 𝕜 := ⟨⟨0, p, hp.ne⟩⟩
  simp_rw [mem_nhds_iff_exists_Ioo_subset] at h ⊢
  obtain ⟨l, u, hxI, hIs⟩ := h
  let d := toIcoDiv hp a x • p
  have hd := toIcoMod_mem_Ico hp a x
  simp_rw [subset_def, mem_inter_iff]
  refine' ⟨_, ⟨l + d, min (a + p) u + d, _, fun x => id⟩, fun y => _⟩ <;>
    

Proof state:
case intro.intro.intro.refine'_1
𝕜 : Type u_1
B : Type u_2
inst✝³ : LinearOrderedAddCommGroup 𝕜
inst✝² : Archimedean 𝕜
inst✝¹ : TopologicalSpace 𝕜
inst✝ : OrderTopology 𝕜
p : 𝕜
hp : 0 < p
a x : 𝕜
s : Set 𝕜
this : Nontrivial 𝕜
l u : 𝕜
hxI : toIcoMod hp a x ∈ Ioo l u
hIs : Ioo l u ⊆ s
d : 𝕜 := toIcoDiv hp a x • p
hd : toIcoMod hp a x ∈ Ico a (a + p)
⊢ x ∈ Ioo (l + d) (min (a + p) u + d)

Next tactic:
simp_rw [← sub_mem_Ioo_iff_left, mem_Ioo, lt_min_iff]
theorem continuous_right_toIcoMod : ContinuousWithinAt (toIcoMod hp a) (Ici x) x := by
  intro s h
  rw [Filter.mem_map, mem_nhdsWithin_iff_exists_mem_nhds_inter]
  haveI : Nontrivial 𝕜 := ⟨⟨0, p, hp.ne⟩⟩
  simp_rw [mem_nhds_iff_exists_Ioo_subset] at h ⊢
  obtain ⟨l, u, hxI, hIs⟩ := h
  let d := toIcoDiv hp a x • p
  have hd := toIcoMod_mem_Ico hp a x
  simp_rw [subset_def, mem_inter_iff]
  refine' ⟨_, ⟨l + d, min (a + p) u + d, _, fun x => id⟩, fun y => _⟩ <;>
    

Proof state:
case intro.intro.intro.refine'_2
𝕜 : Type u_1
B : Type u_2
inst✝³ : LinearOrderedAddCommGroup 𝕜
inst✝² : Archimedean 𝕜
inst✝¹ : TopologicalSpace 𝕜
inst✝ : OrderTopology 𝕜
p : 𝕜
hp : 0 < p
a x : 𝕜
s : Set 𝕜
this : Nontrivial 𝕜
l u : 𝕜
hxI : toIcoMod hp a x ∈ Ioo l u
hIs : Ioo l u ⊆ s
d : 𝕜 := toIcoDiv hp a x • p
hd : toIcoMod hp a x ∈ Ico a (a + p)
y : 𝕜
⊢ y ∈ Ioo (l + d) (min (a + p) u + d) ∧ y ∈ Ici x → y ∈ toIcoMod hp a ⁻¹' s

Next tactic:
simp_rw [← sub_mem_Ioo_iff_left, mem_Ioo, lt_min_iff]
theorem continuous_right_toIcoMod : ContinuousWithinAt (toIcoMod hp a) (Ici x) x := by
  intro s h
  rw [Filter.mem_map, mem_nhdsWithin_iff_exists_mem_nhds_inter]
  haveI : Nontrivial 𝕜 := ⟨⟨0, p, hp.ne⟩⟩
  simp_rw [mem_nhds_iff_exists_Ioo_subset] at h ⊢
  obtain ⟨l, u, hxI, hIs⟩ := h
  let d := toIcoDiv hp a x • p
  have hd := toIcoMod_mem_Ico hp a x
  simp_rw [subset_def, mem_inter_iff]
  refine' ⟨_, ⟨l + d, min (a + p) u + d, _, fun x => id⟩, fun y => _⟩ <;>
    simp_rw [← sub_mem_Ioo_iff_left, mem_Ioo, lt_min_iff]
  · 

Proof state:
case intro.intro.intro.refine'_1
𝕜 : Type u_1
B : Type u_2
inst✝³ : LinearOrderedAddCommGroup 𝕜
inst✝² : Archimedean 𝕜
inst✝¹ : TopologicalSpace 𝕜
inst✝ : OrderTopology 𝕜
p : 𝕜
hp : 0 < p
a x : 𝕜
s : Set 𝕜
this : Nontrivial 𝕜
l u : 𝕜
hxI : toIcoMod hp a x ∈ Ioo l u
hIs : Ioo l u ⊆ s
d : 𝕜 := toIcoDiv hp a x • p
hd : toIcoMod hp a x ∈ Ico a (a + p)
⊢ l < x - toIcoDiv hp a x • p ∧ x - toIcoDiv hp a x • p < a + p ∧ x - toIcoDiv hp a x • p < u

Next tactic:
exact ⟨hxI.1, hd.2, hxI.2⟩
theorem continuous_right_toIcoMod : ContinuousWithinAt (toIcoMod hp a) (Ici x) x := by
  intro s h
  rw [Filter.mem_map, mem_nhdsWithin_iff_exists_mem_nhds_inter]
  haveI : Nontrivial 𝕜 := ⟨⟨0, p, hp.ne⟩⟩
  simp_rw [mem_nhds_iff_exists_Ioo_subset] at h ⊢
  obtain ⟨l, u, hxI, hIs⟩ := h
  let d := toIcoDiv hp a x • p
  have hd := toIcoMod_mem_Ico hp a x
  simp_rw [subset_def, mem_inter_iff]
  refine' ⟨_, ⟨l + d, min (a + p) u + d, _, fun x => id⟩, fun y => _⟩ <;>
    simp_rw [← sub_mem_Ioo_iff_left, mem_Ioo, lt_min_iff]
  · exact ⟨hxI.1, hd.2, hxI.2⟩
  · 

Proof state:
case intro.intro.intro.refine'_2
𝕜 : Type u_1
B : Type u_2
inst✝³ : LinearOrderedAddCommGroup 𝕜
inst✝² : Archimedean 𝕜
inst✝¹ : TopologicalSpace 𝕜
inst✝ : OrderTopology 𝕜
p : 𝕜
hp : 0 < p
a x : 𝕜
s : Set 𝕜
this : Nontrivial 𝕜
l u : 𝕜
hxI : toIcoMod hp a x ∈ Ioo l u
hIs : Ioo l u ⊆ s
d : 𝕜 := toIcoDiv hp a x • p
hd : toIcoMod hp a x ∈ Ico a (a + p)
y : 𝕜
⊢ (l < y - toIcoDiv hp a x • p ∧ y - toIcoDiv hp a x • p < a + p ∧ y - toIcoDiv hp a x • p < u) ∧ y ∈ Ici x →
    y ∈ toIcoMod hp a ⁻¹' s

Next tactic:
rintro ⟨h, h'⟩
theorem continuous_right_toIcoMod : ContinuousWithinAt (toIcoMod hp a) (Ici x) x := by
  intro s h
  rw [Filter.mem_map, mem_nhdsWithin_iff_exists_mem_nhds_inter]
  haveI : Nontrivial 𝕜 := ⟨⟨0, p, hp.ne⟩⟩
  simp_rw [mem_nhds_iff_exists_Ioo_subset] at h ⊢
  obtain ⟨l, u, hxI, hIs⟩ := h
  let d := toIcoDiv hp a x • p
  have hd := toIcoMod_mem_Ico hp a x
  simp_rw [subset_def, mem_inter_iff]
  refine' ⟨_, ⟨l + d, min (a + p) u + d, _, fun x => id⟩, fun y => _⟩ <;>
    simp_rw [← sub_mem_Ioo_iff_left, mem_Ioo, lt_min_iff]
  · exact ⟨hxI.1, hd.2, hxI.2⟩
  · rintro ⟨h, h'⟩
    

Proof state:
case intro.intro.intro.refine'_2.intro
𝕜 : Type u_1
B : Type u_2
inst✝³ : LinearOrderedAddCommGroup 𝕜
inst✝² : Archimedean 𝕜
inst✝¹ : TopologicalSpace 𝕜
inst✝ : OrderTopology 𝕜
p : 𝕜
hp : 0 < p
a x : 𝕜
s : Set 𝕜
this : Nontrivial 𝕜
l u : 𝕜
hxI : toIcoMod hp a x ∈ Ioo l u
hIs : Ioo l u ⊆ s
d : 𝕜 := toIcoDiv hp a x • p
hd : toIcoMod hp a x ∈ Ico a (a + p)
y : 𝕜
h : l < y - toIcoDiv hp a x • p ∧ y - toIcoDiv hp a x • p < a + p ∧ y - toIcoDiv hp a x • p < u
h' : y ∈ Ici x
⊢ y ∈ toIcoMod hp a ⁻¹' s

Next tactic:
apply hIs
theorem continuous_right_toIcoMod : ContinuousWithinAt (toIcoMod hp a) (Ici x) x := by
  intro s h
  rw [Filter.mem_map, mem_nhdsWithin_iff_exists_mem_nhds_inter]
  haveI : Nontrivial 𝕜 := ⟨⟨0, p, hp.ne⟩⟩
  simp_rw [mem_nhds_iff_exists_Ioo_subset] at h ⊢
  obtain ⟨l, u, hxI, hIs⟩ := h
  let d := toIcoDiv hp a x • p
  have hd := toIcoMod_mem_Ico hp a x
  simp_rw [subset_def, mem_inter_iff]
  refine' ⟨_, ⟨l + d, min (a + p) u + d, _, fun x => id⟩, fun y => _⟩ <;>
    simp_rw [← sub_mem_Ioo_iff_left, mem_Ioo, lt_min_iff]
  · exact ⟨hxI.1, hd.2, hxI.2⟩
  · rintro ⟨h, h'⟩
    apply hIs
    

Proof state:
case intro.intro.intro.refine'_2.intro.a
𝕜 : Type u_1
B : Type u_2
inst✝³ : LinearOrderedAddCommGroup 𝕜
inst✝² : Archimedean 𝕜
inst✝¹ : TopologicalSpace 𝕜
inst✝ : OrderTopology 𝕜
p : 𝕜
hp : 0 < p
a x : 𝕜
s : Set 𝕜
this : Nontrivial 𝕜
l u : 𝕜
hxI : toIcoMod hp a x ∈ Ioo l u
hIs : Ioo l u ⊆ s
d : 𝕜 := toIcoDiv hp a x • p
hd : toIcoMod hp a x ∈ Ico a (a + p)
y : 𝕜
h : l < y - toIcoDiv hp a x • p ∧ y - toIcoDiv hp a x • p < a + p ∧ y - toIcoDiv hp a x • p < u
h' : y ∈ Ici x
⊢ toIcoMod hp a y ∈ Ioo l u

Next tactic:
rw [← toIcoMod_sub_zsmul, (toIcoMod_eq_self _).2]
theorem continuous_right_toIcoMod : ContinuousWithinAt (toIcoMod hp a) (Ici x) x := by
  intro s h
  rw [Filter.mem_map, mem_nhdsWithin_iff_exists_mem_nhds_inter]
  haveI : Nontrivial 𝕜 := ⟨⟨0, p, hp.ne⟩⟩
  simp_rw [mem_nhds_iff_exists_Ioo_subset] at h ⊢
  obtain ⟨l, u, hxI, hIs⟩ := h
  let d := toIcoDiv hp a x • p
  have hd := toIcoMod_mem_Ico hp a x
  simp_rw [subset_def, mem_inter_iff]
  refine' ⟨_, ⟨l + d, min (a + p) u + d, _, fun x => id⟩, fun y => _⟩ <;>
    simp_rw [← sub_mem_Ioo_iff_left, mem_Ioo, lt_min_iff]
  · exact ⟨hxI.1, hd.2, hxI.2⟩
  · rintro ⟨h, h'⟩
    apply hIs
    rw [← toIcoMod_sub_zsmul, (toIcoMod_eq_self _).2]
    

Proof state:
case intro.intro.intro.refine'_2.intro.a
𝕜 : Type u_1
B : Type u_2
inst✝³ : LinearOrderedAddCommGroup 𝕜
inst✝² : Archimedean 𝕜
inst✝¹ : TopologicalSpace 𝕜
inst✝ : OrderTopology 𝕜
p : 𝕜
hp : 0 < p
a x : 𝕜
s : Set 𝕜
this : Nontrivial 𝕜
l u : 𝕜
hxI : toIcoMod hp a x ∈ Ioo l u
hIs : Ioo l u ⊆ s
d : 𝕜 := toIcoDiv hp a x • p
hd : toIcoMod hp a x ∈ Ico a (a + p)
y : 𝕜
h : l < y - toIcoDiv hp a x • p ∧ y - toIcoDiv hp a x • p < a + p ∧ y - toIcoDiv hp a x • p < u
h' : y ∈ Ici x
⊢ y - ?intro.intro.intro.refine'_2.intro.a.m • p ∈ Ioo l u
case intro.intro.intro.refine'_2.intro.a
𝕜 : Type u_1
B : Type u_2
inst✝³ : LinearOrderedAddCommGroup 𝕜
inst✝² : Archimedean 𝕜
inst✝¹ : TopologicalSpace 𝕜
inst✝ : OrderTopology 𝕜
p : 𝕜
hp : 0 < p
a x : 𝕜
s : Set 𝕜
this : Nontrivial 𝕜
l u : 𝕜
hxI : toIcoMod hp a x ∈ Ioo l u
hIs : Ioo l u ⊆ s
d : 𝕜 := toIcoDiv hp a x • p
hd : toIcoMod hp a x ∈ Ico a (a + p)
y : 𝕜
h : l < y - toIcoDiv hp a x • p ∧ y - toIcoDiv hp a x • p < a + p ∧ y - toIcoDiv hp a x • p < u
h' : y ∈ Ici x
⊢ y - ?intro.intro.intro.refine'_2.intro.a.m • p ∈ Ico a (a + p)
case intro.intro.intro.refine'_2.intro.a.m
𝕜 : Type u_1
B : Type u_2
inst✝³ : LinearOrderedAddCommGroup 𝕜
inst✝² : Archimedean 𝕜
inst✝¹ : TopologicalSpace 𝕜
inst✝ : OrderTopology 𝕜
p : 𝕜
hp : 0 < p
a x : 𝕜
s : Set 𝕜
this : Nontrivial 𝕜
l u : 𝕜
hxI : toIcoMod hp a x ∈ Ioo l u
hIs : Ioo l u ⊆ s
d : 𝕜 := toIcoDiv hp a x • p
hd : toIcoMod hp a x ∈ Ico a (a + p)
y : 𝕜
h : l < y - toIcoDiv hp a x • p ∧ y - toIcoDiv hp a x • p < a + p ∧ y - toIcoDiv hp a x • p < u
h' : y ∈ Ici x
⊢ ℤ
case intro.intro.intro.refine'_2.intro.a.m
𝕜 : Type u_1
B : Type u_2
inst✝³ : LinearOrderedAddCommGroup 𝕜
inst✝² : Archimedean 𝕜
inst✝¹ : TopologicalSpace 𝕜
inst✝ : OrderTopology 𝕜
p : 𝕜
hp : 0 < p
a x : 𝕜
s : Set 𝕜
this : Nontrivial 𝕜
l u : 𝕜
hxI : toIcoMod hp a x ∈ Ioo l u
hIs : Ioo l u ⊆ s
d : 𝕜 := toIcoDiv hp a x • p
hd : toIcoMod hp a x ∈ Ico a (a + p)
y : 𝕜
h : l < y - toIcoDiv hp a x • p ∧ y - toIcoDiv hp a x • p < a + p ∧ y - toIcoDiv hp a x • p < u
h' : y ∈ Ici x
⊢ ℤ

Next tactic:
exacts [⟨h.1, h.2.2⟩, ⟨hd.1.trans (sub_le_sub_right h' _), h.2.1⟩]
theorem continuous_left_toIocMod : ContinuousWithinAt (toIocMod hp a) (Iic x) x := by
  

Proof state:
𝕜 : Type u_1
B : Type u_2
inst✝³ : LinearOrderedAddCommGroup 𝕜
inst✝² : Archimedean 𝕜
inst✝¹ : TopologicalSpace 𝕜
inst✝ : OrderTopology 𝕜
p : 𝕜
hp : 0 < p
a x : 𝕜
⊢ ContinuousWithinAt (toIocMod hp a) (Iic x) x

Next tactic:
rw [(funext fun y => Eq.trans (by rw [neg_neg]) <| toIocMod_neg _ _ _ :
      toIocMod hp a = (fun x => p - x) ∘ toIcoMod hp (-a) ∘ Neg.neg)]
theorem continuous_left_toIocMod : ContinuousWithinAt (toIocMod hp a) (Iic x) x := by
  rw [(funext fun y => Eq.trans (by 

Proof state:
𝕜 : Type u_1
B : Type u_2
inst✝³ : LinearOrderedAddCommGroup 𝕜
inst✝² : Archimedean 𝕜
inst✝¹ : TopologicalSpace 𝕜
inst✝ : OrderTopology 𝕜
p : 𝕜
hp : 0 < p
a x y : 𝕜
⊢ toIocMod hp a y = toIocMod hp a (- -y)

Next tactic:
rw [neg_neg]
theorem continuous_left_toIocMod : ContinuousWithinAt (toIocMod hp a) (Iic x) x := by
  rw [(funext fun y => Eq.trans (by rw [neg_neg]) <| toIocMod_neg _ _ _ :
      toIocMod hp a = (fun x => p - x) ∘ toIcoMod hp (-a) ∘ Neg.neg)]
  -- Porting note: added
  

Proof state:
𝕜 : Type u_1
B : Type u_2
inst✝³ : LinearOrderedAddCommGroup 𝕜
inst✝² : Archimedean 𝕜
inst✝¹ : TopologicalSpace 𝕜
inst✝ : OrderTopology 𝕜
p : 𝕜
hp : 0 < p
a x : 𝕜
⊢ ContinuousWithinAt ((fun x => p - x) ∘ toIcoMod hp (-a) ∘ Neg.neg) (Iic x) x

Next tactic:
have : ContinuousNeg 𝕜 := TopologicalAddGroup.toContinuousNeg
theorem continuous_left_toIocMod : ContinuousWithinAt (toIocMod hp a) (Iic x) x := by
  rw [(funext fun y => Eq.trans (by rw [neg_neg]) <| toIocMod_neg _ _ _ :
      toIocMod hp a = (fun x => p - x) ∘ toIcoMod hp (-a) ∘ Neg.neg)]
  -- Porting note: added
  have : ContinuousNeg 𝕜 := TopologicalAddGroup.toContinuousNeg
  

Proof state:
𝕜 : Type u_1
B : Type u_2
inst✝³ : LinearOrderedAddCommGroup 𝕜
inst✝² : Archimedean 𝕜
inst✝¹ : TopologicalSpace 𝕜
inst✝ : OrderTopology 𝕜
p : 𝕜
hp : 0 < p
a x : 𝕜
this : ContinuousNeg 𝕜
⊢ ContinuousWithinAt ((fun x => p - x) ∘ toIcoMod hp (-a) ∘ Neg.neg) (Iic x) x

Next tactic:
exact
    (continuous_sub_left _).continuousAt.comp_continuousWithinAt <|
      (continuous_right_toIcoMod _ _ _).comp continuous_neg.continuousWithinAt fun y => neg_le_neg
theorem toIcoMod_eventuallyEq_toIocMod : toIcoMod hp a =ᶠ[𝓝 x] toIocMod hp a :=
  IsOpen.mem_nhds
      (by
        

Proof state:
𝕜 : Type u_1
B : Type u_2
inst✝³ : LinearOrderedAddCommGroup 𝕜
inst✝² : Archimedean 𝕜
inst✝¹ : TopologicalSpace 𝕜
inst✝ : OrderTopology 𝕜
p : 𝕜
hp : 0 < p
a x : 𝕜
hx : ↑x ≠ ↑a
⊢ IsOpen {x | (fun x => toIcoMod hp a x = toIocMod hp a x) x}

Next tactic:
rw [Ico_eq_locus_Ioc_eq_iUnion_Ioo]
theorem toIcoMod_eventuallyEq_toIocMod : toIcoMod hp a =ᶠ[𝓝 x] toIocMod hp a :=
  IsOpen.mem_nhds
      (by
        rw [Ico_eq_locus_Ioc_eq_iUnion_Ioo]
        

Proof state:
𝕜 : Type u_1
B : Type u_2
inst✝³ : LinearOrderedAddCommGroup 𝕜
inst✝² : Archimedean 𝕜
inst✝¹ : TopologicalSpace 𝕜
inst✝ : OrderTopology 𝕜
p : 𝕜
hp : 0 < p
a x : 𝕜
hx : ↑x ≠ ↑a
⊢ IsOpen (⋃ z, Ioo (a + z • p) (a + p + z • p))

Next tactic:
exact isOpen_iUnion fun i => isOpen_Ioo
theorem coe_eq_zero_iff {x : 𝕜} : (x : AddCircle p) = 0 ↔ ∃ n : ℤ, n • p = x := by
  

Proof state:
𝕜 : Type u_1
B : Type u_2
inst✝² : LinearOrderedAddCommGroup 𝕜
inst✝¹ : TopologicalSpace 𝕜
inst✝ : OrderTopology 𝕜
p x : 𝕜
⊢ ↑x = 0 ↔ ∃ n, n • p = x

Next tactic:
simp [AddSubgroup.mem_zmultiples_iff]
theorem coe_eq_zero_of_pos_iff (hp : 0 < p) {x : 𝕜} (hx : 0 < x) :
    (x : AddCircle p) = 0 ↔ ∃ n : ℕ, n • p = x := by
  

Proof state:
𝕜 : Type u_1
B : Type u_2
inst✝² : LinearOrderedAddCommGroup 𝕜
inst✝¹ : TopologicalSpace 𝕜
inst✝ : OrderTopology 𝕜
p : 𝕜
hp : 0 < p
x : 𝕜
hx : 0 < x
⊢ ↑x = 0 ↔ ∃ n, n • p = x

Next tactic:
rw [coe_eq_zero_iff]
theorem coe_eq_zero_of_pos_iff (hp : 0 < p) {x : 𝕜} (hx : 0 < x) :
    (x : AddCircle p) = 0 ↔ ∃ n : ℕ, n • p = x := by
  rw [coe_eq_zero_iff]
  

Proof state:
𝕜 : Type u_1
B : Type u_2
inst✝² : LinearOrderedAddCommGroup 𝕜
inst✝¹ : TopologicalSpace 𝕜
inst✝ : OrderTopology 𝕜
p : 𝕜
hp : 0 < p
x : 𝕜
hx : 0 < x
⊢ (∃ n, n • p = x) ↔ ∃ n, n • p = x

Next tactic:
constructor
theorem coe_eq_zero_of_pos_iff (hp : 0 < p) {x : 𝕜} (hx : 0 < x) :
    (x : AddCircle p) = 0 ↔ ∃ n : ℕ, n • p = x := by
  rw [coe_eq_zero_iff]
  constructor <;> 

Proof state:
case mp
𝕜 : Type u_1
B : Type u_2
inst✝² : LinearOrderedAddCommGroup 𝕜
inst✝¹ : TopologicalSpace 𝕜
inst✝ : OrderTopology 𝕜
p : 𝕜
hp : 0 < p
x : 𝕜
hx : 0 < x
⊢ (∃ n, n • p = x) → ∃ n, n • p = x

Next tactic:
rintro ⟨n, rfl⟩
theorem coe_eq_zero_of_pos_iff (hp : 0 < p) {x : 𝕜} (hx : 0 < x) :
    (x : AddCircle p) = 0 ↔ ∃ n : ℕ, n • p = x := by
  rw [coe_eq_zero_iff]
  constructor <;> 

Proof state:
case mpr
𝕜 : Type u_1
B : Type u_2
inst✝² : LinearOrderedAddCommGroup 𝕜
inst✝¹ : TopologicalSpace 𝕜
inst✝ : OrderTopology 𝕜
p : 𝕜
hp : 0 < p
x : 𝕜
hx : 0 < x
⊢ (∃ n, n • p = x) → ∃ n, n • p = x

Next tactic:
rintro ⟨n, rfl⟩
theorem coe_eq_zero_of_pos_iff (hp : 0 < p) {x : 𝕜} (hx : 0 < x) :
    (x : AddCircle p) = 0 ↔ ∃ n : ℕ, n • p = x := by
  rw [coe_eq_zero_iff]
  constructor <;> rintro ⟨n, rfl⟩
  · 

Proof state:
case mp.intro
𝕜 : Type u_1
B : Type u_2
inst✝² : LinearOrderedAddCommGroup 𝕜
inst✝¹ : TopologicalSpace 𝕜
inst✝ : OrderTopology 𝕜
p : 𝕜
hp : 0 < p
n : ℤ
hx : 0 < n • p
⊢ ∃ n_1, n_1 • p = n • p

Next tactic:
replace hx : 0 < n
theorem coe_eq_zero_of_pos_iff (hp : 0 < p) {x : 𝕜} (hx : 0 < x) :
    (x : AddCircle p) = 0 ↔ ∃ n : ℕ, n • p = x := by
  rw [coe_eq_zero_iff]
  constructor <;> rintro ⟨n, rfl⟩
  · replace hx : 0 < n
    · 

Proof state:
case hx
𝕜 : Type u_1
B : Type u_2
inst✝² : LinearOrderedAddCommGroup 𝕜
inst✝¹ : TopologicalSpace 𝕜
inst✝ : OrderTopology 𝕜
p : 𝕜
hp : 0 < p
n : ℤ
hx : 0 < n • p
⊢ 0 < n

Next tactic:
contrapose! hx
theorem coe_eq_zero_of_pos_iff (hp : 0 < p) {x : 𝕜} (hx : 0 < x) :
    (x : AddCircle p) = 0 ↔ ∃ n : ℕ, n • p = x := by
  rw [coe_eq_zero_iff]
  constructor <;> rintro ⟨n, rfl⟩
  · replace hx : 0 < n
    · contrapose! hx
      

Proof state:
case hx
𝕜 : Type u_1
B : Type u_2
inst✝² : LinearOrderedAddCommGroup 𝕜
inst✝¹ : TopologicalSpace 𝕜
inst✝ : OrderTopology 𝕜
p : 𝕜
hp : 0 < p
n : ℤ
hx : n ≤ 0
⊢ n • p ≤ 0

Next tactic:
simpa only [← neg_nonneg, ← zsmul_neg, zsmul_neg'] using zsmul_nonneg hp.le (neg_nonneg.2 hx)
theorem coe_eq_zero_of_pos_iff (hp : 0 < p) {x : 𝕜} (hx : 0 < x) :
    (x : AddCircle p) = 0 ↔ ∃ n : ℕ, n • p = x := by
  rw [coe_eq_zero_iff]
  constructor <;> rintro ⟨n, rfl⟩
  · replace hx : 0 < n
    · contrapose! hx
      simpa only [← neg_nonneg, ← zsmul_neg, zsmul_neg'] using zsmul_nonneg hp.le (neg_nonneg.2 hx)
    

Proof state:
case mp.intro
𝕜 : Type u_1
B : Type u_2
inst✝² : LinearOrderedAddCommGroup 𝕜
inst✝¹ : TopologicalSpace 𝕜
inst✝ : OrderTopology 𝕜
p : 𝕜
hp : 0 < p
n : ℤ
hx : 0 < n
⊢ ∃ n_1, n_1 • p = n • p

Next tactic:
exact ⟨n.toNat, by rw [← coe_nat_zsmul, Int.toNat_of_nonneg hx.le]⟩
theorem coe_eq_zero_of_pos_iff (hp : 0 < p) {x : 𝕜} (hx : 0 < x) :
    (x : AddCircle p) = 0 ↔ ∃ n : ℕ, n • p = x := by
  rw [coe_eq_zero_iff]
  constructor <;> rintro ⟨n, rfl⟩
  · replace hx : 0 < n
    · contrapose! hx
      simpa only [← neg_nonneg, ← zsmul_neg, zsmul_neg'] using zsmul_nonneg hp.le (neg_nonneg.2 hx)
    exact ⟨n.toNat, by 

Proof state:
𝕜 : Type u_1
B : Type u_2
inst✝² : LinearOrderedAddCommGroup 𝕜
inst✝¹ : TopologicalSpace 𝕜
inst✝ : OrderTopology 𝕜
p : 𝕜
hp : 0 < p
n : ℤ
hx : 0 < n
⊢ Int.toNat n • p = n • p

Next tactic:
rw [← coe_nat_zsmul, Int.toNat_of_nonneg hx.le]
theorem coe_eq_zero_of_pos_iff (hp : 0 < p) {x : 𝕜} (hx : 0 < x) :
    (x : AddCircle p) = 0 ↔ ∃ n : ℕ, n • p = x := by
  rw [coe_eq_zero_iff]
  constructor <;> rintro ⟨n, rfl⟩
  · replace hx : 0 < n
    · contrapose! hx
      simpa only [← neg_nonneg, ← zsmul_neg, zsmul_neg'] using zsmul_nonneg hp.le (neg_nonneg.2 hx)
    exact ⟨n.toNat, by rw [← coe_nat_zsmul, Int.toNat_of_nonneg hx.le]⟩
  · 

Proof state:
case mpr.intro
𝕜 : Type u_1
B : Type u_2
inst✝² : LinearOrderedAddCommGroup 𝕜
inst✝¹ : TopologicalSpace 𝕜
inst✝ : OrderTopology 𝕜
p : 𝕜
hp : 0 < p
n : ℕ
hx : 0 < n • p
⊢ ∃ n_1, n_1 • p = n • p

Next tactic:
exact ⟨(n : ℤ), by simp⟩
theorem coe_eq_zero_of_pos_iff (hp : 0 < p) {x : 𝕜} (hx : 0 < x) :
    (x : AddCircle p) = 0 ↔ ∃ n : ℕ, n • p = x := by
  rw [coe_eq_zero_iff]
  constructor <;> rintro ⟨n, rfl⟩
  · replace hx : 0 < n
    · contrapose! hx
      simpa only [← neg_nonneg, ← zsmul_neg, zsmul_neg'] using zsmul_nonneg hp.le (neg_nonneg.2 hx)
    exact ⟨n.toNat, by rw [← coe_nat_zsmul, Int.toNat_of_nonneg hx.le]⟩
  · exact ⟨(n : ℤ), by 

Proof state:
𝕜 : Type u_1
B : Type u_2
inst✝² : LinearOrderedAddCommGroup 𝕜
inst✝¹ : TopologicalSpace 𝕜
inst✝ : OrderTopology 𝕜
p : 𝕜
hp : 0 < p
n : ℕ
hx : 0 < n • p
⊢ ↑n • p = n • p

Next tactic:
simp
theorem coe_add_period (x : 𝕜) : ((x + p : 𝕜) : AddCircle p) = x := by
  

Proof state:
𝕜 : Type u_1
B : Type u_2
inst✝² : LinearOrderedAddCommGroup 𝕜
inst✝¹ : TopologicalSpace 𝕜
inst✝ : OrderTopology 𝕜
p x : 𝕜
⊢ ↑(x + p) = ↑x

Next tactic:
rw [coe_add, ← eq_sub_iff_add_eq', sub_self, coe_period]
theorem coe_eq_coe_iff_of_mem_Ico {x y : 𝕜} (hx : x ∈ Ico a (a + p)) (hy : y ∈ Ico a (a + p)) :
    (x : AddCircle p) = y ↔ x = y := by
  

Proof state:
𝕜 : Type u_1
B : Type u_2
inst✝³ : LinearOrderedAddCommGroup 𝕜
inst✝² : TopologicalSpace 𝕜
inst✝¹ : OrderTopology 𝕜
p : 𝕜
hp : Fact (0 < p)
a : 𝕜
inst✝ : Archimedean 𝕜
x y : 𝕜
hx : x ∈ Ico a (a + p)
hy : y ∈ Ico a (a + p)
⊢ ↑x = ↑y ↔ x = y

Next tactic:
refine' ⟨fun h => _, by tauto⟩
theorem coe_eq_coe_iff_of_mem_Ico {x y : 𝕜} (hx : x ∈ Ico a (a + p)) (hy : y ∈ Ico a (a + p)) :
    (x : AddCircle p) = y ↔ x = y := by
  refine' ⟨fun h => _, by 

Proof state:
𝕜 : Type u_1
B : Type u_2
inst✝³ : LinearOrderedAddCommGroup 𝕜
inst✝² : TopologicalSpace 𝕜
inst✝¹ : OrderTopology 𝕜
p : 𝕜
hp : Fact (0 < p)
a : 𝕜
inst✝ : Archimedean 𝕜
x y : 𝕜
hx : x ∈ Ico a (a + p)
hy : y ∈ Ico a (a + p)
⊢ x = y → ↑x = ↑y

Next tactic:
tauto
theorem coe_eq_coe_iff_of_mem_Ico {x y : 𝕜} (hx : x ∈ Ico a (a + p)) (hy : y ∈ Ico a (a + p)) :
    (x : AddCircle p) = y ↔ x = y := by
  refine' ⟨fun h => _, by tauto⟩
  

Proof state:
𝕜 : Type u_1
B : Type u_2
inst✝³ : LinearOrderedAddCommGroup 𝕜
inst✝² : TopologicalSpace 𝕜
inst✝¹ : OrderTopology 𝕜
p : 𝕜
hp : Fact (0 < p)
a : 𝕜
inst✝ : Archimedean 𝕜
x y : 𝕜
hx : x ∈ Ico a (a + p)
hy : y ∈ Ico a (a + p)
h : ↑x = ↑y
⊢ x = y

Next tactic:
suffices (⟨x, hx⟩ : Ico a (a + p)) = ⟨y, hy⟩ by exact Subtype.mk.inj this