nLab judgmental equality

Redirected from "judgmental equality of types".

Context

Type theory

natural deduction metalanguage, practical foundations

  1. type formation rule
  2. term introduction rule
  3. term elimination rule
  4. computation rule

type theory (dependent, intensional, observational type theory, homotopy type theory)

syntax object language

computational trinitarianism =
propositions as types +programs as proofs +relation type theory/category theory

logicset theory (internal logic of)category theorytype theory
propositionsetobjecttype
predicatefamily of setsdisplay morphismdependent type
proofelementgeneralized elementterm/program
cut rulecomposition of classifying morphisms / pullback of display mapssubstitution
introduction rule for implicationcounit for hom-tensor adjunctionlambda
elimination rule for implicationunit for hom-tensor adjunctionapplication
cut elimination for implicationone of the zigzag identities for hom-tensor adjunctionbeta reduction
identity elimination for implicationthe other zigzag identity for hom-tensor adjunctioneta conversion
truesingletonterminal object/(-2)-truncated objecth-level 0-type/unit type
falseempty setinitial objectempty type
proposition, truth valuesubsingletonsubterminal object/(-1)-truncated objecth-proposition, mere proposition
logical conjunctioncartesian productproductproduct type
disjunctiondisjoint union (support of)coproduct ((-1)-truncation of)sum type (bracket type of)
implicationfunction set (into subsingleton)internal hom (into subterminal object)function type (into h-proposition)
negationfunction set into empty setinternal hom into initial objectfunction type into empty type
universal quantificationindexed cartesian product (of family of subsingletons)dependent product (of family of subterminal objects)dependent product type (of family of h-propositions)
existential quantificationindexed disjoint union (support of)dependent sum ((-1)-truncation of)dependent sum type (bracket type of)
logical equivalencebijection setobject of isomorphismsequivalence type
support setsupport object/(-1)-truncationpropositional truncation/bracket type
n-image of morphism into terminal object/n-truncationn-truncation modality
equalitydiagonal function/diagonal subset/diagonal relationpath space objectidentity type/path type
completely presented setsetdiscrete object/0-truncated objecth-level 2-type/set/h-set
setset with equivalence relationinternal 0-groupoidBishop set/setoid with its pseudo-equivalence relation an actual equivalence relation
equivalence class/quotient setquotientquotient type
inductioncolimitinductive type, W-type, M-type
higher inductionhigher colimithigher inductive type
-0-truncated higher colimitquotient inductive type
coinductionlimitcoinductive type
presettype without identity types
set of truth valuessubobject classifiertype of propositions
domain of discourseuniverseobject classifiertype universe
modalityclosure operator, (idempotent) monadmodal type theory, monad (in computer science)
linear logic(symmetric, closed) monoidal categorylinear type theory/quantum computation
proof netstring diagramquantum circuit
(absence of) contraction rule(absence of) diagonalno-cloning theorem
synthetic mathematicsdomain specific embedded programming language

homotopy levels

semantics

Equality and Equivalence

Contents

Idea

In any type theory, judgmental equality is the notion of equality which is defined to be a judgment. Judgmental equality is most commonly used in single-level type theories like Martin-Löf type theory or higher observational type theory for making inductive definitions, but it is also used in cubical type theory and simplicial type theory to define probe shapes for (infinity,1)-categorical types which could not be coherently defined in vanilla dependent type theory.

There are two different kinds of judgmental equalities

Judgmental equality of types is not necessary for dependent type theory with a separate type judgment. It behaves similarly to the equality between sets in structural set theory, and the equality between sets is not necessary for structural set theory since one could simply work with bijections or one-to-one correspondences between sets. Similarly, in dependent type theory, one could just work with definitional isomorphism or some notion of equivalence of types instead of judgmental equality of types.

Judgmental equality of terms

Judgmental equality of terms is given by the following judgment:

  • Γaa:A\Gamma \vdash a \equiv a' : A - aa and aa' are judgmentally equal well-typed terms of type AA in context Γ\Gamma.

There are two different notions of judgmental equality of terms which could be distinguished:

Strict judgmental equalities of terms are used in most dependent type theories. Weak judgmental equalities of terms can be used in weak type theories, where a direct translation of the inference rules of the types in Martin-Löf type theory results in a weak version of Martin-Löf type theory.

Judgmental equality of terms can be contrasted with propositional equality of terms, where equality is a proposition in the sense of first-order logic, and typal equality of terms, where equality is a type.

Weak judgmental equality

