Lecture 14: Sequentiality, Concrete Data Structures
Full Abstraction
Lecture 14
Sequentiality  Games 

CCC, Abstract machines, Syntax (77)  Linear Logic (86) 
Full abstraction:
Timeline:
 PCF: what were the challenges
 Stability
 Sequential functions
 Sequential algorithms
 Game semantics
Consider
 a programming language $L$, types and terms in this language

a denotational semantics associating a mathematical structure to some type $τ$:
\[⊢M: τ \leadsto \text{ an element } ⟦M⟧ ∈ ⟦τ⟧\] 
From this, two programs of the same type $⊢ M, M’: τ$ being definitionally equal is defined as
\[M =_{den} M' ⟺ ⟦M⟧ = ⟦M'⟧\]
Observational equality
 Observable type:

some type for which computations end up with a value of this type in finite time (e.g.
nat
in CamL)
Consider an observable type and values of this type.
Let $M:τ ⟼ M’:τ$ be a function computed via some deterministic operational semantics.
Observational equivalence:
\[M =_{obs} M' ⟺ ∀ C, \underbrace{C[M]}_{\text{of some base type}} ⟶^\ast v ⟹ C[M'] ⟶^\ast v \text{ and conversely}\]Full abstraction
Full abstraction: by Plotkin (7677) and Milner.
 Full abstraction/Complete adequacy:
 \[M =_{obs} M' ⟺ M =_{den} M'\]
 Adequacy:
 \[M =_{obs} M' ⟸ M =_{den} M'\]
 Completeness:
 \[M =_{obs} M' ⟹ M =_{den} M'\]
NB:
 adequacy: relatively easy, more frequent
 completeness: rare/hard
 overall: complete adequacy is a matter of finding a good model (observational fixed) or finding a good language (denotational (model) fixed)
PCF with Scott semantics
Language  Model  Completeness/Adequacy? 

PCF  Scott semantics  Adequacy but not Completeness 
Where the shoe pinches: parallel or:
\[por: Bool × Bool ⟶ Bool\]Flat boolean domain:
digraph {
rankdir=BT;
⊥ > T, F;
}
\[por(T, ⊥) = T\\
por(⊥, T) = T\\
por(⊥, ⊥) = ⊥\]
Not doable in PCF because you have no notion of parallelism therein.
Plotkin exploited $por$ to build two terms of the appropriate type $M, M’$ $(Bool ⟶ Bool ⟶ Bool) ⟶ Bool$ such that
\[⟦M⟧ ≠ ⟦M'⟧\\ \text{ but } M =_{obs} M'\]Seminal question on which many people (Berry, Curien, Ong, Abramsky) worked afterwards: for which model is PCF fullyabstract?
What did Plotkin: added $por$ to the syntax of PCF, and then showed that we do have full abstraction!
Language  Model  Completeness/Adequacy? 

PCF  Scott semantics  Adequacy but not Completeness 
PCF+$por$  Scott semantics  Adequacy and Completeness (full abstraction) 
Actually, $por$ is not stable (showed by Berry).
$por$ not stable
NB: here, as DCPOs are finite, Scottcontinuity amounts to monotonicity
 $f: D ⟶ D’$ is stable :

if it is Scottcontinuous and $∀ x, y \text{ st } ∃ z; x, y ≤ z$ (denoted by $x ↑ y$):
\[f(x ∧ y) = f(x) ∧ f(y)\]
NB:
\[∀ x, y ∈ Bool^n, x \not ↑ y ⟺ ∃ i; \; x_i ≠ y_i \text{ and } x_i, y_i ≠ ⊥\] \[por((T, ⊥)) ∧ por((⊥, T)) = T ∧ T = T \\ ≠ ⊥ = por(\underbrace{(T, ⊥) ∧ (⊥, T)}_{= (⊥, ⊥)})\]The function $Gustave$
Even by replacing Scottsemantics by stable semantics, there a function (the $Gustave$ function) that make fullabstraction fail.
Language  Model  Completeness/Adequacy? 

