# Lecture 14: The $\bullet ; \bullet ⊢_o \bullet$ Proof System

$⊢_O = ⊢_I = ⊢_C \qquad hC ⊆ hH \qquad ⊢_O = ⊢_I$

Last time: $⊢_O$

• Standard R-H rules: $Σ: 𝒫 ⊢ G$
• New backchaining rules: $Σ: 𝒫 ⇓ D ⊢ \underbrace{A}_{\text{atomic}}$

e.g.

$\cfrac{𝒫 ⊢ G \qquad 𝒫 ⇓ D ⊢ A}{𝒫 ⇓ G ⇒ D ⊢ A}\supseteq L$ $\cfrac{}{𝒫 ⇓ A ⊢ A}$ $\text{(contraction) }\cfrac{𝒫 ⇓ D ⊢ A}{𝒫 ⊢ A} \qquad \text{Decide } D ∈ 𝒫$ $\cfrac{Σ: 𝒫, D ⊢ G}{Σ: 𝒫 ⊢ D ⇒ G}$

Dynamics of Proof Search: if $Σ’: 𝒫’ ⊢ A’$ appears inside the proof of $Σ: 𝒫 ⊢ A$

• If $𝒫$ is $hC$, then $Σ = Σ’, \; 𝒫 = 𝒫’$ (in other words, flat)
• If $𝒫$ is $hH$, then $Σ ⊆ Σ’, \; 𝒫 ⊆ 𝒫’$ (program and signature are “stack-based”)
$\cfrac{Σ, y: τ: 𝒫 ⊢ G(x)}{Σ: 𝒫 ⊢ ∀ x_τ. G}$

Program example:

kind nat type % natural
type z nat % zero
type s nat->nat % successor
kind list type
type :: nat->list->list
type nil list


We don’t have functions, but relations.

Let’s try to show

$𝒫 ⊢ max \; L \; \qquad \text{ iff } \qquad L \text{ is a list and } max \; [\,] \; = 0 \\ 𝒫 ⊢ leq \; N \; M \qquad \text{ iff } \qquad N ≤ M \\ 𝒫 ⊢ greater \; N \; M \qquad \text{ iff } \qquad N > M \\$
∀ N:nat. leq z N.
∀ N M:nat. leq (s N) (s M) :- leq N M.

greater N M :- leq (s M) N.

% M1
max L M :- maxx L z M. % accumulator
% M2
maxx (X :: L) A M :- leq X A, maxx L A M.
% M3
maxx (X :: L) A M :- greater X A, maxx L X M.
% M4
maxx nil A A.


NB: In Horn clause logic, it’s not possible to make a block (compacting it into one clause) out of $M_1, M_2, M_3$.

But in other logic, it is:

% M5
maxx L M :- (M2 /\ M3 /\ M4) -> maxx L z M.


and then

$\infer{\underbrace{𝒫}_{M_5} ⊢ max \; [2, 3, 1] \; 3}{ \infer{𝒫 ⊢ (M_2 ∧ M_3 ∧ M_3) ⇒ maxx \; [2, 3, 1] \; 0 \; 3}{ \infer{𝒫, M_2, M_3, M_3 ⊢ maxx \; [2, 3, 1] \; 0 \; 3}{ & } } }$

Another example:

$\infer{𝒫_0 ⊢ 𝒫_1 ⇒ \Big(((𝒫_2 ⇒ G_2) ∨ (𝒫_3 ⇒ G_3)) ∨ G_4\Big)}{ \infer{𝒫_0, 𝒫_1, 𝒫_2 ⊢ G_2 }{ & } & \infer{𝒫_0, 𝒫_1, 𝒫_3 ⊢ G_3 }{ & } & \infer{𝒫_0, 𝒫_1 ⊢ G_4 }{ & } }$

NB: note that there’s not the intended notion of scope anymore in classical logic, because $((𝒫_2 ⇒ G_2) ∨ (𝒫_3 ⇒ G_3)) \;≡\; ¬ 𝒫_2 ∨ G_2 ∨ ¬ 𝒫_3 ∨ G_3$

