mathlib4 review helperopen PRs by @wwylele on leanprover-community/mathlib4

← queue

#45534 [ignore me] Valuativerel int refactor

draft CI failure CI failing

+381 −12 · 7 files · 5 commits · head ed15563 · updated 36 days ago · Files changed on GitHub

PR description
Conversation on GitHub 1
github-actions[bot] · comment · 2026-10-31
PR summary ed1556381f
Import changes for modified files

No significant changes to the import graph

<details><summary>Import changes for all files</summary>

|Files|Import difference| |-|-| |<details><summary>3 files</summary> Mathlib.NumberTheory.LocalField.Basic Mathlib.NumberTheory.Padics.LocalField Mathlib.Topology.Algebra.Valued.ValuativeRel</details>|1| | Mathlib.RingTheory.Valuation.ValuativeRel.Integer (new file)|1411| | Mathlib.RingTheory.Valuation.ValuativeRel.ValuationSubring (new file)|2003|

</details>


<details><summary>

Declarations diff (regex)

</summary>

+ IsValuativeTopology.mem_nhds_iff_exists_image_vlt_subset + ValuativeRel.integer.isDiscreteValuationRing_of_compactSpace + ValuativeRel.integer.isPrincipalIdealRing_of_compactSpace + add_vlt_of_vlt_of_vlt + div_vlt_iff + equivValuationSubring + instance : CompactSpace 𝒪[K] := isCompact_iff_compactSpace.mp (isCompact_vle K 1) + instance : Finite 𝓀[K] := by + instance : ValuationRing (integer K) + integer + integer_eq_valuationInteger + isClosed_vle + isCompact_vle + isOpen_vlt + mem_integer_iff + mem_nhds_iff_exists_image_vlt_subset' + mem_valuationSubring_iff + neg_veq_iff + neg_veq_self + neg_vle_iff + neg_vle_self + neg_vlt_iff + ofValuationSubring + ofValuationSubring.vle_def + ofValuationSubring.vle_iff_exists + ofValuation_valuationSubringValuation_eq_ofValuationSubring + self_vle_neg + valuationInteger_valuation_eq_integer + valuationSubring + valuationSubring_eq_valuationValuationSubring + valuationValuationSubring_valuation_eq_valuationSubring + veq_neg_iff + vle_neg_iff + vle_one_or_inv_vle_one + vle_one_or_inv_vlt_one + vlt_div_iff + vlt_neg_iff - instance : CompactSpace 𝒪[K] := isCompact_iff_compactSpace.mp (isCompact_closedBall K 1) - instance : Finite 𝓀[K] <details> <summary>You can run this locally as follows</summary>

## from your `mathlib4` directory:
git clone https://github.com/leanprover-community/mathlib-ci.git ../mathlib-ci

## summary with just the declaration names:
../mathlib-ci/scripts/pr_summary/declarations_diff.sh <optional_commit>

## more verbose report:
../mathlib-ci/scripts/pr_summary/declarations_diff.sh long <optional_commit>

</details>

The doc-module for scripts/pr_summary/declarations_diff.sh in the undefined repository contains some details about this script.

</details>

Declarations diff (Lean -- pending)

Computed after the build finishes.


No changes to strong technical debt. No changes to weak technical debt.

Current commit ed1556381f Reference commit 0d3fb85496

This script lives in the undefined repository. To run it locally, from your mathlib4 directory:

git clone https://github.com/leanprover-community/mathlib-ci.git ../mathlib-ci
../mathlib-ci/scripts/reporting/technical-debt-metrics.py pr_summary
  • The relative value is the weighted sum of the differences with weight given by the inverse of the current value of the statistic.
  • The absolute value is the relative value divided by the total sum of the inverses of the current values (i.e. the weighted average of the differences).

Mathlib.lean +2 −0

public import Mathlib.RingTheory.Valuation.RankOne
7439public import Mathlib.RingTheory.Valuation.ValuationRing
7440public import Mathlib.RingTheory.Valuation.ValuationSubring
7441public import Mathlib.RingTheory.Valuation.ValuativeRel.Basic
7442public import Mathlib.RingTheory.Valuation.ValuativeRel.Integer
7443public import Mathlib.RingTheory.Valuation.ValuativeRel.Trivial
7444public import Mathlib.RingTheory.Valuation.ValuativeRel.ValuationSubring
7445public import Mathlib.RingTheory.WittVector.Basic
7446public import Mathlib.RingTheory.WittVector.Compare
7447public import Mathlib.RingTheory.WittVector.Complete

