Functors #
This module provides additional lemmas, definitions, and instances for Functors.
Main definitions #
Functor.Const αis the functor that sends all types toα.Functor.AddConst αisFunctor.Const αbut for whenαhas an additive structure.Functor.Comp F Gfor functorsFandGis the functor composition ofFandG.LiftpandLiftrrespectively lift predicates and relations on a typeαtoF α. Terms ofF αare considered to, in some sense, contain values of typeα.
Tags #
functor, applicative
Const α is the constant functor, mapping every type to α. When
α has a monoid structure, Const α has an Applicative instance.
(If α has an additive monoid structure, see Functor.AddConst.)
Equations
- Functor.Const α _β = α
Instances For
The map operation of the Const γ functor.
Equations
- Functor.Const.map _f x = x
Instances For
Equations
- Functor.Const.functor = { map := @Functor.Const.map γ }
Functor.Comp is a wrapper around Function.Comp for types.
It prevents Lean's type class resolution mechanism from trying
a Functor (Comp F id) when Functor F would do.
Equations
- Functor.Comp F G α = F (G α)
Instances For
Equations
- Functor.Comp.functor = { map := @Functor.Comp.map F G inst✝¹ inst✝ }
The <*> operation for the composition of applicative functors.
Equations
Instances For
Equations
- Functor.Comp.instPure = { pure := fun {α : Type ?u.27} (x : α) => Functor.Comp.mk (pure (pure x)) }
Equations
- Functor.Comp.instSeq = { seq := fun {α β : Type ?u.31} (f : Functor.Comp F G (α → β)) (x : Unit → Functor.Comp F G α) => f.seq x }
Equations
- Functor.Comp.instApplicativeComp = { map := @Functor.Comp.map F G inst✝¹.toFunctor inst✝.toFunctor, toPure := Functor.Comp.instPure, seq := @Functor.Comp.seq F G inst✝¹ inst✝ }
If we consider x : F α to, in some sense, contain values of type α, then
Liftr r x y relates x and y iff (1) x and y have the same shape and
(2) we can pair values a from x and b from y so that r a b holds.
Equations
- One or more equations did not get rendered due to their size.
Instances For
If f is a functor, if fb : f β and a : α, then mapConstRev fb a is the result of
applying f.map to the constant function β → α sending everything to a, and then
evaluating at fb. In other words it's const a <$> fb.
Equations
- a $> b = Functor.mapConst b a
Instances For
If f is a functor, if fb : f β and a : α, then mapConstRev fb a is the result of
applying f.map to the constant function β → α sending everything to a, and then
evaluating at fb. In other words it's const a <$> fb.
Equations
- Functor.«term_$>_» = Lean.ParserDescr.trailingNode `Functor.«term_$>_» 100 101 (Lean.ParserDescr.binary `andthen (Lean.ParserDescr.symbol " $> ") (Lean.ParserDescr.cat `term 101))