@@ -80,6 +80,9 @@ instance {P S : Type*} [Ring S] [Semiring P] [Module P R] [Module P S]
8080 [Algebra R S] [IsScalarTower P R S] :
8181 IsScalarTower P (WithVal v) S := inferInstanceAs (IsScalarTower P R S)
8282
83+ instance [Ring R] {Γ₀ : Type *} [LinearOrderedCommGroupWithZero Γ₀]
84+ {v : Valuation R Γ₀} : Preorder (WithVal v) := v.toPreorder
85+
8386end Instances
8487
8588section Ring
@@ -94,13 +97,37 @@ def valuation : Valuation (WithVal v) Γ₀ := v.comap (equiv v)
9497
9598@[simp] lemma valuation_equiv_symm (x : R) : valuation v ((equiv v).symm x) = v x := rfl
9699
100+ variable {Γ'₀ : Type *} [LinearOrderedCommGroupWithZero Γ'₀]
101+
102+ /-- Canonical ring equivalence between `WithVal v` and `WithVal w`. -/
103+ def equivWithVal (v : Valuation R Γ₀) (w : Valuation R Γ'₀) :
104+ WithVal v ≃+* WithVal w :=
105+ (equiv v).trans (equiv w).symm
106+
107+ theorem equivWithVal_symm (v : Valuation R Γ₀) (w : Valuation R Γ'₀) :
108+ (equivWithVal v w).symm = equivWithVal w v := rfl
109+
110+ @[simp]
111+ theorem equivWithVal_apply (v : Valuation R Γ₀) (w : Valuation R Γ'₀) {x : WithVal v} :
112+ equivWithVal v w x = (equiv w).symm (equiv v x) := rfl
113+
114+ @[simp]
115+ theorem equivWithVal_symm_apply (v : Valuation R Γ₀) (w : Valuation R Γ'₀) {x : WithVal w} :
116+ (equivWithVal v w).symm x = (equiv v).symm (equiv w x) := rfl
117+
97118instance {R} [Ring R] (v : Valuation R Γ₀) : Valued (WithVal v) Γ₀ :=
98119 Valued.mk' (valuation v)
99120
100121theorem apply_equiv (r : WithVal v) : v (equiv v r) = Valued.v r := rfl
101122
102123@[simp] theorem apply_symm_equiv (r : R) : Valued.v ((equiv v).symm r) = v r := rfl
103124
125+ theorem le_def {v : Valuation R Γ₀} {a b : WithVal v} :
126+ a ≤ b ↔ v (equiv v a) ≤ v (equiv v b) := .rfl
127+
128+ theorem lt_def {v : Valuation R Γ₀} {a b : WithVal v} :
129+ a < b ↔ v (equiv v a) < v (equiv v b) := .rfl
130+
104131end Ring
105132
106133section CommRing
@@ -128,6 +155,56 @@ abbrev Completion := UniformSpace.Completion (WithVal v)
128155instance : Coe R v.Completion :=
129156 inferInstanceAs <| Coe (WithVal v) (UniformSpace.Completion (WithVal v))
130157
158+ section Equivalence
159+
160+ /-! The uniform isomorphism between `WithVal v` and `WithVal w` when `v` and `w` are
161+ equivalent. -/
162+
163+ variable {R Γ₀ Γ₀' : Type *} [Ring R] [LinearOrderedCommGroupWithZero Γ₀]
164+ [LinearOrderedCommGroupWithZero Γ₀'] {v : Valuation R Γ₀} {w : Valuation R Γ₀'}
165+
166+ /-- If two valuations `v` and `w` are equivalent then `WithVal v` is order-isomorphic
167+ to `WithVal w`. -/
168+ def IsEquiv.orderRingIso (h : v.IsEquiv w) :
169+ WithVal v ≃+*o WithVal w where
170+ __ := equivWithVal v w
171+ map_le_map_iff' := h.symm ..
172+
173+ @[simp]
174+ theorem IsEquiv.orderRingIso_apply (h : v.IsEquiv w) (x : WithVal v) :
175+ h.orderRingIso x = (equivWithVal v w) x := rfl
176+
177+ @[simp]
178+ theorem IsEquiv.orderRingIso_symm_apply (h : v.IsEquiv w) (x : WithVal w) :
179+ h.orderRingIso.symm x = (equivWithVal v w).symm x := rfl
180+
181+ -- TODO: remove hw when we have range bases for Valued's ValuativeRel #27314
182+ theorem IsEquiv.uniformContinuous_equivWithVal
183+ (hw : ∀ γ : Γ₀'ˣ, ∃ r s, 0 < w r ∧ 0 < w s ∧ w r / w s = γ) (h : v.IsEquiv w) :
184+ UniformContinuous (equivWithVal v w) := by
185+ refine uniformContinuous_of_continuousAt_zero _ ?_
186+ rw [ContinuousAt, map_zero, (Valued.hasBasis_nhds_zero _ _).tendsto_iff
187+ (Valued.hasBasis_nhds_zero _ _)]
188+ intro γ _
189+ obtain ⟨r, s, hr₀, hs₀, hr⟩ := hw γ
190+ use .mk0 (v r / v s) (by simp [h.ne_zero, hr₀.ne.symm, hs₀.ne.symm]), trivial, fun x hx ↦ ?_
191+ rw [← hr, Set.mem_setOf_eq, ← WithVal.apply_equiv, ← (equiv w).apply_symm_apply r,
192+ lt_div_iff₀ hs₀, ← (equiv w).apply_symm_apply s, ← map_mul, ← map_mul, ← lt_def,
193+ ← h.orderRingIso_apply, ← h.orderRingIso.apply_symm_apply ((equiv w).symm s), ← map_mul,
194+ ← h.orderRingIso.lt_symm_apply]
195+ simpa [lt_def, lt_div_iff₀ (h.pos_iff.2 hs₀)] using hx
196+
197+ /-- If two valuations `v` and `w` are equivalent then `WithVal v` and `WithVal w` are
198+ isomorphic as uniform spaces. -/
199+ def IsEquiv.uniformEquiv (hv : ∀ γ : Γ₀ˣ, ∃ r s, 0 < v r ∧ 0 < v s ∧ v r / v s = γ)
200+ (hw : ∀ γ : Γ₀'ˣ, ∃ r s, 0 < w r ∧ 0 < w s ∧ w r / w s = γ)
201+ (h : v.IsEquiv w) : WithVal v ≃ᵤ WithVal w where
202+ __ := equivWithVal v w
203+ uniformContinuous_toFun := h.uniformContinuous_equivWithVal hw
204+ uniformContinuous_invFun := h.symm.uniformContinuous_equivWithVal hv
205+
206+ end Equivalence
207+
131208end Valuation
132209
133210namespace NumberField.RingOfIntegers
0 commit comments