# Lecture 5: Coherence spaces

Teacher: Paul-André Melliès


Fundamental idea of linear logic: replace the cartesian product by a tensor product, hence going from cartesian categories to monoidal ones.

Linear logic models: $\star$-autonomous categories

## Coherence spaces

Model at the origin of linear logic:

Linear decomposition of the category with

• dI-domains
• stable functions: continuous functions $f$ that satisfy, for all $x,y$:

x ↑ y ⟹ f(x ∧ y) = f(x) ∧ f(y)

Several linearizations:

• Concrete data structures ⟶ Sequential games [model of intuitionistic LL]
• dI-domains with coherence and strongly stable functions (stable but non sequential functions are rejected) ⟶ Hypercoherence spaces (Ehrhard: replaces graphs of coherence spaces by hypergraphs (hyperedges: relate $n$ points (not just binary edges))) [model of classical LL]
• Bidomains (mixes stability and continuity) ⟶ Bistructures (mixes two notion of inclusion/information dual to one another) [model of classical LL]
Coherence space $A = (\vert A \vert, \sim_A)$:

where

• $\vert A \vert$ is a set: the web (trame in fr) of $A$
• reflexive and symmetric relation $\sim_A ⊆ \vert A \vert × \vert A \vert$
$\frown_A$:

non reflexive version of $\sim_A$

a \frown_A a' ⟺ a \sim_A a' \text{ and } a≠a'

$\smile_A$ ≝ $¬ \frown_A$

Special coherence spaces: $0 = ⊥$ empty one, $1 = ⊤$ singleton one

A clique $u$ in a graph $A$:

is a subset of $\vert A \vert$ st $∀(a,a') ∈ u, \quad a \sim_A a'$

Idea: cliques = every $λ$-term / “virtual” program. Every program will be interpreted as a clique.

Ex: all the possible terminal states reached by a program are coherent with one another

A program is can be thought of as an open system that can be closed by a counter-program so that the combination leads to a terminal state.

What is a “counter-program”? Let’s say you define a function $ℕ ⟶ ℕ$. A counter-program for that would be a program that provides the input and waits for the output. Dual type of $A$ = types of “things” using elements of type $A$

Ex: Consider $Bool$, the cliques of which are $∅, \lbrace T \rbrace, \lbrace F \rbrace$. They form the expected flat domain.

Anticlique $v$:

is a subset of $\vert A \vert$ st $∀(a,a') ∈ v, \quad a \smile_A a'$

• Types ⟺ Graphs
• Programs ⟺ Cliques
• Counter-programs ⟺ Anti-ciques (“variety” describing terminal states of the program)

Intersection between a clique (all possible outputs) and an anti-clique (all terminal states) is either empty or a singleton.

NB:

• terminal states = secretely connected to automata
• Anti-cliques: related to closures, environment machines, etc…
Negation of $A$: $A^⊥$:

the web is the same, but elements are coherent in $A^⊥$ iff they are not in $A$. $\sim_{A^⊥} ≝ \smile_A$

NB: $(A^⊥)^⊥ = A$

Sum $⊕$ of coherence spaces:

disjoint sum (no coherence between elements of the web of $A$ and elements of the web of $B$)

NB:

• $A ≃ A ⊕ 0$
• Notation:

• $\texttt{inl } a \sim_{A ⊕ B} \texttt{inl } a’ ⟺ a \sim_A a’$
• $\texttt{inr } b \sim_{A ⊕ B} \texttt{inr } b’ ⟺ b \sim_B b’$
• $Bool ≝ 1 ⊕ 1$

Now, we look at the De Morgan dual of two graphs:

A \& B ≝ (A^⊥ ⊕ B^⊥)^⊥
$A \& B$:
• $\vert A \& B \vert = \vert A \vert + \vert B \vert$
• $a \sim_{A \& B} a’$ iff $a \sim_A a’$
• $b \sim_{A \& B} b’$ iff $b \sim_B b’$
• $a \sim_{A \& B} b$ always

What is a clique of $A \& B$? That is, what is $D_{A \& B}$?

D_{A \& B} = D_A × D_B

Every clique $u$ of $A \& B$ induces a clique $u_A ≝ u ∩ \vert A \vert$ of $A$ and a clique $u_B ≝ u ∩ \vert B \vert$ of $B$. Conversely, every pair $(u_A, u_B)$ of cliques of $A$ and $B$ defines a clique $u ≝ u_A ∪ u_B$ of $A \& B$.

Now, what about $A ⊕ B$?

D_{A ⊕ B} ≝ D_A ⊕ D_B

where $D_A ⊕ D_B$ is the coalesced sum: it’s the disjoint union, except the bottom elements (the empty clique) are merged together.

• Sierpinski domain: $D_1$ = the domain where $⊥ ≤ ⊤$
• $D_{Bool} = D_{1 ⊕ 1} = D_1 ⊕ D_1$ = the domain where $⊥ ≤ T, F$
Tensor product of coherence spaces:
• $\vert A ⊗ B \vert = \vert A \vert × \vert B \vert$
• $(a,b) \sim_{A ⊗ B} (a’,b’)$ iff $a \sim_A a’$ and $b \sim_B b’$

NB: $A ≃ A ⊗ 1$

De Morgan dual:

A ⅋ B ≝ (A^⊥ ⊗ B^⊥)^⊥
Parallel product of coherence spaces:
• $\vert A ⅋ B \vert = \vert A \vert × \vert B \vert$
• $(a,b) \frown_{A ⅋ B} (a’,b’)$ iff $a \frown_A a’$ or $b \frown_B b’$
A ⅋ ⊥ ≃ A
• Sum of graphs: $⊕$/$\&$: additive disjunction/conjunction
• Product of graphs: $⊗$/$⅋$: multiplicative disjunction/conjunction

There is a map:

D_A × D_B ⟶ D_{A ⊗ B}

but not the converse: there is a kind of intrication in $A ⊗ B$, as in quantum physics

NB: Characteristics function: a subset of $\vert A \vert$ can be seen as a characteristics function: in this setting, you can see coherence spaces as vector spaces. $A ⊗ B$ is really the tensor product of vector spaces in linear algebra.

V_A ≝ \Big\lbrace \sum\limits_{ a ∈ \vert A \vert } λ_a e_a \; \mid \; λ \text{ is zero except for a finite number of indices}\Big\rbrace\\ V_{A ⊗ B} = V_A ⊗ V_B\\ V_{A ⊕ B} = V_A ⊕ V_B
• $⊕$/$⊗$: positive connectives
• $\&$/$⅋$: negative connectives
A ⊗ (B ⊕ C) = (A ⊗ B) ⊕ (A ⊗ C)\\ A ⅋ (B \& C) = (A ⅋ B) \& (A ⅋ C)\\

A ⊸ B ≝ A^⊥ ⅋ B = \underbrace{(A ⊗ B^⊥)^⊥}_{\text{better! we'll see why!}}

So: $⅋$ (resp. $⊕$) is some kind of classical (resp. intuitionistic) “or”

$A ⊸ B$:
• $\vert A ⊸ B \vert = \vert A \vert × \vert B \vert$
• $(a,b) \frown_{A ⅋ B} (a’,b’)$ iff ($a \sim_A a’$ implies $b \sim_B b’$) and ($b \sim_{B^⊥} b’$ implies $a \sim_{A^⊥} a’$)

• or equivalently: $(a,b) \frown_{A ⅋ B} (a’,b’)$ iff ($a \sim_A a’$ implies $b \sim_B b’$) and ($b = b’$ implies $a \sim_{A^⊥} a’$)

NB: Cliques of $A ⊸ B$: programs of $A$ are mapped to programs of $B$, counter-programs of $B$ should be mapped to counter-programs of $A$

Example: consider $A = B = ℕ$. Question: what is $ℕ ⊸ ℕ$? Let’s show that it’s the type of functions from $ℕ$ to $ℕ$.

What are the cliques of $ℕ ⊸ ℕ$? Naively, we’d like it to be the set of pairs $(n, m)$, where $m$ is the output of the function at $n$.

But to answer precisely, look at $(A ⊗ B^⊥)^⊥$!

(cf picture)

Tensor product and sum: positives because they enable us to construct data structures. Positive constructors and orthogonality are the underpinning of everything (negatives only stem from them).

Intuition behind $(A ⊗ B^⊥)^⊥$:

the counter-program $(A ⊗ B^⊥)$ consists in providing an $A$ and waiting for a $B$.

## Category of coherence spaces $Coh$

Category $Coh$:
• objects: coherence spaces
• morphisms $f: A → B$: cliques of $A ⊸ B$
• identity: $id_A ≝ \lbrace(a,a) ∈ \vert A ⊸ A \vert\rbrace$
• Composition of $f: A → B$ and $g:B → C$: $g \circ f ≝ \lbrace(a,c) ∈ \vert A ⊸ C \vert \; \mid \; ∃ b ∈ \vert B \vert, (a,b) ∈ f \text{ and } (b,c) ∈ g\rbrace$

NB:

• Similar to $Rel$: category of sets and relations $R ⊆ A × B$: $id_A ≝ \lbrace (a,a) \; \mid \; a ∈ A\rbrace$, $S \circ R ≝ \lbrace (a,c) \; \mid \; ∃b ∈ B; \, (a, b) ∈ R \text{ and } (b,c) ∈ S\rbrace$

• $(X, =) ⊸ (Y,=)$ (between discrete coherence spaces) are partial functions

• the category of sets and partial functions is a full subcategory of $Coh$

Let $X, Y$ be sets.

discrete(X) ≝ (X, =)\\ complete(X) ≝ (X,=)^⊥

In $Coh$:

• a map $discrete(X) ⟶ discrete(Y)$ is a partial function from $X$ to $Y$
• a map $complete(X) = discrete(X)^⊥ ⟶ discrete(Y)^⊥ = compelte(Y)$ is a partial function from $Y$ to $X$
A ⊸ B = B^⊥ ⊸ A^⊥

## Damned! $Coh$ is not cartesian closed

• $A \& B$ is the cartesian product of $A$ and $B$ in the category $Coh$
• the object $⊤$ is terminal in $Coh$

### Cliques of $A$

1 ⊸ A ≃ A

so every clique $u$ of $A$ defines a map $1 → A$ in $Coh$. So generalized elements $1 → A$ are not elements of $A$ but cliques of $A$.

### Anticliques of $A$

A ⊸ ⊥ ≃ A^⊥

so every anticlique $v$ of $A$ defines a map $A → ⊥$ in $Coh$ (here: $1 = ⊥$, but it’s not always the case in LL).

1 \xto u A \xto v ⊥

The composition goes from $1$ to $⊥$: but $1 ⊸ ⊥ = \ast$, the cliques of which are $\lbrace ∅, \lbrace\ast\rbrace \rbrace$

So the composition $vu$ is empty or singleton: it can be viewed as $u ∩ v = \text{ empty or not}$.

1 \xto {x ∈ D_A} A \qquad \text{ i.e. } \qquad {\rm Hom}(1, A) ≃ D_A
\begin{xy} \xymatrix{ A & & B \\ & A \& B \ar[lu]^{π_1} \ar[ru]_{π_2} &\\ & 1 \ar[u]_{u} \ar@/^2pc/[luu]^{u_A} \ar@/_2pc/[ruu]_{u_B} & } \end{xy}

where

π_1 ≝ \lbrace (\texttt{inl } a, a) \; \mid \; a ∈ \vert A \vert\rbrace\\ π_2 ≝ \lbrace (\texttt{inr } b, b) \; \mid \; b ∈ \vert B \vert\rbrace\\

$π_1$ is a clique of $A \& B ⊸ A$

In general, to show that $\&$ is a cartesian product:

\begin{xy} \xymatrix{ A & & B \\ & A \& B \ar[lu]^{π_1} \ar[ru]_{π_2} &\\ & C \ar@{.>}[u]_{∃! \, h} \ar@/^2pc/[luu]^{u_A} \ar@/_2pc/[ruu]_{u_B} & } \end{xy}

Let

• $u_A$ be a clique of $C ⊸ A$
• $u_B$ be a clique of $C ⊸ B$

We define:

u ≝ \lbrace(c, \texttt{inl } a) \; \mid \; (c, a) ∈ u_A\rbrace ∪ \lbrace(c, \texttt{inr } b) \; \mid \; (c, b) ∈ u_B\rbrace

Question: does $u$ define a clique of $C ⊸ A \& B$?

So let $(c, x)$ and $(c’,x’)$ be elements of $u$. There are 4 cases to consider in order to show that $% $

1. $(c, \texttt{inl } a)$ and $(c’, \texttt{inl } a’)$ are coherent because $(c,a)$ and $(c’,a’)$ are elements of $u_A$

2. same for $u_B$

3. $(c, \texttt{inl } a)$ and $(c’, \texttt{inr } b)$ are coherent because $\texttt{inl } a \sim_{A \& B} \texttt{inr } b$ and $\texttt{inl } a ≠ \texttt{inr } b$

4. similar to the previous one

Problem in $Coh$:

• $\&$ is cartesian but not closed

• $⊗$ is closed but not cartesian!

Solution: Relate $\&$ and $⊗$ with:

!(A \& B) \, ≃ \, !A ⊗ !B

Tags:

Updated: