Skip to content

Commit

Permalink
chore(set_theory/ordinal/arithmetic): clean up is_normal.sup and re…
Browse files Browse the repository at this point in the history
…lated (#15162)

We golf various theorems and tweak their arguments.



Co-authored-by: Eric Wieser <wieser.eric@gmail.com>
  • Loading branch information
vihdzp and eric-wieser committed Aug 11, 2022
1 parent 8cfa836 commit 58d9778
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 26 deletions.
46 changes: 21 additions & 25 deletions src/set_theory/ordinal/arithmetic.lean
Expand Up @@ -424,8 +424,8 @@ by simp only [le_antisymm_iff, H.le_iff]
theorem is_normal.self_le {f} (H : is_normal f) (a) : a ≤ f a :=
lt_wf.self_le_of_strict_mono H.strict_mono a

theorem is_normal.le_set {f} (H : is_normal f) (p : set ordinal) (p0 : p.nonempty) (b)
(H₂ : ∀ o, b ≤ o ↔ ∀ a ∈ p, a ≤ o) {o : ordinal} : f b ≤ o ↔ ∀ a ∈ p, f a ≤ o :=
theorem is_normal.le_set {f o} (H : is_normal f) (p : set ordinal) (p0 : p.nonempty) (b)
(H₂ : ∀ o, b ≤ o ↔ ∀ a ∈ p, a ≤ o) : f b ≤ o ↔ ∀ a ∈ p, f a ≤ o :=
⟨λ h a pa, (H.le_iff.2 ((H₂ _).1 le_rfl _ pa)).trans h,
λ h, begin
revert H₂, refine limit_rec_on b (λ H₂, _) (λ S _ H₂, _) (λ S L _ H₂, (H.2 _ L _).2 (λ a h', _)),
Expand All @@ -438,30 +438,21 @@ theorem is_normal.le_set {f} (H : is_normal f) (p : set ordinal) (p0 : p.nonempt
exact (H.le_iff.2 $ (not_le.1 h₂).le).trans (h _ h₁) }
end

theorem is_normal.le_set' {f} (H : is_normal f) (p : set α) (g : α → ordinal) (p0 : p.nonempty) (b)
(H₂ : ∀ o, b ≤ o ↔ ∀ a ∈ p, g a ≤ o) {o} : f b ≤ o ↔ ∀ a ∈ p, f (g a) ≤ o :=
(H.le_set (λ x, ∃ y, p y ∧ x = g y)
(let ⟨x, px⟩ := p0 in ⟨_, _, px, rfl⟩) _
(λ o, (H₂ o).trans ⟨λ H a ⟨y, h1, h2⟩, h2.symm ▸ H y h1,
λ H a h1, H (g a) ⟨a, h1, rfl⟩⟩)).trans
⟨λ H a h, H (g a) ⟨a, h, rfl⟩, λ H a ⟨y, h1, h2⟩, h2.symm ▸ H y h1⟩
theorem is_normal.le_set' {f o} (H : is_normal f) (p : set α) (p0 : p.nonempty) (g : α → ordinal)
(b) (H₂ : ∀ o, b ≤ o ↔ ∀ a ∈ p, g a ≤ o) : f b ≤ o ↔ ∀ a ∈ p, f (g a) ≤ o :=
by simpa [H₂] using H.le_set (g '' p) (p0.image g) b

theorem is_normal.refl : is_normal id :=
⟨lt_succ, λ o l a, limit_le l⟩
theorem is_normal.refl : is_normal id := ⟨lt_succ, λ o l a, limit_le l⟩

theorem is_normal.trans {f g} (H₁ : is_normal f) (H₂ : is_normal g) :
is_normal (λ x, f (g x)) :=
⟨λ x, H₁.lt_iff.2 (H₂.1 _),
λ o l a, H₁.le_set' (< o) g ⟨_, l.pos⟩ _ (λ c, H₂.2 _ l _)⟩
theorem is_normal.trans {f g} (H₁ : is_normal f) (H₂ : is_normal g) : is_normal (f ∘ g) :=
⟨λ x, H₁.lt_iff.2 (H₂.1 _), λ o l a, H₁.le_set' (< o) ⟨_, l.pos⟩ g _ (λ c, H₂.2 _ l _)⟩

theorem is_normal.is_limit {f} (H : is_normal f) {o} (l : is_limit o) :
is_limit (f o) :=
theorem is_normal.is_limit {f} (H : is_normal f) {o} (l : is_limit o) : is_limit (f o) :=
⟨ne_of_gt $ (ordinal.zero_le _).trans_lt $ H.lt_iff.2 l.pos,
λ a h, let ⟨b, h₁, h₂⟩ := (H.limit_lt l).1 h in
(succ_le_of_lt h₂).trans_lt (H.lt_iff.2 h₁)⟩

theorem is_normal.le_iff_eq {f} (H : is_normal f) {a} : f a ≤ a ↔ f a = a :=
(H.self_le a).le_iff_eq
theorem is_normal.le_iff_eq {f} (H : is_normal f) {a} : f a ≤ a ↔ f a = a := (H.self_le a).le_iff_eq

theorem add_le_of_limit {a b c : ordinal} (h : is_limit b) : a + b ≤ c ↔ ∀ b' < b, a + b' ≤ c :=
⟨λ h b' l, (add_le_add_left l.le _).trans h,
Expand Down Expand Up @@ -1073,11 +1064,10 @@ begin
exact le_sup f i
end

theorem is_normal.sup {f} (H : is_normal f) {ι} (g : ι → ordinal) (h : nonempty ι) :
theorem is_normal.sup {f} (H : is_normal f) {ι} (g : ι → ordinal) [nonempty ι] :
f (sup g) = sup (f ∘ g) :=
eq_of_forall_ge_iff $ λ a,
by rw [sup_le_iff, comp, H.le_set' (λ_:ι, true) g (let ⟨i⟩ := h in ⟨i, ⟨⟩⟩)];
intros; simp only [sup_le_iff, true_implies_iff]; tauto
by rw [sup_le_iff, comp, H.le_set' set.univ set.univ_nonempty g]; simp [sup_le_iff]

@[simp] theorem sup_empty {ι} [is_empty ι] (f : ι → ordinal) : sup f = 0 :=
csupr_of_empty f
Expand Down Expand Up @@ -1200,8 +1190,12 @@ by simpa only [not_forall, not_le] using not_congr (@bsup_le_iff _ f a)

theorem is_normal.bsup {f} (H : is_normal f) {o} :
∀ (g : Π a < o, ordinal) (h : o ≠ 0), f (bsup o g) = bsup o (λ a h, f (g a h)) :=
induction_on o $ λ α r _ g h,
by { resetI, rw [←sup_eq_bsup' r, H.sup _ (type_ne_zero_iff_nonempty.1 h), ←sup_eq_bsup' r]; refl }
induction_on o $ λ α r _ g h, begin
resetI,
haveI := type_ne_zero_iff_nonempty.1 h,
rw [←sup_eq_bsup' r, H.sup, ←sup_eq_bsup' r];
refl
end

theorem lt_bsup_of_ne_bsup {o : ordinal} {f : Π a < o, ordinal} :
(∀ i h, f i h ≠ o.bsup f) ↔ ∀ i h, f i h < o.bsup f :=
Expand Down Expand Up @@ -1949,6 +1943,7 @@ begin
{ intros c l IH,
refine eq_of_forall_ge_iff (λ d, (((opow_is_normal a1).trans
(add_is_normal b)).limit_le l).trans _),
dsimp only [function.comp],
simp only [IH] {contextual := tt},
exact (((mul_is_normal $ opow_pos b (ordinal.pos_iff_ne_zero.2 a0)).trans
(opow_is_normal a1)).limit_le l).symm }
Expand Down Expand Up @@ -1984,6 +1979,7 @@ begin
{ intros c l IH,
refine eq_of_forall_ge_iff (λ d, (((opow_is_normal a1).trans
(mul_is_normal (ordinal.pos_iff_ne_zero.2 b0))).limit_le l).trans _),
dsimp only [function.comp],
simp only [IH] {contextual := tt},
exact (opow_le_of_limit (opow_ne_zero _ a0) l).symm }
end
Expand Down Expand Up @@ -2343,7 +2339,7 @@ end

theorem is_normal.apply_omega {f : ordinal.{u} → ordinal.{u}} (hf : is_normal f) :
sup.{0 u} (f ∘ nat.cast) = f ω :=
by rw [←sup_nat_cast, is_normal.sup.{0 u u} hf _ ⟨0]
by rw [←sup_nat_cast, is_normal.sup.{0 u u} hf]

@[simp] theorem sup_add_nat (o : ordinal) : sup (λ n : ℕ, o + n) = o + ω :=
(add_is_normal o).apply_omega
Expand Down
2 changes: 1 addition & 1 deletion src/set_theory/ordinal/topology.lean
Expand Up @@ -234,7 +234,7 @@ begin
{ let g : ι → ordinal.{u} := λ i, (enum_ord_order_iso hs).symm ⟨_, hf i⟩,
suffices : enum_ord s (sup.{u u} g) = sup.{u u} f,
{ rw ←this, exact enum_ord_mem hs _ },
rw is_normal.sup.{u u u} h g hι,
rw @is_normal.sup.{u u u} _ h ι g hι,
congr, ext,
change ((enum_ord_order_iso hs) _).val = f x,
rw order_iso.apply_symm_apply },
Expand Down

0 comments on commit 58d9778

Please sign in to comment.