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

Commit cc4b8e5

Browse files
committed
feat(data/sigma,data/ulift,logic/equiv): add missing lemmas (#14903)
Add lemmas and `equiv`s about `plift`, `psigma`, and `pprod`.
1 parent cf23199 commit cc4b8e5

File tree

4 files changed

+51
-8
lines changed

4 files changed

+51
-8
lines changed

src/data/sigma/basic.lean

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,14 @@ by { cases x₀, cases x₁, cases h₀, cases h₁, refl }
192192
lemma ext_iff {x₀ x₁ : psigma β} : x₀ = x₁ ↔ x₀.1 = x₁.1 ∧ x₀.2 == x₁.2 :=
193193
by { cases x₀, cases x₁, exact psigma.mk.inj_iff }
194194

195+
@[simp] theorem «forall» {p : (Σ' a, β a) → Prop} :
196+
(∀ x, p x) ↔ (∀ a b, p ⟨a, b⟩) :=
197+
⟨assume h a b, h ⟨a, b⟩, assume h ⟨a, b⟩, h a b⟩
198+
199+
@[simp] theorem «exists» {p : (Σ' a, β a) → Prop} :
200+
(∃ x, p x) ↔ (∃ a b, p ⟨a, b⟩) :=
201+
⟨assume ⟨⟨a, b⟩, h⟩, ⟨a, b, h⟩, assume ⟨a, b, h⟩, ⟨⟨a, b⟩, h⟩⟩
202+
195203
/-- A specialized ext lemma for equality of psigma types over an indexed subtype. -/
196204
@[ext]
197205
lemma subtype_ext {β : Sort*} {p : α → β → Prop} :

src/data/ulift.lean

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ In this file we provide `subsingleton`, `unique`, `decidable_eq`, and `is_empty`
1414
-/
1515

1616
universes u v
17+
open function
1718

1819
namespace plift
1920

@@ -24,11 +25,20 @@ instance [unique α] : unique (plift α) := equiv.plift.unique
2425
instance [decidable_eq α] : decidable_eq (plift α) := equiv.plift.decidable_eq
2526
instance [is_empty α] : is_empty (plift α) := equiv.plift.is_empty
2627

28+
lemma up_injective : injective (@up α) := equiv.plift.symm.injective
29+
lemma up_surjective : surjective (@up α) := equiv.plift.symm.surjective
30+
lemma up_bijective : bijective (@up α) := equiv.plift.symm.bijective
31+
32+
@[simp] lemma up_inj {x y : α} : up x = up y ↔ x = y := up_injective.eq_iff
33+
34+
lemma down_surjective : surjective (@down α) := equiv.plift.surjective
35+
lemma down_bijective : bijective (@down α) := equiv.plift.bijective
36+
2737
@[simp] lemma «forall» {p : plift α → Prop} : (∀ x, p x) ↔ ∀ x : α, p (plift.up x) :=
28-
equiv.plift.forall_congr_left'
38+
up_surjective.forall
2939

3040
@[simp] lemma «exists» {p : plift α → Prop} : (∃ x, p x) ↔ ∃ x : α, p (plift.up x) :=
31-
equiv.plift.exists_congr_left
41+
up_surjective.exists
3242

3343
end plift
3444

@@ -41,10 +51,19 @@ instance [unique α] : unique (ulift α) := equiv.ulift.unique
4151
instance [decidable_eq α] : decidable_eq (ulift α) := equiv.ulift.decidable_eq
4252
instance [is_empty α] : is_empty (ulift α) := equiv.ulift.is_empty
4353

54+
lemma up_injective : injective (@up α) := equiv.ulift.symm.injective
55+
lemma up_surjective : surjective (@up α) := equiv.ulift.symm.surjective
56+
lemma up_bijective : bijective (@up α) := equiv.ulift.symm.bijective
57+
58+
@[simp] lemma up_inj {x y : α} : up x = up y ↔ x = y := up_injective.eq_iff
59+
60+
lemma down_surjective : surjective (@down α) := equiv.ulift.surjective
61+
lemma down_bijective : bijective (@down α) := equiv.ulift.bijective
62+
4463
@[simp] lemma «forall» {p : ulift α → Prop} : (∀ x, p x) ↔ ∀ x : α, p (ulift.up x) :=
45-
equiv.ulift.forall_congr_left'
64+
up_surjective.forall
4665

4766
@[simp] lemma «exists» {p : ulift α → Prop} : (∃ x, p x) ↔ ∃ x : α, p (ulift.up x) :=
48-
equiv.ulift.exists_congr_left
67+
up_surjective.exists
4968

5069
end ulift

src/logic/equiv/basic.lean

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -394,6 +394,14 @@ def pprod_equiv_prod {α β : Type*} : pprod α β ≃ α × β :=
394394
left_inv := λ ⟨x, y⟩, rfl,
395395
right_inv := λ ⟨x, y⟩, rfl }
396396

397+
/-- `pprod α β` is equivalent to `plift α × plift β` -/
398+
@[simps apply symm_apply]
399+
def pprod_equiv_prod_plift {α β : Sort*} : pprod α β ≃ plift α × plift β :=
400+
{ to_fun := λ x, (plift.up x.1, plift.up x.2),
401+
inv_fun := λ x, ⟨x.1.down, x.2.down⟩,
402+
left_inv := λ ⟨x, y⟩, rfl,
403+
right_inv := λ ⟨⟨x⟩, ⟨y⟩⟩, rfl }
404+
397405
/-- equivalence of propositions is the same as iff -/
398406
def of_iff {P Q : Prop} (h : P ↔ Q) : P ≃ Q :=
399407
{ to_fun := h.mp,
@@ -941,10 +949,16 @@ def Pi_curry {α} {β : α → Sort*} (γ : Π a, β a → Sort*) :
941949
end
942950

943951
section
952+
944953
/-- A `psigma`-type is equivalent to the corresponding `sigma`-type. -/
945954
@[simps apply symm_apply] def psigma_equiv_sigma {α} (β : α → Type*) : (Σ' i, β i) ≃ Σ i, β i :=
946955
⟨λ a, ⟨a.1, a.2⟩, λ a, ⟨a.1, a.2⟩, λ ⟨a, b⟩, rfl, λ ⟨a, b⟩, rfl⟩
947956

957+
/-- A `psigma`-type is equivalent to the corresponding `sigma`-type. -/
958+
@[simps apply symm_apply] def psigma_equiv_sigma_plift {α} (β : α → Sort*) :
959+
(Σ' i, β i) ≃ Σ i : plift α, plift (β i.down) :=
960+
⟨λ a, ⟨plift.up a.1, plift.up a.2⟩, λ a, ⟨a.1.down, a.2.down⟩, λ ⟨a, b⟩, rfl, λ ⟨⟨a⟩, ⟨b⟩⟩, rfl⟩
961+
948962
/-- A family of equivalences `Π a, β₁ a ≃ β₂ a` generates an equivalence between `Σ' a, β₁ a` and
949963
`Σ' a, β₂ a`. -/
950964
@[simps apply]

src/set_theory/cardinal/cofinality.lean

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -218,13 +218,15 @@ begin
218218
end
219219

220220
@[simp] theorem lift_cof (o) : (cof o).lift = cof o.lift :=
221-
induction_on o $ begin introsI α r _,
221+
begin
222+
refine induction_on o _,
223+
introsI α r _,
222224
cases lift_type r with _ e, rw e,
223225
apply le_antisymm,
224226
{ unfreezingI { refine le_cof_type.2 (λ S H, _) },
225-
have : (#(ulift.up ⁻¹' S)).lift ≤ #S :=
226-
⟨⟨λ ⟨⟨x, h⟩⟩, ⟨⟨x⟩, h⟩,
227-
λ ⟨⟨x, h₁⟩⟩ ⟨⟨y, h₂⟩⟩ e, by simp at e; congr; injection e⟩⟩,
227+
have : (#(ulift.up ⁻¹' S)).lift ≤ #S,
228+
{ rw [← cardinal.lift_umax, ← cardinal.lift_id' (#S)],
229+
exact mk_preimage_of_injective_lift ulift.up _ ulift.up_injective },
228230
refine (cardinal.lift_le.2 $ cof_type_le _).trans this,
229231
exact λ a, let ⟨⟨b⟩, bs, br⟩ := H ⟨a⟩ in ⟨b, bs, br⟩ },
230232
{ rcases cof_eq r with ⟨S, H, e'⟩,

0 commit comments

Comments
 (0)