PCF  Scott semantics  Adequacy but not Completeness 
PCF  Stable semantics  Adequacy but not Completeness 
NB: the name of the function is a joke, it was the nickname of Gérard Béry, because there was already two other Gérard in the lab where he worked.
\[G(T, F, ⊥) = T\\ G(F, ⊥, T) = T\\ G(⊥, T, F) = T\]⟶ stable but not sequential.
Stability: to remove $por$ Sequentiality: to remove $G$
Sequentiality (due to Jean Vuillemin)
 Sequential function $f: Bool^n ⟶ Bool$ at $x ∈ Bool^n$:

iff
\[f(x) = ⊥ \text{ and } (∃ y ≥ x, f(y) ≠ ⊥) ⟹ (∃ i ∈ [1, ⋯ ,n]; x_i = ⊥ \text{ and } ∀ z ≥ x, f(z) ≠ ⊥ ⟹ z_i ≠ ⊥)\]
Stability of $G$: $(T, F, ⊥), (F, ⊥, T)$ and $(⊥, T, F)$ are pairwise incompatible, so $G$ is vacuously stable
$G$ is not sequential.
Sequential model: way harder than from continuous to stable.
Difficulties:

How to adapt the definition to more general domains?
⟹ KahnPoltkin: Category of Concrete data structures and sequential functions, where you can make sense of sequential functions (it is of the same flavour as coherence spaces (but it appeared way before))

