MOQCUA

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 50

Sup:

A logical connective for non-determinism

Alejandro Díaz-Caro
UNIVERSIDAD NACIONAL DE QUILMES
& CONICET / UNIVERSIDAD de BUENOS AIRES
Buenos Aires, Argentina

Based on recent works with


Gilles Dowek
and with
Octavio Malherbe

MOQCUA Team Seminar


December 7, 2023 – Nancy, France
The sup connective
Harmony
With generalized elimination rules
Example 1

Γ⊢A Γ⊢B ∧ Γ ⊢ A ∧ B Γ, A ⊢ C Γ ⊢ A ∧ B Γ, B ⊢ C
i ∧e1 ∧e2
Γ⊢A∧B Γ⊢C Γ⊢C
π1 π2
Γ⊢A Γ⊢B ∧ π3
i
Γ⊢A∧B Γ, A ⊢ C
∧e1 −→ (π1 /A)π3
Γ⊢C
Example 2

Γ⊢A ∨ Γ⊢B ∨ Γ⊢A∨B Γ, A ⊢ C Γ, B ⊢ C


i1 i2 ∨e
Γ⊢A∨B Γ⊢A∨B Γ⊢C
π1
Γ⊢A ∧ π2 π3
i1
Γ⊢A∨B Γ, A ⊢ C Γ, B ⊢ C
∧e −→ (π1 /A)π2
Γ⊢C
Alejandro Díaz-Caro Sup: A logical connective for non-determinism Section 1 / 6: The sup connective Slide 1 / 21
Not harmony
Insufficiency [Prior 1960]

Γ⊢A Γ ⊢ A tonk B Γ, B ⊢ C
tonki tonke
Γ ⊢ A tonk B Γ⊢C
π1
Γ⊢A π2
tonki
Γ ⊢ A tonk B Γ, B ⊢ C
tonke
Γ⊢C

Alejandro Díaz-Caro Sup: A logical connective for non-determinism Section 1 / 6: The sup connective Slide 2 / 21
Not harmony
Insufficiency [Prior 1960]

Γ⊢A Γ ⊢ A tonk B Γ, B ⊢ C
tonki tonke
Γ ⊢ A tonk B Γ⊢C
π1
Γ⊢A π2
tonki
Γ ⊢ A tonk B Γ, B ⊢ C
tonke
Γ⊢C

Excessiveness
Γ ⊢ A Γ ⊢ B ⌣i Γ ⊢ A ⌣ B Γ, A ⊢ C Γ, B ⊢ C
⌣e
Γ⊢A⌣B Γ⊢C
π1 π2
Γ ⊢ A Γ ⊢ B ⌣i π3 π4 (π1 /A)π3
Γ⊢A⌣B Γ, A ⊢ C Γ, B ⊢ C
⌣e (π2 /A)π4
Γ⊢C

Alejandro Díaz-Caro Sup: A logical connective for non-determinism Section 1 / 6: The sup connective Slide 2 / 21
⊙ connective
In PL [A.DC. & Gilles Dowek, ICTAC 2021, TCS 2023]

Γ⊢A Γ⊢B ⊙
i
Γ⊢A⊙B
Γ ⊢ A ⊙ B Γ, A ⊢ C Γ ⊢ A ⊙ B Γ, B ⊢ C Γ⊢A⊙B Γ, A ⊢ C Γ, B ⊢ C
⊙e1 ⊙e2 ⊙e
Γ⊢C Γ⊢C Γ⊢C

Alejandro Díaz-Caro Sup: A logical connective for non-determinism Section 1 / 6: The sup connective Slide 3 / 21
⊙ connective
In PL [A.DC. & Gilles Dowek, ICTAC 2021, TCS 2023]

Γ⊢A Γ⊢B ⊙
i
Γ⊢A⊙B
Γ⊢A⊙B Γ⊢A⊙B Γ⊢A⊙B Γ, A ⊢ C Γ, B ⊢ C
⊙e1 ⊙e2 ⊙e
Γ⊢A Γ⊢B Γ⊢C

Alejandro Díaz-Caro Sup: A logical connective for non-determinism Section 1 / 6: The sup connective Slide 3 / 21
⊙ connective
In PL [A.DC. & Gilles Dowek, ICTAC 2021, TCS 2023]

Γ⊢A Γ⊢B ⊙
i
Γ⊢A⊙B
Γ⊢A⊙B Γ⊢A⊙B Γ⊢A⊙B Γ, A ⊢ C Γ, B ⊢ C
⊙e1 ⊙e2 ⊙e
Γ⊢A Γ⊢B Γ⊢C

