@@ -733,12 +733,12 @@ rfl
733
733
card_product _ _
734
734
735
735
/-- Given that `α × β` is a fintype, `α` is also a fintype. -/
736
- def fintype.fintype_prod_left {α β} [decidable_eq α] [fintype (α × β)] [nonempty β] : fintype α :=
736
+ def fintype.prod_left {α β} [decidable_eq α] [fintype (α × β)] [nonempty β] : fintype α :=
737
737
⟨(fintype.elems (α × β)).image prod.fst,
738
738
assume a, let ⟨b⟩ := ‹nonempty β› in by simp; exact ⟨b, fintype.complete _⟩⟩
739
739
740
740
/-- Given that `α × β` is a fintype, `β` is also a fintype. -/
741
- def fintype.fintype_prod_right {α β} [decidable_eq β] [fintype (α × β)] [nonempty α] : fintype β :=
741
+ def fintype.prod_right {α β} [decidable_eq β] [fintype (α × β)] [nonempty α] : fintype β :=
742
742
⟨(fintype.elems (α × β)).image prod.snd,
743
743
assume b, let ⟨a⟩ := ‹nonempty α› in by simp; exact ⟨a, fintype.complete _⟩⟩
744
744
@@ -763,6 +763,16 @@ instance (α : Type u) (β : Type v) [fintype α] [fintype β] : fintype (α ⊕
763
763
((equiv.sum_equiv_sigma_bool _ _).symm.trans
764
764
(equiv.sum_congr equiv.ulift equiv.ulift))
765
765
766
+ /-- Given that `α ⊕ β` is a fintype, `α` is also a fintype. This is non-computable as it uses
767
+ that `sum.inl` is an injection, but there's no clear inverse if `α` is empty. -/
768
+ noncomputable def fintype.sum_left {α β} [fintype (α ⊕ β)] : fintype α :=
769
+ fintype.of_injective (sum.inl : α → α ⊕ β) sum.inl_injective
770
+
771
+ /-- Given that `α ⊕ β` is a fintype, `β` is also a fintype. This is non-computable as it uses
772
+ that `sum.inr` is an injection, but there's no clear inverse if `β` is empty. -/
773
+ noncomputable def fintype.sum_right {α β} [fintype (α ⊕ β)] : fintype β :=
774
+ fintype.of_injective (sum.inr : β → α ⊕ β) sum.inr_injective
775
+
766
776
namespace fintype
767
777
variables [fintype α] [fintype β]
768
778
0 commit comments