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

Commit dce5dd4

Browse files
committed
feat(order/well_founded, set_theory/ordinal_arithmetic): eq_strict_mono_iff_eq_range (#11882)
Two strict monotonic functions with well-founded domains are equal iff their ranges are. We use this to golf `eq_enum_ord`.
1 parent a87d431 commit dce5dd4

File tree

2 files changed

+29
-20
lines changed

2 files changed

+29
-20
lines changed

src/order/well_founded.lean

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,8 +116,32 @@ end
116116
section linear_order
117117

118118
variables {β : Type*} [linear_order β] (h : well_founded ((<) : β → β → Prop))
119+
{γ : Type*} [partial_order γ]
120+
121+
private theorem eq_strict_mono_iff_eq_range_aux {f g : β → γ} (hf : strict_mono f)
122+
(hg : strict_mono g) (hfg : set.range f = set.range g) {b : β} (H : ∀ a < b, f a = g a) :
123+
f b ≤ g b :=
124+
begin
125+
obtain ⟨c, hc⟩ : g b ∈ set.range f := by { rw hfg, exact set.mem_range_self b },
126+
cases lt_or_le c b with hcb hbc,
127+
{ rw [H c hcb] at hc,
128+
rw hg.injective hc at hcb,
129+
exact hcb.false.elim },
130+
{ rw ←hc,
131+
exact hf.monotone hbc }
132+
end
119133

120134
include h
135+
theorem eq_strict_mono_iff_eq_range {f g : β → γ} (hf : strict_mono f)
136+
(hg : strict_mono g) : set.range f = set.range g ↔ f = g :=
137+
⟨λ hfg, begin
138+
funext a,
139+
apply h.induction a,
140+
exact λ b H, le_antisymm
141+
(eq_strict_mono_iff_eq_range_aux hf hg hfg H)
142+
(eq_strict_mono_iff_eq_range_aux hg hf hfg.symm (λ a hab, (H a hab).symm))
143+
end, congr_arg _⟩
144+
121145
theorem self_le_of_strict_mono {φ : β → β} (hφ : strict_mono φ) : ∀ n, n ≤ φ n :=
122146
by { by_contra' h₁, have h₂ := h.min_mem _ h₁, exact h.not_lt_min _ h₁ (hφ h₂) h₂ }
123147

src/set_theory/ordinal_arithmetic.lean

Lines changed: 5 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1379,28 +1379,13 @@ theorem enum_ord_range : range (enum_ord S hS) = S :=
13791379
by { rw range_eq_iff, exact ⟨enum_ord_mem hS, enum_ord.surjective hS⟩ }
13801380

13811381
/-- A characterization of `enum_ord`: it is the unique strict monotonic function with range `S`. -/
1382-
theorem eq_enum_ord (f : ordinal → ordinal) :
1383-
strict_mono f ∧ range f = S ↔ f = enum_ord S hS :=
1382+
theorem eq_enum_ord (f : ordinal → ordinal) : strict_mono f ∧ range f = S ↔ f = enum_ord S hS :=
13841383
begin
1385-
split, swap,
1384+
split,
1385+
{ rintro ⟨h₁, h₂⟩,
1386+
rwa [←wf.eq_strict_mono_iff_eq_range h₁ (enum_ord.strict_mono hS), enum_ord_range hS] },
13861387
{ rintro rfl,
1387-
exact ⟨enum_ord.strict_mono hS, enum_ord_range hS⟩ },
1388-
rw range_eq_iff,
1389-
rintro ⟨h, hl, hr⟩,
1390-
refine funext (λ a, _),
1391-
apply wf.induction a,
1392-
refine λ b H, le_antisymm _ _,
1393-
{ cases hr _ (enum_ord_mem hS b) with d hd,
1394-
rw ←hd,
1395-
apply h.monotone,
1396-
by_contra' hbd,
1397-
have := enum_ord.strict_mono hS hbd,
1398-
rw ←(H d hbd) at this,
1399-
exact ne_of_lt this hd },
1400-
rw enum_ord_def,
1401-
refine omin_le ⟨hl b, λ c hc, _⟩,
1402-
rw ←(H c hc),
1403-
exact h hc
1388+
exact ⟨enum_ord.strict_mono hS, enum_ord_range hS⟩ }
14041389
end
14051390

14061391
end

0 commit comments

Comments
 (0)