l3lab/ntp-mathlib huggingface dataset:
/-- Note that while this lemma cannot be easily generalized to a type class, it holds for ℤ as
well. See `Int.image_Ico_emod` for the ℤ version. -/
theorem image_Ico_mod (n a : ℕ) : (Ico n (n + a)).image (· % a) = range a := by
  obtain rfl | ha := eq_or_ne a 0
  · rw [range_zero, add_zero, Ico_self, image_empty]
  ext i
  simp only [mem_image, exists_prop, mem_range, mem_Ico]
  constructor
  · rintro ⟨i, _, rfl⟩
    exact mod_lt i ha.bot_lt
  intro hia
  have hn := Nat.mod_add_div n a
  obtain hi | hi := lt_or_le i (n % a)
  · refine' ⟨i + a * (n / a + 1), ⟨_, _⟩, _⟩
    · rw [add_comm (n / a), mul_add, mul_one, ← add_assoc]
      refine' hn.symm.le.trans (add_le_add_right _ _)
      simpa only [zero_add] using add_le_add (zero_le i) (Nat.mod_lt n ha.bot_lt).le
    · refine' lt_of_lt_of_le (add_lt_add_right hi (a * (n / a + 1))) _
      rw [mul_add, mul_one, ← add_assoc, hn]
    · rw [Nat.add_mul_mod_self_left, Nat.mod_eq_of_lt hia]
  · refine' ⟨i + a * (n / a), ⟨_, _⟩, _⟩
    · exact hn.symm.le.trans (add_le_add_right hi _)
    · rw [add_comm n a]
      refine' add_lt_add_of_lt_of_le hia (le_trans _ hn.le)
      simp only [zero_le, le_add_iff_nonneg_left]
    · 

Proof state:
case inr.a.mpr.inr.refine'_3
a✝ b c n a : ℕ
ha : a ≠ 0
i : ℕ
hia : i < a
hn : n % a + a * (n / a) = n
hi : n % a ≤ i
⊢ (i + a * (n / a)) % a = i

Next tactic:
rw [Nat.add_mul_mod_self_left, Nat.mod_eq_of_lt hia]
theorem multiset_Ico_map_mod (n a : ℕ) :
    (Multiset.Ico n (n + a)).map (· % a) = Multiset.range a := by
  

Proof state:
a✝ b c n a : ℕ
⊢ Multiset.map (fun x => x % a) (Multiset.Ico n (n + a)) = Multiset.range a

Next tactic:
convert congr_arg Finset.val (image_Ico_mod n a)
theorem multiset_Ico_map_mod (n a : ℕ) :
    (Multiset.Ico n (n + a)).map (· % a) = Multiset.range a := by
  convert congr_arg Finset.val (image_Ico_mod n a)
  

Proof state:
case h.e'_2
a✝ b c n a : ℕ
⊢ Multiset.map (fun x => x % a) (Multiset.Ico n (n + a)) = (image (fun x => x % a) (Finset.Ico n (n + a))).val

Next tactic:
refine' ((nodup_map_iff_inj_on (Finset.Ico _ _).nodup).2 <| _).dedup.symm
theorem multiset_Ico_map_mod (n a : ℕ) :
    (Multiset.Ico n (n + a)).map (· % a) = Multiset.range a := by
  convert congr_arg Finset.val (image_Ico_mod n a)
  refine' ((nodup_map_iff_inj_on (Finset.Ico _ _).nodup).2 <| _).dedup.symm
  

Proof state:
case h.e'_2
a✝ b c n a : ℕ
⊢ ∀ x ∈ (Finset.Ico n (n + a)).val, ∀ y ∈ (Finset.Ico n (n + a)).val, x % a = y % a → x = y

Next tactic:
exact mod_injOn_Ico _ _
theorem range_image_pred_top_sub (n : ℕ) :
    ((Finset.range n).image fun j => n - 1 - j) = Finset.range n := by
  

Proof state:
a b c n : ℕ
⊢ image (fun j => n - 1 - j) (range n) = range n

Next tactic:
cases n
theorem range_image_pred_top_sub (n : ℕ) :
    ((Finset.range n).image fun j => n - 1 - j) = Finset.range n := by
  cases n
  · 

Proof state:
case zero
a b c : ℕ
⊢ image (fun j => zero - 1 - j) (range zero) = range zero

Next tactic:
rw [range_zero, image_empty]
theorem range_image_pred_top_sub (n : ℕ) :
    ((Finset.range n).image fun j => n - 1 - j) = Finset.range n := by
  cases n
  · rw [range_zero, image_empty]
  · 