## Monotonicity property

Let’s say we have an abstract “container” $𝒜$:

$𝒜, 𝒫 ⊢ maxa \; M \qquad \text{ if } 𝒜 = \lbrace a(n_1), …, a(n_m)\rbrace \text{ where } m ≥ 1 \text{ and } M = \max \lbrace n_1, …, n_m \rbrace$

E.g.:

it’s not possible to prove that, because of the monotonicity property:

$\text{ If } 𝒫 ⊆ 𝒫' \text{ and } 𝒫 ⊢ G \text{ then } 𝒫' ⊢ G$

So if

$a(1), a(2), 𝒫 ⊢ maxa \; 5\\ \text{ then } a(3), a(1), a(2), 𝒫 ⊢ maxa \; 5\\$

### Pumping Lemma

adj ...
path ...
disconnected :- ...

$adj/G, 𝒫 ⊢ \texttt{disconnected} \qquad \text{ iff } \qquad G \text{ is disconnected}$

⟹ not possible to prove either, because of the monotonicity property (you can add edges until something disconnected becomes connected).

# Back to Linear Logic

We will only care about the linear implication $⊸$

Recall that hH (hereditary Harrop formulas) make use of $⊤, \&, ∀, ⇒$ (no resort to $∨, ∃$).

$B ⇒ C \; ≝ \; (!B) ⊸ C \;≡\; ?B^⊥ ⅋ C$

When it comes to LL, we will only consider the connectives:

$⊥, ⅋, ⊤, \&, ∀, ⇒, ⊸$

This set of connectives is complete: all the others can be expressed in terms of these.

$B^⊤ = B ⊸ ⊥\\ B ⊗ C = (B^⊥ ⅋ C^⊥)^⊥\\ !B = (B ⇒ ⊥) ⇒ ⊥\\ ?B = (B ⊸ ⊥) ⇒ ⊥ = (!(B^⊥))^⊥$

But it is redundant, the par is not actually needed:

$B \,⅋\, C = (B^⊥) ⊸ C = (B ⊸ ⊥) ⊸ C$

### Polarity of connectives

Positives vs. Negatives

NB: $B \;≡\; C$ means $⊢ (B ⊸ C) \& (C ⊸ B)$ (or equivalently: with the tensor, as the context is empty)

What does it mean for a connective to be positive:

Assume $B \,\;≡\;\, !B \text{ and } C \,\;≡\;\, !C \\ \text{ then } \\ \begin{cases} B ⊗ C \;≡\; !(B ⊗ C) \\ B ⊕ C \;≡\; !(B ⊕ C) \\ !B \;≡\; !!B\\ 1 \;≡\; !1\\ 0 \;≡\; !0\\ \end{cases}$

It is very important because of promotion:

$\cfrac{!Γ ⊢ B}{!Γ ⊢ !B} \quad\text{prom}$

If $!C ⊕ !B ∈ Γ$ is not stricto sensu promotable, it is in a way promotable, since

$!C ⊕ !D \;≡\; !(!C ⊕ !D)$

As for negatives:

Assume $B \,\;≡\;\, ?B \text{ and } C \,\;≡\;\, ?C \\ \text{ then } \\ \begin{cases} B ⅋ C \;≡\; ?(B ⊗ C) \\ B \& C \;≡\; ?(B ⊕ C) \\ ?B \;≡\; ??B\\ ⊤ \;≡\; ?⊤\\ ⊥ \;≡\; ?⊥\\ \end{cases}$

(cf. Fig. 7.5 (p76) in Dale Miller’s lecture notes)

$\underbrace{B_1, …, B_n}_{\text{unbounded/classical zone}} \quad ; \quad \underbrace{C_1, …, C_n}_{\text{bounded/linear zone}} ⊢ E$

where the intended meaning is

$!B_1, …, !B_n\; ; \; C_1, …, C_n ⊢ E$

but we rule the bang $!$ out from the syntax.

Here are the connectives we consider:

$𝒩_1 = \lbrace ⊤, \&, ⊸, ⇒, ∀ \rbrace$

