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 #
@[instance_reducible]
Because Finset.image requires a DecidableEq instance for the target type, we can only
construct Functor Finset when working classically.
Equations
- Finset.functor = { map := fun {α β : Type ?u.1} (f : α → β) (s : Finset α) => Finset.image f s }
Pure #
Applicative functor #
@[instance_reducible]
Equations
- One or more equations did not get rendered due to their size.
Monad #
@[instance_reducible]
Equations
- Finset.instMonad = { toApplicative := Finset.applicative, bind := fun {α β : Type ?u.1} => Finset.sup }
Alternative functor #
@[instance_reducible]
Equations
- One or more equations did not get rendered due to their size.
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
Instances For
@[simp]
@[simp]
theorem Finset.map_traverse {α β γ : Type u} {G : Type u → Type u} [Applicative G] [CommApplicative G] (g : α → G β) (h : β → γ) (s : Finset α) :