Proof state:
case succ
a b c n✝ : ℕ
⊢ image (fun j => succ n✝ - 1 - j) (range (succ n✝)) = range (succ n✝)

Next tactic:
rw [Finset.range_eq_Ico, Nat.Ico_image_const_sub_eq_Ico (Nat.zero_le _)]
theorem range_image_pred_top_sub (n : ℕ) :
    ((Finset.range n).image fun j => n - 1 - j) = Finset.range n := by
  cases n
  · rw [range_zero, image_empty]
  · rw [Finset.range_eq_Ico, Nat.Ico_image_const_sub_eq_Ico (Nat.zero_le _)]
    

Proof state:
case succ
a b c n✝ : ℕ
⊢ Ico (succ n✝ - 1 + 1 - succ n✝) (succ n✝ - 1 + 1 - 0) = Ico 0 (succ n✝)

Next tactic:
simp_rw [succ_sub_succ, tsub_zero, tsub_self]
theorem range_add_eq_union : range (a + b) = range a ∪ (range b).map (addLeftEmbedding a) := by
  

Proof state:
a b c : ℕ
⊢ range (a + b) = range a ∪ map (addLeftEmbedding a) (range b)

Next tactic:
rw [Finset.range_eq_Ico, map_eq_image]
theorem range_add_eq_union : range (a + b) = range a ∪ (range b).map (addLeftEmbedding a) := by
  rw [Finset.range_eq_Ico, map_eq_image]
  

Proof state:
a b c : ℕ
⊢ Ico 0 (a + b) = Ico 0 a ∪ image (⇑(addLeftEmbedding a)) (Ico 0 b)

Next tactic:
convert (@Ico_union_Ico_eq_Ico _ _ _ _ _ (a + b) a.zero_le le_self_add).symm
theorem range_add_eq_union : range (a + b) = range a ∪ (range b).map (addLeftEmbedding a) := by
  rw [Finset.range_eq_Ico, map_eq_image]
  convert (@Ico_union_Ico_eq_Ico _ _ _ _ _ (a + b) a.zero_le le_self_add).symm
  

Proof state:
case h.e'_3.h.e'_4
a b c : ℕ
⊢ image (⇑(addLeftEmbedding a)) (Ico 0 b) = Ico a (a + b)

Next tactic:
exact image_add_left_Ico _ _ _
theorem Nat.cauchy_induction' (seed : ℕ) (hs : P seed) (hi : ∀ x, seed ≤ x → P x → ∃ y, x < y ∧ P y)
    (n : ℕ) : P n := by
  

Proof state:
a b c : ℕ
P : ℕ → Prop
h : ∀ (n : ℕ), P (n + 1) → P n
seed : ℕ
hs : P seed
hi : ∀ (x : ℕ), seed ≤ x → P x → ∃ y, x < y ∧ P y
n : ℕ
⊢ P n

Next tactic:
apply Nat.decreasing_induction_of_infinite h fun hf => _
theorem Nat.cauchy_induction' (seed : ℕ) (hs : P seed) (hi : ∀ x, seed ≤ x → P x → ∃ y, x < y ∧ P y)
    (n : ℕ) : P n := by
  apply Nat.decreasing_induction_of_infinite h fun hf => _
  

Proof state:
a b c : ℕ
P : ℕ → Prop
h : ∀ (n : ℕ), P (n + 1) → P n
seed : ℕ
hs : P seed
hi : ∀ (x : ℕ), seed ≤ x → P x → ∃ y, x < y ∧ P y
n : ℕ
⊢ Set.Finite {x | P x} → False

Next tactic:
intro hf
theorem Nat.cauchy_induction' (seed : ℕ) (hs : P seed) (hi : ∀ x, seed ≤ x → P x → ∃ y, x < y ∧ P y)
    (n : ℕ) : P n := by
  apply Nat.decreasing_induction_of_infinite h fun hf => _
  intro hf
  

Proof state:
a b c : ℕ
P : ℕ → Prop
h : ∀ (n : ℕ), P (n + 1) → P n
seed : ℕ
hs : P seed
hi : ∀ (x : ℕ), seed ≤ x → P x → ∃ y, x < y ∧ P y
n : ℕ
hf : Set.Finite {x | P x}
⊢ False