How do the rules differ?

$\cfrac{Σ: Γ \quad ; \quad Δ, B ⊢ C}{Σ: Γ; Δ ⊢ B ⊸ C} ⊸R$ $\cfrac{Σ: Γ, B \quad ; \quad Δ ⊢ C}{Σ: Γ \quad ; \quad Δ ⊢ B ⇒ C} ⇒R$ $\cfrac{Γ \quad;\quad Δ_1 ⊢ B \qquad Γ \quad;\quad Δ_2, C ⊢ E}{Γ \quad;\quad Δ_1, Δ_2, B ⊸ C ⊢ E}$

⟹ the classical zone is treated additively, whereas the linear zone is treated multiplicatively

$\cfrac{Γ \quad;\quad ⊢ B \qquad Γ \quad;\quad Δ_1, Δ_2, C ⊢ E}{Γ \quad;\quad Δ_1, Δ_2, B ⇒ C ⊢ E}$

because we implicitely resort to promotion on $B$.

$\cfrac{Γ, B \quad;\quad Δ, B ⊢ C}{Γ, B \quad;\quad Δ ⊢ C} \text{ absorb (from top to bottom: } B \text{ is absorbed)}$ $\cfrac{}{Γ \quad;\quad A ⊢ A} \text{ init}$

NB: the classical initial rule can be derived:

$\infer{Γ, A \quad;\quad ⊢ A}{ \infer[\text{init}]{Γ, A \quad;\quad A ⊢ A}{\phantom{Γ, A \quad;\quad A ⊢ A}} }$

## $\bullet ; \bullet ⊢_o \bullet$ proof system

Recall $⊢_o$ (uniform proof + backchaining): for $⊤, \&, ⇒, ∀$. How do we handle $⊸$ on top of that?

Negative connectives have invertible right-intro rules

$\cfrac{Γ \quad;\quad Δ ⊢ B \qquad Γ \quad;\quad Δ ⊢ C}{Γ \quad;\quad Δ ⊢ B \& C}$

$Γ \quad;\quad Δ ⊢ B \& C$ is provable iff $Γ \quad;\quad Δ ⊢ B$ and $Γ \quad;\quad Δ ⊢ C$ are.

Akin to

$𝒫 ⊢ A \text{ becoming } 𝒫 ⇓ D ⊢ A$ $Γ \quad;\quad Δ ⊢ A \text{ turns into } Γ \quad;\quad Δ ⇓ D ⊢ A$ $\cfrac{Γ \quad;\quad Δ ⇓ D ⊢ A}{Γ \quad;\quad Δ, D ⊢ A} \text{ decide}$ $\cfrac{Γ, D \quad;\quad Δ ⇓ D ⊢ A}{Γ, D \quad;\quad Δ ⊢ A} \text{ decide } !$ $\cfrac{}{Γ \quad;\quad \bullet ⇓ A ⊢ A} \text{ init }$ $\cfrac{Γ \quad;\quad Δ_1 ⊢ G \qquad Γ \quad;\quad Δ_2 ⇓ D ⊢ A}{Γ \quad;\quad Δ_1, Δ_2 ⇓ G ⊸ D ⊢ A}$ $\cfrac{Γ \quad;\quad \bullet ⊢ G \qquad Γ \quad;\quad Δ ⇓ D ⊢ A}{Γ \quad;\quad Δ ⇓ G ⇒ D ⊢ A}$ $\cfrac{Γ \quad;\quad Δ ⇓ D_i ⊢ A}{Γ \quad;\quad Δ ⇓ D_1 \& D_2 ⊢ A} \quad i= 1, 2$ $\cfrac{Γ \quad;\quad Δ ⇓ D[t/x] ⊢ A}{Γ \quad;\quad Δ ⇓ ∀x \, D ⊢ A}$

## Embed C+I into LL

Girard’s Translation:

$A^° \quad = \quad A\\ ⊤^° \quad = \quad 1\\ (B_1 ∧ B_2)^° \quad = \quad (B_1)^° \& (B_2)^°\\ (B_1 ⇒ B_2)^° \quad = \quad !(B_1)^° ⊸ (B_2)^°\\$

