+-- {: .rightHandSide}
+-- {: .toc .clickDown tabindex="0"}
### Context
#### Type theory
+-- {: .hide}
[[!include type theory - contents]]
=--
=--
=--

\tableofcontents

## Idea

In [[dependent type theory]], given types $A$ and $B$ and a family of elements $x:A \vdash f(x):B$, the [[function application to identifications]] for $f(x)$ is the family of elements
$$a:A, b:A, p:a =_A b \vdash \mathrm{ap}_f(a, b, p):f(a) =_B f(b)$$

A dependent function application to identifications is like an function application to identifications, but hwere we allow $B$ to depend on $x:A$ and similarly the [[identity type]] $f(a) =_B f(b)$ to be a [[heterogeneous identity type]] and depend on the identification $p:a =_A b$.

## Definition

In [[dependent type theory]], given a type $A$ and a type family $x:A \vdash B(x)$ and a family of elements $x:A \vdash f(x):B(x)$, the **dependent function application to identifications** or **dependent action on identifications** for $f(x)$ is the family of elements
$$a:A, b:A, p:a =_A b \vdash \mathrm{apd}_f(a, b, p):\mathrm{hId}_{B}(a, b, p, f(a), f(b))$$
inductively defined by
$$a:A \vdash \mathrm{apd}_f(a, a, \mathrm{refl}_A(a)) \coloneqq \mathrm{hrefl}_A(a, f(a)):\mathrm{hId}_{B}(a, a, \mathrm{refl}_A(a), f(a), f(a))$$
where $\mathrm{hId}_{B}(a, b, p, f(a), f(b))$ is a [[heterogeneous identity type]].

### Using functions from the interval type

If dependent identification types are defined in terms of function types from the interval type; i.e.
$$p:\mathbb{I} \to A, x:B(p(0)), y:B(p(1)) \vdash \mathrm{apd}_f(p):\mathrm{hId}_{B}(p, x, y)$$
then dependent function application is defined slightly differently.

By the recursion rule of the [[interval type]], one could use a function $p:\mathbb{I} \to A$ instead of elements $a:A$, $b:A$, and identification $p:a =_A b$. Then given a type $A$ and a type family $x:A \vdash B(x)$ and a family of elements $x:A \vdash f(x):B(x)$, the **dependent function application to identifications** or **dependent action on identifications** for $f(x)$ is the family of elements
$$p:\mathbb{I} \to A \vdash \mathrm{apd}_f(p):\mathrm{hId}_{B}(p, f(p(0)), f(p(1)))$$
inductively defined using the induction principle of the path type $\mathbb{I} \to A$ by
$$a:A \vdash \mathrm{apd}_f(\lambda i:\mathbb{I}.a) \coloneqq \mathrm{hrefl}_A(a, f(a)):\mathrm{hId}_{B}(\lambda i:\mathbb{I}.a, f(a), f(a))$$

### Using transport

In addition, there are two other families of elements which could be considered dependent function applications to identifications, which use [[transport]] and the inverse of transport rather than heterogeneous identity types:

$$a:A, b:A, p:a =_A b \vdash \mathrm{apdl}_f(a, b, p):f(a) =_{B(a)} \mathrm{tr}_B(a, b, p)^{-1}(f(b))$$
$$a:A, b:A, p:a =_A b \vdash \mathrm{apdr}_f(a, b, p):\mathrm{tr}_B(a, b, p)(f(a)) =_{B(b)} f(b)$$

Having one of the three notions of dependent function application to identifications means that one could define all three of them, because the types $f(a) =_B^p f(b)$, $f(a) =_{B(a)} \mathrm{tr}_B(a, b, p)^{-1}(f(b))$, and $\mathrm{tr}_B(a, b, p)(f(a)) =_{B(b)} f(b)$ are all [[equivalence of types|equivalent]] to each other.

## See also

* [[equivalence type]]
* [[transport]]
* [[dependent function]]

[[!redirects dependent function application]]

[[!redirects dependent function application to identities]]
[[!redirects dependent function application to identifications]]
[[!redirects dependent function application to paths]]
[[!redirects dependent function application to equalities]]

[[!redirects application of a dependent function to identities]]
[[!redirects application of a dependent function to identifications]]
[[!redirects application of a dependent function to paths]]
[[!redirects application of a dependent function to equalities]]

[[!redirects dependent action on identities]]
[[!redirects dependent action on identifications]]
[[!redirects dependent action on paths]]
[[!redirects dependent action on equalities]]


dependent functions and dependent pairs -- table

| [[type former]]:  |  meaning of [[terms]]:  |
|--|--|
| [[dependent product]] | [[dependent function]]
 / [[section]] of [[bundle]] |
| [[dependent sum|dependent coproduct]]
 (aka: dependent sum) | [[dependent pair]] /
 [[generalized element|element]] of [[bundle]] |


dependent linear type theory

+-- {: .rightHandSide}
+-- {: .toc .clickDown tabindex="0"}
### Context
#### Type theory
+-- {: .hide}
[[!include type theory - contents]]
=--
#### Quantum systems
+--{: .hide}
[[!include quantum systems -- contents]]
=--
=--
=--

# Dependent linear type theory

* table of contents
{: toc}

## Idea