Next tactic:
obtain ⟨m, hP, hm⟩ := hf.exists_maximal_wrt id _ ⟨seed, hs⟩
theorem Nat.cauchy_induction' (seed : ℕ) (hs : P seed) (hi : ∀ x, seed ≤ x → P x → ∃ y, x < y ∧ P y)
    (n : ℕ) : P n := by
  apply Nat.decreasing_induction_of_infinite h fun hf => _
  intro hf
  obtain ⟨m, hP, hm⟩ := hf.exists_maximal_wrt id _ ⟨seed, hs⟩
  

Proof state:
case intro.intro
a b c : ℕ
P : ℕ → Prop
h : ∀ (n : ℕ), P (n + 1) → P n
seed : ℕ
hs : P seed
hi : ∀ (x : ℕ), seed ≤ x → P x → ∃ y, x < y ∧ P y
n : ℕ
hf : Set.Finite {x | P x}
m : ℕ
hP : m ∈ {x | P x}
hm : ∀ a' ∈ {x | P x}, id m ≤ id a' → id m = id a'
⊢ False

Next tactic:
obtain ⟨y, hl, hy⟩ := hi m (le_of_not_lt fun hl => hl.ne <| hm seed hs hl.le) hP
theorem Nat.cauchy_induction' (seed : ℕ) (hs : P seed) (hi : ∀ x, seed ≤ x → P x → ∃ y, x < y ∧ P y)
    (n : ℕ) : P n := by
  apply Nat.decreasing_induction_of_infinite h fun hf => _
  intro hf
  obtain ⟨m, hP, hm⟩ := hf.exists_maximal_wrt id _ ⟨seed, hs⟩
  obtain ⟨y, hl, hy⟩ := hi m (le_of_not_lt fun hl => hl.ne <| hm seed hs hl.le) hP
  

Proof state:
case intro.intro.intro.intro
a b c : ℕ
P : ℕ → Prop
h : ∀ (n : ℕ), P (n + 1) → P n
seed : ℕ
hs : P seed
hi : ∀ (x : ℕ), seed ≤ x → P x → ∃ y, x < y ∧ P y
n : ℕ
hf : Set.Finite {x | P x}
m : ℕ
hP : m ∈ {x | P x}
hm : ∀ a' ∈ {x | P x}, id m ≤ id a' → id m = id a'
y : ℕ
hl : m < y
hy : P y
⊢ False

Next tactic:
exact hl.ne (hm y hy hl.le)
theorem Nat.cauchy_induction_mul (k seed : ℕ) (hk : 1 < k) (hs : P seed.succ)
    (hm : ∀ x, seed < x → P x → P (k * x)) (n : ℕ) : P n := by
  

Proof state:
a b c : ℕ
P : ℕ → Prop
h : ∀ (n : ℕ), P (n + 1) → P n
k seed : ℕ
hk : 1 < k
hs : P (succ seed)
hm : ∀ (x : ℕ), seed < x → P x → P (k * x)
n : ℕ
⊢ P n

Next tactic:
apply Nat.cauchy_induction h _ hs (k * ·) fun x hl hP => ⟨_, hm x hl hP⟩
theorem Nat.cauchy_induction_mul (k seed : ℕ) (hk : 1 < k) (hs : P seed.succ)
    (hm : ∀ x, seed < x → P x → P (k * x)) (n : ℕ) : P n := by
  apply Nat.cauchy_induction h _ hs (k * ·) fun x hl hP => ⟨_, hm x hl hP⟩
  

Proof state:
a b c : ℕ
P : ℕ → Prop
h : ∀ (n : ℕ), P (n + 1) → P n
k seed : ℕ
hk : 1 < k
hs : P (succ seed)
hm : ∀ (x : ℕ), seed < x → P x → P (k * x)
n : ℕ
⊢ ∀ (x : ℕ), succ seed ≤ x → P x → x < (fun x => k * x) x

Next tactic:
intro _ hl _
theorem Nat.cauchy_induction_mul (k seed : ℕ) (hk : 1 < k) (hs : P seed.succ)
    (hm : ∀ x, seed < x → P x → P (k * x)) (n : ℕ) : P n := by
  apply Nat.cauchy_induction h _ hs (k * ·) fun x hl hP => ⟨_, hm x hl hP⟩
  intro _ hl _
  

Proof state:
a b c : ℕ
P : ℕ → Prop
h : ∀ (n : ℕ), P (n + 1) → P n
k seed : ℕ
hk : 1 < k
hs : P (succ seed)
hm : ∀ (x : ℕ), seed < x → P x → P (k * x)
n x✝ : ℕ
hl : succ seed ≤ x✝
hP✝ : P x✝
⊢ x✝ < (fun x => k * x) x✝

