nLab conversion rule

Redirected from "computation rule".

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

Contents

Idea

In type theory, a conversion rule is a rule which constrains the result of combining term introduction with term elimination. Conversion rules come in two types: beta conversion rules or computation rules, and eta conversion rules or uniqueness rules. Computation rules in particular are important, because they are used in inductive definitions. For example, the rules for addition of natural numbers has two computation rules, which derive from the two computation rules of the natural numbers type.

Moreover, conversion rules use equality. The usage of equality in this manner is called conversional equality, and in the context of beta conversion rules is also called computational equality. In type theory, there are three notions of equality, judgmental equality, propositional equality, and typal equality, all of which could be used for conversional equality.

For example, the beta conversion rule for the dependent product type could be expressed in judgmental, propositional, and typal equality:

  • Judgmental beta conversion 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) = b[a/x]:B[a/x]}
  • Propositional beta conversion rules for dependent product types:
Γ,x:Ab(x):B(x)Γa:AΓλ(x:A).b(x)(a)= B[a/x]b[a/x]true\frac{\Gamma, x:A \vdash b(x):B(x) \quad \Gamma \vdash a:A}{\Gamma \vdash \lambda(x:A).b(x)(a) =_{B[a/x]} b[a/x] \; \mathrm{true}}
  • Typal beta conversion 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 \beta_\Pi:\lambda(x:A).b(x)(a) =_{B[a/x]} b[a/x]}

Similarly, the eta-conversion rule for the sum type could be expressed in judgmental, propositional, and typal equality:

  • Judgmental eta conversion rules for sum types:
Γ,z:A+BCtypeΓ,x:Ac:C[inl(x)/z]Γ,y:Bd:C[inr(y)/z]Γe:A+BΓ,z:A+Bu:CΓ,a:Au[inl(a)/z]c[a/x]:C[inl(a)/z]Γ,b:Bu[inr(b)/z]d[b/y]:C[inr(b)/z]Γu[e/z]ind A+B C(c[inl(e)/x],d[inr(e)/y],e):C[e/z]\frac{\Gamma, z:A + B \vdash C \; \mathrm{type} \quad \Gamma, x:A \vdash c:C[\mathrm{inl}(x)/z] \quad \Gamma, y:B \vdash d:C[\mathrm{inr}(y)/z] \quad \Gamma \vdash e:A + B \quad \Gamma, z:A + B \vdash u:C \quad \Gamma, a:A \vdash u[\mathrm{inl}(a)/z] \equiv c[a/x]:C[\mathrm{inl}(a)/z] \quad \Gamma, b:B \vdash u[\mathrm{inr}(b)/z] \equiv d[b/y]:C[\mathrm{inr}(b)/z]}{\Gamma \vdash u[e/z] \equiv \mathrm{ind}_{A + B}^C(c[\mathrm{inl}(e)/x], d[\mathrm{inr}(e)/y], e):C[e/z]}
  • Propositional eta conversion rules for sum types:
Γ,z:A+BCtypeΓ,x:Ac:C[inl(x)/z]Γ,y:Bd:C[inr(y)/z]Γe:A+BΓ,z:A+Bu:CΓ,a:Au[inl(a)/z] C[inl(a)/z]c[a/x]trueΓ,b:Bu[inr(b)/z] C[inr(b)/z]d[b/y]trueΓu[e/z] C[e/z]ind A+B C(c[inl(e)/x],d[inr(e)/y],e)true\frac{\Gamma, z:A + B \vdash C \; \mathrm{type} \quad \Gamma, x:A \vdash c:C[\mathrm{inl}(x)/z] \quad \Gamma, y:B \vdash d:C[\mathrm{inr}(y)/z] \quad \Gamma \vdash e:A + B \quad \Gamma, z:A + B \vdash u:C \quad \Gamma, a:A \vdash u[\mathrm{inl}(a)/z] \equiv_{C[\mathrm{inl}(a)/z]} c[a/x] \; \mathrm{true} \quad \Gamma, b:B \vdash u[\mathrm{inr}(b)/z] \equiv_{C[\mathrm{inr}(b)/z]} d[b/y] \; \mathrm{true}}{\Gamma \vdash u[e/z] \equiv_{C[e/z]} \mathrm{ind}_{A + B}^C(c[\mathrm{inl}(e)/x], d[\mathrm{inr}(e)/y], e) \; \mathrm{true}}
  • Typal eta conversion rules for sum types:
Γ,z:A+BCtypeΓ,x:Ac:C[inl(x)/z]Γ,y:Bd:C[inr(y)/z]Γe:A+BΓ,z:A+Bu:CΓ,a:Ai inl(u):u[inl(a)/z]= C[inl(a)/z]c[a/x]Γ,b:Bi inr(u):u[inr(b)/z]= C[inr(b)/z]d[b/y]Γη A+B(u,e):u[e/z]= C[e/z]ind A+B C(c[inl(e)/x],d[inr(e)/y],e)\frac{\Gamma, z:A + B \vdash C \; \mathrm{type} \quad \Gamma, x:A \vdash c:C[\mathrm{inl}(x)/z] \quad \Gamma, y:B \vdash d:C[\mathrm{inr}(y)/z] \quad \Gamma \vdash e:A + B \quad \Gamma, z:A + B \vdash u:C \quad \Gamma, a:A \vdash i_\mathrm{inl}(u):u[\mathrm{inl}(a)/z] =_{C[\mathrm{inl}(a)/z]} c[a/x] \quad \Gamma, b:B \vdash i_\mathrm{inr}(u):u[\mathrm{inr}(b)/z] =_{C[\mathrm{inr}(b)/z]} d[b/y]}{\Gamma \vdash \eta_{A + B}(u, e):u[e/z] =_{C[e/z]} \mathrm{ind}_{A + B}^C(c[\mathrm{inl}(e)/x], d[\mathrm{inr}(e)/y], e)}

The paradigmatic example of conversional equality is a pair of terms like “(λx.x+x)(2)(\lambda x. x+x)(2)” and “2+22+2”, where the second is obtained by β\beta-reduction from the first. In a type theory that includes definitions by recursion, expansion of a recursor is also computational equality. For instance, if addition is defined by recursion, then “2+22+2” (that is, s(s(0))+s(s(0))s(s(0))+s(s(0))) reduces via this rule to “44” (that is, s(s(s(s(0))))s(s(s(s(0))))).

Contextual conversion rules

There are also contextual conversion rules. These differ from the usual beta-conversion rules in that in that there is an additional context member Δ\Delta attached to the end of the context Γ,x:A\Gamma, x:A so that the full context becomes Γ,x:A,Δ\Gamma, x:A, \Delta. By definition, Δ\Delta is dependent upon x:Ax:A, and the conclusion usually involves substituting x:Ax:A by some given term a:Aa:A in the context, becoming Γ,Δ[a/x]\Gamma, \Delta[a/x].

For example, using the example of the beta-conversion rule for the dependent product type, the contextual beta-conversion rules are given by the following:

  • Judgmental contextual beta-conversion rules for dependent product types:
Γ,x:A,Δb(x):B(x)Γa:AΓ,Δ[a/x]λ(x:A).b(x)(a)b[a/x]:B[a/x]\frac{\Gamma, x:A, \Delta \vdash b(x):B(x) \quad \Gamma \vdash a:A}{\Gamma, \Delta[a/x] \vdash \lambda(x:A).b(x)(a) \equiv b[a/x]:B[a/x]}
  • Propositional contextual beta-conversion rules for dependent product types:
Γ,x:A,Δ|Φb(x):B(x)Γa:AΓ,Δ[a/x]|Φ[a/x]λ(x:A).b(x)(a) B[a/x]b[a/x]true\frac{\Gamma, x:A, \Delta \vert \Phi \vdash b(x):B(x) \quad \Gamma \vdash a:A}{\Gamma, \Delta[a/x] \vert \Phi[a/x] \vdash \lambda(x:A).b(x)(a) \equiv_{B[a/x]} b[a/x] \; \mathrm{true}}
  • Typal contextual beta-conversion rules for dependent product types:
Γ,x:A,Δb(x):B(x)Γa:AΓ,Δ[a/x]β Π:λ(x:A).b(x)(a)= B[a/x]b[a/x]\frac{\Gamma, x:A, \Delta \vdash b(x):B(x) \quad \Gamma \vdash a:A}{\Gamma, \Delta[a/x] \vdash \beta_\Pi:\lambda(x:A).b(x)(a) =_{B[a/x]} b[a/x]}

Similarly, one could define contextual eta-conversion rules for the sum type:

  • Judgmental contextual eta-conversion rules for sum types:
Γ,z:A+B,ΔCtypeΓ,x:A,Δ[inl(x)/z]c:C[inl(x)/z]Γ,y:B,Δ[inr(y)/z]d:C[inr(y)/z]Γe:A+BΓ,z:A+B,Δu:CΓ,a:A,Δ[inl(a)/z]u[inl(a)/z]c[a/x]:C[inl(a)/z]Γ,b:B,Δ[inr(b)/z]u[inr(b)/z]d[b/y]:C[inr(b)/z]Γ,Δ[e/z]u[e/z]ind A+B C(c[inl(e)/x],d[inr(e)/y],e):C[e/z]\frac{\Gamma, z:A + B, \Delta \vdash C \; \mathrm{type} \quad \Gamma, x:A, \Delta[\mathrm{inl}(x)/z] \vdash c:C[\mathrm{inl}(x)/z] \quad \Gamma, y:B, \Delta[\mathrm{inr}(y)/z] \vdash d:C[\mathrm{inr}(y)/z] \quad \Gamma \vdash e:A + B \quad \Gamma, z:A + B, \Delta \vdash u:C \quad \Gamma, a:A, \Delta[\mathrm{inl}(a)/z] \vdash u[\mathrm{inl}(a)/z] \equiv c[a/x]:C[\mathrm{inl}(a)/z] \quad \Gamma, b:B, \Delta[\mathrm{inr}(b)/z] \vdash u[\mathrm{inr}(b)/z] \equiv d[b/y]:C[\mathrm{inr}(b)/z]}{\Gamma, \Delta[e/z] \vdash u[e/z] \equiv \mathrm{ind}_{A + B}^C(c[\mathrm{inl}(e)/x], d[\mathrm{inr}(e)/y], e):C[e/z]}
  • Propositional contextual eta-conversion rules for sum types:
Γ,z:A+B,Δ|ΦCtypeΓ,x:A,Δ[inl(x)/z]|Φ[inl(x)/z]c:C[inl(x)/z]Γ,y:B,Δ[inr(y)/z]|Φ[inr(y)/z]d:C[inr(y)/z]Γe:A+BΓ,z:A+B,Δ|Φu:CΓ,a:A,Δ[inl(a)/z]|Φ[inl(a)/z]u[inl(a)/z] C[inl(a)/z]c[a/x]trueΓ,b:B,Δ[inr(b)/z]|Φ[inr(b)/z]u[inr(b)/z] C[inr(b)/z]d[b/y]trueΓ,Δ[e/z]|Φ[e/z]u[e/z] C[e/z]ind A+B C(c[inl(e)/x],d[inr(e)/y],e)true\frac{\Gamma, z:A + B, \Delta \vert \Phi \vdash C \; \mathrm{type} \quad \Gamma, x:A, \Delta[\mathrm{inl}(x)/z] \vert \Phi[\mathrm{inl}(x)/z] \vdash c:C[\mathrm{inl}(x)/z] \quad \Gamma, y:B, \Delta[\mathrm{inr}(y)/z] \vert \Phi[\mathrm{inr}(y)/z] \vdash d:C[\mathrm{inr}(y)/z] \quad \Gamma \vdash e:A + B \quad \Gamma, z:A + B, \Delta \vert \Phi \vdash u:C \quad \Gamma, a:A, \Delta[\mathrm{inl}(a)/z] \vert \Phi[\mathrm{inl}(a)/z] \vdash u[\mathrm{inl}(a)/z] \equiv_{C[\mathrm{inl}(a)/z]} c[a/x] \; \mathrm{true} \quad \Gamma, b:B, \Delta[\mathrm{inr}(b)/z] \vert \Phi[\mathrm{inr}(b)/z] \vdash u[\mathrm{inr}(b)/z] \equiv_{C[\mathrm{inr}(b)/z]} d[b/y] \; \mathrm{true}}{\Gamma, \Delta[e/z] \vert \Phi[e/z] \vdash u[e/z] \equiv_{C[e/z]} \mathrm{ind}_{A + B}^C(c[\mathrm{inl}(e)/x], d[\mathrm{inr}(e)/y], e) \; \mathrm{true}}
  • Typal contextual eta-conversion rules for sum types:
Γ,z:A+B,ΔCtypeΓ,x:A,Δ[inl(x)/z]c:C[inl(x)/z]Γ,y:B,Δ[inr(y)/z]d:C[inr(y)/z]Γe:A+BΓ,z:A+B,Δu:CΓ,a:A,Δ[inl(a)/z]i inl(u):u[inl(a)/z]= C[inl(a)/z]c[a/x]Γ,b:B,Δ[inr(b)/z]i inr(u):u[inr(b)/z]= C[inr(b)/z]d[b/y]Γ,Δ[e/z]η A+B(u,e):u[e/z]= C[e/z]ind A+B C(c[inl(e)/x],d[inr(e)/y],e)\frac{\Gamma, z:A + B, \Delta \vdash C \; \mathrm{type} \quad \Gamma, x:A, \Delta[\mathrm{inl}(x)/z] \vdash c:C[\mathrm{inl}(x)/z] \quad \Gamma, y:B, \Delta[\mathrm{inr}(y)/z] \vdash d:C[\mathrm{inr}(y)/z] \quad \Gamma \vdash e:A + B \quad \Gamma, z:A + B, \Delta \vdash u:C \quad \Gamma, a:A, \Delta[\mathrm{inl}(a)/z] \vdash i_\mathrm{inl}(u):u[\mathrm{inl}(a)/z] =_{C[\mathrm{inl}(a)/z]} c[a/x] \quad \Gamma, b:B, \Delta[\mathrm{inr}(b)/z] \vdash i_\mathrm{inr}(u):u[\mathrm{inr}(b)/z] =_{C[\mathrm{inr}(b)/z]} d[b/y]}{\Gamma, \Delta[e/z] \vdash \eta_{A + B}(u, e):u[e/z] =_{C[e/z]} \mathrm{ind}_{A + B}^C(c[\mathrm{inl}(e)/x], d[\mathrm{inr}(e)/y], e)}

 See also

 References

Contextual dependent product types and contextual identity types are defined in the appendix of:

where the computation rules are contextual computation rules.

Last revised on November 9, 2022 at 00:50:29. See the history of this page for a list of all contributions to it.