While proving that every monad is an applicative functor, I extracted the following derivation as a lemma:
fmap f ∘ (λh. fmap h x) ≡ { defn. ∘, β-reduction } λg. fmap f (fmap g x) ≡ { defn. ∘ } λg. (fmap f ∘ fmap g) x ≡ { Functor } λg. fmap (f ∘ g) x ≡ { abstract f ∘ g } λg. (λh. fmap h x) (f ∘ g) ≡ { defn. ∘, η-contraction } (λh. fmap h x) ∘ (f ∘)
for all f, x. This is the Yoneda Lemma in a special form. The term λh. fmap h x
is the natural transformation between an arbitrary functor F and the functor Hom(X, —), where X is fixed by the type of x. Dan Piponi calls it the hardest trivial thing in mathematics
. I didn't recognize it immediately (my category-fu is nonexistent), but the striking symmetry made me curious and I started investigating.
No comments:
Post a Comment