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.
If I understand correctly, in DTT, types can depend on values.
In PTT, types can depend on other types.
Coq is an example of a DTT.
System F is an example of PTT.
What I'm curious about is the following - In Coq, types and terms are the same, and you can write 'polymorphic functions', in a sense. I'm curious if we could call coq a polymorphic type theory too?
I guess, a related question is: we use ∀
in both PTT and DTT. Are they related?
They're related, but not identical. In DTT you can quantify over all the types in a universe, but not over literally all types like you can in PTT. So DTT is "polymorphic" in the general sense that you can quantify over types, but I would say it's "not as polymorphic" as PTT.
Another way in which it's not as polymorphic is that when you quantify over all the types in the universe, the resulting type lies in a higher universe. (This is for the "predicative" version of DTT that's the default in most DTT-based proof assistants; there's also an "impredicative" version in which there's one universe that you can quantify over and stay in that universe, although you still can't quantify over all types.)
However, the polymorphism of DTT does satisfy the same sort of "parametricity" properties that are characteristic of PTT, e.g. the only definable function of type is the identity function.
I thought that the calculus of constructions contained System F. Like, in Barendregt's lambda cube, λ2=System F adds polymorphism to the simply-typed lambda calculus, then λω=System Fω adds type constructors, then λC adds dependent types. Why would Coq not be as polymorphic as System F?
Or do you just mean that λ2 (a PTT) and λP (a DTT) have orthogonal features and you're being loose with the term "polymorphism"?
The original CoC was the impredicative kind of DTT that I mentioned, which contains System F as you say. You can still get that behavior with the --impredicative-set
option to Coq, but Coq's default is now predicative.
Thanks!
Mike Shulman said:
there's also an "impredicative" version in which there's one universe that you can quantify over and stay in that universe, although you still can't quantify over all types
Is it safe to say that 'impredicative' DTT is also a polymorphic type theory?
Moreover, when you say "you still can't quantify over all types", you mean both the predicative and impredicative types? I am guessing that you can quantify over all impredicative types (like Prop in coq)...
Yes, I would say impredicative DTT is even more polymorphic than predicative DTT (but not as polymorphic as PTT).
In predicative DTT you have a tower of universes , and each is closed under the type operations. So a type like lies not in but in , since and it's the domain of the . In impredicative DTT there is a special rule that (only!) is closed under , so that in fact does lie in . But the only kinds of quantifiers over types are , not an arbitrary .
Mike Shulman said:
In impredicative DTT there is a special rule that (only!) is closed under , so that in fact does lie in . But the only kinds of quantifiers over types are , not an arbitrary .
I've never heard of this rule, do you have a source for this? I've only seen impredicativity defined in terms of propositional resizing rules, such as in the HoTT book.
Madeleine Birchfield said:
Mike Shulman said:
In impredicative DTT there is a special rule that (only!) is closed under , so that in fact does lie in . But the only kinds of quantifiers over types are , not an arbitrary .
I've never heard of this rule, do you have a source for this? I've only seen impredicativity defined in terms of propositional resizing rules, such as in the HoTT book.
this is how Set used to be in Coq, before the feature was put behind an optional flag, see e.g. this PA.SE question
Is closure under dependent products over consistent with the univalence axiom for , or with having higher inductive types?
Also, what names do we use to distinguish between this form of impredicative dependent type theory and the impredicative dependent type theory via propositional resizing?
Polymorphic impredicativity vs propositional impredicativity?
A lot of things can be "impredicative", since it just means "not predicative", and propositional resizing is an impredicative property in this sense. However, the phrase "impredicative type theory" is usually used to refer to the theory I'm talking about here, so I wouldn't use it for type theory with propositional resizing. The "intersection" of impredicative type theory and propositional resizing is the assertion that Prop is closed (up to equivalence) under -types with large domain, which follows from either of them.
Yes, an impredicative universe is consistent with univalence: there's a model in cubical assemblies. I don't know if HITs have been constructed in that model but I would expect they're possible.
Mike Shulman said:
They're related, but not identical. In DTT you can quantify over all the types in a universe, but not over literally all types like you can in PTT. So DTT is "polymorphic" in the general sense that you can quantify over types, but I would say it's "not as polymorphic" as PTT.
I was doing some chatting / reading, and I was wondering where Hindley-Milner style polymorphism would fit?
Apparently, its polymorphism is predicative (precisely what this means, I don't know), while System F's polymorphism is impredicative (which is supposed to be more expressive).
If I understand correctly, Hindley-Milner and System F are both examples of Polymorphic Type Theories.
Would it be safe to say that the 'polymorphism' of DTT < HM < System F?
Suraaj K S said:
Mike Shulman said:
They're related, but not identical. In DTT you can quantify over all the types in a universe, but not over literally all types like you can in PTT. So DTT is "polymorphic" in the general sense that you can quantify over types, but I would say it's "not as polymorphic" as PTT.
I was doing some chatting / reading, and I was wondering where Hindley-Milner style polymorphism would fit?
Apparently, its polymorphism is predicative (precisely what this means, I don't know), while System F's polymorphism is impredicative (which is supposed to be more expressive).
If I understand correctly, Hindley-Milner and System F are both examples of Polymorphic Type Theories.
Would it be safe to say that the 'polymorphism' of DTT < HM < System F?
So the HM type system is meant to be a restriction of System F to allow for the type-inference problem to be solved. However, it's somewhat odd from a purely theoretical perspective, since with the expected equational theory one can find terms which look obviously equal, but for which one is ill-typed (basically, removing lets will change typeability!). As a result, the restrictions being used for the HM system are rather incomparable to what is going on with System F compared with DTT or similar.
NB: The restriction also ensures that cannot be specialized to a type containing a , which is why it is sometimes referred to as predicative. However, the term 'predicative' is not used in a terribly consistent way within type theory. It usually just refers to some sort of stratification in who can quantify over what.