Next tactic:
convert (mul_lt_mul_right <| seed.succ_pos.trans_le hl).2 hk
theorem Nat.cauchy_induction_mul (k seed : ℕ) (hk : 1 < k) (hs : P seed.succ)
    (hm : ∀ x, seed < x → P x → P (k * x)) (n : ℕ) : P n := by
  apply Nat.cauchy_induction h _ hs (k * ·) fun x hl hP => ⟨_, hm x hl hP⟩
  intro _ hl _
  convert (mul_lt_mul_right <| seed.succ_pos.trans_le hl).2 hk
  

Proof state:
case h.e'_3
a b c : ℕ
P : ℕ → Prop
h : ∀ (n : ℕ), P (n + 1) → P n
k seed : ℕ
hk : 1 < k
hs : P (succ seed)
hm : ∀ (x : ℕ), seed < x → P x → P (k * x)
n x✝ : ℕ
hl : succ seed ≤ x✝
hP✝ : P x✝
⊢ x✝ = 1 * x✝

Next tactic:
rw [one_mul]
theorem continuous_hatInv [CompletableTopField K] {x : hat K} (h : x ≠ 0) :
    ContinuousAt hatInv x := by
  

Proof state:
K : Type u_1
inst✝² : Field K
inst✝¹ : UniformSpace K
inst✝ : CompletableTopField K
x : hat K
h : x ≠ 0
⊢ ContinuousAt hatInv x

Next tactic:
haveI : T3Space (hat K) := Completion.t3Space K
theorem continuous_hatInv [CompletableTopField K] {x : hat K} (h : x ≠ 0) :
    ContinuousAt hatInv x := by
  haveI : T3Space (hat K) := Completion.t3Space K
  

Proof state:
K : Type u_1
inst✝² : Field K
inst✝¹ : UniformSpace K
inst✝ : CompletableTopField K
x : hat K
h : x ≠ 0
this : T3Space (hat K)
⊢ ContinuousAt hatInv x

Next tactic:
refine' denseInducing_coe.continuousAt_extend _
theorem continuous_hatInv [CompletableTopField K] {x : hat K} (h : x ≠ 0) :
    ContinuousAt hatInv x := by
  haveI : T3Space (hat K) := Completion.t3Space K
  refine' denseInducing_coe.continuousAt_extend _
  

Proof state:
K : Type u_1
inst✝² : Field K
inst✝¹ : UniformSpace K
inst✝ : CompletableTopField K
x : hat K
h : x ≠ 0
this : T3Space (hat K)
⊢ ∀ᶠ (x : hat K) in 𝓝 x, ∃ c, Tendsto (fun x => ↑K x⁻¹) (Filter.comap (↑K) (𝓝 x)) (𝓝 c)

Next tactic:
apply mem_of_superset (compl_singleton_mem_nhds h)
theorem continuous_hatInv [CompletableTopField K] {x : hat K} (h : x ≠ 0) :
    ContinuousAt hatInv x := by
  haveI : T3Space (hat K) := Completion.t3Space K
  refine' denseInducing_coe.continuousAt_extend _
  apply mem_of_superset (compl_singleton_mem_nhds h)
  

Proof state:
K : Type u_1
inst✝² : Field K
inst✝¹ : UniformSpace K
inst✝ : CompletableTopField K
x : hat K
h : x ≠ 0
this : T3Space (hat K)
⊢ {0}ᶜ ⊆ {x | (fun x => ∃ c, Tendsto (fun x => ↑K x⁻¹) (Filter.comap (↑K) (𝓝 x)) (𝓝 c)) x}

Next tactic:
intro y y_ne
theorem continuous_hatInv [CompletableTopField K] {x : hat K} (h : x ≠ 0) :
    ContinuousAt hatInv x := by
  haveI : T3Space (hat K) := Completion.t3Space K
  refine' denseInducing_coe.continuousAt_extend _
  apply mem_of_superset (compl_singleton_mem_nhds h)
  intro y y_ne
  

Proof state:
K : Type u_1
inst✝² : Field K
inst✝¹ : UniformSpace K
inst✝ : CompletableTopField K
x : hat K
h : x ≠ 0
this : T3Space (hat K)
y : hat K
y_ne : y ∈ {0}ᶜ
⊢ y ∈ {x | (fun x => ∃ c, Tendsto (fun x => ↑K x⁻¹) (Filter.comap (↑K) (𝓝 x)) (𝓝 c)) x}