But Girard’s translation doesn’t allow us to expand and properly integrate linear contexts into our sequents.

Instead: Positive/Negative mapping: to bang half as many formulas:

$(A)^+ = (A)^- = A\\ (B_1 ∧ B_2)^+ \quad = \quad (B_1)^+ \& (B_2)^+\\ (B_1 ∧ B_2)^- \quad = \quad (B_1)^- \& (B_2)^-\\ (B_1 ⇒ B_2)^+ \quad = \quad (B_1)^- ⇒ (B_2)^+\\ (B_1 ⇒ B_2)^- \quad = \quad (B_1)^+ ⊸ (B_2)^-\\$

Therefore:

$A_1 ∧ ⋯ ∧ A_n ⇒ A_0 \text{ is negatively translated into } A_1 ⊗ ⋯ ⊗ A_n ⊸ A_0$
A_0 :- A_1, …, A_n


Th:

$Γ ⊢_I B \quad\text{ iff }\quad Γ \quad;\quad \bullet ⊢_ℒ (B)^+$
prove (A -> B) :- (prove A ⇒ prove B)

% translated into
(prove A ⇒ prove B) ⊸ prove (A -> B)


In a way:

$\infer[⊸]{A → B}{ \infer{B}{ \infer{\vdots ⇒}{A} } }$

### Switch example, or how to defeat monotonicity

toggle G :- on, off ⊸ G.
toggle G :- off, on ⊸ G.


where $on, off$ are constants of type $o$ (propositional symbols).

$D_2: \qquad ∀ G \; (on ⊗ (off ⊸ G) ⊸ toggle \; G)\\ D_1: \qquad ∀ G \; (off ⊗ (on ⊸ G) ⊸ toggle \; G)\\$ $\infer{Γ \quad;\quad Δ, on ⊢ toggle \; G}{ \infer{\vdots}{ \infer{Γ \quad;\quad Δ, off ⊢ G}{} } }$

NB: non-logical symbol at toplevel ⟶ seen as atomic

How to prove:

$\infer{Γ \quad;\quad Δ, on ⊢ toggle \; G}{ \infer{Γ \quad;\quad Δ, on ⇓ D_2 ⊢ toggle \; G}{ \infer{Γ \quad;\quad Δ, on ⇓ (on ⊗ (off ⊸ G)) ⊸ toggle \; G ⊢ toggle \; G}{ \infer{Γ \quad;\quad Δ, on ⊢ on ⊗ (off ⊸ G) }{ \infer{Γ \quad;\quad on ⊢ on}{ & } & \infer{Γ \quad;\quad Δ ⊢ off ⊸ G }{ \infer{Γ \quad;\quad Δ, off ⊢ G }{} } } & \infer[init]{Γ \quad;\quad \bullet ⇓ toggle \; G ⊢ toggle \; G}{\phantom{Γ \quad;\quad \bullet ⇓ toggle \; G ⊢ toggle \; G}} } } }$

### Register

Other example:

$\infer{Γ \quad;\quad Δ, reg \; n ⊢ inc \; G}{ \infer{\vdots}{ \infer{Γ \quad;\quad Δ, reg \; (n+1) ⊢ G}{} } }$ $inc \; G ⊢ \underbrace{reg \; N}_{\text{read + delete}} ⊗ (\underbrace{reg \; (N+1)}_{\text{write}} ⊸ G)$

### Multi-set rewriting

Or even:

p :- a ⊗ a ⊗ b ⊗ (c ⊗ a ⊸ q)

$\infer{Γ \quad;\quad Δ, c, a ⊢ q}{ \infer{\vdots}{ \infer{Γ \quad;\quad Δ, a, a, b ⊢ p}{} } }$

### Computing permutations

p :- perm L K

load nil K :- unload K.
perm L K :- load L K.