Weak judgmental equality of terms is simply given by a reflection rule into the identity type:

Γaa:AΓδ a,a:a= Aa\frac{\Gamma \vdash a \equiv a':A}{\Gamma \vdash \delta_{a, a'}:a =_A a'}

Strict judgmental equality

Strict judgmental equality is an equivalence relation:

  • Reflexivity of judgmental equality
ΓAtypeΓa:AΓaa:A\frac{\Gamma \vdash A \; \mathrm{type} \quad \Gamma \vdash a:A}{\Gamma \vdash a \equiv a:A}
  • Symmetry of judgmental equality

    ΓAtypeΓab:AΓba:A\frac{\Gamma \vdash A \; \mathrm{type} \quad \Gamma \vdash a \equiv b:A}{\Gamma \vdash b \equiv a:A}
  • Transitivity of judgmental equality

    ΓAtypeΓab:Abc:AΓac:A\frac{\Gamma \vdash A \; \mathrm{type} \quad \Gamma \vdash a \equiv b:A \quad b \equiv c:A }{\Gamma \vdash a \equiv c:A}

In addition, strict judgmental equality of terms has congruence rules for substitution, the principle of substitution:

  • Principle of substitution for judgmentally equal terms:
    Γab:AΓ,x:A,Δc(x):BΓ,Δ(a)c(a)c(b):B\frac{\Gamma \vdash a \equiv b : A \quad \Gamma, x:A, \Delta \vdash c(x):B}{\Gamma, \Delta(a) \vdash c(a) \equiv c(b): B}

If there is a separate type judgment, then there is also a separate rule for the principle of substitution into type families.

If one has judgmental equality of types, then the principle of substitution into type families is given by

ΓAtypeΓab:AΓ,x:A,ΔB(x)typeΓ,Δ(a)B(a)B(b)type\frac{\Gamma \vdash A \; \mathrm{type} \quad \Gamma \vdash a \equiv b : A \quad \Gamma, x:A, \Delta \vdash B(x) \; \mathrm{type}}{\Gamma, \Delta(a) \vdash B(a) \equiv B(b) \; \mathrm{type}}

This implies the reflection rule of weak judgmental equalities because one could derive the following rule:

Γab:AΓrefl A(a):a= Ab\frac{\Gamma \vdash a \equiv b:A}{\Gamma \vdash \mathrm{refl}_A(a):a =_A b}

Otherwise, the principle of substitution into type families is given by definitional transport across judgmental equality as explicit conversion:

ΓAtypeΓab:AΓ,x:A,ΔB(x)typeΓ,Δ(a)tr B() ab:B(a)B(b)\frac{\Gamma \vdash A \; \mathrm{type} \quad \Gamma \vdash a \equiv b : A \quad \Gamma, x:A, \Delta \vdash B(x) \; \mathrm{type}}{\Gamma, \Delta(a) \vdash \mathrm{tr}_{B(-)}^{a \equiv b}:B(a) \cong B(b)}

where ABA \cong B is the definitional isomorphism type defined using natural deduction inference rules. If one doesn’t have a type of definitional isomorphisms, one could define it by components

ΓAtypeΓab:AΓ,x:A,ΔB(x)typeΓ,y:B(a),Δ(a)tr B() ab(y):B(b)\frac{\Gamma \vdash A \; \mathrm{type} \quad \Gamma \vdash a \equiv b : A \quad \Gamma, x:A, \Delta \vdash B(x) \; \mathrm{type}}{\Gamma, y:B(a), \Delta(a) \vdash \mathrm{tr}_{B(-)}^{a \equiv b}(y):B(b)}
ΓAtypeΓa:AΓ,x:A,ΔB(x)typeΓ,y:B(a),Δ(a)tr B() aa(y)y:B(a)\frac{\Gamma \vdash A \; \mathrm{type} \quad \Gamma \vdash a: A \quad \Gamma, x:A, \Delta \vdash B(x) \; \mathrm{type}}{\Gamma, y:B(a), \Delta(a) \vdash \mathrm{tr}_{B(-)}^{a \equiv a}(y) \equiv y:B(a)}
ΓAtypeΓab:AΓ,x:A,ΔB(x)typeΓ,y:B(a),Δ(a)tr B() ba(tr B() ab(y))y:B(a)\frac{\Gamma \vdash A \; \mathrm{type} \quad \Gamma \vdash a \equiv b : A \quad \Gamma, x:A, \Delta \vdash B(x) \; \mathrm{type}}{\Gamma, y:B(a), \Delta(a) \vdash \mathrm{tr}_{B(-)}^{b \equiv a}(\mathrm{tr}_{B(-)}^{a \equiv b}(y)) \equiv y:B(a)}
ΓAtypeΓab:AΓbc:AΓ,x:A,ΔB(x)typeΓ,y:B(a),Δ(a)tr B() bc(tr B() ab(y))tr B() ac(y):B(c)\frac{\Gamma \vdash A \; \mathrm{type} \quad \Gamma \vdash a \equiv b : A \quad \Gamma \vdash b \equiv c : A \quad \Gamma, x:A, \Delta \vdash B(x) \; \mathrm{type}}{\Gamma, y:B(a), \Delta(a) \vdash \mathrm{tr}_{B(-)}^{b \equiv c}(\mathrm{tr}_{B(-)}^{a \equiv b}(y)) \equiv \mathrm{tr}_{B(-)}^{a \equiv c}(y):B(c)}

This shows that transport across judgmental equality forms a groupoid.

Either way, this also implies the reflection rule of weak judgmental equalities because one could derive the following rule

Γab:AΓtr a= A() ab(refl A(a)):a= Ab\frac{\Gamma \vdash a \equiv b:A}{\Gamma \vdash \mathrm{tr}_{a =_A (-)}^{a \equiv b}(\mathrm{refl}_A(a)):a =_A b}

Similarly, for a term c(x):B(x)c(x):B(x) dependent upon x:Ax:A, if one has judgmental equality of types, then the principle of substitution across c(x)c(x) is given by the rule:

ΓAtypeΓab:AΓ,x:A,Δc(x):B(x)Γ,Δ(b)c(a)c(b):B(b)\frac{\Gamma \vdash A \; \mathrm{type} \quad \Gamma \vdash a \equiv b : A \quad \Gamma, x:A, \Delta \vdash c(x):B(x)}{\Gamma, \Delta(b) \vdash c(a) \equiv c(b):B(b)}

Otherwise, it is given by a judgmental version of function application to identifications:

ΓAtypeΓab:AΓ,x:A,Δc(x):B(x)Γ,Δ(b)tr B() ab(c(a))c(b):B(b)\frac{\Gamma \vdash A \; \mathrm{type} \quad \Gamma \vdash a \equiv b : A \quad \Gamma, x:A, \Delta \vdash c(x):B(x)}{\Gamma, \Delta(b) \vdash \mathrm{tr}_{B(-)}^{a \equiv b}(c(a)) \equiv c(b):B(b)}

In computation and uniqueness rules

Judgmental equality of terms can be used in the computation rules and uniqueness rules of types:

  • Computation rules for dependent product types:
Γ,x:Ab(x):B(x)Γa:AΓλ(x:A).b(x)(a)b(a):B(a)\frac{\Gamma, x:A \vdash b(x):B(x) \quad \Gamma \vdash a:A}{\Gamma \vdash \lambda(x:A).b(x)(a) \equiv b(a):B(a)}
  • Uniqueness rules for dependent product types:
Γf: x:AB(x)Γfλ(x).f(x): x:AB(x)\frac{\Gamma \vdash f:\prod_{x:A} B(x)}{\Gamma \vdash f \equiv \lambda(x).f(x):\prod_{x:A} B(x)}
  • Computation rules for negative dependent sum types:
Γ,x:AB(x)typeΓa:AΓb:B(a)Γπ 1(a,b)a:AΓ,x:AB(x)typeΓa:AΓb:B(a)Γπ 2(a,b)b:B(a)\frac{\Gamma, x:A \vdash B(x) \; \mathrm{type} \quad \Gamma \vdash a:A \quad \Gamma \vdash b:B(a)}{\Gamma \vdash \pi_1(a, b) \equiv a:A} \qquad \frac{\Gamma, x:A \vdash B(x) \; \mathrm{type} \quad \Gamma \vdash a:A \quad \Gamma \vdash b:B(a)}{\Gamma \vdash \pi_2(a, b) \equiv b:B(a)}

If one does not have judgmental equality of types, then one would have to use transport across judgmental equality for the second computation rule:

Γ,x:AB(x)typeΓa:AΓb:B(a)Γtr B() π 1(a,b)a(π 2(a,b))b:B(a)\frac{\Gamma, x:A \vdash B(x) \; \mathrm{type} \quad \Gamma \vdash a:A \quad \Gamma \vdash b:B(a)}{\Gamma \vdash \mathrm{tr}_{B(-)}^{\pi_1(a, b) \equiv a}(\pi_2(a, b)) \equiv b:B(a)}
  • Uniqueness rules for negative dependent sum types:
Γz: x:AB(x)Γz(π 1(z),π 2(z)): x:AB(x)\frac{\Gamma \vdash z:\sum_{x:A} B(x)}{\Gamma \vdash z \equiv (\pi_1(z), \pi_2(z)):\sum_{x:A} B(x)}
  • Computation rules for identity types:
Γ,a:A,b:A,p:a= AbC(a,b,p)typeΓt: c:AC(c,c,refl A(c))Γ,c:AJ(t,c,c,refl(c))t:C(c,c,refl A(c))\frac{\Gamma, a:A, b:A, p:a =_A b \vdash C(a, b, p) \; \mathrm{type} \quad \Gamma \vdash t:\prod_{c:A} C(c, c, \mathrm{refl}_A(c))}{\Gamma, c:A \vdash J(t, c, c, \mathrm{refl}(c)) \equiv t:C(c, c, \mathrm{refl}_A(c))}

Judgmental equality of types

In dependent type theory with a separate type judgment, judgmental equality of types is given by the following judgment:

  • ΓAAtype\Gamma \vdash A \equiv A' \; \mathrm{type} - AA and AA' are judgmentally equal well-typed types in context Γ\Gamma.

There are two different notions of judgmental equality of types which could be distinguished:

  • Weak judgmental equality of types is just a shorthand for equivalence of types

  • Strict judgmental equality of types could be thought of as making explicit the implicit coercion of equivalent types as subtypes, and is preserved throughout the type theory as congruences.

In either case, judgmental equality of types is primarily used for definitional equality of types.

Weak judgmental equality

Weak judgmental equality of types is given by one of the two sets of structural rules:

  • The variable conversion rule for judgmentally equal types:
    ΓABtypeΓ,x:A,Δ𝒥Γ,x:B,Δ𝒥\frac{\Gamma \vdash A \equiv B \; \mathrm{type} \quad \Gamma, x:A, \Delta \vdash \mathcal{J}}{\Gamma, x:B, \Delta \vdash \mathcal{J}}

or

  • Rules for isomorphisms between judgmentally equal types:
ΓABtypeΓ,x:Aδ A,B(x):BΓABtypeΓ,y:Bδ A,B 1(x):A\frac{\Gamma \vdash A \equiv B \; \mathrm{type}}{\Gamma, x:A \vdash \delta_{A, B}(x):B} \qquad \frac{\Gamma \vdash A \equiv B \; \mathrm{type}}{\Gamma, y:B \vdash \delta_{A, B}^{-1}(x):A}
ΓABtypeΓ,x:Aδ A,B 1(δ A,B(x))x:AΓABtypeΓ,y:Bδ A,B(δ A,B 1(y))y:B\frac{\Gamma \vdash A \equiv B \; \mathrm{type}}{\Gamma, x:A \vdash \delta_{A, B}^{-1}(\delta_{A, B}(x)) \equiv x:A} \qquad \frac{\Gamma \vdash A \equiv B \; \mathrm{type}}{\Gamma, y:B \vdash \delta_{A, B}(\delta_{A, B}^{-1}(y)) \equiv y:B}

In the first case, one could construct isomorphisms from the variable conversion rule, other structural rules, and the rules for function types:

From the generic term rule and the variable conversion rule for judgmentally equal types AAA \equiv A' we have x:Ax:Ax:A' \vdash x:A and x:Ax:Ax:A \vdash x:A', whereby from the introduction and computation rules for function types we have functions λx:A.x:AA\lambda x:A'.x:A' \to A and λx:A.x:AA\lambda x:A.x:A \to A' such that