Next tactic:
rw [mem_compl_singleton_iff] at y_ne
theorem continuous_hatInv [CompletableTopField K] {x : hat K} (h : x ≠ 0) :
    ContinuousAt hatInv x := by
  haveI : T3Space (hat K) := Completion.t3Space K
  refine' denseInducing_coe.continuousAt_extend _
  apply mem_of_superset (compl_singleton_mem_nhds h)
  intro y y_ne
  rw [mem_compl_singleton_iff] at y_ne
  

Proof state:
K : Type u_1
inst✝² : Field K
inst✝¹ : UniformSpace K
inst✝ : CompletableTopField K
x : hat K
h : x ≠ 0
this : T3Space (hat K)
y : hat K
y_ne : y ≠ 0
⊢ y ∈ {x | (fun x => ∃ c, Tendsto (fun x => ↑K x⁻¹) (Filter.comap (↑K) (𝓝 x)) (𝓝 c)) x}

Next tactic:
apply CompleteSpace.complete
theorem continuous_hatInv [CompletableTopField K] {x : hat K} (h : x ≠ 0) :
    ContinuousAt hatInv x := by
  haveI : T3Space (hat K) := Completion.t3Space K
  refine' denseInducing_coe.continuousAt_extend _
  apply mem_of_superset (compl_singleton_mem_nhds h)
  intro y y_ne
  rw [mem_compl_singleton_iff] at y_ne
  apply CompleteSpace.complete
  

Proof state:
case a
K : Type u_1
inst✝² : Field K
inst✝¹ : UniformSpace K
inst✝ : CompletableTopField K
x : hat K
h : x ≠ 0
this : T3Space (hat K)
y : hat K
y_ne : y ≠ 0
⊢ Cauchy (map (fun x => ↑K x⁻¹) (Filter.comap (↑K) (𝓝 y)))

Next tactic:
have : (fun (x : K) => (↑x⁻¹: hat K)) =
      ((fun (y : K) => (↑y: hat K))∘(fun (x : K) => (x⁻¹ : K))) := by
    unfold Function.comp
    simp
theorem continuous_hatInv [CompletableTopField K] {x : hat K} (h : x ≠ 0) :
    ContinuousAt hatInv x := by
  haveI : T3Space (hat K) := Completion.t3Space K
  refine' denseInducing_coe.continuousAt_extend _
  apply mem_of_superset (compl_singleton_mem_nhds h)
  intro y y_ne
  rw [mem_compl_singleton_iff] at y_ne
  apply CompleteSpace.complete
  have : (fun (x : K) => (↑x⁻¹: hat K)) =
      ((fun (y : K) => (↑y: hat K))∘(fun (x : K) => (x⁻¹ : K))) := by
    

Proof state:
K : Type u_1
inst✝² : Field K
inst✝¹ : UniformSpace K
inst✝ : CompletableTopField K
x : hat K
h : x ≠ 0
this : T3Space (hat K)
y : hat K
y_ne : y ≠ 0
⊢ (fun x => ↑K x⁻¹) = (fun y => ↑K y) ∘ fun x => x⁻¹

Next tactic:
unfold Function.comp
theorem continuous_hatInv [CompletableTopField K] {x : hat K} (h : x ≠ 0) :
    ContinuousAt hatInv x := by
  haveI : T3Space (hat K) := Completion.t3Space K
  refine' denseInducing_coe.continuousAt_extend _
  apply mem_of_superset (compl_singleton_mem_nhds h)
  intro y y_ne
  rw [mem_compl_singleton_iff] at y_ne
  apply CompleteSpace.complete
  have : (fun (x : K) => (↑x⁻¹: hat K)) =
      ((fun (y : K) => (↑y: hat K))∘(fun (x : K) => (x⁻¹ : K))) := by
    unfold Function.comp
    

Proof state:
K : Type u_1
inst✝² : Field K
inst✝¹ : UniformSpace K
inst✝ : CompletableTopField K
x : hat K
h : x ≠ 0
this : T3Space (hat K)
y : hat K
y_ne : y ≠ 0
⊢ (fun x => ↑K x⁻¹) = fun x => (fun y => ↑K y) ((fun x => x⁻¹) x)