Problem: the category of concrete data structures and sequential functions is not cartesian closed
⟹ Fix:
The category of of concrete data structures and sequential algorithms is cartesian closed
About booleans…
Description in the world of Coherence spaces
How do you recover $Bool$ from events? Let $e_1, e_2$ be two events/tokens that are incompatible (denoted by $e_1 # e_2$):
digraph {
rankdir=BT;
∅ > "{e_1}", "{e_2}";
}
Description in the world of Concrete data structures
Events are now of the form:
\[e = (\text{cell}, \text{value})\]Cells can be filled with at most one value.
Let $?, True, False$ be the only elements we have.
digraph {
rankdir=BT;
∅ > "{(?, True)}", "{?, False}";
}
Concrete data structures
 Concrete data structure $𝕄 \; ≝ \; (C, V, E, ⊢)$:

is given by
 a set $C$ of cells
 a set $V$ of values
 a set $E ⊆ C × V$ of events

Enabling relation \(⊢ ⊆ \underbrace{C}_{\text{we write } ⊢ c \text{ (initial cell)}} ∪ \underbrace{E × C}_{\text{we write } e \, ⊢ \, c}\)

If you write $(c_1, v_1) ⊢ c$ as $c_1 v_1 c$, then the following conditions must be enforced:
 infinite sequences of the form $⋯ c_2 v_2 c_1 v_1 c$ are forbidden

A sequence $c_0 v_0 ⋯ c_k v_k ⋯$ such that
\[⊢ c_0 \qquad \text{ and } \qquad ∀ i > 0, (c_{i1}, v_{i1}) ⊢ c_i\]is called
 a response if the last label is a value $v_n$
 a query if the last label is a value $c_n$
 If $c_0 v_0 ⋯ c_n v_n$ and $d_0 w_0 ⋯ d_k w_k$ are two responses, then their least common prefix is a response.
Example: Signature (arity in superscript):
\[Σ \; ≝ \; \underbrace{a^0 \; \mid \; g^1 \; \mid \; h^2}_{\text{values}}\]Example of a term:
digraph {
rankdir=BT;
a2[label="a"];
h > g, a;
g > a2;
}
Values ⟺ Labels Cells ⟺ Nodes in the tree:
digraph {
rankdir=BT;
ε > 0, 1;
0 > 00;
}
i.e., here:
 $C = ℕ^\ast$ (words)
 $V = \lbrace a, g, h \rbrace$
 $⊢$:

rules of the form \(⊢ ε \\ (u, h^m) ⊢ ui \qquad \text{ where } i < m\)
States in CDS
States ⟺ Partial first order terms

Coherence spaces $E$:
 Data: set of cliques ordered by inclusion $D(E)$

Concrete Data Structures (CDS):
 Data: set of states $D(𝕄)$ ordered by inclusion
Let $𝕄$ be a CDS.
 A state of $𝕄$:

is a set $x ⊆ E$ such that

Coherence: \((c, v_1), (c, v_2) ∈ x ⟹ v_1 = v_2\)

If $(c, v) ∈ x$, then
 either $⊢ c$
 or there exists $(d,w) ∈ x$ such that $(d, w) ⊢ c$

Sequential functions $f: 𝕄 ⟶ 𝕄’$: the index $i$ is replaced by a cell here.
 $D(𝕄)$:

set of states of $𝕄$ ordered by inclusion (it is a Scott domain, by the way)
Cartesian Closed Structure on CDS’s
Related to a model of intuitionistic affine logic (weaking allowed).
Product
$𝕄 = (C, V, E, ⊢), \; 𝕄’ = (C’, V’, E’, ⊢’)$
Let’s build the cartesian product $𝕄’’ = (C’’, V’’, E’’, ⊢’’)$.
 $C’’ = C \sqcup C’ = C.1 ∪ C’.2$
 $V’’ = V ∪ V’$
 \[E'' = \lbrace (c.1, w) \; \mid \; (c, w) ∈ E\rbrace ∪ \lbrace (c'.2, w) \; \mid \; (c', w) ∈ E'\rbrace\]
Enabling relation:
\[\cfrac{⊢ c}{⊢'' c.1} \qquad \cfrac{⊢ c'}{⊢'' c'.2}\\ \cfrac{(c,v) ⊢ d}{(c.1, v) ⊢'' d.1} \qquad \cfrac{(c',v') ⊢ d'}{(c'.2, v) ⊢'' d'.2}\]Prop: in the category of Scott domains:
\[D(M × M') ≅ D(M) × D(M')\]
Function space
In the category of Coherence Spaces:
if $e ∈ (E, \sim_E)$ and $e’ ∈ (E’, \sim_{E’})$, the elements of $E ⇒ E’$ are of the form $(x, e’)$ where
 $x$ is a finite clique
 $e’ ∈ E’$
As it happens, we have:
\[D(E ⇒ E') ≅ D(E) \overset{\text{stable}}{⟶} D(E')\]Now back to our CDS’s.
$𝕄 = (C, V, E, ⊢), \; 𝕄’ = (C’, V’, E’, ⊢’)$
Let’s build the function space $𝕄 ⇒ 𝕄’ \; ≝ \; 𝕄’’ = (C’’, V’’, E’’, ⊢’’)$.
 $C’’ = D^{fin}(𝕄) × C’$
 \[V'' = \lbrace valof \; c \; \mid \; c ∈ C \rbrace ∪ \lbrace output \; v' \; \mid \; v' ∈ V' \rbrace\]

\[E'' = \lbrace (xc', valof \; c) \; \mid \; c ∈ A(x)\rbrace ∪ \lbrace (xc', output \; v') \; \mid \; (c', v') ∈ E'\rbrace\]
where
\[c ∈ A(x) ⟺ c \text{ is enabled in } x \text{ but not filled in } x\](cell just outside of $x$, ready to be filled)
Enabling relation:
\[\cfrac{⊢ c'}{⊢'' ∅ c'}\\ \; \\ \cfrac{(c,v) ∈ E}{(xc', valof \; c) ⊢'' (x ∪ \lbrace (c, v) \rbrace)c'}\\ \; \\ \cfrac{(c',v') ⊢' d'}{(xc', output \; v') ⊢'' xd'}\]Example: quick left “or” $Bool × Bool ⟶ Bool$:
\[(∅?', valof \; ?.1)\\ (\lbrace (?.1, T) \rbrace ?', output \; T)\\ (\lbrace (?.1, F) \rbrace ?', valof \; ?.2)\\ (\lbrace (?.1, F), (?.2, F) \rbrace ?', output \; F)\\ (\lbrace (?.1, F), (?.2, T) \rbrace ?', output \; V)\\\]Depicted as: cf. picture
Leave a comment