(λx:A.x)((λx:A.x)(x))(λx:A.x)(x)x:A(\lambda x:A'.x)((\lambda x:A.x)(x)) \equiv (\lambda x:A'.x)(x) \equiv x:A
(λx:A.x)((λx:A.x)(x))(λx:A.x)(x)x:A(\lambda x:A.x)((\lambda x:A'.x)(x)) \equiv (\lambda x:A.x)(x) \equiv x:A'

making both functions λx:A.x\lambda x:A'.x and λx:A.x\lambda x:A.x isomorphisms.

Strict judgmental equality

In addition to the variable conversion rule, there are reflexivity, symmetry, and transitivity rules making strict judgmental equality for types an equivalence relation:

  • Reflexivity of judgmental equality
ΓAtypeΓAAtype\frac{\Gamma \vdash A \; \mathrm{type}}{\Gamma \vdash A \equiv A \; \mathrm{type}}
  • Symmetry of judgmental equality

    ΓABtypeΓBAtype\frac{\Gamma \vdash A \equiv B \; \mathrm{type}}{\Gamma \vdash B \equiv A \; \mathrm{type}}
  • Transitivity of judgmental equality

    ΓABtypeΓBCtypeΓACtype\frac{\Gamma \vdash A \equiv B \; \mathrm{type} \quad \Gamma \vdash B \equiv C \; \mathrm{type} }{\Gamma \vdash A \equiv C \; \mathrm{type}}

Congruence rules for judgmental equality of types

In addition, strict judgmental equalities have congruence rules for every type in the type theory.

  • Congruence rules for dependent function types
ΓAAtypeΓ,x:AB(x)B(x)typeΓ x:AB(x) x:AB(x)type\frac{ \begin{array}{c} \Gamma \vdash A \equiv A' \; \mathrm{type} \quad \Gamma, x:A \vdash B(x) \equiv B'(x) \; \mathrm{type} \end{array} }{\Gamma \vdash \prod_{x:A} B(x) \equiv \prod_{x:A'} B'(x)\; \mathrm{type}}
ΓAtypeΓ,x:AB(x)typeΓ,x:Ab(x):B(x)Γ,x:Ab(x):B(x) Γ,x:Ab(x)b(x):B(x)Γλx:A.b(x)λx:A.b(x): x:A.B(x)\frac{ \begin{array}{c} \Gamma \vdash A \; \mathrm{type} \quad \Gamma, x:A \vdash B(x) \; \mathrm{type} \quad \Gamma, x:A \vdash b(x):B(x) \quad \Gamma, x:A \vdash b'(x):B(x) \\ \Gamma, x:A \vdash b(x) \equiv b'(x):B(x) \end{array} }{\Gamma \vdash \lambda x:A.b(x) \equiv \lambda x:A.b'(x):\prod_{x:A}.B(x)}
ΓAtypeΓ,x:AB(x)typeΓf: x:AB(x)f: x:AB(x) Γff: x:AB(x)Γ,x:Af(x)f(x):B(x)\frac{ \begin{array}{c} \Gamma \vdash A \; \mathrm{type} \quad \Gamma, x:A \vdash B(x) \; \mathrm{type} \quad \Gamma \vdash f:\prod_{x:A} B(x) \quad f':\prod_{x:A} B(x) \\ \Gamma \vdash f \equiv f':\prod_{x:A} B(x) \end{array} }{\Gamma, x:A \vdash f(x) \equiv f'(x):B(x)}
ΓAtypeΓ,x:AB(x)typeΓ,x:Ab(x):B(x)Γ,x:Ab(x):B(x) Γ,x:Ab(x)b(x):B(x)Γβ A,Bx:A.b(x)β A,Bx:A.b(x): x:Ab(x)= B(x)(λx:A.b(x))(x)\frac{ \begin{array}{c} \Gamma \vdash A \; \mathrm{type} \quad \Gamma, x:A \vdash B(x) \; \mathrm{type} \quad \Gamma, x:A \vdash b(x):B(x) \quad \Gamma, x:A \vdash b'(x):B(x) \\ \Gamma, x:A \vdash b(x) \equiv b'(x):B(x) \end{array} }{\Gamma \vdash \beta_{\prod}^{A, B} x:A.b(x) \equiv \beta_{\prod}^{A, B} x:A.b'(x):\prod_{x:A} b(x) =_{B(x)} (\lambda x:A.b(x))(x)}
ΓAtypeΓ,x:AB(x)typeΓ,x:AB(x)type Γ,x:AB(x)B(x)typeΓη A,Bη A,B: f: x:AB(x)f= x:AB(x)λx:A.f(x)\frac{ \begin{array}{c} \Gamma \vdash A \; \mathrm{type} \quad \Gamma, x:A \vdash B(x) \; \mathrm{type} \quad \Gamma, x:A \vdash B'(x) \; \mathrm{type} \\ \Gamma, x:A \vdash B(x) \equiv B'(x) \; \mathrm{type} \end{array} }{\Gamma \vdash \eta_{\prod}^{A, B} \equiv \eta_{\prod}^{A, B'}:\prod_{f:\prod_{x:A} B(x)} f =_{\prod_{x:A} B(x)} \lambda x:A.f(x)}
  • Congruence rules for dependent pair types:
ΓAAtypeΓ,x:AB(x)B(x)typeΓ x:AB(x) x:AB(x)type\frac{ \begin{array}{c} \Gamma \vdash A \equiv A' \; \mathrm{type} \quad \Gamma, x:A \vdash B(x) \equiv B'(x) \; \mathrm{type} \end{array} }{\Gamma \vdash \sum_{x:A} B(x) \equiv \sum_{x:A'} B'(x)\; \mathrm{type}}
ΓAAtypeΓ,x:AB(x)B(x)typeΓ,x:A,y:B(x)pair A,Bpair A,B: x:AB(x)\frac{ \begin{array}{c} \Gamma \vdash A \equiv A' \; \mathrm{type} \quad \Gamma, x:A \vdash B(x) \equiv B'(x) \; \mathrm{type} \end{array} }{\Gamma, x:A, y:B(x) \vdash \mathrm{pair}_{\sum}^{A, B} \equiv \mathrm{pair}_{\sum}^{A', B'}:\sum_{x:A} B(x)}
ΓAAtypeΓ,x:AB(x)B(x)typeΓ,z: x:AB(x)C(z)C(z)typeΓind A,B,Cind A,B,C: g: x:A y:B(x)C(pair A,B(x,y)) z: x:AB(x)C(z)\frac{ \begin{array}{c} \Gamma \vdash A \equiv A' \; \mathrm{type} \quad \Gamma, x:A \vdash B(x) \equiv B'(x) \; \mathrm{type} \quad \Gamma, z:\sum_{x:A} B(x) \vdash C(z) \equiv C'(z) \; \mathrm{type} \end{array} }{\Gamma \vdash \mathrm{ind}_{\sum}^{A, B, C} \equiv \mathrm{ind}_{\sum}^{A', B', C'}:\prod_{g:\prod_{x:A} \prod_{y:B(x)} C(\mathrm{pair}_{\sum}^{A, B}(x, y))} \prod_{z:\sum_{x:A} B(x)} C(z)}
ΓAAtypeΓ,x:AB(x)B(x)typeΓ,z: x:AB(x)C(z)C(z)typeΓβ A,B,Cβ A,B,C: g: x:A y:B(x)C(pair A,B(x,y)) x:A y:B(x)ind A,B,C(g,pair A,B(x,y))= C(pair A,B(x,y))g(x,y)\frac{ \begin{array}{c} \Gamma \vdash A \equiv A' \; \mathrm{type} \quad \Gamma, x:A \vdash B(x) \equiv B'(x) \; \mathrm{type} \quad \Gamma, z:\sum_{x:A} B(x) \vdash C(z) \equiv C'(z) \; \mathrm{type} \end{array} }{\Gamma \vdash \beta_{\sum}^{A, B, C} \equiv \beta_{\sum}^{A', B', C'}:\prod_{g:\prod_{x:A} \prod_{y:B(x)} C(\mathrm{pair}_{\sum}^{A, B}(x, y))} \prod_{x:A} \prod_{y:B(x)} \mathrm{ind}_{\sum}^{A, B, C}(g, \mathrm{pair}_{\sum}^{A, B}(x, y)) =_{C(\mathrm{pair}_{\sum}^{A, B}(x, y))} g(x, y)}
  • Congruence rules for identity types:
ΓAAtypeΓ,x:A,y:Ax= Ayx= Ay\frac{\Gamma \vdash A \equiv A' \; \mathrm{type}}{\Gamma, x:A, y:A \vdash x =_A y \equiv x =_{A'} y}
ΓAAtypeΓrefl Arefl A: x:Ax= Ax\frac{\Gamma \vdash A \equiv A' \; \mathrm{type}}{\Gamma \vdash \mathrm{refl}_A \equiv \mathrm{refl}_{A'}:\prod_{x:A} x =_A x}
ΓAAtypeΓ,x:A,y:A,p:x= AyC(x,y,p)C(x,y,p)typeΓind = A,Cind = A,C: t: x:AC(x,x,refl A(x)) x:A y:A p:x= AyC(x,y,p)\frac{ \begin{array}{c} \Gamma \vdash A \equiv A' \; \mathrm{type} \quad \Gamma, x:A, y:A, p:x =_A y \vdash C(x, y, p) \equiv C'(x, y, p) \; \mathrm{type} \end{array} }{\Gamma \vdash \mathrm{ind}_{=}^{A, C} \equiv \mathrm{ind}_{=}^{A', C'}:\prod_{t:\prod_{x:A} C(x, x, \mathrm{refl}_A(x))} \prod_{x:A} \prod_{y:A} \prod_{p:x =_A y} C(x, y, p)}
ΓAAtypeΓ,x:A,y:A,p:x= AyC(x,y,p)C(x,y,p)typeΓβ ind = A,Cβ ind = A,C: t: x:AC(x,x,refl A(x)) x:Aind = A,C(t,x,x,refl A(x))= C(x,x,refl A(x))t(x)\frac{ \begin{array}{c} \Gamma \vdash A \equiv A' \; \mathrm{type} \quad \Gamma, x:A, y:A, p:x =_A y \vdash C(x, y, p) \equiv C'(x, y, p) \; \mathrm{type} \end{array} }{\Gamma \vdash \beta_{ \mathrm{ind}_=}^{A, C} \equiv \beta_{\mathrm{ind}_=}^{A', C'}:\prod_{t:\prod_{x:A} C(x, x, \mathrm{refl}_A(x))} \prod_{x:A} \mathrm{ind}_{=}^{A, C}(t, x, x, \mathrm{refl}_A(x)) =_{C(x, x, \mathrm{refl}_A(x))} t(x)}
  • Congruence rules for the empty type:
Γ,x:C(x)C(x)typeΓind Cind C: x:C(x)type\frac{\Gamma, x:\emptyset \vdash C(x) \equiv C'(x) \; \mathrm{type}}{\Gamma \vdash \mathrm{ind}_\emptyset^C \equiv \mathrm{ind}_\emptyset^{C'}:\prod_{x:\emptyset} C(x) \; \mathrm{type}}
  • Congruence rules for the type of booleans:
Γ,x:𝟚C(x)C(x)typeΓind 𝟚 Cind 𝟚 C: a:C(0) b:C(1) x:𝟚C(x)\frac{\Gamma, x:\mathbb{2} \vdash C(x) \equiv C'(x) \; \mathrm{type}}{\Gamma \vdash \mathrm{ind}_\mathbb{2}^C \equiv \mathrm{ind}_\mathbb{2}^{C'}:\prod_{a:C(0)} \prod_{b:C(1)} \prod_{x:\mathbb{2}} C(x)}
Γ,x:𝟚C(x)C(x)typeΓβ 𝟚 0,Cβ 𝟚 0,C: a:C(0) b:C(1)ind 𝟚 C(a,b,0)= C(0)a\frac{\Gamma, x:\mathbb{2} \vdash C(x) \equiv C'(x) \; \mathrm{type}}{\Gamma \vdash \beta_\mathbb{2}^{0, C} \equiv \beta_\mathbb{2}^{0, C'}:\prod_{a:C(0)} \prod_{b:C(1)} \mathrm{ind}_\mathbb{2}^C(a, b, 0) =_{C(0)} a}
Γ,x:𝟚C(x)C(x)typeΓβ 𝟚 1,Cβ 𝟚 1,C: a:C(0) b:C(1)ind 𝟚 C(a,b,1)= C(1)b\frac{\Gamma, x:\mathbb{2} \vdash C(x) \equiv C'(x) \; \mathrm{type}}{\Gamma \vdash \beta_\mathbb{2}^{1, C} \equiv \beta_\mathbb{2}^{1, C'}:\prod_{a:C(0)} \prod_{b:C(1)} \mathrm{ind}_\mathbb{2}^C(a, b, 1) =_{C(1)} b}
  • Congruence rules for the natural numbers type:
Γ,x:C(x)C(x)typeΓind Cind C: c 0:C(0) c s: x:C(x)C(s(x)) x:C(x)\frac{\Gamma, x:\mathbb{N} \vdash C(x) \equiv C'(x) \; \mathrm{type}}{\Gamma \vdash \mathrm{ind}_\mathbb{N}^C \equiv \mathrm{ind}_\mathbb{N}^{C'}:\prod_{c_0:C(0)} \prod_{c_s:\prod_{x:\mathbb{N}} C(x) \to C(s(x))} \prod_{x:\mathbb{N} C(x)}}
Γ,x:C(x)C(x)typeΓβ 0,Cβ 0,C: c 0:C(0) c s: x:C(x)C(s(x))ind C(c 0,c s,0)= C(0)c 0\frac{\Gamma, x:\mathbb{N} \vdash C(x) \equiv C'(x) \; \mathrm{type}}{\Gamma \vdash \beta_\mathbb{N}^{0, C} \equiv \beta_\mathbb{N}^{0, C'}:\prod_{c_0:C(0)} \prod_{c_s:\prod_{x:\mathbb{N}} C(x) \to C(s(x))} \mathrm{ind}_\mathbb{N}^C(c_0, c_s, 0) =_{C(0)} c_0}
Γ,x:C(x)C(x)typeΓβ s,Cβ s,C: c 0:C(0) c s: x:C(x)C(s(x)) x:ind C(c 0,c s,s(x))= C(s(x))c s(x)(ind C(c 0,c s,x))\frac{\Gamma, x:\mathbb{N} \vdash C(x) \equiv C'(x) \; \mathrm{type}}{\Gamma \vdash \beta_\mathbb{N}^{s, C} \equiv \beta_\mathbb{N}^{s, C'}:\prod_{c_0:C(0)} \prod_{c_s:\prod_{x:\mathbb{N}} C(x) \to C(s(x))} \prod_{x:\mathbb{N}} \mathrm{ind}_\mathbb{N}^C(c_0, c_s, s(x)) =_{C(s(x))} c_s(x)(\mathrm{ind}_\mathbb{N}^C(c_0, c_s, x))}

