Skip to content

Commit 7edc8dd

Browse files
committed
feat: more lemmas on ArchimedeanClass.stdPart (#33343)
Upstreamed from the CGT repo.
1 parent 57bd265 commit 7edc8dd

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

Mathlib/Algebra/Order/Ring/StandardPart.lean

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -141,10 +141,7 @@ namespace FiniteResidueField
141141
noncomputable instance : Field (FiniteResidueField K) :=
142142
inferInstanceAs (Field (IsLocalRing.ResidueField _))
143143

144-
#adaptation_note /-- Removed `private':
145-
This had been private, but while disabling `set_option backward.privateInPublic` as a global option
146-
we have made it public again. -/
147-
theorem ordConnected_preimage_mk' : ∀ x, Set.OrdConnected <| Quotient.mk
144+
private theorem ordConnected_preimage_mk' : ∀ x, Set.OrdConnected <| Quotient.mk
148145
(Submodule.quotientRel (IsLocalRing.maximalIdeal (FiniteElement K))) ⁻¹' {x} := by
149146
refine fun x ↦ ⟨?_⟩
150147
rintro x rfl y hy z ⟨hxz, hzy⟩
@@ -154,7 +151,7 @@ theorem ordConnected_preimage_mk' : ∀ x, Set.OrdConnected <| Quotient.mk
154151
apply hy.trans_le (mk_antitoneOn _ _ _) <;> simpa
155152

156153
noncomputable instance : LinearOrder (FiniteResidueField K) :=
157-
@Quotient.instLinearOrder _ _ _ ordConnected_preimage_mk' (Classical.decRel _)
154+
@Quotient.instLinearOrder _ _ _ (by exact ordConnected_preimage_mk') (Classical.decRel _)
158155

159156
/-- The quotient map from finite elements on the field to the associated residue field. -/
160157
def mk : FiniteElement K →+*o FiniteResidueField K where
@@ -405,6 +402,15 @@ theorem ofArchimedean_stdPart (f : ℝ →+*o K) (hx : 0 ≤ mk x) :
405402
rw [stdPart, dif_pos hx, ← OrderRingHom.comp_apply, ← OrderRingHom.comp_assoc,
406403
OrderRingHom.comp_apply, OrderRingHom.apply_eq_self]
407404

405+
theorem stdPart_nonneg {x : K} (h : 0 ≤ x) : 0 ≤ stdPart x := by
406+
obtain hx | hx := eq_or_ne (ArchimedeanClass.mk x) 0
407+
· rw [stdPart, dif_pos hx.ge]
408+
exact map_nonneg _ h
409+
· rw [stdPart_of_mk_ne_zero hx]
410+
411+
theorem stdPart_nonpos {x : K} (h : x ≤ 0) : stdPart x ≤ 0 := by
412+
simpa using stdPart_nonneg (neg_nonneg.2 h)
413+
408414
/-- The standard part of `x` is the unique real `r` such that `x - r` is infinitesimal. -/
409415
theorem mk_sub_pos_iff (f : ℝ →+*o K) {r : ℝ} (hx : 0 ≤ mk x) :
410416
0 < mk (x - f r) ↔ stdPart x = r := by

0 commit comments

Comments
 (0)