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

Commit fef5124

Browse files
committed
feat(order/order_iso_nat): generalize well_founded.monotone_chain_condition to preorders (#15073)
We also clean up the spacing throughout the file.
1 parent 119e166 commit fef5124

File tree

3 files changed

+38
-37
lines changed

3 files changed

+38
-37
lines changed

src/order/order_iso_nat.lean

Lines changed: 35 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import data.nat.lattice
77
import logic.denumerable
88
import logic.function.iterate
99
import order.hom.basic
10+
import tactic.congrm
1011

1112
/-!
1213
# Relation embeddings from the naturals
@@ -21,23 +22,24 @@ defines the limit value of an eventually-constant sequence.
2122
* `monotonic_sequence_limit_index`: The index of the first occurence of `monotonic_sequence_limit`
2223
in the sequence.
2324
-/
25+
26+
variable {α : Type*}
27+
2428
namespace rel_embedding
2529

26-
variables {α : Type*} {r : α → α → Prop} [is_strict_order α r]
30+
variables {r : α → α → Prop} [is_strict_order α r]
2731

2832
/-- If `f` is a strictly `r`-increasing sequence, then this returns `f` as an order embedding. -/
2933
def nat_lt (f : ℕ → α) (H : ∀ n : ℕ, r (f n) (f (n + 1))) :
3034
((<) : ℕ → ℕ → Prop) ↪r r :=
3135
of_monotone f $ nat.rel_of_forall_rel_succ_of_lt r H
3236

3337
@[simp]
34-
lemma nat_lt_apply {f : ℕ → α} {H : ∀ n : ℕ, r (f n) (f (n + 1))} {n : ℕ} :
35-
nat_lt f H n = f n :=
38+
lemma nat_lt_apply {f : ℕ → α} {H : ∀ n : ℕ, r (f n) (f (n + 1))} {n : ℕ} : nat_lt f H n = f n :=
3639
rfl
3740

3841
/-- If `f` is a strictly `r`-decreasing sequence, then this returns `f` as an order embedding. -/
39-
def nat_gt (f : ℕ → α) (H : ∀ n : ℕ, r (f (n + 1)) (f n)) :
40-
((>) : ℕ → ℕ → Prop) ↪r r :=
42+
def nat_gt (f : ℕ → α) (H : ∀ n : ℕ, r (f (n + 1)) (f n)) : ((>) : ℕ → ℕ → Prop) ↪r r :=
4143
by haveI := is_strict_order.swap r; exact rel_embedding.swap (nat_lt f H)
4244

4345
theorem well_founded_iff_no_descending_seq :
@@ -70,8 +72,7 @@ def order_embedding_of_set : ℕ ↪o ℕ :=
7072

7173
/-- `nat.subtype.of_nat` as an order isomorphism between `ℕ` and an infinite decidable subset.
7274
See also `nat.nth` for a version where the subset may be finite. -/
73-
noncomputable def subtype.order_iso_of_nat :
74-
ℕ ≃o s :=
75+
noncomputable def subtype.order_iso_of_nat : ℕ ≃o s :=
7576
rel_iso.of_surjective (rel_embedding.order_embedding_of_lt_embedding
7677
(rel_embedding.nat_lt (nat.subtype.of_nat s) (λ n, nat.subtype.lt_succ_self _)))
7778
nat.subtype.of_nat_surjective
@@ -84,17 +85,15 @@ lemma coe_order_embedding_of_set : ⇑(order_embedding_of_set s) = coe ∘ subty
8485
lemma order_embedding_of_set_apply {n : ℕ} : order_embedding_of_set s n = subtype.of_nat s n := rfl
8586

8687
@[simp]
87-
lemma subtype.order_iso_of_nat_apply {n : ℕ} :
88-
subtype.order_iso_of_nat s n = subtype.of_nat s n :=
89-
by { simp [subtype.order_iso_of_nat] }
88+
lemma subtype.order_iso_of_nat_apply {n : ℕ} : subtype.order_iso_of_nat s n = subtype.of_nat s n :=
89+
by simp [subtype.order_iso_of_nat]
9090

9191
variable (s)
9292

9393
lemma order_embedding_of_set_range : set.range (nat.order_embedding_of_set s) = s :=
9494
subtype.coe_comp_of_nat_range
9595

96-
theorem exists_subseq_of_forall_mem_union {α : Type*} {s t : set α} (e : ℕ → α)
97-
(he : ∀ n, e n ∈ s ∪ t) :
96+
theorem exists_subseq_of_forall_mem_union {s t : set α} (e : ℕ → α) (he : ∀ n, e n ∈ s ∪ t) :
9897
∃ g : ℕ ↪o ℕ, (∀ n, e (g n) ∈ s) ∨ (∀ n, e (g n) ∈ t) :=
9998
begin
10099
classical,
@@ -108,7 +107,7 @@ end
108107

109108
end nat
110109

111-
theorem exists_increasing_or_nonincreasing_subseq' {α : Type*} (r : α → α → Prop) (f : ℕ → α) :
110+
theorem exists_increasing_or_nonincreasing_subseq' (r : α → α → Prop) (f : ℕ → α) :
112111
∃ (g : ℕ ↪o ℕ), (∀ n : ℕ, r (f (g n)) (f (g (n + 1)))) ∨
113112
(∀ m n : ℕ, m < n → ¬ r (f (g m)) (f (g n))) :=
114113
begin
@@ -143,8 +142,7 @@ end
143142

144143
/-- This is the infinitary Erdős–Szekeres theorem, and an important lemma in the usual proof of
145144
Bolzano-Weierstrass for `ℝ`. -/
146-
theorem exists_increasing_or_nonincreasing_subseq
147-
{α : Type*} (r : α → α → Prop) [is_trans α r] (f : ℕ → α) :
145+
theorem exists_increasing_or_nonincreasing_subseq (r : α → α → Prop) [is_trans α r] (f : ℕ → α) :
148146
∃ (g : ℕ ↪o ℕ), (∀ m n : ℕ, m < n → r (f (g m)) (f (g n))) ∨
149147
(∀ m n : ℕ, m < n → ¬ r (f (g m)) (f (g n))) :=
150148
begin
@@ -158,36 +156,41 @@ begin
158156
{ exact ⟨g, or.intro_right _ hnr⟩ }
159157
end
160158

161-
/-- The "monotone chain condition" below is sometimes a convenient form of well foundedness. -/
162-
lemma well_founded.monotone_chain_condition (α : Type*) [partial_order α] :
163-
well_founded ((>) : α → α → Prop) ↔ ∀ (a : ℕ →o α), ∃ n, ∀ m, n ≤ m → a n = a m :=
159+
lemma well_founded.monotone_chain_condition' [preorder α] :
160+
well_founded ((>) : α → α → Prop) ↔ ∀ (a : ℕ →o α), ∃ n, ∀ m, n ≤ m → ¬ a n < a m :=
164161
begin
165-
split; intros h,
166-
{ rw well_founded.well_founded_iff_has_max' at h,
167-
intros a, have hne : (set.range a).nonempty, { use a 0, simp, },
168-
obtain ⟨x, ⟨n, hn⟩, range_bounded⟩ := h _ hne,
169-
use n, intros m hm, rw ← hn at range_bounded, symmetry,
170-
apply range_bounded (a m) (set.mem_range_self _) (a.monotone hm), },
171-
{ rw rel_embedding.well_founded_iff_no_descending_seq, refine ⟨λ a, _⟩,
162+
refine ⟨λ h a, _, λ h, _⟩,
163+
{ have hne : (set.range a).nonempty := ⟨a 0, by simp⟩,
164+
obtain ⟨x, ⟨n, rfl⟩, H⟩ := h.has_min _ hne,
165+
exact ⟨n, λ m hm, H _ (set.mem_range_self _)⟩ },
166+
{ refine rel_embedding.well_founded_iff_no_descending_seq.2 ⟨λ a, _⟩,
172167
obtain ⟨n, hn⟩ := h (a.swap : ((<) : ℕ → ℕ → Prop) →r ((<) : α → α → Prop)).to_order_hom,
173-
exact n.succ_ne_self.symm (rel_embedding.to_order_hom_injective _ (hn _ n.le_succ)), },
168+
exact hn n.succ n.lt_succ_self.le ((rel_embedding.map_rel_iff _).2 n.lt_succ_self) },
169+
end
170+
171+
/-- The "monotone chain condition" below is sometimes a convenient form of well foundedness. -/
172+
lemma well_founded.monotone_chain_condition [partial_order α] :
173+
well_founded ((>) : α → α → Prop) ↔ ∀ (a : ℕ →o α), ∃ n, ∀ m, n ≤ m → a n = a m :=
174+
well_founded.monotone_chain_condition'.trans $ begin
175+
congrm ∀ a, ∃ n, ∀ m (h : n ≤ m), (_ : Prop),
176+
rw lt_iff_le_and_ne,
177+
simp [a.mono h]
174178
end
175179

176180
/-- Given an eventually-constant monotone sequence `a₀ ≤ a₁ ≤ a₂ ≤ ...` in a partially-ordered
177181
type, `monotonic_sequence_limit_index a` is the least natural number `n` for which `aₙ` reaches the
178182
constant value. For sequences that are not eventually constant, `monotonic_sequence_limit_index a`
179183
is defined, but is a junk value. -/
180-
noncomputable def monotonic_sequence_limit_index {α : Type*} [preorder α] (a : ℕ →o α) : ℕ :=
181-
Inf { n | ∀ m, n ≤ m → a n = a m }
184+
noncomputable def monotonic_sequence_limit_index [preorder α] (a : ℕ →o α) : ℕ :=
185+
Inf {n | ∀ m, n ≤ m → a n = a m}
182186

183187
/-- The constant value of an eventually-constant monotone sequence `a₀ ≤ a₁ ≤ a₂ ≤ ...` in a
184188
partially-ordered type. -/
185-
noncomputable def monotonic_sequence_limit {α : Type*} [preorder α] (a : ℕ →o α) :=
189+
noncomputable def monotonic_sequence_limit [preorder α] (a : ℕ →o α) :=
186190
a (monotonic_sequence_limit_index a)
187191

188-
lemma well_founded.supr_eq_monotonic_sequence_limit {α : Type*} [complete_lattice α]
189-
(h : well_founded ((>) : α → α → Prop)) (a : ℕ →o α) :
190-
(⨆ m, a m) = monotonic_sequence_limit a :=
192+
lemma well_founded.supr_eq_monotonic_sequence_limit [complete_lattice α]
193+
(h : well_founded ((>) : α → α → Prop)) (a : ℕ →o α) : supr a = monotonic_sequence_limit a :=
191194
begin
192195
suffices : (⨆ (m : ℕ), a m) ≤ monotonic_sequence_limit a,
193196
{ exact le_antisymm this (le_supr a _), },

src/order/well_founded_set.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ begin
7171
intros t ht,
7272
by_cases hst : (s ∩ t).nonempty,
7373
{ rw ← subtype.preimage_coe_nonempty at hst,
74-
rcases well_founded.well_founded_iff_has_min.1 h (coe ⁻¹' t) hst with ⟨⟨m, ms⟩, mt, hm⟩,
74+
rcases h.has_min (coe ⁻¹' t) hst with ⟨⟨m, ms⟩, mt, hm⟩,
7575
exact ⟨m, mt, λ x xt ⟨xm, xs, ms⟩, hm ⟨x, xs⟩ xt xm⟩ },
7676
{ rcases ht with ⟨m, mt⟩,
7777
exact ⟨m, mt, λ x xt ⟨xm, xs, ms⟩, hst ⟨m, ⟨ms, mt⟩⟩⟩ }

src/ring_theory/artinian.lean

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -198,10 +198,8 @@ set_has_minimal_iff_artinian.mpr ‹_› a ha
198198

199199
/-- A module is Artinian iff every decreasing chain of submodules stabilizes. -/
200200
theorem monotone_stabilizes_iff_artinian :
201-
(∀ (f : ℕ →o (submodule R M)ᵒᵈ), ∃ n, ∀ m, n ≤ m → f n = f m)
202-
↔ is_artinian R M :=
203-
by rw [is_artinian_iff_well_founded];
204-
exact (well_founded.monotone_chain_condition (submodule R M)ᵒᵈ).symm
201+
(∀ (f : ℕ →o (submodule R M)ᵒᵈ), ∃ n, ∀ m, n ≤ m → f n = f m) ↔ is_artinian R M :=
202+
by { rw is_artinian_iff_well_founded, exact well_founded.monotone_chain_condition.symm }
205203

206204
theorem is_artinian.monotone_stabilizes [is_artinian R M] (f : ℕ →o (submodule R M)ᵒᵈ) :
207205
∃ n, ∀ m, n ≤ m → f n = f m :=

0 commit comments

Comments
 (0)