Zulip Chat Archive

Stream: general

Topic: functor universe


Patrick Massot (Jun 18 2019 at 14:19):

Is there any way to make the definition of functor more universe polymorphic? If I define

instance : functor topological_space :=
{ map := λ _ _ f, topological_space.coinduced f }

Then I think I can use f <*> T only if the source and target of f live in the same universe.

Mario Carneiro (Jun 18 2019 at 14:39):

unfortunately no

Patrick Massot (Jun 18 2019 at 14:40):

Is it a limitation of the underlying type theory?

Mario Carneiro (Jun 18 2019 at 14:40):

For it to be more universe polymorphic it has to be free-standing functions

Mario Carneiro (Jun 18 2019 at 14:40):

yes

Patrick Massot (Jun 18 2019 at 14:40):

What is a free-standing function?

Mario Carneiro (Jun 18 2019 at 14:41):

i.e. option.map instead of the map component of functor option

Johan Commelin (Jun 18 2019 at 14:41):

s/i.e./e.g./

Mario Carneiro (Jun 18 2019 at 14:43):

You can't hold a lemma that says that map is functorial as a hypothesis, because that statement involves quantifying over universes so it would be an existential universe variable if it was a hypothesis. But you can prove that every particular polymorphic map function is functorial polymorphically

Patrick Massot (Jun 18 2019 at 14:44):

Ok, this is what I observed, but I wanted to make sure. Too bad

Patrick Massot (Jun 18 2019 at 14:44):

Thanks!

Simon Hudon (Jun 18 2019 at 14:55):

Footnote: there is a way around this limitation but you need to formulate your functor as a relation between two functors e.g. option.{v} and option.{u}

Simon Hudon (Jun 18 2019 at 14:55):

When you need it, it works but you're better off avoiding it if you can

Patrick Massot (Jun 18 2019 at 14:56):

How would that look like in my example?


Last updated: Dec 20 2023 at 11:08 UTC