dependent product type in nLab
Context
Type theory
Dependent product types
- Idea
- Overview
- Definition
- As a negative type
- As a positive type
- Positive versus negative
- Dependent product types a la Russell and a la Tarski
- Weak and strict dependent product types
- In terms of function types
- As types of dependent anafunctions
- Properties
- Universal property of dependent product types
- Typal computation and uniqueness rules
- Typal congruence rules
- Application in logic
- Graph of a dependent function
- Relation to sections
- Categorical interpretation
- Related concepts
- References
Idea
In dependent type theory, a dependent product type ∏ x:AB(x)\prod_{x\colon A} B(x), for a dependent type x:A⊢B(x):Typex\colon A\vdash B(x)\colon Type is the type of “dependently typed functions” assigning to each x:Ax\colon A an element of B(x)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 BB is not dependent on AA, product types as a special case when AA is the type of Booleans, and dependent sequence types as a special case when AA is the natural numbers type.
Overview
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:
A:Typex:A⊢B(x):Type∏ x:AB(x):Type\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:
f:∏ x:AB(x)a:Af(a):B(a)\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 ∏ x:AB(x)\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)B(x) containing a free variable x:Ax\colon A. This yields the usual “λ\lambda-abstraction” constructor:
x:A⊢b:B(x)λx.b:∏ x:AB(x)\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.
(λx.b)(a)→ βb[a/x](\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:
λx.f(x)→ ηf \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.
(x:A⊢b:B(x))⊢c:Cf:∏ x:AB(x)funsplit(c,f):C\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:Cc\colon C involves a “term of type B(x)B(x) containing a free variable x:Ax\colon A”. However, it is possible to make sense of it. In dependent type theory, we need additionally to allow CC to depend on ∏ x:AB(x)\prod_{x\colon A} B(x).
The natural β\beta-reduction rule for this eliminator is
funsplit(c,λx.g)→ βc[g/b] funsplit(c, \lambda x.g) \;\to_\beta c[g/b]
and its η\eta-conversion rule looks something like
funsplit(c[λx.b/g],f)→ ηc[f/g]. funsplit(c[\lambda x.b / g], f) \;\to_\eta\; c[f/g].
Here g:∏ x:AB(x)⊢c:Cg\colon \prod_{x\colon A} B(x) \vdash c\colon C is a term containing a free variable of type ∏ x:AB(x)\prod_{x\colon A} B(x). By substituting λx.b\lambda x.b for gg, we obtain a term of type CC which depends on “a term b:B(x)b\colon B(x) containing a free variable x:Ax\colon A”. We then apply the positive eliminator at f:∏ x:AB(x)f\colon \prod_{x\colon A} B(x), and the η\eta-rule says that this can be computed by just substituting ff for gg in cc.
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:
f(a) ≔funsplit(b[a/x],f) funsplit(c,f) ≔c[f(x)/b] \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 funsplitfunsplit 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 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).
Dependent product types a la Russell and a la Tarski
In dependent type theory, there are two different ways to interpret the term f:∏ x:AB(x)f:\prod_{x:A} B(x):
-
ff is literally a family of terms in the family of types B(x)B(x) indexed by AA
-
ff is a term representation for a family of terms in the family of types B(x)B(x) indexed by AA
This situation is similar to how there are two notions of type universe where small types of a universe are interpreted a la Russell, literally as types, or 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 AA and the type family x:A⊢B(x)x:A \vdash B(x) and an element f:∏ x:AB(x)f:\prod_{x:A} B(x), one could form the family of terms x:A⊢f(x):Bx:A \vdash f(x):B
Γ⊢AtypeΓ,x:A⊢B(x)typeΓ⊢f:∏ x:AB(x)Γ,x:A⊢f(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, x:A \vdash f(x):B(x)}
- given type AA and the type family x:A⊢B(x)x:A \vdash B(x) one could form the family of terms f:∏ x:AB(x),x:A⊢eval(f,x):B(x)f:\prod_{x:A} B(x), x:A \vdash \mathrm{eval}(f, x):B(x)
Γ⊢AtypeΓ,x:A⊢B(x)typeΓ,f:∏ x:AB(x),x:A⊢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 Π(A,B)\Pi(A, B) literally comes with a morphism eval:Π(A,B)×A→Σ(A,B)\mathrm{eval}:\Pi(A, B) \times A \to \Sigma(A, B) in the slice category C/AC/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:
Γ⊢AtypeΓ,x:A⊢B(x)typeΓ,x:A⊢b(x):B(x)Γ,x:A⊢(λx:A.b(x))(x)≡b(x):B(x)\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)}
Γ⊢AtypeΓ,x:A⊢B(x)typeΓ⊢f:∏ x:AB(x)Γ⊢f≡λx:A.f(x):∏ x:AB(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:
Γ⊢AtypeΓ,x:A⊢B(x)typeΓ,x:A⊢b(x):B(x)Γ,x:A⊢eval(λx:A.b(x),x)≡b(x):B(x)\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)}
Γ⊢AtypeΓ,x:A⊢B(x)typeΓ,f:∏ x:AB(x)⊢f≡λx:A.eval(f,x):∏ x:AB(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:
Γ⊢AtypeΓ,x:A⊢B(x)typeΓ,x:A⊢b(x):B(x)Γ,a:A⊢β A→B x:A.b(x)(a):(λ(x:A).b(x))(a)= B(x)b(a)\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)}
Γ⊢AtypeΓ,x:A⊢B(x)typeΓ,f:∏ x:AB(x)⊢η A→B(f):f= ∏ x:AB(x)λ(x:A).f(x)\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:
Γ⊢AtypeΓ,x:A⊢B(x)typeΓ,x:A⊢b(x):B(x)Γ,a:A⊢(λ(x:A).b(x))(a)≡b(a):B(x)\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)}
Γ⊢AtypeΓ,x:A⊢B(x)typeΓ,f:∏ x:AB(x)⊢f≡λ(x:A).f(x):∏ x:AB(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)B(x) indexed by x:Ax:A can be defined as the type of functions f:A→∑ x:AB(x)f:A \to \sum_{x:A} B(x) from AA to the dependent sum type ∑ x:AB(x)\sum_{x:A} B(x) such that the composite of ff with the first projection function π 1:(∑ x:AB(x))→A\pi_1:\left(\sum_{x:A} B(x)\right) \to A is the identity function on AA
∏ x:AB(x)≔∑ f:A→∑ x:AB(x)λx:A.π 1(f(x))= A→Aid 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→∑ x:AB(x)f:A \to \sum_{x:A} B(x) with the second projection function of the dependent sum type:
x:A⊢π 2(f(x)):B(x)x:A \vdash \pi_2(f(x)):B(x)
Similarly, given a family of elements x:A⊢b(x):B(x)x:A \vdash b(x):B(x), one could construct the function
λx:A.(x,b(x)):A→∑ x:AB(x)\lambda x:A.(x, b(x)):A \to \sum_{x:A} B(x)
such that given x:Ax:A, π 1(λx:A.(x,b(x))(x))≡x\pi_1(\lambda x:A.(x, b(x))(x)) \equiv x. By lambda abstraction, one has
λx:A.π 1(λx:A.(x,b(x))(x))≡id A\lambda x:A.\pi_1(\lambda x:A.(x, b(x))(x)) \equiv \mathrm{id}_A
and so the dependent function is given by
(λx:A.(x,b(x)),refl A→A(id A)):∑ f:A→∑ x:AB(x)λx:A.π 1(f(x))= A→Aid A(\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 π 2(λx:A.(x,b(x))(x))≡b(x)\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:∑ f:A→∑ x:AB(x)λx:A.π 1(f(x))= A→Aid Af:\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≡(λx:A.(x,π 2(f(x))),π 2(f))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= Aba =_A b and x= B pyx =_{B}^{p} y respectively for a:Aa:A, b:Ab:A, p:a= Abp:a =_A b, x:B(a)x:B(a), and y:B(b)y:B(b). We use Agda notation (x:A)→B(x)(x:A) \to B(x) for dependent function types rather than the dependent product type notation ∏ x:AB(x)\prod_{x:A} B(x) or Π(x:A).B(x)\Pi(x:A).B(x) in this section.
Rules for dependent function types
Γ⊢AtypeΓ,x:A⊢B(x)typeΓ⊢(x:A)→B(x)typeΓ⊢AtypeΓ,x:A⊢B(x)typeΓ,f:(x:A)→B(x),x:A,y:B(x)⊢ℱ A,B(f,x,y)type\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}}
Γ⊢AtypeΓ,x:A⊢B(x)typeΓ,x:A⊢f(x):B(x)Γ⊢λx.f(x):(x:A)→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 \vdash \lambda x.f(x):(x:A) \to B(x)}
Γ⊢AtypeΓ,x:A⊢B(x)typeΓ,x:A⊢f(x):B(x)Γ,x:A⊢α(x):ℱ A,B(λx.f(x),x,f(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))}
Γ⊢AtypeΓ,x:A⊢B(x)typeΓ,f:(x:A)→B(x),x:A⊢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 \mathrm{ev}(f, x):B(x)}
Γ⊢AtypeΓ,x:A⊢B(x)typeΓ,f:(x:A)→B(x),x:A⊢β(f,x):ℱ A,B(f,x,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 \vdash \beta(f, x):\mathcal{F}_{A, B}(f, x, \mathrm{ev}(f, x))}
Γ⊢AtypeΓ,x:A⊢B(x)typeΓ,f:(x:A)→B(x),x:A,y:B(x),u:ℱ A,B(f,x,y)⊢κ(f,x,y,u):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 \kappa(f, x, y, u):\mathrm{ev}(f, x) =_{B(x)} y}
Γ⊢AtypeΓ,x:A⊢B(x)typeΓ,f:(x:A)→B(x),x:A,y:B(x),u:ℱ A,B(f,x,y)⊢η(f,x,y,u):β(f,x)= ℱ A,B(f,x) κ(f,x,y,u)u\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
Γ⊢AtypeΓ,x:A⊢B(x)typeΓ,f:(x:A)→B(x)⊢η(f):(x:A)→isContr((y:B)×ℱ A,B(f,x,y))\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 ℱ A,B(f)\mathcal{F}_{A, B}(f) is a dependent anafunction for all dependent functions f:(x:A)→B(x)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 AA and type families x:A⊢B(x)x:A \vdash B(x), there is a family of functions
π A:∏ x:A(∏ x:AB(x))→B(x)\pi_A:\prod_{x:A} \left(\prod_{x:A} B(x)\right) \to B(x)
such that for any other type CC and family of functions f:∏ x:AC→B(x)f:\prod_{x:A} C \to B(x), there is a unique function c:C→∏ x:AB(x)c:C \to \prod_{x:A} B(x) such that
∏ x:A∏ y:Cπ A(x)(c(y))= B(x)f(x)(y)\prod_{x:A} \prod_{y:C} \pi_A(x)(c(y)) =_{B(x)} f(x)(y)
If there is a type universe UU, then one could wrap this into a single axiom.
up A,B:∏ C:U∏ f:∏ x:AC→B(x)∃!c:C→∏ x:AB(x).∏ x:A∏ y:Cπ A(x)(c(y))= B(x)f(x)(y)\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 AA, type family x:A⊢B(x)x:A \vdash B(x) and dependent function f:∏ x:AB(x)f:\prod_{x:A} B(x), we have, by the elimination rule and the introduction rule, a dependent function λx:A.f(x):∏ x:AB(x)\lambda x:A.f(x):\prod_{x:A} B(x), which by the uniqueness rules of dependent product types are equal to each other
η ∏ x:AB(x)(f):f= ∏ x:AB(x)λx:A.f(x)\eta_{\prod_{x:A} B(x)}(f):f =_{\prod_{x:A} B(x)} \lambda x:A.f(x)
By the inductively defined function idtohomotopy\mathrm{idtohomotopy} which takes identifications between dependent functions to homotopies between dependent functions, we have that
idtohomotopy(f,λx:A.f(x))(η ∏ x:AB(x)(f)):∏ x:Af(x)= B(x)(λx:A.f(x))(x)\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
Theorem
Given a type AA and a type family x:A⊢B(x)x:A \vdash B(x), dependent functions f:∏ x:AB(x)f:\prod_{x:A} B(x) and g:∏ x:AB(x)g:\prod_{x:A} B(x) and an identification p:f= ∏ x:AB(x)gp:f =_{\prod_{x:A} B(x)} g there are families of identifications x:A⊢compelim(f,g,p)(x):f(x)= B(x)g(x)x:A \vdash \mathrm{compelim}(f, g, p)(x):f(x) =_{B(x)} g(x).
Proof
We simply define the dependent function compelim\mathrm{compelim} to be happly, which is inductively defined on identity types.
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.
Theorem
Assuming dependent function extensionality, given type AA and family of types x:A⊢B(x)x:A \vdash B(x), families of elements x:A⊢b(x):B(x)x:A \vdash b(x):B(x) and x:A⊢b′(x):B(x)x:A \vdash b'(x):B(x), and families of identifications x:A⊢p(x):b(x)= B(x)b′(x)x:A \vdash p(x):b(x) =_{B(x)} b'(x), there is a identification
congintro x:A.p(x):λ(x:A).b(x)= ∏ x:AB(x)λ(x:A).b′(x)\mathrm{congintro}_{x:A.p(x)}:\lambda (x:A).b(x) =_{\prod_{x:A} B(x)} \lambda (x:A).b'(x)
Proof
By the computation rule of strict dependent function types, there are families of judgmental equalities
x:A⊢((λx:A.b(x))(x)≡b(x):B(x)x:A \vdash ((\lambda x:A.b(x))(x) \equiv b(x):B(x)
x:A⊢((λx:A.b′(x))(x)≡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⊢p(x):(λx:A.b(x))(x)= B(x)(λx:A.b′(x))(x)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
λ(x:A).p(x):∏ x:A(λx:A.b(x))(x)= B(x)(λx:A.b′(x))(x)\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
ext ∏ x:AB(x) −1:(λx:A.b(x))= ∏ x:AB(x)(λx:A.b′(x))≃∏ x:A(λx:A.b(x))(x)= B(x)(λx:A.b′(x))(x)\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
ext ∏ x:AB(x) −1−1(λ(x:A).p(x)):(λx:A.b(x))= ∏ x:AB(x)(λx:A.b′(x))\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
congintro x:A.p(x)≔ext ∏ x:AB(x) −1−1(λ(x:A).p(x)):(λx:A.b(x))= ∏ x:AB(x)(λx:A.b′(x))\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))
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 definitional isomorphisms, some notion of equivalences of types, or in a dependent type theory with type variables, identity types between types
Using definitional isomorphisms
Theorem
Given types AA and A′A' and type families x:A⊢B(x)x:A \vdash B(x), x:A′⊢B′(x)x:A' \vdash B'(x) and definitional isomorphisms e A:A≅A′e_A:A \cong A' and dependent function e B:∏ x:AB(x)≅B′(e A(x))e_B:\prod_{x:A} B(x) \cong B'(e_A(x)) consisting of a family of definitional isomorphisms, there is a definitional isomorphism
congform(e A,e B):(∏ x:AB(x))≅(∏ x:A′B′(x))\mathrm{congform}(e_A, e_B):\left(\prod_{x:A} B(x)\right) \cong \left(\prod_{x:A'} B'(x)\right)
Proof
Since for definitional isomorphism e A:A≅A′e_A:A \cong A', we have judgmental equalities e A(e A −1(x))≡x:A′e_A(e_A^{-1}(x)) \equiv x:A' and e A −1(e A(x))≡x:Ae_A^{-1}(e_A(x)) \equiv x:A, so we do not need to transport across identifications. Instead, we define the function
congform(e A,e B):(∏ x:AB(x))→(∏ x:A′B′(x))\mathrm{congform}(e_A, e_B):\left(\prod_{x:A} B(x)\right) \to \left(\prod_{x:A'} B'(x)\right)
by
congform(e A,e B)≔λ(f:∏ x:AB(x)).λx:A′.e B(e A −1(x))(f(e A −1(x)))\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
congform(e A,e B) −1≔λ(f:∏ x:A′B′(x)).λx:A.e B(x) −1(f(e A(x)))\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:∏ x:AB(x)⊢congform(e A,e B) −1(congform(e A,e B)(f))≡f:∏ x:AB(x)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:∏ x:A′B′(x)⊢congform(e A,e B)(congform(e A,e B) −1(g))≡g:∏ 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 congform(e A,e B)\mathrm{congform}(e_A, e_B) is thus a definitional isomorphism.
By definition, we have
congform(e A,e B) −1(congform(e A,e B)(f))≡λx:A.e B(x) −1((λx:A′.e B(e A −1(x))(f(e A −1(x))))(e A(x)))\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
(λx:A′.e B(e A −1(x))(f(e A −1(x))))(e A(x))≡e B(e A −1(e A(x)))(f(e A −1(e A(x))))(\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 Ae_A is a definitional isomorphism, we have
e B(e A −1(e A(x)))(f(e A −1(e A(x))))≡e B(x)(f(x))e_B(e_A^{-1}(e_A(x)))(f(e_A^{-1}(e_A(x)))) \equiv e_B(x)(f(x))
By the congruence rules for substitution of judgmental equality, we have
λx:A.e B(x) −1((λx:A′.e B(e A −1(x))(f(e A −1(x))))(e A(x)))≡λx:A.e B(x) −1(e B(x)(f(x)))\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:Ax:A each e B(x)e_B(x) is also a strict equality, we have
e B(x) −1(e B(x)(f(x)))≡f(x)e_B(x)^{-1}(e_B(x)(f(x))) \equiv f(x)
by the congruence rules for substitution of judgmental equality, we have
λx:A.e B(x) −1(e B(x)(f(x)))≡λx:A.f(x)\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
λx:A.f(x)≡f\lambda x:A.f(x) \equiv f
thus by the transitive rule for judgmental equality we have
congform(e A,e B) −1(congform(e A,e B)(f))≡f\mathrm{congform}(e_A, e_B)^{-1}(\mathrm{congform}(e_A, e_B)(f)) \equiv f
for all f:∏ x:AB(x)f:\prod_{x:A} B(x)
Similarly, by definition, we have
congform(e A,e B)(congform(e A,e B) −1(f))≡λx:A′.e B(e A −1(x))((λx:A.e B(x) −1(f(e A(x))))(e A −1(x)))\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
(λx:A.e B(x) −1(f(e A(x))))(e A −1(x))≡e B(e A −1(x)) −1(f(e A(e A −1(x))))( \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 Ae_A is a definitional isomorphism, we have
e B(e A −1(x)) −1(f(e A(e A −1(x))))≡e B(e A −1(x)) −1(f(x))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 congruence rules for substitution of judgmental equality, we have
λx:A′.e B(e A −1(x))((λx:A.e B(x) −1(f(e A(x))))(e A −1(x)))≡λx:A′.e B(e A −1(x))(e B(e A −1(x)) −1(f(x)))\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:Ax:A each e B(x)e_B(x) is also a strict equality, we have
e B(e A −1(x))(e B(e A −1(x)) −1(f(x)))≡f(x)e_B(e_A^{-1}(x))(e_B(e_A^{-1}(x))^{-1}(f(x))) \equiv f(x)
by the congruence rules for substitution of judgmental equality, we have
λx:A′.e B(e A −1(x))(e B(e A −1(x)) −1(f(x)))≡λx:A′.f(x)\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
λx:A.f(x)≡f\lambda x:A.f(x) \equiv f
thus by the transitive rule for judgmental equality we have
congform(e A,e B)(congform(e A,e B) −1(f))≡f\mathrm{congform}(e_A, e_B)(\mathrm{congform}(e_A, e_B)^{-1}(f)) \equiv f
for all f:∏ x:A′B′(x)f:\prod_{x:A'} B'(x).
Since we have functions
congform(e A,e B):(∏ x:AB(x))→(∏ x:A′B′(x))\mathrm{congform}(e_A, e_B):\left(\prod_{x:A} B(x)\right) \to \left(\prod_{x:A'} B'(x)\right)
congform(e A,e B) −1:(∏ x:A′B′(x))→(∏ x:AB(x))\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:∏ x:AB(x)⊢congform(e A,e B) −1(congform(e A,e B)(f))≡f:∏ x:AB(x)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:∏ x:A′B′(x)⊢congform(e A,e B)(congform(e A,e B) −1(g))≡g:∏ 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 definitional isomorphism
toEquiv(congform(e A,e B),congform(e A,e B) −1):(∏ x:A′B′(x))≅(∏ x:AB(x))\mathrm{toEquiv}(\mathrm{congform}(e_A, e_B), \mathrm{congform}(e_A, e_B)^{-1}):\left(\prod_{x:A'} B'(x)\right) \cong \left(\prod_{x:A} B(x)\right)
By a common abuse of notation we denote the definitional isomorphism by the same name as the underlying function congform(e A,e B)\mathrm{congform}(e_A, e_B); thus we have
congform(e A,e B):(∏ x:AB(x))≅(∏ x:A′B′(x))\mathrm{congform}(e_A, e_B):\left(\prod_{x:A} B(x)\right) \cong \left(\prod_{x:A'} B'(x)\right)
Using weak equivalences of types
Theorem
Given types AA and A′A' and type families x:A⊢B(x)x:A \vdash B(x), x:A′⊢B′(x)x:A' \vdash B'(x) and equivalence e A:A≃A′e_A:A \simeq A' and dependent function e B:∏ x:AB(x)≃B′(e A(x))e_B:\prod_{x:A} B(x) \simeq B'(e_A(x)), there is an equivalence
congform(e A,e B):(∏ x:AB(x))≃(∏ x:A′B′(x))\mathrm{congform}(e_A, e_B):\left(\prod_{x:A} B(x)\right) \simeq \left(\prod_{x:A'} B'(x)\right)
Proof
We define the function
congform(e A,e B):(∏ x:AB(x))→(∏ x:A′B′(x))\mathrm{congform}(e_A, e_B):\left(\prod_{x:A} B(x)\right) \to \left(\prod_{x:A'} B'(x)\right)
by
congform(e A,e B)≔λ(f:∏ x:AB(x)).λx:A′.transport x:A′.B′(x)(e A(e A −1(x)),x,sec e A(x),e B(e A −1(x))(f(e A −1(x))))\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
congform(e A,e B) −1≔λ(f:∏ x:A′B′(x)).λx:A.e B(x) −1(f(e A(x)))\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≃A′e_A:A \simeq A' has families of identifications
x′:A⊢sec e A(x):e A(e A −1(x))= A′xx':A \vdash \mathrm{sec}_{e_A}(x):e_A(e_A^{-1}(x)) =_{A'} x
x:A⊢ret e A(x):e A −1(e A(x))= Axx:A \vdash \mathrm{ret}_{e_A}(x):e_A^{-1}(e_A(x)) =_A x
witnessing that e A −1e_A^{-1} is a section and retraction of e Ae_A respectively.
Now it suffices to construct families of identifications
f:∏ x:AB(x)⊢ret congform(e A,e B)(f):congform(e A,e B) −1(congform(e A,e B)(f))= ∏ x:AB(x)ff:\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:∏ x:A′B′(x)⊢sec congform(e A,e B)(g):congform(e A,e B)(congform(e A,e B) −1(g))= ∏ x:A′B′(x)gg:\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 congform(e A,e B)\mathrm{congform}(e_A, e_B) has a coherent inverse and contractible fibers and is thus an equivalence of types.
By definition,
congform(e A,e B) −1(congform(e A,e B)(f))≡λx:A.e B(x) −1((λx:A′.transport x:A′.B′(x)(e A(e A −1(x)),x,sec e A(x),e B′(e A −1(x))(f(e A −1(x)))))(e A(x)))\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⊢(λx:A′.transport x:A′.B′(x)(e A(e A −1(x)),x,sec e A(x),e B(e A −1(x))(f(e A −1(x)))))(e A(x))≡transport x:A′.B′(x)(e A(e A −1(e A(x))),e A(x),sec e A(e A(x)),e B(e A −1(x))(f(e A −1(e A(x)))))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
congform(e A,e B) −1(congform(e A,e B)(f))≡λx:A.e B(x) −1(transport x:A′.B′(x)(e A(e A −1(e A(x))),e A(x),sec e A(e A(x)),e B(e A −1(e A(x)))(f(e A −1(e A(x))))))\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≃A′e_A:A \simeq A' has the coherence condition
coh e A(x):sec e A(e A(x))= e A(e A −1(e A(x)))= A′e A(x)ap e A(e A −1(e A(x)),x,ret e A(x))\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⊢transport x:A′.B′(x)(e A(e A −1(e A(x))),e A(x),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))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
λp:e A(e A −1(e A(x)))= A′e A(x).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)))))\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 coh e A(x)\mathrm{coh}_{e_A}(x) one gets the family of identifications
x:A⊢ap λp:e A(e A −1(e A(x)))= A′e A(x).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)))))(sec e A(e A(x)),ap e A(e A −1(e A(x)),x,ret e A(x)),coh e A(x)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
transport x:A′.B′(x)(e A(e A −1(e A(x))),e A(x),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)transport x:A′.B′(x)(e A(e A −1(e A(x))),e A(x),ap e A(e A −1(e A(x)),x,ret e A(x)),e B(e A −1(e A(x)))(f(e A −1(e A(x)))))\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⊢transport x:A′.B′(x)(e A(e A −1(e A(x))),e A(x),ap e A(e A −1(e A(x)),x,ret e A(x)),e B(e A −1(e A(x)))(f(e A −1(e A(x))))):B(e A(x))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⊢λy:A.λp:y= Ax.transport x:A′.B′(x)(e A(y),e A(x),ap e A(y,x,p),e B(y)(f(y))):(∑ y:Ay= Ax)→B(e A(x))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))e_A^{-1}(e_A(x)), ret e A(x)\mathrm{ret}_{e_A}(x), xx, refl A(x)\mathrm{refl}_A(x), ret e A(x)\mathrm{ret}_{e_A}(x), and apd y:A.y= Ax(e A −1(e A(x)),x,ret e A(x),ret e A(x),refl 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)), one gets the family of identifications
x:A⊢apbinary λy:A.λp:y= Ax.transport x:A′.B′(x)(e A(y),e A(x),ap e A(y,x,p),e B(y)(f(y)))(e A −1(e A(x)),ret e A(x),x,refl A(x),ret e A(x),apd y:A.y= Ax(e A −1(e A(x)),x,ret e A(x),ret e A(x),refl A(x))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
transport x:A′.B′(x)(e A(e A −1(e A(x))),e A(x),ap e A(e A −1(e A(x)),x,ret e A(x)),e B(e A −1(e A(x)))(f(e A −1(e A(x)))))= B(e A(x))transport x:A′.B′(x)(e A(x),e A(x),ap e A(x,x,refl A(x)),e B(x)(f(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))))) =_{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 ap e A(x,x,refl A(x))≡refl A′(e A(x))\mathrm{ap}_{e_A}(x, x, \mathrm{refl}_A(x)) \equiv \mathrm{refl}_{A'}(e_A(x)), which means that we have
transport x:A′.B′(x)(e A(x),e A(x),ap e A(x,x,refl A(x)),e B(x)(f(x)))≡transport x:A′.B′(x)(e A(x),e A(x),refl A′(e A(x)),e B(x)(f(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))) \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
transport x:A′.B′(x)(e A(x),e A(x),refl A′(e A(x)),e B(x)(f(x)))≡e B(x)(f(x))\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
ap λp:e A(e A −1(e A(x)))= A′e A(x).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)))))(sec e A(e A(x)),ap e A(e A −1(e A(x)),x,ret e A(x)),coh e A(x) •apbinary λy:A.λp:y= Ax.transport x:A′.B′(x)(e A(y),e A(x),ap e A(y,x,p),e B(y)(f(y)))(e A −1(e A(x)),ret e A(x),x,refl A(x),ret e A(x),apd y:A.y= Ax(e A −1(e A(x)),x,ret e A(x),ret e A(x),refl A(x)) \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
transport x:A′.B′(x)(e A(e A −1(e A(x))),e A(x),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))\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) −1e_B(x)^{-1} to the above identification, we have
ap e B(x) −1(transport x:A′.B′(x)(e A(e A −1(e A(x))),e A(x),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)), ap λp:e A(e A −1(e A(x)))= A′e A(x).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)))))(sec e A(e A(x)),ap e A(e A −1(e A(x)),x,ret e A(x)),coh e A(x) •apbinary λy:A.λp:y= Ax.transport x:A′.B′(x)(e A(y),e A(x),ap e A(y,x,p),e B(y)(f(y)))(e A −1(e A(x)),ret e A(x),x,refl A(x),ret e A(x),apd y:A.y= Ax(e A −1(e A(x)),x,ret e A(x),ret e A(x),refl A(x)) \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(transport x:A′.B′(x)(e A(e A −1(e A(x))),e A(x),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)))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⊢e B(x):B(x)≃B′(e A(x))x:A \vdash e_B(x):B(x) \simeq B'(e_A(x))
has a family of identifications
x:A,y:B(x)⊢ret e B(x,y):e B(x) −1(e B(x)(y))= B(x)yx: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) −1e_B(x)^{-1} is a retraction of e B(x)e_B(x) for each x:Ax:A.
By substituting f(x)f(x) in for yy we get the family of identifications
x:A⊢ret e B(x,f(x)):e B(x) −1(e B(x)(f(x)))= B(x)f(x)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
ap e B(x) −1(transport x:A′.B′(x)(e A(e A −1(e A(x))),e A(x),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)), ap λp:e A(e A −1(e A(x)))= A′e A(x).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)))))(sec e A(e A(x)),ap e A(e A −1(e A(x)),x,ret e A(x)),coh e A(x) •apbinary λy:A.λp:y= Ax.transport x:A′.B′(x)(e A(y),e A(x),ap e A(y,x,p),e B(y)(f(y)))(e A −1(e A(x)),ret e A(x),x,refl A(x),ret e A(x),apd y:A.y= Ax(e A −1(e A(x)),x,ret e A(x),ret e A(x),refl A(x)) •ret e B(x,f(x)) \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(transport x:A′.B′(x)(e A(e A −1(e A(x))),e A(x),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)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
λx:A.ap e B(x) −1(transport x:A′.B′(x)(e A(e A −1(e A(x))),e A(x),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)), ap λp:e A(e A −1(e A(x)))= A′e A(x).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)))))(sec e A(e A(x)),ap e A(e A −1(e A(x)),x,ret e A(x)),coh e A(x) •apbinary λy:A.λp:y= Ax.transport x:A′.B′(x)(e A(y),e A(x),ap e A(y,x,p),e B(y)(f(y)))(e A −1(e A(x)),ret e A(x),x,refl A(x),ret e A(x),apd y:A.y= Ax(e A −1(e A(x)),x,ret e A(x),ret e A(x),refl A(x)) •ret e B(x,f(x)) \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
∏ x:Ae B(x) −1(transport x:A′.B′(x)(e A(e A −1(e A(x))),e A(x),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)\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
ext ∏ x:AB(x) −1(λx:A.ap e B(x) −1(transport x:A′.B′(x)(e A(e A −1(e A(x))),e A(x),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)), ap λp:e A(e A −1(e A(x)))= A′e A(x).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)))))(sec e A(e A(x)),ap e A(e A −1(e A(x)),x,ret e A(x)),coh e A(x) •apbinary λy:A.λp:y= Ax.transport x:A′.B′(x)(e A(y),e A(x),ap e A(y,x,p),e B(y)(f(y)))(e A −1(e A(x)),ret e A(x),x,refl A(x),ret e A(x),apd y:A.y= Ax(e A −1(e A(x)),x,ret e A(x),ret e A(x),refl A(x)) •ret e B(x,f(x))) \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
λx:A.e B(x) −1(transport x:A′.B′(x)(e A(e A −1(e A(x))),e A(x),sec e A(e A(x)),e B(e A −1(e A(x)))(f(e A −1(e A(x))))))= ∏ x:AB(x)f\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
congform(e A,e B) −1(congform(e A,e B)(f))≡λx:A.e B(x) −1(transport x:A′.B′(x)(e A(e A −1(e A(x))),e A(x),sec e A(e A(x)),e B(e A −1(e A(x)))(f(e A −1(e A(x))))))\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
ext ∏ x:AB(x) −1(λx:A.ap e B(x) −1(transport x:A′.B′(x)(e A(e A −1(e A(x))),e A(x),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)), ap λp:e A(e A −1(e A(x)))= A′e A(x).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)))))(sec e A(e A(x)),ap e A(e A −1(e A(x)),x,ret e A(x)),coh e A(x) •apbinary λy:A.λp:y= Ax.transport x:A′.B′(x)(e A(y),e A(x),ap e A(y,x,p),e B(y)(f(y)))(e A −1(e A(x)),ret e A(x),x,refl A(x),ret e A(x),apd y:A.y= Ax(e A −1(e A(x)),x,ret e A(x),ret e A(x),refl A(x)) •ret e B(x,f(x))):congform(e A,e B) −1(congform(e A,e B)(f))= ∏ x:AB(x)f \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 congform(e A,e B) −1\mathrm{congform}(e_A, e_B)^{-1} is a retraction of congform(e A,e B)\mathrm{congform}(e_A, e_B) as
ret congform(e A,e B)(f)≔ ext ∏ x:AB(x) −1(λx:A.ap e B(x) −1(transport x:A′.B′(x)(e A(e A −1(e A(x))),e A(x),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)), ap λp:e A(e A −1(e A(x)))= A′e A(x).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)))))(sec e A(e A(x)),ap e A(e A −1(e A(x)),x,ret e A(x)),coh e A(x) •apbinary λy:A.λp:y= Ax.transport x:A′.B′(x)(e A(y),e A(x),ap e A(y,x,p),e B(y)(f(y)))(e A −1(e A(x)),ret e A(x),x,refl A(x),ret e A(x),apd y:A.y= Ax(e A −1(e A(x)),x,ret e A(x),ret e A(x),refl A(x)) •ret e B(x,f(x))):congform(e A,e B) −1(congform(e A,e B)(f))= ∏ x:AB(x)f \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,
congform(e A,e B)(congform(e A,e B) −1(f))≡λx:A′.transport x:A′.B′(x)(e A(e A −1(x)),x,sec e A(x),e B(e A −1(x))((λx:A.e B(x) −1(f(e A(x))))(e A −1(x))))\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⊢(λx:A.e B(x) −1(f(e A(x))))(e A −1(x))≡e B(e A −1(x)) −1(f(e A(e A −1(x))))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
λx:A′.transport x:A′.B′(x)(e A(e A −1(x)),x,sec e A(x),e B(e A −1(x))((λx:A.e B(x) −1(f(e A(x))))(e A −1(x))))≡λx:A′.transport x:A′.B′(x)(e A(e A −1(x)),x,sec e A(x),e B(e A −1(x))(e B(e A −1(x)) −1(f(e A(e A −1(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))((\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′⊢transport x:A′.B′(x)(e A(e A −1(x)),x,sec e A(x),e B(e A −1(x))(e B(e A −1(x)) −1(f(e A(e A −1(x))))))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′⊢λy:A.λp:y= Ax.transport x:A′.B′(x)(y),x,p,e B(e A −1(x))(e B(e A −1(x)) −1(f(y))))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))e_A(e_A^{-1}(x)), sec e A(x)\mathrm{sec}_{e_A}(x), xx, refl A(x)\mathrm{refl}_A(x), sec e A(x)\mathrm{sec}_{e_A}(x), and apd y:A.y= Ax(e A(e A −1(x)),x,sec e A(x),sec e A(x),refl 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)), one gets the family of identifications
x:A′⊢apbinary λy:A.λp:y= Ax.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)),sec e A(x),x,refl A(x),sec e A(x),apd y:A.y= Ax(e A(e A −1(x)),x,sec e A(x),sec e A(x),refl A(x)))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
transport x:A′.B′(x)(e A(e A −1(x)),x,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)transport x:A′.B′(x)(x,x,refl A(x),e B(e A −1(x))(e B(e A −1(x)) −1(f(x))))\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
transport x:A′.B′(x)(x,x,refl A(x),e B(e A −1(x))(e B(e A −1(x)) −1(f(x))))≡e B(e A −1(x))(e B(e A −1(x)) −1(f(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)))) \equiv e_B(e_A^{-1}(x))(e_B(e_A^{-1}(x))^{-1}(f(x)))
Similarly, The family of equivalences
x:A⊢e B(x):B(x)≃B′(e A(x))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))⊢sec e B(x,y):e B(x)(e B(x) −1(y))= B(x)yx: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) −1e_B(x)^{-1} is a section of e B(x)e_B(x) for each x:Ax:A.
By substituting f(e A(e A −1(x)))f(e_A(e_A^{-1}(x))) in for yy and e A −1(x)e_A^{-1}(x) in for xx in the above expression we get the family of identifications
x:A′⊢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)))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 sec e A(x)\mathrm{sec}_{e_A}(x) we get
x:A′⊢transport z:A′.e B(x)(e B(x) −1(f(z)))= B′(z)f(z)(e A(e A −1(x)),x,sec e A(x),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)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
apbinary λy:A.λp:y= Ax.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)),sec e A(x),x,refl A(x),sec e A(x),apd y:A.y= Ax(e A(e A −1(x)),x,sec e A(x),sec e A(x),refl A(x))) •transport z:A′.e B(x)(e B(x) −1(f(z)))= B′(z)f(z)(e A(e A −1(x)),x,sec e A(x),sec e B(e A −1(x),f(e A(e A −1(x))))) \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
transport x:A′.B′(x)(e A(e A −1(x)),x,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)\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
λx:A′.apbinary λy:A.λp:y= Ax.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)),sec e A(x),x,refl A(x),sec e A(x),apd y:A.y= Ax(e A(e A −1(x)),x,sec e A(x),sec e A(x),refl A(x))) •transport z:A′.e B(x)(e B(x) −1(f(z)))= B′(z)f(z)(e A(e A −1(x)),x,sec e A(x),sec e B(e A −1(x),f(e A(e A −1(x))))) \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
∏ x:A′transport x:A′.B′(x)(e A(e A −1(x)),x,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)\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
ext ∏ x:AB(x) −1(λx:A′. apbinary λy:A.λp:y= Ax.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)),sec e A(x),x,refl A(x),sec e A(x),apd y:A.y= Ax(e A(e A −1(x)),x,sec e A(x),sec e A(x),refl A(x))) •transport z:A′.e B(x)(e B(x) −1(f(z)))= B′(z)f(z)(e A(e A −1(x)),x,sec e A(x),sec e B(e A −1(x),f(e A(e A −1(x)))))) \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
λx:A′.transport x:A′.B′(x)(e A(e A −1(x)),x,sec e A(x),e B(e A −1(x))(e B(e A −1(x)) −1(f(e A(e A −1(x))))))= ∏ x:A′B′(x)f\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
congform(e A,e B)(congform(e A,e B) −1(f))≡λx:A′.transport x:A′.B′(x)(e A(e A −1(x)),x,sec e A(x),e B(e A −1(x))((λx:A.e B(x) −1(f(e A(x))))(e A −1(x))))\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
ext ∏ x:AB(x) −1(λx:A′. apbinary λy:A.λp:y= Ax.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)),sec e A(x),x,refl A(x),sec e A(x),apd y:A.y= Ax(e A(e A −1(x)),x,sec e A(x),sec e A(x),refl A(x))) •transport z:A′.e B(x)(e B(x) −1(f(z)))= B′(z)f(z)(e A(e A −1(x)),x,sec e A(x),sec e B(e A −1(x),f(e A(e A −1(x)))))):congform(e A,e B)(congform(e A,e B) −1(f))= ∏ x:A′B′(x)f \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 congform(e A,e B) −1\mathrm{congform}(e_A, e_B)^{-1} is a section of congform(e A,e B)\mathrm{congform}(e_A, e_B) as
sec congform(e A,e B)(f)≔ext ∏ x:AB(x) −1(λx:A′. apbinary λy:A.λp:y= Ax.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)),sec e A(x),x,refl A(x),sec e A(x),apd y:A.y= Ax(e A(e A −1(x)),x,sec e A(x),sec e A(x),refl A(x))) •transport z:A′.e B(x)(e B(x) −1(f(z)))= B′(z)f(z)(e A(e A −1(x)),x,sec e A(x),sec e B(e A −1(x),f(e A(e A −1(x)))))):congform(e A,e B)(congform(e A,e B) −1(f))= ∏ x:A′B′(x)f \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
congform(e A,e B):(∏ x:AB(x))→(∏ x:A′B′(x))\mathrm{congform}(e_A, e_B):\left(\prod_{x:A} B(x)\right) \to \left(\prod_{x:A'} B'(x)\right)
congform(e A,e B) −1:(∏ x:A′B′(x))→(∏ x:AB(x))\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:∏ x:AB(x)⊢ret congform(e A,e B)(f):congform(e A,e B) −1(congform(e A,e B)(f))= ∏ x:AB(x)ff:\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:∏ x:A′B′(x)⊢sec congform(e A,e B)(g):congform(e A,e B)(congform(e A,e B) −1(g))= ∏ x:A′B′(x)gg:\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
(congform(e A,e B),qInvToIsEquiv(congform(e A,e B) −1,λf:∏ x:AB(x).ret congform(e A,e B)(f),λg:∏ x:A′B′(x).sec congform(e A,e B)(g))):(∏ x:AB(x))≃(∏ x:A′B′(x))\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 congform(e A,e B)\mathrm{congform}(e_A, e_B); thus we have
congform(e A,e B):(∏ x:AB(x))≃(∏ x:A′B′(x))\mathrm{congform}(e_A, e_B):\left(\prod_{x:A} B(x)\right) \simeq \left(\prod_{x:A'} B'(x)\right)
Using identity types between types
We assume a dependent type theory with type variables and identity types between types.
Theorem
Given types AA and A′A' and type families x:A⊢B(x)x:A \vdash B(x), x:A′⊢B′(x)x:A' \vdash B'(x) and identity types between types p A:A=A′p_A:A = A' and dependent function p B:∏ x:AB(x)=B′(idtoequiv(p A,x))p_B:\prod_{x:A} B(x) = B'(\mathrm{idtoequiv}(p_A, x)) consisting of a family of identity types between types, there is an identity type between the types
congform(p A,p B):(∏ x:AB(x))=(∏ x:A′B′(x))\mathrm{congform}(p_A, p_B):\left(\prod_{x:A} B(x)\right) = \left(\prod_{x:A'} B'(x)\right)
…
Weak dependent product types
Theorem
Assuming dependent function extensionality, given types AA and A′A' and type families x:A⊢B(x)x:A \vdash B(x) and x:A⊢B′(x)x:A \vdash B'(x) and equivalences e A:A≃A′e_A:A \simeq A' and dependent function of equivalences e B:∏ x:AB(x)≃B′(e(x))e_B:\prod_{x:A} B(x) \simeq B'(e(x)), there is an equivalence
congform(e A,e B):(∏ x:AB(x))≃(∏ x:A′B′(x))\mathrm{congform}(e_A, e_B):\left(\prod_{x:A} B(x)\right) \simeq \left(\prod_{x:A'} B'(x)\right)
Since dependent function types are negative types, we first present the typal congruence rule for the elimination rule of dependent function types
Theorem
Given a type AA and a type family x:A⊢B(x)x:A \vdash B(x), dependent functions f:∏ x:AB(x)f:\prod_{x:A} B(x) and g:∏ x:AB(x)g:\prod_{x:A} B(x) and an identification p:f= ∏ x:AB(x)gp:f =_{\prod_{x:A} B(x)} g there are families of identifications x:A⊢compelim(f,g,p)(x):f(x)= B(x)g(x)x:A \vdash \mathrm{compelim}(f, g, p)(x):f(x) =_{B(x)} g(x).
Proof
We simply define the dependent function compelim\mathrm{compelim} to be happly, which is inductively defined on identity types.
The next is the typal congruence rule for the uniqueness rule of dependent function types.
Theorem
For weak dependent product types with dependent function
η:∏ f:∏ x:AB(x)f= ∏ x:AB(x)λx:A.f(x)\eta:\prod_{f:\prod_{x:A} B(x)} f =_{\prod_{x:A} B(x)} \lambda x:A.f(x)
given
-
a type AA
-
a type family x:A⊢B(x)x:A \vdash B(x)
-
dependent functions f:∏ x:AB(x)f:\prod_{x:A} B(x) and f′:∏ x:AB(x)f':\prod_{x:A} B(x)
-
an identification p:f= ∏ x:AB(x)f′p:f =_{\prod_{x:A} B(x)} f',
there is a family of identifications
etaCong ∏(f,f′,p):transport(f,f′,p)(η ∏ x:AB(x)(f))= f= ∏ x:AB(x)λx:A.f(x)η ∏ x:AB(x)(f′)\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')
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.
Theorem
Assuming dependent function extensionality, given a type AA and a type family x:A⊢B(x)x:A \vdash B(x), families of elements x:A⊢b(x):B(x)x:A \vdash b(x):B(x) and x:A⊢b′(x):B(x)x:A \vdash b'(x):B(x), and families of identifications x:A⊢p(x):b(x)= B(x)b′(x)x:A \vdash p(x):b(x) =_{B(x)} b'(x), there is an identification
congintro x:A.p(x):λ(x:A).b(x)= ∏ x:AB(x)λ(x:A).b′(x)\mathrm{congintro}_{x:A.p(x)}:\lambda (x:A).b(x) =_{\prod_{x:A} B(x)} \lambda (x:A).b'(x)
Proof
By the computation rule of weak dependent function types, there are families of identifications
x:A⊢β ∏ x:AB(x) x:A.b(x)(b(x)):((λ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)
x:A⊢β ∏ x:AB(x) x:A.b′(x)(b′(x)):((λ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⊢β ∏ x:AB(x) x:A.b(x)(b(x))•p(x)•β ∏ x:AB(x) x:A.b′(x)(b′(x)) −1:(λx:A.b(x))(x)= B(x)(λx:A.b′(x))(x)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
λ(x:A).β ∏ x:AB(x) x:A.b(x)(b(x))•p(x)•β ∏ x:AB(x) x:A.b′(x)(b′(x)) −1:(λx:A.b(x))(x)= B(x)(λx:A.b′(x))(x)\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
ext ∏ x:AB(x) −1:(λx:A.b(x))= ∏ x:AB(x)(λx:A.b′(x))≃∏ x:AId B(x)((λx:A.b(x))(x),(λx:A.b′(x))(x))\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
ext ∏ x:AB(x) −1−1(λ(x:A).β ∏ x:AB(x) x:A.b(x)(b(x))•p(x)•β ∏ x:AB(x) x:A.b′(x)(b′(x)) −1):(λx:A.b(x))= ∏ x:AB(x)(λx:A.b′(x))\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
congintro x:A.p(x)≔ext ∏ x:AB(x) −1−1(λ(x:A).β ∏ x:AB(x) x:A.b(x)(b(x))•p(x)•β ∏ x:AB(x) x:A.b′(x)(b′(x)) −1):(λx:A.b(x))= ∏ x:AB(x)(λx:A.b′(x))\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))
Application in logic
In logic, dependent functions types express universal quantifications. More precisely, for x:A⊢ϕ(x)x:A \vdash \phi(x) a predicate on a type AA, under propositions as types the universal quantification ∀x:A.ϕ(x)\forall x:A.\phi(x) is the dependent product type ∏ x:Aϕ(x)\prod_{x:A} \phi(x) (or rather the bracket type of that if one wishes to force this to be of type PropProp again ).
Graph of a dependent function
Given a type AA and a type family x:A⊢B(x)x:A \vdash B(x), there is a function
graph:(∏ x:AB(x))→(A→∑ x:AB(x))\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:∏ x:AB(x)f:\prod_{x:A} B(x) and returns the graph of a dependent function
graph(f):A→∑ x:AB(x)\mathrm{graph}(f):A \to \sum_{x:A} B(x)
defined by graph(f)(x)≡(x,f(x))\mathrm{graph}(f)(x) \equiv (x, f(x)) for all x:Ax:A. As a dependent anafunction the graph of the dependent function is represented by the identity type family
x:A,y:B(x)⊢f(x)= B(x)yx:A, y:B(x) \vdash f(x) =_{B(x)} y
Relation to sections
A family of type x:A⊢B(x)x:A \vdash B(x) is equivalently a type BB with a function f:B→Af:B \to A. Then each B(x)B(x) is defined as the fiber of ff at element x:Ax:A. Then the dependent product of a function is defined as the dependent product type
Π A,B(f)≔∏ x:A∑ y:Bf(y)= Ax\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
Π A,B(f)≔∑ g:A→B∏ x:Af(g(x))= Ax\Pi_{A, B}(f) \coloneqq \sum_{g:A \to B} \prod_{x:A} f(g(x)) =_A x
which says that gg is a section of ff. One could eliminate the use of the dependent product type entirely by using the definition of dependent product type from function types:
Π A,B(f)≔∑ g:A→B∑ h:A→∑ x:Af(g(x))= Axpr ∑ A∘h= A→Aid A\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 right adjoints to context extension in comprehension categories.
There is also another interpretation in category theory of the dependent product type over x:A⊢B(x)typex:A \vdash B(x) \; \mathrm{type} as the terminal AA-indexed wide span under B(x)B(x), the object ∏ x:AB(x)\prod_{x:A} B(x) with a family of morphisms
π A(x):(∏ x:AB(x))→B(x)\pi_A(x):\left(\prod_{x:A} B(x)\right) \to B(x)
such that for any other object CC with a family of morphisms f(x):C→B(x)f(x):C \to B(x), there exists a unique morphism u C:C→∏ x:AB(x)u_C:C \to \prod_{x:A} B(x) such that
π A(x)∘u C=f(x)\pi_A(x) \circ u_C = f(x)
- 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 of
- Nicola Gambino, Lectures on dependent type theory (pdf)
Another textbook account could be found in section 2.1 of:
- Egbert Rijke, Introduction to Homotopy Type Theory, Cambridge Studies in Advanced Mathematics, Cambridge University Press (arXiv:2212.11082)
as well as sections 1.4 and 2.9 of:
See also:
- Richard Garner, On the strength of dependent products in the type theory of Martin-Löf, arXiv.
On the categorical semantics of dependent product types as relative right adjoints to context extension in comprehension categories:
- Michael Lindgren, Dependent products as relative adjoints, Stockholm (2021) [pdf]
Last revised on December 17, 2024 at 16:02:06. See the history of this page for a list of all contributions to it.