Next tactic:
simp
theorem continuous_hatInv [CompletableTopField K] {x : hat K} (h : x ≠ 0) :
    ContinuousAt hatInv x := by
  haveI : T3Space (hat K) := Completion.t3Space K
  refine' denseInducing_coe.continuousAt_extend _
  apply mem_of_superset (compl_singleton_mem_nhds h)
  intro y y_ne
  rw [mem_compl_singleton_iff] at y_ne
  apply CompleteSpace.complete
  have : (fun (x : K) => (↑x⁻¹: hat K)) =
      ((fun (y : K) => (↑y: hat K))∘(fun (x : K) => (x⁻¹ : K))) := by
    unfold Function.comp
    simp
  

Proof state:
case a
K : Type u_1
inst✝² : Field K
inst✝¹ : UniformSpace K
inst✝ : CompletableTopField K
x : hat K
h : x ≠ 0
this✝ : T3Space (hat K)
y : hat K
y_ne : y ≠ 0
this : (fun x => ↑K x⁻¹) = (fun y => ↑K y) ∘ fun x => x⁻¹
⊢ Cauchy (map (fun x => ↑K x⁻¹) (Filter.comap (↑K) (𝓝 y)))

Next tactic:
rw [this, ← Filter.map_map]
theorem continuous_hatInv [CompletableTopField K] {x : hat K} (h : x ≠ 0) :
    ContinuousAt hatInv x := by
  haveI : T3Space (hat K) := Completion.t3Space K
  refine' denseInducing_coe.continuousAt_extend _
  apply mem_of_superset (compl_singleton_mem_nhds h)
  intro y y_ne
  rw [mem_compl_singleton_iff] at y_ne
  apply CompleteSpace.complete
  have : (fun (x : K) => (↑x⁻¹: hat K)) =
      ((fun (y : K) => (↑y: hat K))∘(fun (x : K) => (x⁻¹ : K))) := by
    unfold Function.comp
    simp
  rw [this, ← Filter.map_map]
  

Proof state:
case a
K : Type u_1
inst✝² : Field K
inst✝¹ : UniformSpace K
inst✝ : CompletableTopField K
x : hat K
h : x ≠ 0
this✝ : T3Space (hat K)
y : hat K
y_ne : y ≠ 0
this : (fun x => ↑K x⁻¹) = (fun y => ↑K y) ∘ fun x => x⁻¹
⊢ Cauchy (map (fun y => ↑K y) (map (fun x => x⁻¹) (Filter.comap (↑K) (𝓝 y))))

Next tactic:
apply Cauchy.map _ (Completion.uniformContinuous_coe K)
theorem continuous_hatInv [CompletableTopField K] {x : hat K} (h : x ≠ 0) :
    ContinuousAt hatInv x := by
  haveI : T3Space (hat K) := Completion.t3Space K
  refine' denseInducing_coe.continuousAt_extend _
  apply mem_of_superset (compl_singleton_mem_nhds h)
  intro y y_ne
  rw [mem_compl_singleton_iff] at y_ne
  apply CompleteSpace.complete
  have : (fun (x : K) => (↑x⁻¹: hat K)) =
      ((fun (y : K) => (↑y: hat K))∘(fun (x : K) => (x⁻¹ : K))) := by
    unfold Function.comp
    simp
  rw [this, ← Filter.map_map]
  apply Cauchy.map _ (Completion.uniformContinuous_coe K)
  

Proof state:
K : Type u_1
inst✝² : Field K
inst✝¹ : UniformSpace K
inst✝ : CompletableTopField K
x : hat K
h : x ≠ 0
this✝ : T3Space (hat K)
y : hat K
y_ne : y ≠ 0
this : (fun x => ↑K x⁻¹) = (fun y => ↑K y) ∘ fun x => x⁻¹
⊢ Cauchy (map (fun x => x⁻¹) (Filter.comap (↑K) (𝓝 y)))

Next tactic:
apply CompletableTopField.nice
theorem continuous_hatInv [CompletableTopField K] {x : hat K} (h : x ≠ 0) :
    ContinuousAt hatInv x := by
  haveI : T3Space (hat K) := Completion.t3Space K
  refine' denseInducing_coe.continuousAt_extend _
  apply mem_of_superset (compl_singleton_mem_nhds h)
  intro y y_ne
  rw [mem_compl_singleton_iff] at y_ne
  apply CompleteSpace.complete
  have : (fun (x : K) => (↑x⁻¹: hat K)) =
      ((fun (y : K) => (↑y: hat K))∘(fun (x : K) => (x⁻¹ : K))) := by
    unfold Function.comp
    simp
  rw [this, ← Filter.map_map]
  apply Cauchy.map _ (Completion.uniformContinuous_coe K)
  apply CompletableTopField.nice
  · 

