Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(RingTheory/Valuation): valuation integers ring is a Principal Ideal ring iff the valuation range is not densely ordered #16619

Open
wants to merge 115 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
115 commits
Select commit Hold shift + click to select a range
dbba7e9
feat(Algebra/Order/Archimedean): multiplicativize Archimedean
pechersky Aug 7, 2024
b1e8032
feat(GroupTheory/Archimedean): `LinearOrderedAddCommGroup.discrete_or…
pechersky Aug 9, 2024
4ab710a
Merge branch 'master' into pechersky/mul-archimedean
pechersky Aug 9, 2024
0e57f15
left arrow
pechersky Aug 9, 2024
e039680
unsimp, due to pointwise
pechersky Aug 11, 2024
12d7a39
generalize closure equiv
pechersky Aug 11, 2024
ca18efa
add additive docstring
pechersky Aug 13, 2024
a6c4566
Merge branch 'pechersky/mul-archimedean' into pechersky/multiplicativ…
pechersky Aug 14, 2024
d325a7b
feat(GroupTheory/Archimedean): multiplicativize
pechersky Aug 14, 2024
363ee74
Merge branch 'pechersky/discrete-or-denselyOrdered' into pechersky/mu…
pechersky Aug 15, 2024
e733f83
feat(GroupTheory/Archimedean): `LinearOrderedCommGroupWithZero.discre…
pechersky Aug 15, 2024
591fe49
feat(RingTheory): `Valuation.Integers.not_denselyOrdered_of_isPrincip…
pechersky Aug 18, 2024
038d2d9
feat(Order/SuccPred/TypeTags): `SuccOrder (Multiplicative X)` and fri…
pechersky Aug 18, 2024
7117da4
Mathlib.lean
pechersky Aug 18, 2024
eb3c183
feat(Order/SuccPred): `BddAbove.exists_isGreatest_of_nonempty`
pechersky Aug 18, 2024
679a75b
feat(Order/SuccPred): transfer SuccOrder, IsSuccArchimedean
pechersky Aug 18, 2024
705807c
docstrings
pechersky Aug 18, 2024
55a03e9
reduce line count
pechersky Aug 18, 2024
526e85e
feedback
pechersky Aug 25, 2024
a001674
feedback
pechersky Aug 25, 2024
07a7465
feat(Algebra/Order/Hom): `Order(Add)MonoidIso`
pechersky Aug 26, 2024
b049050
bring instance back
pechersky Aug 26, 2024
e5b8fcb
move to pointwise
pechersky Aug 26, 2024
f869164
change import
pechersky Aug 26, 2024
876152d
fix naming
pechersky Aug 26, 2024
5dd72ee
Merge branch 'master' into pechersky/bddabove-exists-is-greatest-succ…
pechersky Aug 27, 2024
7642ea1
linear order now necessary
pechersky Aug 27, 2024
dff4d8c
Merge branch 'master' into pechersky/succ-order-type-tags
pechersky Aug 27, 2024
d5e0aa4
Merge branch 'master' into pechersky/succ-order-transfer
pechersky Aug 27, 2024
92847b1
remove obsolete field
pechersky Aug 27, 2024
ab2e215
prop is theorem
pechersky Aug 27, 2024
83d4c43
Update Mathlib/GroupTheory/Archimedean.lean
pechersky Aug 27, 2024
298c014
Revert "Update Mathlib/GroupTheory/Archimedean.lean"
pechersky Aug 27, 2024
fe81ea6
Update Mathlib/Algebra/Order/Hom/Monoid.lean
pechersky Aug 28, 2024
a35ae6e
docstring on parametrize over FunLike instead
pechersky Aug 28, 2024
1639c05
remove parens
pechersky Aug 28, 2024
b1be6b0
Merge branch 'pechersky/order-monoid-iso' into pechersky/discrete-or-…
pechersky Aug 28, 2024
47ce27c
use ordermulequiv
pechersky Aug 28, 2024
458be4e
to_additive and generalize
pechersky Aug 28, 2024
ec924b4
add zpow_right_inj/zsmul_left_inj and use it
pechersky Aug 28, 2024
48815d4
use orderAddIso
pechersky Aug 29, 2024
1df8e6b
rename and use max
pechersky Aug 29, 2024
5b51d52
Merge branch 'master' into pechersky/discrete-or-denselyOrdered
pechersky Aug 30, 2024
dc414c2
fix proof
pechersky Aug 30, 2024
22e4b8a
fix again
pechersky Aug 30, 2024
3f75390
move `closure_singleton_int_one_eq_top`
pechersky Sep 1, 2024
42e3914
Merge branch 'pechersky/mul-archimedean' into pechersky/multiplicativ…
pechersky Sep 1, 2024
08de427
Merge branch 'pechersky/discrete-or-denselyOrdered' into pechersky/mu…
pechersky Sep 1, 2024
6852975
Merge branch 'pechersky/multiplicativize-group-archimedean' into pech…
pechersky Sep 1, 2024
1d714e2
fix merge
pechersky Sep 1, 2024
ced308a
name instances better
pechersky Sep 1, 2024
e4c537b
fix proofs
pechersky Sep 1, 2024
ac1d6be
Merge branch 'pechersky/multiplicativize-group-archimedean' into pech…
pechersky Sep 1, 2024
bcbb8ae
rewrite proofs
pechersky Sep 1, 2024
638e229
fix docstrings
pechersky Sep 1, 2024
51d926a
fix docstring
pechersky Sep 2, 2024
506bbc6
actually use lemmas
pechersky Sep 2, 2024
9b63e42
Merge branch 'pechersky/discrete-or-denselyOrdered' into pechersky/mu…
pechersky Sep 2, 2024
08b1daf
Merge branch 'pechersky/multiplicativize-group-archimedean' into pech…
pechersky Sep 2, 2024
526aa38
feat(Algebra/Order/Archimedean/Submonoid): `SubmonoidClass.instMulArc…
pechersky Sep 3, 2024
72f08b8
Merge branch 'master' into pechersky/multiplicativize-group-archimedean
pechersky Sep 8, 2024
46c9cf2
fix moves
pechersky Sep 8, 2024
e8ff879
remove empty line
pechersky Sep 8, 2024
ad6d3b0
Merge branch 'master' into pechersky/succ-order-transfer
pechersky Sep 8, 2024
7281608
Merge branch 'pechersky/multiplicativize-group-archimedean' into pech…
pechersky Sep 8, 2024
4310bdc
Merge branch 'master' into pechersky/bddabove-exists-is-greatest-succ…
pechersky Sep 8, 2024
de02bee
feat(RingTheory/Valuation): valuation ring is a Principal Ideal ring …
pechersky Sep 9, 2024
a7edf14
Merge branch 'pechersky/succ-order-type-tags' into pechersky/valuatio…
pechersky Sep 9, 2024
f359078
mathlib
pechersky Sep 9, 2024
28fe4db
Merge branch 'master' into pechersky/succ-order-type-tags
pechersky Sep 9, 2024
f7c8606
update import
pechersky Sep 9, 2024
ed39f53
Merge branch 'pechersky/succ-order-type-tags' into pechersky/valuatio…
pechersky Sep 9, 2024
005dd4d
Merge branch 'pechersky/valuation-integers-PID' into pechersky/valuat…
pechersky Sep 9, 2024
fdc16d3
Merge branch 'pechersky/linear-ordered-comm-with-zero' into pechersky…
pechersky Sep 9, 2024
72ce08b
Merge branch 'pechersky/submonoid-mul-archimedean' into pechersky/val…
pechersky Sep 9, 2024
7ccaa7d
partial proof
pechersky Sep 9, 2024
df40fc7
feat(Algebra/GroupWithZero): MulEquiv between WithZero (units) and th…
pechersky Sep 9, 2024
6054259
Merge branch 'pechersky/with-zero-congr' into pechersky/valuation-int…
pechersky Sep 9, 2024
d32a393
fix gw0 proofs
pechersky Sep 9, 2024
76429ba
feat(GroupTheory/ArchimedeanDensely): discrete iff not densely ordered
pechersky Sep 9, 2024
1bbee76
feat(Algebra/Order/Units): LinearOrderedCommGroup Units when ambient …
pechersky Sep 9, 2024
5dfa65e
Merge branch 'pechersky/units-locgw0' into pechersky/valuation-intege…
pechersky Sep 9, 2024
bab3251
delete duplicate
pechersky Sep 9, 2024
9daef53
Merge branch 'pechersky/units-locgw0' into pechersky/linear-ordered-c…
pechersky Sep 9, 2024
416b0d9
Merge branch 'pechersky/linear-ordered-comm-with-zero' into pechersky…
pechersky Sep 9, 2024
bfca2ed
Merge branch 'pechersky/units-locgw0' into pechersky/linear-ordered-c…
pechersky Sep 9, 2024
6f69b3b
Merge branch 'pechersky/with-zero-congr' into pechersky/linear-ordere…
pechersky Sep 9, 2024
636c032
delete duplicate
pechersky Sep 9, 2024
caa8340
fix naming
pechersky Sep 9, 2024
21e353f
Merge branch 'pechersky/linear-ordered-comm-with-zero' into pechersky…
pechersky Sep 9, 2024
072d3a7
Merge branch 'pechersky/linear-ordered-comm-with-zero-ndo-iff' into p…
pechersky Sep 9, 2024
fee79fc
Merge branch 'pechersky/succ-order-transfer' into pechersky/valuation…
pechersky Sep 9, 2024
d05648d
Merge branch 'pechersky/bddabove-exists-is-greatest-succarch' into pe…
pechersky Sep 9, 2024
7eff01a
signify that hypotheses will usually be found by unification
pechersky Sep 9, 2024
03cc550
suggestions
pechersky Sep 9, 2024
6d9d415
suggestion
pechersky Sep 9, 2024
9900ba2
tidy
pechersky Sep 10, 2024
2eaa7ec
Merge branch 'master' into pechersky/linear-ordered-comm-with-zero
pechersky Sep 12, 2024
ad6d1f6
tidy more
pechersky Sep 12, 2024
8ad50ca
Merge branch 'pechersky/with-zero-congr' into pechersky/linear-ordere…
pechersky Sep 12, 2024
e6a03ab
Merge branch 'pechersky/linear-ordered-comm-with-zero' into pechersky…
pechersky Sep 12, 2024
32c71c1
Merge branch 'pechersky/linear-ordered-comm-with-zero-ndo-iff' into p…
pechersky Sep 12, 2024
7cbb4c0
fix names
pechersky Sep 12, 2024
7f8bf32
Merge branch 'pechersky/linear-ordered-comm-with-zero' into pechersky…
pechersky Sep 12, 2024
3856228
Merge branch 'pechersky/linear-ordered-comm-with-zero-ndo-iff' into p…
pechersky Sep 12, 2024
1f88182
fix naming
pechersky Sep 12, 2024
895ce6b
Merge branch 'master' into pechersky/valuation-integers-PIring
pechersky Sep 12, 2024
b4bee26
Merge branch 'master' into pechersky/valuation-integers-PIring
pechersky Sep 17, 2024
3b44a60
cleanup
pechersky Sep 17, 2024
2afba8e
remove duplicate
pechersky Sep 17, 2024
9e86263
Merge branch 'master' into pechersky/valuation-integers-PIring
pechersky Sep 17, 2024
4139c5c
Merge branch 'master' into pechersky/linear-ordered-comm-with-zero-nd…
pechersky Sep 18, 2024
8ae6aac
Merge branch 'pechersky/linear-ordered-comm-with-zero-ndo-iff' into p…
pechersky Sep 18, 2024
88d95d8
fix
pechersky Sep 18, 2024
f39fb65
Merge branch 'pechersky/linear-ordered-comm-with-zero-ndo-iff' into p…
pechersky Sep 18, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Mathlib.lean
Original file line number Diff line number Diff line change
Expand Up @@ -4048,6 +4048,7 @@ import Mathlib.RingTheory.Unramified.Basic
import Mathlib.RingTheory.Unramified.Derivations
import Mathlib.RingTheory.Unramified.Finite
import Mathlib.RingTheory.Valuation.AlgebraInstances
import Mathlib.RingTheory.Valuation.Archimedean
import Mathlib.RingTheory.Valuation.Basic
import Mathlib.RingTheory.Valuation.ExtendToLocalization
import Mathlib.RingTheory.Valuation.Integers
Expand Down
108 changes: 86 additions & 22 deletions Mathlib/GroupTheory/ArchimedeanDensely.lean
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,21 @@ lemma LinearOrderedAddCommGroup.discrete_or_denselyOrdered (G : Type*)
· simp [hz.left]
· simpa [lt_sub_iff_add_lt'] using hz.right

/-- Any linearly ordered archimedean additive group is either isomorphic (and order-isomorphic)
to the integers, or is densely ordered, exclusively. -/
lemma LinearOrderedAddCommGroup.discrete_iff_not_denselyOrdered (G : Type*)
[LinearOrderedAddCommGroup G] [Archimedean G] :
Nonempty (G ≃+o ℤ) ↔ ¬ DenselyOrdered G := by
suffices ∀ (_ : G ≃+o ℤ), ¬ DenselyOrdered G by
rcases LinearOrderedAddCommGroup.discrete_or_denselyOrdered G with ⟨⟨h⟩⟩|h
· simpa [this h] using ⟨h⟩
· simp only [h, not_true_eq_false, iff_false, not_nonempty_iff]
exact ⟨fun H ↦ (this H) h⟩
intro e H
rw [denselyOrdered_iff_of_orderIsoClass e] at H
obtain ⟨_, _⟩ := exists_between (one_pos (α := ℤ))
linarith

variable (G) in
/-- Any linearly ordered mul-archimedean group is either isomorphic (and order-isomorphic)
to the multiplicative integers, or is densely ordered. -/
Expand All @@ -211,35 +226,84 @@ lemma LinearOrderedCommGroup.discrete_or_denselyOrdered :
rintro ⟨f, hf⟩
exact ⟨AddEquiv.toMultiplicative' f, hf⟩

/-- Any nontrivial (has other than 0 and 1) linearly ordered mul-archimedean group with zero is
either isomorphic (and order-isomorphic) to `ℤₘ₀`, or is densely ordered. -/
lemma LinearOrderedCommGroupWithZero.discrete_or_denselyOrdered (G : Type*)
[LinearOrderedCommGroupWithZero G] [Nontrivial Gˣ] [MulArchimedean G] :
Nonempty (G ≃*o ℤₘ₀) ∨ DenselyOrdered G := by
classical
refine (LinearOrderedCommGroup.discrete_or_denselyOrdered Gˣ).imp ?_ ?_
· intro ⟨f⟩
refine ⟨OrderMonoidIso.trans
⟨WithZero.withZeroUnitsEquiv.symm, ?_⟩ ⟨f.withZero, ?_⟩⟩
· intro
simp only [WithZero.withZeroUnitsEquiv, MulEquiv.symm_mk,
MulEquiv.toEquiv_eq_coe, Equiv.toFun_as_coe, EquivLike.coe_coe, MulEquiv.coe_mk,
Equiv.coe_fn_symm_mk ]
split_ifs <;>
simp_all [← Units.val_le_val]
· intro a b
induction a <;> induction b <;>
simp [MulEquiv.withZero]
variable (G) in
/-- Any linearly ordered mul-archimedean group is either isomorphic (and order-isomorphic)
to the multiplicative integers, or is densely ordered, exclusively. -/
@[to_additive existing]
lemma LinearOrderedCommGroup.discrete_iff_not_denselyOrdered :
Nonempty (G ≃*o Multiplicative ℤ) ↔ ¬ DenselyOrdered G := by
let e : G ≃o Additive G := OrderIso.refl G
rw [denselyOrdered_iff_of_orderIsoClass e,
← LinearOrderedAddCommGroup.discrete_iff_not_denselyOrdered (Additive G)]
refine Nonempty.congr ?_ ?_ <;> intro f
· exact ⟨MulEquiv.toAdditive' f, by simp⟩
· exact ⟨MulEquiv.toAdditive'.symm f, by simp⟩

lemma denselyOrdered_units_iff {G₀ : Type*} [LinearOrderedCommGroupWithZero G₀] [Nontrivial G₀ˣ] :
DenselyOrdered G₀ˣ ↔ DenselyOrdered G₀ := by
constructor
· intro H
refine ⟨fun x y h ↦ ?_⟩
rcases (zero_le' (a := x)).eq_or_lt with rfl|hx
· lift y to using h.ne'.isUnit
obtain ⟨z, hz⟩ := exists_ne (1 : )
refine ⟨(y * |z|ₘ⁻¹ : ), ?_, ?_⟩
· lift y to G₀ˣ using h.ne'.isUnit
obtain ⟨z, hz⟩ := exists_ne (1 : G₀ˣ)
refine ⟨(y * |z|ₘ⁻¹ : G₀ˣ), ?_, ?_⟩
· simp [zero_lt_iff]
· rw [Units.val_lt_val]
simp [hz]
· obtain ⟨z, hz, hz'⟩ := H.dense (Units.mk0 x hx.ne') (Units.mk0 y (hx.trans h).ne')
(by simp [← Units.val_lt_val, h])
refine ⟨z, ?_, ?_⟩ <;>
simpa [← Units.val_lt_val]
· intro H
refine ⟨fun x y h ↦ ?_⟩
obtain ⟨z, hz⟩ := exists_between (Units.val_lt_val.mpr h)
rcases (zero_le' (a := z)).eq_or_lt with rfl|hz'
· simp at hz
refine ⟨Units.mk0 z hz'.ne', ?_⟩
simp [← Units.val_lt_val, hz]

/-- Any nontrivial (has other than 0 and 1) linearly ordered mul-archimedean group with zero is
either isomorphic (and order-isomorphic) to `ℤₘ₀`, or is densely ordered. -/
lemma LinearOrderedCommGroupWithZero.discrete_or_denselyOrdered (G : Type*)
[LinearOrderedCommGroupWithZero G] [Nontrivial Gˣ] [MulArchimedean G] :
Nonempty (G ≃*o WithZero (Multiplicative ℤ)) ∨ DenselyOrdered G := by
classical
rw [← denselyOrdered_units_iff]
refine (LinearOrderedCommGroup.discrete_or_denselyOrdered Gˣ).imp_left ?_
intro ⟨f⟩
refine ⟨OrderMonoidIso.trans
⟨WithZero.withZeroUnitsEquiv.symm, ?_⟩ ⟨f.withZero, ?_⟩⟩
· intro
simp only [WithZero.withZeroUnitsEquiv, MulEquiv.symm_mk,
MulEquiv.toEquiv_eq_coe, Equiv.toFun_as_coe, EquivLike.coe_coe, MulEquiv.coe_mk,
Equiv.coe_fn_symm_mk ]
split_ifs <;>
simp_all [← Units.val_le_val]
· intro a b
induction a <;> induction b <;>
simp [MulEquiv.withZero]

open WithZero in
/-- Any nontrivial (has other than 0 and 1) linearly ordered mul-archimedean group with zero is
either isomorphic (and order-isomorphic) to `ℤₘ₀`, or is densely ordered, exclusively -/
lemma LinearOrderedCommGroupWithZero.discrete_iff_not_denselyOrdered (G : Type*)
[LinearOrderedCommGroupWithZero G] [Nontrivial Gˣ] [MulArchimedean G] :
Nonempty (G ≃*o WithZero (Multiplicative ℤ)) ↔ ¬ DenselyOrdered G := by
rw [← denselyOrdered_units_iff,
← LinearOrderedCommGroup.discrete_iff_not_denselyOrdered]
refine Nonempty.congr ?_ ?_ <;> intro f
· refine ⟨MulEquiv.unzero (withZeroUnitsEquiv.trans f), ?_⟩
intros
simp only [MulEquiv.unzero, withZeroUnitsEquiv, MulEquiv.trans_apply,
MulEquiv.coe_mk, Equiv.coe_fn_mk, recZeroCoe_coe, OrderMonoidIso.coe_mulEquiv,
MulEquiv.symm_trans_apply, MulEquiv.symm_mk, Equiv.coe_fn_symm_mk, map_eq_zero, coe_ne_zero,
↓reduceDIte, unzero_coe, MulEquiv.toEquiv_eq_coe, Equiv.toFun_as_coe, EquivLike.coe_coe]
rw [← Units.val_le_val, ← map_le_map_iff f, ← coe_le_coe, coe_unzero, coe_unzero]
· refine ⟨withZeroUnitsEquiv.symm.trans (MulEquiv.withZero f), ?_⟩
intros
simp only [withZeroUnitsEquiv, MulEquiv.symm_mk, MulEquiv.withZero,
MulEquiv.toMonoidHom_eq_coe, MulEquiv.toEquiv_eq_coe, Equiv.toFun_as_coe, EquivLike.coe_coe,
MulEquiv.trans_apply, MulEquiv.coe_mk, Equiv.coe_fn_symm_mk, Equiv.coe_fn_mk]
split_ifs <;>
simp_all [← Units.val_le_val]
10 changes: 10 additions & 0 deletions Mathlib/Order/Hom/Basic.lean
Original file line number Diff line number Diff line change
Expand Up @@ -522,6 +522,11 @@ protected def withTopMap (f : α →o β) : WithTop α →o WithTop β :=

end OrderHom

-- See note [lower instance priority]
instance (priority := 100) OrderHomClass.toOrderHomClassOrderDual [LE α] [LE β]
[FunLike F α β] [OrderHomClass F α β] : OrderHomClass F αᵒᵈ βᵒᵈ where
map_rel f := map_rel f

/-- Embeddings of partial orders that preserve `<` also preserve `≤`. -/
def RelEmbedding.orderEmbeddingOfLTEmbedding [PartialOrder α] [PartialOrder β]
(f : ((· < ·) : α → α → Prop) ↪r ((· < ·) : β → β → Prop)) : α ↪o β :=
Expand Down Expand Up @@ -1272,6 +1277,11 @@ end BoundedOrder

end LatticeIsos

-- See note [lower instance priority]
instance (priority := 100) OrderIsoClass.toOrderIsoClassOrderDual [LE α] [LE β]
[EquivLike F α β] [OrderIsoClass F α β] : OrderIsoClass F αᵒᵈ βᵒᵈ where
map_le_map_iff f := map_le_map_iff f

section DenselyOrdered

lemma denselyOrdered_iff_of_orderIsoClass {X Y F : Type*} [Preorder X] [Preorder Y]
Expand Down
33 changes: 33 additions & 0 deletions Mathlib/Order/SuccPred/Archimedean.lean
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,39 @@ lemma SuccOrder.forall_ne_bot_iff
simp only [Function.iterate_succ', Function.comp_apply]
apply h

section IsLeast

-- TODO: generalize to PartialOrder and `DirectedOn` after #16272
lemma BddAbove.exists_isGreatest_of_nonempty {X : Type*} [LinearOrder X] [SuccOrder X]
[IsSuccArchimedean X] {S : Set X} (hS : BddAbove S) (hS' : S.Nonempty) :
∃ x, IsGreatest S x := by
obtain ⟨m, hm⟩ := hS
obtain ⟨n, hn⟩ := hS'
by_cases hm' : m ∈ S
· exact ⟨_, hm', hm⟩
have hn' := hm hn
revert hn hm hm'
refine Succ.rec ?_ ?_ hn'
· simp (config := {contextual := true})
intro m _ IH hm hn hm'
rw [mem_upperBounds] at IH hm
simp_rw [Order.le_succ_iff_eq_or_le] at hm
replace hm : ∀ x ∈ S, x ≤ m := by
intro x hx
refine (hm x hx).resolve_left ?_
rintro rfl
exact hm' hx
by_cases hmS : m ∈ S
· exact ⟨m, hmS, hm⟩
· exact IH hm hn hmS

lemma BddBelow.exists_isLeast_of_nonempty {X : Type*} [LinearOrder X] [PredOrder X]
[IsPredArchimedean X] {S : Set X} (hS : BddBelow S) (hS' : S.Nonempty) :
∃ x, IsLeast S x :=
BddAbove.exists_isGreatest_of_nonempty (X := Xᵒᵈ) hS hS'

end IsLeast

section OrderIso

variable {X Y : Type*} [PartialOrder X] [PartialOrder Y]
Expand Down
125 changes: 125 additions & 0 deletions Mathlib/RingTheory/Valuation/Archimedean.lean
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
/-
Copyright (c) 2024 Yakov Pechersky. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Yakov Pechersky
-/
import Mathlib.Algebra.Order.Archimedean.Submonoid
import Mathlib.Algebra.Order.Monoid.Submonoid
import Mathlib.Algebra.Order.SuccPred.TypeTags
import Mathlib.Data.Int.SuccPred
import Mathlib.GroupTheory.ArchimedeanDensely
import Mathlib.RingTheory.Valuation.Integers

/-!
# Ring of integers under a given valuation in an multiplicatively archimedean codomain

-/

namespace Valuation.Integers

section Field

variable {F Γ₀ O : Type*} [Field F] [LinearOrderedCommGroupWithZero Γ₀]
[CommRing O] [Algebra O F] {v : Valuation F Γ₀}

lemma isPrincipalIdealRing_iff_not_denselyOrdered [MulArchimedean Γ₀] (hv : Integers v O) :
IsPrincipalIdealRing O ↔ ¬ DenselyOrdered (Set.range v) := by
refine ⟨fun _ ↦ not_denselyOrdered_of_isPrincipalIdealRing hv, fun H ↦ ?_⟩
let l : LinearOrderedCommGroupWithZero (MonoidHom.mrange v) :=
{ zero := ⟨0, by simp⟩
zero_mul := by
intro a
exact Subtype.ext (zero_mul a.val)
mul_zero := by
intro a
exact Subtype.ext (mul_zero a.val)
zero_le_one := Subtype.coe_le_coe.mp (zero_le_one)
inv := fun x ↦ ⟨x⁻¹, by
obtain ⟨y, hy⟩ := x.prop
simp_rw [← hy, ← v.map_inv]
exact MonoidHom.mem_mrange.mpr ⟨_, rfl⟩⟩
exists_pair_ne := ⟨⟨v 0, by simp⟩, ⟨v 1, by simp [- _root_.map_one]⟩, by simp⟩
inv_zero := Subtype.ext inv_zero
mul_inv_cancel := by
rintro ⟨a, ha⟩ h
simp only [ne_eq, Subtype.ext_iff] at h
simpa using mul_inv_cancel₀ h }
have h0 : (0 : MonoidHom.mrange v) = ⟨0, by simp⟩ := rfl
rcases subsingleton_or_nontrivial (MonoidHom.mrange v)ˣ with hs|_
· have : ∀ x : (MonoidHom.mrange v)ˣ, x.val = 1 := by
intro x
rw [← Units.val_one, Units.eq_iff]
exact Subsingleton.elim _ _
replace this : ∀ x ≠ 0, v x = 1 := by
intros x hx
specialize this (Units.mk0 ⟨v x, by simp⟩ _)
· simp [ne_eq, Subtype.ext_iff, h0, hx]
simpa [Subtype.ext_iff] using this
suffices ∀ I : Ideal O, I = ⊥ ∨ I = ⊤ by
constructor
intro I
rcases this I with rfl|rfl
· exact ⟨0, Ideal.span_zero.symm⟩
· exact ⟨1, Ideal.span_one.symm⟩
intro I
rcases eq_or_ne I ⊤ with rfl|hI
· simp
simp only [hI, or_false]
ext x
rcases eq_or_ne x 0 with rfl|hx
· simp
· specialize this (algebraMap O F x) (by simp [map_eq_zero_iff _ hv.hom_inj, hx])
simp only [Ideal.mem_bot, hx, iff_false]
contrapose! hI
exact Ideal.eq_top_of_isUnit_mem _ hI (isUnit_of_one' hv this)
replace H : ¬ DenselyOrdered (MonoidHom.mrange v) := H
rw [← LinearOrderedCommGroupWithZero.discrete_iff_not_denselyOrdered (MonoidHom.mrange v)] at H
obtain ⟨e⟩ := H
constructor
intro S
rw [isPrincipal_iff_exists_isGreatest hv]
rcases eq_or_ne S ⊥ with rfl|hS
· simp only [Function.comp_apply, Submodule.bot_coe, Set.image_singleton, _root_.map_zero]
exact ⟨0, by simp⟩
let e' : (MonoidHom.mrange v)ˣ ≃o Multiplicative ℤ := ⟨
(MulEquiv.unzero (WithZero.withZeroUnitsEquiv.trans e)).toEquiv, by
intros
simp only [MulEquiv.unzero, WithZero.withZeroUnitsEquiv,
MulEquiv.trans_apply, MulEquiv.coe_mk, Equiv.coe_fn_mk, WithZero.recZeroCoe_coe,
OrderMonoidIso.coe_mulEquiv, MulEquiv.symm_trans_apply, MulEquiv.symm_mk, Units.val_mk0,
Equiv.coe_fn_symm_mk, map_eq_zero, WithZero.coe_ne_zero, ↓reduceDIte, WithZero.unzero_coe,
MulEquiv.toEquiv_eq_coe, Equiv.toFun_as_coe, EquivLike.coe_coe, ← Units.val_le_val]
rw [← map_le_map_iff e, ← WithZero.coe_le_coe, WithZero.coe_unzero, WithZero.coe_unzero]⟩
let _ : SuccOrder (MonoidHom.mrange v)ˣ := .ofOrderIso e'.symm
have : IsSuccArchimedean (MonoidHom.mrange v)ˣ := .of_orderIso e'.symm
set T : Set (MonoidHom.mrange v)ˣ := {y | ∃ (x : O) (h : x ≠ 0), x ∈ S ∧
y = Units.mk0 ⟨v (algebraMap O F x), by simp⟩
(by simp [map_ne_zero_iff, Subtype.ext_iff, h0, map_eq_zero_iff _ hv.hom_inj, h])} with hT
have : BddAbove (α := (MonoidHom.mrange v)ˣ) T := by
refine ⟨1, ?_⟩
simp only [ne_eq, exists_and_left, mem_upperBounds, Set.mem_setOf_eq, forall_exists_index,
and_imp, hT]
rintro _ x _ hx' rfl
simp [← Units.val_le_val, ← Subtype.coe_le_coe, hv.map_le_one]
have hTn : T.Nonempty := by
rw [Submodule.ne_bot_iff] at hS
obtain ⟨x, hx, hx'⟩ := hS
refine ⟨Units.mk0 ⟨v (algebraMap O F x), by simp⟩ ?_, ?_⟩
· simp [map_ne_zero_iff, Subtype.ext_iff, h0, map_eq_zero_iff _ hv.hom_inj, hx']
· simp only [hT, ne_eq, exists_and_left, Set.mem_setOf_eq, Units.mk0_inj, Subtype.mk.injEq,
exists_prop', nonempty_prop]
exact ⟨_, hx, hx', rfl⟩
obtain ⟨_, ⟨x, hx, hxS, rfl⟩, hx'⟩ := this.exists_isGreatest_of_nonempty hTn
refine ⟨_, ⟨x, hxS, rfl⟩, ?_⟩
simp only [hT, ne_eq, exists_and_left, mem_upperBounds, Set.mem_setOf_eq, ← Units.val_le_val,
Units.val_mk0, ← Subtype.coe_le_coe, forall_exists_index, and_imp, Function.comp_apply,
Set.mem_image, SetLike.mem_coe, forall_apply_eq_imp_iff₂] at hx' ⊢
intro y hy
rcases eq_or_ne y 0 with rfl|hy'
· simp
specialize hx' _ y hy hy' rfl
simpa [← Units.val_le_val, ← Subtype.coe_le_coe] using hx'

end Field

end Valuation.Integers
Loading