#45394 feat(RingTheory/Valuation): equivalence between ValuativeRel and ValuationSubring
PR description
... and propose for future refactoring with the new def ValuativeRel.integer and ValuativeRel.valuationSubring. Based on my understanding, mathlib introduced ValuativeRel because it expresses the equivalences of valuation better, so it should be treated as the more fundamental object, and we should build more API around it without going through Valuation.
The original goal of this was to have a way to write IsLocalRing.ResidueField for a valuative relation without going through the associated Valuation, but I ended up also showing the equivalence.
Related discussion: #Is there code for X? > maximal valued fields
- ☐ depends on: #45537
Conversation on GitHub 6
PR summary ca14a76362
Import changes for modified files
No significant changes to the import graph
<details><summary>Import changes for all files</summary>
|Files|Import difference|
|-|-|
| Mathlib.RingTheory.Valuation.ValuativeRel.Integer (new file)|1325|
| Mathlib.RingTheory.Valuation.ValuativeRel.ValuationSubring (new file)|2003|
</details>
<details><summary>
Declarations diff (regex)
</summary>
+ equivValuationSubring
+ integer
+ integer_eq_valuationInteger
+ mem_integer_iff
+ 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_neg_iff
<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>
<details><summary>
Declarations diff (Lean)
</summary>
✅ Lean-aware diff — post-build, computed from the Lean environment (commit
ca14a76).
- +26 new declarations
- −0 removed declarations
+ValuativeRel.equivValuationSubring
+ValuativeRel.equivValuationSubring_apply
+ValuativeRel.equivValuationSubring_symm_apply
+ValuativeRel.integer
+ValuativeRel.integer_eq_valuationInteger
+ValuativeRel.mem_integer_iff
+ValuativeRel.mem_valuationSubring_iff
+ValuativeRel.neg_veq_iff
+ValuativeRel.neg_veq_self
+ValuativeRel.neg_vle_iff
+ValuativeRel.neg_vle_self
+ValuativeRel.neg_vlt_iff
+ValuativeRel.ofValuationSubring
+ValuativeRel.ofValuationSubring.vle_def
+ValuativeRel.ofValuationSubring.vle_iff_exists
+ValuativeRel.ofValuation_valuationSubringValuation_eq_ofValuationSubring
+ValuativeRel.self_vle_neg
+ValuativeRel.valuationInteger_valuation_eq_integer
+ValuativeRel.valuationSubring
+ValuativeRel.valuationSubring_eq_valuationValuationSubring
+ValuativeRel.valuationValuationSubring_valuation_eq_valuationSubring
+ValuativeRel.veq_neg_iff
+ValuativeRel.vle_neg_iff
+ValuativeRel.vle_one_or_inv_vle_one
+ValuativeRel.vle_one_or_inv_vlt_one
+ValuativeRel.vlt_neg_iff
</details>
No changes to strong technical debt. No changes to weak technical debt.
Current commit ca14a76362 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
relativevalue is the weighted sum of the differences with weight given by the inverse of the current value of the statistic. - The
absolutevalue is therelativevalue divided by the total sum of the inverses of the current values (i.e. the weighted average of the differences).
🟢 Approval recommended
No active review issues block approval of the correspondence between valuative relations and valuation subrings.
No open issues 🎉
<details> <summary><strong>What changed in this PR</strong></summary>
Adds a direct correspondence between valuative relations and valuation subrings over a field, supporting access to residue fields without first constructing an associated valuation.
Changes:
- Defines integer subrings and valuation subrings directly from valuative relations.
- Constructs the inverse relation from a valuation subring and proves the equivalence.
- Adds supporting negation and inverse comparison lemmas and exports the new module.
| File | Description |
| ---- | ----------- |
| Mathlib/RingTheory/Valuation/ValuativeRel/ValuationSubring.lean | Defines the subring constructions and proves their compatibility with valuations and the equivalence. |
| Mathlib/RingTheory/Valuation/ValuativeRel/Basic.lean | Adds negation and inverse comparison lemmas used by the constructions. |
| Mathlib.lean | Imports the new module into the library-wide entry point. |
</details>
<sub>Review effort: Balanced</sub>
🟡 Changes recommended
An active review finding identifies a typo on line 18 of ValuationSubring.lean: “Further more” should be “Furthermore.”
<details open> <summary><strong>1 open issue</strong></summary>
- <picture><source media="(prefers-color-scheme: dark)" srcset="github.githubassets.com/static/images/icons/copilot-code-review/low-v2-dark.svg"<source media="(prefers-color-scheme: light)" srcset="github.githubassets.com/static/images/icons/copilot-code-review/low-v2-light.svg"<img src="github.githubassets.com/static/images/icons/copilot-code-review/low-v2-light.png" alt="Low severity" width="62" height="18" align="texttop"></picture> Use “Furthermore” as one word · New
</details>
<sub>Review effort: Balanced</sub>
“Further more” should be written as the single word “Furthermore.”
After trying some proposed refactor myself, I understand that this is a more radical change that I thought. The new Valuative.integer is not defeq to the existing one, and consequently 𝒪[R] (seen as a type), 𝓂[R] and 𝓀[R] are downgraded from defeq to their Valued counterparts to mere equivalence, so a lot of downstream lemma needs a rewrite. I still hold the opinion that this refactor is good given we want to get rid of Valued, but I am good with parking this for a while if the direction is not very clear yet. Meanwhile I am going to extract some less controversial lemma into separate PR
This PR/issue depends on:
- leanprover-community/mathlib4#45537
By Dependent Issues (🤖). Happy coding!
Mathlib.lean +2 −0
public import Mathlib.RingTheory.Valuation.RankOneMathlib/RingTheory/Valuation/ValuativeRel/Basic.lean +47 −0
theorem vle_add_cases (x y : R) : x + y ≤ᵥ x ∨ x + y ≤ᵥ y :=Can we have these for vlt and veq too? I've been using these on the CGT repo for a while, I wasn't aware they were more general theorems on valued rings...
lemma inv_vlt_one (hx : x ≠ 0) : x⁻¹ <ᵥ 1 ↔ 1 <ᵥ x :=Mathlib/RingTheory/Valuation/ValuativeRel/Integer.lean +52 −0 new file
Mathlib/RingTheory/Valuation/ValuativeRel/ValuationSubring.lean +111 −0 new file
Is this a heavy enough import that it doesn't make sense to put both in the same file?
The split was just following the existing the file structure in Valuation. I noticed that downstream files that only cares about rings only imports Valuation.Integers, so I anticipate that it will also only import ValuativeRel.Integers after the refactoring.