Lecture 19: Systematic compilation of PCF Böhm Trees

II.

1.

As forests: just juxtapose the forests (and add the index $.1$ to the one corresponding to $f$ in the product)

Abstract algorithm version:

f(xc') = u\\ id(xc') = \begin{cases} \texttt{output } v' &&\text{ if } (c,v) ∈ x \\ \texttt{valof } c &&\text{ if } c ∈ A(x) \\ \end{cases}

Therefore

(f × id) ((x, x'')c'.1) = f(xc')\\ (f × id) ((x, x'')c''.2) = id(x',c'')\\

2.

lor, ror: Bool × Bool ⟶ Bool
f = lor \circ (ror × id): \underbrace{Bool}_{11} × \underbrace{Bool}_{12} × \underbrace{Bool}_{2} ⟶ \underbrace{Bool}_{ε}


Systematic compilation of a PCF Böhm Tree ⟶ strategy (innocent) = set of views

Similar to De Bruijn translation

  • Arena: $(M, λ, ⊢)$
  • Plays of the form: m_1 (m_2, \overset{0}{←}) m_3 (m_4, \overset{1}{←}) m_5 ⋯

A PCF type

σ = σ_1 → ⋯ → σ_n → nat\\ \, \\ ⟦σ⟧_ε = ⟦σ_1⟧_1 → ⋯ → ⟦σ_n⟧_n → nat_ε

where

⟦σ⟧_n = ⟦σ_1⟧_{u1} → ⋯ → ⟦σ_n⟧_{un} → nat_u\\ ⟦nat⟧_u = \underbrace{nat_u}_{\text{this } u \text{ is just there for bookkeeping purpose}}

Syntax reminder:

PCF Böhm tree:

M \; ≝ \; λx_1, …, x_n. W \qquad \text{(starts with O)}\\ W \; ≝ \; n \; \mid \; \texttt{case } \, x \, M_1 ⋯ M_p \, [n_1 ← W_1 ⋯ n_q ← W_q] \qquad \text{(starts with P)}
⟦M⟧_u^L\\ u \text{ is a word on } (ℕ \backslash \lbrace 0 \rbrace)^\ast\\ L \text{ is a list of items } (\underbrace{\vec x}_{\text{vector of variables}}, \underbrace{u}_{∈ ℕ^\ast})
⟦λ \vec x. W⟧_u^L = ?_u \; ⟦W⟧_u^{L, (\vec x, u)}\\ ⟦n⟧_u^L = n_u\\ ⟦ \texttt{case } x \; M_1 ⋯ M_p \; [n_1 ← W_1 ⋯ n_q ← W_q] ⟧_u^L = (?_{vj} \, \overset{i}{←})

where

(?_{vj} \, \overset{i}{←}) = \texttt{access } (x, L, 0) ⋯ \text{ cf picture }

and

\texttt{access } (x, (\vec x, v) :: L, i) = (?_{vj}, \overset{i}{←}) \qquad \text{ if } \vec x = x_1 ⋯ x_n \quad ∧ \quad x = x_j\\ \texttt{access } (x, (\vec x, v) :: L, i) = \texttt{access } (x, L, i+1) \qquad \text{ if } x ∉ \vec x\\

NB: HO pointers are faithfully tracked, and it’s essential to capture the syntax of PCF B-trees.

Compiled PCF B-trees to deterministic strategies as sets of views (innocent strategies)

Reminder: deterministic means: sm, sn ∈ σ ⟹ m = n

Also, the very construction of the compilation demonstrates that it is injective.

What is the image of this compilation? Answer: it is the well-bracketed strategies (these are exactly compilation of PCF B-trees)

Full-abstraction: everything in the semantics is definiable in the syntax. But you don’t get FA straight

Example of a non-well bracketed strategy: catch/or-tester (language with control operators can do it, but not PCF)

cf picture

In well-behaved strategies, answers can only be be given to the last question.

In an arena, interpreting a PCF type each move is either a Question or an Answer (i.e. of the form $?_u$ or $n_u$).

A well-bracketed strategy is one in which each P-answer points (is an answer) to the last open question.

Leave a comment