Similarly, we have congruence rules for every axiom in the dependent type theory, such as

ΓAAtypeΓ,x:AB(x)B(x)typeΓfunext A,Bfunext A,B: f; x:AB(x) g: x:AB(x)(f= x:AB(x)g) x:Af(x)= B(x)g(x)\frac{\Gamma \vdash A \equiv A' \; \mathrm{type} \quad \Gamma, x:A \vdash B(x) \equiv B'(x) \; \mathrm{type}}{\Gamma \vdash \mathrm{funext}_{A, B} \equiv \mathrm{funext}_{A', B'}:\prod_{f;\prod_{x:A} B(x)} \prod_{g:\prod_{x:A} B(x)} (f =_{\prod_{x:A} B(x)} g) \simeq \prod_{x:A} f(x) =_{B(x)} g(x)}
ΓAAtypeΓ,x:AB(x)B(x)typeΓ,x:A,y:B(x)C(x,y)C(x,y)typeΓchoice A,B,Cchoice A,B,C:(isSet(A)× x:AisSet(B(x)))x:A.y:B(x).C(x,y)g: x:AB(x).x:A.C(x,g(x))\frac{\Gamma \vdash A \equiv A' \; \mathrm{type} \quad \Gamma, x:A \vdash B(x) \equiv B'(x) \; \mathrm{type} \quad \Gamma, x:A, y:B(x) \vdash C(x, y) \equiv C'(x, y) \; \mathrm{type}}{\Gamma \vdash \mathrm{choice}_{A, B, C} \equiv \mathrm{choice}_{A', B', C'}:\left(\mathrm{isSet}(A) \times \prod_{x:A} \mathrm{isSet}(B(x))\right) \to \forall x:A.\exists y:B(x).C(x, y) \to \exists g:\prod_{x:A} B(x).\forall x:A.C(x, g(x))}

