Lectures onType Theory
Type-preserving compilation of polymorphic records
appendix sectionrules

Type-preserving compilation of polymorphic records

A record kind {{i:τi}}i=1m requires the listed distinct fields but does not fix the complete layout. Rule K-Rec checks both complete-record formation and finite-map inclusion:

K{j:υj}j=1n::U{i:τi}i=1m{j:υj}j=1n
K{j:υj}j=1n::{{i:τi}}i=1m
K-Rec

The source record and projection rules are

K;TRMi:τi(1in)1,,n are distinct
K;TR{i=Mi}i=1n:{i:τi}i=1n
R-Record
K;TRM:τKτ::{{:υ}}
K;TRM.:υ
R-Dot

The variable It, belongs only to the pair (t,). For a ground kind-respecting substitution S, the distinct numeral substitution is νS(It,)=pos(S(t)). The target rules distinguish vector selection CJ from type application C[τ]:

K;L;TVC:τKτ::{{:υ}}K;LJ:idx(,τ)
K;L;TVCJ:υ
V-Nth
K;L,I:idx(,τ);TVC:υ
K;L;TVλiI.C:idx(,τ)iυ
V-IAbs
K;L;TVC:idx(,τ)iυK;LJ:idx(,τ)
K;L;TVC@J:υ
V-IApp

The contextual judgment K;L;TMrecC:σ uses C-Record to compile records to vectors in increasing label order and C-Dot to compile projection as M.recCJ. Rule C-TAbsRec inserts λiIt,1λiIt,m in canonical label order; C-TAppRec supplies the certified positions. Source call-by-value has term beta, type beta, and record projection. Target call-by-value has term beta, type beta, and the two additional roots [A1,,An]i0Ai,(λiI.C)@i0C[i/I].

Search the book

Type to search the local edition.