forked from leanprover-community/mathlib4
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathBasic.lean
More file actions
1367 lines (1079 loc) · 53.6 KB
/
Copy pathBasic.lean
File metadata and controls
1367 lines (1079 loc) · 53.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/-
Copyright (c) 2025 Adam Topaz. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Aaron Liu, Adam Topaz
-/
module
public import Mathlib.RingTheory.Valuation.Basic
public import Mathlib.Data.NNReal.Defs
public import Mathlib.Topology.Defs.Filter
public import Mathlib.Order.Filter.Bases.Basic
/-!
# Valuative Relations
In this file we introduce a class called `ValuativeRel R` for a ring `R`.
This bundles a relation `vle : R → R → Prop` on `R` which mimics a
preorder on `R` arising from a valuation.
We introduce the notation `x ≤ᵥ y` for this relation.
Recall that the equivalence class of a valuation is *completely* characterized by
such a preorder. Thus, we can think of `ValuativeRel R` as a way of
saying that `R` is endowed with an equivalence class of valuations.
## Main Definitions
- `ValuativeRel R` endows a commutative ring `R` with a relation arising from a valuation.
This is equivalent to fixing an equivalence class of valuations on `R`.
Use the notation `x ≤ᵥ y` for this relation.
- `ValuativeRel.valuation R` is the "canonical" valuation associated to `ValuativeRel R`,
taking values in `ValuativeRel.ValueGroupWithZero R`.
- Given a valuation `v` on `R` and an instance `[ValuativeRel R]`, writing `[v.Compatible]`
ensures that the relation `x ≤ᵥ y` is equivalent to `v x ≤ v y`. Note that
it is possible to have `[v.Compatible]` and `[w.Compatible]` for two different valuations on `R`.
- Given `[ValuativeRel A]`, `[ValuativeRel B]` and `[Algebra A B]`, the class
`[ValuativeExtension A B]` ensures that the algebra map `A → B` is compatible with the valuations
on `A` and `B`. For example, this can be used to talk about extensions of valued fields.
## Remark
The last two axioms in `ValuativeRel`, namely `vle_mul_cancel` and `not_vle_one_zero`, are
used to ensure that we have a well-behaved valuation taking values in a *value group* (with zero).
In principle, it should be possible to drop these two axioms and obtain a value monoid,
however, such a value monoid would not necessarily embed into an ordered abelian group with zero.
Similarly, without these axioms, the support of the valuation need not be a prime ideal.
We have thus opted to include these two axioms and obtain a `ValueGroupWithZero` associated to
a `ValuativeRel` in order to best align with the literature about valuations on commutative rings.
Future work could refactor `ValuativeRel` by dropping the `vle_mul_cancel` and `not_vle_one_zero`
axioms, opting to make these mixins instead.
## Projects
The `ValuativeRel` class should eventually replace the existing `Valued` typeclass.
Once such a refactor happens, `ValuativeRel` could be renamed to `Valued`.
## TODO
Split this file. For instance, the universal properties of `ValueGroupWithZero` and definition of
`IsRankLeOne` could be separated out.
-/
@[expose] public section
noncomputable section
/-- The class `[ValuativeRel R]` class introduces an operator `x ≤ᵥ y : Prop` for `x y : R`
which is the natural relation arising from (the equivalence class of) a valuation on `R`.
More precisely, if v is a valuation on R then the associated relation is `x ≤ᵥ y ↔ v x ≤ v y`.
Use this class to talk about the case where `R` is equipped with an equivalence class
of valuations. -/
@[ext]
class ValuativeRel (R : Type*) [CommRing R] where
/-- The valuation less-equal operator arising from `ValuativeRel`. -/
vle : R → R → Prop
vle_total (x y) : vle x y ∨ vle y x
vle_trans {z y x} : vle x y → vle y z → vle x z
vle_add {x y z} : vle x z → vle y z → vle (x + y) z
mul_vle_mul_left {x y} (h : vle x y) (z) : vle (x * z) (y * z)
vle_mul_cancel {x y z} : ¬ vle z 0 → vle (x * z) (y * z) → vle x y
not_vle_one_zero : ¬ vle 1 0
@[inherit_doc] infix:50 " ≤ᵥ " => ValuativeRel.vle
macro_rules | `($a ≤ᵥ $b) => `(binrel% ValuativeRel.vle $a $b)
namespace Valuation
variable {R Γ : Type*} [CommRing R] [LinearOrderedCommMonoidWithZero Γ]
(v : Valuation R Γ)
/-- We say that a valuation `v` is `Compatible` if the relation `x ≤ᵥ y`
is equivalent to `v x ≤ v y`. -/
class Compatible [ValuativeRel R] where
vle_iff_le (x y : R) : x ≤ᵥ y ↔ v x ≤ v y
end Valuation
/-- A preorder on a ring is said to be "valuative" if it agrees with the
valuative relation. -/
class ValuativePreorder (R : Type*) [CommRing R] [ValuativeRel R] [Preorder R] where
vle_iff_le (x y : R) : x ≤ᵥ y ↔ x ≤ y
namespace ValuativeRel
@[deprecated (since := "2025-12-20")] alias Rel := vle
@[deprecated (since := "2025-12-20")] alias rel_total := vle_total
@[deprecated (since := "2025-12-20")] alias rel_trans := vle_trans
@[deprecated (since := "2025-12-20")] alias rel_add := vle_add
@[deprecated (since := "2025-12-20")] alias rel_mul_right := mul_vle_mul_left
@[deprecated (since := "2025-12-20")] alias rel_mul_cancel := vle_mul_cancel
@[deprecated (since := "2025-12-20")] alias not_rel_one_zero := not_vle_one_zero
variable {R : Type*} [CommRing R] [ValuativeRel R] {x y z : R}
/-- The valuation less-than relation, defined as `x <ᵥ y ↔ ¬ y ≤ᵥ x`. -/
def vlt (x y : R) : Prop := ¬ y ≤ᵥ x
@[deprecated (since := "2025-12-20")] alias SRel := vlt
@[inherit_doc] infix:50 " <ᵥ " => ValuativeRel.vlt
macro_rules | `($a <ᵥ $b) => `(binrel% ValuativeRel.vlt $a $b)
/-- The valuation equals relation, defined as `x =ᵥ y ↔ x ≤ᵥ y ∧ y ≤ᵥ x`. -/
def veq : R → R → Prop := AntisymmRel (· ≤ᵥ ·)
@[inherit_doc] infix:50 " =ᵥ " => ValuativeRel.veq
macro_rules | `($a =ᵥ $b) => `(binrel% ValuativeRel.veq $a $b)
@[simp, grind =] lemma not_vle {x y : R} : ¬ x ≤ᵥ y ↔ y <ᵥ x := .rfl
@[simp, grind =] lemma not_vlt {x y : R} : ¬ x <ᵥ y ↔ y ≤ᵥ x := not_vle.not_left
lemma veq_def {x y : R} : x =ᵥ y ↔ x ≤ᵥ y ∧ y ≤ᵥ x := .rfl
@[deprecated not_vle (since := "2025-12-20")]
lemma srel_iff {x y : R} : x <ᵥ y ↔ ¬ y ≤ᵥ x := Iff.rfl
@[deprecated (since := "2025-12-20")] alias not_srel_iff := not_vlt
protected alias ⟨_, vle.not_vlt⟩ := not_vlt
protected alias ⟨_, vlt.not_vle⟩ := not_vle
lemma veq_comm {x y : R} : x =ᵥ y ↔ y =ᵥ x := antisymmRel_comm
@[symm] protected alias ⟨veq.symm, _⟩ := veq_comm
instance : @Std.Symm R (· =ᵥ ·) where
symm _ _ := veq.symm
lemma vle_of_veq {x y : R} (h : x =ᵥ y) : x ≤ᵥ y := h.1
lemma vge_of_veq {x y : R} (h : x =ᵥ y) : y ≤ᵥ x := h.2
protected alias veq.vle := vle_of_veq
protected alias veq.vge := vge_of_veq
lemma not_vlt_of_veq {x y : R} (h : x =ᵥ y) : ¬ x <ᵥ y := h.vge.not_vlt
lemma not_vgt_of_veq {x y : R} (h : x =ᵥ y) : ¬ y <ᵥ x := h.vle.not_vlt
protected alias veq.not_vlt := not_vlt_of_veq
protected alias veq.not_vgt := not_vgt_of_veq
@[simp, refl] lemma vle_refl (x : R) : x ≤ᵥ x := or_self_iff.1 <| vle_total x x
lemma vle_rfl {x : R} : x ≤ᵥ x := vle_refl x
@[deprecated (since := "2025-12-20")] alias rel_refl := vle_refl
@[deprecated (since := "2025-12-20")] alias rel_rfl := vle_rfl
protected alias vle.refl := vle_refl
protected alias vle.rfl := vle_rfl
instance : @Std.Refl R (· ≤ᵥ ·) where
refl _ := vle_rfl
@[deprecated (since := "2025-12-20")] protected alias Rel.refl := vle.refl
@[deprecated (since := "2025-12-20")] protected alias Rel.rfl := vle.rfl
@[simp, refl] lemma veq_refl (x : R) : x =ᵥ x := AntisymmRel.rfl
lemma veq_rfl {x : R} : x =ᵥ x := veq_refl x
protected alias veq.refl := veq_refl
protected alias veq.rfl := veq_rfl
instance : @Std.Refl R (· =ᵥ ·) where
refl _ := veq_rfl
@[simp]
theorem zero_vle (x : R) : 0 ≤ᵥ x := by
simpa using mul_vle_mul_left ((vle_total 0 1).resolve_right not_vle_one_zero) x
@[deprecated (since := "2025-12-20")] alias zero_rel := zero_vle
@[simp]
theorem not_vlt_zero (x : R) : ¬ x <ᵥ 0 := by
simp
theorem vlt.ne_zero (h : x <ᵥ y) : y ≠ 0 := by
rintro rfl; exact not_vlt_zero _ h
@[simp]
lemma zero_vlt_one : (0 : R) <ᵥ 1 :=
not_vle_one_zero
@[deprecated (since := "2025-12-20")] alias zero_srel_one := zero_vlt_one
@[deprecated mul_vle_mul_left (since := "2026-01-06")]
lemma vle_mul_right {x y : R} (z) (h : x ≤ᵥ y) : x * z ≤ᵥ y * z :=
mul_vle_mul_left h z
lemma mul_vle_mul_right {x y : R} (h : x ≤ᵥ y) (z) : z * x ≤ᵥ z * y := by
rw [mul_comm z x, mul_comm z y]
exact mul_vle_mul_left h z
@[deprecated (since := "2025-12-20")] alias rel_mul_left := mul_vle_mul_right
instance : @Trans R R R vle vle vle where
trans := vle_trans
protected alias vle.trans := vle_trans
@[deprecated (since := "2025-12-20")] protected alias Rel.trans := vle.trans
lemma vle_trans' {x y z : R} (h1 : y ≤ᵥ z) (h2 : x ≤ᵥ y) : x ≤ᵥ z :=
h2.trans h1
@[deprecated (since := "2025-12-20")] alias rel_trans' := vle_trans'
protected alias vle.trans' := vle_trans'
@[deprecated (since := "2025-12-20")] protected alias Rel.trans' := vle.trans'
lemma veq_trans {x y z : R} (h1 : x =ᵥ y) (h2 : y =ᵥ z) : x =ᵥ z :=
AntisymmRel.trans h1 h2
instance : @Trans R R R veq veq veq where
trans := veq_trans
@[gcongr]
lemma mul_vle_mul {x x' y y' : R} (h1 : x ≤ᵥ y) (h2 : x' ≤ᵥ y') : x * x' ≤ᵥ y * y' :=
(mul_vle_mul_left h1 _).trans (mul_vle_mul_right h2 _)
@[deprecated (since := "2025-12-20")] alias mul_rel_mul := mul_vle_mul
@[simp] lemma mul_vle_mul_iff_left (hz : 0 <ᵥ z) : x * z ≤ᵥ y * z ↔ x ≤ᵥ y :=
⟨vle_mul_cancel hz, (mul_vle_mul_left · _)⟩
@[deprecated (since := "2025-12-20")] alias mul_rel_mul_iff_left := mul_vle_mul_iff_left
@[simp] lemma mul_vle_mul_iff_right (hx : 0 <ᵥ x) : x * y ≤ᵥ x * z ↔ y ≤ᵥ z := by
simp [mul_comm x, hx]
@[deprecated (since := "2025-12-20")] alias mul_rel_mul_iff_right := mul_vle_mul_iff_right
@[simp] lemma mul_vlt_mul_iff_left (hz : 0 <ᵥ z) : x * z <ᵥ y * z ↔ x <ᵥ y :=
(mul_vle_mul_iff_left hz).not
@[gcongr] alias ⟨_, mul_vlt_mul_left⟩ := mul_vlt_mul_iff_left
@[deprecated (since := "2026-01-06")] alias vlt_mul_right := mul_vlt_mul_left
@[deprecated (since := "2025-12-20")] alias mul_srel_mul_iff_left := mul_vlt_mul_iff_left
@[simp] lemma mul_vlt_mul_iff_right (hx : 0 <ᵥ x) : x * y <ᵥ x * z ↔ y <ᵥ z :=
(mul_vle_mul_iff_right hx).not
@[gcongr] alias ⟨_, mul_vlt_mul_right⟩ := mul_vlt_mul_iff_right
@[deprecated (since := "2026-01-06")] alias vlt_mul_left := mul_vlt_mul_right
@[deprecated (since := "2025-12-20")] alias mul_srel_mul_iff_right := mul_vlt_mul_iff_right
@[deprecated (since := "2025-11-04")] alias rel_mul := mul_vle_mul
@[gcongr]
lemma mul_veq_mul {x x' y y' : R} (h1 : x =ᵥ y) (h2 : x' =ᵥ y') : x * x' =ᵥ y * y' :=
⟨mul_vle_mul h1.vle h2.vle, mul_vle_mul h1.vge h2.vge⟩
theorem vle_add_cases (x y : R) : x + y ≤ᵥ x ∨ x + y ≤ᵥ y :=
(vle_total y x).imp (fun h => vle_add .rfl h) (fun h => vle_add h .rfl)
@[deprecated (since := "2025-12-20")] alias rel_add_cases := vle_add_cases
@[simp] lemma zero_vlt_mul (hx : 0 <ᵥ x) (hy : 0 <ᵥ y) : 0 <ᵥ x * y := by
contrapose hy
rw [not_vlt] at hy ⊢
rw [show (0 : R) = x * 0 by simp, mul_comm x y, mul_comm x 0] at hy
exact vle_mul_cancel hx hy
@[deprecated (since := "2025-12-20")] alias zero_srel_mul := zero_vlt_mul
variable (R) in
/-- The submonoid of elements `x : R` whose valuation is positive. -/
def posSubmonoid : Submonoid R where
carrier := { x | 0 <ᵥ x }
mul_mem' := zero_vlt_mul
one_mem' := zero_vlt_one
@[simp] lemma zero_vlt_coe_posSubmonoid (x : posSubmonoid R) : 0 <ᵥ x.val := x.prop
@[deprecated (since := "2025-12-20")] alias zero_srel_coe_posSubmonoid := zero_vlt_coe_posSubmonoid
@[simp]
lemma posSubmonoid_def (x : R) : x ∈ posSubmonoid R ↔ 0 <ᵥ x := Iff.rfl
lemma right_cancel_posSubmonoid (x y : R) (u : posSubmonoid R) :
x * u ≤ᵥ y * u ↔ x ≤ᵥ y := by simp
lemma left_cancel_posSubmonoid (x y : R) (u : posSubmonoid R) :
u * x ≤ᵥ u * y ↔ x ≤ᵥ y := by simp
@[simp]
lemma val_posSubmonoid_ne_zero (x : posSubmonoid R) : (x : R) ≠ 0 := by
have := x.prop
rw [posSubmonoid_def] at this
contrapose this
simp [this]
variable (R) in
/-- The setoid used to construct `ValueGroupWithZero R`. -/
@[implicit_reducible]
def valueSetoid : Setoid (R × posSubmonoid R) where
r := fun (x, s) (y, t) => x * t ≤ᵥ y * s ∧ y * s ≤ᵥ x * t
iseqv := {
refl ru := ⟨vle_refl _, vle_refl _⟩
symm h := ⟨h.2, h.1⟩
trans := by
rintro ⟨r, u⟩ ⟨s, v⟩ ⟨t, w⟩ ⟨h1, h2⟩ ⟨h3, h4⟩
constructor
· have := mul_vle_mul h1 (vle_refl ↑w)
rw [mul_right_comm s] at this
have := vle_trans this (mul_vle_mul h3 (vle_refl _))
rw [mul_right_comm r, mul_right_comm t] at this
simpa using this
· have := mul_vle_mul h4 (vle_refl ↑u)
rw [mul_right_comm s] at this
have := vle_trans this (mul_vle_mul h2 (vle_refl _))
rw [mul_right_comm t, mul_right_comm r] at this
simpa using this
}
variable (R) in
/-- The "canonical" value group-with-zero of a ring with a valuative relation. -/
def ValueGroupWithZero := Quotient (valueSetoid R)
/-- Construct an element of the value group-with-zero from an element `r : R` and
`y : posSubmonoid R`. This should be thought of as `v r / v y`. -/
protected
def ValueGroupWithZero.mk (x : R) (y : posSubmonoid R) : ValueGroupWithZero R :=
Quotient.mk _ (x, y)
protected
theorem ValueGroupWithZero.sound {x y : R} {t s : posSubmonoid R}
(h₁ : x * s ≤ᵥ y * t) (h₂ : y * t ≤ᵥ x * s) :
ValueGroupWithZero.mk x t = ValueGroupWithZero.mk y s :=
Quotient.sound ⟨h₁, h₂⟩
protected
theorem ValueGroupWithZero.exact {x y : R} {t s : posSubmonoid R}
(h : ValueGroupWithZero.mk x t = ValueGroupWithZero.mk y s) :
x * s ≤ᵥ y * t ∧ y * t ≤ᵥ x * s :=
Quotient.exact h
protected
theorem ValueGroupWithZero.ind {motive : ValueGroupWithZero R → Prop} (mk : ∀ x y, motive (.mk x y))
(t : ValueGroupWithZero R) : motive t :=
Quotient.ind (fun (x, y) => mk x y) t
/-- Lifts a function `R → posSubmonoid R → α` to the value group-with-zero of `R`. -/
protected
def ValueGroupWithZero.lift {α : Sort*} (f : R → posSubmonoid R → α)
(hf : ∀ (x y : R) (t s : posSubmonoid R), x * t ≤ᵥ y * s → y * s ≤ᵥ x * t → f x s = f y t)
(t : ValueGroupWithZero R) : α :=
Quotient.lift (fun (x, y) => f x y) (fun (x, t) (y, s) ⟨h₁, h₂⟩ => hf x y s t h₁ h₂) t
@[simp] protected
theorem ValueGroupWithZero.lift_mk {α : Sort*} (f : R → posSubmonoid R → α)
(hf : ∀ (x y : R) (t s : posSubmonoid R), x * t ≤ᵥ y * s → y * s ≤ᵥ x * t → f x s = f y t)
(x : R) (y : posSubmonoid R) : ValueGroupWithZero.lift f hf (.mk x y) = f x y := rfl
/-- Lifts a function `R → posSubmonoid R → R → posSubmonoid R → α` to
the value group-with-zero of `R`. -/
protected
def ValueGroupWithZero.lift₂ {α : Sort*} (f : R → posSubmonoid R → R → posSubmonoid R → α)
(hf : ∀ (x y z w : R) (t s u v : posSubmonoid R),
x * t ≤ᵥ y * s → y * s ≤ᵥ x * t → z * u ≤ᵥ w * v → w * v ≤ᵥ z * u →
f x s z v = f y t w u)
(t₁ : ValueGroupWithZero R) (t₂ : ValueGroupWithZero R) : α :=
Quotient.lift₂ (fun (x, t) (y, s) => f x t y s)
(fun (x, t) (z, v) (y, s) (w, u) ⟨h₁, h₂⟩ ⟨h₃, h₄⟩ => hf x y z w s t u v h₁ h₂ h₃ h₄) t₁ t₂
@[simp] protected
lemma ValueGroupWithZero.lift₂_mk {α : Sort*} (f : R → posSubmonoid R → R → posSubmonoid R → α)
(hf : ∀ (x y z w : R) (t s u v : posSubmonoid R),
x * t ≤ᵥ y * s → y * s ≤ᵥ x * t → z * u ≤ᵥ w * v → w * v ≤ᵥ z * u →
f x s z v = f y t w u)
(x y : R) (z w : posSubmonoid R) :
ValueGroupWithZero.lift₂ f hf (.mk x z) (.mk y w) = f x z y w := rfl
theorem ValueGroupWithZero.mk_eq_mk {x y : R} {t s : posSubmonoid R} :
ValueGroupWithZero.mk x t = ValueGroupWithZero.mk y s ↔ x * s ≤ᵥ y * t ∧ y * t ≤ᵥ x * s :=
Quotient.eq
instance : Zero (ValueGroupWithZero R) where
zero := .mk 0 1
@[simp]
theorem ValueGroupWithZero.mk_eq_zero (x : R) (y : posSubmonoid R) :
ValueGroupWithZero.mk x y = 0 ↔ x ≤ᵥ 0 :=
⟨fun h => by simpa using ValueGroupWithZero.mk_eq_mk.mp h,
fun h => ValueGroupWithZero.sound (by simpa using h) (by simp)⟩
@[simp]
theorem ValueGroupWithZero.mk_zero (x : posSubmonoid R) : ValueGroupWithZero.mk 0 x = 0 :=
(ValueGroupWithZero.mk_eq_zero 0 x).mpr .rfl
instance : One (ValueGroupWithZero R) where
one := .mk 1 1
@[simp]
theorem ValueGroupWithZero.mk_self (x : posSubmonoid R) : ValueGroupWithZero.mk (x : R) x = 1 :=
ValueGroupWithZero.sound (by simp) (by simp)
@[simp]
theorem ValueGroupWithZero.mk_one_one : ValueGroupWithZero.mk (1 : R) 1 = 1 :=
ValueGroupWithZero.sound (by simp) (by simp)
@[simp]
theorem ValueGroupWithZero.mk_eq_one (x : R) (y : posSubmonoid R) :
ValueGroupWithZero.mk x y = 1 ↔ x ≤ᵥ y ∧ y ≤ᵥ x := by
simp [← mk_one_one, mk_eq_mk]
theorem ValueGroupWithZero.lift_zero {α : Sort*} (f : R → posSubmonoid R → α)
(hf : ∀ (x y : R) (t s : posSubmonoid R), x * t ≤ᵥ y * s → y * s ≤ᵥ x * t → f x s = f y t) :
ValueGroupWithZero.lift f hf 0 = f 0 1 :=
rfl
@[simp]
theorem ValueGroupWithZero.lift_one {α : Sort*} (f : R → posSubmonoid R → α)
(hf : ∀ (x y : R) (t s : posSubmonoid R), x * t ≤ᵥ y * s → y * s ≤ᵥ x * t → f x s = f y t) :
ValueGroupWithZero.lift f hf 1 = f 1 1 :=
rfl
instance : Mul (ValueGroupWithZero R) where
mul := ValueGroupWithZero.lift₂ (fun a b c d => .mk (a * c) (b * d)) <| by
intro x y z w t s u v h₁ h₂ h₃ h₄
apply ValueGroupWithZero.sound
· rw [Submonoid.coe_mul, Submonoid.coe_mul,
mul_mul_mul_comm x, mul_mul_mul_comm y]
exact mul_vle_mul h₁ h₃
· rw [Submonoid.coe_mul, Submonoid.coe_mul,
mul_mul_mul_comm x, mul_mul_mul_comm y]
exact mul_vle_mul h₂ h₄
@[simp]
theorem ValueGroupWithZero.mk_mul_mk (a b : R) (c d : posSubmonoid R) :
ValueGroupWithZero.mk a c * ValueGroupWithZero.mk b d = ValueGroupWithZero.mk (a * b) (c * d) :=
rfl
theorem ValueGroupWithZero.lift_mul {α : Type*} [Mul α] (f : R → posSubmonoid R → α)
(hf : ∀ (x y : R) (t s : posSubmonoid R), x * t ≤ᵥ y * s → y * s ≤ᵥ x * t → f x s = f y t)
(hdist : ∀ (a b r s), f (a * b) (r * s) = f a r * f b s)
(a b : ValueGroupWithZero R) :
ValueGroupWithZero.lift f hf (a * b) =
ValueGroupWithZero.lift f hf a * ValueGroupWithZero.lift f hf b := by
induction a using ValueGroupWithZero.ind
induction b using ValueGroupWithZero.ind
simpa using hdist _ _ _ _
instance : CommMonoidWithZero (ValueGroupWithZero R) where
mul_assoc a b c := by
induction a using ValueGroupWithZero.ind
induction b using ValueGroupWithZero.ind
induction c using ValueGroupWithZero.ind
simp [mul_assoc]
one_mul := ValueGroupWithZero.ind <| by simp [← ValueGroupWithZero.mk_one_one]
mul_one := ValueGroupWithZero.ind <| by simp [← ValueGroupWithZero.mk_one_one]
zero_mul := ValueGroupWithZero.ind <| fun _ _ => by
rw [← ValueGroupWithZero.mk_zero 1, ValueGroupWithZero.mk_mul_mk]
simp
mul_zero := ValueGroupWithZero.ind <| fun _ _ => by
rw [← ValueGroupWithZero.mk_zero 1, ValueGroupWithZero.mk_mul_mk]
simp
mul_comm a b := by
induction a using ValueGroupWithZero.ind
induction b using ValueGroupWithZero.ind
simp [mul_comm]
npow n := ValueGroupWithZero.lift (fun a b => ValueGroupWithZero.mk (a ^ n) (b ^ n)) <| by
intro x y t s h₁ h₂
induction n with
| zero => simp
| succ n ih =>
simp only [pow_succ, ← ValueGroupWithZero.mk_mul_mk, ih]
apply congrArg (_ * ·)
exact ValueGroupWithZero.sound h₁ h₂
npow_zero := ValueGroupWithZero.ind (by simp)
npow_succ n := ValueGroupWithZero.ind (by simp [pow_succ])
instance : LE (ValueGroupWithZero R) where
le := ValueGroupWithZero.lift₂ (fun a s b t => a * t ≤ᵥ b * s) <| by
intro x y z w t s u v h₁ h₂ h₃ h₄
by_cases hw : w ≤ᵥ 0 <;> by_cases hz : z ≤ᵥ 0
· refine propext ⟨fun h => vle_trans ?_ (zero_vle _), fun h => vle_trans ?_ (zero_vle _)⟩
· apply vle_mul_cancel (s * v).prop
rw [mul_right_comm, Submonoid.coe_mul, ← mul_assoc]
apply (mul_vle_mul_left (mul_vle_mul_left h₂ v) u).trans
rw [mul_right_comm x]
apply (mul_vle_mul_left (mul_vle_mul_left h t) u).trans
apply vle_trans (mul_vle_mul_left (mul_vle_mul_left (mul_vle_mul_left hz s) t) u)
simp
· apply vle_mul_cancel (t * u).prop
rw [mul_right_comm, Submonoid.coe_mul, ← mul_assoc]
apply (mul_vle_mul_left (mul_vle_mul_left h₁ u) v).trans
rw [mul_right_comm y]
apply (mul_vle_mul_left (mul_vle_mul_left h s) v).trans
apply vle_trans (mul_vle_mul_left (mul_vle_mul_left (mul_vle_mul_left hw t) s) v)
simp
· absurd hz
apply vle_mul_cancel u.prop
simpa using h₃.trans (mul_vle_mul_left hw v)
· absurd hw
apply vle_mul_cancel v.prop
simpa using h₄.trans (mul_vle_mul_left hz u)
· refine propext ⟨fun h => ?_, fun h => ?_⟩
· apply vle_mul_cancel s.prop
apply vle_mul_cancel hz
calc y * u * s * z
_ = y * s * (z * u) := by ring
_ ≤ᵥ x * t * (w * v) := by gcongr
_ = x * v * (t * w) := by ring
_ ≤ᵥ z * s * (t * w) := by gcongr
_ = w * t * s * z := by ring
· apply vle_mul_cancel t.prop
apply vle_mul_cancel hw
calc x * v * t * w
_ = x * t * (w * v) := by ring
_ ≤ᵥ y * s * (z * u) := by gcongr
_ = y * u * (s * z) := by ring
_ ≤ᵥ w * t * (s * z) := by gcongr
_ = z * s * t * w := by ring
@[simp]
theorem ValueGroupWithZero.mk_le_mk (x y : R) (t s : posSubmonoid R) :
ValueGroupWithZero.mk x t ≤ ValueGroupWithZero.mk y s ↔ x * s ≤ᵥ y * t := Iff.rfl
instance : LinearOrder (ValueGroupWithZero R) where
le_refl := ValueGroupWithZero.ind fun _ _ => .rfl
le_trans a b c hab hbc := by
induction a using ValueGroupWithZero.ind with | mk a₁ a₂
induction b using ValueGroupWithZero.ind with | mk b₁ b₂
induction c using ValueGroupWithZero.ind with | mk c₁ c₂
rw [ValueGroupWithZero.mk_le_mk] at hab hbc ⊢
apply vle_mul_cancel b₂.prop
calc a₁ * c₂ * b₂
_ = a₁ * b₂ * c₂ := by rw [mul_right_comm]
_ ≤ᵥ b₁ * a₂ * c₂ := mul_vle_mul_left hab _
_ = b₁ * c₂ * a₂ := by rw [mul_right_comm]
_ ≤ᵥ c₁ * b₂ * a₂ := mul_vle_mul_left hbc _
_ = c₁ * a₂ * b₂ := by rw [mul_right_comm]
le_antisymm a b hab hba := by
induction a using ValueGroupWithZero.ind
induction b using ValueGroupWithZero.ind
exact ValueGroupWithZero.sound hab hba
le_total a b := by
induction a using ValueGroupWithZero.ind
induction b using ValueGroupWithZero.ind
rw [ValueGroupWithZero.mk_le_mk, ValueGroupWithZero.mk_le_mk]
apply vle_total
toDecidableLE := Classical.decRel LE.le
@[simp]
theorem ValueGroupWithZero.mk_lt_mk (x y : R) (t s : posSubmonoid R) :
ValueGroupWithZero.mk x t < ValueGroupWithZero.mk y s ↔ x * s <ᵥ y * t := by
rw [lt_iff_not_ge, ← not_vle, mk_le_mk]
@[simp]
lemma ValueGroupWithZero.mk_pos {x : R} {s : posSubmonoid R} :
0 < ValueGroupWithZero.mk x s ↔ 0 <ᵥ x := by rw [← mk_zero 1]; simp [-mk_zero]
instance : Bot (ValueGroupWithZero R) where
bot := 0
theorem ValueGroupWithZero.bot_eq_zero : (⊥ : ValueGroupWithZero R) = 0 := rfl
instance : OrderBot (ValueGroupWithZero R) where
bot_le := ValueGroupWithZero.ind fun x y => by
rw [ValueGroupWithZero.bot_eq_zero, ← ValueGroupWithZero.mk_zero 1, ValueGroupWithZero.mk_le_mk]
simp
instance : IsOrderedMonoid (ValueGroupWithZero R) where
mul_le_mul_left a b hab c := by
induction a using ValueGroupWithZero.ind
induction b using ValueGroupWithZero.ind
induction c using ValueGroupWithZero.ind
simp only [ValueGroupWithZero.mk_mul_mk, ValueGroupWithZero.mk_le_mk, Submonoid.coe_mul]
conv_lhs => apply mul_mul_mul_comm
conv_rhs => apply mul_mul_mul_comm
exact mul_vle_mul_left hab _
instance : Inv (ValueGroupWithZero R) where
inv := ValueGroupWithZero.lift (fun x s => by
classical exact if h : x ≤ᵥ 0 then 0 else .mk s ⟨x, h⟩) <| by
intro x y t s h₁ h₂
by_cases hx : x ≤ᵥ 0 <;> by_cases hy : y ≤ᵥ 0
· simp [hx, hy]
· absurd hy
apply vle_mul_cancel s.prop
simpa using vle_trans h₂ (mul_vle_mul_left hx t)
· absurd hx
apply vle_mul_cancel t.prop
simpa using vle_trans h₁ (mul_vle_mul_left hy s)
· simp only [dif_neg hx, dif_neg hy]
apply ValueGroupWithZero.sound
· simpa [mul_comm] using h₂
· simpa [mul_comm] using h₁
@[simp]
theorem ValueGroupWithZero.inv_mk (x : R) (y : posSubmonoid R) (hx : ¬x ≤ᵥ 0) :
(ValueGroupWithZero.mk x y)⁻¹ = ValueGroupWithZero.mk (y : R) ⟨x, hx⟩ := dif_neg hx
/-- The value group-with-zero is a linearly ordered commutative group with zero. -/
instance : LinearOrderedCommGroupWithZero (ValueGroupWithZero R) where
zero_le _ := bot_le
exists_pair_ne := by
refine ⟨0, 1, fun h => ?_⟩
apply ge_of_eq at h
rw [← ValueGroupWithZero.mk_zero 1, ← ValueGroupWithZero.mk_one_one,
ValueGroupWithZero.mk_le_mk] at h
simp [not_vle_one_zero] at h
inv_zero := dif_pos .rfl
mul_inv_cancel := ValueGroupWithZero.ind fun x y h => by
rw [ne_eq, ← ValueGroupWithZero.mk_zero 1, ValueGroupWithZero.mk_eq_mk] at h
simp only [Submonoid.coe_one, mul_one, zero_mul, zero_vle, and_true] at h
rw [ValueGroupWithZero.inv_mk x y h, ← ValueGroupWithZero.mk_one_one,
ValueGroupWithZero.mk_mul_mk, ValueGroupWithZero.mk_eq_mk]
simp [mul_comm]
mul_lt_mul_of_pos_left := ValueGroupWithZero.ind fun a x ha ↦ ValueGroupWithZero.ind fun b y ↦
ValueGroupWithZero.ind fun c z hbc ↦ by simp_all [mul_mul_mul_comm _ _ (x : R)]
variable (R) in
/-- The "canonical" valuation associated to a valuative relation. -/
def valuation : Valuation R (ValueGroupWithZero R) where
toFun r := ValueGroupWithZero.mk r 1
map_zero' := rfl
map_one' := rfl
map_mul' _ _ := by simp
map_add_le_max' := by simp [vle_add_cases]
instance : (valuation R).Compatible where
vle_iff_le _ _ := by simp [valuation]
@[simp]
lemma ValueGroupWithZero.lift_valuation {α : Sort*} (f : R → posSubmonoid R → α)
(hf : ∀ (x y : R) (t s : posSubmonoid R), x * t ≤ᵥ y * s → y * s ≤ᵥ x * t → f x s = f y t)
(x : R) :
ValueGroupWithZero.lift f hf (valuation R x) = f x 1 :=
rfl
lemma valuation_eq_zero_iff {x : R} :
valuation R x = 0 ↔ x ≤ᵥ 0 :=
ValueGroupWithZero.mk_eq_zero _ _
lemma valuation_posSubmonoid_ne_zero (x : posSubmonoid R) :
valuation R (x : R) ≠ 0 := by
rw [ne_eq, valuation_eq_zero_iff]
exact x.prop
lemma ValueGroupWithZero.mk_eq_div (r : R) (s : posSubmonoid R) :
ValueGroupWithZero.mk r s = valuation R r / valuation R (s : R) := by
rw [eq_div_iff (valuation_posSubmonoid_ne_zero _)]
simp [valuation, mk_eq_mk]
/-- Construct a valuative relation on a ring using a valuation. -/
@[implicit_reducible]
def ofValuation
{S Γ : Type*} [CommRing S]
[LinearOrderedCommGroupWithZero Γ]
(v : Valuation S Γ) : ValuativeRel S where
vle x y := v x ≤ v y
vle_total x y := le_total (v x) (v y)
vle_trans := le_trans
vle_add hab hbc := (map_add_le_max v _ _).trans (sup_le hab hbc)
mul_vle_mul_left _ h := by simp only [map_mul]; gcongr
vle_mul_cancel h0 h := by
rw [map_zero, le_zero_iff] at h0
simp only [map_mul] at h
exact le_of_mul_le_mul_right h (lt_of_le_of_ne' zero_le' h0)
not_vle_one_zero := by simp
lemma _root_.Valuation.Compatible.ofValuation
{S Γ : Type*} [CommRing S]
[LinearOrderedCommGroupWithZero Γ]
(v : Valuation S Γ) :
letI := ValuativeRel.ofValuation v -- letI so that instance is inlined directly in declaration
Valuation.Compatible v :=
letI := ValuativeRel.ofValuation v
⟨fun _ _ ↦ Iff.rfl⟩
lemma isEquiv {Γ₁ Γ₂ : Type*}
[LinearOrderedCommMonoidWithZero Γ₁]
[LinearOrderedCommMonoidWithZero Γ₂]
(v₁ : Valuation R Γ₁)
(v₂ : Valuation R Γ₂)
[v₁.Compatible] [v₂.Compatible] :
v₁.IsEquiv v₂ := by
intro x y
simp_rw [← Valuation.Compatible.vle_iff_le]
end ValuativeRel
namespace Valuation
open ValuativeRel
variable {R : Type*} [CommRing R] [ValuativeRel R]
variable {Γ₀ : Type*} [LinearOrderedCommMonoidWithZero Γ₀] (v : Valuation R Γ₀) [v.Compatible]
variable {x y : R}
lemma vle_iff_le : x ≤ᵥ y ↔ v x ≤ v y :=
Compatible.vle_iff_le _ _
@[deprecated (since := "2025-12-20")] alias rel_iff_le := vle_iff_le
lemma vlt_iff_lt : x <ᵥ y ↔ v x < v y := by
simp [lt_iff_not_ge, ← Compatible.vle_iff_le]
@[deprecated (since := "2025-12-20")] alias srel_iff_lt := vlt_iff_lt
@[deprecated (since := "2025-10-09")]
alias Compatible.srel_iff_lt := vlt_iff_lt
lemma veq_iff_eq : x =ᵥ y ↔ v x = v y := by
simp_rw [veq_def, vle_iff_le v, antisymm_iff]
lemma vle_one_iff : x ≤ᵥ 1 ↔ v x ≤ 1 := by simp [v.vle_iff_le]
lemma vlt_one_iff : x <ᵥ 1 ↔ v x < 1 := by simp [v.vlt_iff_lt]
lemma one_vle_iff : 1 ≤ᵥ x ↔ 1 ≤ v x := by simp [v.vle_iff_le]
lemma one_vlt_iff : 1 <ᵥ x ↔ 1 < v x := by simp [v.vlt_iff_lt]
@[deprecated (since := "2025-12-20")] alias rel_one_iff := vle_one_iff
@[deprecated (since := "2025-12-20")] alias srel_one_iff := vlt_one_iff
@[deprecated (since := "2025-12-20")] alias one_rel_iff := one_vle_iff
@[deprecated (since := "2025-12-20")] alias one_srel_iff := one_vlt_iff
@[simp]
lemma apply_posSubmonoid_ne_zero (x : posSubmonoid R) : v (x : R) ≠ 0 := by
simp [(isEquiv v (valuation R)).eq_zero, valuation_posSubmonoid_ne_zero]
@[simp]
lemma apply_posSubmonoid_pos (x : posSubmonoid R) : 0 < v x :=
zero_lt_iff.mpr <| v.apply_posSubmonoid_ne_zero x
end Valuation
namespace ValuativeRel
variable {R : Type*} [CommRing R] [ValuativeRel R]
variable (R) in
/-- An alias for endowing a ring with a preorder defined as the valuative relation. -/
def WithPreorder := R
/-- The ring instance on `WithPreorder R` arising from the ring structure on `R`. -/
instance : CommRing (WithPreorder R) := inferInstanceAs (CommRing R)
/-- The preorder on `WithPreorder R` arising from the valuative relation on `R`. -/
instance : Preorder (WithPreorder R) where
le (x y : R) := x ≤ᵥ y
le_refl _ := vle_refl _
le_trans _ _ _ := vle_trans
lt (x y : R) := x <ᵥ y
lt_iff_le_not_ge (x y : R) := by have := vle_total x y; grind
/-- The valuative relation on `WithPreorder R` arising from the valuative relation on `R`.
This is defined as the preorder itself. -/
instance : ValuativeRel (WithPreorder R) where
vle := (· ≤ ·)
vle_total := vle_total (R := R)
vle_trans := vle_trans (R := R)
vle_add := vle_add (R := R)
mul_vle_mul_left := mul_vle_mul_left (R := R)
vle_mul_cancel := vle_mul_cancel (R := R)
not_vle_one_zero := not_vle_one_zero (R := R)
instance : ValuativePreorder (WithPreorder R) where
vle_iff_le _ _ := Iff.rfl
variable (R) in
/-- The support of the valuation on `R`. -/
def supp : Ideal R where
carrier := { x | x ≤ᵥ 0 }
add_mem' ha hb := vle_add ha hb
zero_mem' := vle_refl _
smul_mem' x _ h := by simpa using mul_vle_mul_right h _
@[simp]
lemma supp_def (x : R) : x ∈ supp R ↔ x ≤ᵥ 0 := Iff.refl _
lemma supp_eq_valuation_supp : supp R = (valuation R).supp := by
ext
simpa using valuation_eq_zero_iff.symm
instance : (supp R).IsPrime := by
rw [supp_eq_valuation_supp]
infer_instance
section CommRing
variable {R : Type*} [CommRing R] [ValuativeRel R] {a b c d : R}
lemma vlt_of_vlt_of_vle (hab : a <ᵥ b) (hbc : b ≤ᵥ c) : a <ᵥ c :=
lt_of_lt_of_le (α := WithPreorder R) hab hbc
@[deprecated (since := "2025-12-20")] alias srel_of_srel_of_rel := vlt_of_vlt_of_vle
alias vlt.trans_vle := vlt_of_vlt_of_vle
@[deprecated (since := "2025-12-20")] alias SRel.trans_rel := vlt.trans_vle
lemma vlt_of_vle_of_vlt (hab : a ≤ᵥ b) (hbc : b <ᵥ c) : a <ᵥ c :=
lt_of_le_of_lt (α := WithPreorder R) hab hbc
@[deprecated (since := "2025-12-20")] alias srel_of_rel_of_srel := mul_vlt_mul_iff_left
alias vle.trans_vlt := vlt_of_vle_of_vlt
@[deprecated (since := "2025-12-20")] alias Rel.trans_srel := srel_of_rel_of_srel
lemma vlt.vle (hab : a <ᵥ b) : a ≤ᵥ b :=
le_of_lt (α := WithPreorder R) hab
@[deprecated (since := "2025-12-20")] alias SRel.rel := vlt.vle
lemma vlt.trans (hab : a <ᵥ b) (hbc : b <ᵥ c) : a <ᵥ c :=
hab.trans_vle hbc.vle
@[deprecated (since := "2025-12-20")] alias SRel.trans := vlt.trans
@[deprecated (since := "2026-01-06")] alias vle_mul_right_iff := mul_vle_mul_iff_left
@[deprecated (since := "2025-12-20")] alias rel_mul_right_iff := vle_mul_right_iff
@[deprecated (since := "2026-01-06")] alias vle_mul_left_iff := mul_vle_mul_iff_right
@[deprecated (since := "2025-12-20")] alias rel_mul_left_iff := mul_vle_mul_iff_right
@[deprecated (since := "2026-01-06")] alias vlt_mul_right_iff := mul_vlt_mul_iff_left
@[deprecated (since := "2025-12-20")] alias srel_mul_right_iff := mul_vlt_mul_iff_left
@[deprecated (since := "2025-12-20")] alias srel_mul_right := mul_vlt_mul_right
@[deprecated (since := "2026-01-06")] alias vlt_mul_left_iff := mul_vlt_mul_iff_right
@[deprecated (since := "2025-12-20")] alias srel_mul_left_iff := mul_vlt_mul_iff_right
@[deprecated (since := "2025-12-20")] alias srel_mul_left := mul_vlt_mul_right
lemma mul_vlt_mul_of_vlt_of_vle (hab : a <ᵥ b) (hcd : c ≤ᵥ d) (hd : 0 <ᵥ d) :
a * c <ᵥ b * d :=
(mul_vle_mul_right hcd _).trans_vlt (mul_vlt_mul_left hd hab)
@[deprecated (since := "2025-12-20")] alias mul_srel_mul_of_srel_of_rel := mul_vlt_mul_of_vlt_of_vle
lemma mul_vlt_mul_of_vle_of_vlt (hab : a ≤ᵥ b) (hcd : c <ᵥ d) (ha : 0 <ᵥ a) :
a * c <ᵥ b * d :=
(mul_vlt_mul_right ha hcd).trans_vle (mul_vle_mul_left hab _)
@[deprecated (since := "2025-12-20")] alias mul_srel_mul_of_rel_of_srel := mul_vlt_mul_of_vle_of_vlt
@[gcongr]
lemma mul_vlt_mul (hab : a <ᵥ b) (hcd : c <ᵥ d) : a * c <ᵥ b * d :=
(mul_vle_mul_right hcd.vle _).trans_vlt (mul_vlt_mul_left ((zero_vle c).trans_vlt hcd) hab)
@[deprecated (since := "2025-12-20")] alias mul_srel_mul := mul_vlt_mul
lemma pow_vle_pow (hab : a ≤ᵥ b) (n : ℕ) : a ^ n ≤ᵥ b ^ n := by
induction n with
| zero => simp
| succ _ hn => simp [pow_succ, mul_vle_mul hn hab]
@[deprecated (since := "2025-12-20")] alias pow_rel_pow := pow_vle_pow
lemma pow_vlt_pow (hab : a <ᵥ b) {n : ℕ} (hn : n ≠ 0) : a ^ n <ᵥ b ^ n := by
induction n using Nat.twoStepInduction with
| zero => contradiction
| one => simpa
| more _ _ => simp_all [pow_succ, mul_vlt_mul]
@[deprecated (since := "2025-12-20")] alias pow_srel_pow := pow_vlt_pow
lemma pow_vle_pow_of_vle_one (ha : a ≤ᵥ 1) {n m : ℕ} (hnm : n ≤ m) : a ^ m ≤ᵥ a ^ n := by
obtain ⟨m, rfl⟩ := exists_add_of_le hnm
simpa [pow_add] using mul_vle_mul_right (pow_vle_pow ha m) _
@[deprecated (since := "2025-12-20")] alias pow_rel_pow_of_rel_one := pow_vle_pow_of_vle_one
lemma pow_vle_pow_of_one_vle (ha : 1 ≤ᵥ a) {n m : ℕ} (hnm : n ≤ m) : a ^ n ≤ᵥ a ^ m := by
obtain ⟨m, rfl⟩ := exists_add_of_le hnm
simpa [pow_add] using mul_vle_mul_right (pow_vle_pow ha m) _
@[deprecated (since := "2025-12-20")] alias pow_rel_pow_of_one_rel := pow_vle_pow_of_one_vle
end CommRing
section Field
variable {K : Type*} [Field K] [ValuativeRel K] {a b c x : K}
@[simp]
lemma vle_zero_iff : a ≤ᵥ 0 ↔ a = 0 := by
rw [← supp_def, Ideal.eq_bot_of_prime (supp K), Ideal.mem_bot]
@[deprecated (since := "2025-12-20")] alias rel_zero_iff := vle_zero_iff
@[simp]
lemma zero_vlt_iff : 0 <ᵥ a ↔ a ≠ 0 := by
simp [vlt]
@[deprecated (since := "2025-12-20")] alias zero_srel_iff := zero_vlt_iff
@[simp]
lemma zero_veq_iff : a =ᵥ 0 ↔ a = 0 where
mp h := vle_zero_iff.1 h.1
mpr := by simp +contextual
@[simp]
lemma veq_zero_iff : 0 =ᵥ a ↔ 0 = a := by
rw [veq_comm, eq_comm, zero_veq_iff]
lemma vle_div_iff (hc : c ≠ 0) : a ≤ᵥ b / c ↔ a * c ≤ᵥ b := by
rw [← mul_vle_mul_iff_left (by simpa), div_mul_cancel₀ _ (by lia)]
@[deprecated (since := "2025-12-20")] alias rel_div_iff := vle_div_iff
lemma div_vle_iff (hc : c ≠ 0) : a / c ≤ᵥ b ↔ a ≤ᵥ b * c := by
rw [← mul_vle_mul_iff_left (by simpa), div_mul_cancel₀ _ (by lia)]
@[deprecated (since := "2025-12-20")] alias div_rel_iff := div_vle_iff
lemma one_vle_div_iff (hb : b ≠ 0) : 1 ≤ᵥ a / b ↔ b ≤ᵥ a := by
simp [vle_div_iff hb]
@[deprecated (since := "2025-12-20")] alias one_rel_div_iff := one_vle_div_iff
lemma div_vle_one_iff (hb : b ≠ 0) : a / b ≤ᵥ 1 ↔ a ≤ᵥ b := by
simp [div_vle_iff hb]
@[deprecated (since := "2025-12-20")] alias div_rel_one_iff := div_vle_one_iff
lemma one_vle_inv (hx : x ≠ 0) : 1 ≤ᵥ x⁻¹ ↔ x ≤ᵥ 1 := by
simpa using one_vle_div_iff (a := 1) hx
@[deprecated (since := "2025-12-20")] alias one_rel_inv := one_vle_inv
lemma inv_vle_one (hx : x ≠ 0) : x⁻¹ ≤ᵥ 1 ↔ 1 ≤ᵥ x := by
simpa using div_vle_one_iff (a := 1) hx
@[deprecated (since := "2025-12-20")] alias inv_rel_one := inv_vle_one
lemma inv_vlt_one (hx : x ≠ 0) : x⁻¹ <ᵥ 1 ↔ 1 <ᵥ x :=
(one_vle_inv hx).not
@[deprecated (since := "2025-12-20")] alias inv_srel_one := inv_vlt_one
lemma one_vlt_inv (hx : x ≠ 0) : 1 <ᵥ x⁻¹ ↔ x <ᵥ 1 :=
(inv_vle_one hx).not
@[deprecated (since := "2025-12-20")] alias one_srel_inv := one_vlt_inv
end Field
open NNReal in variable (R) in
/-- An auxiliary structure used to define `IsRankLeOne`. -/
structure RankLeOneStruct where
/-- The embedding of the value group-with-zero into the nonnegative reals. -/
emb : ValueGroupWithZero R →*₀ ℝ≥0
strictMono : StrictMono emb
variable (R) in
/-- We say that a ring with a valuative relation is of rank one if
there exists a strictly monotone embedding of the "canonical" value group-with-zero into
the nonnegative reals, and the image of this embedding contains some element different
from `0` and `1`. -/
class IsRankLeOne where
nonempty : Nonempty (RankLeOneStruct R)
variable (R) in
/-- We say that a valuative relation on a ring is *nontrivial* if the
value group-with-zero is nontrivial, meaning that it has an element
which is different from 0 and 1. -/
class IsNontrivial where
condition : ∃ γ : ValueGroupWithZero R, γ ≠ 0 ∧ γ ≠ 1
lemma IsNontrivial.exists_lt_one [IsNontrivial R] :
∃ γ : ValueGroupWithZero R, 0 < γ ∧ γ < 1 := by
obtain ⟨γ, h0, h1⟩ := IsNontrivial.condition (R := R)
obtain h1 | h1 := lt_or_lt_iff_ne.mpr h1
· exact ⟨γ, zero_lt_iff.mpr h0, h1⟩
· exact ⟨γ⁻¹, by simpa [zero_lt_iff], by simp [inv_lt_one_iff₀, h0, h1]⟩
lemma isNontrivial_iff_nontrivial_units :
IsNontrivial R ↔ Nontrivial (ValueGroupWithZero R)ˣ := by