You're reading the public-facing archive of the Category Theory Zulip server.
To join the server you need an invite. Anybody can get an invite by contacting Matteo Capucci at name dot surname at gmail dot com.
For all things related to this archive refer to the same person.
Is it safe to think of the objects in a category as types?
Depending on the assumptions of your category, you can talk about elements, subsets, whether a subset corresponds to an object, etc.
But can you always think of objects as types? Or, as an example of a conflict, do types have elements in all of their definitions?
Define "type". I can define "object in a category", but before knowing whether it's safe for you to think of it as a type, I need to know what you mean (you mean) by a type.
The question is motivated by Leinster's notes.
My basic understanding of "type" is it tracks what operations are allowed on some data (both in and out).
I'm open to types being "plug and socket" pairs, so you're only allowed to connect a wire "if the ends match", as synonymous with "if the types match".
I guess I'm half asking if types can be safely understood as generally as objects "but no further" or if there is some key distinct insight that makes them different.
Another way I've thought about types is as expression combination rules. An expression is composed of smaller expressions with specific types, and the whole expression has its own type.
So types then are a sort of grammer, that's especially simple to understand.
Formally, a "type" is usually a thing in a formal system of syntax. Most or all such "type theories" include judgments describing the "elements" or "terms" of a type, so that inside the theory, types behave a lot like sets.
Thank you! I think that answers my question
Categorical semantics provides a way to interpret such a system of syntax into a category, so that each type corresponds to an object. But I wouldn't normally say that the objects of a category are types.
(Except for particular special categories, like the "syntactic category" of a type theory in which the objects are defined to be the types of that theory.)
You probably should try not to think of the objects in a(n arbitrary) category as anything at all. In general, they're just dots that can mark out domains and codomains, much as elements of an arbitrary set are just dots that can't do anything at all.
If I provide a categorical semantics for a type system like HoTT - can I argue each term has a unique type, because each term is an arrow from the terminal object to a unique codomain ?
Edit: I know term's types are unique because they are, but is this necessary for the categorical semantics to work?
Kevin wrote:
You probably should try not to think of the objects in a(n arbitrary) category as anything at all. In general, they're just dots [....]
Either that, or get used to thinking of them in a bunch of different ways, and choose the way that's most appropriate for a given context. They're kind of like dots, and sometimes they're kind of like sets, and sometimes they're kind of like types, and sometimes they're kind of spaces, and... so on.
Yeah, you can't survive actually thinking of them as "just dots" all the time, but that's often the hardest perspective to learn at first, and it's the only one that in some middlebrow sense is sufficient for all cases.
Melliès and Zeilberger wrote a nice paper, "Functors are type refinement systems". In it, they say
Our starting point here will be the observation that this analysis may be turned around: in fact, any functor
may be alternatively viewed as a “type system” in a generalized sense, if we interpret the (arbitrary) category as a category of typing derivations and the (arbitrary) category as a category of terms. This will lead us to a purely categorical way of speaking about typing derivations and terms—but also conversely to a purely type-theoretic way of speaking about functors.
Kevin Carlson said:
Yeah, you can't survive actually thinking of them as "just dots" all the time, but that's often the hardest perspective to learn at first, and it's the only one that in some middlebrow sense is sufficient for all cases.
You definitely don't want to get stuck in any one way of thinking that's more specific than 'just dots', because then a category will come along for which that way of thinking may be more confusing than helpful.
The otherwise stupid modern saying "it is what it is" actually applies pretty well to the concept of category.
The real numbers equipped with is a category where each hom-set has at most one morphism. Are real numbers types?
I don't want to say this is a uniquely important point of view.
But where my intuition goes with that thought, is say you have a manufacturing facility which processes widgets, and the widgets are allowed to go through a given unit provided the widget is below that unit's height requirement, and that's it.
Now you're allowed to connect three units, provided the height requirements are only increasing.
I think of the natural numbers as "types" between matrices, tracking whether you're allowed to multiply them.
But I'm prepared to accept this interpretation only really makes sense with respect to categories with specified morphisms.
I interpreted Shulman's answer though as implying the way I'm using type here is too broad
Perhaps what you're thinking is that when the notion of category is written in a dependently typed language, the type of the composition function is
Thus, the type system enforces that you can only compose two morphisms if their types and share an object. This is what's going on with multiplying matrices: the (dimension of the) codomain of one must match the (dimension of the) domain of the other. Here the objects of the category aren't themselves types, but they are parameters of the dependent hom-type which governs the allowed composites.
Oh weird, that makes sense
Alex Kreitzberg said:
If I provide a categorical semantics for a type system like HoTT - can I argue each term has a unique type, because each term is an arrow from the terminal object to a unique codomain ?
Edit: I know term's types are unique because they are, but is this necessary for the categorical semantics to work?
It's true that categorical semantics requires each "thing it interprets as a morphism" to have a unique domain and codomain, since each morphism in a category has a unique domain and codomain. (For a term in a nonempty context, the domain may not be the terminal object, rather it's the object corresponding to that context.) However, the information in that domain and codomain may not be fully contained in the syntactic object called a "term" without also knowing its type. In other words, what gets interpreted as a morphism is not a bare term but a term judgment , with being interpreted as the domain of that morphism and as its codomain. Depending on the type theory, might or might not be determined by (and is almost never determined by ), but it doesn't matter since categorical semantics takes and as part of its input to produce a morphism.
Thank you, your answers have been very enlightening.
This stuff is hard! I'll try and tighten up my language more to save folks time.
So a "term" is sorta like a "rule", in that by itself it's not enough to make a term judgement, like a rule isn't enough to define a function.
The bookkeeping in category theory is possible in part because we have hom-sets, which depend on objects. So the compose operator has enough data to check whether arrows can compose. Types behave like sets.
I think I understand, I'm sure I'll understand it better as I mull over the answers.
Terminology-wise, in type theory the "rules" are what tell us how to form certain judgments. For instance, the "pairing" rule says that if we have judgments and we can form . This probably isn't what you meant by "rule".
Oh definitely not, thank you, yes by "rule" I meant just the syntax "(s, t)", but I'll try to use different language in the future.
Well I guess I'll call that the "term" in the future
Note that a term is an entire expression like , while something like the specific syntax of pairs is sometimes called a "term-former".
Right, so would be a term?
Or even
Yes.
John Baez said:
Either that, or get used to thinking of them in a bunch of different ways, and choose the way that's most appropriate for a given context. They're kind of like dots, and sometimes they're kind of like sets, and sometimes they're kind of like types, and sometimes they're kind of spaces, and... so on.
In the most abstract sense a category is just a directed graph with composition defined, so the objects are just vertices that don't mean anything. The meaning comes in when one specifies a (usually faithful or fully faithful) functor out of a category. If you take a category and equip it with a faithful functor to Set- if one exists- then the objects behave as sets with extra structure. If the faithful functor is into a category of types (like a syntactic category for a type theory as was mentioned) then you can view the objects as acting like types. If the faithful functor into Set is topological, then the objects act like spaces. And so on! So basically: category by itself = abstract objects, category with a specified functor = more meaning to the objects.
It's true that if you have a category with a functor defined on it, then you can think of the objects of that category as objects of the codomain of the functor equipped with extra "stuff". But in addition, in many specific categories, the objects literally are things with extra stuff. For instance, in the category of groups, the objects literally are sets equipped with group structures, not just abstract dots. It's only when we're talking about an arbitrary category that we're forced to treat the objects as featureless dots that can only be given meaning by functors.
This is the same as what happens all over mathematics. In an arbitrary group, the elements are featureless dots equipped with a composition operation, but in a specific group they are generally something specific, e.g. in a symmetric group the elements are permutations of some set. But for some reason it seems harder to wrap our mind around in the case of categories.
Madeleine Birchfield said:
The real numbers equipped with is a category where each hom-set has at most one morphism. Are real numbers types?
On second thought this isn't a good example of a category whose objects aren't types.
One definition of a real number is a two-sided Dedekind cut, which is usually represented by an element of satisfying certain axioms, but is isomorphic to and thus to , where is the set with exactly two elements.
One can represent elements of as sets with injections into the set , meaning that one can define real numbers or Dedekind cuts as certain sets.
Isn't that ZFC style encoding tricks though? If you think of a real number as a set, then you can write statements like , which we don't want to do right?
Or am I dramatically misunderstanding you?
If we're not allowed , then I think the point behind your original example still stands.
i.e. I can have objects like real numbers that mediate whether I'm allowed to compose morphisms, but the objects don't have to behave like sets.
Alex Kreitzberg said:
Isn't that ZFC style encoding tricks though? If you think of a real number as a set, then you can write statements like , which we don't want to do right?
Or am I dramatically misunderstanding you?
If we're not allowed , then I think the point behind your original example still stands.
No, that isn't a ZFC encoding trick, the definition of a Dedekind cut as an object in a category is valid in any well-pointed Heyting pretopos with NNO, where the object is defined as , is defined in the usual manner from the natural numbers object , products and quotients, injections are the monomorphisms into .
Interesting, okay thank you for clarifying
The only difference is that without power sets, you can't define the set of all Dedekind cuts. However, you can still define addition, negation, multiplication, the order relations, etc on Dedekind cuts as operations on and relations between sets.
@Alex Kreitzberg - in case you don't know: the idea of a Dedekind cut is to specify a real number you give the set of all rationals it and the set of all rationals it. That's what this thing is about. So for the number you'd have meaning , and meaning is not .
I'll let you decide if this is a "ZFC style encoding trick" or not.
John Baez said:
Alex Kreitzberg - in case you don't know: the idea of a Dedekind cut is to specify a real number you give the set of all rationals it and the set of all rationals it.
Shouldn't the second condition be rather than ?
John Baez said:
I'll let you decide if this is a "ZFC style encoding trick" or not.
It is an encoding trick but it doesn't inherently have anything to do with ZFC, since it is also valid in non-ZFC foundations like ETCS or SEAR or dependent type theory or higher order logic. Compare with the von Neumann ordinals as an encoding of the natural numbers, which only really makes sense in ZFC style set theories.
In general, it's of the same nature as using elements of power sets instead of sets with injections . In categorical set theory, is in general not a set, the associated set is given by , where the relation is given as part of the structure of the power set.
Madeleine Birchfield said:
John Baez said:
Alex Kreitzberg - in case you don't know: the idea of a Dedekind cut is to specify a real number you give the set of all rationals it and the set of all rationals it.
Shouldn't the second condition be rather than ?
If you say so you must be right. I never use Dedekind cuts in my own work, although I've occasionally taught a course where I used them to construct the reals. So I don't remember the advantage of using . Oh, I guess it makes negatives easier to define!
Madeleine Birchfield said:
John Baez said:
I'll let you decide if this is a "ZFC style encoding trick" or not.
It is an encoding trick but it doesn't inherently have anything to do with ZFC, since it is also valid in non-ZFC foundations like ETCS or SEAR or dependent type theory or higher order logic.
I bet when Alex said "ZFC style encoding trick" he really just meant "set-theoretic encoding trick", since I've never seen him talk about non-ZFC foundations.
John Baez said:
If you say so you must be right. I never use Dedekind cuts in my own work, although I've occasionally taught a course where I used them to construct the reals. So I don't remember the advantage of using . Oh, I guess it makes negatives easier to define!
In non-boolean elementary toposes, the left-sided Dedekind cuts, right-sided Dedekind cuts, and two-sided Dedekind cuts do not coincide, and the two-sided Dedekind cuts are the ones which have the right topology. That they coincide is equivalent to the elementary topos being Boolean.
That's true, but John did describe a two-sided version. He made the lower half of the cut open and the upper half closed, which is a little oddly asymmetrical, but I don't think it's a problem even constructively. IIRC open and closed cuts are interdefinable even constructively, although the open ones are more traditional.
Mike Shulman said:
That's true, but John did describe a two-sided version. He made the lower half of the cut open and the upper half closed, which is a little oddly asymmetrical, but I don't think it's a problem even constructively. IIRC open and closed cuts are interdefinable even constructively, although the open ones are more traditional.
I wasn't aware that one could use closed cuts for Dedekind cuts; all the definitions I've seen had only used the open ones.
I also seem to have misinterpreted John Baez's comment: I took it to mean the advantage of using over nothing at all (i.e. two-sided vs left Dedekind reals) while he may have meant the advantage of using over .
I've already said something confused today, so I'm trying to avoid doing that twice XD, and I can't say I'm strong at foundations (I'm slightly interested in HoTT, and read "Naive set theory" by Halmos years ago)
I don't think there's an ordinary type system where you can have a judgement that looks something like , and it isn't clear to me how reals being built out of a pair of sets of rationals would let you do that. The set pair defining real numbers look like they're part of the implementation, not the interface of real numbers.
But I wanted to read and think over the answers first before commenting, because I was open to still being confused.
But yeah I meant "set-theoretic encoding trick", "implementation details", etc. An individual real number doesn't satisfy the interface of a type...right?
That was what I was trying to clarify.
And if that last paragraph was true, then individual real numbers as "not a type" still felt like a good counterexample to my (wrong) intuition that objects were types.
Alex Kreitzberg said:
I don't think there's an ordinary type system where you can have a judgement that looks something like , and it isn't clear to me how reals being built out of a pair of sets of rationals would let you do that. The set pair defining real numbers look like they're part of the implementation, not the interface of real numbers.
But I wanted to read and think over the answers first before commenting, because I was open to still being confused.
But yeah I meant "set-theoretic encoding trick", "implementation details", etc. An individual real number doesn't satisfy the interface of a type...right?
What I've been trying to say is that there is a definition of a real number as a set or type. More specifically, one definition of a real number as a two-sided Dedekind cut is a set or type with an injection or embedding such that
Since one can define the real number as a two-sided Dedekind cut, using the above definition, is a type with an injection satisfying the above axioms.
As a result, it makes perfect sense to form the judgment if one is using this definition of a real number.
The elements of in this case are codes for pairs consisting of a rational number and a boolean indicating whether the rational number is in the lower cut or the upper cut associated with the real number . I say codes because the elements of aren't literally such pairs (unless one has coercion rules for injections / subtypes to mimic what happens in ZFC), but that given an element , is such a pair. And since is an injection, for every if there is a such that then is the unique element of satisfying .
Madeleine Birchfield said:
I wasn't aware that one could use closed cuts for Dedekind cuts; all the definitions I've seen had only used the open ones.
I was surprised when I learned that too! If is an open lower cut, the corresponding closed lower cut is
and if is a closed lower cut, the corresponding open lower cut is
Madeleine Birchfield said:
As a result, it makes perfect sense to form the judgment if one is using this definition of a real number.
Alright thank you, I'll read what you wrote carefully, (and that's wild)
More commonly, real numbers as two-sided Dedekind cuts are defined as consisting of two sets and with injections and , where represents the lower cut associated with the real number and represents the upper cut associated with the real numbers. But one can just take the disjoint union of and and one gets a set with a single injection , and is isomorphic to . Then one can simply say that the real number is represented by .
And agreed that it is wild. In this formulation, sequences of real numbers are -indexed families of sets, and individual functions on the real numbers are modal operators on Dedekind cuts.