@@ -7,6 +7,7 @@ import data.nat.lattice
7
7
import logic.denumerable
8
8
import logic.function.iterate
9
9
import order.hom.basic
10
+ import tactic.congrm
10
11
11
12
/-!
12
13
# Relation embeddings from the naturals
@@ -21,23 +22,24 @@ defines the limit value of an eventually-constant sequence.
21
22
* `monotonic_sequence_limit_index`: The index of the first occurence of `monotonic_sequence_limit`
22
23
in the sequence.
23
24
-/
25
+
26
+ variable {α : Type *}
27
+
24
28
namespace rel_embedding
25
29
26
- variables {α : Type *} { r : α → α → Prop } [is_strict_order α r]
30
+ variables {r : α → α → Prop } [is_strict_order α r]
27
31
28
32
/-- If `f` is a strictly `r`-increasing sequence, then this returns `f` as an order embedding. -/
29
33
def nat_lt (f : ℕ → α) (H : ∀ n : ℕ, r (f n) (f (n + 1 ))) :
30
34
((<) : ℕ → ℕ → Prop ) ↪r r :=
31
35
of_monotone f $ nat.rel_of_forall_rel_succ_of_lt r H
32
36
33
37
@[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 :=
36
39
rfl
37
40
38
41
/-- 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 :=
41
43
by haveI := is_strict_order.swap r; exact rel_embedding.swap (nat_lt f H)
42
44
43
45
theorem well_founded_iff_no_descending_seq :
@@ -70,8 +72,7 @@ def order_embedding_of_set : ℕ ↪o ℕ :=
70
72
71
73
/-- `nat.subtype.of_nat` as an order isomorphism between `ℕ` and an infinite decidable subset.
72
74
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 :=
75
76
rel_iso.of_surjective (rel_embedding.order_embedding_of_lt_embedding
76
77
(rel_embedding.nat_lt (nat.subtype.of_nat s) (λ n, nat.subtype.lt_succ_self _)))
77
78
nat.subtype.of_nat_surjective
@@ -84,17 +85,15 @@ lemma coe_order_embedding_of_set : ⇑(order_embedding_of_set s) = coe ∘ subty
84
85
lemma order_embedding_of_set_apply {n : ℕ} : order_embedding_of_set s n = subtype.of_nat s n := rfl
85
86
86
87
@[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]
90
90
91
91
variable (s)
92
92
93
93
lemma order_embedding_of_set_range : set.range (nat.order_embedding_of_set s) = s :=
94
94
subtype.coe_comp_of_nat_range
95
95
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) :
98
97
∃ g : ℕ ↪o ℕ, (∀ n, e (g n) ∈ s) ∨ (∀ n, e (g n) ∈ t) :=
99
98
begin
100
99
classical,
108
107
109
108
end nat
110
109
111
- theorem exists_increasing_or_nonincreasing_subseq' {α : Type *} (r : α → α → Prop ) (f : ℕ → α) :
110
+ theorem exists_increasing_or_nonincreasing_subseq' (r : α → α → Prop ) (f : ℕ → α) :
112
111
∃ (g : ℕ ↪o ℕ), (∀ n : ℕ, r (f (g n)) (f (g (n + 1 )))) ∨
113
112
(∀ m n : ℕ, m < n → ¬ r (f (g m)) (f (g n))) :=
114
113
begin
143
142
144
143
/-- This is the infinitary Erdős–Szekeres theorem, and an important lemma in the usual proof of
145
144
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 : ℕ → α) :
148
146
∃ (g : ℕ ↪o ℕ), (∀ m n : ℕ, m < n → r (f (g m)) (f (g n))) ∨
149
147
(∀ m n : ℕ, m < n → ¬ r (f (g m)) (f (g n))) :=
150
148
begin
@@ -158,36 +156,41 @@ begin
158
156
{ exact ⟨g, or.intro_right _ hnr⟩ }
159
157
end
160
158
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 :=
164
161
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, _⟩,
172
167
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]
174
178
end
175
179
176
180
/-- Given an eventually-constant monotone sequence `a₀ ≤ a₁ ≤ a₂ ≤ ...` in a partially-ordered
177
181
type, `monotonic_sequence_limit_index a` is the least natural number `n` for which `aₙ` reaches the
178
182
constant value. For sequences that are not eventually constant, `monotonic_sequence_limit_index a`
179
183
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}
182
186
183
187
/-- The constant value of an eventually-constant monotone sequence `a₀ ≤ a₁ ≤ a₂ ≤ ...` in a
184
188
partially-ordered type. -/
185
- noncomputable def monotonic_sequence_limit {α : Type *} [preorder α] (a : ℕ →o α) :=
189
+ noncomputable def monotonic_sequence_limit [preorder α] (a : ℕ →o α) :=
186
190
a (monotonic_sequence_limit_index a)
187
191
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 :=
191
194
begin
192
195
suffices : (⨆ (m : ℕ), a m) ≤ monotonic_sequence_limit a,
193
196
{ exact le_antisymm this (le_supr a _), },
0 commit comments