$\infer{Γ \quad;\quad \underbrace{\bullet}_{\text{the floor is empty}} ⊢ perm \; [1, 2, 3] \; [3, 1, 2]}{ \infer{Γ \quad;\quad \bullet ⊢ load \; [1, 2, 3] \; [3, 1, 2]}{ \infer{Γ \quad;\quad \bullet ⊢ item \; 1 ⊸ load \; [2, 3] \; [3, 1, 2]}{ \infer{Γ \quad;\quad item \; 1 ⊢ load \; [2, 3] \; [3, 1, 2]}{ \infer{\vdots}{ \infer{Γ \quad;\quad item \; 1, item \; 2, item \; 3 ⊢ load \; [] \; [3, 1, 2]}{ \infer{Γ \quad;\quad item \; 1, item \; 2, item \; 3 ⊢ unload \; [3, 1, 2]}{ \infer{Γ \quad;\quad item \; 3 ⊢ item \; 3}{} & \infer{Γ \quad;\quad item \; 1, item \; 2 ⊢ unload \; [1, 2]}{ \infer{\vdots}{ \infer{Γ \quad;\quad \bullet ⊢ unload \; []}{} } } } } } } } } }$

Problem: if you have already something in the context at the beginning, it fails at the end:

$\infer{Γ \quad;\quad \underbrace{sth}_{\text{the floor is NOT empty}} ⊢ perm \; [1, 2, 3] \; [3, 1, 2]}{ \infer{Γ \quad;\quad sth ⊢ load \; [1, 2, 3] \; [3, 1, 2]}{ \infer{Γ \quad;\quad sth ⊢ item \; 1 ⊸ load \; [2, 3] \; [3, 1, 2]}{ \infer{Γ \quad;\quad sth, item \; 1 ⊢ load \; [2, 3] \; [3, 1, 2]}{ \infer{\vdots}{ \infer{Γ \quad;\quad sth, item \; 1, item \; 2, item \; 3 ⊢ load \; [] \; [3, 1, 2]}{ \infer{Γ \quad;\quad sth, item \; 1, item \; 2, item \; 3 ⊢ unload \; [3, 1, 2]}{ \infer{Γ \quad;\quad item \; 3 ⊢ item \; 3}{} & \infer{Γ \quad;\quad sth, item \; 1, item \; 2 ⊢ unload \; [1, 2]}{ \infer{\vdots}{ \infer{Γ \quad;\quad sth ⊢ unload \; []}{\text{doesn't work!}} } } } } } } } } }$

Workaround:

$\cfrac{Γ \quad;\quad \bullet ⊢ load \; L \; K \qquad Γ \quad;\quad Δ ⊢ goal(K)}{Γ \quad;\quad Δ ⊢ perm \; L \; K ⊗ goal(K)}$

whence the critical use of the tensor!

### Reverse lists

Idea:

⊢ rv [] [3, 2, 1]
⊢ rv [3] [2, 1]
⊢ rv [2, 3] [1]
⊢ rv [1, 2, 3] []


In Prolog, scheme:

$reverse ⊢ rv ⟹ (rv ⊢ rv) ⟹ rv$
reverse L K :- ∀ rv, (rv [] K ⇒ (∀ X, L, K. (rv (X::L) K :- rv L (X::K))) ⇒ rv L [])

$\infer{⊢ reverse \; [1, 2, 3] \; [3, 2, 1]}{ \infer{rv \; [] \; [3, 2, 1], ∀(rv ⊢ rv) ⊢ rv \; [1, 2, 3] \; []}{ \infer{⊢ rv \; [1, 2, 3] \; []}{ \vdots} } }$

NB: We actually have

$reverse \overbrace{⊢}^{⊸} rv \overbrace{⊸}^{⟹} (rv \underbrace{⊢}_{⊸} rv) \overbrace{⊸}^{⟹} rv$

because the base case (contrary to the recursive case) is used exactly once.

Property we want to ensure:

$𝒫 ⊢ reverse \; L \; K ⟹ 𝒫 ⊢ reverse \; K \; L$ $p ⊸ q \; ≡ \; q^⊥ ⊸ p^⊥$

Tags:

Updated: