Skip to content

Commit

Permalink
feat: Subtype of sum is equivalent to sum of subtypes (#6083)
Browse files Browse the repository at this point in the history
This PR adds an equivalence between a subtype of a sum and a sum of subtypes
  • Loading branch information
tb65536 committed Jul 28, 2023
1 parent 8c6a52e commit 284442f
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions Mathlib/Logic/Equiv/Basic.lean
Expand Up @@ -329,6 +329,17 @@ theorem sumCongr_refl : Equiv.sumCongr (Equiv.refl α) (Equiv.refl β) = Equiv.r
cases i <;> rfl
#align equiv.sum_congr_refl Equiv.sumCongr_refl

/-- A subtype of a sum is equivalent to a sum of subtypes. -/
def subtypeSum {p : α ⊕ β → Prop} : {c // p c} ≃ {a // p (Sum.inl a)} ⊕ {b // p (Sum.inr b)} where
toFun c := match h : c.1 with
| Sum.inl a => Sum.inl ⟨a, h ▸ c.2
| Sum.inr b => Sum.inr ⟨b, h ▸ c.2
invFun c := match c with
| Sum.inl a => ⟨Sum.inl a, a.2
| Sum.inr b => ⟨Sum.inr b, b.2
left_inv := by rintro ⟨a | b, h⟩ <;> rfl
right_inv := by rintro (a | b) <;> rfl

namespace Perm

/-- Combine a permutation of `α` and of `β` into a permutation of `α ⊕ β`. -/
Expand Down

0 comments on commit 284442f

Please sign in to comment.