Zulip Chat Archive

Stream: Is there code for X?

Topic: functor.eval


Johan Commelin (May 26 2021 at 05:00):

Given two categories CC and DD, and an object XCX \in C, there's a natural functor Func(C,D)D\mathrm{Func}(C,D) \to D by evaluating functors on XX. Do we have this functor in mathlib already?

Mario Carneiro (May 26 2021 at 05:06):

that looks like swap(eval) or so

Johan Commelin (May 26 2021 at 05:14):

But there doesn't seem to be a functor.eval in mathlib. So I guess we just don't have it.

Mario Carneiro (May 26 2021 at 05:18):

import category_theory.functor_category

open category_theory

universes v₁ v₂ u₁ u₂

variables (C : Type u₁) [category.{v₁} C] (D : Type u₂) [category.{v₂} D]

def eval (A : C) : (C  D)  D :=
(functor.flip (functor.id _)).obj A

Johan Commelin (May 26 2021 at 05:22):

Ooh, nice!

Scott Morrison (May 26 2021 at 07:26):

There is src#category_theory.evaluation, very confusingly inside category_theory/prod.lean.

Johan Commelin (May 26 2021 at 10:04):

category_theory/products/basic.lean :wink:


Last updated: Dec 20 2023 at 11:08 UTC