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

Commit 289d17c

Browse files
committed
chore(data/equiv/basic): avoid λ ⟨a, b⟩ in some defs, add simp lemmas (#3530)
1 parent 2d395a9 commit 289d17c

File tree

1 file changed

+40
-13
lines changed

1 file changed

+40
-13
lines changed

src/data/equiv/basic.lean

Lines changed: 40 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -676,24 +676,43 @@ end
676676
section
677677
/-- A `psigma`-type is equivalent to the corresponding `sigma`-type. -/
678678
def psigma_equiv_sigma {α} (β : α → Sort*) : (Σ' i, β i) ≃ Σ i, β i :=
679-
⟨λ ⟨a, b⟩, ⟨a, b⟩, λ ⟨a, b⟩, ⟨a, b⟩, λ ⟨a, b⟩, rfl, λ ⟨a, b⟩, rfl⟩
679+
⟨λ a, ⟨a.1, a.2⟩, λ a, ⟨a.1, a.2⟩, λ ⟨a, b⟩, rfl, λ ⟨a, b⟩, rfl⟩
680+
681+
@[simp] lemma psigma_equiv_sigma_apply {α} (β : α → Sort*) (x) :
682+
psigma_equiv_sigma β x = ⟨x.1, x.2⟩ :=
683+
rfl
684+
685+
@[simp] lemma psigma_equiv_sigma_symm_apply {α} (β : α → Sort*) (x) :
686+
(psigma_equiv_sigma β).symm x = ⟨x.1, x.2⟩ :=
687+
rfl
680688

681689
/-- A family of equivalences `Π a, β₁ a ≃ β₂ a` generates an equivalence between `Σ a, β₁ a` and
682690
`Σ a, β₂ a`. -/
683691
def sigma_congr_right {α} {β₁ β₂ : α → Sort*} (F : Π a, β₁ a ≃ β₂ a) : (Σ a, β₁ a) ≃ Σ a, β₂ a :=
684-
⟨λ a, b⟩, ⟨a, F a b⟩, λ a, b⟩, ⟨a, (F a).symm b⟩,
692+
⟨λ a, ⟨a.1, F a.1 a.2⟩, λ a, ⟨a.1, (F a.1).symm a.2⟩,
685693
λ ⟨a, b⟩, congr_arg (sigma.mk a) $ symm_apply_apply (F a) b,
686694
λ ⟨a, b⟩, congr_arg (sigma.mk a) $ apply_symm_apply (F a) b⟩
687695

696+
@[simp] lemma sigma_congr_right_apply {α} {β₁ β₂ : α → Sort*} (F : Π a, β₁ a ≃ β₂ a) (x) :
697+
sigma_congr_right F x = ⟨x.1, F x.1 x.2⟩ :=
698+
rfl
699+
700+
@[simp] lemma sigma_congr_right_symm_apply {α} {β₁ β₂ : α → Sort*} (F : Π a, β₁ a ≃ β₂ a) (x) :
701+
(sigma_congr_right F).symm x = ⟨x.1, (F x.1).symm x.2⟩ :=
702+
rfl
703+
688704
/-- An equivalence `f : α₁ ≃ α₂` generates an equivalence between `Σ a, β (f a)` and `Σ a, β a`. -/
689-
def sigma_congr_left {α₁ α₂} {β : α₂ → Sort*} : ∀ f : α₁ ≃ α₂, (Σ a:α₁, β (f a)) ≃ (Σ a:α₂, β a)
690-
| ⟨f, g, l, r⟩ :=
691-
⟨λ ⟨a, b⟩, ⟨f a, b⟩, λ ⟨a, b⟩, ⟨g a, @@eq.rec β b (r a).symm⟩,
692-
λ ⟨a, b⟩, match g (f a), l a : ∀ a' (h : a' = a),
693-
@sigma.mk _ (β ∘ f) _ (@@eq.rec β b (congr_arg f h.symm)) = ⟨a, b⟩ with
694-
| _, rfl := rfl end,
695-
λ ⟨a, b⟩, match f (g a), _ : ∀ a' (h : a' = a), sigma.mk a' (@@eq.rec β b h.symm) = ⟨a, b⟩ with
696-
| _, rfl := rfl end
705+
def sigma_congr_left {α₁ α₂} {β : α₂ → Sort*} (e : α₁ ≃ α₂) : (Σ a:α₁, β (e a)) ≃ (Σ a:α₂, β a) :=
706+
⟨λ a, ⟨e a.1, a.2⟩, λ a, ⟨e.symm a.1, @@eq.rec β a.2 (e.right_inv a.1).symm⟩,
707+
λ ⟨a, b⟩, match e.symm (e a), e.left_inv a : ∀ a' (h : a' = a),
708+
@sigma.mk _ (β ∘ e) _ (@@eq.rec β b (congr_arg e h.symm)) = ⟨a, b⟩ with
709+
| _, rfl := rfl end,
710+
λ ⟨a, b⟩, match e (e.symm a), _ : ∀ a' (h : a' = a), sigma.mk a' (@@eq.rec β b h.symm) = ⟨a, b⟩ with
711+
| _, rfl := rfl end
712+
713+
@[simp] lemma sigma_congr_left_apply {α₁ α₂} {β : α₂ → Sort*} (e : α₁ ≃ α₂) (x : Σ a, β (e a)) :
714+
sigma_congr_left e x = ⟨e x.1, x.2⟩ :=
715+
rfl
697716

698717
/-- Transporting a sigma type through an equivalence of the base -/
699718
def sigma_congr_left' {α₁ α₂} {β : α₁ → Sort*} (f : α₁ ≃ α₂) :
@@ -708,12 +727,20 @@ def sigma_congr {α₁ α₂} {β₁ : α₁ → Sort*} {β₂ : α₂ → Sort*
708727
(sigma_congr_right F).trans (sigma_congr_left f)
709728

710729
/-- `sigma` type with a constant fiber is equivalent to the product. -/
711-
def sigma_equiv_prod (α β : Sort*) : (Σ_:α, β) ≃ α × β :=
712-
⟨λ ⟨a, b⟩, ⟨a, b⟩, λ ⟨a, b⟩, ⟨a, b⟩, λ ⟨a, b⟩, rfl, λ ⟨a, b⟩, rfl⟩
730+
def sigma_equiv_prod (α β : Type*) : (Σ_:α, β) ≃ α × β :=
731+
⟨λ a, ⟨a.1, a.2⟩, λ a, ⟨a.1, a.2⟩, λ ⟨a, b⟩, rfl, λ ⟨a, b⟩, rfl⟩
732+
733+
@[simp] lemma sigma_equiv_prod_apply {α β : Type*} (x : Σ _:α, β) :
734+
sigma_equiv_prod α β x = ⟨x.1, x.2⟩ :=
735+
rfl
736+
737+
@[simp] lemma sigma_equiv_prod_symm_apply {α β : Type*} (x : α × β) :
738+
(sigma_equiv_prod α β).symm x = ⟨x.1, x.2⟩ :=
739+
rfl
713740

714741
/-- If each fiber of a `sigma` type is equivalent to a fixed type, then the sigma type
715742
is equivalent to the product. -/
716-
def sigma_equiv_prod_of_equiv {α β} {β₁ : α → Sort*} (F : a, β₁ a ≃ β) : sigma β₁ ≃ α × β :=
743+
def sigma_equiv_prod_of_equiv {α β} {β₁ : α → Sort*} (F : Π a, β₁ a ≃ β) : sigma β₁ ≃ α × β :=
717744
(sigma_congr_right F).trans (sigma_equiv_prod α β)
718745

719746
end

0 commit comments

Comments
 (0)