Mathlib/NumberTheory/LocalField/Basic.lean +79 −11

lemma isCompact_closedBall (γ : ValueGroupWithZero K) : IsCompact { x | valuati
100 simp only [IsValuativeTopology.v_eq_valuation, ← map_mul, Valuation.restrict_le_iff]
101 simp [hr]
instance (anonymous instance) removedLundefined–undefined
−instance : CompactSpace 𝒪[K] := isCompact_iff_compactSpace.mp (isCompact_closedBall K 1)
lemma isCompact_vle newL103–132
103lemma isCompact_vle (y : K) : IsCompact { x | x ≤ᵥ y } := by
104 by_cases hy : y = 0
105 · simp [hy]
106 have hy' : 0 <ᵥ y := by simpa using hy
107 obtain ⟨s, hs, -, hcompact⟩ :=
108 LocallyCompactSpace.local_compact_nhds (0 : K) .univ Filter.univ_mem
109 rw [IsValuativeTopology.mem_nhds_iff_exists_image_vlt_subset'] at hs
110 obtain ⟨z, hz0, hz⟩ := hs
111 simp only [zero_add, Set.image_id'] at hz
112 obtain ⟨w, hw0, hw1, hw⟩ : ∃ w ≠ 0, w <ᵥ 1 ∧ {x | x ≤ᵥ w} ⊆ s := by
113 obtain ⟨v, hv0, hv1⟩ := ValuativeRel.IsNontrivial.exists_lt_one (R := K)
114 obtain ⟨w, rfl⟩ := ValuativeRel.valuation_surjective v
115 have hw0 : w ≠ 0 := by simpa using hv0
116 have hw1 : w <ᵥ 1 := by simpa [(valuation K).vlt_iff_lt] using hv1
117 by_cases hw : z ≤ᵥ w
118 · refine ⟨z * w, by simp [hz0, hw0], ?_, ?_⟩
119 · simpa using ValuativeRel.mul_vlt_mul (hw.trans_vlt hw1) hw1
120 · apply hz.trans'
121 intro x hx
122 apply ValuativeRel.vle.trans_vlt hx
123 simpa using ValuativeRel.mul_vlt_mul_of_vle_of_vlt (vle_refl z) hw1 (by simpa using hz0)
124 · use w, hw0, hw1, Set.Subset.trans (fun x hx ↦ ValuativeRel.vle.trans_vlt hx hw) hz
125 rw [← (Homeomorph.mulLeft₀ (y / w) (by simp [hy, hw0])).isCompact_preimage]
126 suffices IsCompact {x | y / w * x ≤ᵥ y} by simpa
127 convert_to IsCompact {x | x ≤ᵥ w}
128 · ext x
129 simp only [Set.mem_ofPred_eq]
130 conv_rhs => rw [← ValuativeRel.mul_vle_mul_iff_right hy', ← ValuativeRel.div_vle_iff hw0,
131 mul_div_right_comm]
132 exact .of_isClosed_subset hcompact (IsValuativeTopology.isClosed_vle w) hw
instance (anonymous instance) newL134–134
134instance : CompactSpace 𝒪[K] := isCompact_iff_compactSpace.mp (isCompact_vle K 1)
136instance (K : Type*) [Field K] [ValuativeRel K] [UniformSpace K] [IsUniformAddGroup K]
137 [IsValuativeTopology K] : (Valued.v (R := K) (Γ₀ := ValueGroupWithZero K)).Compatible :=
138 inferInstanceAs (valuation K).Compatible
140section Stuff
142variable {K : Type*} [Field K] [ValuativeRel K] [TopologicalSpace K] [IsValuativeTopology K]
lemma ValuativeRel.integer.isPrincipalIdealRing_of_compactSpace newL144–162
144lemma ValuativeRel.integer.isPrincipalIdealRing_of_compactSpace [hc : CompactSpace 𝒪[K]] :
145 IsPrincipalIdealRing 𝒪[K] := by
146 have hc : IsCompact (X := K) 𝒪[K] := isCompact_iff_compactSpace.mpr hc
147 --obtain ⟨_⟩ := locallyFiniteOrder_units_mrange_of_isCompact_integer hc
148 /- -- The strategy to show that we have a PIR is by contradiction,
149 -- assuming that the range of the valuation is densely ordered.
150 have hi : Valuation.Integers (R := K) Valued.v 𝒪[K] := Valuation.integer.integers v
151 have hc : IsCompact (X := K) 𝒪[K] := isCompact_iff_compactSpace.mpr hc
152 -- We can also construct that it has a locally finite order, by compactness
153 -- which leads to a contradiction.
154 obtain ⟨_⟩ := locallyFiniteOrder_units_mrange_of_isCompact_integer hc
155 have hm := mulArchimedean_mrange_of_isCompact_integer hc
156 -- The key result is that a valuation ring that maps into a `MulArchimedean` value group
157 -- is a PIR iff the value group is not densely ordered.
158 refine hi.isPrincipalIdealRing_iff_not_denselyOrdered_mrange.mpr fun _ ↦ ?_
159 -- since we are densely ordered, we necessarily are nontrivial
160 exact not_subsingleton (MonoidHom.mrange (v : Valuation K Γ₀))ˣ
161 (LocallyFiniteOrder.denselyOrdered_iff_subsingleton.mp inferInstance)-/
162 sorry
theorem ValuativeRel.integer.isDiscreteValuationRing_of_compactSpace newL165–171
165theorem ValuativeRel.integer.isDiscreteValuationRing_of_compactSpace [CompactSpace 𝒪[K]]
166 [ValuativeRel.IsNontrivial K] :
167 IsDiscreteValuationRing 𝒪[K] where
168 -- To prove we have a DVR, we need to show it is
169 -- a local ring (instance is directly inferred) and a PIR and not a field.
170 __ := ValuativeRel.integer.isPrincipalIdealRing_of_compactSpace
171 not_a_field' := sorry
173end Stuff
instance (anonymous instance) changedL175–178
175instance : IsDiscreteValuationRing 𝒪[K] :=
− letI := IsTopologicalAddGroup.rightUniformSpace K
− haveI := isUniformAddGroup_of_addCommGroup (G := K)
− haveI : CompactSpace (Valued.integer K) := inferInstanceAs (CompactSpace 𝒪[K])
− Valued.integer.isDiscreteValuationRing_of_compactSpace
176 ValuativeRel.integer.isDiscreteValuationRing_of_compactSpace
178/-- The value group of a local field is (uniquely) isomorphic to `ℤᵐ⁰`. -/
179noncomputable
def valueGroupWithZeroIsoInt changedL180–190
180def valueGroupWithZeroIsoInt : ValueGroupWithZero K ≃*o ℤᵐ⁰ := by
181 apply Nonempty.some
182 let := IsTopologicalAddGroup.rightUniformSpace K
183 have := isUniformAddGroup_of_addCommGroup (G := K)
184 have : CompactSpace 𝒪[K] := inferInstance
185 rw [← valuationInteger_valuation_eq_integer] at this
186 obtain ⟨_⟩ := Valued.integer.locallyFiniteOrder_units_mrange_of_isCompact_integer
− (isCompact_iff_compactSpace.mpr (inferInstance : CompactSpace 𝒪[K]))
187 (isCompact_iff_compactSpace.mpr this)
188 let e : (MonoidHom.mrange (valuation K)) ≃*o ValueGroupWithZero K :=
189 ⟨.ofBijective (MonoidHom.mrange (valuation K)).subtype ⟨Subtype.val_injective, fun x ↦
190 ⟨⟨x, ValuativeRel.valuation_surjective x⟩, rfl⟩⟩, .rfl⟩
instance : ValuativeRel.IsRankLeOne K :=
204 ValuativeRel.isRankLeOne_iff_mulArchimedean.mpr
205 (.comap (valueGroupWithZeroIsoInt K).toMonoidHom (valueGroupWithZeroIsoInt K).strictMono)
instance (anonymous instance) changedL207–217
−instance : Finite 𝓀[K] :=
207instance : Finite 𝓀[K] := by
208 letI := IsTopologicalAddGroup.rightUniformSpace K
209 haveI := isUniformAddGroup_of_addCommGroup (G := K)
210 letI : (Valued.v (R := K)).RankOne :=
211 { hom' := IsRankLeOne.nonempty.some.emb (R := K).comp MonoidWithZeroHom.ValueGroup₀.embedding
212 strictMono' := IsRankLeOne.nonempty.some.strictMono.comp
213 MonoidWithZeroHom.ValueGroup₀.embedding_strictMono }
− (compactSpace_iff_completeSpace_and_isDiscreteValuationRing_and_finite_residueField.mp
− (inferInstanceAs (CompactSpace 𝒪[K]))).2.2
214 sorry
215 /-rw [← integer_valuation_eq_integer]
216 exact (compactSpace_iff_completeSpace_and_isDiscreteValuationRing_and_finite_residueField.mp
217 (inferInstanceAs (CompactSpace (Valued.integer K)))).2.2-/
219end TopologicalSpace
instance : CompleteSpace 𝒪[K] :=
238 { hom' := IsRankLeOne.nonempty.some.emb (R := K).comp MonoidWithZeroHom.ValueGroup₀.embedding
239 strictMono' := IsRankLeOne.nonempty.some.strictMono.comp
240 MonoidWithZeroHom.ValueGroup₀.embedding_strictMono }
− (compactSpace_iff_completeSpace_and_isDiscreteValuationRing_and_finite_residueField.mp
− (inferInstanceAs (CompactSpace 𝒪[K]))).1
241 sorry
242 /-(compactSpace_iff_completeSpace_and_isDiscreteValuationRing_and_finite_residueField.mp
243 (inferInstanceAs (Valued.integer K))).1-/
  • L241 Leftover debugging or forbidden tactic. guide
245open scoped Pointwise in
246instance : IsAdicComplete 𝓂[K] 𝒪[K] where

Mathlib/RingTheory/Valuation/ValuativeRel/Basic.lean +56 −0

theorem vle_add_cases (x y : R) : x + y ≤ᵥ x ∨ x + y ≤ᵥ y :=
295 grw [show (0 : R) = x * 0 by simp, veq_mul_comm, veq_mul_comm x] at hy
296 exact vle_mul_cancel hx hy
lemma add_vlt_of_vlt_of_vlt newL298–301
298lemma add_vlt_of_vlt_of_vlt {x y z : R} (hx : x <ᵥ z) (hy : y <ᵥ z) : x + y <ᵥ z := by
299 rcases ValuativeRel.vle_add_cases x y with h | h
300 · apply h.trans_vlt hx
301 · apply h.trans_vlt hy
303section Ring
305variable {R : Type*} [Ring R] [ValuativeRel R]
lemma neg_vle_self newL307–310
307lemma neg_vle_self (x : R) : -x ≤ᵥ x := by
308 rcases vle_total (-x) x with h | h
309 · exact h
310 · simpa using mul_vle_mul_left h (-1)
lemma self_vle_neg newL312–312
312lemma self_vle_neg (x : R) : x ≤ᵥ -x := by simpa using neg_vle_self (-x)
lemma neg_veq_self newL314–314
314lemma neg_veq_self (x : R) : -x =ᵥ x := ⟨neg_vle_self x, self_vle_neg x⟩
lemma neg_vle_iff newL316–319
316@[simp]
317lemma neg_vle_iff {x y : R} : -x ≤ᵥ y ↔ x ≤ᵥ y where
318 mp h := vle_trans (self_vle_neg x) h
319 mpr h := vle_trans (neg_vle_self x) h
lemma vle_neg_iff newL321–324
321@[simp]
322lemma vle_neg_iff {x y : R} : x ≤ᵥ -y ↔ x ≤ᵥ y where
323 mp h := vle_trans h (neg_vle_self y)
324 mpr h := vle_trans h (self_vle_neg y)
lemma neg_vlt_iff newL326–327
326@[simp]
327lemma neg_vlt_iff {x y : R} : -x <ᵥ y ↔ x <ᵥ y := by simp [← not_vle]
lemma vlt_neg_iff newL329–330
329@[simp]
330lemma vlt_neg_iff {x y : R} : x <ᵥ -y ↔ x <ᵥ y := by simp [← not_vle]
lemma neg_veq_iff newL332–333
332@[simp]
333lemma neg_veq_iff {x y : R} : -x =ᵥ y ↔ x =ᵥ y := by simp [veq_def]
lemma veq_neg_iff newL335–336
335@[simp]
336lemma veq_neg_iff {x y : R} : x =ᵥ -y ↔ x =ᵥ y := by simp [veq_def]
338end Ring
340variable (R) in
341/-- The submonoid of elements `x : R` whose valuation is positive. -/
342def posSubmonoid : Submonoid R where
lemma vle_div_iff (hc : c ≠ 0) : a ≤ᵥ b / c ↔ a * c ≤ᵥ b := by
947lemma div_vle_iff (hc : c ≠ 0) : a / c ≤ᵥ b ↔ a ≤ᵥ b * c := by
948 rw [← mul_vle_mul_iff_left (by simpa), div_mul_cancel₀ _ (by lia)]
lemma vlt_div_iff newL950–950
950lemma vlt_div_iff (hc : c ≠ 0) : a <ᵥ b / c ↔ a * c <ᵥ b := (div_vle_iff hc).not
lemma div_vlt_iff newL952–952
952lemma div_vlt_iff (hc : c ≠ 0) : a / c <ᵥ b ↔ a <ᵥ b * c := (vle_div_iff hc).not
954lemma one_vle_div_iff (hb : b ≠ 0) : 1 ≤ᵥ a / b ↔ b ≤ᵥ a := by
955 simp [vle_div_iff hb]
lemma inv_vlt_one (hx : x ≠ 0) : x⁻¹ <ᵥ 1 ↔ 1 <ᵥ x :=
969lemma one_vlt_inv (hx : x ≠ 0) : 1 <ᵥ x⁻¹ ↔ x <ᵥ 1 :=
970 (inv_vle_one hx).not
lemma vle_one_or_inv_vlt_one newL972–975
972lemma vle_one_or_inv_vlt_one : x ≤ᵥ 1 ∨ x⁻¹ <ᵥ 1 := by
973 by_cases h : x = 0
974 · simp [h]
975 · simp [or_iff_not_imp_right, one_vle_inv h]
lemma vle_one_or_inv_vle_one newL977–980
977lemma vle_one_or_inv_vle_one : x ≤ᵥ 1 ∨ x⁻¹ ≤ᵥ 1 := by
978 by_cases h : x = 0
979 · simp [h]
980 · simpa [inv_vle_one h] using vle_total x 1
982end DivisionRing
984open NNReal in variable (R) in

Mathlib/RingTheory/Valuation/ValuativeRel/Integer.lean +71 −0 new file

1/-
2Copyright (c) 2026 Weiyi Wang. All rights reserved.
3Released under Apache 2.0 license as described in the file LICENSE.
4Authors: Weiyi Wang
5-/
6
7module
8
9public import Mathlib.RingTheory.Valuation.Integers
10public import Mathlib.RingTheory.Valuation.ValuationRing
11public import Mathlib.RingTheory.Valuation.ValuativeRel.Basic
13/-!
14# Integers of valuative relations
16This file introduces `ValuativeRel.integer` analog to `Valuation.integer`, the subring of elements
17valuatively less or equal to 1.
19TODO: existing usage of `(ValuativeRel.valuation R).integer` should be converted to
20`ValuativeRel.integer R`, including those under notations `𝒪[K]` and such.
21-/
23public section
25namespace ValuativeRel
26variable {R : Type*} [Ring R] [ValuativeRel R]
28variable (R) in
def integer newL29–38
29/-- The ring of integers under a given `ValuativeRel` is the subring of elements valuatively
30less or equal to 1. -/
31@[expose]
32def integer : Subring R where
33 carrier := { x | x ≤ᵥ 1 }
34 one_mem' := by simp
35 mul_mem' {x y} hx hy := by simpa using mul_vle_mul hx hy
36 zero_mem' := by simp
37 add_mem' {x y} hx hy := vle_add hx hy
38 neg_mem' {x} hx := by simpa using hx
theorem mem_integer_iff newL40–40
40theorem mem_integer_iff {x : R} : x ∈ integer R ↔ x ≤ᵥ 1 := by rfl
theorem integer_eq_valuationInteger newL42–46
42theorem integer_eq_valuationInteger {Γ₀ : Type*} [LinearOrderedCommGroupWithZero Γ₀]
43 (v : Valuation R Γ₀) [v.Compatible] :
44 integer R = v.integer := by
45 ext x
46 simp [mem_integer_iff, v.mem_integer_iff, v.vle_iff_le]
48variable (R) in
theorem valuationInteger_valuation_eq_integer newL49–51
49@[simp]
50theorem valuationInteger_valuation_eq_integer : (ValuativeRel.valuation R).integer = integer R :=
51 (integer_eq_valuationInteger (ValuativeRel.valuation R)).symm
53variable {K : Type*} [Field K] [ValuativeRel K]
instance (anonymous instance) newL54–69
54instance : ValuationRing (integer K) where
55 cond' a b := by
56 have hc {a b : integer K} (h : b.val ≤ᵥ a.val) : ∃ c, a * c = b ∨ b * c = a := by
57 by_cases ha : a = 0
58 · exact ⟨0, by simp [ha]⟩
59 refine ⟨⟨b.val / a.val, ?_⟩, Or.inl ?_⟩
60 · rw [mem_integer_iff, div_vle_one_iff (by simpa using ha)]
61 exact h
62 · ext
63 exact mul_div_cancel₀ _ (by simpa using ha)
64 rcases vle_total a.val b.val with h | h
65 · obtain ⟨c, h⟩ := hc h
66 use c
67 grind
68 · obtain ⟨c, h⟩ := hc h
69 use c
71end ValuativeRel

Mathlib/RingTheory/Valuation/ValuativeRel/ValuationSubring.lean +111 −0 new file

1/-
2Copyright (c) 2026 Weiyi Wang. All rights reserved.
3Released under Apache 2.0 license as described in the file LICENSE.
4Authors: Weiyi Wang
5-/
6
7module
8
9public import Mathlib.RingTheory.Valuation.ValuationSubring
10public import Mathlib.RingTheory.Valuation.ValuativeRel.Integer
12/-!
13# Valuation subrings and valuative relations
15This file introduces `ValuativeRel.valuationSubring` analog to `Valuation.valuationSubring`. It
16upgrades `ValuativeRel.integer` to a `ValuationSubring` for fields.
18Furthermore, we show that the type `ValuativeRel R` and the type `ValuationSubring R` are
19equivalent at `ValuativeRel.equivValuationSubring`.
20-/
22public section
24namespace ValuativeRel
25variable {K : Type*} [Field K] [ValuativeRel K]
27variable (K) in
def valuationSubring newL28–33
28/-- The valuation subring associated to a `ValuativeRel`, consisting of elements valuatively
29less or equal to 1. -/
30@[expose]
31def valuationSubring : ValuationSubring K where
32 __ := integer K
33 mem_or_inv_mem' x := by simpa [mem_integer_iff] using vle_one_or_inv_vle_one
theorem mem_valuationSubring_iff newL35–35
35theorem mem_valuationSubring_iff {x : K} : x ∈ valuationSubring K ↔ x ≤ᵥ 1 := by rfl
theorem valuationSubring_eq_valuationValuationSubring newL37–41
37theorem valuationSubring_eq_valuationValuationSubring {Γ₀ : Type*}
38 [LinearOrderedCommGroupWithZero Γ₀] (v : Valuation K Γ₀) [v.Compatible] :
39 valuationSubring K = v.valuationSubring := by
40 ext x
41 simp [mem_valuationSubring_iff, v.mem_valuationSubring_iff, v.vle_iff_le]
43variable (K) in
theorem valuationValuationSubring_valuation_eq_valuationSubring newL44–47
44@[simp]
45theorem valuationValuationSubring_valuation_eq_valuationSubring :
46 (ValuativeRel.valuation K).valuationSubring = valuationSubring K :=
47 (valuationSubring_eq_valuationValuationSubring (ValuativeRel.valuation K)).symm
def ofValuationSubring newL49–74
49/-- The `ValuativeRel` induced by a valuation subring. -/
50@[instance_reducible, expose]
51def ofValuationSubring (r : ValuationSubring K) : ValuativeRel K where
52 vle x y := x = 0 ∨ y ≠ 0 ∧ x / y ∈ r
53 vle_total x y := by
54 by_cases hx : x = 0
55 · simp [hx]
56 by_cases hy : y = 0
57 · simp [hy]
58 simpa [hx, hy] using r.mem_or_inv_mem (x / y)
59 vle_trans {z y x} hxy hyz := by
60 rcases hxy with hxy | hxy
61 · simp [hxy]
62 rcases hyz with hyz | hyz
63 · simp [hxy.1] at hyz
64 · simp [(div_mul_div_cancel₀ hxy.1) ▸ (mul_mem hxy.2 hyz.2), hyz.1]
65 vle_add {x y z} hxy hyz := by aesop (add simp [add_div])
66 mul_vle_mul_left {x y} hxy z := by
67 by_cases h : z = 0
68 · simp [h]
69 · simpa [mul_div_mul_right _ _ h, h] using hxy
70 vle_mul_cancel {x y z} hz hxy := by
71 have h : z ≠ 0 := by simpa using hz
72 simpa [mul_div_mul_right _ _ h, h] using hxy
73 not_vle_one_zero := by simp
74 vle_mul_comm {x y} := by by_cases h : x * y = 0 <;> simp [h, mul_comm y x]
76omit [ValuativeRel K] in
theorem ofValuationSubring.vle_def newL77–80
77theorem ofValuationSubring.vle_def (r : ValuationSubring K) {x y : K} :
78 letI := ofValuationSubring r
79 x ≤ᵥ y ↔ x = 0 ∨ y ≠ 0 ∧ x / y ∈ r := by
80 rfl
82omit [ValuativeRel K] in
theorem ofValuationSubring.vle_iff_exists newL83–86
83theorem ofValuationSubring.vle_iff_exists (r : ValuationSubring K) {x y : K} :
84 letI := ofValuationSubring r
85 x ≤ᵥ y ↔ ∃ a ∈ r, a * y = x := by
86 by_cases h : x = 0 <;> aesop (add simp [vle_def])
88omit [ValuativeRel K] in
theorem ofValuation_valuationSubringValuation_eq_ofValuationSubring newL89–95
89@[simp]
90theorem ofValuation_valuationSubringValuation_eq_ofValuationSubring (r : ValuationSubring K) :
91 ofValuation r.valuation = ofValuationSubring r := by
92 ext x y
93 let := ofValuation r.valuation
94 simp [ofValuationSubring.vle_iff_exists, Valuation.vle_iff_le r.valuation,
95 ValuationSubring.valuation_le_iff]
97variable (K) in
def equivValuationSubring newL98–109
98/-- The correspondence between `ValuativeRel` and `ValuationSubring` of a given field. -/
99@[expose, simps]
100def equivValuationSubring : ValuativeRel K ≃ ValuationSubring K where
101 toFun v := valuationSubring K
102 invFun := ofValuationSubring
103 left_inv v := by
104 ext x y
105 by_cases hy : y = 0
106 · simp [ofValuationSubring.vle_def, hy]
107 aesop (add simp [mem_valuationSubring_iff, ofValuationSubring.vle_def, div_vle_one_iff])
108 right_inv r := by
109 aesop (add simp [mem_valuationSubring_iff, ofValuationSubring.vle_def])
111end ValuativeRel

Mathlib/Topology/Algebra/ValuativeRel/ValuativeTopology.lean +60 −0

class IsValuativeTopology [TopologicalSpace R] where
59 mem_nhds_iff {s : Set R} {x : R} : s ∈ 𝓝 (x : R) ↔
60 ∃ γ : (ValueGroupWithZero R)ˣ, (x + ·) '' { z | valuation _ z < γ } ⊆ s
theorem IsValuativeTopology.mem_nhds_iff_exists_image_vlt_subset newL62–76
62theorem IsValuativeTopology.mem_nhds_iff_exists_image_vlt_subset [TopologicalSpace R]
63 [IsValuativeTopology R] {s : Set R} {x : R} :
64 s ∈ 𝓝 x ↔ ∃ (a b : posSubmonoid R), (x + ·) '' {z | z * b <ᵥ a} ⊆ s := by
65 rw [IsValuativeTopology.mem_nhds_iff]
66 refine ⟨fun h ↦ ?_, fun h ↦ ?_⟩
67 · obtain ⟨γ, h⟩ := h
68 obtain ⟨a, b, hab⟩ := ValuativeRel.exists_valuation_posSubmonoid_div_valuation_posSubmonoid_eq γ
69 use a, b
70 convert h with x
71 rw [← hab, lt_div_iff₀ (by simp), ← map_mul, (valuation R).vlt_iff_lt]
72 · obtain ⟨a, b, hab⟩ := h
73 use Units.mk0 (valuation R a / valuation R b) (by simp)
74 convert hab with x
75 simp_rw [Units.val_mk0]
76 rw [lt_div_iff₀ (by simp), ← map_mul, (valuation R).vlt_iff_lt]
78namespace ValuativeRel
80/-- The topology induced by a valuative relation. Note that this is not made into a global instance
lemma hasBasis_nhds_zero' :
176 (hasBasis_nhds_zero R).to_hasBasis (fun γ _ ↦ ⟨γ, by simp⟩)
177 fun γ hγ ↦ ⟨.mk0 γ hγ, by simp⟩
theorem isOpen_vlt newL179–190
179theorem isOpen_vlt (r : R) : IsOpen {x | x <ᵥ r} := by
180 rw [isOpen_iff_mem_nhds]
181 intro x hx
182 rw [mem_ofPred_eq] at hx
183 by_cases hr : r ≤ᵥ 0
184 · have := hx.trans_vle hr
185 simp at this
186 rw [mem_nhds_iff_exists_image_vlt_subset]
187 use ⟨r, hr⟩, 1
188 suffices ∀ (a : R), -x + a <ᵥ r → a <ᵥ r by simpa
189 intro a ha
190 simpa using add_vlt_of_vlt_of_vlt hx ha
theorem isClosed_vle newL192–202
192theorem isClosed_vle (r : R) : IsClosed {x | x ≤ᵥ r} := by
193 rw [← isOpen_compl_iff, isOpen_iff_mem_nhds]
194 simp only [mem_compl_iff, mem_ofPred_eq, not_vle]
195 intro x hrx
196 rw [mem_nhds_iff_exists_image_vlt_subset]
197 use ⟨x, ValuativeRel.vle.trans_vlt (by simp) hrx⟩, 1
198 intro a
199 suffices -x + a <ᵥ x → r <ᵥ -a by simpa
200 intro h h'
201 have : x <ᵥ x := by simpa using add_vlt_of_vlt_of_vlt h (h'.trans_vlt hrx)
202 exact this (vle_refl x)
204section Field
206variable {K : Type*} [Field K] [ValuativeRel K] [TopologicalSpace K] [IsValuativeTopology K]
theorem mem_nhds_iff_exists_image_vlt_subset' newL208–219
208theorem mem_nhds_iff_exists_image_vlt_subset' {s : Set K} {x : K} :
209 s ∈ 𝓝 x ↔ ∃ y ≠ 0, (x + ·) '' {z | z <ᵥ y} ⊆ s := by
210 rw [mem_nhds_iff_exists_image_vlt_subset]
211 refine ⟨fun h ↦ ?_, fun h ↦ ?_⟩
212 · obtain ⟨a, b, h⟩ := h
213 use a.val / b.val, (by simp)
214 convert h using 4 with z
215 rw [vlt_div_iff (by simp)]
216 · obtain ⟨y, hy, h⟩ := h
217 use ⟨y, by simpa using hy⟩, 1
218 convert h
219 simp
221end Field
223end IsValuativeTopology
225open IsValuativeTopology

Mathlib/Topology/Algebra/Valued/ValuativeRel.lean +2 −1

Authors: Yakov Pechersky
5-/
6module
7
8public import Mathlib.RingTheory.Valuation.ValuativeRel.Integer
9public import Mathlib.Topology.Algebra.ValuativeRel.ValuativeTopology
10public import Mathlib.Topology.Algebra.WithZeroTopology
end IsValuativeTopology
86namespace ValuativeRel
88@[inherit_doc]
−scoped notation "𝒪[" R "]" => Valuation.integer (valuation R)
89scoped notation "𝒪[" R "]" => ValuativeRel.integer R
91@[inherit_doc]
92scoped notation "𝓂[" K "]" => IsLocalRing.maximalIdeal ↥𝒪[K]
0/40 declarations checked

Your review, as Markdown

Paste it as a comment or a review on the PR. Line links to the head commit unfold into code snippets on GitHub.