*Dependent linear [[type theory]]* should be some kind of combination of _[[dependent type theory]]_ and _[[linear type theory]]_.  Dependent linear *homotopy* type theory ([Schreiber 2014](#Schreiber14), [Riley 2022](#Riley22)) should additionally combine this with [[homotopy type theory]].  There are various things that such combinations might mean, and various approaches to making it precise.

One of the most important is a theory that includes both "linear types" and "nonlinear types", where the linear types may be dependent on the nonlinear types.  The nonlinear types might also be allowed to depend on each other, but in this theory the linear types are not allowed to depend on each other.

There are other approaches to dependent linear type theory that do allow some sort of dependence between linear types, but we will not (yet) discuss them on this page.

## Syntax

Details are still somewhat in the making: An extension of the [[LF]] [[syntax]] by dependent linear types appears in ([Pfenning 96](#Pfenning96), [WCFW 03](#WCFW03)) and a dependent linear extension of [[system L]] in ([Spiwack 14, section 5](#Spiwack14)).

Proposals for an actual [[syntax]] for dependent linear type theory appear in ([Vákár 14](#Vakar14), [KPB 15](#KPB15)).

## Semantics

One sort of dependent linear type theory should have [[categorical semantics]] in [[indexed monoidal (∞,1)-categories]] -- see there for detailed discussion.

### Non-homotopy version

Notice that the following relation between syntax and semantics are well established (see at _[[relation between type theory and category theory]]_ for details):

|  [[syntax]] | [[semantics]] |
|-------------|---------------|
| [[linear type theory|multiplicative intuitionistic linear type theory]] | ([[symmetric monoidal category|symmetric]] [[closed monoidal category|closed]]) [[monoidal categories]] |
| [[dependent type theory]] | [[locally cartesian closed categories]] |

Here the correspondence in the first line works by interpreting [[types]] $X$ in the [[linear type theory]] as [[objects]] $[X]$ in a [[monoidal category]] $\mathcal{C}^{\otimes}$ and by interpreting the [[conjunctions]] (as far as they exist) as follows:

| [[type theory]] | [[category theory]] |
|------|--------|
| $\otimes$ [[multiplicative conjunction]] | $\otimes$ [[tensor product]] |
| $\multimap$ [[linear implication]]   | $[-,-]$ [[internal hom]] |
| $(-)^\bot$ [[linear negation]] | $(-)^\ast$ [[dual object]]

The correspondence in the second line works by forming for any [[locally cartesian closed category]] $\mathcal{C}$ its system of [[slice categories]] $[\Gamma] \mapsto \mathcal{C}_{/[\Gamma]}$, each of which is a [[cartesian monoidal category|cartesian]] [[closed monoidal category]], and then interpreting that as the [[semantics]] for [[dependent type theory]] in the [[context]] $\Gamma$:

$$
  \left\{
    \Gamma \vdash a \colon A
  \right\}
  \leftrightarrow
  \left\{
     (\ast \stackrel{[a]}{\longrightarrow} [A])
     \in Mor(\mathcal{C}_{/[\Gamma]})
  \right\}
  \,.
$$

Moreover, the system of slice categories has good [[base change]] in that for every morphism $[f] \colon [\Gamma_1]\to [\Gamma_2]$ in $\mathcal{C}$ there is an [[adjoint triple]] of [[functors]]

$$
   \mathcal{C}_{[\Gamma_1]}
    \stackrel{\stackrel{[f]_!}{\longrightarrow}}{\stackrel{\overset{[f]^\ast}{\longleftarrow}}{\underset{[f]_\ast}{\longrightarrow}}}
    \mathcal{C}_{[\Gamma_2]}
$$

satisfying [[Frobenius reciprocity]]. These serve as the semantics for the [[context extension]] along a map $f\colon \Gamma_1 \to \Gamma_2$ of contexts, and for the [[dependent sum]] $\sum$, and the [[dependent product]] of the dependent type theory syntax, respectively:

$$
  \left\{
     \underset{f^{-1}(-)}{\sum}
     , \; f \;,
     \underset{f^{-1}(-)}{\prod}
  \right\}
  \leftrightarrow
  \left\{
    [f]_! \dashv [f]^\ast \dashv [f]_\ast
  \right\}
  \,.
$$

Now since a [[cartesian monoidal category]] is in particular a ([[symmetric monoidal category|symmetric]] [[closed monoidal category|closed]]) [[monoidal category]], this immediately suggest to generalize the assignments
$[\Gamma] \mapsto (\mathcal{C}_{/[\Gamma]})^\times$ to assignments
$[\Gamma] \mapsto (\mathcal{C}_{[\Gamma]})^\otimes$ of ([[symmetric monoidal category|symmetric]] [[closed monoidal category|closed]]) [[monoidal categories]] (possibly but not necessarily the [[slice categories]] of $\mathcal{C}$) such that there still is good [[base change]] in the above way.

More explicitly, following the notion of [[hyperdoctrine]], the [[categorical semantics]] of dependent linear type theory should have for each [[context]] $\Gamma$ a [[linear type theory]]/possibly-non-[[cartesian monoidal category|cartesian]] [[symmetric monoidal category|symmetric]] [[closed monoidal category]] $(\mathcal{C}_{\Gamma}, \otimes, 1)$ and for each [[homomorphism]] of [[contexts]] $f \;\colon\; \Gamma_1 \longrightarrow \Gamma_2$ functorially an [[adjoint triple]] of [[functors]]

$$
  (f_! \dashv f^\ast \dashv f_\ast)
    \;\colon\;
   \mathcal{C}_{\Gamma_1}
    \stackrel{\stackrel{f_!}{\longrightarrow}}{\stackrel{\overset{f^\ast}{\longleftarrow}}{\underset{f_\ast}{\rightarrow}}}
    \mathcal{C}_{\Gamma_2}
  \,.
$$

where $f^\ast$ is [[context extension]] and where the [[left adjoint]] $f_!$ and [[right adjoint]] $f_\ast$ are to be thought of as linear analogs of [[dependent sum]] and [[dependent product]], respectively. Moreover this should satisfy [[Frobenius reciprocity]], hence $f^\ast$ should be a strong [[closed monoidal functor]].  Typically one would in addition demand the [[Beck-Chevalley condition]] for consecutive such adjoint triples.

Equivalently this is an [[indexed closed monoidal category]]; in the homotopical version, it would be an [[indexed monoidal (∞,1)-category]].  See those pages for more extensive discussion of the mathematics that takes place in such models that should be internalizable in dependent linear (homotopy) type theory once it exists.

In [[geometry]]/[[topos theory]] such a "linear hyperdoctrine" is known as _[[six operations]] yoga in [[Wirthmüller context|Wirtmüller flavor]]_. In fact there this appears in [[geometric homotopy theory]] ("[[derived functors]] on [[quasicoherent sheaves]]") hence as _dependent linear [[homotopy type theory]]_.

Details (of what?) are written out in ([Vakar 14](#Vakar14)).

+-- {: .num_remark }
###### Remark

That $f^\ast$ is a morphism of [[monoidal categories]] means that it is a [[strong monoidal functor]], preserving the [[tensor product]]

$$
  f^\ast(X\otimes Y)\simeq (f^\ast X)\otimes (f^\ast Y)
  \,.
$$

If monoidal categories involved are [[closed monoidal categories]] then the condition of [[Frobenius reciprocity]] is equivalent to $f^\ast$ also being a [[strong closed functor]] in that it preserves the [[internal hom]]

$$
  f^\ast [X,Y] \simeq [f^\ast X, f^\ast Y]
  \,.
$$

=--

+-- {: .num_defn}
###### Definition (Notation)

In view of the perspective of semantics for type theory, we may omit the notational distinction between contexts and the objects that interpret them, and between dependent sum/product and the functors that interpret them. We will write the [[base change]] as

$$
   \left(
     \underset{f}{\sum}
     \dashv
     f^\ast
     \dashv
     \underset{f}{\prod}
   \right)
    \;\colon\;
   Mod(\Gamma_1)
    \stackrel{\stackrel{f_!}{\longrightarrow}}{\stackrel{\overset{f^\ast}{\longleftarrow}}{\underset{f_\ast}{\longrightarrow}}}
    Mod(\Gamma_2)
  \,.
$$

The statement of [[Frobenius reciprocity]] then equivalently reads like this:

$$
  \underset{f}{\sum}
  \left(
    X \otimes f^\ast Y
  \right)
  \simeq
  \left(
    \underset{f}{\sum} X
  \right)
  \otimes
  Y
  \,.
$$

For $f\colon X\to Y$ a morphism in $\mathcal{C}$, we write

$$
  \epsilon_f
  \colon
  \underset{f}{\sum}f^\ast (-)
  \longrightarrow
  (-)
$$

for the [[counit of an adjunction|adjunction counit]] of $(\sum_f \dashv f^\ast)$.

Notice that $\underset{f}{\sum}$ has the interpretation of summing over all the [[fibers]] of the morphism $f$, as the elements in its [[codomain]] vary. Therefore it is sometime suggestive to use the notation

$$
  \underset{f^{-1}(-)}{\sum}
  \coloneqq
  \underset{f}{\sum}
  \,.
$$

In this vein, for $X \in \mathcal{C}$ any object and $p_X \colon X \to \ast$ the canonical morphism to the [[terminal object]], we abbreviate as

$$
  \underset{X}{\sum}
  \coloneqq
  \underset{p_X}{\sum}
  \,.
$$

=--

### Homotopy version
 {#LinearHomotopyTypeTheory}

This discussion of dependent linear type theory [above](#DependentLinearTypeTheory) has an evident straightforward refinement to [[homotopy theory]]. To appreciate this, notice that the following relation is well established (see again at _[[relation between type theory and category theory]]_ for details):

|  [[syntax]] | [[semantics]] |
|-------------|---------------|
| [[homotopy type theory]]  | [[locally cartesian closed (∞,1)-categories]] |
| [[homotopy type theory]] with [[univalence|univalent]] weak [[type universes]] | [[(∞,1)-toposes]] |

This works very much along the lines of the above relation between [[dependent type theory]] and [[locally cartesian closed categories]]. The central new ingredient is that one requires the locally cartesian closed category $\mathcal{C}$ to be equipped with a suitable structure of a [[model category]]. Using this there is then a notation of [[fibrant replacement]] of morphisms. The key point is that where in [[extensional type theory]] the [[identity type]] $(X \vdash Id_X \colon Type)$ of a type $X$ has semantics given by the [[diagonal]] morphism $\Delta_{[X]} \in \mathcal{C}_{/{[X]}}$, here in [[homotopy type theory]] it has semantics in the [[fibrant replacement]] $\hat \Delta_{[X]} \in \mathcal{C}_{/X}$. Such a fibrant replacement of the diagonal is [[path space object]] of $X$, reflecting the [[equivalences]]/[[homotopies]] "inside" the type $X$.

+-- {: .num_remark }
###### Remark

Since the Grothendieck construction of the standard indexed monoidal $(\infty,1)$-category of parametrized spectra is a [[tangent (∞,1)-toposes]],  one model for linear types depending on other *linear* types might be higher [[jet (∞,1)-category|jet (∞,1)-topos]]. This remains to be thought about.

=--

What should be the [[categorical semantics]] of one kind of dependent linear type theory was discussed in ([Shulman 08](#Shulman08), [Ponto-Shulman 12](#PontoShulman12), [Shulman 12](#Shulman12), [Schreiber 14](#Schreiber14)).

## Related concepts

* [[dependent type theory]], [[linear type theory]]

* [[quantum set]]

* [[classical modality]]

* [[categorical semantics]]:

  [[indexed monoidal (∞,1)-categories]],

  [[tangent (∞,1)-toposes]]

* [[quantum logic]], [[quantum programming]]

* [[parameterized quantum system]]

## References
 {#References}

A [[syntax]] extending [[LF]] with linear dependent types was first published in

* {#Pfenning96} Iliano Cervesato, [[Frank Pfenning]], _A Linear Logical Framework_, 1996, ([web](http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.21.1152))

Note that this framework was restricted to the _negative_ fragment of [[intuitionistic linear logic]] and [[dependent type theory]] (i.e., $\multimap$, $\&$ and $\Pi$).  The problem of extending [[LF]] to positive connectives ($\otimes,1,!,\exists$) while retaining a reasonable notion of [[canonical form]] was later addressed by

* {#WCFW03} Kevin Watkins, Iliano Cervesato, [[Frank Pfenning]], David Walker, _A concurrent logical framework I: Judgments and properties_, CMU technical report CMU-CS-02-101, revised May 2003 ([web](http://www.cs.cmu.edu/~fp/papers/CMU-CS-02-101.pdf))

A dependent linear version of [[system L]] is considered in

* {#Spiwack14} [[Arnaud Spiwack]], section 5 of: _A dissection of L_ (2014) [[pdf](http://assert-false.science/arnaud/papers/A%20dissection%20of%20L.pdf)]

More recent work in the type-theoretic literature includes:

* [[Ugo Dal Lago]], _Linear Dependent Types in a Subrecursive Setting_, in _[Bounded Linear Logic Workshop](https://www.cs.bham.ac.uk/~drg/bll.html)_ Fontainebleau, 2013, [slides](https://www.cs.bham.ac.uk/~drg/bll/dallago.pdf).

* [[Ugo Dal Lago]], M. Gaboardi, _Linear Dependent Types and Relative Completeness-, in _Logical Methods in Computer Science_ Vol. 8(4:11), 2012.

* [[Ugo Dal Lago]] and B. Petit, _Linear dependent types in a call-by-value scenario_, in _Science of Computer Programming 84_, 2014.

* F.N. Forsberg, _Restricted linear dependent types for resource allocation_, in _[Bounded Linear Logic Workshop](https://www.cs.bham.ac.uk/~drg/bll.html)_, Fontainebleau, 2013, [slides](https://www.cs.bham.ac.uk/~drg/bll/fredrik.pdf).

* M. Gaboardi et al., _Linear Dependent Types for Differential Privacy_, in POPL '13, 2013.

Proposals for a genuine [[syntax]] for dependent linear type theory:

* {#SchöppStark04} [[Ulrich Schöpp]], [[Ian Stark]], *A Dependent Type Theory with Names and Binding*, in *Computer Science Logic. CSL 2004*, Lecture Notes in Computer Science **3210** (2004) 235–249 [[doi:10.1007/978-3-540-30124-0_20](https://doi.org/10.1007/978-3-540-30124-0_20), [web](https://homepages.inf.ed.ac.uk/stark/names+binding.html)]

* {#Vakar14} [[Matthijs Vákár]], _Syntax and Semantics of Linear Dependent Types_ ([arXiv:1405.0033](http://arxiv.org/abs/1405.0033))

* {#VakarSlides14} [[Matthijs Vákár]], _Splitting the Atom of Dependent Types... or Linear and Operational Dependent Type Theory_, talk at Oxford, November 2014 ([[VakarLinearAndOperationalDTT.pdf:file]])

* {#Vakar15} [[Matthijs Vákár]], *A Categorical Semantics for Linear Logical Frameworks*, In: A. Pitts  (ed.), *Foundations of Software Science and Computation Structures* FoSSaCS 2015. Lecture Notes in Computer Science, vol 9034. Springer 2015  ([arXiv:1501.05016](https://arxiv.org/abs/1501.05016), [doi:10.1007/978-3-662-46678-0_7](https://doi.org/10.1007/978-3-662-46678-0_7))

* {#Vakar17} [[Matthijs Vákár]], Section 3 of: *In Search of Effectful Dependent Types* ([arXiv:1706.07997](https://arxiv.org/abs/1706.07997), [uuid:e91e19b3-7e10-4fda-9433-f23b469e4049](https://ora.ox.ac.uk/objects/uuid:e91e19b3-7e10-4fda-9433-f23b469e4049))

* {#KPB15} [[Neelakantan Krishnaswami]], [[Pierre Pradic]], [[Nick Benton]], *Integrating Dependent and Linear Types*,  ACM SIGPLAN Notices **50** 1 (2015)  17–30  [[pdf](https://www.cl.cam.ac.uk/~nk480/dlnl-paper.pdf),  [doi:10.1145/2775051.2676969](https://doi.org/10.1145/2775051.2676969)]

* {#Lundfall17} [[Martin Lundfall]], *Models of linear dependent type theory*, 2017 ([[LundfallModelsOfLinerDTT.pdf:file]])

* {#Lundfall18} [[Martin Lundfall]], _A diagram model of linear dependent type theory_ [[arXiv:1806.09593](https://arxiv.org/abs/1806.09593)]

  > (with [[homotopy type theory]]-aspects)

* [[Conor McBride]], *I Got Plenty o’ Nuttin’*, in: *A List of Successes That Can Change the World*, Lecture Notes in Computer Science **9600**, Springer (2016) [[doi:10.1007/978-3-319-30936-1_12](https://doi.org/10.1007/978-3-319-30936-1_12)]

* [[Robert Atkey]], *Syntax and semantics of quantitative type theory*, in *33rd Annual ACM/IEEE Symposium on Logic in Computer Science*, LICS (2018) 56–65 [[doi:10.1145/3209108.3209189](https://dl.acm.org/doi/10.1145/3209108.3209189)]

* [[Mike Shulman]], _A type theory for fibred functors and polynomials_, unfinished note (2018)  [[pdf](http://home.sandiego.edu/~shulman/papers/functors.pdf)]

* [[Benjamin Moon]], [[Harley Eades III]], [[Dominic Orchard]], *Graded Modal Dependent Type Theory*. In: N. Yoshida (ed.) *Programming Languages and Systems ESOP 2021*, Lecture Notes in Computer Science **12648**, Springer (2021) 462-490 [[doi:10.1007/978-3-030-72019-3_17](https://doi.org/10.1007/978-3-030-72019-3_17), [arxiv:2010.13163](https://arxiv.org/abs/2010.13163)]

(Detailed critical discussion of most of these previous proposals is given in [Riley 2022, §1.7](#Riley22Thesis) [p. 90](https://mvr.hosting.nyu.edu/pubs/thesis.pdf#page=90), see also brief comments in [Riley 2022b](#Riley22), [p. 22](https://ncatlab.org/nlab/files/CQTS-InitialResearcherMeeting-Riley-220913.pdf#page=22)).

A satisfactory dependent [[linear homotopy type theory]] is given in

* {#Riley22Thesis} [[Mitchell Riley]], *A Bunched Homotopy Type Theory for Synthetic Stable Homotopy Theory*, PhD Thesis (2022) [[doi:10.14418/wes01.3.139](https://doi.org/10.14418/wes01.3.139), [ir:3269](https://digitalcollections.wesleyan.edu/object/ir%3A3269), [pdf](https://mvr.hosting.nyu.edu/pubs/thesis.pdf)]

  > (using ideas from [[bunched logic]])

based on

* {#RileyFinsterLicata21} [[Mitchell Riley]], [[Eric Finster]], [[Daniel Licata]], *Synthetic Spectra via a Monadic and Comonadic Modality* ([arXiv:2102.04099](https://arxiv.org/abs/2102.04099))

Exposition:

* [[Mitchell Riley]], *Extending Homotopy Type Theory with Linear Type Formers*, talk at *The ForML Lab* (2021)  [[web](https://the-au-forml-lab.github.io/colloquium_talks/Riley.html), [video](https://www.youtube.com/watch?v=sPxtdCtjSDc)]

* {#Riley22} [[Mitchell Riley]], *Linear Homotopy Type Theory*, talk at: [HoTTEST Event for Junior Researchers 2022](https://www.uwo.ca/math/faculty/kapulkin/seminars/hottest_junior_2022.html)  (Jan 2022) [slides: [pdf](https://www.uwo.ca/math/faculty/kapulkin/seminars/hottestfiles/Riley-2022-01-20-HoTTEST.pdf), [[Riley-LHoTT-talk.pdf:file]], video: [YT](https://www.youtube.com/watch?v=o2oWhHabjdM)]

  > **Abstract.** Some ∞-toposes support constructions that are inherently 'linear', such as the external smash product of parameterised spectra. These cannot be added axiomatically to ordinary HoTT, because there is no way to enforce this linearity: there are no restrictions on variable uses. This talk describes an extension of HoTT with linear tensor and hom type formers, as a kind of 'binary modality' and its right adjoint. Trying to stay compatible with existing results in HoTT naturally leads us to a novel kind of bunched dependent type theory. Our type theory is intended to be as human-usable as possible, with an eye towards synthetic stable homotopy theory.

* {#Riley22} [[Mitchell Riley]], *Dependent Type Theories à la Carte*, [talk at](Center+for+Quantum+and+Topological+Systems#RileySep2022) *[[CQTS]] Initial Researcher's Meeting* (Sep 2022) [[[CQTS-InitialResearcherMeeting-Riley-220913.pdf:file]]]

* [[Mitchell Riley]], *[[schreiber:Quantum Certification via Linear Homotopy Types|A Linear Dependent Type Theory with Identity Types as a Quantum Verification Language]]* (2023) [[pdf](https://mvr.hosting.nyu.edu/pubs/translation.pdf), [[Riley-QuantumCertification.pdf:file]]]

  > (translation between `LHoTT` and the proto-[[nLab:Quipper|`Quipper`]] of [Fu, Kishida & Selinger 2020](Quipper#FuKishidaSelinger20))

Potential semantics for dependent linear type theory and linear homotopy type theory are discussed in

* {#Shulman08} [[Mike Shulman]], _Framed bicategories and monoidal fibrations_, in  Theory and Applications of Categories,  Vol. 20, 2008, No. 18, pp 650-738.  ([TAC](http://www.tac.mta.ca/tac/volumes/20/18/20-18abs.html))

* {#PontoShulman12} [[Kate Ponto]], [[Mike Shulman]], _Duality and traces in indexed monoidal categories_, ([arXiv:1211.1555](http://arxiv.org/abs/1211.1555),  [blog](http://golem.ph.utexas.edu/category/2011/11/traces_in_indexed_monoidal_cat.html))

* {#Shulman12} [[Mike Shulman]], _Enriched indexed categories_,([arXiv:1212.3914](http://arxiv.org/abs/1212.3914))

* {#Schreiber14} [[Urs Schreiber]], *[[schreiber:Quantization via Linear homotopy types]]* [[arXiv:1402.7041](http://arxiv.org/abs/1402.7041)]

* [[Hisham Sati]], [[Urs Schreiber]], *[[schreiber:Entanglement of Sections]]* [[arXiv:2309.07245](https://arxiv.org/abs/2309.07245)]

As a [[quantum programming language]]:

* {#FuKishidaSelinger20} [[Peng Fu]], [[Kohei Kishida]], [[Peter Selinger]], _Linear Dependent Type Theory for Quantum Programming Languages_, LICS '20: Proceedings of the 35th Annual ACM/IEEE Symposium on Logic in Computer ScienceJuly 2020 Pages 440–453 ([arXiv:2004.13472](https://arxiv.org/abs/2004.13472), [doi:10.1145/3373718.3394765](https://dl.acm.org/doi/10.1145/3373718.3394765), [pdf](https://depend.cs.uni-saarland.de/lics-icalp/papers/B5.F), [video](https://www.youtube.com/watch?v=GUT8j4V6Nzg))

specifically implemented for [[Quipper]]:

* [[Peng Fu]], [[Kohei Kishida]], [[Neil Ross]], [[Peter Selinger]],  _A Tutorial Introduction to Quantum Circuit Programming in Dependently Typed Proto-Quipper_, in I. Lanese, M. Rawski  (eds.) _Reversible Computation_ RC 2020. Lecture Notes in Computer Science, vol 12227 ([arXiv:2005.08396](https://arxiv.org/abs/2005.08396), [doi:10.1007/978-3-030-52482-1_9](https://doi.org/10.1007/978-3-030-52482-1_9))

and in view of [[linear homotopy type theory]]:

* [[Hisham Sati]], [[Urs Schreiber]], *[[schreiber:The Quantum Monadology]]* [[arXiv:2310.15735](https://arxiv.org/abs/2310.15735)]

[[!redirects dependent linear type theories]]

[[!redirects linear dependent type theory]]
[[!redirects linear dependent type theories]]

[[!redirects linear dependent homotopy type theory]]
[[!redirects linear dependent homotopy type theories]]

[[!redirects dependent linear homotopy type theory]]
[[!redirects dependent linear homotopy type theories]]

[[!redirects linear homotopy type theory]]
[[!redirects linear homotopy type theories]]

[[!redirects linear homotopy-type theory]]
[[!redirects linear homotopy-type theories]]

[[!redirects dependent linear type]]
[[!redirects dependent linear types]]


dependent product

+-- {: .rightHandSide}
+-- {: .toc .clickDown tabindex="0"}
### Context
#### Category theory
+-- {: .hide}
[[!include category theory - contents]]
=--
#### Limits and colimits
+--{: .hide}
[[!include infinity-limits - contents]]
=--
=--
=--

# Dependent products
* table of contents
{: toc}

## Idea

The _dependent product_ is a [[universal construction]] in [[category theory]]. It generalizes the [[internal hom]] to the situation where the codomain may _depend_ on the domain, and [[internalization|internalizes]] indexed [[products]]. Hence it forms _[[sections]]_ of a [[bundle]].

The [[duality|dual]] concept is that of _[[dependent sum]]_.

The concept of [[cartesian product]] of [[sets]] makes sense for any [[family of sets]], while the [[category theory|category-theoretic]] [[product]] makes sense for any family of objects.  In each case, however, the family is indexed by a [[set]]; how can we get a purely category-theoretic product indexed by an object?

First we need to describe a family of objects indexed by an object; it\'s common to interpret this as a [[bundle]], that is an arbitrary morphism $\pi: E \to A$.  (In [[Set]], $A$ would be the index set of the family, and the [[fiber]] of the bundle over an element $x$ of $A$ would be the set indexed by $x$.  Conversely, given a family of sets, $E$ can be constructed as its [[disjoint union]].)

In these terms, the cartesian product of the family of sets is the set $S$ of (global) [[section]]s of the bundle.  This set comes equipped with an evaluation map $ev: S \times A \to E$ such that
$$ S \times A \stackrel{ev}\to E \stackrel{\pi}\to A $$
equals the usual product projection from $S \times A$ to $A$, so $ev$ and $\pi$ are both morphisms in the [[over category]] $Set/A$.  The [[universal property]] of $S$ is that, given any set $T$ and morphism $T \times A \to E$ in $Set/A$, there\'s a unique map $T \to S$ that makes everything commute.

In other words, $S$ and $ev$ define an [[adjoint functor|adjunction]] from $Set$ to $Set/A$ in which taking the product with $A$ is the left adjoint and applying this universal property is the right adjoint.  This is the basis for the definition below, but we add one further level of generality: We realise that $Set$ is secretly $Set/*$, where $*$ is the one-point set (the [[final object]]), and move everything from $Set$ to an arbitrary over category $\mathcal{C}/I$.

## Definitions

Let  $\mathcal{C}$ be a [[category]], and $g\colon B \to A$ a [[morphism]] in $\mathcal{C}$, such that [[pullbacks]] along this morphism exist. These then constitute the [[base change]] [[functor]] between the corresponding [[slice categories]]

$$
  g^* \colon \mathcal{C}_{/A} \to \mathcal{C}_{/B}
  \,.
$$

+-- {: .num_defn}
###### Definition

The **dependent product** along $g$ is, if it exists, the [[right adjoint]] functor $\prod_g \colon \mathcal{C}_{/B} \to \mathcal{C}_{/A}$ to the [[base change]] along $g$

$$
  (g^* \dashv \prod_g)
  \colon
  \mathcal{C}_{/B}
   \stackrel{\overset{g^* }{\leftarrow}}{\underset{\prod_g}{\to}}
  \mathcal{C}_{/A}
  \,.
$$

=--

So a category with all dependent products is necessarily a category with all [[pullbacks]].

## Properties
 {#Properties}

### Relation to spaces of sections
 {#RelationToSpacesOfSections}

+-- {: .num_prop #RelationToSections}
###### Proposition

Let $\mathcal{C}$ be a [[cartesian closed category]] with all [[limit]]s and note that $\mathcal{C}_{/\ast}\cong\mathcal{C}$. Let $X \in C$ be any object and identify it with the terminal morphism $X\to *$. Then the dependent product functor

$$
  \mathcal{C}_{/X}
   \underoverset
       {\underset{\prod_{x \in X}}{\longrightarrow}}
      {\overset{- \times X}{\longleftarrow}}
      {\bot}
  \mathcal{C}
$$

sends [[bundles]] $P \to X$ to their [[space of sections|object of sections]].

$$
  \prod_{x \in X} P_x
    \simeq
  \Gamma_X(P)
    :=
  [X,P] \times_{[X,X]} \{id\}
  \,.
$$

=--

+-- {: .proof}
###### Proof

We check the characterizing [[natural isomorphism]] for the adjunction: For every  $A \in \mathcal{C}$ we have the following sequence of natural isos:

$$
  \begin{aligned}
    \mathcal{C}_{/X}(A \times X, P \to X)
      &=
    \mathcal{C}(A \times X, P ) \times_{\mathcal{C}(A \times X, X)} \{p_2\}
    \\
      & =
      \mathcal{C}(A, [X,P]) \times_{\mathcal{C}(A,[X,X])} \{\tilde p_2\}
     \\
      &=
      \mathcal{C}(A, [X,P] \times_{[X,X]} \{Id\})
     \\
      &=  \mathcal{C}(A, \Gamma_X(P))
  \end{aligned}
  \,.
$$

=--

+-- {: .num_remark}
###### Remark

This statement and its proof remain valid in [[homotopy theory]]. More in detail, if $\mathcal{C}$ is a [[simplicial model category]], $X$, $A$ and $X \times A$ are cofibrant, $P$ and $X$ are fibrant and $P \to X$ is a [[fibration]], then $\Gamma_X(A)$ as above is the homotopy-correct [[derived hom-space|derived section space]].

=--

### Relation to exponential objects / internal homs

As a special case of prop. \ref{RelationToSections} one obtains [[exponential objects]]/[[internal homs]].

Let $\mathcal{C}$ have a [[terminal object]] $* \in \mathcal{C}$. Let $A$ and $X$ in $\mathcal{C}$ be objects and let $A \colon A \to *$ and $X \colon X \to *$ be the terminal morphisms.

+-- {: .num_cor}
###### Corollary

The dependent product along $X$ of the arrow obtained by base change of $A$ along $X$ is the exponential object $[X,A]$:

$$
  \prod_{X} X^* A \simeq [X,A]  \in \mathcal{C}
  \,.
$$

=--

+-- {: .num_remark}
###### Remark

This is essentially a [[categorification|categorified]] version of the familiar fact that the exponentiation $m^n$ of two [[natural numbers]] can be identified with the product $\overset{n}{\overbrace{m\cdot\dots \cdot m}}$ of $n$ copies of $m$.

=--

+-- {: .num_example}
###### Example

Consider the chain of equivalences from $[X,A]$ to $\prod_{X} X^* A$ in [[Set]]: Firstly, the exponential object $[X,A]$ is characterized in $[Y,[X,A]]$ as right adjoint to $[Y\times X,A]$.
Secondly, the elements  $\theta$ of $[Y\times X,A]$ are in turn in bijection with those functions $(y,x)\mapsto (\theta(y,x),x)$ from $[Y\times X,A\times X]$, that leave the second component fixed. The condition just stated is the definition of arrows in the overcategory ${Set}/X$, between the right projections out of $Y\times X$ resp. $A\times X$. If we identify objects $Z\in{Set}$ with their terminal morphisms $Z:Z\to *$ in ${Set}/*$, those two right projections are the pullbacks $X^* Y$ and $X^* A$, respectively. Thirdly, thus, the subset of $[Y\times X,A\times X]$ we are interested in corresponds to $[X^* Y,X^* A]$ in ${Set}/X$. Finally, the right adjoint to $X^*$ is a functor $\prod_{X}$ from ${Set}/X$ to ${Set}/*$, such that $[X^* Y,X^* A]\simeq [Y, \prod_{X} X^* A]$. Hence $\prod_{X} X^* A$ must correspond to $[X,A]$.

=--

### Relation to type theory and quantification in logic

The dependent product is the [[categorical semantics]] of what in [[type theory]] is the [[type formation|formation]] of [[dependent product types]].  Under [[propositions as types]] this corresponds to [[universal quantification]].

[[!include dependent product natural deduction - table]]

## Examples

### In toposes

Dependent products (and sums) exist in any [[topos]]:

+-- {: .un_prop }
###### Proposition

For $C$ a topos and $f : A \to I$ any morphism in $C$, both the left adjoint $\sum_f : C/A \to C/I$ as well as the right adjoint $\prod_f: C/A \to C/I$ to $f^*: C/I \to C/A$ exist.

Moreover, $f^*$ preserves the  [[subobject classifier]] and [[internal hom]]s.
=--

This is ([MacLaneMoerdijk, theorem 2 in section IV, 7](#MacLaneMoerdijk)).

The dependent product plays a role in the definition of [[universe in a topos]].

### Along $\mathbf{B}H \to \mathbf{B}G$
 {#AlongDeloopingsOfGroupHomomorphisms}

For $\mathbf{H}$ an [[(∞,1)-topos]] and $G$ an group object in $\mathbf{H}$ (an [[∞-group]]), then the [[slice (∞,1)-topos]] over its [[delooping]] may be identified with the [[(∞,1)-category]] of $G$-[[∞-actions]] (see there for more):

$$
  Act_G(\mathbf{H}) \simeq \mathbf{H}_{/\mathbf{B}G}
  \,.
$$

Under this identification, then dependent product along a morphism of the form $\mathbf{B}H \to \mathbf{B}G$ (corresponding to an [[∞-group]] homomorphism $H \to G$) corresponds to forming [[coinduced representations]].

### Along $\ast \to \mathbf{B}G$
 {#AlongPointInclusionIntoBG}

As the special case of the [above](#AlongDeloopingsOfGroupHomomorphisms) for $H = 1$ the trivial group we obtain the following:

+-- {: .num_prop #GeneralReduction}
###### Proposition

Let $\mathbf{H}$ be any  [[(∞,1)-topos]] and let $G$ be a group object in $\mathbf{H}$ (an [[∞-group]]). Then the dependent product along the canonical point inclusion

$$
  i \;\colon\; \ast \to \mathbf{B}G
$$

into the [[delooping]] of $G$ takes the following form:

There is a pair of [[adjoint ∞-functors]] of the form

$$
  \mathbf{H}
    \underoverset
      { \underset{\underset{i}{\prod} \simeq [G,-]/G}{\longrightarrow}}
      { \overset{i^\ast \simeq hofib}{\longleftarrow}}
      {\bot}
  \mathbf{H}_{/\mathbf{B}G}
  \,,
$$

where

* $hofib$ denotes the operation of taking the [[homotopy fiber]] of a map to $\mathbf{B}G$ over the canonical basepoint;

* $[G,-]$ denotes the [[internal hom]] in $\mathbf{H}$;

* $[G,-]/G$ denotes the [[homotopy quotient]] by the [[conjugation action|conjugation]] [[∞-action]] for $G$ equipped with its canonical [[∞-action]] by left multiplication and the argument
regarded as equipped with its trivial $G$-$\infty$-action

  (for $G = S^1$ then this is the [[cyclic loop space]] construction).

Hence for

* $\hat X \to X$ a $G$-[[principal ∞-bundle]]

* $A$ a [[coefficient]] object, such as for some [[differential cohomology|differential]] [[generalized cohomology theory]]

then there is a [[natural equivalence]]

$$
  \underset{
    \text{original} \atop \text{fluxes}
  }{
  \underbrace{
    \mathbf{H}(\hat X\;,\; A)
  }
  }
    \;\;
    \underoverset
      {\underset{oxidation}{\longleftarrow}}
      {\overset{reduction}{\longrightarrow}}
      {\simeq}
    \;\;
  \underset{
     \text{doubly} \atop { \text{dimensionally reduced} \atop \text{fluxes} }
  }{
  \underbrace{
    \mathbf{H}(X \;,\; [G,A]/G)
  }
  }
$$

given by

$$
  \left(
     \hat X \longrightarrow A
  \right)
  \;\;\;
    \leftrightarrow
  \;\;\;
  \left(
    \array{
       X && \longrightarrow && [G,A]/G
       \\
       & \searrow && \swarrow
       \\
       && \mathbf{B}G
    }
  \right)
$$

=--

+-- {: .proof #DimensionalReductionAbstractly}
###### Proof

The statement that $i^\ast \simeq hofib$ follows immediately by the definitions. What we need to show is that the [[dependent product]] along $i$ is given as claimed.

To that end, first observe that the [[conjugation action]] on $[G,X]$ is the [[internal hom]] in
the [[(∞,1)-category]] of $G$-[[∞-actions]] $Act_G(\mathbf{H})$.
Under the [[equivalence of (∞,1)-categories]]

$$
  Act_G(\mathbf{H}) \simeq \mathbf{H}_{/\mathbf{B}G}
$$

(from [NSS 12](geometry+of+physics+-+fundamental+super+p-branes#NSS12)) then $G$ with its canonical [[∞-action]] is $(\ast \to \mathbf{B}G)$
and $X$ with the trivial action is $(X \times \mathbf{B}G \to \mathbf{B}G)$.

Hence

$$
  [G,X]/G
    \simeq
  [\ast, X \times \mathbf{B}G]_{\mathbf{B}G}
  \;\;\;\;\;
  \in
   \mathbf{H}_{/\mathbf{B}G}
  \,.
$$

So far this is the very definition of what $[G,X]/G \in \mathbf{H}_{/\mathbf{B}G}$ is to mean in the first place.

But now since the [[slice (∞,1)-topos]] $\mathbf{H}_{/\mathbf{B}G}$ is itself [[cartesian closed (infinity,1)-category|cartesian closed]], via

$$
  E \times_{\mathbf{B}G}(-)
  \;\;\;
   \dashv
  \;\;\;
  [E,-]_{\mathbf{B}G}
$$

it is immediate that
there is the following sequence of [[natural equivalences]]

$$
  \begin{aligned}
   \mathbf{H}_{/\mathbf{B}G}(Y, [G,X]/G)
   & \simeq
   \mathbf{H}_{/\mathbf{B}G}(Y, [\ast, X \times \mathbf{B}G]_{\mathbf{B}G})
   \\
   & \simeq
   \mathbf{H}_{/\mathbf{B}G}(
     Y \times_{\mathbf{B}G} \ast,
     \underset{p^\ast X}{\underbrace{X \times \mathbf{B}G }}
  )
  \\
  & \simeq
  \mathbf{H}(
     \underset{hofib(Y)}{\underbrace{p_!(Y \times_{\mathbf{B}G} \ast)}},
     X
  )
  \\
  & \simeq
  \mathbf{H}(hofib(Y),X)
  \end{aligned}
$$

Here $p \colon \mathbf{B}G \to \ast$ denotes the terminal morphism and $p_! \dashv p^\ast$ denotes the [[base change]] along it.

=--

See also at _[[double dimensional reduction]]_ for more on this.

### Along $V/G \to \mathbf{B}G$

More generally:

+-- {: .num_prop #RightBaseChangeAlongUniversalFiberBundleProjection}
###### Proposition

Let $\mathbf{H}$ be an [[(∞,1)-topos]] and $G \in Grp(\mathbf{H})$ an [[∞-group]].

Let moreover $V \in \mathbf{H}$ be an object equipped with a $G$-[[∞-action]] $\rho$, equivalently (by the discussion there) a [[homotopy fiber sequence]] of the form

$$
  \array{
    V
    \\
    \downarrow
    \\
    V/G & \overset{p_\rho}{\longrightarrow}& \mathbf{B}G
  }
$$

Then

1. pullback along $p_\rho$ is the operation that assigns to a morphism $c \colon X \to \mathbf{B}G$ the $V$-[[fiber ∞-bundle]] which is [[associated ∞-bundle|associated]] via $\rho$ to the $G$-[[principal ∞-bundle]] $P_c$ classified by $c$:

   $$
     (p_\rho)^\ast \;\colon\; c \mapsto P_c \times_G V
   $$

1. the right base change along $p_\rho$ is given on objects of the form $X \times (V/G)$ by

   $$
     (p_\rho)_\ast \;\colon\; X \times (V/G) \;\mapsto\;  [V,X]/G
   $$

=--

+-- {: .proof}
###### Proof

The first statement is [NSS 12, prop. 4.6](https://ncatlab.org/schreiber/show/Principal+%E2%88%9E-bundles+--+theory%2C+presentations+and+applications).

The second statement follows as in the proof of prop. \ref{CyclicLoopSpace}: Let

$$
  \left(
    \array{
      Y
      \\
      \downarrow^{\mathrlap{c}}
      \\
      \mathbf{B}G
    }
  \right)
  \;\in\;
  \mathbf{H}_{/\mathbf{B}G}
$$

be any object, then there is the following sequence of [[natural equivalences]]

$$
  \begin{aligned}
   \mathbf{H}_{/\mathbf{B}G}(Y, [V,X]/G)
   & \simeq
   \mathbf{H}_{/\mathbf{B}G}(Y, [V/G, X \times \mathbf{B}G]_{\mathbf{B}G})
   \\
   & \simeq
   \mathbf{H}_{/\mathbf{B}G}(
     Y \times_{\mathbf{B}G} (V/G),
     \underset{p^\ast X}{\underbrace{X \times \mathbf{B}G }}
  )
  \\
  & \simeq
  \mathbf{H}_{/\mathbf{B}G}
  (
    (p_\rho)_!( P_c \times_G (V/G) ),
    p^\ast X
  )
  \\
  & \simeq
     \mathbf{H}_{/(V/G)}
     (
       P_c \times_G V, (p_\rho)^\ast p^\ast X
     )
  \\
  &
  \simeq
    \mathbf{H}_{/(V/G)}(P_c \times_G V, X \times (V/G))
  \end{aligned}
$$

where again

$$
  p \colon \mathbf{B}G \to \ast
  \,.
$$

=--

+-- {: .num_example #SymmetricPowers}
###### Example
**(symmetric powers)**

Let

$$
  G = \Sigma(n) \in Grp(Set) \hookrightarrow Grp(\infty Grpd) \overset{LConst}{\longrightarrow} \mathbf{H}
$$

be the [[symmetric group]] on $n$ elements, and

$$
  V = \{1, \cdots, n\} \in Set \hookrightarrow \infty Grpd \overset{LConst}{\longrightarrow} \mathbf{H}
$$

the $n$-element [[set]] ([[h-set]]) equipped with the canonical $\Sigma(n)$-[[action]]. Then prop. \ref{RightBaseChangeAlongUniversalFiberBundleProjection} says that right base change of any $p_\rho^\ast p^\ast X$ along

$$
  \{1, \cdots, n\}/\Sigma(n)
    \longrightarrow
  \mathbf{B}\Sigma(n)
$$

is equivalently the $n$th [[symmetric power]] of $X$

$$
 [\{1,\cdots, n\},X]/\Sigma(n)
  \simeq
  (X^n)/\Sigma(n)
  \,.
$$

=--

## Related concepts

* [[product]], [[coproduct]]

* [[sink]], [[cosink]]

* [[Kan extension]]

* [[internal limit]]

* [[base change]]

  * [[dependent sum]], **dependent product**

  * [[dependent sum type]], [[dependent product type]]

  * [[necessity]], [[possibility]], [[reader monad]], [[writer comonad]]

## References

Standard textbook accounts include section A1.5.3 of

* [[Peter Johnstone]], _[[Sketches of an Elephant]]_
 {#Johnstone}

and section IV of

* [[Saunders MacLane]], [[Ieke Moerdijk]], _[[Sheaves in Geometry and Logic]]_
  {#MacLaneMoerdijk}

[[!redirects dependent product]]
[[!redirects dependent products]]


dependent product natural deduction - table

The [[inference rules]] for [[dependent function types]] (aka "dependent product types" or "$\Pi$-types"):

\begin{imagefromfile}
    "file_name": "DependentFunctionTypeInference-230215.jpg",
    "width": 770,
    "unit": "px",
    "margin": {
        "top": -30,
        "bottom": 20,
        "right": 0,
        "left": 10
    }
\end{imagefromfile}


dependent product type

+-- {: .rightHandSide}
+-- {: .toc .clickDown tabindex="0"}
### Context
#### Type theory
+-- {: .hide}
[[!include type theory - contents]]
=--
=--
=--

# Dependent product types
* table of contents
{: toc}

## Idea

In [[dependent type theory]], a _dependent product type_ $\prod_{x\colon A} B(x)$, for a [[dependent type]] $x\colon A\vdash B(x)\colon Type$ is the [[type]] of "dependently typed [[functions]]" assigning to each $x\colon A$ an element of $B(x)$.

In a [[model]] of the type theory in [[categorical semantics]], this is a [[dependent product]].  In [[set theory]], it is an element of an indexed product.

It includes [[function types]] as the special case when $B$ is not dependent on $A$, [[product types]] as a special case when $A$ is the type of [[Booleans]], and [[dependent sequence types]] as a special case when $A$ is the [[natural numbers type]].

## Overview

[[!include dependent product natural deduction - table]]

## Definition

Like any type constructor in type theory, a dependent 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.

The [[type formation rule]] for dependent product type is:

$$\frac{A\colon Type \qquad x\colon A \vdash B(x) \colon Type}{\prod_{x\colon A} B(x)\colon Type}$$

### As a negative type

Dependent product types are almost always defined as [[negative types]].  In this presentation, primacy is given to the eliminators.  The natural eliminator of a dependent product type says that we can *apply* it to any input:

$$\frac{f\colon \prod_{x\colon A} B(x) \qquad a\colon A}{f(a) \colon B(a)}$$

The constructor is then determined as usual for a negative type: to construct a term of $\prod_{x\colon A} B(x)$, we have to specify how it behaves when applied to any input.  In other words, we should have a term of type $B(x)$ containing a free variable $x\colon A$.  This yields the usual "$\lambda$-abstraction" constructor:

$$\frac{x\colon A\vdash b\colon B(x)}{\lambda x.b\colon \prod_{x\colon A} B(x)}$$

The [[beta-reduction]] rule is the obvious one, saying that when we evaluate a $\lambda$-abstraction, we do it by substituting for the bound variable.

$$(\lambda x.b)(a) \;\to_\beta\; b[a/x]$$

If we want an [[eta-conversion]] rule, the natural one says that every dependently typed function is a $\lambda$-abstraction:

$$ \lambda x.f(x) \;\to_\eta\; f$$

### As a positive type

It is also possible to present dependent product types as a [[positive type]].  However, this requires a stronger metatheory, such as a [[logical framework]].  We use the same constructor ($\lambda$-abstraction), but now the eliminator says that to define an operation using a function, it suffices to say what to do in the case that that function is a lambda abstraction.

$$\frac{(x\colon A \vdash b\colon B(x)) \vdash c\colon C \qquad f\colon \prod_{x\colon A} B(x)}{funsplit(c,f)\colon C}$$

This rule cannot be formulated in the usual presentation of type theory, since it involves a "higher-order judgment": the context of the term $c\colon C$ involves a "term of type $B(x)$ containing a free variable $x\colon A$".  However, it is possible to make sense of it.  In [[dependent type theory]], we need additionally to allow $C$ to depend on $\prod_{x\colon A} B(x)$.

The natural $\beta$-reduction rule for this eliminator is

$$ funsplit(c, \lambda x.g) \;\to_\beta c[g/b] $$

and its $\eta$-conversion rule looks something like

$$ funsplit(c[\lambda x.b / g], f) \;\to_\eta\; c[f/g]. $$

Here $g\colon \prod_{x\colon A} B(x) \vdash c\colon C$ is a term containing a free variable of type $\prod_{x\colon A} B(x)$.  By substituting $\lambda x.b$ for $g$, we obtain a term of type $C$ which depends on "a term $b\colon B(x)$ containing a free variable $x\colon A$".  We then apply the positive eliminator at $f\colon \prod_{x\colon A} B(x)$, and the $\eta$-rule says that this can be computed by just substituting $f$ for $g$ in $c$.

### Positive versus negative

As usual, the positive and negative formulations are equivalent in a suitable sense.  They have the same constructor, while we can formulate the eliminators in terms of each other:

$$
\begin{aligned}
  f(a) &\coloneqq funsplit(b[a/x], f)\\
  funsplit(c, f) &\coloneqq c[f(x)/b]
\end{aligned}
$$

The conversion rules also correspond.

In dependent type theory, this definition of $funsplit$ only gives us a properly typed dependent eliminator if the negative dependent product type satisfies $\eta$-conversion.  As usual, if it satisfies [propositional eta-conversion](/nlab/show/eta-conversion#Propositional) then we can transport along that instead---and conversely, the dependent eliminator allows us to prove propositional $\eta$-conversion.  This is the content of Propositions 3.5, 3.6, and 3.7 in [(Garner)](#GarnerSDP).

### Dependent product types a la Russell and a la Tarski

In [[dependent type theory]], there are two different ways to interpret the term $f:\prod_{x:A} B(x)$:

1. $f$ is literally a family of terms in the family of types $B(x)$ indexed by $A$

1. $f$ is a term representation for a family of terms in the family of types $B(x)$ indexed by $A$

This situation is similar to how there are two notions of [[type universe]] where [[small types]] of a universe are interpreted [[Russell universe|a la Russell]], literally as types, or [[Tarski universe|a la Tarski]], as a term representation of types. Thus, in analogy to type universes, we can refer to dependent product types *a la Russell* and function types *a la Tarski*.

Dependent product types a la Russell and a la Tarski are expressed respectively via the [[elimination rule]] of function types:

* given type $A$ and the type family $x:A \vdash B(x)$ and an element $f:\prod_{x:A} B(x)$, one could form the family of terms $x:A \vdash f(x):B$

$$\frac{\Gamma \vdash A \; \mathrm{type} \quad \Gamma, x:A \vdash B(x) \; \mathrm{type} \quad \Gamma \vdash f:\prod_{x:A} B(x)}{\Gamma, x:A \vdash f(x):B(x)}$$

* given type $A$ and the type family $x:A \vdash B(x)$ one could form the family of terms $f:\prod_{x:A} B(x), x:A \vdash \mathrm{eval}(f, x):B(x)$

$$\frac{\Gamma \vdash A \; \mathrm{type} \quad \Gamma, x:A \vdash B(x) \; \mathrm{type}}{\Gamma, f:\prod_{x:A} B(x), x:A \vdash \mathrm{eval}(f, x):B(x)}$$

Dependent product types a la Tarski corresponds to the notion of [[dependent product]] in [[category theory]] where the dependent product $\Pi(A, B)$ literally comes with a morphism $\mathrm{eval}:\Pi(A, B) \times A \to \Sigma(A, B)$ in the [[slice category]] $C/A$, but dependent product types a la Russell are the one most commonly used in [[dependent type theory]].

The conversion rules for dependent product types a la Russell are as follows:

$$\frac{\Gamma \vdash A \; \mathrm{type} \quad \Gamma, x:A \vdash B(x) \; \mathrm{type} \quad \Gamma, x:A \vdash b(x):B(x)}{\Gamma, x:A \vdash (\lambda x:A.b(x))(x) \equiv b(x):B(x)}$$

$$\frac{\Gamma \vdash A \; \mathrm{type} \quad \Gamma, x:A \vdash B(x) \; \mathrm{type} \quad \Gamma \vdash f:\prod_{x:A} B(x)}{\Gamma \vdash f \equiv \lambda x:A.f(x):\prod_{x:A} B(x)}$$

and the conversion rules for dependent product types a la Tarski are as follows:

$$\frac{\Gamma \vdash A \; \mathrm{type} \quad \Gamma, x:A \vdash B(x) \; \mathrm{type} \quad \Gamma, x:A \vdash b(x):B(x)}{\Gamma, x:A \vdash \mathrm{eval}(\lambda x:A.b(x), x) \equiv b(x):B(x)}$$

$$\frac{\Gamma \vdash A \; \mathrm{type} \quad \Gamma, x:A \vdash B(x) \; \mathrm{type}}{\Gamma, f:\prod_{x:A} B(x) \vdash f \equiv \lambda x:A.\mathrm{eval}(f, x):\prod_{x:A} B(x)}$$

For the rest of the article we shall assume the use of dependent product types a la Russell.

### Weak and strict dependent product types

In [[dependent type theory]], **weak dependent product types** are dependent product types for which the [[computation rules]] ($\beta$-conversion) and [[uniqueness rules]] ($\eta$-conversion) are propositional rather than judgmental:

$$\frac{\Gamma \vdash A \; \mathrm{type} \quad \Gamma, x:A \vdash B(x) \; \mathrm{type} \quad \Gamma, x:A \vdash b(x):B(x)}{\Gamma, a:A \vdash \beta_{A \to B}^{x:A.b(x)}(a):(\lambda(x:A).b(x))(a) =_{B(x)} b(a)}$$

$$\frac{\Gamma \vdash A \; \mathrm{type} \quad \Gamma, x:A \vdash B(x) \; \mathrm{type}}{\Gamma, f:\prod_{x:A} B(x) \vdash \eta_{A \to B}(f):f =_{\prod_{x:A} B(x)} \lambda(x:A).f(x)}$$

Weak dependent product types appear in [[weak type theories]].

This contrasts with **strict dependent product types** which use judgmental computation and uniqueness rules:

$$\frac{\Gamma \vdash A \; \mathrm{type} \quad \Gamma, x:A \vdash B(x) \; \mathrm{type} \quad \Gamma, x:A \vdash b(x):B(x)}{\Gamma, a:A \vdash (\lambda(x:A).b(x))(a) \equiv b(a):B(x)}$$

$$\frac{\Gamma \vdash A \; \mathrm{type} \quad \Gamma, x:A \vdash B(x) \; \mathrm{type}}{\Gamma, f:\prod_{x:A} B(x) \vdash f \equiv \lambda(x:A).f(x):\prod_{x:A} B(x)}$$

Strict dependent product types appear in most dependent type theories such as [[Martin-Löf type theory]], [[observational type theory]], and [[cubical type theory]].

For strict dependent product types, the judgmental computation and uniqueness rules automatically imply the propositional computation and uniqueness rules, as by the rules for [[judgmental equality]] and [[identity types]], judgmental equality of two terms always implies propositional equality of the two terms.

### In terms of function types

Given a [[dependent type theory]] with [[function types]], [[dependent sum types]], and [[identity types]], the dependent product type of a type family $B(x)$ indexed by $x:A$ can be defined as the type of functions $f:A \to \sum_{x:A} B(x)$ from $A$ to the dependent sum type $\sum_{x:A} B(x)$ such that the composite of $f$ with the first projection function $\pi_1:\left(\sum_{x:A} B(x)\right) \to A$ is the [[identity function]] on $A$

$$\prod_{x:A} B(x) \coloneqq \sum_{f:A \to \sum_{x:A} B(x)} \lambda x:A.\pi_1(f(x)) =_{A \to A} \mathrm{id}_A$$

The underlying family of elements is then given by the composite of $f:A \to \sum_{x:A} B(x)$ with the second projection function of the dependent sum type:

$$x:A \vdash \pi_2(f(x)):B(x)$$

Similarly, given a family of elements $x:A \vdash b(x):B(x)$, one could construct the function

$$\lambda x:A.(x, b(x)):A \to \sum_{x:A} B(x)$$

such that given $x:A$, $\pi_1(\lambda x:A.(x, b(x))(x)) \equiv x$. By lambda abstraction, one has

$$\lambda x:A.\pi_1(\lambda x:A.(x, b(x))(x)) \equiv \mathrm{id}_A$$

and so the dependent function is given by

$$(\lambda x:A.(x, b(x)), \mathrm{refl}_{A \to A}(\mathrm{id}_A)):\sum_{f:A \to \sum_{x:A} B(x)} \lambda x:A.\pi_1(f(x)) =_{A \to A} \mathrm{id}_A$$

One also has $\pi_2(\lambda x:A.(x, b(x))(x)) \equiv b(x)$ which is the associated computation rule for dependent function types. Meanwhile, from the judgmental $\eta$-conversion rules for negative dependent sum types and function types, one could prove the judgmental $\eta$-conversion rule for dependent function types. Given
$$f:\sum_{f:A \to \sum_{x:A} B(x)} \lambda x:A.\pi_1(f(x)) =_{A \to A} \mathrm{id}_A$$
one has
$$f \equiv (\lambda x:A.(x, \pi_2(f(x))), \pi_2(f))$$

### As types of dependent anafunctions

In the same way that one could define [[equivalence types]] as types of [[one-to-one correspondences]] and [[function types]] as types of [[anafunctions]], one could define dependent function types as types of [[dependent anafunctions]]. This requires both [[identity types]] and [[heterogeneous identity types]] being defined first, which we shall write as $a =_A b$ and $x =_{B}^{p} y$ respectively for $a:A$, $b:A$, $p:a =_A b$, $x:B(a)$, and $y:B(b)$. We use Agda notation $(x:A) \to B(x)$ for dependent function types rather than the dependent product type notation $\prod_{x:A} B(x)$ or $\Pi(x:A).B(x)$ in this section.

Rules for dependent function types
$$\frac{\Gamma \vdash A \; \mathrm{type} \quad \Gamma, x:A \vdash B(x) \; \mathrm{type}}{\Gamma \vdash (x:A) \to B(x) \; \mathrm{type}} \qquad \frac{\Gamma \vdash A \; \mathrm{type} \quad \Gamma, x:A \vdash B(x) \; \mathrm{type}}{\Gamma, f:(x:A) \to B(x), x:A, y:B(x) \vdash \mathcal{F}_{A, B}(f, x, y) \; \mathrm{type}}$$

$$\frac{\Gamma \vdash A \; \mathrm{type} \quad \Gamma, x:A \vdash B(x) \; \mathrm{type} \quad \Gamma, x:A \vdash f(x):B(x)}{\Gamma \vdash \lambda x.f(x):(x:A) \to B(x)}$$

$$\frac{\Gamma \vdash A \; \mathrm{type} \quad \Gamma, x:A \vdash B(x) \; \mathrm{type} \quad \Gamma, x:A \vdash f(x):B(x)}{\Gamma, x:A \vdash \alpha(x):\mathcal{F}_{A, B}(\lambda x.f(x), x, f(x))}$$

$$\frac{\Gamma \vdash A \; \mathrm{type} \quad \Gamma, x:A \vdash B(x) \; \mathrm{type}}{\Gamma, f:(x:A) \to B(x), x:A \vdash \mathrm{ev}(f, x):B(x)}$$

$$\frac{\Gamma \vdash A \; \mathrm{type} \quad \Gamma, x:A \vdash B(x) \; \mathrm{type}}{\Gamma, f:(x:A) \to B(x), x:A \vdash \beta(f, x):\mathcal{F}_{A, B}(f, x, \mathrm{ev}(f, x))}$$

$$\frac{\Gamma \vdash A \; \mathrm{type} \quad \Gamma, x:A \vdash B(x) \; \mathrm{type}}{\Gamma, f:(x:A) \to B(x), x:A, y:B(x), u:\mathcal{F}_{A, B}(f, x, y) \vdash \kappa(f, x, y, u):\mathrm{ev}(f, x) =_{B(x)} y}$$

$$\frac{\Gamma \vdash A \; \mathrm{type} \quad \Gamma, x:A \vdash B(x) \; \mathrm{type}}{\Gamma, f:(x:A) \to B(x), x:A, y:B(x), u:\mathcal{F}_{A, B}(f, x, y) \vdash \eta(f, x, y, u):\beta(f, x) =_{\mathcal{F}_{A, B}(f, x)}^{\kappa(f, x, y, u)} u}$$

By the rules for [[dependent pair types]] and [[dependent function types]], one could derive that

$$\frac{\Gamma \vdash A \; \mathrm{type} \quad \Gamma, x:A \vdash B(x) \; \mathrm{type}}{\Gamma, f:(x:A) \to B(x) \vdash \eta(f):(x:A) \to \mathrm{isContr}\left((y:B) \times \mathcal{F}_{A, B}(f, x, y)\right)}$$

which is precisely the statement that $\mathcal{F}_{A, B}(f)$ is a [[dependent anafunction]] for all dependent functions $f:(x:A) \to B(x)$.

## Properties

### Universal property of dependent product types

The **universal property of dependent product types** states that for all types $A$ and type families $x:A \vdash B(x)$, there is a family of functions

$$\pi_A:\prod_{x:A} \left(\prod_{x:A} B(x)\right) \to B(x)$$

such that for any other type $C$ and family of functions $f:\prod_{x:A} C \to B(x)$, there is a unique function $c:C \to \prod_{x:A} B(x)$ such that

$$\prod_{x:A} \prod_{y:C} \pi_A(x)(c(y)) =_{B(x)} f(x)(y)$$

If there is a [[type universe]] $U$, then one could wrap this into a single [[axiom]].

$$\mathrm{up}_{A, B}:\prod_{C:U} \prod_{f:\prod_{x:A} C \to B(x)} \exists!c:C \to \prod_{x:A} B(x).\prod_{x:A} \prod_{y:C} \pi_A(x)(c(y)) =_{B(x)} f(x)(y)$$

### Typal computation and uniqueness rules

The typal computation rule for function types is provable from the other four typal type formers of function types. Given type $A$, type family $x:A \vdash B(x)$ and dependent function $f:\prod_{x:A} B(x)$, we have, by the elimination rule and the introduction rule, a dependent function $\lambda x:A.f(x):\prod_{x:A} B(x)$, which by the uniqueness rules of dependent product types are equal to each other
$$\eta_{\prod_{x:A} B(x)}(f):f =_{\prod_{x:A} B(x)} \lambda x:A.f(x)$$
By the inductively defined function $\mathrm{idtohomotopy}$ which takes [[identifications]] between dependent functions to [[homotopies]] between dependent functions, we have that
$$\mathrm{idtohomotopy}(f, \lambda x:A.f(x))(\eta_{\prod_{x:A} B(x)}(f)):\prod_{x:A} f(x) =_{B(x)} (\lambda x:A.f(x))(x)$$
which is the typal computation rule for dependent function types.

### Typal congruence rules

These are called *typal congruence rules* because they are the analogue of the judgmental [[congruence rules]] which use [[identity types]] and [[weak equivalence types]] instead of [[judgmental equality]].

#### Strict dependent product types

Since [[dependent product types]] are negative types, we first present the typal congruence rule for the elimination rule of dependent product types

\begin{theorem}
Given a type $A$ and a type family $x:A \vdash B(x)$, dependent functions $f:\prod_{x:A} B(x)$ and $g:\prod_{x:A} B(x)$ and an identification $p:f =_{\prod_{x:A} B(x)} g$ there are families of identifications $x:A \vdash \mathrm{compelim}(f, g, p)(x):f(x) =_{B(x)} g(x)$.
\end{theorem}

\begin{proof}
We simply define the dependent function $\mathrm{compelim}$ to be happly, which is inductively defined on [[identity types]].
\end{proof}

The next is the typal congruence rule for the introduction rule of dependent function types. However, unlike the case for the other two rules, one needs dependent function extensionality.

\begin{theorem}
Assuming dependent [[function extensionality]], given type $A$ and family of types $x:A \vdash B(x)$, families of elements $x:A \vdash b(x):B(x)$ and $x:A \vdash b'(x):B(x)$, and families of [[identifications]] $x:A \vdash p(x):b(x) =_{B(x)} b'(x)$, there is a identification
$$\mathrm{congintro}_{x:A.p(x)}:\lambda (x:A).b(x) =_{\prod_{x:A} B(x)} \lambda (x:A).b'(x)$$
\end{theorem}

\begin{proof}
By the computation rule of strict dependent function types, there are families of judgmental equalities

$$x:A \vdash ((\lambda x:A.b(x))(x) \equiv b(x):B(x)$$
$$x:A \vdash ((\lambda x:A.b'(x))(x) \equiv b'(x):B(x)$$

Thus, by the [[structural rules]] of [[judgmental equality]], there are families of identifications

$$x:A \vdash p(x):(\lambda x:A.b(x))(x) =_{B(x)} (\lambda x:A.b'(x))(x)$$

and by $\lambda$-abstraction, one gets the dependent function

$$\lambda (x:A).p(x):\prod_{x:A} (\lambda x:A.b(x))(x) =_{B(x)} (\lambda x:A.b'(x))(x)$$

By dependent [[function extensionality]], there is an [[equivalence of types]]

$$\mathrm{ext}_{\prod_{x:A} B(x)}^{-1}:(\lambda x:A.b(x)) =_{\prod_{x:A} B(x)} (\lambda x:A.b'(x)) \simeq \prod_{x:A} (\lambda x:A.b(x))(x) =_{B(x)} (\lambda x:A.b'(x))(x)$$

which yields an identification

$$\mathrm{ext}_{\prod_{x:A} B(x)}^{-1}^{-1}(\lambda (x:A).p(x)):(\lambda x:A.b(x)) =_{\prod_{x:A} B(x)} (\lambda x:A.b'(x))$$

We define

$$\mathrm{congintro}_{x:A.p(x)} \coloneqq \mathrm{ext}_{\prod_{x:A} B(x)}^{-1}^{-1}(\lambda (x:A).p(x)):(\lambda x:A.b(x)) =_{\prod_{x:A} B(x)} (\lambda x:A.b'(x))$$
\end{proof}

Finally, we present the typal congruence rule for the formation rule of function types, which relies upon the previous two results. The theorem and proof differs significantly whether one uses [[strict equivalences of types]] or some notion of [[weak equivalences of types]].

##### Using strict equivalences of types

\begin{theorem}
Given types $A$ and $A'$ and type families $x:A \vdash B(x)$, $x:A' \vdash B'(x)$ and [[strict equivalence]] $e_A:A \simeq A'$ and dependent function $e_B:\prod_{x:A} B(x) \simeq B'(e_A(x))$ consisting of a family of strict equivalences, there is a strict equivalence
$$\mathrm{congform}(e_A, e_B):\left(\prod_{x:A} B(x)\right) \simeq \left(\prod_{x:A'} B'(x)\right)$$
\end{theorem}

\begin{proof}
Since for [[strict equivalences]] $e_A:A \simeq A'$, we have judgmental equalities $e_A(e_A^{-1}(x)) \equiv x:A'$ and $e_A^{-1}(e_A(x)) \equiv x:A$, so we do not need to transport across [[identifications]]. Instead, we define the function
$$\mathrm{congform}(e_A, e_B):\left(\prod_{x:A} B(x)\right) \to \left(\prod_{x:A'} B'(x)\right)$$
by
$$\mathrm{congform}(e_A, e_B) \coloneqq \lambda (f:\prod_{x:A} B(x)).\lambda x:A'.e_B(e_A^{-1}(x))(f(e_A^{-1}(x)))$$

and the inverse function by

$$\mathrm{congform}(e_A, e_B)^{-1} \coloneqq \lambda (f:\prod_{x:A'} B'(x)).\lambda x:A.e_B(x)^{-1}(f(e_A(x)))$$

Now it suffices to construct judgmental equalities

$$f:\prod_{x:A} B(x) \vdash \mathrm{congform}(e_A, e_B)^{-1}(\mathrm{congform}(e_A, e_B)(f)) \equiv f:\prod_{x:A} B(x)$$

$$g:\prod_{x:A'} B'(x) \vdash \mathrm{congform}(e_A, e_B)(\mathrm{congform}(e_A, e_B)^{-1}(g)) \equiv g:\prod_{x:A'} B'(x)$$

from where it implies that $\mathrm{congform}(e_A, e_B)$ is thus a [[strict equivalence]].

By definition, we have
$$\mathrm{congform}(e_A, e_B)^{-1}(\mathrm{congform}(e_A, e_B)(f)) \equiv \lambda x:A.e_B(x)^{-1}((\lambda x:A'.e_B(e_A^{-1}(x))(f(e_A^{-1}(x))) )(e_A(x)))$$

and by the computation rules of strict dependent product types, we have

$$(\lambda x:A'.e_B(e_A^{-1}(x))(f(e_A^{-1}(x))) )(e_A(x)) \equiv e_B(e_A^{-1}(e_A(x)))(f(e_A^{-1}(e_A(x))))$$

and because $e_A$ is a strict equivalence, we have

$$e_B(e_A^{-1}(e_A(x)))(f(e_A^{-1}(e_A(x)))) \equiv e_B(x)(f(x))$$

By the congrunence rules for substitution of judgmental equality, we have

$$\lambda x:A.e_B(x)^{-1}((\lambda x:A'.e_B(e_A^{-1}(x))(f(e_A^{-1}(x))) )(e_A(x))) \equiv \lambda x:A.e_B(x)^{-1}(e_B(x)(f(x)))$$

Since for all $x:A$ each $e_B(x)$ is also a strict equiality, we have

$$e_B(x)^{-1}(e_B(x)(f(x))) \equiv f(x)$$

by the congruence rules for subsitution of judgmental equality, we have

$$\lambda x:A.e_B(x)^{-1}(e_B(x)(f(x))) \equiv \lambda x:A.f(x)$$

and by the uniqueness rule of dependent function types we have

$$\lambda x:A.f(x) \equiv f$$

thus by the transitive rule for judgmental equality we have

$$\mathrm{congform}(e_A, e_B)^{-1}(\mathrm{congform}(e_A, e_B)(f)) \equiv f$$

for all $f:\prod_{x:A} B(x)$

Similarly, by definition, we have
$$\mathrm{congform}(e_A, e_B)(\mathrm{congform}(e_A, e_B)^{-1}(f)) \equiv \lambda x:A'.e_B(e_A^{-1}(x))(( \lambda x:A.e_B(x)^{-1}(f(e_A(x))) )(e_A^{-1}(x)))$$

and by the computation rules for strict dependent product types, we have

$$( \lambda x:A.e_B(x)^{-1}(f(e_A(x))) )(e_A^{-1}(x)) \equiv e_B(e_A^{-1}(x))^{-1}(f(e_A(e_A^{-1}(x))))$$

and because $e_A$ is a strict equivalence, we have

$$e_B(e_A^{-1}(x))^{-1}(f(e_A(e_A^{-1}(x)))) \equiv e_B(e_A^{-1}(x))^{-1}(f(x))$$

By the congrunence rules for substitution of judgmental equality, we have

$$\lambda x:A'.e_B(e_A^{-1}(x))(( \lambda x:A.e_B(x)^{-1}(f(e_A(x))) )(e_A^{-1}(x))) \equiv \lambda x:A'.e_B(e_A^{-1}(x))(e_B(e_A^{-1}(x))^{-1}(f(x)))$$

Since for all $x:A$ each $e_B(x)$ is also a strict equiality, we have

$$e_B(e_A^{-1}(x))(e_B(e_A^{-1}(x))^{-1}(f(x))) \equiv f(x)$$

by the congruence rules for subsitution of judgmental equality, we have

$$\lambda x:A'.e_B(e_A^{-1}(x))(e_B(e_A^{-1}(x))^{-1}(f(x))) \equiv \lambda x:A'.f(x)$$

and by the uniqueness rule of dependent function types we have

$$\lambda x:A.f(x) \equiv f$$

thus by the transitive rule for judgmental equality we have

$$\mathrm{congform}(e_A, e_B)(\mathrm{congform}(e_A, e_B)^{-1}(f)) \equiv f$$

for all $f:\prod_{x:A'} B'(x)$.

Since we have functions

$$\mathrm{congform}(e_A, e_B):\left(\prod_{x:A} B(x)\right) \to \left(\prod_{x:A'} B'(x)\right)$$

$$\mathrm{congform}(e_A, e_B)^{-1}:\left(\prod_{x:A'} B'(x)\right) \to \left(\prod_{x:A} B(x)\right)$$

and families of judgmental equalities

$$f:\prod_{x:A} B(x) \vdash \mathrm{congform}(e_A, e_B)^{-1}(\mathrm{congform}(e_A, e_B)(f)) \equiv f:\prod_{x:A} B(x)$$

$$g:\prod_{x:A'} B'(x) \vdash \mathrm{congform}(e_A, e_B)(\mathrm{congform}(e_A, e_B)^{-1}(g)) \equiv g:\prod_{x:A'} B'(x)$$

we could form the strict equivalence

$$\mathrm{toEquiv}(\mathrm{congform}(e_A, e_B), \mathrm{congform}(e_A, e_B)^{-1}):\left(\prod_{x:A'} B'(x)\right) \simeq \left(\prod_{x:A} B(x)\right)$$

By a common abuse of notation we denote the strict equivalence by the same name as the underlying function $\mathrm{congform}(e_A, e_B)$; thus we have
$$\mathrm{congform}(e_A, e_B):\left(\prod_{x:A} B(x)\right) \simeq \left(\prod_{x:A'} B'(x)\right)$$
\end{proof}

##### Using weak equivalences of types

\begin{theorem}
Given types $A$ and $A'$ and type families $x:A \vdash B(x)$, $x:A' \vdash B'(x)$ and equivalence $e_A:A \simeq A'$ and dependent function $e_B:\prod_{x:A} B(x) \simeq B'(e_A(x))$, there is an equivalence
$$\mathrm{congform}(e_A, e_B):\left(\prod_{x:A} B(x)\right) \simeq \left(\prod_{x:A'} B'(x)\right)$$
\end{theorem}

\begin{proof}
We define the function
$$\mathrm{congform}(e_A, e_B):\left(\prod_{x:A} B(x)\right) \to \left(\prod_{x:A'} B'(x)\right)$$
by
$$\mathrm{congform}(e_A, e_B) \coloneqq \lambda (f:\prod_{x:A} B(x)).\lambda x:A'.\mathrm{transport}_{x:A'.B'(x)}(e_A(e_A^{-1}(x)), x, \mathrm{sec}_{e_A}(x), e_B(e_A^{-1}(x))(f(e_A^{-1}(x))))$$

and the inverse function by

$$\mathrm{congform}(e_A, e_B)^{-1} \coloneqq \lambda (f:\prod_{x:A'} B'(x)).\lambda x:A.e_B(x)^{-1}(f(e_A(x)))$$

where the equivalence $e_A:A \simeq A'$ has families of identifications
$$x':A \vdash \mathrm{sec}_{e_A}(x):e_A(e_A^{-1}(x)) =_{A'} x$$
$$x:A \vdash \mathrm{ret}_{e_A}(x):e_A^{-1}(e_A(x)) =_A x$$
witnessing that $e_A^{-1}$ is a [[section]] and [[retraction]] of $e_A$ respectively.

Now it suffices to construct families of identifications

$$f:\prod_{x:A} B(x) \vdash \mathrm{ret}_{\mathrm{congform}(e_A, e_B)}(f):\mathrm{congform}(e_A, e_B)^{-1}(\mathrm{congform}(e_A, e_B)(f)) =_{\prod_{x:A} B(x)} f$$

$$g:\prod_{x:A'} B'(x) \vdash \mathrm{sec}_{\mathrm{congform}(e_A, e_B)}(g):\mathrm{congform}(e_A, e_B)(\mathrm{congform}(e_A, e_B)^{-1}(g)) =_{\prod_{x:A'} B'(x)} g$$

from where it implies that $\mathrm{congform}(e_A, e_B)$ has a coherent inverse and contractible fibers and is thus an [[equivalence of types]].

----

By definition,
$$\mathrm{congform}(e_A, e_B)^{-1}(\mathrm{congform}(e_A, e_B)(f)) \equiv \lambda x:A.e_B(x)^{-1}((\lambda x:A'.\mathrm{transport}_{x:A'.B'(x)}(e_A(e_A^{-1}(x)), x, \mathrm{sec}_{e_A}(x), e_{B'}(e_A^{-1}(x))(f(e_A^{-1}(x)))))(e_A(x)))$$

By the computation rules of strict dependent function types, there is a family of judgmental equalities
$$x:A \vdash (\lambda x:A'.\mathrm{transport}_{x:A'.B'(x)}(e_A(e_A^{-1}(x)), x, \mathrm{sec}_{e_A}(x), e_B(e_A^{-1}(x))(f(e_A^{-1}(x)))))(e_A(x)) \equiv \mathrm{transport}_{x:A'.B'(x)}(e_A(e_A^{-1}(e_A(x))), e_A(x), \mathrm{sec}_{e_A}(e_A(x)), e_B(e_A^{-1}(x))(f(e_A^{-1}(e_A(x)))))$$
and thus by the structural rules of [[judgmental equalities]] and the judgmental congruence rules for dependent function types, a judgmental equality
$$\mathrm{congform}(e_A, e_B)^{-1}(\mathrm{congform}(e_A, e_B)(f)) \equiv \lambda x:A.e_B(x)^{-1}(\mathrm{transport}_{x:A'.B'(x)}(e_A(e_A^{-1}(e_A(x))), e_A(x), \mathrm{sec}_{e_A}(e_A(x)), e_B(e_A^{-1}(e_A(x)))(f(e_A^{-1}(e_A(x))))))$$

In addition, the equivalence $e_A:A \simeq A'$ has the coherence condition
$$\mathrm{coh}_{e_A}(x):\mathrm{sec}_{e_A}(e_A(x)) =_{e_A(e_A^{-1}(e_A(x))) =_{A'} e_A(x)} \mathrm{ap}_{e_A}(e_A^{-1}(e_A(x)), x, \mathrm{ret}_{e_A}(x))$$

So we have the family of elements

$$x:A \vdash \mathrm{transport}_{x:A'.B'(x)}(e_A(e_A^{-1}(e_A(x))), e_A(x), \mathrm{sec}_{e_A}(e_A(x)), e_B(e_A^{-1}(e_A(x)))(f(e_A^{-1}(e_A(x))))):B'(e_A(x))$$

and by applying the function

$$\lambda p:e_A(e_A^{-1}(e_A(x))) =_{A'} e_A(x).\mathrm{transport}_{x:A'.B'(x)}(e_A(e_A^{-1}(e_A(x))), e_A(x), p, e_B(e_A^{-1}(e_A(x)))(f(e_A^{-1}(e_A(x)))))$$
across $\mathrm{coh}_{e_A}(x)$ one gets the family of identifications

$$x:A \vdash \mathrm{ap}_{\lambda p:e_A(e_A^{-1}(e_A(x))) =_{A'} e_A(x).\mathrm{transport}_{x:A'.B'(x)}(e_A(e_A^{-1}(e_A(x))), e_A(x), p, e_B(e_A^{-1}(e_A(x)))(f(e_A^{-1}(e_A(x)))))}(\mathrm{sec}_{e_A}(e_A(x)), \mathrm{ap}_{e_A}(e_A^{-1}(e_A(x)), x, \mathrm{ret}_{e_A}(x)), \mathrm{coh}_{e_A}(x)$$

in type

$$\mathrm{transport}_{x:A'.B'(x)}(e_A(e_A^{-1}(e_A(x))), e_A(x), \mathrm{sec}_{e_A}(e_A(x)), e_B(e_A^{-1}(e_A(x)))(f(e_A^{-1}(e_A(x))))) =_{B'(e_A(x)} \mathrm{transport}_{x:A'.B'(x)}(e_A(e_A^{-1}(e_A(x))), e_A(x), \mathrm{ap}_{e_A}(e_A^{-1}(e_A(x)), x, \mathrm{ret}_{e_A}(x)), e_B(e_A^{-1}(e_A(x)))(f(e_A^{-1}(e_A(x)))))$$

From the family of elements

$$x:A \vdash \mathrm{transport}_{x:A'.B'(x)}(e_A(e_A^{-1}(e_A(x))), e_A(x), \mathrm{ap}_{e_A}(e_A^{-1}(e_A(x)), x, \mathrm{ret}_{e_A}(x)), e_B(e_A^{-1}(e_A(x)))(f(e_A^{-1}(e_A(x))))):B(e_A(x))$$

one could define the family of dependent functions

$$x:A \vdash \lambda y:A.\lambda p:y =_A x.\mathrm{transport}_{x:A'.B'(x)}(e_A(y), e_A(x), \mathrm{ap}_{e_A}(y, x, p), e_B(y)(f(y))):\left(\sum_{y:A} y =_A x\right) \to B(e_A(x))$$

This means by applying the above dependent function
to $e_A^{-1}(e_A(x))$, $\mathrm{ret}_{e_A}(x)$, $x$, $\mathrm{refl}_A(x)$, $\mathrm{ret}_{e_A}(x)$, and $\mathrm{apd}_{y:A.y =_A x}(e_A^{-1}(e_A(x)), x, \mathrm{ret}_{e_A}(x), \mathrm{ret}_{e_A}(x), \mathrm{refl}_A(x))$, one gets the family of identifications

$$x:A \vdash \mathrm{apbinary}_{\lambda y:A.\lambda p:y =_A x.\mathrm{transport}_{x:A'.B'(x)}(e_A(y), e_A(x), \mathrm{ap}_{e_A}(y, x, p), e_B(y)(f(y)))}(e_A^{-1}(e_A(x)), \mathrm{ret}_{e_A}(x), x, \mathrm{refl}_A(x), \mathrm{ret}_{e_A}(x), \mathrm{apd}_{y:A.y =_A x}(e_A^{-1}(e_A(x)), x, \mathrm{ret}_{e_A}(x), \mathrm{ret}_{e_A}(x), \mathrm{refl}_A(x))$$

in type

$$\mathrm{transport}_{x:A'.B'(x)}(e_A(e_A^{-1}(e_A(x))), e_A(x), \mathrm{ap}_{e_A}(e_A^{-1}(e_A(x)), x, \mathrm{ret}_{e_A}(x)), e_B(e_A^{-1}(e_A(x)))(f(e_A^{-1}(e_A(x))))) =_{B(e_A(x))} \mathrm{transport}_{x:A'.B'(x)}(e_A(x), e_A(x), \mathrm{ap}_{e_A}(x, x, \mathrm{refl}_A(x)), e_B(x)(f(x)))$$

By the judgmental computation rules of identity types, we have $\mathrm{ap}_{e_A}(x, x, \mathrm{refl}_A(x)) \equiv \mathrm{refl}_{A'}(e_A(x))$, which means that we have

$$\mathrm{transport}_{x:A'.B'(x)}(e_A(x), e_A(x), \mathrm{ap}_{e_A}(x, x, \mathrm{refl}_A(x)), e_B(x)(f(x))) \equiv \mathrm{transport}_{x:A'.B'(x)}(e_A(x), e_A(x), \mathrm{refl}_{A'}(e_A(x)), e_B(x)(f(x)))$$

and we have

$$\mathrm{transport}_{x:A'.B'(x)}(e_A(x), e_A(x), \mathrm{refl}_{A'}(e_A(x)), e_B(x)(f(x))) \equiv e_B(x)(f(x))$$

Thus by concatenation we have identification

$$
\begin{array}{c}
\mathrm{ap}_{\lambda p:e_A(e_A^{-1}(e_A(x))) =_{A'} e_A(x).\mathrm{transport}_{x:A'.B'(x)}(e_A(e_A^{-1}(e_A(x))), e_A(x), p, e_B(e_A^{-1}(e_A(x)))(f(e_A^{-1}(e_A(x)))))}(\mathrm{sec}_{e_A}(e_A(x)), \mathrm{ap}_{e_A}(e_A^{-1}(e_A(x)), x, \mathrm{ret}_{e_A}(x)), \mathrm{coh}_{e_A}(x) \\
\bullet \mathrm{apbinary}_{\lambda y:A.\lambda p:y =_A x.\mathrm{transport}_{x:A'.B'(x)}(e_A(y), e_A(x), \mathrm{ap}_{e_A}(y, x, p), e_B(y)(f(y)))}(e_A^{-1}(e_A(x)), \mathrm{ret}_{e_A}(x), x, \mathrm{refl}_A(x), \mathrm{ret}_{e_A}(x), \mathrm{apd}_{y:A.y =_A x}(e_A^{-1}(e_A(x)), x, \mathrm{ret}_{e_A}(x), \mathrm{ret}_{e_A}(x), \mathrm{refl}_A(x))
\end{array}
$$

in type

$$\mathrm{transport}_{x:A'.B'(x)}(e_A(e_A^{-1}(e_A(x))), e_A(x), \mathrm{sec}_{e_A}(e_A(x)), e_B(e_A^{-1}(e_A(x)))(f(e_A^{-1}(e_A(x))))) =_{B'(e_A(x))} e_B(x)(f(x))$$

and by application of $e_B(x)^{-1}$ to the above identification, we have

$$
\begin{array}{c}
\mathrm{ap}_{e_B(x)^{-1}}(\mathrm{transport}_{x:A'.B'(x)}(e_A(e_A^{-1}(e_A(x))), e_A(x), \mathrm{sec}_{e_A}(e_A(x)), e_B(e_A^{-1}(e_A(x)))(f(e_A^{-1}(e_A(x))))), e_B(x)(f(x)), \\
\mathrm{ap}_{\lambda p:e_A(e_A^{-1}(e_A(x))) =_{A'} e_A(x).\mathrm{transport}_{x:A'.B'(x)}(e_A(e_A^{-1}(e_A(x))), e_A(x), p, e_B(e_A^{-1}(e_A(x)))(f(e_A^{-1}(e_A(x)))))}(\mathrm{sec}_{e_A}(e_A(x)), \mathrm{ap}_{e_A}(e_A^{-1}(e_A(x)), x, \mathrm{ret}_{e_A}(x)), \mathrm{coh}_{e_A}(x) \\
\bullet \mathrm{apbinary}_{\lambda y:A.\lambda p:y =_A x.\mathrm{transport}_{x:A'.B'(x)}(e_A(y), e_A(x), \mathrm{ap}_{e_A}(y, x, p), e_B(y)(f(y)))}(e_A^{-1}(e_A(x)), \mathrm{ret}_{e_A}(x), x, \mathrm{refl}_A(x), \mathrm{ret}_{e_A}(x), \mathrm{apd}_{y:A.y =_A x}(e_A^{-1}(e_A(x)), x, \mathrm{ret}_{e_A}(x), \mathrm{ret}_{e_A}(x), \mathrm{refl}_A(x))
\end{array}
$$

in type

$$e_B(x)^{-1}(\mathrm{transport}_{x:A'.B'(x)}(e_A(e_A^{-1}(e_A(x))), e_A(x), \mathrm{sec}_{e_A}(e_A(x)), e_B(e_A^{-1}(e_A(x)))(f(e_A^{-1}(e_A(x)))))) =_{B(x)} e_B(x)^{-1}(e_B(x)(f(x)))$$

Similarly, The family of equivalences
$$x:A \vdash e_B(x):B(x) \simeq B'(e_A(x))$$
has a family of identifications
$$x:A, y:B(x) \vdash \mathrm{ret}_{e_B}(x, y):e_B(x)^{-1}(e_B(x)(y)) =_{B(x)} y$$
witnessing that $e_B(x)^{-1}$ is a [[retraction]] of $e_B(x)$ for each $x:A$.

By substituting $f(x)$ in for $y$ we get the family of identifications

$$x:A \vdash \mathrm{ret}_{e_B}(x, f(x)):e_B(x)^{-1}(e_B(x)(f(x))) =_{B(x)} f(x)$$

and thus the family of identifications

$$
\begin{array}{c}
\mathrm{ap}_{e_B(x)^{-1}}(\mathrm{transport}_{x:A'.B'(x)}(e_A(e_A^{-1}(e_A(x))), e_A(x), \mathrm{sec}_{e_A}(e_A(x)), e_B(e_A^{-1}(e_A(x)))(f(e_A^{-1}(e_A(x))))), e_B(x)(f(x)), \\
\mathrm{ap}_{\lambda p:e_A(e_A^{-1}(e_A(x))) =_{A'} e_A(x).\mathrm{transport}_{x:A'.B'(x)}(e_A(e_A^{-1}(e_A(x))), e_A(x), p, e_B(e_A^{-1}(e_A(x)))(f(e_A^{-1}(e_A(x)))))}(\mathrm{sec}_{e_A}(e_A(x)), \mathrm{ap}_{e_A}(e_A^{-1}(e_A(x)), x, \mathrm{ret}_{e_A}(x)), \mathrm{coh}_{e_A}(x) \\
\bullet \mathrm{apbinary}_{\lambda y:A.\lambda p:y =_A x.\mathrm{transport}_{x:A'.B'(x)}(e_A(y), e_A(x), \mathrm{ap}_{e_A}(y, x, p), e_B(y)(f(y)))}(e_A^{-1}(e_A(x)), \mathrm{ret}_{e_A}(x), x, \mathrm{refl}_A(x), \mathrm{ret}_{e_A}(x), \mathrm{apd}_{y:A.y =_A x}(e_A^{-1}(e_A(x)), x, \mathrm{ret}_{e_A}(x), \mathrm{ret}_{e_A}(x), \mathrm{refl}_A(x)) \\
\bullet \mathrm{ret}_{e_B}(x, f(x))
\end{array}
$$

in type

$$e_B(x)^{-1}(\mathrm{transport}_{x:A'.B'(x)}(e_A(e_A^{-1}(e_A(x))), e_A(x), \mathrm{sec}_{e_A}(e_A(x)), e_B(e_A^{-1}(e_A(x)))(f(e_A^{-1}(e_A(x)))))) =_{B(x)} f(x)$$

and the dependent function

$$
\begin{array}{c}
\lambda x:A.\mathrm{ap}_{e_B(x)^{-1}}(\mathrm{transport}_{x:A'.B'(x)}(e_A(e_A^{-1}(e_A(x))), e_A(x), \mathrm{sec}_{e_A}(e_A(x)), e_B(e_A^{-1}(e_A(x)))(f(e_A^{-1}(e_A(x))))), e_B(x)(f(x)), \\
\mathrm{ap}_{\lambda p:e_A(e_A^{-1}(e_A(x))) =_{A'} e_A(x).\mathrm{transport}_{x:A'.B'(x)}(e_A(e_A^{-1}(e_A(x))), e_A(x), p, e_B(e_A^{-1}(e_A(x)))(f(e_A^{-1}(e_A(x)))))}(\mathrm{sec}_{e_A}(e_A(x)), \mathrm{ap}_{e_A}(e_A^{-1}(e_A(x)), x, \mathrm{ret}_{e_A}(x)), \mathrm{coh}_{e_A}(x) \\
\bullet \mathrm{apbinary}_{\lambda y:A.\lambda p:y =_A x.\mathrm{transport}_{x:A'.B'(x)}(e_A(y), e_A(x), \mathrm{ap}_{e_A}(y, x, p), e_B(y)(f(y)))}(e_A^{-1}(e_A(x)), \mathrm{ret}_{e_A}(x), x, \mathrm{refl}_A(x), \mathrm{ret}_{e_A}(x), \mathrm{apd}_{y:A.y =_A x}(e_A^{-1}(e_A(x)), x, \mathrm{ret}_{e_A}(x), \mathrm{ret}_{e_A}(x), \mathrm{refl}_A(x)) \\
\bullet \mathrm{ret}_{e_B}(x, f(x))
\end{array}
$$

in type

$$\prod_{x:A} e_B(x)^{-1}(\mathrm{transport}_{x:A'.B'(x)}(e_A(e_A^{-1}(e_A(x))), e_A(x), \mathrm{sec}_{e_A}(e_A(x)), e_B(e_A^{-1}(e_A(x)))(f(e_A^{-1}(e_A(x)))))) =_{B(x)} f(x)$$

By dependent function extensionality, we get the identification

$$
\begin{array}{c}
\mathrm{ext}_{\prod_{x:A} B(x)}^{-1}(\lambda x:A.\mathrm{ap}_{e_B(x)^{-1}}(\mathrm{transport}_{x:A'.B'(x)}(e_A(e_A^{-1}(e_A(x))), e_A(x), \mathrm{sec}_{e_A}(e_A(x)), e_B(e_A^{-1}(e_A(x)))(f(e_A^{-1}(e_A(x))))), e_B(x)(f(x)), \\
\mathrm{ap}_{\lambda p:e_A(e_A^{-1}(e_A(x))) =_{A'} e_A(x).\mathrm{transport}_{x:A'.B'(x)}(e_A(e_A^{-1}(e_A(x))), e_A(x), p, e_B(e_A^{-1}(e_A(x)))(f(e_A^{-1}(e_A(x)))))}(\mathrm{sec}_{e_A}(e_A(x)), \mathrm{ap}_{e_A}(e_A^{-1}(e_A(x)), x, \mathrm{ret}_{e_A}(x)), \mathrm{coh}_{e_A}(x) \\
\bullet \mathrm{apbinary}_{\lambda y:A.\lambda p:y =_A x.\mathrm{transport}_{x:A'.B'(x)}(e_A(y), e_A(x), \mathrm{ap}_{e_A}(y, x, p), e_B(y)(f(y)))}(e_A^{-1}(e_A(x)), \mathrm{ret}_{e_A}(x), x, \mathrm{refl}_A(x), \mathrm{ret}_{e_A}(x), \mathrm{apd}_{y:A.y =_A x}(e_A^{-1}(e_A(x)), x, \mathrm{ret}_{e_A}(x), \mathrm{ret}_{e_A}(x), \mathrm{refl}_A(x)) \\
\bullet \mathrm{ret}_{e_B}(x, f(x)))
\end{array}
$$

in type

$$\lambda x:A.e_B(x)^{-1}(\mathrm{transport}_{x:A'.B'(x)}(e_A(e_A^{-1}(e_A(x))), e_A(x), \mathrm{sec}_{e_A}(e_A(x)), e_B(e_A^{-1}(e_A(x)))(f(e_A^{-1}(e_A(x)))))) =_{\prod_{x:A} B(x)} f$$

and since we defined

$$\mathrm{congform}(e_A, e_B)^{-1}(\mathrm{congform}(e_A, e_B)(f)) \equiv \lambda x:A.e_B(x)^{-1}(\mathrm{transport}_{x:A'.B'(x)}(e_A(e_A^{-1}(e_A(x))), e_A(x), \mathrm{sec}_{e_A}(e_A(x)), e_B(e_A^{-1}(e_A(x)))(f(e_A^{-1}(e_A(x))))))$$

we have

$$
\begin{array}{c}
\mathrm{ext}_{\prod_{x:A} B(x)}^{-1}(\lambda x:A.\mathrm{ap}_{e_B(x)^{-1}}(\mathrm{transport}_{x:A'.B'(x)}(e_A(e_A^{-1}(e_A(x))), e_A(x), \mathrm{sec}_{e_A}(e_A(x)), e_B(e_A^{-1}(e_A(x)))(f(e_A^{-1}(e_A(x))))), e_B(x)(f(x)), \\
\mathrm{ap}_{\lambda p:e_A(e_A^{-1}(e_A(x))) =_{A'} e_A(x).\mathrm{transport}_{x:A'.B'(x)}(e_A(e_A^{-1}(e_A(x))), e_A(x), p, e_B(e_A^{-1}(e_A(x)))(f(e_A^{-1}(e_A(x)))))}(\mathrm{sec}_{e_A}(e_A(x)), \mathrm{ap}_{e_A}(e_A^{-1}(e_A(x)), x, \mathrm{ret}_{e_A}(x)), \mathrm{coh}_{e_A}(x) \\
\bullet \mathrm{apbinary}_{\lambda y:A.\lambda p:y =_A x.\mathrm{transport}_{x:A'.B'(x)}(e_A(y), e_A(x), \mathrm{ap}_{e_A}(y, x, p), e_B(y)(f(y)))}(e_A^{-1}(e_A(x)), \mathrm{ret}_{e_A}(x), x, \mathrm{refl}_A(x), \mathrm{ret}_{e_A}(x), \mathrm{apd}_{y:A.y =_A x}(e_A^{-1}(e_A(x)), x, \mathrm{ret}_{e_A}(x), \mathrm{ret}_{e_A}(x), \mathrm{refl}_A(x)) \\
\bullet \mathrm{ret}_{e_B}(x, f(x))):\mathrm{congform}(e_A, e_B)^{-1}(\mathrm{congform}(e_A, e_B)(f)) =_{\prod_{x:A} B(x)} f
\end{array}
$$

We can define the witness that $\mathrm{congform}(e_A, e_B)^{-1}$ is a [[retraction]] of $\mathrm{congform}(e_A, e_B)$ as

$$
\begin{array}{c}
\mathrm{ret}_{\mathrm{congform}(e_A, e_B)}(f) \coloneqq \\
\mathrm{ext}_{\prod_{x:A} B(x)}^{-1}(\lambda x:A.\mathrm{ap}_{e_B(x)^{-1}}(\mathrm{transport}_{x:A'.B'(x)}(e_A(e_A^{-1}(e_A(x))), e_A(x), \mathrm{sec}_{e_A}(e_A(x)), e_B(e_A^{-1}(e_A(x)))(f(e_A^{-1}(e_A(x))))), e_B(x)(f(x)), \\
\mathrm{ap}_{\lambda p:e_A(e_A^{-1}(e_A(x))) =_{A'} e_A(x).\mathrm{transport}_{x:A'.B'(x)}(e_A(e_A^{-1}(e_A(x))), e_A(x), p, e_B(e_A^{-1}(e_A(x)))(f(e_A^{-1}(e_A(x)))))}(\mathrm{sec}_{e_A}(e_A(x)), \mathrm{ap}_{e_A}(e_A^{-1}(e_A(x)), x, \mathrm{ret}_{e_A}(x)), \mathrm{coh}_{e_A}(x) \\
\bullet \mathrm{apbinary}_{\lambda y:A.\lambda p:y =_A x.\mathrm{transport}_{x:A'.B'(x)}(e_A(y), e_A(x), \mathrm{ap}_{e_A}(y, x, p), e_B(y)(f(y)))}(e_A^{-1}(e_A(x)), \mathrm{ret}_{e_A}(x), x, \mathrm{refl}_A(x), \mathrm{ret}_{e_A}(x), \mathrm{apd}_{y:A.y =_A x}(e_A^{-1}(e_A(x)), x, \mathrm{ret}_{e_A}(x), \mathrm{ret}_{e_A}(x), \mathrm{refl}_A(x)) \\
\bullet \mathrm{ret}_{e_B}(x, f(x))):\mathrm{congform}(e_A, e_B)^{-1}(\mathrm{congform}(e_A, e_B)(f)) =_{\prod_{x:A} B(x)} f
\end{array}
$$

----

Similarly, by definition,
$$\mathrm{congform}(e_A, e_B)(\mathrm{congform}(e_A, e_B)^{-1}(f)) \equiv \lambda x:A'.\mathrm{transport}_{x:A'.B'(x)}(e_A(e_A^{-1}(x)), x, \mathrm{sec}_{e_A}(x), e_B(e_A^{-1}(x))(( \lambda x:A.e_B(x)^{-1}(f(e_A(x))) )(e_A^{-1}(x))))$$

By the computation rules of strict dependent function types, there is a family of judgmental equalities
$$x:A \vdash (\lambda x:A.e_B(x)^{-1}(f(e_A(x))))(e_A^{-1}(x)) \equiv e_B(e_A^{-1}(x))^{-1}(f(e_A(e_A^{-1}(x))))$$
and thus by the structural rules of [[judgmental equalities]] and the judgmental congruence rules for dependent function types, a judgmental equality
$$\lambda x:A'.\mathrm{transport}_{x:A'.B'(x)}(e_A(e_A^{-1}(x)), x, \mathrm{sec}_{e_A}(x), e_B(e_A^{-1}(x))((\lambda x:A.e_B(x)^{-1}(f(e_A(x))) )(e_A^{-1}(x)))) \equiv \lambda x:A'.\mathrm{transport}_{x:A'.B'(x)}(e_A(e_A^{-1}(x)), x, \mathrm{sec}_{e_A}(x), e_B(e_A^{-1}(x))(e_B(e_A^{-1}(x))^{-1}(f(e_A(e_A^{-1}(x))))))$$

From the family of elements

$$x:A' \vdash \mathrm{transport}_{x:A'.B'(x)}(e_A(e_A^{-1}(x)), x, \mathrm{sec}_{e_A}(x), e_B(e_A^{-1}(x))(e_B(e_A^{-1}(x))^{-1}(f(e_A(e_A^{-1}(x))))))$$

one could define the family of dependent functions

$$x:A' \vdash \lambda y:A.\lambda p:y =_A x.\mathrm{transport}_{x:A'.B'(x)}(y), x, p, e_B(e_A^{-1}(x))(e_B(e_A^{-1}(x))^{-1}(f(y))))$$

This means by applying the above dependent function
to $e_A(e_A^{-1}(x))$, $\mathrm{sec}_{e_A}(x)$, $x$, $\mathrm{refl}_A(x)$, $\mathrm{sec}_{e_A}(x)$, and $\mathrm{apd}_{y:A.y =_A x}(e_A(e_A^{-1}(x)), x, \mathrm{sec}_{e_A}(x), \mathrm{sec}_{e_A}(x), \mathrm{refl}_A(x))$, one gets the family of identifications

$$x:A' \vdash \mathrm{apbinary}_{\lambda y:A.\lambda p:y =_A x.\mathrm{transport}_{x:A'.B'(x)}(y), x, p, e_B(e_A^{-1}(x))(e_B(e_A^{-1}(x))^{-1}(f(y))))}(e_A(e_A^{-1}(x)), \mathrm{sec}_{e_A}(x), x, \mathrm{refl}_A(x), \mathrm{sec}_{e_A}(x), \mathrm{apd}_{y:A.y =_A x}(e_A(e_A^{-1}(x)), x, \mathrm{sec}_{e_A}(x), \mathrm{sec}_{e_A}(x), \mathrm{refl}_A(x)))$$

in type

$$\mathrm{transport}_{x:A'.B'(x)}(e_A(e_A^{-1}(x)), x, \mathrm{sec}_{e_A}(x), e_B(e_A^{-1}(x))(e_B(e_A^{-1}(x))^{-1}(f(e_A(e_A^{-1}(x)))))) =_{B'(x)} \mathrm{transport}_{x:A'.B'(x)}(x, x, \mathrm{refl}_A(x), e_B(e_A^{-1}(x))(e_B(e_A^{-1}(x))^{-1}(f(x))))$$

By the judgmental computation rules of identity types, we have

$$\mathrm{transport}_{x:A'.B'(x)}(x, x, \mathrm{refl}_A(x), e_B(e_A^{-1}(x))(e_B(e_A^{-1}(x))^{-1}(f(x)))) \equiv e_B(e_A^{-1}(x))(e_B(e_A^{-1}(x))^{-1}(f(x)))$$

Similarly, The family of equivalences
$$x:A \vdash e_B(x):B(x) \simeq B'(e_A(x))$$
has a family of identifications
$$x:A, y:B'(e_A(x)) \vdash \mathrm{sec}_{e_B}(x, y):e_B(x)(e_B(x)^{-1}(y)) =_{B(x)} y$$
witnessing that $e_B(x)^{-1}$ is a [[section]] of $e_B(x)$ for each $x:A$.

By substituting $f(e_A(e_A^{-1}(x)))$ in for $y$ and $e_A^{-1}(x)$ in for $x$ in the above expression we get the family of identifications

$$x:A' \vdash \mathrm{sec}_{e_B}(e_A^{-1}(x), f(e_A(e_A^{-1}(x)))):e_B(e_A^{-1}(x))(e_B(e_A^{-1}(x))^{-1}(f(e_A(e_A^{-1}(x))))) =_{B'(e_A(e_A^{-1}(x)))} f(e_A(e_A^{-1}(x)))$$

and by transport across $\mathrm{sec}_{e_A}(x)$ we get

$$x:A' \vdash \mathrm{transport}_{z:A'.e_B(x)(e_B(x)^{-1}(f(z))) =_{B'(z)} f(z)}(e_A(e_A^{-1}(x)), x, \mathrm{sec}_{e_A}(x), \mathrm{sec}_{e_B}(e_A^{-1}(x), f(e_A(e_A^{-1}(x))))):e_B(e_A^{-1}(x))(e_B(e_A^{-1}(x))^{-1}(f(x))) =_{B'(x)} f(x)$$

By concatenation of identifications we get

$$
\begin{array}{c}
\mathrm{apbinary}_{\lambda y:A.\lambda p:y =_A x.\mathrm{transport}_{x:A'.B'(x)}(y), x, p, e_B(e_A^{-1}(x))(e_B(e_A^{-1}(x))^{-1}(f(y))))}(e_A(e_A^{-1}(x)), \mathrm{sec}_{e_A}(x), x, \mathrm{refl}_A(x), \mathrm{sec}_{e_A}(x), \mathrm{apd}_{y:A.y =_A x}(e_A(e_A^{-1}(x)), x, \mathrm{sec}_{e_A}(x), \mathrm{sec}_{e_A}(x), \mathrm{refl}_A(x))) \\
\bullet \mathrm{transport}_{z:A'.e_B(x)(e_B(x)^{-1}(f(z))) =_{B'(z)} f(z)}(e_A(e_A^{-1}(x)), x, \mathrm{sec}_{e_A}(x), \mathrm{sec}_{e_B}(e_A^{-1}(x), f(e_A(e_A^{-1}(x)))))
\end{array}
$$

in type

$$\mathrm{transport}_{x:A'.B'(x)}(e_A(e_A^{-1}(x)), x, \mathrm{sec}_{e_A}(x), e_B(e_A^{-1}(x))(e_B(e_A^{-1}(x))^{-1}(f(e_A(e_A^{-1}(x)))))) =_{B'(x)} f(x)$$

and by $\lambda$-abstraction we get

$$
\begin{array}{c}
\lambda x:A'.\mathrm{apbinary}_{\lambda y:A.\lambda p:y =_A x.\mathrm{transport}_{x:A'.B'(x)}(y), x, p, e_B(e_A^{-1}(x))(e_B(e_A^{-1}(x))^{-1}(f(y))))}(e_A(e_A^{-1}(x)), \mathrm{sec}_{e_A}(x), x, \mathrm{refl}_A(x), \mathrm{sec}_{e_A}(x), \mathrm{apd}_{y:A.y =_A x}(e_A(e_A^{-1}(x)), x, \mathrm{sec}_{e_A}(x), \mathrm{sec}_{e_A}(x), \mathrm{refl}_A(x))) \\
\bullet \mathrm{transport}_{z:A'.e_B(x)(e_B(x)^{-1}(f(z))) =_{B'(z)} f(z)}(e_A(e_A^{-1}(x)), x, \mathrm{sec}_{e_A}(x), \mathrm{sec}_{e_B}(e_A^{-1}(x), f(e_A(e_A^{-1}(x)))))
\end{array}
$$

in type

$$\prod_{x:A'} \mathrm{transport}_{x:A'.B'(x)}(e_A(e_A^{-1}(x)), x, \mathrm{sec}_{e_A}(x), e_B(e_A^{-1}(x))(e_B(e_A^{-1}(x))^{-1}(f(e_A(e_A^{-1}(x)))))) =_{B'(x)} f(x)$$

By dependent function extensionality, we get the identification

$$
\begin{array}{c}
\mathrm{ext}_{\prod_{x:A} B(x)}^{-1}(\lambda x:A'. \\
\mathrm{apbinary}_{\lambda y:A.\lambda p:y =_A x.\mathrm{transport}_{x:A'.B'(x)}(y), x, p, e_B(e_A^{-1}(x))(e_B(e_A^{-1}(x))^{-1}(f(y))))}(e_A(e_A^{-1}(x)), \mathrm{sec}_{e_A}(x), x, \mathrm{refl}_A(x), \mathrm{sec}_{e_A}(x), \mathrm{apd}_{y:A.y =_A x}(e_A(e_A^{-1}(x)), x, \mathrm{sec}_{e_A}(x), \mathrm{sec}_{e_A}(x), \mathrm{refl}_A(x))) \\
\bullet \mathrm{transport}_{z:A'.e_B(x)(e_B(x)^{-1}(f(z))) =_{B'(z)} f(z)}(e_A(e_A^{-1}(x)), x, \mathrm{sec}_{e_A}(x), \mathrm{sec}_{e_B}(e_A^{-1}(x), f(e_A(e_A^{-1}(x))))))
\end{array}
$$

in type

$$\lambda x:A'.\mathrm{transport}_{x:A'.B'(x)}(e_A(e_A^{-1}(x)), x, \mathrm{sec}_{e_A}(x), e_B(e_A^{-1}(x))(e_B(e_A^{-1}(x))^{-1}(f(e_A(e_A^{-1}(x)))))) =_{\prod_{x:A'} B'(x)} f$$

and since we defined

$$\mathrm{congform}(e_A, e_B)(\mathrm{congform}(e_A, e_B)^{-1}(f)) \equiv \lambda x:A'.\mathrm{transport}_{x:A'.B'(x)}(e_A(e_A^{-1}(x)), x, \mathrm{sec}_{e_A}(x), e_B(e_A^{-1}(x))(( \lambda x:A.e_B(x)^{-1}(f(e_A(x))) )(e_A^{-1}(x))))$$

we have

$$
\begin{array}{c}
\mathrm{ext}_{\prod_{x:A} B(x)}^{-1}(\lambda x:A'. \\
\mathrm{apbinary}_{\lambda y:A.\lambda p:y =_A x.\mathrm{transport}_{x:A'.B'(x)}(y), x, p, e_B(e_A^{-1}(x))(e_B(e_A^{-1}(x))^{-1}(f(y))))}(e_A(e_A^{-1}(x)), \mathrm{sec}_{e_A}(x), x, \mathrm{refl}_A(x), \mathrm{sec}_{e_A}(x), \mathrm{apd}_{y:A.y =_A x}(e_A(e_A^{-1}(x)), x, \mathrm{sec}_{e_A}(x), \mathrm{sec}_{e_A}(x), \mathrm{refl}_A(x))) \\
\bullet \mathrm{transport}_{z:A'.e_B(x)(e_B(x)^{-1}(f(z))) =_{B'(z)} f(z)}(e_A(e_A^{-1}(x)), x, \mathrm{sec}_{e_A}(x), \mathrm{sec}_{e_B}(e_A^{-1}(x), f(e_A(e_A^{-1}(x)))))):\mathrm{congform}(e_A, e_B)(\mathrm{congform}(e_A, e_B)^{-1}(f)) =_{\prod_{x:A'} B'(x)} f
\end{array}
$$

We can define the witness that $\mathrm{congform}(e_A, e_B)^{-1}$ is a [[section]] of $\mathrm{congform}(e_A, e_B)$ as

$$
\begin{array}{c}
\mathrm{sec}_{\mathrm{congform}(e_A, e_B)}(f) \coloneqq \mathrm{ext}_{\prod_{x:A} B(x)}^{-1}(\lambda x:A'. \\
\mathrm{apbinary}_{\lambda y:A.\lambda p:y =_A x.\mathrm{transport}_{x:A'.B'(x)}(y), x, p, e_B(e_A^{-1}(x))(e_B(e_A^{-1}(x))^{-1}(f(y))))}(e_A(e_A^{-1}(x)), \mathrm{sec}_{e_A}(x), x, \mathrm{refl}_A(x), \mathrm{sec}_{e_A}(x), \mathrm{apd}_{y:A.y =_A x}(e_A(e_A^{-1}(x)), x, \mathrm{sec}_{e_A}(x), \mathrm{sec}_{e_A}(x), \mathrm{refl}_A(x))) \\
\bullet \mathrm{transport}_{z:A'.e_B(x)(e_B(x)^{-1}(f(z))) =_{B'(z)} f(z)}(e_A(e_A^{-1}(x)), x, \mathrm{sec}_{e_A}(x), \mathrm{sec}_{e_B}(e_A^{-1}(x), f(e_A(e_A^{-1}(x)))))):\mathrm{congform}(e_A, e_B)(\mathrm{congform}(e_A, e_B)^{-1}(f)) =_{\prod_{x:A'} B'(x)} f
\end{array}
$$

----

Since we have functions

$$\mathrm{congform}(e_A, e_B):\left(\prod_{x:A} B(x)\right) \to \left(\prod_{x:A'} B'(x)\right)$$

$$\mathrm{congform}(e_A, e_B)^{-1}:\left(\prod_{x:A'} B'(x)\right) \to \left(\prod_{x:A} B(x)\right)$$

and families of identifications

$$f:\prod_{x:A} B(x) \vdash \mathrm{ret}_{\mathrm{congform}(e_A, e_B)}(f):\mathrm{congform}(e_A, e_B)^{-1}(\mathrm{congform}(e_A, e_B)(f)) =_{\prod_{x:A} B(x)} f$$

$$g:\prod_{x:A'} B'(x) \vdash \mathrm{sec}_{\mathrm{congform}(e_A, e_B)}(g):\mathrm{congform}(e_A, e_B)(\mathrm{congform}(e_A, e_B)^{-1}(g)) =_{\prod_{x:A'} B'(x)} g$$

we could form the equivalence

$$\left(\mathrm{congform}(e_A, e_B), \mathrm{qInvToIsEquiv}\left(\mathrm{congform}(e_A, e_B)^{-1}, \lambda f:\prod_{x:A} B(x).\mathrm{ret}_{\mathrm{congform}(e_A, e_B)}(f), \lambda g:\prod_{x:A'} B'(x).\mathrm{sec}_{\mathrm{congform}(e_A, e_B)}(g)\right)\right):\left(\prod_{x:A} B(x)\right) \simeq \left(\prod_{x:A'} B'(x)\right)$$

By a common abuse of notation we denote the equivalence by the same name as the underlying function $\mathrm{congform}(e_A, e_B)$; thus we have
$$\mathrm{congform}(e_A, e_B):\left(\prod_{x:A} B(x)\right) \simeq \left(\prod_{x:A'} B'(x)\right)$$
\end{proof}

#### Weak dependent product types

\begin{theorem}
Assuming dependent function extensionality, given types $A$ and $A'$ and type families $x:A \vdash B(x)$ and $x:A \vdash B'(x)$ and equivalences $e_A:A \simeq A'$ and dependent function of equivalences $e_B:\prod_{x:A} B(x) \simeq B'(e(x))$, there is an equivalence
$$\mathrm{congform}(e_A, e_B):\left(\prod_{x:A} B(x)\right) \simeq \left(\prod_{x:A'} B'(x)\right)$$
\end{theorem}

Since [[dependent function types]] are negative types, we first present the typal congruence rule for the elimination rule of dependent function types

\begin{theorem}
Given a type $A$ and a type family $x:A \vdash B(x)$, dependent functions $f:\prod_{x:A} B(x)$ and $g:\prod_{x:A} B(x)$ and an identification $p:f =_{\prod_{x:A} B(x)} g$ there are families of identifications $x:A \vdash \mathrm{compelim}(f, g, p)(x):f(x) =_{B(x)} g(x)$.
\end{theorem}

\begin{proof}
We simply define the dependent function $\mathrm{compelim}$ to be happly, which is inductively defined on [[identity types]].
\end{proof}

The next is the typal congruence rule for the uniqueness rule of dependent function types.

\begin{theorem}
For weak dependent product types with dependent function
$$\eta:\prod_{f:\prod_{x:A} B(x)} f =_{\prod_{x:A} B(x)} \lambda x:A.f(x)$$

given

* a type $A$

* a type family $x:A \vdash B(x)$

* dependent functions $f:\prod_{x:A} B(x)$ and $f':\prod_{x:A} B(x)$

* an identification $p:f =_{\prod_{x:A} B(x)} f'$,

there is a family of identifications

$$\mathrm{etaCong}_{\prod}(f, f', p):\mathrm{transport}(f, f', p)(\eta_{\prod_{x:A} B(x)}(f)) =_{f =_{\prod_{x:A} B(x)} \lambda x:A.f(x)} \eta_{\prod_{x:A} B(x)}(f')$$
\end{theorem}

\begin{proof}
We simply define $\mathrm{etaCong}_{\prod}(f, f', p)$ to be the [[dependent function application to identifications]] $\mathrm{apd}(\eta, f, f' p)$.
\end{proof}

The next is the typal congruence rule for the introduction rule of function types. However, unlike the case for the other two rules, one needs dependent function extensionality.

\begin{theorem}
Assuming dependent function extensionality, given a type $A$ and a type family $x:A \vdash B(x)$, families of elements $x:A \vdash b(x):B(x)$ and $x:A \vdash b'(x):B(x)$, and families of [[identifications]] $x:A \vdash p(x):b(x) =_{B(x)} b'(x)$, there is an identification
$$\mathrm{congintro}_{x:A.p(x)}:\lambda (x:A).b(x) =_{\prod_{x:A} B(x)} \lambda (x:A).b'(x)$$
\end{theorem}

\begin{proof}
By the computation rule of weak dependent function types, there are families of identifications

$$x:A \vdash \beta_{\prod_{x:A} B(x)}^{x:A.b(x)}(b(x)):((\lambda x:A.b(x))(x) =_{B(x)} b(x)$$
$$x:A \vdash \beta_{\prod_{x:A} B(x)}^{x:A.b'(x)}(b'(x)):((\lambda x:A.b'(x))(x) =_{B(x)} b'(x)$$

Thus, there are families of identificaitons

$$x:A \vdash \beta_{\prod_{x:A} B(x)}^{x:A.b(x)}(b(x)) \bullet p(x) \bullet \beta_{\prod_{x:A} B(x)}^{x:A.b'(x)}(b'(x))^{-1}:(\lambda x:A.b(x))(x) =_{B(x)} (\lambda x:A.b'(x))(x)$$

and by $\lambda$-abstraction, one gets the dependent function

$$\lambda (x:A).\beta_{\prod_{x:A} B(x)}^{x:A.b(x)}(b(x)) \bullet p(x) \bullet \beta_{\prod_{x:A} B(x)}^{x:A.b'(x)}(b'(x))^{-1}:(\lambda x:A.b(x))(x) =_{B(x)} (\lambda x:A.b'(x))(x)$$

By dependent function extensionality, there is an [[equivalence of types]]

$$\mathrm{ext}_{\prod_{x:A} B(x)}^{-1}:(\lambda x:A.b(x)) =_{\prod_{x:A} B(x)} (\lambda x:A.b'(x)) \simeq \prod_{x:A} \mathrm{Id}_{B(x)}((\lambda x:A.b(x))(x), (\lambda x:A.b'(x))(x))$$

which yields an identification

$$\mathrm{ext}_{\prod_{x:A} B(x)}^{-1}^{-1}(\lambda (x:A).\beta_{\prod_{x:A} B(x)}^{x:A.b(x)}(b(x)) \bullet p(x) \bullet \beta_{\prod_{x:A} B(x)}^{x:A.b'(x)}(b'(x))^{-1}):(\lambda x:A.b(x)) =_{\prod_{x:A} B(x)} (\lambda x:A.b'(x))$$

We define

$$\mathrm{congintro}_{x:A.p(x)} \coloneqq \mathrm{ext}_{\prod_{x:A} B(x)}^{-1}^{-1}(\lambda (x:A).\beta_{\prod_{x:A} B(x)}^{x:A.b(x)}(b(x)) \bullet p(x) \bullet \beta_{\prod_{x:A} B(x)}^{x:A.b'(x)}(b'(x))^{-1}):(\lambda x:A.b(x)) =_{\prod_{x:A} B(x)} (\lambda x:A.b'(x))$$
\end{proof}

### Application in logic

In [[logic]], dependent functions types express [[universal quantifications]]. More precisely, for $x:A \vdash \phi(x)$ a [[predicate]] on a type $A$, under [[propositions as types]] the [[universal quantification]] $\forall x:A.\phi(x)$ is the dependent product type $\prod_{x:A} \phi(x)$ (or rather the [[bracket type]] of that if one wishes to force this to be of type $Prop$ again ).

### Graph of a dependent function

Given a type $A$ and a type family $x:A \vdash B(x)$, there is a function

$$\mathrm{graph}:\left(\prod_{x:A} B(x)\right) \to \left(A \to \sum_{x:A} B(x)\right)$$

which takes a dependent function $f:\prod_{x:A} B(x)$ and returns the **[[graph of a function|graph of a dependent function]]**
$$\mathrm{graph}(f):A \to \sum_{x:A} B(x)$$
defined by $\mathrm{graph}(f)(x) \equiv (x, f(x))$ for all $x:A$. As a [[dependent anafunction]] the graph of the dependent function is represented by the [[identity type]] family

$$x:A, y:B(x) \vdash f(x) =_{B(x)} y$$

### Relation to sections

A family of type $x:A \vdash B(x)$ is equivalently a type $B$ with a function $f:B \to A$. Then each $B(x)$ is defined as the fiber of $f$ at element $x:A$. Then the dependent product of a function is defined as the dependent product type

$$\Pi_{A, B}(f) \coloneqq \prod_{x:A} \sum_{y:B} f(y) =_A x$$

or equivalently, due to the [[type theoretic axiom of choice]], as the dependent sum type

$$\Pi_{A, B}(f) \coloneqq \sum_{g:A \to B} \prod_{x:A} f(g(x)) =_A x$$

which says that $g$ is a [[section]] of $f$. One could eliminate the use of the dependent product type entirely by using the definition of dependent product type from function types:

$$\Pi_{A, B}(f) \coloneqq \sum_{g:A \to B} \sum_{h:A \to \sum_{x:A} f(g(x)) =_A x} \mathrm{pr}_{\sum}^{A} \circ h =_{A \to A} \mathrm{id}_A$$

## Categorical interpretation

In [[categorical semantics]], the [[dependent product types]] are *[[relative adjoint functor|relative]]* [[right adjoints]] to [[context extension]] in [[comprehension categories]].

There is also another interpretation in category theory of the dependent product type over $x:A \vdash B(x) \; \mathrm{type}$ as the [[terminal]] $A$-indexed [[wide span]] under $B(x)$, the object $\prod_{x:A} B(x)$ with a family of morphisms

$$\pi_A(x):\left(\prod_{x:A} B(x)\right) \to B(x)$$

such that for any other object $C$ with a family of morphisms $f(x):C \to B(x)$, there exists a unique morphism $u_C:C \to \prod_{x:A} B(x)$ such that

$$\pi_A(x) \circ u_C = f(x)$$

## Related concepts

* [[dependent product]]
* [[dependent sum type]]
* [[dependent pullback type]]
* [[function type]]
* [[dependent sequence type]]
* [[dependent extension type]]

## References

The standard rules for type-formation, term introduction/elimination and computation of dependent product type are listed for instance in [part I](http://www.math.unipa.it/~ngambino/Research/Lectures/lecture1.pdf)  of

* [[Nicola Gambino]], _Lectures on dependent type theory_ ([pdf](http://www.cs.le.ac.uk/events/mgs2009/courses/gambino/lecturenotes-gambino.pdf))

Another textbook account could be found in section 2.1 of:

* {#Rijke22} [[Egbert Rijke]], *[[Introduction to Homotopy Type Theory]]*, Cambridge Studies in Advanced Mathematics, Cambridge University Press ([arXiv:2212.11082](https://arxiv.org/abs/2212.11082))

as well as sections 1.4 and 2.9 of:

* {#UFP13} [[Univalent Foundations Project]], *[[HoTT book|Homotopy Type Theory – Univalent Foundations of Mathematics]]* (2013)

See also:

* {#GarnerSDP} [[Richard Garner]], *On the strength of dependent products in the type theory of Martin-Löf*, [arXiv](http://arxiv.org/abs/0803.4466).

On the [[categorical semantics]] of [[dependent product types]] as *[[relative adjoint functor|relative]]* [[right adjoints]] to [[context extension]] in [[comprehension categories]]:

* [[Michael Lindgren]], *Dependent products as relative adjoints*, Stockholm (2021) [[[Lindgren-DependentProductsAsRelativeAdjoints.pdf:file]]]

[[!redirects dependent product type]]
[[!redirects dependent product types]]
[[!redirects dependent function type]]
[[!redirects dependent function types]]
[[!redirects Pi-type]]
[[!redirects Pi-types]]
[[!redirects Pi type]]
[[!redirects Pi types]]
[[!redirects Π-type]]
[[!redirects Π-types]]
[[!redirects Π type]]
[[!redirects Π types]]

[[!redirects Russell dependent product type]]
[[!redirects Russell dependent product types]]
[[!redirects Russell dependent function type]]
[[!redirects Russell dependent function types]]
[[!redirects Russell Pi-type]]
[[!redirects Russell Pi-types]]
[[!redirects Russell Pi type]]
[[!redirects Russell Pi types]]
[[!redirects Russell Π-type]]
[[!redirects Russell Π-types]]
[[!redirects Russell Π type]]
[[!redirects Russell Π types]]

[[!redirects dependent product type a la Russell]]
[[!redirects dependent product types a la Russell]]
[[!redirects dependent function type a la Russell]]
[[!redirects dependent function types a la Russell]]
[[!redirects Pi-type a la Russell]]
[[!redirects Pi-types a la Russell]]
[[!redirects Pi type a la Russell]]
[[!redirects Pi types a la Russell]]
[[!redirects Π-type a la Russell]]
[[!redirects Π-types a la Russell]]
[[!redirects Π type a la Russell]]
[[!redirects Π types a la Russell]]

[[!redirects Tarski dependent product type]]
[[!redirects Tarski dependent product types]]
[[!redirects Tarski dependent function type]]
[[!redirects Tarski dependent function types]]
[[!redirects Tarski Pi-type]]
[[!redirects Tarski Pi-types]]
[[!redirects Tarski Pi type]]
[[!redirects Tarski Pi types]]
[[!redirects Tarski Π-type]]
[[!redirects Tarski Π-types]]
[[!redirects Tarski Π type]]
[[!redirects Tarski Π types]]

[[!redirects dependent product type a la Tarski]]
[[!redirects dependent product types a la Tarski]]
[[!redirects dependent function type a la Tarski]]
[[!redirects dependent function types a la Tarski]]
[[!redirects Pi-type a la Tarski]]
[[!redirects Pi-types a la Tarski]]
[[!redirects Pi type a la Tarski]]
[[!redirects Pi types a la Tarski]]
[[!redirects Π-type a la Tarski]]
[[!redirects Π-types a la Tarski]]
[[!redirects Π type a la Tarski]]
[[!redirects Π types a la Tarski]]

[[!redirects graph of a dependent function]]

[[!redirects universal property of dependent product types]]
[[!redirects universal property of dependent function types]]
[[!redirects universal property of Pi-types]]
[[!redirects universal property of Pi types]]
[[!redirects universal property of Π-types]]
[[!redirects universal property of Π types]]