Lean4
theorem continuous_extension : Continuous (Valued.extension : hat K → Γ₀) :=
by
refine Completion.isDenseInducing_coe.continuous_extend ?_
intro x₀
rcases eq_or_ne x₀ 0 with (rfl | h)
· refine ⟨0, ?_⟩
erw [← Completion.isDenseInducing_coe.isInducing.nhds_eq_comap]
exact Valued.continuous_valuation.tendsto' 0 0 (map_zero v)
· have preimage_one : v ⁻¹' {(1 : Γ₀)} ∈ 𝓝 (1 : K) :=
by
have : (v (1 : K) : Γ₀) ≠ 0 := by
rw [Valuation.map_one]
exact zero_ne_one.symm
convert Valued.loc_const this
ext x
rw [Valuation.map_one, mem_preimage, mem_singleton_iff, mem_setOf_eq]
obtain ⟨V, V_in, hV⟩ : ∃ V ∈ 𝓝 (1 : hat K), ∀ x : K, (x : hat K) ∈ V → (v x : Γ₀) = 1 := by
rwa [Completion.isDenseInducing_coe.nhds_eq_comap, mem_comap] at preimage_one
have : ∃ V' ∈ 𝓝 (1 : hat K), (0 : hat K) ∉ V' ∧ ∀ (x) (_ : x ∈ V') (y) (_ : y ∈ V'), x * y⁻¹ ∈ V :=
by
have : Tendsto (fun p : hat K × hat K => p.1 * p.2⁻¹) ((𝓝 1) ×ˢ (𝓝 1)) (𝓝 1) :=
by
rw [← nhds_prod_eq]
conv =>
congr
rfl
rfl
rw [← one_mul (1 : hat K)]
refine Tendsto.mul continuous_fst.continuousAt (Tendsto.comp ?_ continuous_snd.continuousAt)
convert (continuousAt_inv₀ (zero_ne_one.symm : 1 ≠ (0 : hat K))).tendsto
exact inv_one.symm
rcases tendsto_prod_self_iff.mp this V V_in with ⟨U, U_in, hU⟩
let hatKstar := ({0}ᶜ : Set <| hat K)
have : hatKstar ∈ 𝓝 (1 : hat K) := compl_singleton_mem_nhds zero_ne_one.symm
use U ∩ hatKstar, Filter.inter_mem U_in this
constructor
· rintro ⟨_, h'⟩
rw [mem_compl_singleton_iff] at h'
exact h' rfl
· rintro x ⟨hx, _⟩ y ⟨hy, _⟩
apply hU <;> assumption
rcases this with ⟨V', V'_in, zeroV', hV'⟩
have nhds_right : (fun x => x * x₀) '' V' ∈ 𝓝 x₀ :=
by
have l : Function.LeftInverse (fun x : hat K => x * x₀⁻¹) fun x : hat K => x * x₀ :=
by
intro x
simp only [mul_assoc, mul_inv_cancel₀ h, mul_one]
have r : Function.RightInverse (fun x : hat K => x * x₀⁻¹) fun x : hat K => x * x₀ :=
by
intro x
simp only [mul_assoc, inv_mul_cancel₀ h, mul_one]
have c : Continuous fun x : hat K => x * x₀⁻¹ := continuous_id.mul continuous_const
rw [image_eq_preimage_of_inverse l r]
rw [← mul_inv_cancel₀ h] at V'_in
exact c.continuousAt V'_in
have : ∃ z₀ : K, ∃ y₀ ∈ V', ↑z₀ = y₀ * x₀ ∧ z₀ ≠ 0 :=
by
rcases Completion.denseRange_coe.mem_nhds nhds_right with ⟨z₀, y₀, y₀_in, H : y₀ * x₀ = z₀⟩
refine ⟨z₀, y₀, y₀_in, ⟨H.symm, ?_⟩⟩
rintro rfl
exact mul_ne_zero (ne_of_mem_of_not_mem y₀_in zeroV') h H
rcases this with ⟨z₀, y₀, y₀_in, hz₀, z₀_ne⟩
have vz₀_ne : (v z₀ : Γ₀) ≠ 0 := by rwa [Valuation.ne_zero_iff]
refine ⟨v z₀, ?_⟩
rw [WithZeroTopology.tendsto_of_ne_zero vz₀_ne, eventually_comap]
filter_upwards [nhds_right] with x x_in a ha
rcases x_in with ⟨y, y_in, rfl⟩
have : (v (a * z₀⁻¹) : Γ₀) = 1 := by
apply hV
have : (z₀⁻¹ : K) = (z₀ : hat K)⁻¹ := map_inv₀ (Completion.coeRingHom : K →+* hat K) z₀
rw [Completion.coe_mul, this, ha, hz₀, mul_inv, mul_comm y₀⁻¹, ← mul_assoc, mul_assoc y, mul_inv_cancel₀ h,
mul_one]
solve_by_elim
calc
v a = v (a * z₀⁻¹ * z₀) := by rw [mul_assoc, inv_mul_cancel₀ z₀_ne, mul_one]
_ = v (a * z₀⁻¹) * v z₀ := (Valuation.map_mul _ _ _)
_ = v z₀ := by rw [this, one_mul]