Proof state:
case a
K : Type u_1
inst✝² : Field K
inst✝¹ : UniformSpace K
inst✝ : CompletableTopField K
x : hat K
h : x ≠ 0
this✝ : T3Space (hat K)
y : hat K
y_ne : y ≠ 0
this : (fun x => ↑K x⁻¹) = (fun y => ↑K y) ∘ fun x => x⁻¹
⊢ Cauchy (Filter.comap (↑K) (𝓝 y))

Next tactic:
haveI := denseInducing_coe.comap_nhds_neBot y
theorem continuous_hatInv [CompletableTopField K] {x : hat K} (h : x ≠ 0) :
    ContinuousAt hatInv x := by
  haveI : T3Space (hat K) := Completion.t3Space K
  refine' denseInducing_coe.continuousAt_extend _
  apply mem_of_superset (compl_singleton_mem_nhds h)
  intro y y_ne
  rw [mem_compl_singleton_iff] at y_ne
  apply CompleteSpace.complete
  have : (fun (x : K) => (↑x⁻¹: hat K)) =
      ((fun (y : K) => (↑y: hat K))∘(fun (x : K) => (x⁻¹ : K))) := by
    unfold Function.comp
    simp
  rw [this, ← Filter.map_map]
  apply Cauchy.map _ (Completion.uniformContinuous_coe K)
  apply CompletableTopField.nice
  · haveI := denseInducing_coe.comap_nhds_neBot y
    

Proof state:
case a
K : Type u_1
inst✝² : Field K
inst✝¹ : UniformSpace K
inst✝ : CompletableTopField K
x : hat K
h : x ≠ 0
this✝¹ : T3Space (hat K)
y : hat K
y_ne : y ≠ 0
this✝ : (fun x => ↑K x⁻¹) = (fun y => ↑K y) ∘ fun x => x⁻¹
this : NeBot (Filter.comap (↑K) (𝓝 y))
⊢ Cauchy (Filter.comap (↑K) (𝓝 y))

Next tactic:
apply cauchy_nhds.comap
theorem continuous_hatInv [CompletableTopField K] {x : hat K} (h : x ≠ 0) :
    ContinuousAt hatInv x := by
  haveI : T3Space (hat K) := Completion.t3Space K
  refine' denseInducing_coe.continuousAt_extend _
  apply mem_of_superset (compl_singleton_mem_nhds h)
  intro y y_ne
  rw [mem_compl_singleton_iff] at y_ne
  apply CompleteSpace.complete
  have : (fun (x : K) => (↑x⁻¹: hat K)) =
      ((fun (y : K) => (↑y: hat K))∘(fun (x : K) => (x⁻¹ : K))) := by
    unfold Function.comp
    simp
  rw [this, ← Filter.map_map]
  apply Cauchy.map _ (Completion.uniformContinuous_coe K)
  apply CompletableTopField.nice
  · haveI := denseInducing_coe.comap_nhds_neBot y
    apply cauchy_nhds.comap
    · 

Proof state:
case a.hm
K : Type u_1
inst✝² : Field K
inst✝¹ : UniformSpace K
inst✝ : CompletableTopField K
x : hat K
h : x ≠ 0
this✝¹ : T3Space (hat K)
y : hat K
y_ne : y ≠ 0
this✝ : (fun x => ↑K x⁻¹) = (fun y => ↑K y) ∘ fun x => x⁻¹
this : NeBot (Filter.comap (↑K) (𝓝 y))
⊢ Filter.comap (fun p => (↑K p.1, ↑K p.2)) (uniformity (hat K)) ≤ uniformity K

Next tactic:
rw [Completion.comap_coe_eq_uniformity]
theorem continuous_hatInv [CompletableTopField K] {x : hat K} (h : x ≠ 0) :
    ContinuousAt hatInv x := by
  haveI : T3Space (hat K) := Completion.t3Space K
  refine' denseInducing_coe.continuousAt_extend _
  apply mem_of_superset (compl_singleton_mem_nhds h)
  intro y y_ne
  rw [mem_compl_singleton_iff] at y_ne
  apply CompleteSpace.complete
  have : (fun (x : K) => (↑x⁻¹: hat K)) =
      ((fun (y : K) => (↑y: hat K))∘(fun (x : K) => (x⁻¹ : K))) := by
    unfold Function.comp
    simp
  rw [this, ← Filter.map_map]
  apply Cauchy.map _ (Completion.uniformContinuous_coe K)
  apply CompletableTopField.nice
  · haveI := denseInducing_coe.comap_nhds_neBot y
    apply cauchy_nhds.comap
    · rw [Completion.comap_coe_eq_uniformity]
  · 

