Recursive types, PCF, domains, and finite observations
appendix sectionrules
Recursive types, PCF, domains, and finite observations
Eager iso-recursive calculus.
The eager fragment inherits 𝟏, products, sums, arrows, and the call-by-value rules of the simple calculus, and locally adds ℕ, numerals, type variables bound by 𝜇, and explicit fold/unfold: 𝐴,𝐵::=⋯∣ℕ∣𝑋∣𝜇𝑋.𝐴,𝑒::=⋯∣𝑛∣𝖿𝗈𝗅𝖽𝜇𝑋.𝐴𝑒∣𝗎𝗇𝖿𝗈𝗅𝖽𝑒. The complete local formation and typing delta is
Δ⊢ℕ𝗍𝗒𝗉𝖾
Nat-F
Γ⊢𝑛:ℕ
T-Nat
Δ,𝑋⊢𝐴𝗍𝗒𝗉𝖾
Δ⊢𝜇𝑋.𝐴𝗍𝗒𝗉𝖾
Mu-F
Γ⊢𝑒:𝐴[𝜇𝑋.𝐴/𝑋]
Γ⊢𝖿𝗈𝗅𝖽𝜇𝑋.𝐴𝑒:𝜇𝑋.𝐴
T-Fold
Γ⊢𝑒:𝜇𝑋.𝐴
Γ⊢𝗎𝗇𝖿𝗈𝗅𝖽𝑒:𝐴[𝜇𝑋.𝐴/𝑋]
T-Unfold
Values and evaluation contexts gain 𝑣::=⋯∣𝑛∣𝖿𝗈𝗅𝖽𝜇𝑋.𝐴𝑣,𝐸::=⋯∣𝖿𝗈𝗅𝖽𝜇𝑋.𝐴𝐸∣𝗎𝗇𝖿𝗈𝗅𝖽𝐸, and their sole new root is
𝗎𝗇𝖿𝗈𝗅𝖽(𝖿𝗈𝗅𝖽𝜇𝑋.𝐴𝑣)⟼𝑣
E-UnfoldFold
The list instance and its canonical folded-cell abbreviation are 𝖫𝗂𝗌𝗍𝖭𝖺𝗍=𝜇𝑋.(𝟏+ℕ×𝑋),𝖼𝖾𝗅𝗅(𝑛,𝑒)=𝖿𝗈𝗅𝖽𝖫𝗂𝗌𝗍𝖭𝖺𝗍(𝗂𝗇𝗋⟨𝑛,𝑒⟩). Thus 𝖼𝖾𝗅𝗅(𝑛,𝑣) is a value when 𝑣 is a value, whereas the curried term 𝖼𝗈𝗇𝗌𝑛𝑣 takes two beta steps to that syntax.
Contractive regular equality.
A binder 𝜇𝑋.𝐴 is admitted to the equality algorithm only when every free occurrence of its bound 𝑋 in 𝐴 lies strictly below a product, sum, or arrow constructor. Closed admitted types are finite directed graphs. Writing 𝗁𝖾𝖺𝖽(𝑎) for the first constructor reached by following recursive back-edges, the worklist transitions are as follows. A visited pair is discarded: ((𝑎,𝑏)::𝑊′,𝑉)⟼(𝑊′,𝑉)((𝑎,𝑏)∈𝑉). An unvisited pair rejects when its exposed heads differ in constructor or arity. Otherwise it takes the transition ((𝑎,𝑏)::𝑊′,𝑉)⟼(𝖼𝗁𝗂𝗅𝖽𝗋𝖾𝗇(𝑎,𝑏)++𝑊′,𝑉∪{(𝑎,𝑏)}). The initial state is ([(𝑎,𝑏)],∅); an empty worklist accepts. The judgment 𝐴≡𝜇𝐵 means bisimilarity of the two unfolded ordered constructor trees, not a term reduction or a subtyping judgment.
Call-by-name PCF.
The separate language 𝖯𝖢𝖥𝗇 has 𝐴,𝐵::=ℕ∣𝐴→𝐵,𝑒::=𝑥∣𝑛∣𝗌𝗎𝖼𝖼𝑒∣𝗂𝖿𝗓𝑒𝗍𝗁𝖾𝗇𝑒0𝖾𝗅𝗌𝖾𝑥.𝑒𝑠∣𝜆𝑥:𝐴.𝑒∣𝑒𝑒∣𝖿𝗂𝗑𝑥:𝐴.𝑒. Besides the inherited variable, numeral, lambda, and application rules, its typing rules are
Γ⊢𝑒:ℕ
Γ⊢𝗌𝗎𝖼𝖼𝑒:ℕ
P-Succ
Γ⊢𝑒:ℕΓ⊢𝑒0:𝐴Γ,𝑥:ℕ⊢𝑒𝑠:𝐴
Γ⊢𝗂𝖿𝗓𝑒𝗍𝗁𝖾𝗇𝑒0𝖾𝗅𝗌𝖾𝑥.𝑒𝑠:𝐴
P-Ifz
Γ,𝑥:𝐴⊢𝑒:𝐴
Γ⊢𝖿𝗂𝗑𝑥:𝐴.𝑒:𝐴
P-Fix
Values, the complete context grammar, and roots are 𝑣::=𝑛∣𝜆𝑥:𝐴.𝑒,𝐸::=[]∣𝗌𝗎𝖼𝖼𝐸∣𝗂𝖿𝗓𝐸𝗍𝗁𝖾𝗇𝑒0𝖾𝗅𝗌𝖾𝑥.𝑒𝑠∣𝐸𝑒,
(𝜆𝑥:𝐴.𝑒)𝑑⟼𝑒[𝑑/𝑥]
P-Beta
𝗌𝗎𝖼𝖼𝑛⟼𝑛+1
P-SuccN
𝗂𝖿𝗓0𝗍𝗁𝖾𝗇𝑒0𝖾𝗅𝗌𝖾𝑥.𝑒𝑠⟼𝑒0
P-IfZ
𝗂𝖿𝗓(𝑛+1)𝗍𝗁𝖾𝗇𝑒0𝖾𝗅𝗌𝖾𝑥.𝑒𝑠⟼𝑒𝑠[𝑛/𝑥]
P-IfS
𝖿𝗂𝗑𝑥:𝐴.𝑒⟼𝑒[𝖿𝗂𝗑𝑥:𝐴.𝑒/𝑥]
P-Unroll
There is no argument context. Write 𝑒⇓𝑛 for 𝑒⟼∗𝑛, and 𝑒⇑ for an infinite reduction.
Omega-cpos and constructors.
For an omega-chain (𝑑𝑖), its least upper bound is ⨆𝑖𝑑𝑖. A pointed omega-cpo has a least element ⊥. A map is continuous when it is monotone and preserves these lubs. An element 𝑐 is compact exactly when 𝑐⊑𝖣⨆𝑖𝑑𝑖⟹∃𝑗.𝑐⊑𝖣𝑑𝑗. The orders used in the list equation are (𝑑,𝑒)⊑𝖣(𝑑′,𝑒′)⟺𝑑⊑𝖣𝑑′∧𝑒⊑𝖣𝑒′,𝗂𝗇𝗅𝑑⊑𝖣𝗂𝗇𝗅𝑑′⟺𝑑⊑𝖣𝑑′,𝗂𝗇𝗋𝑒⊑𝖣𝗂𝗇𝗋𝑒′⟺𝑒⊑𝖣𝑒′, with distinct sum tags incomparable, and ⊥⊑𝖣𝑧,↑𝑑⊑𝖣↑𝑑′⟺𝑑⊑𝖣𝑑′ for the lifting 𝐷⊥. 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 [𝐷→𝐸]𝑐 have the pointwise order and pointwise omega-chain lubs.
For continuous 𝐹:𝐷→𝐷 on a pointed omega-cpo, lfp(𝐹)=⨆𝑛≥0𝐹𝑛(⊥),𝐹(lfp𝐹)=lfp𝐹. If 𝐹(𝑑)⊑𝖣𝑑, then lfp(𝐹)⊑𝖣𝑑. If Φ:𝑃×𝐷→𝐷 is continuous, then 𝐹𝑝(𝑑)=Φ(𝑝,𝑑),𝜇Φ(𝑝)=lfp(𝐹𝑝) defines a continuous map 𝜇Φ:𝑃→𝐷. An admissible predicate contains bottom and is closed under omega-chain lubs; if it is preserved by 𝐹, it contains lfp(𝐹).
The partial-list solution.
The cpo L consists of finite words ending in a hole, finite words ending in 𝗇𝗂𝗅, and infinite words. Its order is generated by ⊥⊑𝖣𝑑,𝖼𝗈𝗇𝗌(𝑛,𝑑)⊑𝖣𝖼𝗈𝗇𝗌(𝑛,𝑑′)⟺𝑑⊑𝖣𝑑′. The truncations are 𝑑↾0=⊥,⊥↾(𝑘+1)=⊥,𝗇𝗂𝗅↾(𝑘+1)=𝗇𝗂𝗅,𝖼𝗈𝗇𝗌(𝑛,𝑑)↾(𝑘+1)=𝖼𝗈𝗇𝗌(𝑛,𝑑↾𝑘). Finite elements are exactly the compact ones. The continuous inverse maps solving the selected equation are L𝗈𝗎𝗍⇄𝗂𝗇({∗}+ℕ×L)⊥ with 𝗈𝗎𝗍(⊥)=⊥,𝗂𝗇(⊥)=⊥,𝗈𝗎𝗍(𝗇𝗂𝗅)=↑𝗂𝗇𝗅(∗),𝗂𝗇(↑𝗂𝗇𝗅(∗))=𝗇𝗂𝗅,𝗈𝗎𝗍(𝖼𝗈𝗇𝗌(𝑛,𝑑))=↑𝗂𝗇𝗋(𝑛,𝑑),𝗂𝗇(↑𝗂𝗇𝗋(𝑛,𝑑))=𝖼𝗈𝗇𝗌(𝑛,𝑑).
PCF denotation and adequacy relation.
Types are interpreted by [[ℕ]]=ℕ⊥,[[𝐴→𝐵]]=[[[𝐴]]→[[𝐵]]]𝑐. The strict natural operations are 𝗌𝗎𝖼𝖼⊥(⊥)=⊥,𝗌𝗎𝖼𝖼⊥(𝑛)=𝑛+1,𝖼𝖺𝗌𝖾𝐷(⊥,𝑑,ℎ)=⊥𝐷,𝖼𝖺𝗌𝖾𝐷(0,𝑑,ℎ)=𝑑,𝖼𝖺𝗌𝖾𝐷(𝑛+1,𝑑,ℎ)=ℎ(𝑛). Variables, numerals, lambda, and application use projection, the numeral injection, continuous currying, and evaluation. The remaining clauses are [[𝗌𝗎𝖼𝖼𝑒]]𝜂=𝗌𝗎𝖼𝖼⊥([[𝑒]]𝜂),[[𝗂𝖿𝗓𝑒𝗍𝗁𝖾𝗇𝑒0𝖾𝗅𝗌𝖾𝑥.𝑒𝑠]]𝜂=𝖼𝖺𝗌𝖾[[𝐴]]([[𝑒]]𝜂,[[𝑒0]]𝜂,𝑑↦[[𝑒𝑠]]𝜂[𝑥↦𝑑]),[[𝖿𝗂𝗑𝑥:𝐴.𝑒]]𝜂=lfp(𝑑↦[[𝑒]]𝜂[𝑥↦𝑑]). Logical approximation is ⊥Rℕ𝑒always,𝑛Rℕ𝑒⟺𝑒⇓𝑛,𝑓R𝐴→𝐵𝑒⟺∀𝑑,𝑎.𝑑R𝐴𝑎⇒𝑓(𝑑)R𝐵𝑒𝑎. For closed 𝑒:ℕ, adequacy is 𝑒⇓𝑛⟺[[𝑒]]=𝑛,𝑒⇑⟺[[𝑒]]=⊥.
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 𝑓≈𝐴→𝐵𝑛+1𝑔⟺∀𝑗≤𝑛+1.∀𝑣≈𝐴𝑗𝑤.𝑓𝑣E𝐵𝑗𝑔𝑤,𝖿𝗈𝗅𝖽𝜇𝑋.𝐴𝑣≈𝜇𝑋.𝐴𝑛+1𝖿𝗈𝗅𝖽𝜇𝑋.𝐴𝑤⟺𝑣≈𝐴[𝜇𝑋.𝐴/𝑋]𝑛𝑤. The symmetric term observation is 𝑒E𝐴𝑛𝑑⟺⎧{
{⎨{
{⎩∀𝑗<𝑛.𝑒⟼𝑗𝑣⇒∃𝑤.𝑑⟼∗𝑤∧𝑣≈𝐴𝑛−𝑗𝑤,∀𝑗<𝑛.𝑑⟼𝑗𝑤⇒∃𝑣.𝑒⟼∗𝑣∧𝑣≈𝐴𝑛−𝑗𝑤. The endpoints quantified here are values. Related substitutions satisfy 𝛾≈Γ𝑛𝛿 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
𝑑0⇝𝑑
Obs-Zero
𝗈𝗎𝗍(𝑑)=↑𝗂𝗇𝗋(𝑛,𝑑1)𝑑1𝑘⇝𝑑′
𝑑𝑘+1⇝𝑑′
Obs-Cons
The optional unrestricted propositions-as-types extension is exactly
Γ,𝑝:𝑃⊢𝑒:𝑃
Γ⊢𝖿𝗂𝗑𝑝:𝑃.𝑒:𝑃
Pr-Fix
𝖿𝗂𝗑𝑝:𝑃.𝑒⟼𝑒[𝖿𝗂𝗑𝑝:𝑃.𝑒/𝑝]
Pr-Unroll
It is not part of a total proof core: at every 𝑃, including the empty type 0, the term 𝖿𝗂𝗑𝑝:𝑃.𝑝 is a closed self-loop of type 𝑃.