English
The product Bool × α is equivalent to the disjoint sum α ⊕ α; a pair (b, a) corresponds to inl a if b is false and inr a if b is true.
Русский
Произведение Bool × α эквивалентно дизъjointной сумме α ⊕ α; пара (b, a) соответствует inl a, если b = false, и inr a, если b = true.
LaTeX
$$$\text{Bool} \times \alpha \cong \alpha \oplus \alpha.$$$
Lean4
/-- The product `Bool × α` is equivalent to `α ⊕ α`. -/
@[simps]
def boolProdEquivSum (α) : Bool × α ≃ α ⊕ α
where
toFun p := if p.1 then (inr p.2) else (inl p.2)
invFun := Sum.elim (Prod.mk false) (Prod.mk true)
left_inv := by rintro ⟨_ | _, _⟩ <;> rfl
right_inv := by rintro (_ | _) <;> rfl