Proof state:
case a
K : Type u_1
inst✝² : Field K
inst✝¹ : UniformSpace K
inst✝ : CompletableTopField K
x : hat K
h : x ≠ 0
this✝ : T3Space (hat K)
y : hat K
y_ne : y ≠ 0
this : (fun x => ↑K x⁻¹) = (fun y => ↑K y) ∘ fun x => x⁻¹
⊢ 𝓝 0 ⊓ Filter.comap (↑K) (𝓝 y) = ⊥

Next tactic:
have eq_bot : 𝓝 (0 : hat K) ⊓ 𝓝 y = ⊥ := by
      by_contra h
      exact y_ne (eq_of_nhds_neBot <| neBot_iff.mpr h).symm
theorem continuous_hatInv [CompletableTopField K] {x : hat K} (h : x ≠ 0) :
    ContinuousAt hatInv x := by
  haveI : T3Space (hat K) := Completion.t3Space K
  refine' denseInducing_coe.continuousAt_extend _
  apply mem_of_superset (compl_singleton_mem_nhds h)
  intro y y_ne
  rw [mem_compl_singleton_iff] at y_ne
  apply CompleteSpace.complete
  have : (fun (x : K) => (↑x⁻¹: hat K)) =
      ((fun (y : K) => (↑y: hat K))∘(fun (x : K) => (x⁻¹ : K))) := by
    unfold Function.comp
    simp
  rw [this, ← Filter.map_map]
  apply Cauchy.map _ (Completion.uniformContinuous_coe K)
  apply CompletableTopField.nice
  · haveI := denseInducing_coe.comap_nhds_neBot y
    apply cauchy_nhds.comap
    · rw [Completion.comap_coe_eq_uniformity]
  · have eq_bot : 𝓝 (0 : hat K) ⊓ 𝓝 y = ⊥ := by
      

Proof state:
K : Type u_1
inst✝² : Field K
inst✝¹ : UniformSpace K
inst✝ : CompletableTopField K
x : hat K
h : x ≠ 0
this✝ : T3Space (hat K)
y : hat K
y_ne : y ≠ 0
this : (fun x => ↑K x⁻¹) = (fun y => ↑K y) ∘ fun x => x⁻¹
⊢ 𝓝 0 ⊓ 𝓝 y = ⊥

Next tactic:
by_contra h
theorem continuous_hatInv [CompletableTopField K] {x : hat K} (h : x ≠ 0) :
    ContinuousAt hatInv x := by
  haveI : T3Space (hat K) := Completion.t3Space K
  refine' denseInducing_coe.continuousAt_extend _
  apply mem_of_superset (compl_singleton_mem_nhds h)
  intro y y_ne
  rw [mem_compl_singleton_iff] at y_ne
  apply CompleteSpace.complete
  have : (fun (x : K) => (↑x⁻¹: hat K)) =
      ((fun (y : K) => (↑y: hat K))∘(fun (x : K) => (x⁻¹ : K))) := by
    unfold Function.comp
    simp
  rw [this, ← Filter.map_map]
  apply Cauchy.map _ (Completion.uniformContinuous_coe K)
  apply CompletableTopField.nice
  · haveI := denseInducing_coe.comap_nhds_neBot y
    apply cauchy_nhds.comap
    · rw [Completion.comap_coe_eq_uniformity]
  · have eq_bot : 𝓝 (0 : hat K) ⊓ 𝓝 y = ⊥ := by
      by_contra h
      

Proof state:
K : Type u_1
inst✝² : Field K
inst✝¹ : UniformSpace K
inst✝ : CompletableTopField K
x : hat K
h✝ : x ≠ 0
this✝ : T3Space (hat K)
y : hat K
y_ne : y ≠ 0
this : (fun x => ↑K x⁻¹) = (fun y => ↑K y) ∘ fun x => x⁻¹
h : ¬𝓝 0 ⊓ 𝓝 y = ⊥
⊢ False

Next tactic:
exact y_ne (eq_of_nhds_neBot <| neBot_iff.mpr h).symm