GSoC Project | Discussion | Implementation of Functors in the Category Theory module

48 views
Skip to first unread message

Vatsal Srivastava

unread,
Mar 8, 2020, 8:37:12 AM3/8/20
to sy...@googlegroups.com
Hi,

I've been reading the category theory module, and I found that functors have not been implemented yet. I propose to do this during Phase 1 of the GSoC project.

I was wondering if we should implement it as simply an object that stores two dicts, one would be a map between objects of two categories, and the other one would be a map between morphisms of the same two categories. These maps would have to be supplied as parameters while creation of the object. 

This class could then have derived classes like one for Linearization Functors, in that case we needn't supply the map or the other category (the codomain), but we would have to supply a field over which the linearization would be done.

Suggestions are most welcome.
And please tell me if I should include some more work in Phase 1. As soon as I get more idea about how I can implement these, I can propose the work in the remaining phases too. 

Thanks,
Vatsal Srivastava.

Aaron Meurer

unread,
Mar 9, 2020, 4:24:05 PM3/9/20
to sympy
I think it would be more useful to represent functors as unevaluated
objects. That way, you can manipulate them on abstract category
objects, which may actually represent infinite categories.

See also this issue https://github.com/sympy/sympy/issues/17964

Aaron Meurer
> --
> You received this message because you are subscribed to the Google Groups "sympy" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to sympy+un...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/sympy/CANr2OynjRj8kMD6GszQwyMd_SyusVONJP5rL2ooCCf9qfKPtZQ%40mail.gmail.com.

Vatsal Srivastava

unread,
Mar 9, 2020, 5:41:52 PM3/9/20
to sy...@googlegroups.com
But just like you correctly pointed out, the code does not support infinite categories. Regardless, why not just have an unevaluated object to accommodate for the potentially infinite categories, and a derived class for the finite ones?
The reason why I think the latter is important, is because there are a few types of functors which are defined conceptually, for eg:

1. Linearization Functor:
This is a functor from the category of sets to the category of vector spaces, and is defined as follows:

Fix a field k. To each set X, one can define a vector
space, denoted kX, whose elements are formal finite
linear combinations
a1x1 + a2x2 + · · · + anxn,
where ai ∈ k and xi ∈ X.
That clearly maps ever set, to some vector space.

Now to map the morphisms, given a function f : X → Y (where X and Y are sets) , define the linear map
k_f: kX → kY by replacing each xi in a given
linear combination with f(xi).
One checks that this mapping of f to k_f indeed preserves the composition operation of functions.
So mapping every set X to a vector space kX, and every function f to a linear map k_f, we have ourselves a functor.
Now, to compute where a given set S would land under this functor, we need provide the functor the explicit map, but just the field, and the set S.

2. Forgetful Functor: This is the kind of functor that loses (or 'forgets') information about the objects/morphisms. For this too, we just need the object in the domain category, and a flag that somehow depicts to what extent the information has to be forgotten (possible implementation?)

Also, I was wondering if anybody needs to use the Category Theory module for research purposes, etc, they would need all the basic categories implemented and the basic functors amongst them right? For eg, sets, monoids, rings, groups, algebras etc? So should these be implemented separately in the category theory module or integrated with wherever else in the code these may have been implemented?

Thanks and regards,
Vatsal.

Vatsal Srivastava

unread,
Mar 9, 2020, 5:44:00 PM3/9/20
to sy...@googlegroups.com
Typo: we need not provide the functor the explicit map, but just the field and the set S.

Vatsal Srivastava

unread,
Mar 10, 2020, 9:56:22 AM3/10/20
to sy...@googlegroups.com
Any help/views/suggestions on the above discussion would be greatly appreciated.

Thanks and regards,
Vatsal.
Reply all
Reply to author
Forward
0 new messages