algebra and coalgebra in the light affine lambda calculus · turing machines lambda calculus ptime...
TRANSCRIPT
![Page 1: Algebra and Coalgebra in the Light Affine Lambda Calculus · Turing Machines Lambda Calculus PTIME NPTIME PSPACE LOGSPACE BPP LALC INTML STA DLAL RSLR Computability Complexity Implicit](https://reader034.vdocuments.net/reader034/viewer/2022050123/5f53297e82234652116ddf72/html5/thumbnails/1.jpg)
Algebra and Coalgebra in the
Light Affine Lambda Calculus
Marco GaboardiUniversity of Dundee
Romain PéchouxUniversité de Lorraine
![Page 2: Algebra and Coalgebra in the Light Affine Lambda Calculus · Turing Machines Lambda Calculus PTIME NPTIME PSPACE LOGSPACE BPP LALC INTML STA DLAL RSLR Computability Complexity Implicit](https://reader034.vdocuments.net/reader034/viewer/2022050123/5f53297e82234652116ddf72/html5/thumbnails/2.jpg)
ComputabilityComplexity
![Page 3: Algebra and Coalgebra in the Light Affine Lambda Calculus · Turing Machines Lambda Calculus PTIME NPTIME PSPACE LOGSPACE BPP LALC INTML STA DLAL RSLR Computability Complexity Implicit](https://reader034.vdocuments.net/reader034/viewer/2022050123/5f53297e82234652116ddf72/html5/thumbnails/3.jpg)
TuringMachines
Lambda Calculus
ComputabilityComplexity
![Page 4: Algebra and Coalgebra in the Light Affine Lambda Calculus · Turing Machines Lambda Calculus PTIME NPTIME PSPACE LOGSPACE BPP LALC INTML STA DLAL RSLR Computability Complexity Implicit](https://reader034.vdocuments.net/reader034/viewer/2022050123/5f53297e82234652116ddf72/html5/thumbnails/4.jpg)
TuringMachines
Lambda Calculus
PTIME NPTIME
PSPACE
LOGSPACE
BPP
LALC
STAINTML
DLAL
RSLR
ComputabilityComplexity
![Page 5: Algebra and Coalgebra in the Light Affine Lambda Calculus · Turing Machines Lambda Calculus PTIME NPTIME PSPACE LOGSPACE BPP LALC INTML STA DLAL RSLR Computability Complexity Implicit](https://reader034.vdocuments.net/reader034/viewer/2022050123/5f53297e82234652116ddf72/html5/thumbnails/5.jpg)
TuringMachines
Lambda Calculus
PTIME NPTIME
PSPACE
LOGSPACE
BPP
LALC
STAINTML
DLAL
RSLR
ComputabilityComplexity
Implicit Complexity
![Page 6: Algebra and Coalgebra in the Light Affine Lambda Calculus · Turing Machines Lambda Calculus PTIME NPTIME PSPACE LOGSPACE BPP LALC INTML STA DLAL RSLR Computability Complexity Implicit](https://reader034.vdocuments.net/reader034/viewer/2022050123/5f53297e82234652116ddf72/html5/thumbnails/6.jpg)
TuringMachines
Lambda Calculus
PTIME NPTIME
PSPACE
LOGSPACE
BPP
LALC
STAINTML
DLAL
RSLRLALCPTIME
ComputabilityComplexity
![Page 7: Algebra and Coalgebra in the Light Affine Lambda Calculus · Turing Machines Lambda Calculus PTIME NPTIME PSPACE LOGSPACE BPP LALC INTML STA DLAL RSLR Computability Complexity Implicit](https://reader034.vdocuments.net/reader034/viewer/2022050123/5f53297e82234652116ddf72/html5/thumbnails/7.jpg)
(Light Affine Lambda Calculus)
LALC
PTIME
![Page 8: Algebra and Coalgebra in the Light Affine Lambda Calculus · Turing Machines Lambda Calculus PTIME NPTIME PSPACE LOGSPACE BPP LALC INTML STA DLAL RSLR Computability Complexity Implicit](https://reader034.vdocuments.net/reader034/viewer/2022050123/5f53297e82234652116ddf72/html5/thumbnails/8.jpg)
Where these languages could help?
![Page 9: Algebra and Coalgebra in the Light Affine Lambda Calculus · Turing Machines Lambda Calculus PTIME NPTIME PSPACE LOGSPACE BPP LALC INTML STA DLAL RSLR Computability Complexity Implicit](https://reader034.vdocuments.net/reader034/viewer/2022050123/5f53297e82234652116ddf72/html5/thumbnails/9.jpg)
Where these languages could help?
ResourceAnalysis
![Page 10: Algebra and Coalgebra in the Light Affine Lambda Calculus · Turing Machines Lambda Calculus PTIME NPTIME PSPACE LOGSPACE BPP LALC INTML STA DLAL RSLR Computability Complexity Implicit](https://reader034.vdocuments.net/reader034/viewer/2022050123/5f53297e82234652116ddf72/html5/thumbnails/10.jpg)
Where these languages could help?
ResourceAnalysis
Efficient arithmeticimplementation
![Page 11: Algebra and Coalgebra in the Light Affine Lambda Calculus · Turing Machines Lambda Calculus PTIME NPTIME PSPACE LOGSPACE BPP LALC INTML STA DLAL RSLR Computability Complexity Implicit](https://reader034.vdocuments.net/reader034/viewer/2022050123/5f53297e82234652116ddf72/html5/thumbnails/11.jpg)
Where these languages could help?
ComputationalIndistinguishability
ResourceAnalysis
Efficient arithmeticimplementation
![Page 12: Algebra and Coalgebra in the Light Affine Lambda Calculus · Turing Machines Lambda Calculus PTIME NPTIME PSPACE LOGSPACE BPP LALC INTML STA DLAL RSLR Computability Complexity Implicit](https://reader034.vdocuments.net/reader034/viewer/2022050123/5f53297e82234652116ddf72/html5/thumbnails/12.jpg)
Completeness every PTIME Turing Machine can be expressed in LALC.
Soundness: every LALC program can be run in polynomial time.
PTIME LALC
![Page 13: Algebra and Coalgebra in the Light Affine Lambda Calculus · Turing Machines Lambda Calculus PTIME NPTIME PSPACE LOGSPACE BPP LALC INTML STA DLAL RSLR Computability Complexity Implicit](https://reader034.vdocuments.net/reader034/viewer/2022050123/5f53297e82234652116ddf72/html5/thumbnails/13.jpg)
Completeness every PTIME Turing Machine can be expressed in LALC.
Soundness: every LALC program can be run in polynomial time.
Expressivity?
PTIME LALC
![Page 14: Algebra and Coalgebra in the Light Affine Lambda Calculus · Turing Machines Lambda Calculus PTIME NPTIME PSPACE LOGSPACE BPP LALC INTML STA DLAL RSLR Computability Complexity Implicit](https://reader034.vdocuments.net/reader034/viewer/2022050123/5f53297e82234652116ddf72/html5/thumbnails/14.jpg)
Our research question:
Can we express Algebra and Coalgebra in LALC?
![Page 15: Algebra and Coalgebra in the Light Affine Lambda Calculus · Turing Machines Lambda Calculus PTIME NPTIME PSPACE LOGSPACE BPP LALC INTML STA DLAL RSLR Computability Complexity Implicit](https://reader034.vdocuments.net/reader034/viewer/2022050123/5f53297e82234652116ddf72/html5/thumbnails/15.jpg)
Our contribution
![Page 16: Algebra and Coalgebra in the Light Affine Lambda Calculus · Turing Machines Lambda Calculus PTIME NPTIME PSPACE LOGSPACE BPP LALC INTML STA DLAL RSLR Computability Complexity Implicit](https://reader034.vdocuments.net/reader034/viewer/2022050123/5f53297e82234652116ddf72/html5/thumbnails/16.jpg)
Our contributionWeak notions of Algebras and Coalgebras can be encoded in LALC.
1 -
![Page 17: Algebra and Coalgebra in the Light Affine Lambda Calculus · Turing Machines Lambda Calculus PTIME NPTIME PSPACE LOGSPACE BPP LALC INTML STA DLAL RSLR Computability Complexity Implicit](https://reader034.vdocuments.net/reader034/viewer/2022050123/5f53297e82234652116ddf72/html5/thumbnails/17.jpg)
Our contributionWeak notions of Algebras and Coalgebras can be encoded in LALC.
1 -
Data types:
✔ Inductive types✗ Coinductive types
2 -
![Page 18: Algebra and Coalgebra in the Light Affine Lambda Calculus · Turing Machines Lambda Calculus PTIME NPTIME PSPACE LOGSPACE BPP LALC INTML STA DLAL RSLR Computability Complexity Implicit](https://reader034.vdocuments.net/reader034/viewer/2022050123/5f53297e82234652116ddf72/html5/thumbnails/18.jpg)
Our contribution
LALC restrictions can be slightly relaxed to achieve more expressivity for coinductive types.
Weak notions of Algebras and Coalgebras can be encoded in LALC.
1 -
Data types:
✔ Inductive types✗ Coinductive types
2 -
3 -
![Page 19: Algebra and Coalgebra in the Light Affine Lambda Calculus · Turing Machines Lambda Calculus PTIME NPTIME PSPACE LOGSPACE BPP LALC INTML STA DLAL RSLR Computability Complexity Implicit](https://reader034.vdocuments.net/reader034/viewer/2022050123/5f53297e82234652116ddf72/html5/thumbnails/19.jpg)
![Page 20: Algebra and Coalgebra in the Light Affine Lambda Calculus · Turing Machines Lambda Calculus PTIME NPTIME PSPACE LOGSPACE BPP LALC INTML STA DLAL RSLR Computability Complexity Implicit](https://reader034.vdocuments.net/reader034/viewer/2022050123/5f53297e82234652116ddf72/html5/thumbnails/20.jpg)
LALC ⊂ Linear (Affine) System F
Light Affine Lambda Calculus - LALC
![Page 21: Algebra and Coalgebra in the Light Affine Lambda Calculus · Turing Machines Lambda Calculus PTIME NPTIME PSPACE LOGSPACE BPP LALC INTML STA DLAL RSLR Computability Complexity Implicit](https://reader034.vdocuments.net/reader034/viewer/2022050123/5f53297e82234652116ddf72/html5/thumbnails/21.jpg)
LALC ⊂ Linear (Affine) System F
!A §B
A B
A → B =
⊸
Main Idea
⊸
Light Affine Lambda Calculus - LALC
![Page 22: Algebra and Coalgebra in the Light Affine Lambda Calculus · Turing Machines Lambda Calculus PTIME NPTIME PSPACE LOGSPACE BPP LALC INTML STA DLAL RSLR Computability Complexity Implicit](https://reader034.vdocuments.net/reader034/viewer/2022050123/5f53297e82234652116ddf72/html5/thumbnails/22.jpg)
LALC ⊂ Linear (Affine) System F
!A §B
A B
A → B =
⊸
Main Idea
⊸
Light Affine Lambda Calculus - LALC
A non iterative function-
A function using its argument only once
![Page 23: Algebra and Coalgebra in the Light Affine Lambda Calculus · Turing Machines Lambda Calculus PTIME NPTIME PSPACE LOGSPACE BPP LALC INTML STA DLAL RSLR Computability Complexity Implicit](https://reader034.vdocuments.net/reader034/viewer/2022050123/5f53297e82234652116ddf72/html5/thumbnails/23.jpg)
LALC ⊂ Linear (Affine) System F
!A §B
A B
A → B =
⊸
Main Idea
⊸
Light Affine Lambda Calculus - LALC
an iterative function-
! needed for duplication§ placeholder witnessing
duplication
![Page 24: Algebra and Coalgebra in the Light Affine Lambda Calculus · Turing Machines Lambda Calculus PTIME NPTIME PSPACE LOGSPACE BPP LALC INTML STA DLAL RSLR Computability Complexity Implicit](https://reader034.vdocuments.net/reader034/viewer/2022050123/5f53297e82234652116ddf72/html5/thumbnails/24.jpg)
Iterators in LALC
⊸IT : ∀a.!(a a) §(a a)⊸⊸
![Page 25: Algebra and Coalgebra in the Light Affine Lambda Calculus · Turing Machines Lambda Calculus PTIME NPTIME PSPACE LOGSPACE BPP LALC INTML STA DLAL RSLR Computability Complexity Implicit](https://reader034.vdocuments.net/reader034/viewer/2022050123/5f53297e82234652116ddf72/html5/thumbnails/25.jpg)
Iterators in LALC
⊸IT : ∀a.!(a a) §(a a)⊸⊸
IT A (step: A A)⊸✔
![Page 26: Algebra and Coalgebra in the Light Affine Lambda Calculus · Turing Machines Lambda Calculus PTIME NPTIME PSPACE LOGSPACE BPP LALC INTML STA DLAL RSLR Computability Complexity Implicit](https://reader034.vdocuments.net/reader034/viewer/2022050123/5f53297e82234652116ddf72/html5/thumbnails/26.jpg)
Iterators in LALC
⊸IT : ∀a.!(a a) §(a a)⊸⊸
IT A (step: A A)⊸IT A (step: !A §A)⊸
✔
✗
![Page 27: Algebra and Coalgebra in the Light Affine Lambda Calculus · Turing Machines Lambda Calculus PTIME NPTIME PSPACE LOGSPACE BPP LALC INTML STA DLAL RSLR Computability Complexity Implicit](https://reader034.vdocuments.net/reader034/viewer/2022050123/5f53297e82234652116ddf72/html5/thumbnails/27.jpg)
Algebras and Coalgebras
AFA fA FBBgB
Algebra Coalgebra
![Page 28: Algebra and Coalgebra in the Light Affine Lambda Calculus · Turing Machines Lambda Calculus PTIME NPTIME PSPACE LOGSPACE BPP LALC INTML STA DLAL RSLR Computability Complexity Implicit](https://reader034.vdocuments.net/reader034/viewer/2022050123/5f53297e82234652116ddf72/html5/thumbnails/28.jpg)
μX.FXFμX.FX in
AFA fA
Fh h
Weakly Initial Algebra∀A, ∃ h
Algebras and Coalgebras
AFA fA FBBgB
Algebra Coalgebra
![Page 29: Algebra and Coalgebra in the Light Affine Lambda Calculus · Turing Machines Lambda Calculus PTIME NPTIME PSPACE LOGSPACE BPP LALC INTML STA DLAL RSLR Computability Complexity Implicit](https://reader034.vdocuments.net/reader034/viewer/2022050123/5f53297e82234652116ddf72/html5/thumbnails/29.jpg)
μX.FXFμX.FX in
AFA fA
Fh h
Weakly Initial Algebra∀A, ∃ h
FBBgB
νX.FXout
h Fh
Weakly Final Coalgebra∀B, ∃h
FνX.FX
Algebras and Coalgebras
AFA fA FBBgB
Algebra Coalgebra
![Page 30: Algebra and Coalgebra in the Light Affine Lambda Calculus · Turing Machines Lambda Calculus PTIME NPTIME PSPACE LOGSPACE BPP LALC INTML STA DLAL RSLR Computability Complexity Implicit](https://reader034.vdocuments.net/reader034/viewer/2022050123/5f53297e82234652116ddf72/html5/thumbnails/30.jpg)
F(-) = 1+ (-)
F(-) = 1+ A × (-)
F(-) = 1+ A × (-) × (-)
Initial Algebra Final Coalgebra
N N ∪ {∞}
A* A∞
T*(A) T∞(A)
Examples
![Page 31: Algebra and Coalgebra in the Light Affine Lambda Calculus · Turing Machines Lambda Calculus PTIME NPTIME PSPACE LOGSPACE BPP LALC INTML STA DLAL RSLR Computability Complexity Implicit](https://reader034.vdocuments.net/reader034/viewer/2022050123/5f53297e82234652116ddf72/html5/thumbnails/31.jpg)
(co)algebras in System F
Theorem [Reynolds, Plotkin, Geuvers, …]:Given F expressible in the polymorphic lambda calculus:
- there exists a weakly initial F-Algebra
- there exists a weakly final F-Coalgebra
![Page 32: Algebra and Coalgebra in the Light Affine Lambda Calculus · Turing Machines Lambda Calculus PTIME NPTIME PSPACE LOGSPACE BPP LALC INTML STA DLAL RSLR Computability Complexity Implicit](https://reader034.vdocuments.net/reader034/viewer/2022050123/5f53297e82234652116ddf72/html5/thumbnails/32.jpg)
(co)algebras in System F
Theorem [Reynolds, Plotkin, Geuvers, …]:Given F expressible in the polymorphic lambda calculus:
- there exists a weakly initial F-Algebra
- there exists a weakly final F-Coalgebra
Wraith-Wadler encoding:
μa.Fa = ∀a.(Fa → a) → a
𝛎a.Fa = ∃a.(a → Fa) * a
![Page 33: Algebra and Coalgebra in the Light Affine Lambda Calculus · Turing Machines Lambda Calculus PTIME NPTIME PSPACE LOGSPACE BPP LALC INTML STA DLAL RSLR Computability Complexity Implicit](https://reader034.vdocuments.net/reader034/viewer/2022050123/5f53297e82234652116ddf72/html5/thumbnails/33.jpg)
(co)algebras in System F
Theorem [Reynolds, Plotkin, Geuvers, …]:Given F expressible in the polymorphic lambda calculus:
- there exists a weakly initial F-Algebra
- there exists a weakly final F-Coalgebra
Wraith-Wadler encoding:
μa.Fa = ∀a.(Fa → a) → a
𝛎a.Fa = ∃a.(a → Fa) * a
F-algebra!
![Page 34: Algebra and Coalgebra in the Light Affine Lambda Calculus · Turing Machines Lambda Calculus PTIME NPTIME PSPACE LOGSPACE BPP LALC INTML STA DLAL RSLR Computability Complexity Implicit](https://reader034.vdocuments.net/reader034/viewer/2022050123/5f53297e82234652116ddf72/html5/thumbnails/34.jpg)
(co)algebras in System F
Theorem [Reynolds, Plotkin, Geuvers, …]:Given F expressible in the polymorphic lambda calculus:
- there exists a weakly initial F-Algebra
- there exists a weakly final F-Coalgebra
Wraith-Wadler encoding:
μa.Fa = ∀a.(Fa → a) → a
𝛎a.Fa = ∃a.(a → Fa) * a
F-algebra!
F-coalgebra!
![Page 35: Algebra and Coalgebra in the Light Affine Lambda Calculus · Turing Machines Lambda Calculus PTIME NPTIME PSPACE LOGSPACE BPP LALC INTML STA DLAL RSLR Computability Complexity Implicit](https://reader034.vdocuments.net/reader034/viewer/2022050123/5f53297e82234652116ddf72/html5/thumbnails/35.jpg)
Wraith-Wadler encodingμa.FaF(μa.Fa) in
BFB f
F (fold f) fold f
in : F(μa.Fa) → μa.Fain = λs.λk.k (F (fold k) s)
fold : ∀b. (Fb → b) → μa.Fa → bfold = λf.λt. t f
μa.Fa = ∀a.(Fa→a)→a
![Page 36: Algebra and Coalgebra in the Light Affine Lambda Calculus · Turing Machines Lambda Calculus PTIME NPTIME PSPACE LOGSPACE BPP LALC INTML STA DLAL RSLR Computability Complexity Implicit](https://reader034.vdocuments.net/reader034/viewer/2022050123/5f53297e82234652116ddf72/html5/thumbnails/36.jpg)
in : F(μa.Fa) → μa.Fain = λs.λk. k (F (fold k) s)
fold : ∀b. (Fb → b) → μa.Fa → bfold = λf.λt. t f
μa.Fa =∀a. (Fa → a) → a
⊸
Wraith-Wadler encoding in LALC
![Page 37: Algebra and Coalgebra in the Light Affine Lambda Calculus · Turing Machines Lambda Calculus PTIME NPTIME PSPACE LOGSPACE BPP LALC INTML STA DLAL RSLR Computability Complexity Implicit](https://reader034.vdocuments.net/reader034/viewer/2022050123/5f53297e82234652116ddf72/html5/thumbnails/37.jpg)
in : F(μa.Fa) → μa.Fain = λs.λk. k (F (fold k) s)
fold : ∀b. (Fb → b) → μa.Fa → bfold = λf.λt. t f
μa.Fa =∀a. (Fa → a) → a
⊸
k need to beduplicated!
Wraith-Wadler encoding in LALC
![Page 38: Algebra and Coalgebra in the Light Affine Lambda Calculus · Turing Machines Lambda Calculus PTIME NPTIME PSPACE LOGSPACE BPP LALC INTML STA DLAL RSLR Computability Complexity Implicit](https://reader034.vdocuments.net/reader034/viewer/2022050123/5f53297e82234652116ddf72/html5/thumbnails/38.jpg)
in : F(μa.Fa) μa.Fain = λs.λk.§k (F (fold !k) s)
fold : ∀b.!(Fb b) μa.Fa §bfold = λf.λt. t !f
μa.Fa =∀a.!(Fa a) §a
⊸
Let’s change the type!
Wraith-Wadler encoding in LALC
⊸
⊸ ⊸
⊸ ⊸ ⊸
![Page 39: Algebra and Coalgebra in the Light Affine Lambda Calculus · Turing Machines Lambda Calculus PTIME NPTIME PSPACE LOGSPACE BPP LALC INTML STA DLAL RSLR Computability Complexity Implicit](https://reader034.vdocuments.net/reader034/viewer/2022050123/5f53297e82234652116ddf72/html5/thumbnails/39.jpg)
μa.FaF(μa.Fa) in
§BF§B???
F (fold !f) fold !f
⊸
in : F(μa.Fa) μa.Fa
fold : ∀b.!(Fb b) μa.Fa §b
⊸⊸ ⊸ ⊸
Wraith-Wadler encoding in LALC
![Page 40: Algebra and Coalgebra in the Light Affine Lambda Calculus · Turing Machines Lambda Calculus PTIME NPTIME PSPACE LOGSPACE BPP LALC INTML STA DLAL RSLR Computability Complexity Implicit](https://reader034.vdocuments.net/reader034/viewer/2022050123/5f53297e82234652116ddf72/html5/thumbnails/40.jpg)
μa.FaF(μa.Fa) in
§BF§B§f
F (fold !f) fold !f
⊸
in : F(μa.Fa) μa.FaLF : ∀b. F§b §Fb fold : ∀b.!(Fb b) μa.Fa §b
⊸⊸ ⊸ ⊸
§FBLF
⊸
Weakly-Initial algebra under §
![Page 41: Algebra and Coalgebra in the Light Affine Lambda Calculus · Turing Machines Lambda Calculus PTIME NPTIME PSPACE LOGSPACE BPP LALC INTML STA DLAL RSLR Computability Complexity Implicit](https://reader034.vdocuments.net/reader034/viewer/2022050123/5f53297e82234652116ddf72/html5/thumbnails/41.jpg)
μa.FaF(μa.Fa) in
§BF§B§f
F (fold !f) fold !f
⊸
in : F(μa.Fa) μa.FaLF : ∀b. F§b §Fb fold : ∀b.!(Fb b) μa.Fa §b
⊸⊸ ⊸ ⊸
§FBLF
⊸
Weakly-Initial algebra under §
Left distributivity
![Page 42: Algebra and Coalgebra in the Light Affine Lambda Calculus · Turing Machines Lambda Calculus PTIME NPTIME PSPACE LOGSPACE BPP LALC INTML STA DLAL RSLR Computability Complexity Implicit](https://reader034.vdocuments.net/reader034/viewer/2022050123/5f53297e82234652116ddf72/html5/thumbnails/42.jpg)
out : 𝛎a.Fa F(𝛎a.Fa)RF : ∀b. §Fb F§bunfold:∀b.!(b Fb) §b 𝛎a.Fa
F(𝛎a.Fa)𝛎a.Fa out
F§B§B§f
unfold !f F(unfold !f)
⊸
§FBRF
𝛎a.Fa = ∃a.!(a Fa)⨂§a
⊸ ⊸⊸
⊸ ⊸⊸
Weakly-Final coalgebra under §
![Page 43: Algebra and Coalgebra in the Light Affine Lambda Calculus · Turing Machines Lambda Calculus PTIME NPTIME PSPACE LOGSPACE BPP LALC INTML STA DLAL RSLR Computability Complexity Implicit](https://reader034.vdocuments.net/reader034/viewer/2022050123/5f53297e82234652116ddf72/html5/thumbnails/43.jpg)
out : 𝛎a.Fa F(𝛎a.Fa)RF : ∀b. §Fb F§bunfold:∀b.!(b Fb) §b 𝛎a.Fa
F(𝛎a.Fa)𝛎a.Fa out
F§B§B§f
unfold !f F(unfold !f)
⊸
§FBRF
𝛎a.Fa = ∃a.!(a Fa)⨂§a
⊸ ⊸⊸
⊸ ⊸⊸
Weakly-Final coalgebra under §
Right distributivity
![Page 44: Algebra and Coalgebra in the Light Affine Lambda Calculus · Turing Machines Lambda Calculus PTIME NPTIME PSPACE LOGSPACE BPP LALC INTML STA DLAL RSLR Computability Complexity Implicit](https://reader034.vdocuments.net/reader034/viewer/2022050123/5f53297e82234652116ddf72/html5/thumbnails/44.jpg)
Expressivity?
F(-) = 1 ⊕ -
F(-) = 1 ⊕ A ⨂ -
F(-) = 1 ⊕ A ⨂ - ⨂ -
• Which Functor satisfies LF:∀b. F§b §Fb ?⊸
![Page 45: Algebra and Coalgebra in the Light Affine Lambda Calculus · Turing Machines Lambda Calculus PTIME NPTIME PSPACE LOGSPACE BPP LALC INTML STA DLAL RSLR Computability Complexity Implicit](https://reader034.vdocuments.net/reader034/viewer/2022050123/5f53297e82234652116ddf72/html5/thumbnails/45.jpg)
Expressivity?
F(-) = 1 ⊕ -
F(-) = 1 ⊕ A ⨂ -
F(-) = 1 ⊕ A ⨂ - ⨂ -
• Which Functor satisfies LF:∀b. F§b §Fb ?
✔
✔
✔
provided ⊢A §A⊸
⊸
![Page 46: Algebra and Coalgebra in the Light Affine Lambda Calculus · Turing Machines Lambda Calculus PTIME NPTIME PSPACE LOGSPACE BPP LALC INTML STA DLAL RSLR Computability Complexity Implicit](https://reader034.vdocuments.net/reader034/viewer/2022050123/5f53297e82234652116ddf72/html5/thumbnails/46.jpg)
Expressivity?
F(-) = 1 ⊕ -
F(-) = 1 ⊕ A ⨂ -
F(-) = 1 ⊕ A ⨂ - ⨂ -
• Which Functor satisfies RF: ∀b. §Fb F§b⊸
![Page 47: Algebra and Coalgebra in the Light Affine Lambda Calculus · Turing Machines Lambda Calculus PTIME NPTIME PSPACE LOGSPACE BPP LALC INTML STA DLAL RSLR Computability Complexity Implicit](https://reader034.vdocuments.net/reader034/viewer/2022050123/5f53297e82234652116ddf72/html5/thumbnails/47.jpg)
Expressivity?
F(-) = 1 ⊕ -
F(-) = 1 ⊕ A ⨂ -
F(-) = 1 ⊕ A ⨂ - ⨂ -
• Which Functor satisfies RF: ∀b. §Fb F§b
✗
✗
✗
⊸
![Page 48: Algebra and Coalgebra in the Light Affine Lambda Calculus · Turing Machines Lambda Calculus PTIME NPTIME PSPACE LOGSPACE BPP LALC INTML STA DLAL RSLR Computability Complexity Implicit](https://reader034.vdocuments.net/reader034/viewer/2022050123/5f53297e82234652116ddf72/html5/thumbnails/48.jpg)
Where is the problem?
The modality § does not commute with the other type constructions!
![Page 49: Algebra and Coalgebra in the Light Affine Lambda Calculus · Turing Machines Lambda Calculus PTIME NPTIME PSPACE LOGSPACE BPP LALC INTML STA DLAL RSLR Computability Complexity Implicit](https://reader034.vdocuments.net/reader034/viewer/2022050123/5f53297e82234652116ddf72/html5/thumbnails/49.jpg)
Where is the problem?
The modality § does not commute with the other type constructions!
Solution: make § to commute
![Page 50: Algebra and Coalgebra in the Light Affine Lambda Calculus · Turing Machines Lambda Calculus PTIME NPTIME PSPACE LOGSPACE BPP LALC INTML STA DLAL RSLR Computability Complexity Implicit](https://reader034.vdocuments.net/reader034/viewer/2022050123/5f53297e82234652116ddf72/html5/thumbnails/50.jpg)
We can add to LALC the following terms:
dist⊕ : §(A ⊕ B) §A ⊕ §B
dist⨂ : §(A ⨂ B) §A ⨂ §B
⊸⊸
dist⊕ §(inj t) → inj §t
dist⨂ §(<t1,t2>) → <§t1,§t2>
Adding terms for distributivity
![Page 51: Algebra and Coalgebra in the Light Affine Lambda Calculus · Turing Machines Lambda Calculus PTIME NPTIME PSPACE LOGSPACE BPP LALC INTML STA DLAL RSLR Computability Complexity Implicit](https://reader034.vdocuments.net/reader034/viewer/2022050123/5f53297e82234652116ddf72/html5/thumbnails/51.jpg)
We can add to LALC the following terms:
dist⊕ : §(A ⊕ B) §A ⊕ §B
dist⨂ : §(A ⨂ B) §A ⨂ §B
⊸⊸
dist⊕ §(inj t) → inj §t
dist⨂ §(<t1,t2>) → <§t1,§t2>
They require the evaluation of terms inside a §Problem: this breaks polynomial time soundness.
Adding terms for distributivity
![Page 52: Algebra and Coalgebra in the Light Affine Lambda Calculus · Turing Machines Lambda Calculus PTIME NPTIME PSPACE LOGSPACE BPP LALC INTML STA DLAL RSLR Computability Complexity Implicit](https://reader034.vdocuments.net/reader034/viewer/2022050123/5f53297e82234652116ddf72/html5/thumbnails/52.jpg)
We can add to LALC the following terms:
dist⊕ : §(A ⊕ B) §A ⊕ §B
dist⨂ : §(A ⨂ B) §A ⨂ §B
⊸⊸
dist⊕ §(inj t) → inj §t
dist⨂ §(<t1,t2>) → <§t1,§t2>
They require the evaluation of terms inside a §Problem: this breaks polynomial time soundness.
Adding terms for distributivity
New (quite complex) proof in the paper!
![Page 53: Algebra and Coalgebra in the Light Affine Lambda Calculus · Turing Machines Lambda Calculus PTIME NPTIME PSPACE LOGSPACE BPP LALC INTML STA DLAL RSLR Computability Complexity Implicit](https://reader034.vdocuments.net/reader034/viewer/2022050123/5f53297e82234652116ddf72/html5/thumbnails/53.jpg)
Expressivity?
F(-) = 1 ⊕ -
F(-) = 1 ⊕ A ⨂ -
F(-) = 1 ⊕ A ⨂ - ⨂ -
• Which Functor satisfies RF?
![Page 54: Algebra and Coalgebra in the Light Affine Lambda Calculus · Turing Machines Lambda Calculus PTIME NPTIME PSPACE LOGSPACE BPP LALC INTML STA DLAL RSLR Computability Complexity Implicit](https://reader034.vdocuments.net/reader034/viewer/2022050123/5f53297e82234652116ddf72/html5/thumbnails/54.jpg)
Expressivity?
F(-) = 1 ⊕ -
F(-) = 1 ⊕ A ⨂ -
F(-) = 1 ⊕ A ⨂ - ⨂ -
• Which Functor satisfies RF?
✔
✔
✔
provided ⊢§A A⊸
![Page 55: Algebra and Coalgebra in the Light Affine Lambda Calculus · Turing Machines Lambda Calculus PTIME NPTIME PSPACE LOGSPACE BPP LALC INTML STA DLAL RSLR Computability Complexity Implicit](https://reader034.vdocuments.net/reader034/viewer/2022050123/5f53297e82234652116ddf72/html5/thumbnails/55.jpg)
Expressivity?
F(-) = 1 ⊕ -
F(-) = 1 ⊕ A ⨂ -
F(-) = 1 ⊕ A ⨂ - ⨂ -
• Which Functor satisfies RF?
✔
✔
✔
provided ⊢§A A⊸
We can have streams and trees at every finite type
![Page 56: Algebra and Coalgebra in the Light Affine Lambda Calculus · Turing Machines Lambda Calculus PTIME NPTIME PSPACE LOGSPACE BPP LALC INTML STA DLAL RSLR Computability Complexity Implicit](https://reader034.vdocuments.net/reader034/viewer/2022050123/5f53297e82234652116ddf72/html5/thumbnails/56.jpg)
Take out?
• Algebras and Coalgebras encodings make sense also for polynomial time languages,
• Due to the restrictive nature of languages for implicit complexity their definitions can be a bit more tricky,
• The expressivity may still depend on the restrictions of the language.