|logic||category theory||type theory|
|true||terminal object/(-2)-truncated object||h-level 0-type/unit type|
|false||initial object||empty type|
|proposition||(-1)-truncated object||h-level 1-type/h-prop|
|classical type theory?||internal logic||classical type theory?, logic programming?|
|cut elimination?||counit||beta reduction|
|disjunction||coproduct ((-1)-truncation of)||sum type (bracket type of)|
|implication||internal hom||function type|
|negation||internal hom into initial object||function type into empty type|
|universal quantification||dependent product||dependent product type|
|existential quantification||dependent sum ((-1)-truncation of)||dependent sum type (bracket type of)|
|equivalence||path space object||identity type|
|equivalence class||quotient||quotient type|
|induction||colimit||inductive type, W-type, M-type|
|higher induction||higher colimit||higher inductive type|
|completely presented set||discrete object/0-truncated object||h-level 2-type/preset/h-set|
|set||internal 0-groupoid||Bishop set/setoid|
|universe||object classifier||type of types|
|modality||closure operator monad||modal type theory, monad (in computer science)|
|type theory||category theory|
|natural deduction||universal construction|
Like any type constructor in type theory (see at natural deduction), a product type is specified by rules saying when we can introduce it as a type, how to construct terms of that type, how to use or “eliminate” terms of that type, and how to compute when we combine the constructors with the eliminators.
but the constructors and eliminators may be different.
When presented negatively, primacy is given to the eliminators. We specify that there are two ways to eliminate a term of type : by projecting out the first component, or by projecting out the second.
This then determines the form of the constructors: in order to construct a term of type , we have to specify what value that term should yield when all the eliminators are applied to it. In other words, we have to specify a pair of elements, one of (to be the value of ) and one of (to be the value of ).
and we may or may not choose to have an eta reduction rule
When presented positively, primacy is given to the constructors. We specify that the way to construct something of type is to give something of type and something of type :
Of course, this is the same as the constructor obtained from the negative presentation. However, the eliminator is different. Now, in order to say how to use something of type , we have to specify how we should behave for all possible ways that it could have been constructed. In other words, we have to say, assuming that were of the form , what we want to do. Thus we end up with the following rule:
We need a term in the context of two variables of types and , and the destructor or match “binds those variables” to the two components of . Note that the “ordered pair” in the destructor is just a part of the syntax; it is not an instance of the constructor ordered pair. In dependent type theory, this elimination rule must be generalized to allow the type to depend on .
Now we have beta reduction rule:
In other words, if we build an ordered pair and then break it apart, what we get is just the things we put into it. (The notation means to substitute for and for in the term ).
And (if we wish) the eta reduction rule, which is a little more subtle:
This says that if we break something of type into its components, but then we only use those two components by way of putting them back together into an ordered pair, then we might as well just not have broken it down in the first place.
Inductive prod (A B:Type) : Type := | pair : A -> B -> prod A B.
(Coq then implements beta-reduction, but not eta-reduction. However, eta-equivalence is provable with the internally defined identity type, using the dependent eliminator mentioned above.)
Arguably, negatively defined products should be naturally expressed as coinductive types, but this is not exactly the case for the presentation of coinductive types used in Coq.
In ordinary “nonlinear” type theory, the positive and negative product types are equivalent. They manifestly have the same constructor, while we can define the eliminators in terms of each other as follows:
It is obvious that the -reduction rules in the two cases correspond; see below for -conversion.
In dependent type theory, in order to recover the dependent eliminator for the positive product type from the eliminators for the negative product type, we need the latter to satisfy the -conversion rule so as to make the above definition well-typed. It is sufficient to have the -conversion up to propositional equality, however, if we are willing to insert a substitution along such an equality in the definition of the dependent eliminator. Conversely, the dependent eliminator for the positive product allows us to prove a propositional version of the negative -conversion (without assuming the positive -conversion). See propositional eta-conversions.
Now from -conversion for the negative product, we can also derive
so the defined positive product also satisfies its -conversion, which will be definitional or propositional according to that of the negative product.
On the other hand, if the positive product has a definitional -conversion, then for the defined negative product we have
Note that this involves a beta-reduction step and also a “backwards” -reduction step. So from positive reduction we cannot derive negative -reduction, only negative -equivalence. (However, the directionality of -reduction is somewhat questionable anyway.)
In conclusion, we have:
In non-dependent type theory, positive and negative products are equivalent, as are their definitional -reduction rules.
In any case, the two definitional -conversion rules also correspond.
It is of importance to note that these translations require the contraction rule and the weakening rule; that is, they duplicate and discard terms. In linear logic these rules are disallowed, and therefore the positive and negative products become different. The positive product becomes “tensor” , and the negative product becomes “with” .
categorical products may be used to interpret product types that validate both beta and eta rules, while
the syntactic category of a type theory with product types has categorical products, as long as the type theory satisfies both beta and eta rules.
Of course, the categorical notion of product matches the negative definition of a product most directly. In linear logic, therefore, the categorical product interprets “with” , while an additional monoidal structure interprets “tensor” . On the other hand, in a representable cartesian multicategory, the product has a “from the left” universal property which matches the positive definition.
A textbook account in the context of programming languages is in section 11 of