Judgmental equality of contexts

In some dependent type theories, there is also judgmental equality of contexts, which is given by the following judgment:

  • ΓΓctx\Gamma \equiv \Gamma' \; \mathrm{ctx} - Γ\Gamma and Γ\Gamma' are judgmentally equal contexts.

In addition to the variable conversion rule, there are reflexivity, symmetry, and transitivity rules making judgmental equality for contexts an equivalence relation:

  • Reflexivity of judgmental equality
ΓctxΓΓctx\frac{\Gamma \; \mathrm{ctx}}{\Gamma \equiv \Gamma \; \mathrm{ctx}}
  • Symmetry of judgmental equality

    ΓΔctxΔΓctx\frac{\Gamma \equiv \Delta \; \mathrm{ctx}}{\Delta \equiv \Gamma \; \mathrm{ctx}}
  • Transitivity of judgmental equality

    ΓΔctxΔΞctxΓΞctx\frac{\Gamma \equiv \Delta \; \mathrm{ctx} \quad \Delta \equiv \Xi \; \mathrm{ctx}}{\Gamma \equiv \Xi \; \mathrm{ctx}}

See also

References

  • Robin Adams, Pure type systems with judgemental equality, Journal of Functional Programming, Volume 16 Issue 2(2006) (web)

  • Vincent Siles, Hugo Herbelin, Equality is typable in semi-full pure type systems (pdf)

  • Egbert Rijke, Introduction to Homotopy Type Theory, Cambridge Studies in Advanced Mathematics, Cambridge University Press (pdf) (478 pages)

Last revised on May 17, 2024 at 12:40:03. See the history of this page for a list of all contributions to it.