Skip to content
This repository was archived by the owner on Jul 24, 2024. It is now read-only.

Commit 210657c

Browse files
committed
refactor(order/well_founded): ditch well_founded_iff_has_min' and well_founded_iff_has_max' (#15071)
The predicate `x ≤ y → y = x` is no more convenient than `¬ x < y`. For this reason, we ditch `well_founded.well_founded_iff_has_min'` and `well_founded.well_founded_iff_has_max'` in favor of `well_founded.well_founded_iff_has_min` (or in some cases, just `well_founded.has_min`. We also remove the misplaced lemma `well_founded.eq_iff_not_lt_of_le`, and we golf the theorems that used the removed theorems. The lemma `well_founded.well_founded_iff_has_min` has a misleading name when applied on `well_founded (>)`, and mildly screws over dot notation and rewriting by virtue of using `>`, but a future refactor will fix this.
1 parent 02e095b commit 210657c

9 files changed

Lines changed: 45 additions & 80 deletions

File tree

src/algebra/lie/engel.lean

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -259,14 +259,11 @@ begin
259259
exact nontrivial_max_triv_of_is_nilpotent R K (L' ⧸ K.to_lie_submodule), },
260260
haveI _i5 : is_noetherian R L' :=
261261
is_noetherian_of_surjective L _ (linear_map.range_range_restrict (to_endomorphism R L M)),
262-
obtain ⟨K, hK₁, hK₂⟩ :=
263-
well_founded.well_founded_iff_has_max'.mp (lie_subalgebra.well_founded_of_noetherian R L') s hs,
262+
obtain ⟨K, hK₁, hK₂⟩ := (lie_subalgebra.well_founded_of_noetherian R L').has_min s hs,
264263
have hK₃ : K = ⊤,
265264
{ by_contra contra,
266265
obtain ⟨K', hK'₁, hK'₂⟩ := this K hK₁ contra,
267-
specialize hK₂ K' hK'₁ (le_of_lt hK'₂),
268-
replace hK'₂ := (ne_of_lt hK'₂).symm,
269-
contradiction, },
266+
exact hK₂ K' hK'₁ hK'₂, },
270267
exact hK₃ ▸ hK₁,
271268
end
272269

src/linear_algebra/free_module/pid.lean

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -59,21 +59,21 @@ variables {ι : Type*} (b : basis ι R M)
5959
open submodule.is_principal submodule
6060

6161
lemma eq_bot_of_generator_maximal_map_eq_zero (b : basis ι R M) {N : submodule R M}
62-
{ϕ : M →ₗ[R] R} (hϕ : ∀ (ψ : M →ₗ[R] R), N.map ϕ N.map ψ → N.map ψ = N.map ϕ)
62+
{ϕ : M →ₗ[R] R} (hϕ : ∀ (ψ : M →ₗ[R] R), ¬ N.map ϕ < N.map ψ)
6363
[(N.map ϕ).is_principal] (hgen : generator (N.map ϕ) = (0 : R)) : N = ⊥ :=
6464
begin
6565
rw submodule.eq_bot_iff,
6666
intros x hx,
6767
refine b.ext_elem (λ i, _),
6868
rw (eq_bot_iff_generator_eq_zero _).mpr hgen at hϕ,
6969
rw [linear_equiv.map_zero, finsupp.zero_apply],
70-
exact (submodule.eq_bot_iff _).mp (hϕ ((finsupp.lapply i) ∘ₗ ↑b.repr) bot_le) _ ⟨x, hx, rfl⟩
70+
exact (submodule.eq_bot_iff _).mp (not_bot_lt_iff.1 $ hϕ ((finsupp.lapply i) ∘ₗ ↑b.repr)) _
71+
⟨x, hx, rfl⟩
7172
end
7273

7374
lemma eq_bot_of_generator_maximal_submodule_image_eq_zero {N O : submodule R M} (b : basis ι R O)
7475
(hNO : N ≤ O)
75-
{ϕ : O →ₗ[R] R} (hϕ : ∀ (ψ : O →ₗ[R] R), ϕ.submodule_image N ≤ ψ.submodule_image N →
76-
ψ.submodule_image N = ϕ.submodule_image N)
76+
{ϕ : O →ₗ[R] R} (hϕ : ∀ (ψ : O →ₗ[R] R), ¬ ϕ.submodule_image N < ψ.submodule_image N)
7777
[(ϕ.submodule_image N).is_principal] (hgen : generator (ϕ.submodule_image N) = 0) :
7878
N = ⊥ :=
7979
begin
@@ -82,7 +82,7 @@ begin
8282
refine congr_arg coe (show (⟨x, hNO hx⟩ : O) = 0, from b.ext_elem (λ i, _)),
8383
rw (eq_bot_iff_generator_eq_zero _).mpr hgen at hϕ,
8484
rw [linear_equiv.map_zero, finsupp.zero_apply],
85-
refine (submodule.eq_bot_iff _).mp (hϕ ((finsupp.lapply i) ∘ₗ ↑b.repr) bot_le) _ _,
85+
refine (submodule.eq_bot_iff _).mp (not_bot_lt_iff.1 $ hϕ ((finsupp.lapply i) ∘ₗ ↑b.repr)) _ _,
8686
exact (linear_map.mem_submodule_image_of_le hNO).mpr ⟨x, hx, rfl⟩
8787
end
8888

@@ -115,8 +115,7 @@ variables {M : Type*} [add_comm_group M] [module R M] {b : ι → M}
115115
open submodule.is_principal
116116

117117
lemma generator_maximal_submodule_image_dvd {N O : submodule R M} (hNO : N ≤ O)
118-
{ϕ : O →ₗ[R] R} (hϕ : ∀ (ψ : O →ₗ[R] R), ϕ.submodule_image N ≤ ψ.submodule_image N →
119-
ψ.submodule_image N = ϕ.submodule_image N)
118+
{ϕ : O →ₗ[R] R} (hϕ : ∀ (ψ : O →ₗ[R] R), ¬ ϕ.submodule_image N < ψ.submodule_image N)
120119
[(ϕ.submodule_image N).is_principal]
121120
(y : M) (yN : y ∈ N) (ϕy_eq : ϕ ⟨y, hNO yN⟩ = generator (ϕ.submodule_image N))
122121
(ψ : O →ₗ[R] R) : generator (ϕ.submodule_image N) ∣ ψ ⟨y, hNO yN⟩ :=
@@ -144,7 +143,7 @@ begin
144143
refine le_antisymm (this.trans (le_of_eq _))
145144
(ideal.span_singleton_le_span_singleton.mpr d_dvd_left),
146145
rw span_singleton_generator,
147-
refine hϕ ψ' (le_trans _ this),
146+
apply (le_trans _ this).eq_of_not_gt (hϕ ψ'),
148147
rw [← span_singleton_generator (ϕ.submodule_image N)],
149148
exact ideal.span_singleton_le_span_singleton.mpr d_dvd_left,
150149
{ exact subset_span (mem_insert _ _) }
@@ -175,8 +174,7 @@ lemma submodule.basis_of_pid_aux [finite ι] {O : Type*} [add_comm_group O] [mod
175174
begin
176175
-- Let `ϕ` be a maximal projection of `M` onto `R`, in the sense that there is
177176
-- no `ψ` whose image of `N` is larger than `ϕ`'s image of `N`.
178-
have : ∃ ϕ : M →ₗ[R] R, ∀ (ψ : M →ₗ[R] R),
179-
ϕ.submodule_image N ≤ ψ.submodule_image N → ψ.submodule_image N = ϕ.submodule_image N,
177+
have : ∃ ϕ : M →ₗ[R] R, ∀ (ψ : M →ₗ[R] R), ¬ ϕ.submodule_image N < ψ.submodule_image N,
180178
{ obtain ⟨P, P_eq, P_max⟩ := set_has_maximal_iff_noetherian.mpr
181179
(infer_instance : is_noetherian R R) _
182180
(show (set.range (λ ψ : M →ₗ[R] R, ψ.submodule_image N)).nonempty,

src/order/basic.lean

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -227,6 +227,9 @@ le_iff_lt_or_eq.trans or.comm
227227
lemma lt_iff_le_and_ne [partial_order α] {a b : α} : a < b ↔ a ≤ b ∧ a ≠ b :=
228228
⟨λ h, ⟨le_of_lt h, ne_of_lt h⟩, λ ⟨h1, h2⟩, h1.lt_of_ne h2⟩
229229

230+
lemma eq_iff_not_lt_of_le {α} [partial_order α] {x y : α} : x ≤ y → y = x ↔ ¬ x < y :=
231+
by rw [lt_iff_le_and_ne, not_and, not_not, eq_comm]
232+
230233
-- See Note [decidable namespace]
231234
protected lemma decidable.eq_iff_le_not_lt [partial_order α] [@decidable_rel α (≤)]
232235
{a b : α} : a = b ↔ a ≤ b ∧ ¬ a < b :=

src/order/compactly_generated.lean

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -190,18 +190,16 @@ end
190190

191191
lemma well_founded.is_Sup_finite_compact (h : well_founded ((>) : α → α → Prop)) :
192192
is_Sup_finite_compact α :=
193-
begin
194-
intros s,
195-
let p : set α := { x | ∃ (t : finset α), ↑t ⊆ s ∧ t.sup id = x },
196-
have hp : p.nonempty, { use [⊥, ∅], simp, },
197-
obtain ⟨m, ⟨t, ⟨ht₁, ht₂⟩⟩, hm⟩ := well_founded.well_founded_iff_has_max'.mp h p hp,
198-
use t, simp only [ht₁, ht₂, true_and], apply le_antisymm,
199-
{ apply Sup_le, intros y hy, classical,
200-
have hy' : (insert y t).sup id ∈ p,
201-
{ use insert y t, simp, rw set.insert_subset, exact ⟨hy, ht₁⟩, },
202-
have hm' : m ≤ (insert y t).sup id, { rw ← ht₂, exact finset.sup_mono (t.subset_insert y), },
203-
rw ← hm _ hy' hm', simp, },
204-
{ rw [← ht₂, finset.sup_id_eq_Sup], exact Sup_le_Sup ht₁, },
193+
λ s, begin
194+
obtain ⟨m, ⟨t, ⟨ht₁, rfl⟩⟩, hm⟩ := well_founded.well_founded_iff_has_min.mp h
195+
{x | ∃ t : finset α, ↑t ⊆ s ∧ t.sup id = x} ⟨⊥, ∅, by simp⟩,
196+
refine ⟨t, ht₁, (Sup_le (λ y hy, _)).antisymm _⟩,
197+
{ classical,
198+
rw eq_of_le_of_not_lt (finset.sup_mono (t.subset_insert y))
199+
(hm _ ⟨insert y t, by simp [set.insert_subset, hy, ht₁]⟩),
200+
simp },
201+
{ rw finset.sup_id_eq_Sup,
202+
exact Sup_le_Sup ht₁ },
205203
end
206204

207205
lemma is_Sup_finite_compact.is_sup_closed_compact (h : is_Sup_finite_compact α) :

src/order/order_iso_nat.lean

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -226,17 +226,9 @@ a (monotonic_sequence_limit_index a)
226226
lemma well_founded.supr_eq_monotonic_sequence_limit [complete_lattice α]
227227
(h : well_founded ((>) : α → α → Prop)) (a : ℕ →o α) : supr a = monotonic_sequence_limit a :=
228228
begin
229-
suffices : (⨆ (m : ℕ), a m) ≤ monotonic_sequence_limit a,
230-
{ exact le_antisymm this (le_supr a _), },
231-
apply supr_le,
232-
intros m,
233-
by_cases hm : m ≤ monotonic_sequence_limit_index a,
234-
{ exact a.monotone hm, },
235-
{ replace hm := le_of_not_le hm,
236-
let S := { n | ∀ m, n ≤ m → a n = a m },
237-
have hInf : Inf S ∈ S,
238-
{ refine nat.Inf_mem _, rw well_founded.monotone_chain_condition at h, exact h a, },
239-
change Inf S ≤ m at hm,
240-
change a m ≤ a (Inf S),
241-
rw hInf m hm, },
229+
apply (supr_le (λ m, _)).antisymm (le_supr a _),
230+
cases le_or_lt m (monotonic_sequence_limit_index a) with hm hm,
231+
{ exact a.monotone hm },
232+
{ cases well_founded.monotone_chain_condition'.1 h a with n hn,
233+
exact (nat.Inf_mem ⟨n, λ k hk, (a.mono hk).eq_of_not_lt (hn k hk)⟩ m hm.le).ge }
242234
end

src/order/well_founded.lean

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -72,26 +72,6 @@ begin
7272
exact hm' y hy' hy
7373
end
7474

75-
lemma eq_iff_not_lt_of_le {α} [partial_order α] {x y : α} : x ≤ y → y = x ↔ ¬ x < y :=
76-
begin
77-
split,
78-
{ intros xle nge,
79-
cases le_not_le_of_lt nge,
80-
rw xle left at nge,
81-
exact lt_irrefl x nge },
82-
{ intros ngt xle,
83-
contrapose! ngt,
84-
exact lt_of_le_of_ne xle (ne.symm ngt) }
85-
end
86-
87-
theorem well_founded_iff_has_max' [partial_order α] : (well_founded ((>) : α → α → Prop) ↔
88-
∀ (p : set α), p.nonempty → ∃ m ∈ p, ∀ x ∈ p, m ≤ x → x = m) :=
89-
by simp only [eq_iff_not_lt_of_le, well_founded_iff_has_min]
90-
91-
theorem well_founded_iff_has_min' [partial_order α] : (well_founded (has_lt.lt : α → α → Prop)) ↔
92-
∀ (p : set α), p.nonempty → ∃ m ∈ p, ∀ x ∈ p, x ≤ m → x = m :=
93-
@well_founded_iff_has_max' αᵒᵈ _
94-
9575
open set
9676
/-- The supremum of a bounded, well-founded order -/
9777
protected noncomputable def sup {r : α → α → Prop} (wf : well_founded r) (s : set α)

src/ring_theory/artinian.lean

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -181,12 +181,11 @@ end
181181
/-- A module is Artinian iff every nonempty set of submodules has a minimal submodule among them.
182182
-/
183183
theorem set_has_minimal_iff_artinian :
184-
(∀ a : set $ submodule R M, a.nonempty → ∃ M' ∈ a, ∀ I ∈ a, I ≤ M' → I = M') ↔
185-
is_artinian R M :=
186-
by rw [is_artinian_iff_well_founded, well_founded.well_founded_iff_has_min']
184+
(∀ a : set $ submodule R M, a.nonempty → ∃ M' ∈ a, ∀ I ∈ a, ¬ I < M') ↔ is_artinian R M :=
185+
by rw [is_artinian_iff_well_founded, well_founded.well_founded_iff_has_min]
187186

188187
theorem is_artinian.set_has_minimal [is_artinian R M] (a : set $ submodule R M) (ha : a.nonempty) :
189-
∃ M' ∈ a, ∀ I ∈ a, I ≤ M' → I = M' :=
188+
∃ M' ∈ a, ∀ I ∈ a, ¬ I < M' :=
190189
set_has_minimal_iff_artinian.mpr ‹_› a ha
191190

192191
/-- A module is Artinian iff every decreasing chain of submodules stabilizes. -/
@@ -414,19 +413,19 @@ begin
414413
simpa only [this, top_smul, ideal.zero_eq_bot] using hJ },
415414
by_contradiction hJ, change J ≠ ⊤ at hJ,
416415
rcases is_artinian.set_has_minimal {J' : ideal R | J < J'} ⟨⊤, hJ.lt_top⟩
417-
with ⟨J', hJJ' : J < J', hJ' : ∀ I, J < I → I ≤ J' → I = J'⟩,
416+
with ⟨J', hJJ' : J < J', hJ' : ∀ I, J < I → ¬ I < J'⟩,
418417
rcases set_like.exists_of_lt hJJ' with ⟨x, hxJ', hxJ⟩,
419418
obtain rfl : J ⊔ ideal.span {x} = J',
420-
{ refine hJ' (J ⊔ ideal.span {x}) _ _,
419+
{ apply eq_of_le_of_not_lt _ (hJ' (J ⊔ ideal.span {x}) _),
420+
{ exact (sup_le hJJ'.le (span_le.2 (singleton_subset_iff.2 hxJ'))) },
421421
{ rw set_like.lt_iff_le_and_exists,
422-
exact ⟨le_sup_left, ⟨x, mem_sup_right (mem_span_singleton_self x), hxJ⟩⟩ },
423-
{ exact (sup_le hJJ'.le (span_le.2 (singleton_subset_iff.2 hxJ'))) } },
422+
exact ⟨le_sup_left, ⟨x, mem_sup_right (mem_span_singleton_self x), hxJ⟩⟩ } },
424423
have : J ⊔ Jac • ideal.span {x} ≤ J ⊔ ideal.span {x},
425424
from sup_le_sup_left (smul_le.2 (λ _ _ _, submodule.smul_mem _ _)) _,
426425
have : Jac * ideal.span {x} ≤ J, --Need version 4 of Nakayamas lemma on Stacks
427426
{ classical, by_contradiction H,
428427
refine H (smul_sup_le_of_le_smul_of_le_jacobson_bot
429-
(fg_span_singleton _) le_rfl (hJ' _ _ this).ge),
428+
(fg_span_singleton _) le_rfl (this.eq_of_not_lt (hJ' _ _)).ge),
430429
exact lt_of_le_of_ne le_sup_left (λ h, H $ h.symm ▸ le_sup_right) },
431430
have : ideal.span {x} * Jac ^ (n + 1) ≤ ⊥,
432431
calc ideal.span {x} * Jac ^ (n + 1) = ideal.span {x} * Jac * Jac ^ n :

src/ring_theory/ideal/associated_prime.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ begin
9595
rw [smul_comm, hc, smul_zero] },
9696
have H₂ : (submodule.span R {a • y}).annihilator ≠ ⊤,
9797
{ rwa [ne.def, submodule.annihilator_eq_top_iff, submodule.span_singleton_eq_bot] },
98-
rwa [h₃ (R ∙ a • y).annihilator ⟨l.trans H₁, H₂, _, rfl⟩ H₁,
98+
rwa [H₁.eq_of_not_lt (h₃ (R ∙ a • y).annihilator ⟨l.trans H₁, H₂, _, rfl⟩),
9999
submodule.mem_annihilator_span_singleton, smul_comm, smul_smul]
100100
end
101101

src/ring_theory/noetherian.lean

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -253,20 +253,20 @@ begin
253253
{ intro H,
254254
constructor,
255255
intro N,
256-
obtain ⟨⟨N₀, h₁⟩, e : N₀ ≤ N, h₂⟩ := well_founded.well_founded_iff_has_max'.mp
256+
obtain ⟨⟨N₀, h₁⟩, e : N₀ ≤ N, h₂⟩ := well_founded.has_min
257257
H { N' : α | N'.1 ≤ N } ⟨⟨⊥, submodule.fg_bot⟩, bot_le⟩,
258258
convert h₁,
259259
refine (e.antisymm _).symm,
260260
by_contra h₃,
261261
obtain ⟨x, hx₁ : x ∈ N, hx₂ : x ∉ N₀⟩ := set.not_subset.mp h₃,
262262
apply hx₂,
263-
have := h₂ ⟨(R ∙ x) ⊔ N₀, _⟩ _ _,
263+
have := eq_of_le_of_not_lt _ (h₂ ⟨(R ∙ x) ⊔ N₀, _⟩ _),
264264
{ injection this with eq,
265-
rw eq,
265+
rw eq,
266266
exact (le_sup_left : (R ∙ x) ≤ (R ∙ x) ⊔ N₀) (submodule.mem_span_singleton_self _) },
267267
{ exact submodule.fg.sup ⟨{x}, by rw [finset.coe_singleton]⟩ h₁ },
268-
{ exact sup_le ((submodule.span_singleton_le_iff_mem _ _).mpr hx₁) e },
269-
{ show N₀ ≤ (R ∙ x) ⊔ N₀, from le_sup_right } }
268+
{ show N₀ ≤ (R ∙ x) ⊔ N₀, from le_sup_right },
269+
{ exact sup_le ((submodule.span_singleton_le_iff_mem _ _).mpr hx₁) e } }
270270
end
271271

272272
variables (R M)
@@ -280,14 +280,12 @@ variables {R M}
280280
/-- A module is Noetherian iff every nonempty set of submodules has a maximal submodule among them.
281281
-/
282282
theorem set_has_maximal_iff_noetherian :
283-
(∀ a : set $ submodule R M, a.nonempty → ∃ M' ∈ a, ∀ I ∈ a, M' ≤ I → I = M') ↔
284-
is_noetherian R M :=
285-
by rw [is_noetherian_iff_well_founded, well_founded.well_founded_iff_has_max']
283+
(∀ a : set $ submodule R M, a.nonempty → ∃ M' ∈ a, ∀ I ∈ a, ¬ M' < I) ↔ is_noetherian R M :=
284+
by rw [is_noetherian_iff_well_founded, well_founded.well_founded_iff_has_min]
286285

287286
/-- A module is Noetherian iff every increasing chain of submodules stabilizes. -/
288287
theorem monotone_stabilizes_iff_noetherian :
289-
(∀ (f : ℕ →o submodule R M), ∃ n, ∀ m, n ≤ m → f n = f m)
290-
↔ is_noetherian R M :=
288+
(∀ (f : ℕ →o submodule R M), ∃ n, ∀ m, n ≤ m → f n = f m) ↔ is_noetherian R M :=
291289
by rw [is_noetherian_iff_well_founded, well_founded.monotone_chain_condition]
292290

293291
/-- If `∀ I > J, P I` implies `P J`, then `P` holds for all submodules. -/

0 commit comments

Comments
 (0)