nLab judgmental equality

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.

Judgmental equality can be contrasted with propositional equality, where equality is a proposition, and typal equality, where equality is a type.

Judgments

In the model of dependent type theory which uses judgmental equality for definitional equality, judgmental equality of types, terms, and contexts are given by the following judgments:

  • ΓAAtype\Gamma \vdash A \equiv A' \; \mathrm{type} - AA and AA' are judgementally equal well-typed types in context Γ\Gamma.
  • Γaa:A\Gamma \vdash a \equiv a' : A - aa and aa' are judgementally equal well-typed terms of type AA in context Γ\Gamma.
  • ΓΓctx\Gamma \equiv \Gamma' \; \mathrm{ctx} - Γ\Gamma and Γ\Gamma' are judgementally equal contexts.

Structural rules

Judgmental equality has its own structural rules: reflexivity, symmetry, transitivity, the principle of substitution, and the variable conversion rule.

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

    ΓABtypeΓBAtype\frac{\Gamma \vdash A \equiv B \; \mathrm{type}}{\Gamma \vdash B \equiv A \; \mathrm{type}}
    ΓAtypeΓab:AΓba:A\frac{\Gamma \vdash A \; \mathrm{type} \quad \Gamma \vdash a \equiv b:A}{\Gamma \vdash b \equiv a:A}
    ΓΔctxΔΓctx\frac{\Gamma \equiv \Delta \; \mathrm{ctx}}{\Delta \equiv \Gamma \; \mathrm{ctx}}
  • 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}}
    Γ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}
    ΓΔctxΔΞctxΓΞctx\frac{\Gamma \equiv \Delta \; \mathrm{ctx} \quad \Delta \equiv \Xi \; \mathrm{ctx}}{\Gamma \equiv \Xi \; \mathrm{ctx}}
  • Principle of substitution for judgmentally equal terms:

    ΓAtypeΓab:AΓ,x:A,ΔBtypeΓ,Δ[b/x]B[a/x]B[b/x]type\frac{\Gamma \vdash A \; \mathrm{type} \quad \Gamma \vdash a \equiv b : A \quad \Gamma, x:A, \Delta \vdash B \; \mathrm{type}}{\Gamma, \Delta[b/x] \vdash B[a/x] \equiv B[b/x] \; \mathrm{type}}
    ΓAtypeΓab:AΓ,x:A,Δc:BΓ,Δ[b/x]c[a/x]c[b/x]:B[b/x]\frac{\Gamma \vdash A \; \mathrm{type} \quad \Gamma \vdash a \equiv b : A \quad \Gamma, x:A, \Delta \vdash c:B}{\Gamma, \Delta[b/x] \vdash c[a/x] \equiv c[b/x]: B[b/x]}
  • 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}}
  • The context conversion rule for judgmentally equal contexts

    Γ𝒥ΓΔctxΔ𝒥\frac{\Gamma \vdash \mathcal{J} \quad \Gamma \equiv \Delta \; \mathrm{ctx}}{\Delta \vdash \mathcal{J}}

In addition, if the dependent type theory has type definition judgments BAtypeB \coloneqq A \; \mathrm{type} term definition judgments ba:Ab \coloneqq a:A, and context definition judgments ΔΓctx\Delta \coloneqq \Gamma \; \mathrm{ctx} then judgmental equality is used in the following rules:

  • Formation and judgmental equality reflection rules for type definition:

    ΓBAtypeΓBtypeΓBAtypeΓBAtype\frac{\Gamma \vdash B \coloneqq A \; \mathrm{type}}{\Gamma \vdash B \; \mathrm{type}} \qquad \frac{\Gamma \vdash B \coloneqq A \; \mathrm{type}}{\Gamma \vdash B \equiv A\; \mathrm{type}}
  • Introduction and judgmental equality reflection rules for term definition:

    Γba:AΓb:AΓba:AΓba:A\frac{\Gamma \vdash b \coloneqq a:A}{\Gamma \vdash b:A} \qquad \frac{\Gamma \vdash b \coloneqq a:A}{\Gamma \vdash b \equiv a:A}
  • Formation and judgmental equality reflection rules for context definition:

    ΔΓctxΔctxΔΓctxΔΓctx\frac{\Delta \coloneqq \Gamma \; \mathrm{ctx}}{\Delta \; \mathrm{ctx}} \qquad \frac{\Delta \coloneqq \Gamma \; \mathrm{ctx}}{\Delta \equiv \Gamma \; \mathrm{ctx}}

In computation and uniqueness rules

Judgmental equality 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/x]:B[a/x]\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/x]:B[a/x]}
  • 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 dependent sum types:
Γ,x:Ab(x):B(x)Γa:AΓπ 1(a,b)a:AΓ,x:Ab:BΓa:AΓπ 2(a,b)b:B(π 1(a,b))\frac{\Gamma, x:A \vdash b(x):B(x) \quad \Gamma \vdash a:A}{\Gamma \vdash \pi_1(a, b) \equiv a:A} \qquad \frac{\Gamma, x:A \vdash b:B \quad \Gamma \vdash a:A}{\Gamma \vdash \pi_2(a, b) \equiv b:B(\pi_1(a, b))}
  • Uniqueness rules for 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= AbCtypeΓ,c:At:C[c/a,c/b,refl A(c)/p]Γ,c:AJ(t,c,c,refl(c))t:C[c/a,c/b,refl A(c)/p]\frac{\Gamma, a:A, b:A, p:a =_A b \vdash C \; \mathrm{type} \quad \Gamma, c:A \vdash t:C[c/a, c/b, \mathrm{refl}_A(c)/p]}{\Gamma, c:A \vdash J(t, c, c, \mathrm{refl}(c)) \equiv t:C[c/a, c/b, \mathrm{refl}_A(c)/p]}

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 December 1, 2022 at 03:38:56. See the history of this page for a list of all contributions to it.