Functoriality of Finset
#
This file defines the functor structure of Finset
.
TODO #
Currently, all instances are classical because the functor classes want to run over all types. If instead we could state that a functor is lawful/applicative/traversable... between two given types, then we could provide the instances for types with decidable equality.
Functor #
Because Finset.image
requires a DecidableEq
instance for the target type, we can only
construct Functor Finset
when working classically.
Equations
- One or more equations did not get rendered due to their size.
Pure #
Equations
- Finset.pure = { pure := fun {α : Type ?u.6} (x : α) => {x} }
Applicative functor #
Equations
Monad #
Equations
Alternative functor #
Traversable functor #
def
Finset.traverse
{α β : Type u}
{F : Type u → Type u}
[Applicative F]
[CommApplicative F]
[DecidableEq β]
(f : α → F β)
(s : Finset α)
:
F (Finset β)
Traverse function for Finset
.
Equations
- Finset.traverse f s = Multiset.toFinset <$> Multiset.traverse f s.val
Instances For
@[simp]
@[simp]
theorem
Finset.map_traverse
{α β γ : Type u}
{G : Type u → Type u}
[Applicative G]
[CommApplicative G]
(g : α → G β)
(h : β → γ)
(s : Finset α)
:
Functor.map h <$> traverse g s = traverse (Functor.map h ∘ g) s