Towards refined notions of computation: the global state example
Danel Ahman LFCS, University of Edinburgh 20 December 2012 joint work with Gordon Plotkin and Alex Simpson
Towards refined notions of computation: the global state example - - PowerPoint PPT Presentation
Towards refined notions of computation: the global state example Danel Ahman LFCS, University of Edinburgh 20 December 2012 joint work with Gordon Plotkin and Alex Simpson Overview Moggis monadic approach to computational effects
Danel Ahman LFCS, University of Edinburgh 20 December 2012 joint work with Gordon Plotkin and Alex Simpson
and the computational effects they identify
and adding more detailed specifications
as the exponential σ ⇒ τ
→ σ
→ C to model computational effects
as the Kleisli exponential σ ⇒ Tτ
→ Tσ
as the exponential σ ⇒ τ
→ σ
→ C to model computational effects
as the Kleisli exponential σ ⇒ Tτ
→ Tσ
→ S × Y )
m∈(n/I) (Sm × Xm))Sn
how to construct such effects
effects (e.g., state) are implemented in programming languages
J : ℵop
1 −
→ L
sets)
as a set of n-ary operations in the theory
→ I
→ 1)
countable products
→ C
→ C
→ Mod(L, C)
→ I a morphism X O − → X I
= M(
1) ∼ =
(M1) ∼ = (M1)O
countable products
→ C
→ C
→ Mod(L, C)
→ I a morphism X O − → X I
= M(
1) ∼ =
(M1) ∼ = (M1)O
determined by the following countable Lawvere theory
→ Loc
→ Loc × V
subject to commuting diagrams expressed set-theoretically
1 lookuploc(updateloc,v(x))v = x 2 lookuploc(lookuploc(xvv′)v)v′ = lookuploc(xvv)v 3 updateloc,v(updateloc,v′(x)) = updateloc,v′(x) 4 updateloc,v(readloc(x′ v)′ v) = updateloc,v(xv) 5 updateloc,v(updateloc′,v′(x)) =
updateloc′,v′(updateloc,v(x)) (loc = loc′)
6 ...
determined by the following countable Lawvere theory
→ Loc
→ Loc × V
subject to commuting diagrams expressed set-theoretically
1 lookuploc(updateloc,v(x))v = x 2 lookuploc(lookuploc(xvv′)v)v′ = lookuploc(xvv)v 3 updateloc,v(updateloc,v′(x)) = updateloc,v′(x) 4 updateloc,v(readloc(x′ v)′ v) = updateloc,v(xv) 5 updateloc,v(updateloc′,v′(x)) =
updateloc′,v′(updateloc,v(x)) (loc = loc′)
6 ...
determined by the following countable Lawvere theory
→ Loc
→ Loc × V
subject to commuting diagrams expressed set-theoretically
1 lookuploc(updateloc,v(x))v = x 2 lookuploc(lookuploc(xvv′)v)v′ = lookuploc(xvv)v 3 updateloc,v(updateloc,v′(x)) = updateloc,v′(x) 4 updateloc,v(readloc(x′ v)′ v) = updateloc,v(xv) 5 updateloc,v(updateloc′,v′(x)) =
updateloc′,v′(updateloc,v(x)) (loc = loc′)
6 ...
determined by the following countable Lawvere theory
→ Loc
→ Loc × V
subject to commuting diagrams expressed set-theoretically
1 lookuploc(updateloc,v(x))v = x 2 lookuploc(lookuploc(xvv′)v)v′ = lookuploc(xvv)v 3 updateloc,v(updateloc,v′(x)) = updateloc,v′(x) 4 updateloc,v(readloc(x′ v)′ v) = updateloc,v(xv) 5 updateloc,v(updateloc′,v′(x)) =
updateloc′,v′(updateloc,v(x)) (loc = loc′)
6 ...
determined by the following countable Lawvere theory
→ Loc
→ Loc × V
subject to commuting diagrams expressed set-theoretically
1 lookuploc(updateloc,v(x))v = x 2 lookuploc(lookuploc(xvv′)v)v′ = lookuploc(xvv)v 3 updateloc,v(updateloc,v′(x)) = updateloc,v′(x) 4 updateloc,v(readloc(x′ v)′ v) = updateloc,v(xv) 5 updateloc,v(updateloc′,v′(x)) =
updateloc′,v′(updateloc,v(x)) (loc = loc′)
6 ...
m∈(n/Inj) (Sm × Xm))Sn
Vn = V , Sn = V n
→ X Loc
→ X Loc×V
→ X V
comodels) and Staton (completeness via nominal sets)
m∈(n/Inj) (Sm × Xm))Sn
Vn = V , Sn = V n
→ X Loc
→ X Loc×V
→ X V
comodels) and Staton (completeness via nominal sets)
m∈(n/Inj) (Sm × Xm))Sn
Vn = V , Sn = V n
→ X Loc
→ X Loc×V
→ X V
comodels) and Staton (completeness via nominal sets)
m∈(n/Inj) (Sm × Xm))Sn
Vn = V , Sn = V n
→ X Loc
→ X Loc×V
→ X V
comodels) and Staton (completeness via nominal sets)
Γ ⊢ σ : Ref (σ) Γ ⊢ φ : Ref (σ) Γ, x : φ ⊢ P : wf Γ ⊢ (x : φ)P : Ref (σ) Γ ⊢ φ : Ref (σ1) Γ, x : φ ⊢ ψ : Ref (σ2) Γ ⊢ Σx:φψ : Ref (σ1 × σ2) Γ ⊢ φ : Ref (σ) Γ, x : φ ⊢ ψ : Ref (τ) Γ ⊢ Πx:φψ : Ref (σ → τ)
Γ ⊢ t : φ Γ ⊢ P[t/x] Γ ⊢ t : (x : φ)P Γ, x : φ ⊢ t : ψ Γ ⊢ λx : φ.t : Πx:φψ Γ ⊢ t1 : Πx:φψ Γ ⊢ t2 : φ Γ ⊢ t1t2 : ψ[t2/x]
Γ ⊢ σ : Ref (σ) Γ ⊢ φ : Ref (σ) Γ, x : φ ⊢ P : wf Γ ⊢ (x : φ)P : Ref (σ) Γ ⊢ φ : Ref (σ1) Γ, x : φ ⊢ ψ : Ref (σ2) Γ ⊢ Σx:φψ : Ref (σ1 × σ2) Γ ⊢ φ : Ref (σ) Γ, x : φ ⊢ ψ : Ref (τ) Γ ⊢ Πx:φψ : Ref (σ → τ)
Γ ⊢ t : φ Γ ⊢ P[t/x] Γ ⊢ t : (x : φ)P Γ, x : φ ⊢ t : ψ Γ ⊢ λx : φ.t : Πx:φψ Γ ⊢ t1 : Πx:φψ Γ ⊢ t2 : φ Γ ⊢ t1t2 : ψ[t2/x]
as a family of PERs Γ − → PER(σ)
straightforwardly
→ P(σ) (subsets denoting the ’total realizers’)
P
cod
as a family of PERs Γ − → PER(σ)
straightforwardly
→ P(σ) (subsets denoting the ’total realizers’)
P
cod
Closed(Loc) = ¬Open(loc) on the locations Loc
locations that are open
→ X Open(Loc)
→ X Open(Loc)×V
collection of open locations
Closed(Loc) = ¬Open(loc) on the locations Loc
locations that are open
→ X Open(Loc)
→ X Open(Loc)×V
collection of open locations
Closed(Loc) = ¬Open(loc) on the locations Loc
locations that are open
→ X Open(Loc)
→ X Open(Loc)×V
collection of open locations
locations
→ X Open(Loc)
→ X Open(Loc)×V
→ X Closed(Loc)
→ X Open(Loc)
computations able to use different locations
non-discrete world category and the corresponding (monoidal) closed structure should be
locations
→ X Open(Loc)
→ X Open(Loc)×V
→ X Closed(Loc)
→ X Open(Loc)
computations able to use different locations
non-discrete world category and the corresponding (monoidal) closed structure should be
locations
→ X Open(Loc)
→ X Open(Loc)×V
→ X Closed(Loc)
→ X Open(Loc)
computations able to use different locations
non-discrete world category and the corresponding (monoidal) closed structure should be
locations
→ X Open(Loc)
→ X Open(Loc)×V
→ X Closed(Loc)
→ X Open(Loc)
computations able to use different locations
non-discrete world category and the corresponding (monoidal) closed structure should be
J : W ∗ − → L
→ Set
→ SetW again has a left adjoint F inducing a monad T = UF
J : W ∗ − → L
→ Set
→ SetW again has a left adjoint F inducing a monad T = UF
J : W ∗ − → L
→ Set
→ SetW again has a left adjoint F inducing a monad T = UF
J : W ∗ − → L
→ Set
→ SetW again has a left adjoint F inducing a monad T = UF
→ w
→ w
→ w[loc → ⊥]
→ w[loc → ⊤]
→ Xw
→ Xw
→ Xw[loc→⊥]
→ Xw[loc→⊤]
→ w
→ w
→ w[loc → ⊥]
→ w[loc → ⊤]
→ Xw
→ Xw
→ Xw[loc→⊥]
→ Xw[loc→⊤]
→ Xw
→ Xw
→ Xw[loc→⊥]
→ Xw[loc→⊤]
w′∈W (Sw′ × Xw′))Sw
→ UFX of the adjunction given by:
ηx,w γ = λs . injw (s , γ)
→ A of the adjunction:
εA,w = ((S × Aw ′))S
((S×− − → close))S
− → ((S × Aw ⊤))S
∼ =
− → (S × Aw ⊤)S
(− − → write)S
− → (Aw ⊤)S
− − → read
− → Aw ⊤
− − →
− → Aw
→ Xw
→ Xw
→ Xw[loc→⊥]
→ Xw[loc→⊤]
w′∈W (Sw′ × Xw′))Sw
→ UFX of the adjunction given by:
ηx,w γ = λs . injw (s , γ)
→ A of the adjunction:
εA,w = ((S × Aw ′))S
((S×− − → close))S
− → ((S × Aw ⊤))S
∼ =
− → (S × Aw ⊤)S
(− − → write)S
− → (Aw ⊤)S
− − → read
− → Aw ⊤
− − →
− → Aw
→ Xw
→ Xw
→ Xw[loc→⊥]
→ Xw[loc→⊤]
w′∈W (Sw′ × Xw′))Sw
→ UFX of the adjunction given by:
ηx,w γ = λs . injw (s , γ)
→ A of the adjunction:
εA,w = ((S × Aw ′))S
((S×− − → close))S
− → ((S × Aw ⊤))S
∼ =
− → (S × Aw ⊤)S
(− − → write)S
− → (Aw ⊤)S
− − → read
− → Aw ⊤
− − →
− → Aw
logging off from some system
→ false
→ true
→ true
→ Xfalse
→ Xtrue
→ Xtrue
in the algebra
Xδo(w,o) − →
Xδi(w,i)
and in the theory
{δo(w, o)} − →
{δi(w, i)}
lookup[li→⊥] :
{[li → ⊥]} − → 0
in the algebra
Xδo(w,o) − →
Xδi(w,i)
and in the theory
{δo(w, o)} − →
{δi(w, i)}
lookup[li→⊥] :
{[li → ⊥]} − → 0
in the algebra
Xδo(w,o) − →
Xδi(w,i)
and in the theory
{δo(w, o)} − →
{δi(w, i)}
lookup[li→⊥] :
{[li → ⊥]} − → 0