Lectures onType Theory
Recursive types, PCF, domains, and finite observations
appendix sectionrules

Recursive types, PCF, domains, and finite observations

Eager iso-recursive calculus.

The eager fragment inherits 1, products, sums, arrows, and the call-by-value rules of the simple calculus, and locally adds N, numerals, type variables bound by μ, and explicit fold/unfold: A,B::=NXμX.A,e::=nfoldμX.Aeunfolde. The complete local formation and typing delta is

ΔN type
Nat-F
Γn:N
T-Nat
Δ,XA type
ΔμX.A type
Mu-F
Γe:A[μX.A/X]
ΓfoldμX.Ae:μX.A
T-Fold
Γe:μX.A
Γunfolde:A[μX.A/X]
T-Unfold

Values and evaluation contexts gain v::=nfoldμX.Av,E::=foldμX.AEunfoldE, and their sole new root is

unfold(foldμX.Av)v
E-UnfoldFold

The list instance and its canonical folded-cell abbreviation are ListNat=μX.(1+N×X),cell(n,e)=foldListNat(inrn,e). Thus cell(n,v) is a value when v is a value, whereas the curried term consnv takes two beta steps to that syntax.

Contractive regular equality.

A binder μX.A is admitted to the equality algorithm only when every free occurrence of its bound X in A lies strictly below a product, sum, or arrow constructor. Closed admitted types are finite directed graphs. Writing head(a) for the first constructor reached by following recursive back-edges, the worklist transitions are as follows. A visited pair is discarded: ((a,b)::W,V)(W,V)((a,b)V). An unvisited pair rejects when its exposed heads differ in constructor or arity. Otherwise it takes the transition ((a,b)::W,V)(children(a,b)++W,V{(a,b)}). The initial state is ([(a,b)],); an empty worklist accepts. The judgment AμB means bisimilarity of the two unfolded ordered constructor trees, not a term reduction or a subtyping judgment.

Call-by-name PCF.

The separate language PCFn has A,B::=NAB,e::=xnsucceifz e then e0 else x.esλx:A.eeefix x:A.e. Besides the inherited variable, numeral, lambda, and application rules, its typing rules are

Γe:N
Γsucce:N
P-Succ
Γe:NΓe0:AΓ,x:Nes:A
Γifz e then e0 else x.es:A
P-Ifz
Γ,x:Ae:A
Γfix x:A.e:A
P-Fix

Values, the complete context grammar, and roots are v::=nλx:A.e,E::=[]succEifz E then e0 else x.esEe,

(λx:A.e)de[d/x]
P-Beta
succnn+1
P-SuccN
ifz 0 then e0 else x.ese0
P-IfZ
ifz (n+1) then e0 else x.eses[n/x]
P-IfS
fix x:A.ee[fix x:A.e/x]
P-Unroll

There is no argument context. Write en for en, and e for an infinite reduction.

Omega-cpos and constructors.

For an omega-chain (di), its least upper bound is idi. A pointed omega-cpo has a least element . A map is continuous when it is monotone and preserves these lubs. An element c is compact exactly when cDidij. cDdj. The orders used in the list equation are (d,e)D(d,e)dDd  eDe,inldDinlddDd,inreDinreeDe, with distinct sum tags incomparable, and Dz,dDddDd for the lifting D. Chain lubs are componentwise for products, remain in one tag for separated sums, and are bottom or the lifting of the eventual payload lub for liftings. Continuous function spaces [DE]c have the pointwise order and pointwise omega-chain lubs.

For continuous F:DD on a pointed omega-cpo, lfp(F)=n0Fn(),F(lfpF)=lfpF. If F(d)Dd, then lfp(F)Dd. If Φ:P×DD is continuous, then Fp(d)=Φ(p,d),μΦ(p)=lfp(Fp) defines a continuous map μΦ:PD. An admissible predicate contains bottom and is closed under omega-chain lubs; if it is preserved by F, it contains lfp(F).

The partial-list solution.

The cpo L consists of finite words ending in a hole, finite words ending in nil, and infinite words. Its order is generated by Dd,cons(n,d)Dcons(n,d)dDd. The truncations are d0=,(k+1)=,nil(k+1)=nil,cons(n,d)(k+1)=cons(n,dk). Finite elements are exactly the compact ones. The continuous inverse maps solving the selected equation are Loutin({}+N×L) with out()=,in()=,out(nil)=inl(),in(inl())=nil,out(cons(n,d))=inr(n,d),in(inr(n,d))=cons(n,d).

PCF denotation and adequacy relation.

Types are interpreted by [[N]]=N,[[AB]]=[[[A]][[B]]]c. The strict natural operations are succ()=,succ(n)=n+1,caseD(,d,h)=D,caseD(0,d,h)=d,caseD(n+1,d,h)=h(n). Variables, numerals, lambda, and application use projection, the numeral injection, continuous currying, and evaluation. The remaining clauses are [[succe]]η=succ([[e]]η),[[ifz e then e0  else x.es]]η=case[[A]]([[e]]η,[[e0]]η,d[[es]]η[xd]),[[fix x:A.e]]η=lfp(d[[e]]η[xd]). Logical approximation is RNealways,nRNeen,fRABed,a. dRAaf(d)RBea. For closed e:N, adequacy is en[[e]]=n,e[[e]]=.

Indexed eager observation.

For the exact fragment in convention 24.40, index zero relates all closed values of the same type. Positive indices compare unit and natural values, products, and equal sum tags structurally; arrows and recursive types use fn+1ABgjn+1. vjAw. fvEjBgw,foldμX.Avn+1μX.AfoldμX.AwvnA[μX.A/X]w. The symmetric term observation is eEnAd{j<n. ejvw. dwvnjAw,j<n. djwv. evvnjAw. The endpoints quantified here are values. Related substitutions satisfy γnΓδ componentwise. The relation is downward closed, admits two-sided finite anti-reduction, is compatible with related substitution, and is preserved by every well-typed closing evaluation context of the fragment.

Tail observation and proof recursion.

Finite tail observation in L is generated by

d0d
Obs-Zero
out(d)=↑inr(n,d1)d1kd
dk+1d
Obs-Cons

The optional unrestricted propositions-as-types extension is exactly

Γ,p:Pe:P
Γfix p:P.e:P
Pr-Fix
fix p:P.ee[fix p:P.e/p]
Pr-Unroll

It is not part of a total proof core: at every P, including the empty type 0, the term fix p:P.p is a closed self-loop of type P.

Search the book

Type to search the local edition.