In ILL, an additive connective [A.DC. & Gilles Dowek, FSCD 2022, arXiv:2201.11221]

Γ⊢A Γ⊢B ⊙
i
Γ⊢A⊙B
Γ⊢A⊙B Γ⊢A⊙B Γ⊢A⊙B ∆, A ⊢ C ∆, B ⊢ C
⊙e1 ⊙e2 ⊙e
Γ⊢A Γ⊢A Γ, ∆ ⊢ C

Alejandro Díaz-Caro Sup: A logical connective for non-determinism Section 1 / 6: The sup connective Slide 3 / 21
⊙ connective
As an additive conjunction
The rule
Γ⊢A⊙B ∆, A ⊢ C ∆, B ⊢ C
⊙e
Γ, ∆ ⊢ C

Can be derived in ILL as


Γ ⊢ A&B
&
Γ ⊢ A ⊕e1
i1
Γ⊢A⊕B ∆, A ⊢ C ∆, B ⊢ C
⊕e
Γ, ∆ ⊢ C

or
Γ ⊢ A&B
&e2
Γ⊢B ⊕i2
Γ⊢A⊕B ∆, A ⊢ C ∆, B ⊢ C
⊕e
Γ, ∆ ⊢ C

which one we use?. . . Non-deterministic choice!


Alejandro Díaz-Caro Sup: A logical connective for non-determinism Section 1 / 6: The sup connective Slide 4 / 21
The L⊙-calculus
The L⊙-calculus
Intuitionistic linear logic connectives

Truth Falsehood Implication Conjunction Disjunction Superposition


Prop. logic ⊤ ⊥ ⇒ ∧ ∨ ⊙
Multiplicative 1 ⊸ ⊗
Additive ⊤ 0 & ⊕ ⊙

Alejandro Díaz-Caro Sup: A logical connective for non-determinism Section 2 / 6: The L⊙-calculus Slide 5 / 21
The L⊙-calculus
Intuitionistic linear logic connectives

Truth Falsehood Implication Conjunction Disjunction Superposition


Prop. logic ⊤ ⊥ ⇒ ∧ ∨ ⊙
Multiplicative 1 ⊸ ⊗
Additive ⊤ 0 & ⊕ ⊙
Proof terms
introductions eliminations connective
t=x |⋆ | t;t (1)
| λx.t | tt (⊸)
|t ⊗t | let x ⊗ y = t in t (⊗)
| ⟨⟩ (⊤)
| err(t) (0)
| ⟨t, t⟩ | fst(t) | snd(t) (&)
| inl(t) | inr(t) | match(t, x.t, y .t) (⊕)
| [t, t] | fst⊙ (t) | snd⊙ (t)| match⊙ (t, x.t, y .t) (⊙)

Alejandro Díaz-Caro Sup: A logical connective for non-determinism Section 2 / 6: The L⊙-calculus Slide 5 / 21
The L⊙-calculus
Some deduction rules

Γ⊢t:A Γ⊢u:B Γ ⊢ t : A&B Γ ⊢ t : A&B


&i &e1 &e2
Γ ⊢ ⟨t, u⟩ : A & B Γ ⊢ fst(t) : A Γ ⊢ snd(t) : B
Γ⊢t:A ⊕i1 Γ⊢t:B ⊕i2
Γ ⊢ inl(t) : A ⊕ B Γ ⊢ inr(t) : A ⊕ B

Γ ⊢ t : A ⊕ B ∆, x : A ⊢ r : C ∆, y : B ⊢ s : C
⊕e
Γ, ∆ ⊢ match(t, x.r , y .s) : C

Γ⊢t:A Γ⊢u:B ⊙ Γ⊢t:A ⊙ B Γ⊢t:A ⊙ B


i ⊙e1 ⊙e2
Γ ⊢ [t, u] : A ⊙ B Γ ⊢ fst⊙ (t) : A Γ ⊢ snd⊙ (t) : B

Γ⊢t :A⊙B ∆, x : A ⊢ r : C ∆, y : B ⊢ s : C

⊙e
Γ, ∆ ⊢ match (t, x.r , y .s) : C

Alejandro Díaz-Caro Sup: A logical connective for non-determinism Section 2 / 6: The L⊙-calculus Slide 6 / 21
The L⊙-calculus
Some reduction rules

fst⟨t, u⟩ → t fst⊙ [t, u] → t


