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

Commit fd0cdae

Browse files
committed
feat(linear_algebra/pi): pi_option_equiv_prod (#9003)
1 parent 8ff139a commit fd0cdae

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

src/data/equiv/basic.lean

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -794,6 +794,15 @@ def option_is_some_equiv (α : Type*) : {x : option α // x.is_some} ≃ α :=
794794
left_inv := λ o, subtype.eq $ option.some_get _,
795795
right_inv := λ x, option.get_some _ _ }
796796

797+
/-- The product over `option α` of `β a` is the binary product of the
798+
product over `α` of `β (some α)` and `β none` -/
799+
@[simps] def pi_option_equiv_prod {α : Type*} {β : option α → Type*} :
800+
(Π a : option α, β a) ≃ (β none × Π a : α, β (some a)) :=
801+
{ to_fun := λ f, (f none, λ a, f (some a)),
802+
inv_fun := λ x a, option.cases_on a x.fst x.snd,
803+
left_inv := λ f, funext $ λ a, by cases a; refl,
804+
right_inv := λ x, by simp }
805+
797806
/-- `α ⊕ β` is equivalent to a `sigma`-type over `bool`. Note that this definition assumes `α` and
798807
`β` to be types from the same universe, so it cannot by used directly to transfer theorems about
799808
sigma types to theorems about sum types. In many cases one can use `ulift` to work around this

src/linear_algebra/pi.lean

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -279,6 +279,14 @@ This is `equiv.Pi_congr_left` as a `linear_equiv` -/
279279
def Pi_congr_left (e : ι' ≃ ι) : (Π i', φ (e i')) ≃ₗ[R] (Π i, φ i) :=
280280
(Pi_congr_left' R φ e.symm).symm
281281

282+
/-- This is `equiv.pi_option_equiv_prod` as a `linear_equiv` -/
283+
def pi_option_equiv_prod {ι : Type*} {M : option ι → Type*}
284+
[Π i, add_comm_group (M i)] [Π i, module R (M i)] :
285+
(Π i : option ι, M i) ≃ₗ[R] (M none × Π i : ι, M (some i)) :=
286+
{ map_add' := by simp [function.funext_iff],
287+
map_smul' := by simp [function.funext_iff],
288+
..equiv.pi_option_equiv_prod }
289+
282290
variables (ι R M) (S : Type*) [fintype ι] [decidable_eq ι] [semiring S]
283291
[add_comm_monoid M] [module R M] [module S M] [smul_comm_class R S M]
284292

0 commit comments

Comments
 (0)