snd⟨t, u⟩ → u snd⊙ [t, u] → u
match(inl(t), x.r , y .s) → (t/x)r match⊙ ([t, u], x.r , y .s) → (t/x)r
match(inr(u), x.r , y .s) → (u/y )s match⊙ ([t, u], x.r , y .s) → (u/y )s

We can consider

match⊙ ([t, u], x.r , y .s)

equivalent to

match(inl(fst⟨t, u⟩), x.r , y .s) or match(inr(snd⟨t, u⟩), x.r , y .s)

which one we use?. . . Non-deterministic choice!


Alejandro Díaz-Caro Sup: A logical connective for non-determinism Section 2 / 6: The L⊙-calculus Slide 7 / 21
The LS -calculus and the linearity
The LS -calculus and the linearity
Addition and multiplication by scalar

Γ ⊢ A Γ ⊢ A sum Γ ⊢ A prod
Γ⊢A Γ⊢A

Alejandro Díaz-Caro Sup: A logical connective for non-determinism Section 3 / 6: The LS -calculus and the linearity Slide 8 / 21
The LS -calculus and the linearity
Addition and multiplication by scalar

Γ ⊢ A Γ ⊢ A sum Γ ⊢ A prod
Γ⊢A Γ⊢A
Now some proofs cannot be reduced, e.g.
π1 π2
Γ⊢A Γ⊢B
&
Γ ⊢ A & B prodi
Γ ⊢ A&B
&e
Γ⊢A

Alejandro Díaz-Caro Sup: A logical connective for non-determinism Section 3 / 6: The LS -calculus and the linearity Slide 8 / 21
The LS -calculus and the linearity
Addition and multiplication by scalar

Γ ⊢ A Γ ⊢ A sum Γ ⊢ A prod
Γ⊢A Γ⊢A
Now some proofs cannot be reduced, e.g.
π1 π2
Γ⊢A Γ⊢B
&
Γ ⊢ A & B prodi
Γ ⊢ A&B
&e
Γ⊢A

Commute sum either with the intro or with the elim


π1 π2 π1 π2
Γ ⊢ A prod Γ ⊢ B prod Γ⊢A Γ⊢B
&i
Γ⊢A Γ⊢B Γ ⊢ A&B
&i &e
Γ ⊢ A&B Γ ⊢ A prod
&e
Γ⊢A Γ⊢A

We chose to commute with the introduction as much as possible


Alejandro Díaz-Caro Sup: A logical connective for non-determinism Section 3 / 6: The LS -calculus and the linearity Slide 8 / 21
The LS -calculus and the linearity
Scalars, addition and multiplication by scalar

ax Γ ⊢ t : A Γ ⊢ u : A sum Γ ⊢ t : A prod
Γ ⊢ s.⋆ : 1 Γ⊢t +u :A Γ⊢s •t :A
Now some proofs cannot be reduced, e.g.
Γ⊢t:A Γ⊢u:B
&i
Γ ⊢ ⟨t, u⟩ : A & B
prod
Γ ⊢ s • ⟨t, u⟩ : A & B
&e
Γ ⊢ fst(s • ⟨t, u⟩) : A

Commute sum either with the intro or with the elim


Γ ⊢ t : A prod Γ ⊢ u : B prod Γ⊢t:A Γ⊢u:B
&i
Γ⊢s •t :A Γ⊢s •u :B Γ ⊢ ⟨t, u⟩ : A & B
&i &e
Γ ⊢ ⟨s • t, s • u⟩ : A & B Γ ⊢ fst⟨t, u⟩ : A
&e prod
Γ ⊢ fst⟨s • t, s • u⟩ : A Γ ⊢ s • fst⟨t, u⟩ : A

We chose to commute with the introduction as much as possible: s • ⟨t, u⟩ → ⟨s • t, s • u⟩


Alejandro Díaz-Caro Sup: A logical connective for non-determinism Section 3 / 6: The LS -calculus and the linearity Slide 9 / 21
The LS -calculus and the linearity
Syntactic linearity

Theorem (Linearity)
| & ·{z
Let A be any proposition, and B = 1 · · & 1} ⊢ t : A ⊸ B, and u, v ∈ A, then
n≥1

t(u + v ) ≡ (tu) + (tv ) t(a • u) ≡ a • (tu)

Alejandro Díaz-Caro Sup: A logical connective for non-determinism Section 3 / 6: The LS -calculus and the linearity Slide 10 / 21
The LS -calculus and the linearity
Syntactic linearity

Theorem (Linearity)
| & ·{z
Let A be any proposition, and B = 1 · · & 1} ⊢ t : A ⊸ B, and u, v ∈ A, then
n≥1

t(u + v ) ≡ (tu) + (tv ) t(a • u) ≡ a • (tu)

It does not extend directly to arbitrary B: Let t = λx.λy .yx : 1 ⊸ (1 ⊸ 1) ⊸ 1

t(1. ⋆ + 2.⋆) −→∗ λy .y 3.⋆ (t1.⋆) + (t2.⋆) −→∗ λy .(y 1.⋆) + (y 2.⋆)

But they are observationally equivalent!

Alejandro Díaz-Caro Sup: A logical connective for non-determinism Section 3 / 6: The LS -calculus and the linearity Slide 10 / 21
The LS -calculus and the linearity
Syntactic linearity

Theorem (Linearity)
| & ·{z
Let A be any proposition, and B = 1 · · & 1} ⊢ t : A ⊸ B, and u, v ∈ A, then
n≥1

t(u + v ) ≡ (tu) + (tv ) t(a • u) ≡ a • (tu)

It does not extend directly to arbitrary B: Let t = λx.λy .yx : 1 ⊸ (1 ⊸ 1) ⊸ 1

t(1. ⋆ + 2.⋆) −→∗ λy .y 3.⋆ (t1.⋆) + (t2.⋆) −→∗ λy .(y 1.⋆) + (y 2.⋆)

But they are observationally equivalent!

Theorem (Generalized linearity)


Let A, B be any propositions, ⊢ t : A ⊸ B, and u, v ∈ A, then

t(u + v ) ∼ (tu) + (tv ) t(a • u) ∼ a • (tu)

Alejandro Díaz-Caro Sup: A logical connective for non-determinism Section 3 / 6: The LS -calculus and the linearity Slide 10 / 21
Quantum computing
Encoding quantum computing in the L⊙C -calculus
Qubits and norm

Definition (Qubits: Qn )
Q0 = 1 Qn+1 = Qn ⊙ Qn

Definition (Norm)
Let t closed irreductible proof of Qn .
▶ If n = 0, t = a.⋆ ∥t∥2 = |a|2
▶ If n = n′ + 1, t = [t1 , t2 ] ∥t∥2 = ∥t1 ∥2 + ∥t2 ∥2

Alejandro Díaz-Caro Sup: A logical connective for non-determinism Section 4 / 6: Quantum computing Slide 11 / 21
Encoding quantum computing in the L⊙C -calculus
Qubits and norm

Definition (Qubits: Qn )
Q0 = 1 Qn+1 = Qn ⊙ Qn

Definition (Norm)
Let t closed irreductible proof of Qn .
▶ If n = 0, t = a.⋆ ∥t∥2 = |a|2
▶ If n = n′ + 1, t = [t1 , t2 ] ∥t∥2 = ∥t1 ∥2 + ∥t2 ∥2
u
Convention u closed irreductible proof of Qn =⇒ alternative expression of the n-qubit ∥u∥ .
Example: √12 |0⟩ + √12 |1⟩ can be expressed by [ √12 .⋆, √12 .⋆] or by [1.⋆, 1.⋆].

Alejandro Díaz-Caro Sup: A logical connective for non-determinism Section 4 / 6: Quantum computing Slide 11 / 21
Encoding quantum computing in the L⊙C -calculus
Qubits and norm

Definition (Qubits: Qn )
Q0 = 1 Qn+1 = Qn ⊙ Qn

Definition (Norm)
Let t closed irreductible proof of Qn .
▶ If n = 0, t = a.⋆ ∥t∥2 = |a|2
▶ If n = n′ + 1, t = [t1 , t2 ] ∥t∥2 = ∥t1 ∥2 + ∥t2 ∥2
u
Convention u closed irreductible proof of Qn =⇒ alternative expression of the n-qubit ∥u∥ .
Example: √12 |0⟩ + √12 |1⟩ can be expressed by [ √12 .⋆, √12 .⋆] or by [1.⋆, 1.⋆].

We can asign probabilities to the non-deterministic reductions of match⊙

Alejandro Díaz-Caro Sup: A logical connective for non-determinism Section 4 / 6: Quantum computing Slide 11 / 21
Measurement in the L⊙C -calculus
Definition (Measurement of n qubits)
measn = λx.match⊙ (x, y .[y , 0Qn−1 ], z.[0Qn−1 , z]) ⊢ measn : Qn ⊸ Qn

Alejandro Díaz-Caro Sup: A logical connective for non-determinism Section 4 / 6: Quantum computing Slide 12 / 21
Measurement in the L⊙C -calculus
Definition (Measurement of n qubits)
measn = λx.match⊙ (x, y .[y , 0Qn−1 ], z.[0Qn−1 , z]) ⊢ measn : Qn ⊸ Qn

Definition (Bits: B)
B=1⊕1 0 = inl(1.⋆) 1 = inr(1.⋆)
Convention Proofs of bits are taken modulo normalization.
a • 0 with a ̸= 0 represents the Boolean 0 a • 1 with a ̸= 0 represents the Boolean 1

Alejandro Díaz-Caro Sup: A logical connective for non-determinism Section 4 / 6: Quantum computing Slide 12 / 21
Measurement in the L⊙C -calculus
Definition (Measurement of n qubits)
measn = λx.match⊙ (x, y .[y , 0Qn−1 ], z.[0Qn−1 , z]) ⊢ measn : Qn ⊸ Qn

Definition (Bits: B)
B=1⊕1 0 = inl(1.⋆) 1 = inr(1.⋆)
Convention Proofs of bits are taken modulo normalization.
a • 0 with a ̸= 0 represents the Boolean 0 a • 1 with a ̸= 0 represents the Boolean 1

Definition (Classical output of the measurement)


meas′1 = λx.match⊙ (x, y .y ;0, z.z;1) ⊢ meas′1 : Qn ⊸ B

Example
meas′1 [a.⋆, b.⋆]
2
|b|2
Reduces to a.0 with probability |a|2|a|
+|b|2 Reduces to b.1 with probability |a|2 +|b|2

Alejandro Díaz-Caro Sup: A logical connective for non-determinism Section 4 / 6: Quantum computing Slide 12 / 21
Example: Deutsch’s algorithm
Preliminaires

Definition (The four boolean functions)


if = λx.λy .λz.match(x, w1 .w1 ;y , w2 .w2 ;z) ⊢ if : B ⊸ A ⊸ A ⊸ A
if 0 u v → 1 • u if 1 u v → 1 • v
The four Boolean functions mapping 0 to a and 1 to b are λx.if x a b

Alejandro Díaz-Caro Sup: A logical connective for non-determinism Section 4 / 6: Quantum computing Slide 13 / 21
Example: Deutsch’s algorithm
Preliminaires

Definition (The four boolean functions)


if = λx.λy .λz.match(x, w1 .w1 ;y , w2 .w2 ;z) ⊢ if : B ⊸ A ⊸ A ⊸ A
if 0 u v → 1 • u if 1 u v → 1 • v
The four Boolean functions mapping 0 to a and 1 to b are λx.if x a b

Definition (⊢ U : (B ⊸ B) ⊸ Q2 ⊸ Q2 )
       
⊙ ⊙
U = λf .λq. M0 π1 (π1 q) + M1 π2⊙ (π1⊙ q) + M2 π1⊙ (π2⊙ q) +
⊙ ⊙
M3 π2 (π2 q)

where M0 , M1 , M2 , and M3 are the proofs of 1 ⊸ Q2

M0 = λs.(s;if (f 0) [[1.⋆, 0.⋆], [0.⋆, 0.⋆]] [[0.⋆, 1.⋆], [0.⋆, 0.⋆]])


M1 = λs.(s;if (f 0) [[0.⋆, 1.⋆], [0.⋆, 0.⋆]] [[1.⋆, 0.⋆], [0.⋆, 0.⋆]])
M2 = λs.(s;if (f 1) [[0.⋆, 0.⋆], [1.⋆, 0.⋆]] [[0.⋆, 0.⋆], [0.⋆, 1.⋆]])
M3 = λs.(s;if (f 1) [[0.⋆, 0.⋆], [0.⋆, 1.⋆]] [[0.⋆, 0.⋆], [1.⋆, 0.⋆]])
Alejandro Díaz-Caro Sup: A logical connective for non-determinism Section 4 / 6: Quantum computing Slide 13 / 21
Example: Deutsch’s algorithm

Deutsch = λf .meas′2 ((H ⊗ I ) (U f | + −⟩))


⊢ Deutsch : (B ⊸ B) ⊸ B

Example
⊢f :B⊸B
▶ If f constant function, Deutsch f −→∗(1) a • 0, for some scalar a,
▶ If f if not constant, Deutsch f −→∗(1) a • 1 for some scalar a.

Alejandro Díaz-Caro Sup: A logical connective for non-determinism Section 4 / 6: Quantum computing Slide 14 / 21
Categorical model
A categorical model of the LS -calculus
[ADC & O. Malherbe, arXiv:2205.02142, 2022]

Definition (Semiring)
▶ (S, +) commutative monoid with identity 0 In particular {∗} is a
▶ (S, ·) commutative monoid with identity 1 semiring, with 0 = 1 = ∗
▶ · distributes w.r.t. +
▶ For any s ∈ S, 0 · s = 0

Definition (S-semimodule)
(A, +) commutative monoid with additive identity 0 and • : S × A → A satisfying:

(s · s ′ ) • a = s • (s ′ • a) 1•a=a
′ ′
s • (a + a ) = (s • a) + (s • a ) s •0=0•a=0
(s + s ′ ) • a = (s • a) + (s ′ • a)

Alejandro Díaz-Caro Sup: A logical connective for non-determinism Section 5 / 6: Categorical model Slide 15 / 21
A categorical model of the LS -calculus
[ADC & O. Malherbe, arXiv:2205.02142, 2022]

Definition (Category SMS ) Theorem


Obj(SMS ) = {A | A is a S-semimodule} SMS is a symmetic monoidal closed
Arr(SMS ) = {f | f is a S-homomorphism} category with biproduct

J1K = S J0K = {∗}


JA ⊗ BK = JAK ⊗ JBK JA & BK = JAK × JBK
JA ⊸ BK = [JAK → JBK] JA ⊕ BK = JAK + JBK
J⊤K = {∗}

Theorem (Soundness) Theorem (Adequacy)


If t → u, then JΓ ⊢ t : AK = JΓ ⊢ u : AK If JΓ ⊢ t : AK = JΓ ⊢ u : AK then t ≡ u

Alejandro Díaz-Caro Sup: A logical connective for non-determinism Section 5 / 6: Categorical model Slide 16 / 21
Interpreting the non-determinism
Interpreting the non-determinism
[A.DC. & Octavio Malherbe, arXiv:2309.04624, 2023]
Moggi’s approach:
1. PA = {X | X ⊆ A}
2. Calculate the two outputs (a1 , a2 ).
3. Map them into {a1 , a2 }

Alejandro Díaz-Caro Sup: A logical connective for non-determinism Section 6 / 6: Interpreting the non-determinism Slide 17 / 21
Interpreting the non-determinism
[A.DC. & Octavio Malherbe, arXiv:2309.04624, 2023]
Moggi’s approach:
1. PA = {X | X ⊆ A}
2. Calculate the two outputs (a1 , a2 ).
3. Map them into {a1 , a2 }
Problem: the map ξ(a1 , a2 ) = {a1 , a2 } is not linear

ξ((a1 , a2 ) +A×A (a3 , a4 )) = ξ(a1 +A a3 , a2 +A a4 ) = {a1 +A a3 , a2 +A a4 }


ξ(a1 , a2 ) +A×A ξ(a3 , a4 ) = {a1 , a2 } +PA {a3 , a4 } = {a1 +A a3 , a1 +A a3 , a2 +A a3 , a2 +A a4 }

Alejandro Díaz-Caro Sup: A logical connective for non-determinism Section 6 / 6: Interpreting the non-determinism Slide 17 / 21
Interpreting the non-determinism
[A.DC. & Octavio Malherbe, arXiv:2309.04624, 2023]
Moggi’s approach:
1. PA = {X | X ⊆ A}
2. Calculate the two outputs (a1 , a2 ).
3. Map them into {a1 , a2 }
Problem: the map ξ(a1 , a2 ) = {a1 , a2 } is not linear

ξ((a1 , a2 ) +A×A (a3 , a4 )) = ξ(a1 +A a3 , a2 +A a4 ) = {a1 +A a3 , a2 +A a4 }


ξ(a1 , a2 ) +A×A ξ(a3 , a4 ) = {a1 , a2 } +PA {a3 , a4 } = {a1 +A a3 , a1 +A a3 , a2 +A a3 , a2 +A a4 }

Possible alternative:
1. LA = {ℓ | ℓ is a list of elements of A}
2. Calculate the two outputs (a1 , a2 ).
3. Map them into [a1 , a2 ]

Alejandro Díaz-Caro Sup: A logical connective for non-determinism Section 6 / 6: Interpreting the non-determinism Slide 17 / 21
Interpreting the non-determinism
[A.DC. & Octavio Malherbe, arXiv:2309.04624, 2023]
Moggi’s approach:
1. PA = {X | X ⊆ A}
2. Calculate the two outputs (a1 , a2 ).
3. Map them into {a1 , a2 }
Problem: the map ξ(a1 , a2 ) = {a1 , a2 } is not linear

ξ((a1 , a2 ) +A×A (a3 , a4 )) = ξ(a1 +A a3 , a2 +A a4 ) = {a1 +A a3 , a2 +A a4 }


ξ(a1 , a2 ) +A×A ξ(a3 , a4 ) = {a1 , a2 } +PA {a3 , a4 } = {a1 +A a3 , a1 +A a3 , a2 +A a3 , a2 +A a4 }

Possible alternative:
1. LA = {ℓ | ℓ is a list of elements of A}
2. Calculate the two outputs (a1 , a2 ).
3. Map them into [a1 , a2 ]
Problem: Pointwise sum does not represent the mixture of non-deterministic choices!
Alejandro Díaz-Caro Sup: A logical connective for non-determinism Section 6 / 6: Interpreting the non-determinism Slide 17 / 21
Interpreting the non-determinism
Our (first) approach: using the codiagonal
First attempt

∆ = ⟨id, id⟩ ∇ = [id, id]

A
id ∆ id

A π1 A×A π2 A

A i1 A+A i2 A
id ∇ id

ξ
Instead of A × A −→ PA defined by ξ(a1 , a2 ) = {a1 , a2 }

use A × A −→ A defined by ∇(a1 , a2 ) = a1 +A a2
Alejandro Díaz-Caro Sup: A logical connective for non-determinism Section 6 / 6: Interpreting the non-determinism Slide 18 / 21
Interpreting the non-determinism
Our (first) approach: using the codiagonal
First attempt
Problem:
∆ = ⟨id, id⟩ ∇ = [id, id] ▶ t → t1 and t → t2
A
id ∆ id

A π1 A×A π2 A

A i1 A+A i2 A
id ∇ id

ξ
Instead of A × A −→ PA defined by ξ(a1 , a2 ) = {a1 , a2 }

use A × A −→ A defined by ∇(a1 , a2 ) = a1 +A a2
Alejandro Díaz-Caro Sup: A logical connective for non-determinism Section 6 / 6: Interpreting the non-determinism Slide 18 / 21
Interpreting the non-determinism
Our (first) approach: using the codiagonal
First attempt
Problem:
∆ = ⟨id, id⟩ ∇ = [id, id] ▶ t → t1 and t → t2
A ▶ (t, v ) → (t1 , v ) and (t, v ) → (t2 , v )

id ∆ id

A π1 A×A π2 A

A i1 A+A i2 A
id ∇ id

ξ
Instead of A × A −→ PA defined by ξ(a1 , a2 ) = {a1 , a2 }

use A × A −→ A defined by ∇(a1 , a2 ) = a1 +A a2
Alejandro Díaz-Caro Sup: A logical connective for non-determinism Section 6 / 6: Interpreting the non-determinism Slide 18 / 21
Interpreting the non-determinism
Our (first) approach: using the codiagonal
First attempt
Problem:
∆ = ⟨id, id⟩ ∇ = [id, id] ▶ t → t1 and t → t2
A ▶ (t, v ) → (t1 , v ) and (t, v ) → (t2 , v )
▶ ∇((t1 , v ), (t2 , v ))
id ∆ id
= (t1 , v ) +A×B (t2 , v )
A π1 A×A π2 A = (t1 +A t2 , v +B v)
A i1 A+A i2 A
id ∇ id

ξ
Instead of A × A −→ PA defined by ξ(a1 , a2 ) = {a1 , a2 }

use A × A −→ A defined by ∇(a1 , a2 ) = a1 +A a2
Alejandro Díaz-Caro Sup: A logical connective for non-determinism Section 6 / 6: Interpreting the non-determinism Slide 18 / 21
Interpreting the non-determinism
Our (first) approach: using the codiagonal
First attempt
Problem:
∆ = ⟨id, id⟩ ∇ = [id, id] ▶ t → t1 and t → t2
A ▶ (t, v ) → (t1 , v ) and (t, v ) → (t2 , v )
▶ ∇((t1 , v ), (t2 , v ))
id ∆ id
= (t1 , v ) +A×B (t2 , v )
A π1 A×A π2 A = (t1 +A t2 , v +B v )
▶ But if first reduce t and then place it
A i1 A+A i2 A
in the context (_, v ):
id ∇ id
(∇(t1 , t2 ), v ) = (t1 +A t2 , v )
A

ξ
Instead of A × A −→ PA defined by ξ(a1 , a2 ) = {a1 , a2 }

use A × A −→ A defined by ∇(a1 , a2 ) = a1 +A a2
Alejandro Díaz-Caro Sup: A logical connective for non-determinism Section 6 / 6: Interpreting the non-determinism Slide 18 / 21
Interpreting the non-determinism
Our approach: using a weighted codiagonal

∆pq = ⟨p̂, q̂⟩ ∇pq = [p̂, q̂]

A
p̂ ∆pq q̂

A π1 A×A π2 A

A i1 A+A i2 A
p̂ ∇pq q̂

A
ξ
Instead of A × A −→ PA defined by ξ(a1 , a2 ) = {a1 , a2 }
∇pq
use A × A −→ A defined by ∇pq (a1 , a2 ) = p •A a1 +A q •A a2
with p +S q = 1

Alejandro Díaz-Caro Sup: A logical connective for non-determinism Section 6 / 6: Interpreting the non-determinism Slide 19 / 21
Interpreting the non-determinism
Our approach: using a weighted codiagonal

∆pq = ⟨p̂, q̂⟩ ∇pq = [p̂, q̂]

A Same example:
p̂ ∆pq q̂
▶ t → t1 and t → t2
▶ (t, v ) → (t1 , v ) and (t, v ) → (t2 , v )
A π1 A×A π2 A
▶ ∇pq ((t1 , v ), (t2 , v ))
A i1 A+A i2 A = p •A×B (t1 , v ) +A×B q •A×B (t2 , v )
p̂ ∇pq q̂
= (p •A t1 +A q •A t2 , v )

A
ξ
Instead of A × A −→ PA defined by ξ(a1 , a2 ) = {a1 , a2 }
∇pq
use A × A −→ A defined by ∇pq (a1 , a2 ) = p •A a1 +A q •A a2
with p +S q = 1

Alejandro Díaz-Caro Sup: A logical connective for non-determinism Section 6 / 6: Interpreting the non-determinism Slide 19 / 21
Interpreting the non-determinism
Interpretation of ⊙ using ∇pq

JA ⊙ BK = JAK × JBK Γ⊢t :A⊙B x : A, ∆ ⊢ u : C y : B, ∆ ⊢ v : C



⊙e
Γ, ∆ ⊢ match (t, x.u, y .v ) : C

t⊗id d u×v ∇pq


JΓK ⊗ J∆K −→ (JAK × JBK) ⊗ J∆K −→ (JAK ⊗ J∆K) × (JBK ⊗ J∆K) −→ JC K × JC K −→ JC K

Alejandro Díaz-Caro Sup: A logical connective for non-determinism Section 6 / 6: Interpreting the non-determinism Slide 20 / 21
Interpreting the non-determinism
Interpretation of ⊙ using ∇pq

JA ⊙ BK = JAK × JBK Γ⊢t :A⊙B x : A, ∆ ⊢ u : C y : B, ∆ ⊢ v : C



⊙e
Γ, ∆ ⊢ match (t, x.u, y .v ) : C

t⊗id d u×v ∇pq


JΓK ⊗ J∆K −→ (JAK × JBK) ⊗ J∆K −→ (JAK ⊗ J∆K) × (JBK ⊗ J∆K) −→ JC K × JC K −→ JC K

Similarity with ⊕e

JA ⊕ BK = JAK + JBK Γ ⊢ t : A ⊕ B x : A, ∆ ⊢ u : C y : B, ∆ ⊢ v : C
⊕e
Γ, ∆ ⊢ match(t, x.u, y .v ) : C
t⊗id d [u,v ]
JΓK ⊗ J∆K −→ (JAK + JBK) ⊗ J∆K −→ (JAK ⊗ J∆K) + (JBK ⊗ J∆K) −→ JC K

[u,v ] u×v ∇
A + B −→ C equivalent to A × B −→ C × C −→ C
u×v ∇ u×v ∇pq
So changed A × B −→ C × C −→ C by A × B −→ C × C −→ C
Alejandro Díaz-Caro Sup: A logical connective for non-determinism Section 6 / 6: Interpreting the non-determinism Slide 20 / 21
Summarizing

The ⊙ connective as a non-harmonious connective in PL and IMALL

Linearity result from sum and scalar multiplication in the linear lambda-calculus

The L⊙C -calculus is suitable for quantum computing

Categorical model for the extended linear lambda-calculus (semimodules over a semiring).

Novel approach for non-determinism in a category with biproducts,


when Moggi’s Powerset Monad is not possible

Alejandro Díaz-Caro Sup: A logical connective for non-determinism Summarizing Slide 21 / 21

You might also like