256
DIRECTED GEOMETRIC MODELS OF CONCURRENT PROGRAMS Samuel Mimram École Polytechnique Applied and Computational Algebraic Topology Spring School April 24th, 2017

DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS · 2017. 4. 23. · DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS SamuelMimram ÉcolePolytechnique AppliedandComputationalAlgebraicTopology

  • Upload
    others

  • View
    2

  • Download
    0

Embed Size (px)

Citation preview

Page 1: DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS · 2017. 4. 23. · DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS SamuelMimram ÉcolePolytechnique AppliedandComputationalAlgebraicTopology

DIRECTEDGEOMETRICMODELS OFCONCURRENTPROGRAMS

Samuel MimramÉcole Polytechnique

Applied and Computational Algebraic Topology

Spring School

April 24th, 2017

Page 2: DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS · 2017. 4. 23. · DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS SamuelMimram ÉcolePolytechnique AppliedandComputationalAlgebraicTopology

Models of concurrent programs

▶ We are interested in concurrent programs:

multiple threads in parallel.

▶ We want to model their state space:

describe all possible executions.

▶ We advocate here that geometric models can be useful:

we can (hope to) use geometric tools.

▶ A typical application is to verification of programs:

guarantee that a program will never divide by 0,

and other problems more specific to concurrency.

2 / 117

Page 3: DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS · 2017. 4. 23. · DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS SamuelMimram ÉcolePolytechnique AppliedandComputationalAlgebraicTopology

Models of concurrent programs

▶ We are interested in concurrent programs:

multiple threads in parallel.

▶ We want to model their state space:

describe all possible executions.

▶ We advocate here that geometric models can be useful:

we can (hope to) use geometric tools.

▶ A typical application is to verification of programs:

guarantee that a program will never divide by 0,

and other problems more specific to concurrency.

2 / 117

Page 4: DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS · 2017. 4. 23. · DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS SamuelMimram ÉcolePolytechnique AppliedandComputationalAlgebraicTopology

Models of concurrent programs

▶ We are interested in concurrent programs:

multiple threads in parallel.

▶ We want to model their state space:

describe all possible executions.

▶ We advocate here that geometric models can be useful:

we can (hope to) use geometric tools.

▶ A typical application is to verification of programs:

guarantee that a program will never divide by 0,

and other problems more specific to concurrency.

2 / 117

Page 5: DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS · 2017. 4. 23. · DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS SamuelMimram ÉcolePolytechnique AppliedandComputationalAlgebraicTopology

Models of concurrent programs

▶ We are interested in concurrent programs:

multiple threads in parallel.

▶ We want to model their state space:

describe all possible executions.

▶ We advocate here that geometric models can be useful:

we can (hope to) use geometric tools.

▶ A typical application is to verification of programs:

guarantee that a program will never divide by 0,

and other problems more specific to concurrency.

2 / 117

Page 6: DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS · 2017. 4. 23. · DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS SamuelMimram ÉcolePolytechnique AppliedandComputationalAlgebraicTopology

Geometric models

Pa Pb Vb Va

Pb

Pa

Va

Vb

Pb

Pa

Va

Vb

Pb

Pa

Va

Vb

Pa

Pa

Pb

Pb

Vb

Vb

Va

Va

∼ ∼

∼ ∼

Geometric models are interesting:▶ they range from algebraic to topological flavors▶ they provide useful visualizations of the state space▶ we can use geometric invariants and constructions▶ it raises new questions in geometry

3 / 117

Page 7: DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS · 2017. 4. 23. · DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS SamuelMimram ÉcolePolytechnique AppliedandComputationalAlgebraicTopology

Directed geometryLet’s consider a typical example.

For a connected space X, one considers the fundamental group

π1(X, x0)

More generally, one considers the fundamental groupoid

Π1(X)

For directed space, we have a fundamental category

Π1(X)

Other invariants have to be generalized similarly, which is notalways obvious (e.g. no weak equivalences / model categories,etc.)

4 / 117

Page 8: DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS · 2017. 4. 23. · DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS SamuelMimram ÉcolePolytechnique AppliedandComputationalAlgebraicTopology

Directed geometryLet’s consider a typical example.

For a connected space X, one considers the fundamental group

π1(X, x0)

More generally, one considers the fundamental groupoid

Π1(X)

For directed space, we have a fundamental category

Π1(X)

Other invariants have to be generalized similarly, which is notalways obvious (e.g. no weak equivalences / model categories,etc.)

4 / 117

Page 9: DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS · 2017. 4. 23. · DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS SamuelMimram ÉcolePolytechnique AppliedandComputationalAlgebraicTopology

Directed geometryLet’s consider a typical example.

For a connected space X, one considers the fundamental group

π1(X, x0)

More generally, one considers the fundamental groupoid

Π1(X)

For directed space, we have a fundamental category

Π1(X)

Other invariants have to be generalized similarly, which is notalways obvious (e.g. no weak equivalences / model categories,etc.)

4 / 117

Page 10: DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS · 2017. 4. 23. · DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS SamuelMimram ÉcolePolytechnique AppliedandComputationalAlgebraicTopology

Directed geometryLet’s consider a typical example.

For a connected space X, one considers the fundamental group

π1(X, x0)

More generally, one considers the fundamental groupoid

Π1(X)

For directed space, we have a fundamental category

Π1(X)

Other invariants have to be generalized similarly, which is notalways obvious (e.g. no weak equivalences / model categories,etc.)

4 / 117

Page 11: DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS · 2017. 4. 23. · DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS SamuelMimram ÉcolePolytechnique AppliedandComputationalAlgebraicTopology

This talk

Here

▶ we focus on (simple) geometric aspects:more involved developments will follow in Raussen’s talk

▶ verification is only really used here as a motivation

5 / 117

Page 12: DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS · 2017. 4. 23. · DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS SamuelMimram ÉcolePolytechnique AppliedandComputationalAlgebraicTopology

VERIFYINGSEQUENTIALPROGRAMS

6 / 117

Page 13: DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS · 2017. 4. 23. · DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS SamuelMimram ÉcolePolytechnique AppliedandComputationalAlgebraicTopology

Control flow graphs

When studying sequential programs, people often already use ageometric description: control flow graphs.

7 / 117

Page 14: DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS · 2017. 4. 23. · DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS SamuelMimram ÉcolePolytechnique AppliedandComputationalAlgebraicTopology

Control flow graphs

x := 5;while x != 1 do (

if x mod 2 != 0 then(x := 3*x; x := x+1)

elsex := x/2

);print "Reached 1!"

s x := 5 x != 1 x mod 2 != 0

¬(x mod 2 != 0)

x := 3*xx := x+1

x := x/2¬(x != 1)

print "Reached 1!"t

8 / 117

Page 15: DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS · 2017. 4. 23. · DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS SamuelMimram ÉcolePolytechnique AppliedandComputationalAlgebraicTopology

Control flow graphs

x := 5;while x != 1 do (

if x mod 2 != 0 then(x := 3*x; x := x+1)

elsex := x/2

);print "Reached 1!"

s x := 5 x != 1 x mod 2 != 0

¬(x mod 2 != 0)

x := 3*xx := x+1

x := x/2¬(x != 1)

print "Reached 1!"t

8 / 117

Page 16: DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS · 2017. 4. 23. · DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS SamuelMimram ÉcolePolytechnique AppliedandComputationalAlgebraicTopology

A toy languageConsider a language consisting of▶ arithmetic expressions:

a ::= x | n | a + a | a * a

▶ boolean expressions:

b ::= true | false | a < a | b and b | ¬b

▶ actions:A ::= x := a | print a

▶ commands / programs:

c ::= A |c; c | if b then c else c | while b do c

9 / 117

Page 17: DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS · 2017. 4. 23. · DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS SamuelMimram ÉcolePolytechnique AppliedandComputationalAlgebraicTopology

A toy languageConsider a language consisting of▶ arithmetic expressions:

a ::= x | n | a + a | a * a

▶ boolean expressions:

b ::= true | false | a < a | b and b | ¬b

▶ actions:A ::= x := a | print a

▶ commands / programs:

c ::= A |c; c | if b then c else c | while b do c

9 / 117

Page 18: DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS · 2017. 4. 23. · DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS SamuelMimram ÉcolePolytechnique AppliedandComputationalAlgebraicTopology

A toy languageConsider a language consisting of▶ arithmetic expressions:

a ::= x | n | a + a | a * a

▶ boolean expressions:

b ::= true | false | a < a | b and b | ¬b

▶ actions:A ::= x := a | print a

▶ commands / programs:

c ::= A |c; c | if b then c else c | while b do c

9 / 117

Page 19: DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS · 2017. 4. 23. · DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS SamuelMimram ÉcolePolytechnique AppliedandComputationalAlgebraicTopology

A toy languageConsider a language consisting of▶ arithmetic expressions:

a ::= x | n | a + a | a * a

▶ boolean expressions:

b ::= true | false | a < a | b and b | ¬b

▶ actions:A ::= x := a | print a

▶ commands / programs:

c ::= A |c; c | if b then c else c | while b do c

9 / 117

Page 20: DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS · 2017. 4. 23. · DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS SamuelMimram ÉcolePolytechnique AppliedandComputationalAlgebraicTopology

Graphs

A graph G consists of▶ a set G0 of vertices▶ a set G1 of edges▶ source and target maps ∂−, ∂+ : G1 → G0

For control flow graphs, we moreover have▶ distinguished beginning and end vertices: s, t ∈ G0

▶ a labeling:ℓ : G1 → A⊔ B

into actions (A) or boolean expressions (B)

10 / 117

Page 21: DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS · 2017. 4. 23. · DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS SamuelMimram ÉcolePolytechnique AppliedandComputationalAlgebraicTopology

Graphs

A graph G consists of▶ a set G0 of vertices▶ a set G1 of edges▶ source and target maps ∂−, ∂+ : G1 → G0

For control flow graphs, we moreover have▶ distinguished beginning and end vertices: s, t ∈ G0

▶ a labeling:ℓ : G1 → A⊔ B

into actions (A) or boolean expressions (B)

10 / 117

Page 22: DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS · 2017. 4. 23. · DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS SamuelMimram ÉcolePolytechnique AppliedandComputationalAlgebraicTopology

The control flow graphTo each program one can associate a graph by induction:▶ action A:

GA = sA tAA

▶ sequence p;q:

sp Gp tp sq Gq tq

▶ if b then p else q:

G = s

sp

sq

b

¬b

tp = tq = tGp

Gq

11 / 117

Page 23: DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS · 2017. 4. 23. · DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS SamuelMimram ÉcolePolytechnique AppliedandComputationalAlgebraicTopology

The control flow graphTo each program one can associate a graph by induction:▶ action A:

GA = sA tAA

▶ sequence p;q:

sp Gp tp sq Gq tq

▶ if b then p else q:

G = s

sp

sq

b

¬b

tp = tq = tGp

Gq

11 / 117

Page 24: DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS · 2017. 4. 23. · DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS SamuelMimram ÉcolePolytechnique AppliedandComputationalAlgebraicTopology

The control flow graphTo each program one can associate a graph by induction:▶ action A:

GA = sA tAA

▶ sequence p;q:

Gp;q = sp Gp tp sq Gq tq

▶ if b then p else q:

G = s

sp

sq

b

¬b

tp = tq = tGp

Gq

11 / 117

Page 25: DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS · 2017. 4. 23. · DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS SamuelMimram ÉcolePolytechnique AppliedandComputationalAlgebraicTopology

The control flow graphTo each program one can associate a graph by induction:▶ action A:

GA = sA tAA

▶ sequence p;q:

Gp;q = sp Gp tp sq Gq tq

▶ if b then p else q:

G = s

sp

sq

b

¬b

tp = tq = tGp

Gq

11 / 117

Page 26: DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS · 2017. 4. 23. · DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS SamuelMimram ÉcolePolytechnique AppliedandComputationalAlgebraicTopology

The control flow graphTo each program one can associate a graph by induction:▶ action A:

GA = sA tAA

▶ sequence p;q:

Gp;q = sp Gp tp sq Gq tq

▶ while b do p:

G = s = tp spGp

b

t¬b

11 / 117

Page 27: DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS · 2017. 4. 23. · DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS SamuelMimram ÉcolePolytechnique AppliedandComputationalAlgebraicTopology

Execution paths

An execution path of a program is a path starting from sp in thegraph Gp.

s x := 5 x != 1 x mod 2 != 0

¬(x mod 2 != 0)

x := 3*xx := x+1

x := x/2¬(x != 1)

print "Reached 1!"t

12 / 117

Page 28: DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS · 2017. 4. 23. · DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS SamuelMimram ÉcolePolytechnique AppliedandComputationalAlgebraicTopology

Denotational semanticsA state of the program is an element of Σ = ZVar:variables contain integers.

We can define a semantics by interpreting▶ each arithmetic expression a as a function

JaK : Σ → Z

▶ each boolean expression b as a function

JbK : Σ → {⊥,⊤}

▶ each action A as a function

JAK : Σ → Σ

e.g.

13 / 117

Page 29: DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS · 2017. 4. 23. · DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS SamuelMimram ÉcolePolytechnique AppliedandComputationalAlgebraicTopology

Denotational semanticsA state of the program is an element of Σ = ZVar:variables contain integers.

We can define a semantics by interpreting▶ each arithmetic expression a as a functionJaK : Σ → Z

e.g. in a state σ where σ(x) = 2, we haveJx+3K(σ) = JxK(σ) + J3K(σ) = σ(x) + 3 = 5

▶ each boolean expression b as a functionJbK : Σ → {⊥,⊤}▶ each action A as a functionJAK : Σ → Σ

e.g.

13 / 117

Page 30: DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS · 2017. 4. 23. · DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS SamuelMimram ÉcolePolytechnique AppliedandComputationalAlgebraicTopology

Denotational semanticsA state of the program is an element of Σ = ZVar:variables contain integers.

We can define a semantics by interpreting▶ each arithmetic expression a as a function

JaK : Σ → Z

▶ each boolean expression b as a function

JbK : Σ → {⊥,⊤}

▶ each action A as a function

JAK : Σ → Σ

e.g.

13 / 117

Page 31: DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS · 2017. 4. 23. · DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS SamuelMimram ÉcolePolytechnique AppliedandComputationalAlgebraicTopology

Denotational semanticsA state of the program is an element of Σ = ZVar:variables contain integers.

We can define a semantics by interpreting▶ each arithmetic expression a as a function

JaK : Σ → Z

▶ each boolean expression b as a function

JbK : Σ → {⊥,⊤}

▶ each action A as a function

JAK : Σ → Σ

e.g. Jx:=aK(σ) = y 7→

{JaK(σ) if y = xσ(y) otherwise

13 / 117

Page 32: DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS · 2017. 4. 23. · DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS SamuelMimram ÉcolePolytechnique AppliedandComputationalAlgebraicTopology

Denotational semanticsA state of the program is an element of Σ = ZVar:variables contain integers.

We can define a semantics by interpreting▶ each arithmetic expression a as a function

JaK : Σ → Z

▶ each boolean expression b as a function

JbK : Σ → {⊥,⊤}

▶ each action A as a function

JAK : Σ → Σ

e.g. JA;BK(σ) = JBK(JAK(σ))13 / 117

Page 33: DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS · 2017. 4. 23. · DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS SamuelMimram ÉcolePolytechnique AppliedandComputationalAlgebraicTopology

Denotational semanticsA state of the program is an element of Σ = ZVar:variables contain integers.

We can define a semantics by interpreting▶ each arithmetic expression a as a function

JaK : Σ → Z

▶ each boolean expression b as a function

JbK : Σ → {⊥,⊤}

▶ each action A as a function

JAK : Σ → Σ

e.g.Jif b then A else BK(σ) =

{JAK(σ) if JbK(σ) = ⊤JBK(σ) otherwise13 / 117

Page 34: DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS · 2017. 4. 23. · DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS SamuelMimram ÉcolePolytechnique AppliedandComputationalAlgebraicTopology

Valid execution pathsThe semantics can be extended to execution paths (as thesemantics of the sequence of labels, ignoring booleanconditions).

s x := 5 x != 1 x mod 2 != 0

¬(x mod 2 != 0)

x := 3*xx := x+1

x := x/2¬(x != 1)

print "Reached 1!"t

14 / 117

Page 35: DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS · 2017. 4. 23. · DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS SamuelMimram ÉcolePolytechnique AppliedandComputationalAlgebraicTopology

Valid execution pathsThe semantics can be extended to execution paths (as thesemantics of the sequence of labels, ignoring booleanconditions).

Given an initial environment, an execution path is valid when theboolean conditions are satisfied: these correspond to actual exe-cutions.

s x := 5 x != 1 x mod 2 != 0

¬(x mod 2 != 0)

x := 3*xx := x+1

x := x/2¬(x != 1)

print "Reached 1!"t

14 / 117

Page 36: DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS · 2017. 4. 23. · DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS SamuelMimram ÉcolePolytechnique AppliedandComputationalAlgebraicTopology

Verifying programsA program with a distinguished set of error vertices is correctwhen there is no valid execution path with an error vertex astarget.

15 / 117

Page 37: DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS · 2017. 4. 23. · DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS SamuelMimram ÉcolePolytechnique AppliedandComputationalAlgebraicTopology

Verifying programsA program with a distinguished set of error vertices is correctwhen there is no valid execution path with an error vertex astarget.

Typical example:

if x = 0 then error else y := 1/x

corresponding to

x=0y:=1/x

¬ (x=0)

15 / 117

Page 38: DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS · 2017. 4. 23. · DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS SamuelMimram ÉcolePolytechnique AppliedandComputationalAlgebraicTopology

Verifying programsA program with a distinguished set of error vertices is correctwhen there is no valid execution path with an error vertex astarget.

Reachability analysis can be performed by systematic exploration.This can be infinite because of▶ loops,▶ infinite sets of possible values,

and reachability is actually undecidable.

However, there are standard techniques which work well in prac-tice such as abstract interpretation.

15 / 117

Page 39: DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS · 2017. 4. 23. · DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS SamuelMimram ÉcolePolytechnique AppliedandComputationalAlgebraicTopology

Verifying programs

Another point of view on verification consists in ensuringinvariants on execution paths

p : sp ↠ tp

from the beginning to the end.

For this reason, the set of such paths is particularly important andcalled the trace space.

The terminology “space” suggests that it generally has morestructure than a mere set...

16 / 117

Page 40: DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS · 2017. 4. 23. · DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS SamuelMimram ÉcolePolytechnique AppliedandComputationalAlgebraicTopology

CONCURRENTPROGRAMS

17 / 117

Page 41: DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS · 2017. 4. 23. · DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS SamuelMimram ÉcolePolytechnique AppliedandComputationalAlgebraicTopology

Concurrent programs

Concurrent programs consists in multiple processes running inparallel. In order to model this, we add a new construction toprograms:

p||q

means run p and q in parallel.

18 / 117

Page 42: DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS · 2017. 4. 23. · DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS SamuelMimram ÉcolePolytechnique AppliedandComputationalAlgebraicTopology

Sequential consistencyAssumptionSequential consistency: the possible behaviors of p||q are theinterleavings of the actions of p and q.

Example (x1:=1; y1:=x2) || (x2:=1; y2:=x1)

has the six following possible executions:▶ x1:=1; y1:=x2; x2:=1; y2:=x1▶ x1:=1; x2:=1; y1:=x2; y2:=x1▶ x1:=1; x2:=1; y2:=x1; y1:=x2▶ x2:=1; x1:=1; y1:=x2; y2:=x1▶ x2:=1; x1:=1; y2:=x1; y1:=x2▶ x2:=1; y2:=x1; x1:=1; y1:=x2

19 / 117

Page 43: DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS · 2017. 4. 23. · DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS SamuelMimram ÉcolePolytechnique AppliedandComputationalAlgebraicTopology

Sequential consistencyAssumptionSequential consistency: the possible behaviors of p||q are theinterleavings of the actions of p and q.

Example (x1:=1; y1:=x2) || (x2:=1; y2:=x1)

has the six following possible executions:▶ x1:=1; y1:=x2; x2:=1; y2:=x1▶ x1:=1; x2:=1; y1:=x2; y2:=x1▶ x1:=1; x2:=1; y2:=x1; y1:=x2▶ x2:=1; x1:=1; y1:=x2; y2:=x1▶ x2:=1; x1:=1; y2:=x1; y1:=x2▶ x2:=1; y2:=x1; x1:=1; y1:=x2

19 / 117

Page 44: DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS · 2017. 4. 23. · DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS SamuelMimram ÉcolePolytechnique AppliedandComputationalAlgebraicTopology

Sequential consistencyAssumptionSequential consistency: the possible behaviors of p||q are theinterleavings of the actions of p and q.

Example (x1:=1; y1:=x2) || (x2:=1; y2:=x1)·

x1:=1

���������

x2:=1

��===

====

·y1:=x2

���������

x2:=1==

=

��===

·x1:=1�

��

�����

y2:=x1

��===

====

·

x2:=1 ��===

====

·y1:=x2�

��

�����

y2:=x1==

=

��===

·

x1:=1���������

·

y2:=x1 ��===

====

·

y1:=x2���������

·19 / 117

Page 45: DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS · 2017. 4. 23. · DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS SamuelMimram ÉcolePolytechnique AppliedandComputationalAlgebraicTopology

Sequential consistencyAssumptionSequential consistency: the possible behaviors of p||q are theinterleavings of the actions of p and q.

Example (x1:=1; y1:=x2) || (x2:=1; y2:=x1)

Nowadays processors have weak memory models, because ofwhich in the end you can even have

y1 = 0 and y2 = 0

if you are not careful...

19 / 117

Page 46: DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS · 2017. 4. 23. · DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS SamuelMimram ÉcolePolytechnique AppliedandComputationalAlgebraicTopology

Sequential consistency

#include <pthread.h>#include <stdio.h>

volatile int x1=0, y1=0, x2=0, y2=0;

void* f1(void *arg){

x1 = 1;y1 = x2;return NULL;

}

void* f2(void *arg){

x2 = 1;y2 = x1;return NULL;

}

int main(void){

pthread_t t1;pthread_t t2;int i;

for (i=0; i<1000000; i++) {x1=0;x2=0;pthread_create(&t1, NULL, &f1, NULL);pthread_create(&t2, NULL, &f2, NULL);pthread_join(t1, NULL);pthread_join(t2, NULL);if (y1 == 0 && y2 == 0)

printf("Impossible case!\n");}

return 0;}

20 / 117

Page 47: DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS · 2017. 4. 23. · DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS SamuelMimram ÉcolePolytechnique AppliedandComputationalAlgebraicTopology

Semantics for parallelThis suggests that we define

Gp||q = Gp ⊗Gq

where the tensor product has▶ vertices: Vp||q = Vp × Vq▶ edges: Ep||q = (Ep × Vq) ⊔ (Vp × Eq)▶ expected source and target

x

e��y

f��z

x′

e′��y′

f′��z′

=

x⊗ x′e⊗x′wwnnn

nnn x⊗e′''PP

PPPP

y⊗ x′f⊗x′wwooo

ooo y⊗e′OO

''

x⊗ y′

e⊗y′oo

wwx⊗f′

''OOOOO

O

z⊗ x′

z⊗e′ ''OOOOO

O y⊗ y′

f⊗y′oo

wwoo y⊗f′OO

''OO

x⊗ z′

e⊗z′wwoooooo

z⊗ y′

z⊗f′ ''PPPPP

P y⊗ z′

f⊗z′wwnnnnnn

z⊗ z′

21 / 117

Page 48: DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS · 2017. 4. 23. · DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS SamuelMimram ÉcolePolytechnique AppliedandComputationalAlgebraicTopology

Semantics for parallelThis suggests that we define

Gp||q = Gp ⊗Gq

where the tensor product has▶ vertices: Vp||q = Vp × Vq▶ edges: Ep||q = (Ep × Vq) ⊔ (Vp × Eq)▶ expected source and target

x

e��y

f��z

x′

e′��y′

f′��z′

=

x⊗ x′e⊗x′wwnnn

nnn x⊗e′''PP

PPPP

y⊗ x′f⊗x′wwooo

ooo y⊗e′OO

''

x⊗ y′

e⊗y′oo

wwx⊗f′

''OOOOO

O

z⊗ x′

z⊗e′ ''OOOOO

O y⊗ y′

f⊗y′oo

wwoo y⊗f′OO

''OO

x⊗ z′

e⊗z′wwoooooo

z⊗ y′

z⊗f′ ''PPPPP

P y⊗ z′

f⊗z′wwnnnnnn

z⊗ z′21 / 117

Page 49: DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS · 2017. 4. 23. · DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS SamuelMimram ÉcolePolytechnique AppliedandComputationalAlgebraicTopology

Verifying parallel programsIn theory, this is all we need to perform verification on programs,i.e. we can apply previously mentioned techniques...

In practice, we face the state space explosion problem: givena program p of size k, the size of n copies of p in parallel

p ⊗ p ⊗ · · · ⊗ p

iskn

e.g.·

��·

��·

·

��·

��·

⊗ . . . ⊗

·

��·

��·

making things impractical.

22 / 117

Page 50: DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS · 2017. 4. 23. · DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS SamuelMimram ÉcolePolytechnique AppliedandComputationalAlgebraicTopology

Verifying parallel programsIn theory, this is all we need to perform verification on programs,i.e. we can apply previously mentioned techniques...

In practice, we face the state space explosion problem: givena program p of size k, the size of n copies of p in parallel

p ⊗ p ⊗ · · · ⊗ p

iskn

e.g.·

��·

��·

·

��·

��·

⊗ . . . ⊗

·

��·

��·

making things impractical.22 / 117

Page 51: DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS · 2017. 4. 23. · DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS SamuelMimram ÉcolePolytechnique AppliedandComputationalAlgebraicTopology

CUBICALSEMANTICS

OFCONCURRENTPROGRAMS

23 / 117

Page 52: DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS · 2017. 4. 23. · DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS SamuelMimram ÉcolePolytechnique AppliedandComputationalAlgebraicTopology

Toward geometric models

This suggests that we need to take some more structure ofprograms in account, i.e. study more carefully their geometry.

We will see that▶ commutations between actions provide surfaces▶ forbidden regions create holes

24 / 117

Page 53: DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS · 2017. 4. 23. · DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS SamuelMimram ÉcolePolytechnique AppliedandComputationalAlgebraicTopology

Commutation between actionsIn order to face the state explosion problem, people haveobserved that some actions commute.

For instance, the actions of

x := 1 || y := 2

whose graph is

x:=1

~~}}}}}}}}} y:=2

BBB

BBBB

BB

y:=2 B

BBBB

BBBB

x:=1~~}}}}}}}}}

do commute in the sense that

Jx:=1; y:=2K = Jy:=2; x:=1K

25 / 117

Page 54: DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS · 2017. 4. 23. · DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS SamuelMimram ÉcolePolytechnique AppliedandComputationalAlgebraicTopology

Commutation between actionsIn order to face the state explosion problem, people haveobserved that some actions commute.

For instance, the actions of

x := 1 || y := 2

whose graph is

x:=1

~~}}}}}}}}} y:=2

BBB

BBBB

BB

y:=2 B

BBBB

BBBB

x:=1~~}}}}}}}}}

do commute in the sense that

Jx:=1; y:=2K = Jy:=2; x:=1K25 / 117

Page 55: DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS · 2017. 4. 23. · DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS SamuelMimram ÉcolePolytechnique AppliedandComputationalAlgebraicTopology

Commutation between actionsIn order to face the state explosion problem, people haveobserved that some actions commute.

For instance, the actions of

x := 1 || y := 2

whose graph is

x:=1

~~}}}}}}}}} y:=2

BBB

BBBB

BB

y:=2 B

BBBB

BBBB ⋄

x:=1~~}}}}}}}}}

do commute in the sense that

Jx:=1; y:=2K = Jy:=2; x:=1K25 / 117

Page 56: DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS · 2017. 4. 23. · DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS SamuelMimram ÉcolePolytechnique AppliedandComputationalAlgebraicTopology

Commutation between actionsIn order to face the state explosion problem, people haveobserved that some actions commute.

For instance, the actions of

x := 1 || x := 2

whose graph is

x:=1

���������� x:=2

��???

????

?

x:=2��?

????

???

x:=1����������

do not commute in the sense that

Jx:=1; x:=2K = Jx:=2; x:=1K25 / 117

Page 57: DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS · 2017. 4. 23. · DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS SamuelMimram ÉcolePolytechnique AppliedandComputationalAlgebraicTopology

Stability under refinementAnother reason why this commutation is important is that wewant semantics to be stable under refinement.

For instance:

▶ the semantics of A||B is B��

A //

B��

A//

▶ if we replace A by A1;A2, we obtain B��

A1 // A2 //

B��

A1

//A2

//

▶ the semantics of (A1;A2)||B is B��

A1 //

B��

A2 //

B��

A1

//A2

//

26 / 117

Page 58: DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS · 2017. 4. 23. · DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS SamuelMimram ÉcolePolytechnique AppliedandComputationalAlgebraicTopology

True concurrency

This idea of taking commutations in account is called trueconcurrency: Mazurkiewicz traces, asynchronous automata, etc.

There is no reason why we should stop at commutation of twoactions...

27 / 117

Page 59: DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS · 2017. 4. 23. · DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS SamuelMimram ÉcolePolytechnique AppliedandComputationalAlgebraicTopology

True concurrency

This idea of taking commutations in account is called trueconcurrency: Mazurkiewicz traces, asynchronous automata, etc.

There is no reason why we should stop at commutation of twoactions...

27 / 117

Page 60: DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS · 2017. 4. 23. · DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS SamuelMimram ÉcolePolytechnique AppliedandComputationalAlgebraicTopology

Higher commutations▶ commutation of two actions is indicated by a square

A

���������� B

��???

????

?

B��?

????

??? ⋄

A����������

▶ commutation of three actions is indicated by a cube

C

��

B??

?

��????

A //

C

��

B

��???

????

?

C

��

A //

C

��

A //

B ��???

????

?

B??

?

��????

A//

▶ etc.

28 / 117

Page 61: DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS · 2017. 4. 23. · DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS SamuelMimram ÉcolePolytechnique AppliedandComputationalAlgebraicTopology

Higher commutations▶ commutation of two actions is indicated by a square

A

���������� B

��???

????

?

B��?

????

??? ⋄

A����������

▶ commutation of three actions is indicated by a cube

C

��

B??

?

��????

A //

C

��

B

��???

????

?

C

��

A //

C

��

A //

B ��???

????

?

B??

?

��????

A//

▶ etc.

28 / 117

Page 62: DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS · 2017. 4. 23. · DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS SamuelMimram ÉcolePolytechnique AppliedandComputationalAlgebraicTopology

Higher commutations▶ commutation of two actions is indicated by a square

A

���������� B

��???

????

?

B��?

????

??? ⋄

A����������

▶ commutation of three actions is indicated by a cube

C

��

B??

?

��????

A //

C

��

B

��???

????

?

C

��

A //

C

��

A //

B ��???

????

?

B??

?

��????

A//

▶ etc.28 / 117

Page 63: DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS · 2017. 4. 23. · DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS SamuelMimram ÉcolePolytechnique AppliedandComputationalAlgebraicTopology

Precubical setsA precubical set C consists of, for every n ∈ N,▶ a set Cn of n-cubes▶ face maps

∂αi : Cn → Cn−1

for α ∈ {−,+} and 0 ≤ i < n, such that

∂βj ∂αi = ∂αi ∂

βj+1 : Cn+1 → Cn−1

for 0 ≤ i ≤ j < n and α, β ∈ {−,+}.

29 / 117

Page 64: DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS · 2017. 4. 23. · DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS SamuelMimram ÉcolePolytechnique AppliedandComputationalAlgebraicTopology

Precubical setsA precubical set C consists of, for every n ∈ N,▶ a set Cn of n-cubes▶ face maps

∂αi : Cn → Cn−1

for α ∈ {−,+} and 0 ≤ i < n, such that

∂βj ∂αi = ∂αi ∂

βj+1 : Cn+1 → Cn−1

for 0 ≤ i ≤ j < n and α, β ∈ {−,+}.

For instance an element x ∈ C2 can be pictured as

∂−0 ∂−1 (x)

∂−0 (x)

��

∂−1 (x)

//

x

∂+0 ∂−1 (x)

∂+0 (x)

��∂−0 ∂

+1 (x)

∂+1 (x)

// ∂+0 ∂+1 (x)

29 / 117

Page 65: DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS · 2017. 4. 23. · DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS SamuelMimram ÉcolePolytechnique AppliedandComputationalAlgebraicTopology

Precubical setsA precubical set C consists of, for every n ∈ N,▶ a set Cn of n-cubes▶ face maps

∂αi : Cn → Cn−1

for α ∈ {−,+} and 0 ≤ i < n, such that

∂βj ∂αi = ∂αi ∂

βj+1 : Cn+1 → Cn−1

for 0 ≤ i ≤ j < n and α, β ∈ {−,+}.

Note that there is an underlying graph with▶ C0 as vertices▶ C1 as edges▶ ∂−, ∂+ : C1 → C0 as source and target maps

29 / 117

Page 66: DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS · 2017. 4. 23. · DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS SamuelMimram ÉcolePolytechnique AppliedandComputationalAlgebraicTopology

Precubical setsA precubical set C consists of, for every n ∈ N,▶ a set Cn of n-cubes▶ face maps

∂αi : Cn → Cn−1

for α ∈ {−,+} and 0 ≤ i < n, such that

∂βj ∂αi = ∂αi ∂

βj+1 : Cn+1 → Cn−1

for 0 ≤ i ≤ j < n and α, β ∈ {−,+}.

Terminology: a precubical set with a distinguished vertex is calledan higher-dimensional automaton (or HDA)

29 / 117

Page 67: DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS · 2017. 4. 23. · DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS SamuelMimram ÉcolePolytechnique AppliedandComputationalAlgebraicTopology

Tensor product

The tensor productC⊗ D

of two precubical sets has n-cubes

(C⊗ D)n =⨿i+j=n

Ci × Dj

and boundary

∂αk : (C⊗ D)n → (C⊗ D)n−1

x⊗ y 7→

{∂αk (x)⊗ y if 0 ≤ k < i

x⊗ ∂αk−i(y) if i ≤ k < n

30 / 117

Page 68: DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS · 2017. 4. 23. · DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS SamuelMimram ÉcolePolytechnique AppliedandComputationalAlgebraicTopology

Tensor productFor instance with

I = x yf

and S1 =z

g

one has

▶ I⊗ S1: x ⊗ g y ⊗ g

x ⊗ z y ⊗ z

f ⊗ g

f ⊗ z

▶ I⊗ I: f ⊗ gx ⊗ x y ⊗ x

x ⊗ y y ⊗ y

f ⊗ x

x ⊗ f y ⊗ f

f ⊗ y

▶ S1 ⊗ S1: z ⊗ z

g ⊗ z

z ⊗ gg ⊗ g

31 / 117

Page 69: DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS · 2017. 4. 23. · DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS SamuelMimram ÉcolePolytechnique AppliedandComputationalAlgebraicTopology

Tensor productFor instance with

I = x yf

and S1 =z

g

one has

▶ I⊗ S1: x ⊗ g y ⊗ g

x ⊗ z y ⊗ z

f ⊗ g

f ⊗ z

▶ I⊗ I: f ⊗ gx ⊗ x y ⊗ x

x ⊗ y y ⊗ y

f ⊗ x

x ⊗ f y ⊗ f

f ⊗ y

▶ S1 ⊗ S1: z ⊗ z

g ⊗ z

z ⊗ gg ⊗ g

31 / 117

Page 70: DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS · 2017. 4. 23. · DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS SamuelMimram ÉcolePolytechnique AppliedandComputationalAlgebraicTopology

Tensor productFor instance with

I = x yf

and S1 =z

g

one has

▶ I⊗ S1: x ⊗ g y ⊗ g

x ⊗ z y ⊗ z

f ⊗ g

f ⊗ z

▶ I⊗ I: f ⊗ gx ⊗ x y ⊗ x

x ⊗ y y ⊗ y

f ⊗ x

x ⊗ f y ⊗ f

f ⊗ y

▶ S1 ⊗ S1: z ⊗ z

g ⊗ z

z ⊗ gg ⊗ g

31 / 117

Page 71: DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS · 2017. 4. 23. · DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS SamuelMimram ÉcolePolytechnique AppliedandComputationalAlgebraicTopology

Cubical semantics

The cubical semantics Cp of a program p is defined as before,but in precubical sets, e.g.

Cp||q = Cp ⊗ Cq

where the tensor product is now taken in precubical sets.

32 / 117

Page 72: DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS · 2017. 4. 23. · DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS SamuelMimram ÉcolePolytechnique AppliedandComputationalAlgebraicTopology

Cubical semanticsFor now, the cubical semantics is too simple:▶ x := 1 || y := 2

x:=1

���������� y:=2

��???

????

?

y:=2��?

????

??? ⋄

x:=1����������

▶ x := 1 || x := 2

x:=1

���������� x:=2

��???

????

?

x:=2��?

????

??? ⋄

x:=1����������

We need to carve holes!33 / 117

Page 73: DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS · 2017. 4. 23. · DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS SamuelMimram ÉcolePolytechnique AppliedandComputationalAlgebraicTopology

MutexesIn practice, systems provide primitives to ensure that▶ two threads will not access a variable at the same time:mutual exclusion

▶ some sequences of actions are atomic

A mutex a is a resource which you can▶ lock: Pa▶ release: Va

and the system will guarantee that at most one process will havethe resource at a given time (locks can block).

We add to our language actions of the form

Pa and Va

34 / 117

Page 74: DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS · 2017. 4. 23. · DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS SamuelMimram ÉcolePolytechnique AppliedandComputationalAlgebraicTopology

MutexesIn practice, systems provide primitives to ensure that▶ two threads will not access a variable at the same time:mutual exclusion

▶ some sequences of actions are atomic

A mutex a is a resource which you can▶ lock: Pa▶ release: Va

and the system will guarantee that at most one process will havethe resource at a given time (locks can block).

We add to our language actions of the form

Pa and Va

34 / 117

Page 75: DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS · 2017. 4. 23. · DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS SamuelMimram ÉcolePolytechnique AppliedandComputationalAlgebraicTopology

MutexesIn practice, systems provide primitives to ensure that▶ two threads will not access a variable at the same time:mutual exclusion

▶ some sequences of actions are atomic

A mutex a is a resource which you can▶ lock: Pa▶ release: Va

and the system will guarantee that at most one process will havethe resource at a given time (locks can block).

We add to our language actions of the form

Pa and Va

34 / 117

Page 76: DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS · 2017. 4. 23. · DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS SamuelMimram ÉcolePolytechnique AppliedandComputationalAlgebraicTopology

More general resources

More generally, we consider resources a with arbitrary capacity

κa ∈ N

which can be locked by at most κa threads at a time.

A mutex is a resource of capacity 1.

35 / 117

Page 77: DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS · 2017. 4. 23. · DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS SamuelMimram ÉcolePolytechnique AppliedandComputationalAlgebraicTopology

Protecting variablesThe semantics of the program

x := 1 || x := 2

is

x:=1

���������� x:=2

��???

????

?

x:=2��?

????

??? ⋄

x:=1����������

36 / 117

Page 78: DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS · 2017. 4. 23. · DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS SamuelMimram ÉcolePolytechnique AppliedandComputationalAlgebraicTopology

Protecting variablesThe semantics of the program

(Pa;x := 1;Va) || (Pa;x := 2;Va)

is

Pa{{www

wwww Pa

##GGG

GGGG

x:=1{{www

wwww

PaGGG

##GGG

⋄Pawww

{{wwwx:=2

##GGG

GGGG

Va{{www

wwww

PaGGG

##GGG

⋄x:=1w

ww

{{wwwx:=2GGG

##GGG

⋄Pawww

{{wwwVa

##GGG

GGGG

Pa ##GGG

GGGG ⋄

Vawww

{{www ##GGG

GGGGx:=2GGG

##GGG

⋄x:=1w

ww

{{wwwVaGGG

##GGG

Pa{{wwwwwww

x:=2 ##GGG

GGGG ⋄

Vawww

{{wwwVaGGG

##GGG

x:=1{{wwwwwww

Va ##GGG

GGGG ⋄

Va{{wwwwwww

36 / 117

Page 79: DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS · 2017. 4. 23. · DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS SamuelMimram ÉcolePolytechnique AppliedandComputationalAlgebraicTopology

Protecting variablesThe semantics of the program

(Pa;x := 1;Va) || (Pa;x := 2;Va)

is

Pa{{www

wwww Pa

##GGG

GGGG

x:=1{{www

wwww x:=2

##GGG

GGGG

Va{{www

wwww Va

##GGG

GGGG

Pa ##GGG

GGGG

Pa{{wwwwwww

x:=2 ##GGG

GGGG

x:=1{{wwwwwww

Va ##GGG

GGGG

Va{{wwwwwww

36 / 117

Page 80: DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS · 2017. 4. 23. · DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS SamuelMimram ÉcolePolytechnique AppliedandComputationalAlgebraicTopology

Protecting variables

In a program of the form

(Pa;p;Va) || (Pa;q;Va)

the subprograms p and q are

▶ mutually exclusive:they cannot be executed at the same time

▶ atomic:once we start executing p, we go on until the endi.e. there is no interleaving with other threads

37 / 117

Page 81: DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS · 2017. 4. 23. · DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS SamuelMimram ÉcolePolytechnique AppliedandComputationalAlgebraicTopology

Protecting variables

In a program of the form

(Pa;p;Va) || (Pa;q;Va)

the subprograms p and q are

▶ mutually exclusive:they cannot be executed at the same time

▶ atomic:once we start executing p, we go on until the endi.e. there is no interleaving with other threads

37 / 117

Page 82: DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS · 2017. 4. 23. · DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS SamuelMimram ÉcolePolytechnique AppliedandComputationalAlgebraicTopology

Conservative programsA program is conservative when the resource consumption onlydepends on the vertex (not on the path reaching the vertex).

▶ conservative programs:

Pa

Pb

Pa

PbPa b

Va

Pa¬b Va

Pa||Pb Pa;(while b do (Va;Pa));Va

▶ non-conservative programs:

¬b

b

Pa

Pb b Pa

¬bif b then Pa else Pb while b do Pa

38 / 117

Page 83: DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS · 2017. 4. 23. · DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS SamuelMimram ÉcolePolytechnique AppliedandComputationalAlgebraicTopology

Conservative programsA program is conservative when the resource consumption onlydepends on the vertex (not on the path reaching the vertex).

▶ conservative programs:

Pa

Pb

Pa

PbPa b

Va

Pa¬b Va

Pa||Pb Pa;(while b do (Va;Pa));Va

▶ non-conservative programs:

¬b

b

Pa

Pb b Pa

¬bif b then Pa else Pb while b do Pa

38 / 117

Page 84: DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS · 2017. 4. 23. · DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS SamuelMimram ÉcolePolytechnique AppliedandComputationalAlgebraicTopology

Conservative programsA program is conservative when the resource consumption onlydepends on the vertex (not on the path reaching the vertex).

▶ conservative programs:

Pa

Pb

Pa

PbPa b

Va

Pa¬b Va

Pa||Pb Pa;(while b do (Va;Pa));Va

▶ non-conservative programs:

¬b

b

Pa

Pb b Pa

¬bif b then Pa else Pb while b do Pa

38 / 117

Page 85: DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS · 2017. 4. 23. · DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS SamuelMimram ÉcolePolytechnique AppliedandComputationalAlgebraicTopology

Conservative programsA program is conservative when the resource consumption

∆(p) : R → Z

is well defined:

∆(A) = 0

∆(Pa) = −δa ∆(Va) = δa

∆(p;q) = ∆(p) + ∆(q) ∆(p||q) = ∆(p) + ∆(q)

∆(if b then p else q) = ∆(p) whenever ∆(p) = ∆(q)

∆(while b do p) = 0 whenever ∆(p) = 0

where

δa(b) =

{1 if b = a

0 otherwise

39 / 117

Page 86: DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS · 2017. 4. 23. · DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS SamuelMimram ÉcolePolytechnique AppliedandComputationalAlgebraicTopology

Forbidden verticesIn a conservative program p a vertex x ∈ Cp is valid when, given apath

t : sp ↠ x

for every resource a, we have

0 ≤ κa +∆(t)(a) ≤ κa

It is forbidden otherwise.

Pa{{www

ww Pa##G

GGGG

•x:=1{{www

ww PaGG

##GG⋄

Paww

{{wwx:=2##G

GGGG

Va{{www

ww PaGG

##GG⋄x:=1w

w{{ww x:=2

GG

##GG⋄

Paww

{{wwVa##G

GGGG

Pa ##GGGG

G •⋄Vaww

{{ww ##GGGG

Gx:=2GG

##GG⋄x:=1w

w{{ww Va

GG

##GG⋄•

Pa{{wwwww

x:=2 ##GGGG

G ⋄Vaww

{{ww VaGG

##GG⋄

x:=1{{wwwww

Va ##GGGG

G ⋄

Va{{wwwww

40 / 117

Page 87: DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS · 2017. 4. 23. · DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS SamuelMimram ÉcolePolytechnique AppliedandComputationalAlgebraicTopology

Cubical semantics

The cubical semantics Cp of a conservative program p is theprecubical set

Cp

from which we have removed▶ forbidden vertices▶ cubes having forbidden vertices as iterated faces

41 / 117

Page 88: DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS · 2017. 4. 23. · DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS SamuelMimram ÉcolePolytechnique AppliedandComputationalAlgebraicTopology

Influence of the capacity

Consider the program p:

Pa;Va || Pa;Va || Pa;Va

Depending on the capacity of a, the geometric semantics is

κa ≥ 3 κa = 2 κa = 1 κa = 0

42 / 117

Page 89: DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS · 2017. 4. 23. · DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS SamuelMimram ÉcolePolytechnique AppliedandComputationalAlgebraicTopology

Equivalent pathsGiven a precubical set, we write ∼ for the smallest equivalencerelation on paths▶ such that

A · B ∼ B′ · A′

for every 2-cubeA

�������� B′

��???

???

B ��???

??? ⋄

A′��������

▶ which is a congruence:

t ∼ t′ and u ∼ u′

impliest · u ∼ t′ · u′

for concatenable paths43 / 117

Page 90: DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS · 2017. 4. 23. · DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS SamuelMimram ÉcolePolytechnique AppliedandComputationalAlgebraicTopology

Coherent programs

A program is coherent when all concurrent accesses to variablesare protected by mutexes.

PropositionFor coherent two equivalent paths have the same semantics:

t ∼ t′ implies JtK = Jt′KIn order to check all the behaviors, it is enough to check onerepresentative in each equivalence class of executions under ∼.

44 / 117

Page 91: DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS · 2017. 4. 23. · DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS SamuelMimram ÉcolePolytechnique AppliedandComputationalAlgebraicTopology

Coherent programs

A program is coherent when all concurrent accesses to variablesare protected by mutexes.

PropositionFor coherent two equivalent paths have the same semantics:

t ∼ t′ implies JtK = Jt′K

In order to check all the behaviors, it is enough to check onerepresentative in each equivalence class of executions under ∼.

44 / 117

Page 92: DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS · 2017. 4. 23. · DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS SamuelMimram ÉcolePolytechnique AppliedandComputationalAlgebraicTopology

Coherent programs

A program is coherent when all concurrent accesses to variablesare protected by mutexes.

PropositionFor coherent two equivalent paths have the same semantics:

t ∼ t′ implies JtK = Jt′KIn order to check all the behaviors, it is enough to check onerepresentative in each equivalence class of executions under ∼.

44 / 117

Page 93: DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS · 2017. 4. 23. · DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS SamuelMimram ÉcolePolytechnique AppliedandComputationalAlgebraicTopology

The fundamental category

Given a precubical set C, the fundamental category Π1(C) has▶ vertices of C as objects▶ paths up to equivalence as morphisms

and composition is given by concatenation.

The terminology suggests that equivalence corresponds to someform of homotopy, we will get back to this.

45 / 117

Page 94: DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS · 2017. 4. 23. · DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS SamuelMimram ÉcolePolytechnique AppliedandComputationalAlgebraicTopology

The trace space

Given a program p, we are mostly interested in the trace space:

Π1(Cp)(sp, tp)

We are also interested into finer properties, e.g. how many waysthere are to show that two paths are equivalent, etc.

⇝ • •

46 / 117

Page 95: DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS · 2017. 4. 23. · DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS SamuelMimram ÉcolePolytechnique AppliedandComputationalAlgebraicTopology

The trace space

Given a program p, we are mostly interested in the trace space:

Π1(Cp)(sp, tp)

We are also interested into finer properties, e.g. how many waysthere are to show that two paths are equivalent, etc.

⇝ • •

46 / 117

Page 96: DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS · 2017. 4. 23. · DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS SamuelMimram ÉcolePolytechnique AppliedandComputationalAlgebraicTopology

Forgetting about valuesThe geometry does not depend on actions manipulating values!

The semantics of

(Pa;x := 1;Va) || (Pa;x := 2;Va)

47 / 117

Page 97: DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS · 2017. 4. 23. · DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS SamuelMimram ÉcolePolytechnique AppliedandComputationalAlgebraicTopology

Forgetting about valuesThe geometry does not depend on actions manipulating values!

The semantics of

(Pa;x := 1;Va) || (Pa;x := 2;Va)

Pa{{www

wwww Pa

##GGG

GGGG

x:=1{{www

wwww x:=2

##GGG

GGGG

Va{{www

wwww Va

##GGG

GGGG

Pa ##GGG

GGGG

Pa{{wwwwwww

x:=2 ##GGG

GGGG

x:=1{{wwwwwww

Va ##GGG

GGGG

Va{{wwwwwww

47 / 117

Page 98: DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS · 2017. 4. 23. · DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS SamuelMimram ÉcolePolytechnique AppliedandComputationalAlgebraicTopology

Forgetting about valuesThe geometry does not depend on actions manipulating values!

The semantics of

(Pa;Va) || (Pa;Va)

Pa{{www

wwww Pa

##GGG

GGGG

Va{{www

wwww Va

##GGG

GGGG

Pa ##GGG

GGGG

Pa{{wwwwwww

Va ##GGG

GGGG

Va{{wwwwwww

47 / 117

Page 99: DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS · 2017. 4. 23. · DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS SamuelMimram ÉcolePolytechnique AppliedandComputationalAlgebraicTopology

DIRECTEDTOPOLOGICAL

MODELS

48 / 117

Page 100: DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS · 2017. 4. 23. · DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS SamuelMimram ÉcolePolytechnique AppliedandComputationalAlgebraicTopology

Geometric realizationWe write I for the interval topological space

I = [0, 1]

The topological n-cube is defined as

In

49 / 117

Page 101: DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS · 2017. 4. 23. · DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS SamuelMimram ÉcolePolytechnique AppliedandComputationalAlgebraicTopology

Geometric realizationWe write I for the interval topological space

I = [0, 1]

The topological n-cube is defined as

In

For instance,

. . . .

I0 I1 I2 I3 . . .

49 / 117

Page 102: DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS · 2017. 4. 23. · DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS SamuelMimram ÉcolePolytechnique AppliedandComputationalAlgebraicTopology

Geometric realizationWe write I for the interval topological space

I = [0, 1]

The topological n-cube is defined as

In

With 0 ≤ i < n and α ∈ {−,+}, we write

ιαi : In−1 → In

for the canonical inclusions:

ι−i (x0, . . . , xn−2) = (x0, . . . , 0, . . . , xn−2)

ι+i (x0, . . . , xn−2) = (x0, . . . , 1, . . . , xn−2)

49 / 117

Page 103: DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS · 2017. 4. 23. · DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS SamuelMimram ÉcolePolytechnique AppliedandComputationalAlgebraicTopology

Geometric realization

A precubical set can be seen as a topological space,via the geometric realization functor

|−| : PCSet → Top

which to a precubical set C associates the space obtained bygluing cubes as described by C:

|C| =⨿n∈N

(Cn × In)/ ≈

where Cn has discrete topology and

(∂αi (x),p) ≈ (x, ιαi (p))

50 / 117

Page 104: DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS · 2017. 4. 23. · DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS SamuelMimram ÉcolePolytechnique AppliedandComputationalAlgebraicTopology

Geometric realization

A precubical set can be seen as a topological space,via the geometric realization functor

|−| : PCSet → Top

which to a precubical set C associates the space obtained bygluing cubes as described by C:

|C| =⨿n∈N

(Cn × In)/ ≈

where Cn has discrete topology and

(∂αi (x),p) ≈ (x, ιαi (p))

50 / 117

Page 105: DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS · 2017. 4. 23. · DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS SamuelMimram ÉcolePolytechnique AppliedandComputationalAlgebraicTopology

Geometric realization

Given the precubical set

x1

f1��

ϕ

xg1oo

f��

g2 // x2

ψ f2��

y1 yh1

ooh2

// y2

The cubes ϕ, f, ψ will induce cubes in the geometric realization:

|C| = I2 ⊔ I1 ⊔ I2 ⊔ . . .

and the identification (∂αi (x),p) ≈ (x, ιαi (p)) means

51 / 117

Page 106: DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS · 2017. 4. 23. · DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS SamuelMimram ÉcolePolytechnique AppliedandComputationalAlgebraicTopology

Geometric realization

PropositionGeometric realization sends tensor product to cartesian one:

|C⊗ D| = |C| × |D|

52 / 117

Page 107: DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS · 2017. 4. 23. · DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS SamuelMimram ÉcolePolytechnique AppliedandComputationalAlgebraicTopology

What makes Topa good place to takegeometric realization?

53 / 117

Page 108: DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS · 2017. 4. 23. · DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS SamuelMimram ÉcolePolytechnique AppliedandComputationalAlgebraicTopology

Graphs

If we write □1 for the category

0∂−

//

∂+// 1

a functorG : □op1 → Set

is characterized by two sets

G(0) G(1)

and two functions

G(∂−),G(∂+) : G(1) → G(0)

i.e. a graph.

54 / 117

Page 109: DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS · 2017. 4. 23. · DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS SamuelMimram ÉcolePolytechnique AppliedandComputationalAlgebraicTopology

GraphsNote that every graph can be canonically obtained as a colimitinvolving the two graphs

G0 = · and G1 = · // ·

For instance,· !!// · // ·

is the colimit of

G1

G0

66nnnnnnnnnnnnnnn

AAA

AAAA

A G0

~~}}}}}}}}

AAA

AAAA

A G0

hhPPPPPPPPPPPPPPP

~~}}}}}}}}

G1 G1

This means that a cocontinuous functor is uniquely determinedby its image on G0 and G1.

55 / 117

Page 110: DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS · 2017. 4. 23. · DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS SamuelMimram ÉcolePolytechnique AppliedandComputationalAlgebraicTopology

GraphsNote that every graph can be canonically obtained as a colimitinvolving the two graphs

G0 = · and G1 = · // ·

For instance,· !!// · // ·

is the colimit of

G1

G0

66nnnnnnnnnnnnnnn

AAA

AAAA

A G0

~~}}}}}}}}

AAA

AAAA

A G0

hhPPPPPPPPPPPPPPP

~~}}}}}}}}

G1 G1

This means that a cocontinuous functor is uniquely determinedby its image on G0 and G1.

55 / 117

Page 111: DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS · 2017. 4. 23. · DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS SamuelMimram ÉcolePolytechnique AppliedandComputationalAlgebraicTopology

Precubical setsA precubical set can be seen as a presheaf functor

C : □op → Set

where □ is the category with▶ n ∈ N as objects▶ morphisms are generated by

∂αi : n− 1 → n

quotiented by relations

∂αi ∂βj = ∂βj+1∂

αi : n− 1 → n+ 1

To sum up: PCSet ∼= □56 / 117

Page 112: DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS · 2017. 4. 23. · DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS SamuelMimram ÉcolePolytechnique AppliedandComputationalAlgebraicTopology

A cube object

We can remark that we have a functor

F : □ → Top

defined byF(n) = In

andF(∂αi ) = ιαi : In−1 → In

encoding the realization of all the standard cube and their faces.

This is all we need!

57 / 117

Page 113: DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS · 2017. 4. 23. · DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS SamuelMimram ÉcolePolytechnique AppliedandComputationalAlgebraicTopology

Presheaves as cocompletionA category is cocomplete when it has coproducts and quotients.

PropositionThe category □ is the free cocompletion of □: given a functorF : □→ C, with C cocomplete, there is a unique cocontinuousfunctor F such that

□Y��

F // C

□F

@@

where Y is the Yoneda embedding.

58 / 117

Page 114: DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS · 2017. 4. 23. · DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS SamuelMimram ÉcolePolytechnique AppliedandComputationalAlgebraicTopology

Presheaves as cocompletionA category is cocomplete when it has coproducts and quotients.

PropositionThe category □ is the free cocompletion of □: given a functorF : □→ C, with C cocomplete, there is a unique cocontinuousfunctor F such that

□Y��

F // C

□F

@@

where Y is the Yoneda embedding.

58 / 117

Page 115: DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS · 2017. 4. 23. · DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS SamuelMimram ÉcolePolytechnique AppliedandComputationalAlgebraicTopology

Presheaves as cocompletionA category is cocomplete when it has coproducts and quotients.

PropositionThe category □ is the free cocompletion of □: given a functorF : □→ C, with C cocomplete, there is a unique cocontinuousfunctor F such that

□Y��

F // C

□F

@@

where Y is the Yoneda embedding.

We obtain geometric realization as □

Y��

F // Top

□|−|

= LanY F

>> .

58 / 117

Page 116: DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS · 2017. 4. 23. · DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS SamuelMimram ÉcolePolytechnique AppliedandComputationalAlgebraicTopology

Presheaves as cocompletionA category is cocomplete when it has coproducts and quotients.

PropositionThe category □ is the free cocompletion of □: given a functorF : □→ C, with C cocomplete, there is a unique cocontinuousfunctor F such that

□Y��

F // C

□F

@@

where Y is the Yoneda embedding.

We obtain geometric realization as □

Y��

F // Top

□|−| = LanY F

>> .

58 / 117

Page 117: DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS · 2017. 4. 23. · DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS SamuelMimram ÉcolePolytechnique AppliedandComputationalAlgebraicTopology

Presheaves as cocompletionA category is cocomplete when it has coproducts and quotients.

PropositionThe category □ is the free cocompletion of □: given a functorF : □→ C, with C cocomplete, there is a unique cocontinuousfunctor F such that

□Y��

F // C

□F

@@

where Y is the Yoneda embedding.

This point of view will be useful to consider other“geometric realizations”.

58 / 117

Page 118: DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS · 2017. 4. 23. · DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS SamuelMimram ÉcolePolytechnique AppliedandComputationalAlgebraicTopology

What aboutgeometric realizations

ofgeometric semantics

ofconcurrent programs?

59 / 117

Page 119: DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS · 2017. 4. 23. · DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS SamuelMimram ÉcolePolytechnique AppliedandComputationalAlgebraicTopology

Geometric semantics

The geometric semantics Sp of a program p is the space

Sp =∣∣∣Cp∣∣∣

60 / 117

Page 120: DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS · 2017. 4. 23. · DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS SamuelMimram ÉcolePolytechnique AppliedandComputationalAlgebraicTopology

Simple programsA simple program p is of the form

p1 || p2 || . . . || pn

where each pi is a sequence of actions (Pa / Va).

In this case, the geometric semantics is of the form

Sp =∣∣∣Cp∣∣∣

= |Cp \ Fp|=

∣∣I⊗n \ Fp∣∣= In \

l∪i=1

Ri

where Ri are open hyperrectangles.61 / 117

Page 121: DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS · 2017. 4. 23. · DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS SamuelMimram ÉcolePolytechnique AppliedandComputationalAlgebraicTopology

Geometric semantics

The geometric semantics of

Pa;Va || Pa;Va

with κa = 1, is

Pa Va

Pa

Va

62 / 117

Page 122: DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS · 2017. 4. 23. · DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS SamuelMimram ÉcolePolytechnique AppliedandComputationalAlgebraicTopology

Geometric semantics

The geometric semantics of

Pa;Va || Pa;Va || Pa;Va

with κa = 1, is

62 / 117

Page 123: DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS · 2017. 4. 23. · DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS SamuelMimram ÉcolePolytechnique AppliedandComputationalAlgebraicTopology

Geometric semantics

The geometric semantics of

Pa;Va || Pa;Va || Pa;Va

with κa = 2, is

62 / 117

Page 124: DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS · 2017. 4. 23. · DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS SamuelMimram ÉcolePolytechnique AppliedandComputationalAlgebraicTopology

Geometric semantics

The geometric semantics of

Pa;Va;Pb;Vb || Pa;Va;Pb;Vb

with κa = 1, is

Pa Va Pb Vb

Pa

Va

Pb

Vb

62 / 117

Page 125: DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS · 2017. 4. 23. · DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS SamuelMimram ÉcolePolytechnique AppliedandComputationalAlgebraicTopology

Geometric semantics

The geometric semantics of

Pa;Va;Pb;Vb || Pb;Vb;Pa;Va

with κa = 1, is

Pa Va Pb Vb

Pb

Vb

Pa

Va

62 / 117

Page 126: DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS · 2017. 4. 23. · DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS SamuelMimram ÉcolePolytechnique AppliedandComputationalAlgebraicTopology

Geometric semantics

The geometric semantics of

Pa;Pb;Vb;Va || Pb;Pa;Va;Vb

with κa = 1, is

Pa Pb Vb Va

Pb

Pa

Va

Vb

62 / 117

Page 127: DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS · 2017. 4. 23. · DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS SamuelMimram ÉcolePolytechnique AppliedandComputationalAlgebraicTopology

Geometric semantics

The geometric semantics of

Pa; while b do (Va;Pa) || Pa;Va

with κa = 1, is

sp

tp

PaVa

Pa

bVaPa

¬b

62 / 117

Page 128: DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS · 2017. 4. 23. · DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS SamuelMimram ÉcolePolytechnique AppliedandComputationalAlgebraicTopology

Paths in geometric semantics

The geometric semantics S is equipped with beginning and endpoints s and t.

We can expect that▶ the paths

p : I → S

with p(0) = s and p(1) = t to correspond to executions ofthe program,

▶ deformations of paths correspond to equivalence betweenpaths.

63 / 117

Page 129: DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS · 2017. 4. 23. · DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS SamuelMimram ÉcolePolytechnique AppliedandComputationalAlgebraicTopology

Paths in geometric semantics

The geometric semantics S is equipped with beginning and endpoints s and t.

We can expect that▶ the paths

p : I → S

with p(0) = s and p(1) = t to correspond to executions ofthe program,

▶ deformations of paths correspond to equivalence betweenpaths.

63 / 117

Page 130: DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS · 2017. 4. 23. · DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS SamuelMimram ÉcolePolytechnique AppliedandComputationalAlgebraicTopology

Paths in geometric semantics

The geometric semantics of

Pa;Va;Pb;Vb || Pb;Vb;Pa;Va

is

s

t

Pa Va Pb Vb

Pb

Vb

Pa

Va

64 / 117

Page 131: DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS · 2017. 4. 23. · DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS SamuelMimram ÉcolePolytechnique AppliedandComputationalAlgebraicTopology

Paths in geometric semantics

The geometric semantics of

Pa;Va;Pb;Vb || Pb;Vb;Pa;Va

is

s

t

Pa Va Pb Vb

Pb

Vb

Pa

Va

64 / 117

Page 132: DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS · 2017. 4. 23. · DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS SamuelMimram ÉcolePolytechnique AppliedandComputationalAlgebraicTopology

Paths in geometric semantics

The geometric semantics of

Pa;Va;Pb;Vb || Pb;Vb;Pa;Va

is

s

t

Pa Va Pb Vb

Pb

Vb

Pa

Va

64 / 117

Page 133: DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS · 2017. 4. 23. · DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS SamuelMimram ÉcolePolytechnique AppliedandComputationalAlgebraicTopology

Paths in geometric semantics

The geometric semantics of

Pa;Va;Pb;Vb || Pb;Vb;Pa;Va

is

s

t

Pa Va Pb Vb

Pb

Vb

Pa

Va

64 / 117

Page 134: DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS · 2017. 4. 23. · DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS SamuelMimram ÉcolePolytechnique AppliedandComputationalAlgebraicTopology

Paths in geometric semantics

The geometric semantics of

Pa;Va;Pb;Vb || Pb;Vb;Pa;Va

is

s

t

Pa Va Pb Vb

Pb

Vb

Pa

Va

Actual executions correspond to increasing paths!

64 / 117

Page 135: DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS · 2017. 4. 23. · DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS SamuelMimram ÉcolePolytechnique AppliedandComputationalAlgebraicTopology

Directed paths

We want to axiomatize a notion of directed path.

In practice, we will consider Rn with directed paths

p : I → Rn

being those for which

Ip // Rn πi // R

is increasing for every projection πi.

65 / 117

Page 136: DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS · 2017. 4. 23. · DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS SamuelMimram ÉcolePolytechnique AppliedandComputationalAlgebraicTopology

Directed paths

We want to axiomatize a notion of directed path.

In practice, we will consider Rn with directed paths

p : I → Rn

being those for which

Ip // Rn πi // R

is increasing for every projection πi.

65 / 117

Page 137: DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS · 2017. 4. 23. · DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS SamuelMimram ÉcolePolytechnique AppliedandComputationalAlgebraicTopology

Directed spaces

Definition (Grandis)A d-space (X,dX) consists of a topological space X togetherwith a set dX of paths, called directed, such that▶ dX contains constant paths▶ dX is closed under composition with increasingreparametrizations I→ I

▶ dX is closed under concatenation

We write dTop for the category whose morphisms preservedirected paths.

The category dTop is complete and cocomplete.

66 / 117

Page 138: DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS · 2017. 4. 23. · DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS SamuelMimram ÉcolePolytechnique AppliedandComputationalAlgebraicTopology

Directed spaces

Definition (Grandis)A d-space (X,dX) consists of a topological space X togetherwith a set dX of paths, called directed, such that▶ dX contains constant paths▶ dX is closed under composition with increasingreparametrizations I→ I

▶ dX is closed under concatenation

We write dTop for the category whose morphisms preservedirected paths.

The category dTop is complete and cocomplete.

66 / 117

Page 139: DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS · 2017. 4. 23. · DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS SamuelMimram ÉcolePolytechnique AppliedandComputationalAlgebraicTopology

Directed spacesExampleAny topological space X can canonically be seen as a d-space intwo ways:▶ take dX the set of all paths in X, or▶ take dX the set of constant paths in X

ExampleThe directed interval I is I = [0, 1] with increasing functionsp : I→ I as directed paths.

67 / 117

Page 140: DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS · 2017. 4. 23. · DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS SamuelMimram ÉcolePolytechnique AppliedandComputationalAlgebraicTopology

Directed spacesExampleAny topological space X can canonically be seen as a d-space intwo ways:▶ take dX the set of all paths in X, or▶ take dX the set of constant paths in X

ExampleThe directed interval I is I = [0, 1] with increasing functionsp : I→ I as directed paths.

67 / 117

Page 141: DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS · 2017. 4. 23. · DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS SamuelMimram ÉcolePolytechnique AppliedandComputationalAlgebraicTopology

Directed spacesExampleAny topological space X can canonically be seen as a d-space intwo ways:▶ take dX the set of all paths in X, or▶ take dX the set of constant paths in X

ExampleThe directed interval I is I = [0, 1] with increasing functionsp : I→ I as directed paths.

ExampleThe directed circle S1 and directed complex plane C:

67 / 117

Page 142: DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS · 2017. 4. 23. · DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS SamuelMimram ÉcolePolytechnique AppliedandComputationalAlgebraicTopology

Directed spacesExampleAny topological space X can canonically be seen as a d-space intwo ways:▶ take dX the set of all paths in X, or▶ take dX the set of constant paths in X

ExampleThe directed interval I is I = [0, 1] with increasing functionsp : I→ I as directed paths.

RemarkFor a d-space (X,dX), there is a bijection

dX ∼= dTop(I,X)

67 / 117

Page 143: DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS · 2017. 4. 23. · DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS SamuelMimram ÉcolePolytechnique AppliedandComputationalAlgebraicTopology

Directed geometric semantics

The category dTop is cocomplete and we have a functor

I : □ → dTop

The directed geometric realization is its extension

Y��

I // dTop

□|−|

==

i.e.|C| =

⨿n∈N

(Cn × In)/ ≈

68 / 117

Page 144: DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS · 2017. 4. 23. · DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS SamuelMimram ÉcolePolytechnique AppliedandComputationalAlgebraicTopology

Directed geometric semantics

The category dTop is cocomplete and we have a functor

I : □ → dTop

The directed geometric realization is its extension

Y��

I // dTop

□|−|

==

i.e.|C| =

⨿n∈N

(Cn × In)/ ≈

68 / 117

Page 145: DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS · 2017. 4. 23. · DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS SamuelMimram ÉcolePolytechnique AppliedandComputationalAlgebraicTopology

Homotopy between pathsTwo paths

p,q : I → X

are homotopic when there there is

h : I→ XI

such that▶ h(0) = p▶ h(1) = q▶ h(t)(0) does not depend on t▶ h(t)(1) does not depend on t

p

q

69 / 117

Page 146: DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS · 2017. 4. 23. · DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS SamuelMimram ÉcolePolytechnique AppliedandComputationalAlgebraicTopology

Dihomotopy between pathsTwo directed paths

p,q : I → X

are dihomotopic when there there is

h : I→ XI

such that▶ h(0) = p▶ h(1) = q▶ h(t)(0) does not depend on t▶ h(t)(1) does not depend on t

p

q

70 / 117

Page 147: DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS · 2017. 4. 23. · DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS SamuelMimram ÉcolePolytechnique AppliedandComputationalAlgebraicTopology

Dihomotopy between pathsTwo directed paths

p,q : I → X

are dihomotopic when there there is

h : I→ XI

such that▶ h(0) = p▶ h(1) = q▶ h(t)(0) does not depend on t▶ h(t)(1) does not depend on t

p

q

70 / 117

Page 148: DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS · 2017. 4. 23. · DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS SamuelMimram ÉcolePolytechnique AppliedandComputationalAlgebraicTopology

The fundamental categoryThe fundamental category Π1(X) of a d-space X has▶ points of X as objects▶ dipaths up to dihomotopy as morphisms

and composition is induced by concatenation.

It coincides with the previous definition: for a precubical set Cthere is a canonical full and faithful functor

Π1(C) ↪→ Π1(|C|)

e.g.· / / ·

·

OO

// ·⋄

OO

↪→

71 / 117

Page 149: DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS · 2017. 4. 23. · DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS SamuelMimram ÉcolePolytechnique AppliedandComputationalAlgebraicTopology

The fundamental categoryThe fundamental category Π1(X) of a d-space X has▶ points of X as objects▶ dipaths up to dihomotopy as morphisms

and composition is induced by concatenation.

It coincides with the previous definition: for a precubical set Cthere is a canonical full and faithful functor

Π1(C) ↪→ Π1(|C|)

e.g.· / / ·

·

OO

// ·⋄

OO

↪→

71 / 117

Page 150: DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS · 2017. 4. 23. · DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS SamuelMimram ÉcolePolytechnique AppliedandComputationalAlgebraicTopology

Directed vs undirected paths

The geometric realization of the programs

Pa;Va;Pb;Vb||Pa;Va;Pb;Vb and Pa;Va;Pb;Vb||Pb;Vb;Pa;Va

are respectively

Pa Va Pb Vb

Pa

Va

Pb

Vb

Pa Va Pb Vb

Pb

Vb

Pa

Va

Note that the underlying spaces are homotopy equivalent!

72 / 117

Page 151: DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS · 2017. 4. 23. · DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS SamuelMimram ÉcolePolytechnique AppliedandComputationalAlgebraicTopology

Dihomotopy vs homotopy

Consider I3 without the interior:

The two dipaths are▶ not dihomotopic

▶ homotopic

73 / 117

Page 152: DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS · 2017. 4. 23. · DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS SamuelMimram ÉcolePolytechnique AppliedandComputationalAlgebraicTopology

Dihomotopy vs homotopy

Consider I3 without the interior:

The two dipaths are▶ not dihomotopic▶ homotopic

73 / 117

Page 153: DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS · 2017. 4. 23. · DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS SamuelMimram ÉcolePolytechnique AppliedandComputationalAlgebraicTopology

Dihomotopy vs homotopy

Consider I3 without the interior:

The two dipaths are▶ not dihomotopic▶ homotopic

73 / 117

Page 154: DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS · 2017. 4. 23. · DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS SamuelMimram ÉcolePolytechnique AppliedandComputationalAlgebraicTopology

Dihomotopy vs homotopy

Consider I3 without the interior:

The two dipaths are▶ not dihomotopic▶ homotopic

73 / 117

Page 155: DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS · 2017. 4. 23. · DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS SamuelMimram ÉcolePolytechnique AppliedandComputationalAlgebraicTopology

Dihomotopy vs homotopy

Consider I3 without the interior:

The two dipaths are▶ not dihomotopic▶ homotopic

73 / 117

Page 156: DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS · 2017. 4. 23. · DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS SamuelMimram ÉcolePolytechnique AppliedandComputationalAlgebraicTopology

Dihomotopy vs homotopy

Consider I3 without the interior:

The two dipaths are▶ not dihomotopic▶ homotopic

73 / 117

Page 157: DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS · 2017. 4. 23. · DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS SamuelMimram ÉcolePolytechnique AppliedandComputationalAlgebraicTopology

Dihomotopy vs homotopy

Consider I3 without the interior:

The two dipaths are▶ not dihomotopic▶ homotopic

73 / 117

Page 158: DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS · 2017. 4. 23. · DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS SamuelMimram ÉcolePolytechnique AppliedandComputationalAlgebraicTopology

Dihomotopy vs homotopy

Consider I3 without the interior:

The two dipaths are▶ not dihomotopic▶ homotopic

73 / 117

Page 159: DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS · 2017. 4. 23. · DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS SamuelMimram ÉcolePolytechnique AppliedandComputationalAlgebraicTopology

Some classical theoremscan be adaptedto this context.

74 / 117

Page 160: DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS · 2017. 4. 23. · DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS SamuelMimram ÉcolePolytechnique AppliedandComputationalAlgebraicTopology

The van Kampen theorem

Given X = U ∪ V, with U,V open, the image of

U ∩ V

��

// U

��V // X

is a pushout in Cat:

Π1(U ∩ V)

��

// Π1(U)

��

Π1(V) // Π1(X)

75 / 117

Page 161: DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS · 2017. 4. 23. · DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS SamuelMimram ÉcolePolytechnique AppliedandComputationalAlgebraicTopology

Dicovering spaces

A theory of dicovering spaces has been developed by Fajstrup.

It is useful in practice in order to unfold loops.

More later on about this (maybe).

76 / 117

Page 162: DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS · 2017. 4. 23. · DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS SamuelMimram ÉcolePolytechnique AppliedandComputationalAlgebraicTopology

DEADLOCKS

77 / 117

Page 163: DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS · 2017. 4. 23. · DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS SamuelMimram ÉcolePolytechnique AppliedandComputationalAlgebraicTopology

DeadlocksApart from “usual problems”, concurrent programs can sufferfrom deadlocks.

In the program

Pa;Pb;Vb;Va || Pb;Pa;Va;Vbconsider the following execution:

s

t

Pa Pb Vb Va

Pb

Pa

Va

Vb

corresponding toP1a · P2b · P1b · P2a

Each of the two processes is waiting for the other! 78 / 117

Page 164: DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS · 2017. 4. 23. · DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS SamuelMimram ÉcolePolytechnique AppliedandComputationalAlgebraicTopology

Deadlocks

DefinitionA deadlock x in the geometric semantics is a point▶ the only path

p : x ↠ y

with x as source is the constant path,▶ x is different form the end point tp.

s

t

Pa Pb Vb Va

Pb

Pa

Va

Vb

79 / 117

Page 165: DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS · 2017. 4. 23. · DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS SamuelMimram ÉcolePolytechnique AppliedandComputationalAlgebraicTopology

Simple programsWe want to find deadlocks for a simple program p with nprocesses:

Sp = In \l∪

i=1

Ri

with

Ri =

n∏j=1

]xij, yij[

e.g.

Pa Pb Vb Va

Pb

Pa

Va

Vb

80 / 117

Page 166: DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS · 2017. 4. 23. · DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS SamuelMimram ÉcolePolytechnique AppliedandComputationalAlgebraicTopology

An algorithm for deadlocks[Fajstrup,Goubault,Raussen]

The deadlock points can be found using the following algorithm:

1. find n intervals Ri1 , . . . ,Rin with∩ni=1 R

ij = ∅

2. compute the point z with zj = max{xi1j , . . . , x

inj

}3. if there is no i with z ∈ Ri then z is a deadlock

81 / 117

Page 167: DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS · 2017. 4. 23. · DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS SamuelMimram ÉcolePolytechnique AppliedandComputationalAlgebraicTopology

An algorithm for deadlocks[Fajstrup,Goubault,Raussen]

The deadlock points can be found using the following algorithm:

1. find n intervals Ri1 , . . . ,Rin with∩ni=1 R

ij = ∅

2. compute the point z with zj = max{xi1j , . . . , x

inj

}3. if there is no i with z ∈ Ri then z is a deadlock

81 / 117

Page 168: DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS · 2017. 4. 23. · DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS SamuelMimram ÉcolePolytechnique AppliedandComputationalAlgebraicTopology

An algorithm for deadlocks[Fajstrup,Goubault,Raussen]

The deadlock points can be found using the following algorithm:

1. find n intervals Ri1 , . . . ,Rin with∩ni=1 R

ij = ∅

2. compute the point z with zj = max{xi1j , . . . , x

inj

}

3. if there is no i with z ∈ Ri then z is a deadlock

81 / 117

Page 169: DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS · 2017. 4. 23. · DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS SamuelMimram ÉcolePolytechnique AppliedandComputationalAlgebraicTopology

An algorithm for deadlocks[Fajstrup,Goubault,Raussen]

The deadlock points can be found using the following algorithm:

1. find n intervals Ri1 , . . . ,Rin with∩ni=1 R

ij = ∅

2. compute the point z with zj = max{xi1j , . . . , x

inj

}3. if there is no i with z ∈ Ri then z is a deadlock

81 / 117

Page 170: DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS · 2017. 4. 23. · DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS SamuelMimram ÉcolePolytechnique AppliedandComputationalAlgebraicTopology

An algorithm for deadlocks[Fajstrup,Goubault,Raussen]

The deadlock points can be found using the following algorithm:

1. find n intervals Ri1 , . . . ,Rin with∩ni=1 R

ij = ∅

2. compute the point z with zj = max{xi1j , . . . , x

inj

}3. if there is no i with z ∈ Ri then z is a deadlock

81 / 117

Page 171: DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS · 2017. 4. 23. · DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS SamuelMimram ÉcolePolytechnique AppliedandComputationalAlgebraicTopology

An algorithm for deadlocks[Fajstrup,Goubault,Raussen]

The deadlock points can be found using the following algorithm:

1. find n intervals Ri1 , . . . ,Rin with∩ni=1 R

ij = ∅

2. compute the point z with zj = max{xi1j , . . . , x

inj

}3. if there is no i with z ∈ Ri then z is a deadlock

81 / 117

Page 172: DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS · 2017. 4. 23. · DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS SamuelMimram ÉcolePolytechnique AppliedandComputationalAlgebraicTopology

An algorithm for deadlocks[Fajstrup,Goubault,Raussen]

The deadlock points can be found using the following algorithm:

1. find n intervals Ri1 , . . . ,Rin with∩ni=1 R

ij = ∅

2. compute the point z with zj = max{xi1j , . . . , x

inj

}3. if there is no i with z ∈ Ri then z is a deadlock

81 / 117

Page 173: DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS · 2017. 4. 23. · DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS SamuelMimram ÉcolePolytechnique AppliedandComputationalAlgebraicTopology

An algorithm for deadlocks[Fajstrup,Goubault,Raussen]

The deadlock points can be found using the following algorithm:

1. find n intervals Ri1 , . . . ,Rin with∩ni=1 R

ij = ∅

2. compute the point z with zj = max{xi1j , . . . , x

inj

}3. if there is no i with z ∈ Ri then z is a deadlock

81 / 117

Page 174: DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS · 2017. 4. 23. · DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS SamuelMimram ÉcolePolytechnique AppliedandComputationalAlgebraicTopology

Lipski’s program

Consider the program with mutexes

Pa;Pb;Pc;Va;Pf;Vc;Vb;Vf|| Pd;Pe;Pa;Vd;Pc;Ve;Va;Vc|| Pb;Pf;Vb;Pd;Vf;Pe;Vd;Ve

Its geometric semantics is

p1

p2

p3

82 / 117

Page 175: DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS · 2017. 4. 23. · DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS SamuelMimram ÉcolePolytechnique AppliedandComputationalAlgebraicTopology

Lipski’s program

Consider the program with mutexes

Pa;Pb;Pc;Va;Pf;Vc;Vb;Vf|| Pd;Pe;Pa;Vd;Pc;Ve;Va;Vc|| Pb;Pf;Vb;Pd;Vf;Pe;Vd;Ve

Its request graph is

a

b

c

d

e

f

Acyclicity of the request graph implies the absence of deadlocks.

82 / 117

Page 176: DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS · 2017. 4. 23. · DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS SamuelMimram ÉcolePolytechnique AppliedandComputationalAlgebraicTopology

The doomed region

A point x is doomed when there is no path

p : x ↠ tp

The doomed region is the subspace of doomed points.

s

t

Pa Pb Vb Va

Pb

Pa

Va

Vb

In other words: a doomed point will eventually reach a deadlock!

83 / 117

Page 177: DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS · 2017. 4. 23. · DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS SamuelMimram ÉcolePolytechnique AppliedandComputationalAlgebraicTopology

The doomed region

If z is a deadlock point as computed by the previous algorithm,then the region

]z′, z]

is doomed with

z′j = max{xikj

∣∣∣ 1 ≤ k ≤ n, xikj = zj}

s

t

Pa Pb Vb Va

Pb

Pa

Va

Vb

z ′

z

84 / 117

Page 178: DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS · 2017. 4. 23. · DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS SamuelMimram ÉcolePolytechnique AppliedandComputationalAlgebraicTopology

The doomed region

To compute the doomed region, we need need to iterate:

R1

R2

R3

Pa Pb Va Pc Vc Vb

Pc

Pa

Va

Pb

Vb

Vc

z

85 / 117

Page 179: DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS · 2017. 4. 23. · DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS SamuelMimram ÉcolePolytechnique AppliedandComputationalAlgebraicTopology

The doomed region

To compute the doomed region, we need need to iterate:

zU

Pa Pb Va Pc Vc Vb

Pc

Pa

Va

Pb

Vb

Vc

85 / 117

Page 180: DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS · 2017. 4. 23. · DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS SamuelMimram ÉcolePolytechnique AppliedandComputationalAlgebraicTopology

The doomed region

To compute the doomed region, we need need to iterate:

Pa Pb Va Pc Vc Vb

Pc

Pa

Va

Pb

Vb

Vc

85 / 117

Page 181: DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS · 2017. 4. 23. · DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS SamuelMimram ÉcolePolytechnique AppliedandComputationalAlgebraicTopology

The doomed region

To compute the doomed region, we need need to iterate:

Pa Pb Va Pc Vc Vb

Pc

Pa

Va

Pb

Vb

Vc

z ′

U ′

85 / 117

Page 182: DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS · 2017. 4. 23. · DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS SamuelMimram ÉcolePolytechnique AppliedandComputationalAlgebraicTopology

The doomed region

To compute the doomed region, we need need to iterate:

Pa Pb Va Pc Vc Vb

Pc

Pa

Va

Pb

Vb

Vc

85 / 117

Page 183: DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS · 2017. 4. 23. · DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS SamuelMimram ÉcolePolytechnique AppliedandComputationalAlgebraicTopology

The unreachable region

Dually, the unreachable region consists of points x for whichthere is no path

p : se ↠ x

s

t

Pa Pb Vb Va

Pb

Pa

Va

Vb

Having dead code is often an indication of a misconception.

86 / 117

Page 184: DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS · 2017. 4. 23. · DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS SamuelMimram ÉcolePolytechnique AppliedandComputationalAlgebraicTopology

PROGRAMSWITH

MUTEXESONLY

87 / 117

Page 185: DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS · 2017. 4. 23. · DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS SamuelMimram ÉcolePolytechnique AppliedandComputationalAlgebraicTopology

Programs with mutexes

The most common case is the one of programs with mutexesonly, i.e. κa = 1.

Otherwise said, all conflicts are binary.

▶ The cubical semantics is determined by cubes in dimension0, 1 and 2 (all possible cubes in higher dimension are filled).

▶ The cubical semantics also satisfies an important propertycalled the cube property.

88 / 117

Page 186: DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS · 2017. 4. 23. · DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS SamuelMimram ÉcolePolytechnique AppliedandComputationalAlgebraicTopology

Programs with mutexes

The most common case is the one of programs with mutexesonly, i.e. κa = 1.

Otherwise said, all conflicts are binary.

▶ The cubical semantics is determined by cubes in dimension0, 1 and 2 (all possible cubes in higher dimension are filled).

▶ The cubical semantics also satisfies an important propertycalled the cube property.

88 / 117

Page 187: DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS · 2017. 4. 23. · DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS SamuelMimram ÉcolePolytechnique AppliedandComputationalAlgebraicTopology

Programs with mutexes

The most common case is the one of programs with mutexesonly, i.e. κa = 1.

Otherwise said, all conflicts are binary.

▶ The cubical semantics is determined by cubes in dimension0, 1 and 2 (all possible cubes in higher dimension are filled).

▶ The cubical semantics also satisfies an important propertycalled the cube property.

88 / 117

Page 188: DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS · 2017. 4. 23. · DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS SamuelMimram ÉcolePolytechnique AppliedandComputationalAlgebraicTopology

The cube property

In a situation such as

Pa||Pa||A =

Pa

xxqqqqqq

qqqqq

A��

Pa

&&MMMMM

MMMMMM

A

��PaKKK

KKKK

%%KKKyyssssss

ssssss

%%KKKKK

KKKKKK

K

Passss

sss

yysssA

��

Pa$$I

IIII

IIII

II x

A�� Pazzuuuuuuuuuuu

y

the vertex x is forbidden (and has to be removed).

In this case, the vertex y has to be removed too, because A = Va!

89 / 117

Page 189: DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS · 2017. 4. 23. · DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS SamuelMimram ÉcolePolytechnique AppliedandComputationalAlgebraicTopology

The cube property

In a situation such as

Pa||Pa||A =

Pa

xxqqqqqq

qqqqq

A��

Pa

&&MMMMM

MMMMMM

A

��PaKKK

KKKK

%%KKKyyssssss

ssssss

%%KKKKK

KKKKKK

K

Passss

sss

yysssA

��

Pa$$I

IIII

IIII

II x

A�� Pazzuuuuuuuuuuu

y

the vertex x is forbidden (and has to be removed).

In this case, the vertex y has to be removed too, because A = Va!

89 / 117

Page 190: DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS · 2017. 4. 23. · DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS SamuelMimram ÉcolePolytechnique AppliedandComputationalAlgebraicTopology

The cube propertySemantics of programs satisfy the cube property:

A

����������

��

C′

��???

????

?

B��

����������

��???

????

? ⋄

B′

��

C ��???

????

? ⋄

A′����������

A

���������� C′

��???

????

?

B�� ��?

????

??? ⋄

����������

B′

��

C ��???

????

? ⋄

��

A′����������

and other more minor properties, e.g.

A

���������� B′

��???

????

?

B��?

????

??? ⋄

A′����������

and

A

���������� B′′

��???

????

?

B��?

????

??? ⋄

A′′����������

implies A′ = A′′ and B′ = B′′.

90 / 117

Page 191: DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS · 2017. 4. 23. · DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS SamuelMimram ÉcolePolytechnique AppliedandComputationalAlgebraicTopology

The cube propertySemantics of programs satisfy the cube property:

A

����������

��

C′

��???

????

?

B��

����������

��???

????

? ⋄

B′

��

C ��???

????

? ⋄

A′����������

A

���������� C′

��???

????

?

B�� ��?

????

??? ⋄

����������

B′

��

C ��???

????

? ⋄

��

A′����������

and other more minor properties, e.g.

A

���������� B′

��???

????

?

B��?

????

??? ⋄

A′����������

and

A

���������� B′′

��???

????

?

B��?

????

??? ⋄

A′′����������

implies A′ = A′′ and B′ = B′′.90 / 117

Page 192: DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS · 2017. 4. 23. · DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS SamuelMimram ÉcolePolytechnique AppliedandComputationalAlgebraicTopology

This has many consequences!

91 / 117

Page 193: DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS · 2017. 4. 23. · DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS SamuelMimram ÉcolePolytechnique AppliedandComputationalAlgebraicTopology

Non-positively curved spaces

Suppose fixed a precubical set C satisfying the cube property.

PropositionThe geometric realization |C| of C is non-positively curved.

Let me:▶ recall the notion of curvature for a metric space▶ recall Gromov’s characterization of non-positively curvedcube complexes

▶ explain how to put a metric on the geometric realization

92 / 117

Page 194: DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS · 2017. 4. 23. · DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS SamuelMimram ÉcolePolytechnique AppliedandComputationalAlgebraicTopology

Non-positively curved spaces

Suppose fixed a precubical set C satisfying the cube property.

PropositionThe geometric realization |C| of C is non-positively curved.

Let me:▶ recall the notion of curvature for a metric space▶ recall Gromov’s characterization of non-positively curvedcube complexes

▶ explain how to put a metric on the geometric realization

92 / 117

Page 195: DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS · 2017. 4. 23. · DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS SamuelMimram ÉcolePolytechnique AppliedandComputationalAlgebraicTopology

Metric spaces

A metric space is a space X equipped with a metricd : X× X→ [0,∞] such that, given x, y, z ∈ X,

(1) point equality: d(x, x) = 0(2) triangle inequality: d(x, z) ≤ d(x, y) + d(y, z)(3) finite distances: d(x, y) <∞(4) separation: d(x, y) = 0 implies x = y(5) symmetry: d(x, y) = d(y, x)

A path p : I→ X is geodesic when

d(p(t),p(t′)) = d(p(0),p(1))(t′ − t)

for 0 ≤ t ≤ t′ ≤ 1.

93 / 117

Page 196: DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS · 2017. 4. 23. · DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS SamuelMimram ÉcolePolytechnique AppliedandComputationalAlgebraicTopology

Metric spaces

A metric space is a space X equipped with a metricd : X× X→ [0,∞] such that, given x, y, z ∈ X,

(1) point equality: d(x, x) = 0(2) triangle inequality: d(x, z) ≤ d(x, y) + d(y, z)(3) finite distances: d(x, y) <∞(4) separation: d(x, y) = 0 implies x = y(5) symmetry: d(x, y) = d(y, x)

A path p : I→ X is geodesic when

d(p(t),p(t′)) = d(p(0),p(1))(t′ − t)

for 0 ≤ t ≤ t′ ≤ 1.

93 / 117

Page 197: DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS · 2017. 4. 23. · DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS SamuelMimram ÉcolePolytechnique AppliedandComputationalAlgebraicTopology

Non-positively curved spaces▶ A geodesic triangle ∆(x, y, z) in a metric space X consistsof three points x, y, z and geodesics joining any pairs.

▶ A comparison triangle for a geodesic triangle ∆(x, y, z)consists of an isometry − : ∆(x, y, z) → R2 whose image∆(x, y, z) is a geodesic triangle.

DefinitionA geodesic space is CAT(0) if for every geodesic triangle∆(x, y, z), there exists a comparison triangle ∆(x, y, z) such thatfor every points p,q ∈ ∆(x, y, z), we have d(p,q) ≤ dR2(p,q).

A locally CAT(0) space is callednon-positively curved (NPC).

94 / 117

Page 198: DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS · 2017. 4. 23. · DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS SamuelMimram ÉcolePolytechnique AppliedandComputationalAlgebraicTopology

Non-positively curved spaces▶ A geodesic triangle ∆(x, y, z) in a metric space X consistsof three points x, y, z and geodesics joining any pairs.

▶ A comparison triangle for a geodesic triangle ∆(x, y, z)consists of an isometry − : ∆(x, y, z) → R2 whose image∆(x, y, z) is a geodesic triangle.

DefinitionA geodesic space is CAT(0) if for every geodesic triangle∆(x, y, z), there exists a comparison triangle ∆(x, y, z) such thatfor every points p,q ∈ ∆(x, y, z), we have d(p,q) ≤ dR2(p,q).

A locally CAT(0) space is callednon-positively curved (NPC).

94 / 117

Page 199: DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS · 2017. 4. 23. · DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS SamuelMimram ÉcolePolytechnique AppliedandComputationalAlgebraicTopology

Non-positively curved spaces▶ A geodesic triangle ∆(x, y, z) in a metric space X consistsof three points x, y, z and geodesics joining any pairs.

▶ A comparison triangle for a geodesic triangle ∆(x, y, z)consists of an isometry − : ∆(x, y, z) → R2 whose image∆(x, y, z) is a geodesic triangle.

DefinitionA geodesic space is CAT(0) if for every geodesic triangle∆(x, y, z), there exists a comparison triangle ∆(x, y, z) such thatfor every points p,q ∈ ∆(x, y, z), we have d(p,q) ≤ dR2(p,q).

A locally CAT(0) space is callednon-positively curved (NPC).

94 / 117

Page 200: DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS · 2017. 4. 23. · DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS SamuelMimram ÉcolePolytechnique AppliedandComputationalAlgebraicTopology

Non-positively curved spaces▶ A geodesic triangle ∆(x, y, z) in a metric space X consistsof three points x, y, z and geodesics joining any pairs.

▶ A comparison triangle for a geodesic triangle ∆(x, y, z)consists of an isometry − : ∆(x, y, z) → R2 whose image∆(x, y, z) is a geodesic triangle.

DefinitionA geodesic space is CAT(0) if for every geodesic triangle∆(x, y, z), there exists a comparison triangle ∆(x, y, z) such thatfor every points p,q ∈ ∆(x, y, z), we have d(p,q) ≤ dR2(p,q).

A locally CAT(0) space is callednon-positively curved (NPC).

94 / 117

Page 201: DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS · 2017. 4. 23. · DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS SamuelMimram ÉcolePolytechnique AppliedandComputationalAlgebraicTopology

Positively curved spaces

Typical examples of positively curved spaces:

xy

x y

For realizations of precubical sets with the cube property, we canexpect that this does not happen!

95 / 117

Page 202: DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS · 2017. 4. 23. · DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS SamuelMimram ÉcolePolytechnique AppliedandComputationalAlgebraicTopology

Positively curved spaces

Typical examples of positively curved spaces:

xy

x y

For realizations of precubical sets with the cube property, we canexpect that this does not happen!

95 / 117

Page 203: DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS · 2017. 4. 23. · DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS SamuelMimram ÉcolePolytechnique AppliedandComputationalAlgebraicTopology

Metric realizationThe interval I = [0, 1] can be equipped with the standardeuclidean distance.

This induces a functor

□ → Met

n 7→ In

which extends as a metric realization functor

□Y��

// Met

==

excepting that▶ I did not tell you what the morphisms of Met are

▶ the category Met is not cocomplete

96 / 117

Page 204: DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS · 2017. 4. 23. · DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS SamuelMimram ÉcolePolytechnique AppliedandComputationalAlgebraicTopology

Metric realizationThe interval I = [0, 1] can be equipped with the standardeuclidean distance.

This induces a functor

□ → Met

n 7→ In

which extends as a metric realization functor

□Y��

// Met

==

excepting that▶ I did not tell you what the morphisms of Met are

▶ the category Met is not cocomplete

96 / 117

Page 205: DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS · 2017. 4. 23. · DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS SamuelMimram ÉcolePolytechnique AppliedandComputationalAlgebraicTopology

Metric realizationThe interval I = [0, 1] can be equipped with the standardeuclidean distance.

This induces a functor

□ → Met

n 7→ In

which extends as a metric realization functor

□Y��

// Met

==

excepting that▶ I did not tell you what the morphisms of Met are

▶ the category Met is not cocomplete

96 / 117

Page 206: DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS · 2017. 4. 23. · DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS SamuelMimram ÉcolePolytechnique AppliedandComputationalAlgebraicTopology

Metric realizationThe interval I = [0, 1] can be equipped with the standardeuclidean distance.

This induces a functor

□ → Met

n 7→ In

which extends as a metric realization functor

□Y��

// Met

==

excepting that▶ I did not tell you what the morphisms of Met are

▶ the category Met is not cocomplete

96 / 117

Page 207: DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS · 2017. 4. 23. · DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS SamuelMimram ÉcolePolytechnique AppliedandComputationalAlgebraicTopology

Metric realizationThe interval I = [0, 1] can be equipped with the standardeuclidean distance.

This induces a functor

□ → Met

n 7→ In

which extends as a metric realization functor

□Y��

// Met

==

excepting that▶ I did not tell you what the morphisms of Met are▶ the category Met is not cocomplete

96 / 117

Page 208: DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS · 2017. 4. 23. · DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS SamuelMimram ÉcolePolytechnique AppliedandComputationalAlgebraicTopology

Generalizing metric spaces

DefinitionA metric space is a space X equipped with a metricd : X× X→ [0,∞] such that, given x, y, z ∈ X,

(1) point equality: d(x, x) = 0(2) triangle inequality: d(x, z) ≤ d(x, y) + d(y, z)(3) finite distances: d(x, y) <∞(4) separation: d(x, y) = 0 implies x = y(5) symmetry: d(x, y) = d(y, x)

We consider contracting maps f : X→ Y:

dY(f(x), f(x′)) ≤ dX(x, x

′)

Unfortunately, the resulting category is not cocomplete!

97 / 117

Page 209: DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS · 2017. 4. 23. · DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS SamuelMimram ÉcolePolytechnique AppliedandComputationalAlgebraicTopology

Generalizing metric spaces

DefinitionA metric space is a space X equipped with a metricd : X× X→ [0,∞] such that, given x, y, z ∈ X,

(1) point equality: d(x, x) = 0(2) triangle inequality: d(x, z) ≤ d(x, y) + d(y, z)(3) finite distances: d(x, y) <∞(4) separation: d(x, y) = 0 implies x = y(5) symmetry: d(x, y) = d(y, x)

Intuitively, X+ Y should be such that

d(x, y) = ∞

for x ∈ X and y ∈ Y.

97 / 117

Page 210: DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS · 2017. 4. 23. · DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS SamuelMimram ÉcolePolytechnique AppliedandComputationalAlgebraicTopology

Generalizing metric spaces

DefinitionA metric space is a space X equipped with a metricd : X× X→ [0,∞] such that, given x, y, z ∈ X,

(1) point equality: d(x, x) = 0(2) triangle inequality: d(x, z) ≤ d(x, y) + d(y, z)(3) finite distances: d(x, y) <∞(4) separation: d(x, y) = 0 implies x = y(5) symmetry: d(x, y) = d(y, x)

Consider the relation ≈ on X identifying a family of points (xi)i∈Nsuch that d(xi, y) = 1/i for some y

x1 x2 x3 x4 x5 y

Intuitively, in X/ ≈, we should have d([xi], [y]) = 0.97 / 117

Page 211: DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS · 2017. 4. 23. · DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS SamuelMimram ÉcolePolytechnique AppliedandComputationalAlgebraicTopology

Generalizing metric spaces

DefinitionA metric space is a space X equipped with a metricd : X× X→ [0,∞] such that, given x, y, z ∈ X,

(1) point equality: d(x, x) = 0(2) triangle inequality: d(x, z) ≤ d(x, y) + d(y, z)(3) finite distances: d(x, y) <∞(4) separation: d(x, y) = 0 implies x = y(5) symmetry: d(x, y) = d(y, x)

We can encode direction in the distance!

d(x, y) =∧{

ρ− θ∣∣∣ x = ei2πθ, y = ei2πρ, ρ ≥ θ

}

97 / 117

Page 212: DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS · 2017. 4. 23. · DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS SamuelMimram ÉcolePolytechnique AppliedandComputationalAlgebraicTopology

Generalized metric spaces

Definition (Lawvere)A generalized metric space is a space X equipped with a metricd : X× X→ [0,∞] such that, given x, y, z ∈ X,

(1) point equality: d(x, x) = 0(2) triangle inequality: d(x, z) ≤ d(x, y) + d(y, z)

The category GMet enjoys the following:▶ the category GMet is complete and cocomplete,▶ the forgetful functor GMet → Set has left and right adjoints,▶ the forgetful functor GMet → Top preserves finite (co)limits.

98 / 117

Page 213: DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS · 2017. 4. 23. · DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS SamuelMimram ÉcolePolytechnique AppliedandComputationalAlgebraicTopology

Generalized metric spaces

Definition (Lawvere)A generalized metric space is a space X equipped with a metricd : X× X→ [0,∞] such that, given x, y, z ∈ X,

(1) point equality: d(x, x) = 0(2) triangle inequality: d(x, z) ≤ d(x, y) + d(y, z)

The category GMet enjoys the following:▶ the category GMet is complete and cocomplete,▶ the forgetful functor GMet → Set has left and right adjoints,▶ the forgetful functor GMet → Top preserves finite (co)limits.

98 / 117

Page 214: DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS · 2017. 4. 23. · DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS SamuelMimram ÉcolePolytechnique AppliedandComputationalAlgebraicTopology

Directed metric realizationWe write I for the directed interval [0, 1] equipped with

d(x, y) =

{y− x if y ≥ x

∞ if y < x

The product In is equipped with

d((x1, . . . , xn), (y1, . . . , yn)) = d(x1, y1) ∨ . . . ∨ d(xn, yn)

The geometric realization of a precubical set C is

|C| =

∫ n∈□Cn · In

PropositionFor finite-dimensional precubical sets, geometric realizationcommutes with forgetful functor GMet → Top and producesgeodesic length spaces.

99 / 117

Page 215: DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS · 2017. 4. 23. · DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS SamuelMimram ÉcolePolytechnique AppliedandComputationalAlgebraicTopology

Directed metric realizationWe write I for the directed interval [0, 1] equipped with

d(x, y) =

{y− x if y ≥ x

∞ if y < x

The product In is equipped with

d((x1, . . . , xn), (y1, . . . , yn)) = d(x1, y1) ∨ . . . ∨ d(xn, yn)

The geometric realization of a precubical set C is

|C| =

∫ n∈□Cn · In

PropositionFor finite-dimensional precubical sets, geometric realizationcommutes with forgetful functor GMet → Top and producesgeodesic length spaces.

99 / 117

Page 216: DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS · 2017. 4. 23. · DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS SamuelMimram ÉcolePolytechnique AppliedandComputationalAlgebraicTopology

Directed metric realizationWe write I for the directed interval [0, 1] equipped with

d(x, y) =

{y− x if y ≥ x

∞ if y < x

The product In is equipped with

d((x1, . . . , xn), (y1, . . . , yn)) = d(x1, y1) ∨ . . . ∨ d(xn, yn)

The geometric realization of a precubical set C is

|C| =

∫ n∈□Cn · In

PropositionFor finite-dimensional precubical sets, geometric realizationcommutes with forgetful functor GMet → Top and producesgeodesic length spaces.

99 / 117

Page 217: DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS · 2017. 4. 23. · DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS SamuelMimram ÉcolePolytechnique AppliedandComputationalAlgebraicTopology

Directed metric realizationWe write I for the directed interval [0, 1] equipped with

d(x, y) =

{y− x if y ≥ x

∞ if y < x

The product In is equipped with

d((x1, . . . , xn), (y1, . . . , yn)) = d(x1, y1) ∨ . . . ∨ d(xn, yn)

The geometric realization of a precubical set C is

|C| =

∫ n∈□Cn · In

PropositionFor finite-dimensional precubical sets, geometric realizationcommutes with forgetful functor GMet → Top and producesgeodesic length spaces.

99 / 117

Page 218: DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS · 2017. 4. 23. · DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS SamuelMimram ÉcolePolytechnique AppliedandComputationalAlgebraicTopology

Colimits in GMet vs Top

Colimits in GMet do not necessarily coincide with those in Top.

Write In for the space I = [0, 1] equipped with dn(x, y) = |y− x|/n.

Consider the colimit

I∞ =⨿n∈N

In/ ≈0

I1

I2

I31

where ≈ identifies 0 (resp. 1) in various In.

We have d(0, 1) = 0 and therefore the points 0 and 1 are notseparated in I∞.

100 / 117

Page 219: DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS · 2017. 4. 23. · DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS SamuelMimram ÉcolePolytechnique AppliedandComputationalAlgebraicTopology

Colimits in GMet vs Top

Colimits in GMet do not necessarily coincide with those in Top.

Write In for the space I = [0, 1] equipped with dn(x, y) = |y− x|/n.

Consider the colimit

I∞ =⨿n∈N

In/ ≈0

I1

I2

I31

where ≈ identifies 0 (resp. 1) in various In.

We have d(0, 1) = 0 and therefore the points 0 and 1 are notseparated in I∞.

100 / 117

Page 220: DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS · 2017. 4. 23. · DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS SamuelMimram ÉcolePolytechnique AppliedandComputationalAlgebraicTopology

Colimits in GMet vs Top

Colimits in GMet do not necessarily coincide with those in Top.

Write In for the space I = [0, 1] equipped with dn(x, y) = |y− x|/n.

Consider the colimit

I∞ =⨿n∈N

In/ ≈0

I1

I2

I31

where ≈ identifies 0 (resp. 1) in various In.

We have d(0, 1) = 0 and therefore the points 0 and 1 are notseparated in I∞.

100 / 117

Page 221: DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS · 2017. 4. 23. · DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS SamuelMimram ÉcolePolytechnique AppliedandComputationalAlgebraicTopology

Colimits in GMet vs Top

Colimits in GMet do not necessarily coincide with those in Top.

Write In for the space I = [0, 1] equipped with dn(x, y) = |y− x|/n.

Consider the colimit

I∞ =⨿n∈N

In/ ≈0

I1

I2

I31

where ≈ identifies 0 (resp. 1) in various In.

We have d(0, 1) = 0 and therefore the points 0 and 1 are notseparated in I∞.

100 / 117

Page 222: DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS · 2017. 4. 23. · DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS SamuelMimram ÉcolePolytechnique AppliedandComputationalAlgebraicTopology

Gromov’s theoremReformulating “flag links condition” in our setting:

Theorem (Gromov)The geometric realization of a precubical set is NPC if and only iffit satisfies the cube property.

Such a space is locally uniquely geodesic. In particular, directedpaths are local geodesics:

an analogue of the least action principle

Moreover, it enjoys many nice properties:▶ greedy normal forms for paths,▶ universal cover is CAT(0),▶ fundamental group is automatic,▶ …

101 / 117

Page 223: DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS · 2017. 4. 23. · DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS SamuelMimram ÉcolePolytechnique AppliedandComputationalAlgebraicTopology

Gromov’s theoremReformulating “flag links condition” in our setting:

Theorem (Gromov)The geometric realization of a precubical set is NPC if and only iffit satisfies the cube property.

Such a space is locally uniquely geodesic. In particular, directedpaths are local geodesics:

an analogue of the least action principle

Moreover, it enjoys many nice properties:▶ greedy normal forms for paths,▶ universal cover is CAT(0),▶ fundamental group is automatic,▶ …

101 / 117

Page 224: DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS · 2017. 4. 23. · DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS SamuelMimram ÉcolePolytechnique AppliedandComputationalAlgebraicTopology

Gromov’s theoremReformulating “flag links condition” in our setting:

Theorem (Gromov)The geometric realization of a precubical set is NPC if and only iffit satisfies the cube property.

Such a space is locally uniquely geodesic. In particular, directedpaths are local geodesics:

an analogue of the least action principle

Moreover, it enjoys many nice properties:▶ greedy normal forms for paths,▶ universal cover is CAT(0),▶ fundamental group is automatic,▶ …

101 / 117

Page 225: DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS · 2017. 4. 23. · DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS SamuelMimram ÉcolePolytechnique AppliedandComputationalAlgebraicTopology

A small example

ConsiderPa || Pa || Pa

whose realization of geometric semantics is

a mutex

a of arity 2

NPC

not NPC

102 / 117

Page 226: DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS · 2017. 4. 23. · DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS SamuelMimram ÉcolePolytechnique AppliedandComputationalAlgebraicTopology

A small example

ConsiderPa || Pa || Pa

whose realization of geometric semantics is

a mutex a of arity 2NPC not NPC

102 / 117

Page 227: DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS · 2017. 4. 23. · DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS SamuelMimram ÉcolePolytechnique AppliedandComputationalAlgebraicTopology

Gromov’s conditionGiven a precubical set

z3

y1a′3 ��

a′′2>>}}}}}}α3 y2

a′1``AAAAAA

a′′3��z2 xα2

a1AAA

``AA

a3��

a2}}}

>>}}

α1 z1

y3a′′1

``AAAAAA a′2

>>}}}}}}

and a vertex x, we can define a simplicial complex

a1α3

α2 AAAA

AAAA

a2

α1}}}}}}}}

a3

called the link of x.103 / 117

Page 228: DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS · 2017. 4. 23. · DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS SamuelMimram ÉcolePolytechnique AppliedandComputationalAlgebraicTopology

Gromov’s conditionA simplicial complex is flag when every boundary of an n-simplexis filled, for n ≥ 2.

Theorem (Gromov’87)A finite dimensional cubed complex is NPC if and only if the link ofevery vertex is flag.

a1α3

α2 AAAA

AAAA

a2

α1}}}}}}}}

a3

⇒a1

α3

α2 AAAA

AAAA

A

a2

α1}}}}}}}}

a3

z3

y1a′3 ��

a′′2>>}}}}}}α3 y2

a′1``AAAAAA

a′′3��z2 xα2

a1AAA

``AA

a3��

a2}}}

>>}}

α1 z1

y3a′′1

``AAAAAA a′2

>>}}}}}}

z3

��y1

a′3��

a′′2??~~~~~~

β1 x′ y2β2

a′1__@@@@@@

a′′3��

z2

??~~~~~~β3 z1

__@@@@@@

y3a′′1

``AAAAAA a′2

>>}}}}}}

Given a precubical set

and a vertex x, we can define a simplicial complex

104 / 117

Page 229: DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS · 2017. 4. 23. · DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS SamuelMimram ÉcolePolytechnique AppliedandComputationalAlgebraicTopology

Gromov’s conditionA simplicial complex is flag when every boundary of an n-simplexis filled, for n ≥ 2.

Theorem (Gromov’87)A finite dimensional cubed complex is NPC if and only if the link ofevery vertex is flag.

a1α3

α2 AAAA

AAAA

a2

α1}}}}}}}}

a3

⇒a1

α3

α2 AAAA

AAAA

A

a2

α1}}}}}}}}

a3

z3

y1a′3 ��

a′′2>>}}}}}}α3 y2

a′1``AAAAAA

a′′3��z2 xα2

a1AAA

``AA

a3��

a2}}}

>>}}

α1 z1

y3a′′1

``AAAAAA a′2

>>}}}}}}

z3

��y1

a′3��

a′′2??~~~~~~

β1 x′ y2β2

a′1__@@@@@@

a′′3��

z2

??~~~~~~β3 z1

__@@@@@@

y3a′′1

``AAAAAA a′2

>>}}}}}}

Given a precubical set

and a vertex x, we can define a simplicial complex

104 / 117

Page 230: DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS · 2017. 4. 23. · DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS SamuelMimram ÉcolePolytechnique AppliedandComputationalAlgebraicTopology

Gromov’s conditionA simplicial complex is flag when every boundary of an n-simplexis filled, for n ≥ 2.

Theorem (Gromov’87)A finite dimensional cubed complex is NPC if and only if the link ofevery vertex is flag.

a1α3

α2 AAAA

AAAA

a2

α1}}}}}}}}

a3

⇒a1

α3

α2 AAAA

AAAA

A

a2

α1}}}}}}}}

a3

z3

y1a′3 ��

a′′2>>}}}}}}α3 y2

a′1``AAAAAA

a′′3��z2 xα2

a1AAA

``AA

a3��

a2}}}

>>}}

α1 z1

y3a′′1

``AAAAAA a′2

>>}}}}}}

z3

��y1

a′3��

a′′2??~~~~~~

β1 x′ y2β2

a′1__@@@@@@

a′′3��

z2

??~~~~~~β3 z1

__@@@@@@

y3a′′1

``AAAAAA a′2

>>}}}}}}

Given a precubical set

and a vertex x, we can define a simplicial complex

104 / 117

Page 231: DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS · 2017. 4. 23. · DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS SamuelMimram ÉcolePolytechnique AppliedandComputationalAlgebraicTopology

Gromov’s conditionA simplicial complex is flag when every boundary of an n-simplexis filled, for n ≥ 2.

Theorem (Gromov’87)A finite dimensional cubed complex is NPC if and only if the link ofevery vertex is flag.

a1α3

α2 AAAA

AAAA

a2

α1}}}}}}}}

a3

⇒a1

α3

α2 AAAA

AAAA

A

a2

α1}}}}}}}}

a3

z3

y1a′3 ��

a′′2>>}}}}}}α3 y2

a′1``AAAAAA

a′′3��z2 xα2

a1AAA

``AA

a3��

a2}}}

>>}}

α1 z1

y3a′′1

``AAAAAA a′2

>>}}}}}}

z3

��y1

a′3��

a′′2??~~~~~~

β1 x′ y2β2

a′1__@@@@@@

a′′3��

z2

??~~~~~~β3 z1

__@@@@@@

y3a′′1

``AAAAAA a′2

>>}}}}}}

Given a precubical set

and a vertex x, we can define a simplicial complex

104 / 117

Page 232: DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS · 2017. 4. 23. · DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS SamuelMimram ÉcolePolytechnique AppliedandComputationalAlgebraicTopology

Gromov’s conditionA simplicial complex is flag when every boundary of an n-simplexis filled, for n ≥ 2.

Theorem (Gromov’87)A finite dimensional cubed complex is NPC if and only if the link ofevery vertex is flag.

a1α3

α2 AAAA

AAAA

a2

α1}}}}}}}}

a3

⇒a1

α3

α2 AAAA

AAAA

A

a2

α1}}}}}}}}

a3

z3

y1a′3 ��

a′′2>>}}}}}}α3 y2

a′1``AAAAAA

a′′3��z2 xα2

a1AAA

``AA

a3��

a2}}}

>>}}

α1 z1

y3a′′1

``AAAAAA a′2

>>}}}}}}

z3

��y1

a′3��

a′′2??~~~~~~

β1 x′ y2β2

a′1__@@@@@@

a′′3��

z2

??~~~~~~β3 z1

__@@@@@@

y3a′′1

``AAAAAA a′2

>>}}}}}}

Given a precubical set

and a vertex x, we can define a simplicial complex

104 / 117

Page 233: DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS · 2017. 4. 23. · DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS SamuelMimram ÉcolePolytechnique AppliedandComputationalAlgebraicTopology

Some other propertiesof NPC precubical sets

105 / 117

Page 234: DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS · 2017. 4. 23. · DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS SamuelMimram ÉcolePolytechnique AppliedandComputationalAlgebraicTopology

Dihomotopy vs homotopy

PropositionIn (the geometric realization of) C two directed paths arehomotopic if and only if they are dihomotopic.

Otherwise said, there is a faithful functor

Π1(C) ↪→ Π1(C)

106 / 117

Page 235: DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS · 2017. 4. 23. · DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS SamuelMimram ÉcolePolytechnique AppliedandComputationalAlgebraicTopology

Universal directed coversare easy to define

for NPC precubical sets

107 / 117

Page 236: DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS · 2017. 4. 23. · DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS SamuelMimram ÉcolePolytechnique AppliedandComputationalAlgebraicTopology

Covering spaces

A covering space of X is a space which can be obtained from Xby “unrolling” some of its loops.

p−→

The universal covering is the initial (= most general) pointedcovering of a space X.

108 / 117

Page 237: DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS · 2017. 4. 23. · DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS SamuelMimram ÉcolePolytechnique AppliedandComputationalAlgebraicTopology

Covering spaces

A morphism p : Y → X is covering when every x ∈ X admits aneighborhood U such that p−1(U) is a disjoint union of homeo-morphic copies of U.

p−→

The universal covering is the initial (= most general) pointedcovering of a space X.

108 / 117

Page 238: DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS · 2017. 4. 23. · DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS SamuelMimram ÉcolePolytechnique AppliedandComputationalAlgebraicTopology

Covering spaces

A morphism p : Y → X is covering when every x ∈ X admits aneighborhood U such that p−1(U) is a disjoint union of homeo-morphic copies of U.

p−→

The universal covering is the initial (= most general) pointedcovering of a space X.

108 / 117

Page 239: DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS · 2017. 4. 23. · DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS SamuelMimram ÉcolePolytechnique AppliedandComputationalAlgebraicTopology

Covering spaces

A morphism p : Y → X is covering when every x ∈ X admits aneighborhood U such that p−1(U) is a disjoint union of homeo-morphic copies of U.

p−→

The universal covering is the initial (= most general) pointedcovering of a space X.

It is the simply connected covering of X.

108 / 117

Page 240: DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS · 2017. 4. 23. · DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS SamuelMimram ÉcolePolytechnique AppliedandComputationalAlgebraicTopology

Covering spaces

A morphism p : Y → X is covering when every x ∈ X admits aneighborhood U such that p−1(U) is a disjoint union of homeo-morphic copies of U.

p−→

The universal covering is the initial (= most general) pointedcovering of a space X.

Given x ∈ X, the universal covering space of X can be describedas the space of paths

x↠ y

with a suitable topology.

108 / 117

Page 241: DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS · 2017. 4. 23. · DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS SamuelMimram ÉcolePolytechnique AppliedandComputationalAlgebraicTopology

Dicovering spacesFor dicovering spaces can consider:

1. the universal dicovering: every x ∈ X admits a neighborhoodU such that p−1(U) is a disjoint union of dihomeomorphiccopies of U,

2. the space of dipaths up to dihomotopy from a fixed point.

They do not coincide in general: the space of dipaths is

x

p−→x

whereas identity is the only dicovering in the sense of 1.

However, for NPC spaces, they do coincide!

109 / 117

Page 242: DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS · 2017. 4. 23. · DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS SamuelMimram ÉcolePolytechnique AppliedandComputationalAlgebraicTopology

Dicovering spacesFor dicovering spaces can consider:

1. the universal dicovering: every x ∈ X admits a neighborhoodU such that p−1(U) is a disjoint union of dihomeomorphiccopies of U,

2. the space of dipaths up to dihomotopy from a fixed point.

They do not coincide in general: the space of dipaths is

x

p−→x

whereas identity is the only dicovering in the sense of 1.

However, for NPC spaces, they do coincide!

109 / 117

Page 243: DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS · 2017. 4. 23. · DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS SamuelMimram ÉcolePolytechnique AppliedandComputationalAlgebraicTopology

Dicovering spacesFor dicovering spaces can consider:

1. the universal dicovering: every x ∈ X admits a neighborhoodU such that p−1(U) is a disjoint union of dihomeomorphiccopies of U,

2. the space of dipaths up to dihomotopy from a fixed point.

They do not coincide in general: the space of dipaths is

x

p−→x

whereas identity is the only dicovering in the sense of 1.

However, for NPC spaces, they do coincide!

109 / 117

Page 244: DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS · 2017. 4. 23. · DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS SamuelMimram ÉcolePolytechnique AppliedandComputationalAlgebraicTopology

They correspond toconfiguration spacesof event structures

110 / 117

Page 245: DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS · 2017. 4. 23. · DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS SamuelMimram ÉcolePolytechnique AppliedandComputationalAlgebraicTopology

Event structures

An event structure (E,≤,#) consists of▶ a poset (E,≤) of events▶ a binary relation # called incompatibility

such that

▶ finite causes: for every event e, the set{e′ ∈ E

∣∣ e′ ≤ e}

is finite,▶ hereditary incompatibility: for every events e1, e2, e′2,

e1#e2 and e2 ≤ e′2 implies e1#e′2

111 / 117

Page 246: DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS · 2017. 4. 23. · DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS SamuelMimram ÉcolePolytechnique AppliedandComputationalAlgebraicTopology

Event structures

An event structure (E,≤,#) consists of▶ a poset (E,≤) of events▶ a binary relation # called incompatibility

such that▶ finite causes: for every event e, the set{

e′ ∈ E∣∣ e′ ≤ e

}is finite,

▶ hereditary incompatibility: for every events e1, e2, e′2,

e1#e2 and e2 ≤ e′2 implies e1#e′2

111 / 117

Page 247: DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS · 2017. 4. 23. · DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS SamuelMimram ÉcolePolytechnique AppliedandComputationalAlgebraicTopology

Event structures

An event structure (E,≤,#) consists of▶ a poset (E,≤) of events▶ a binary relation # called incompatibility

such that▶ finite causes: for every event e, the set{

e′ ∈ E∣∣ e′ ≤ e

}is finite,

▶ hereditary incompatibility: for every events e1, e2, e′2,

e1#e2 and e2 ≤ e′2 implies e1#e′2

111 / 117

Page 248: DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS · 2017. 4. 23. · DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS SamuelMimram ÉcolePolytechnique AppliedandComputationalAlgebraicTopology

Configuration spaces

A configuration of an event structure is a downward closed setof events.

For instance, in the event structure

b c /o/o/o c′

a

>>>>>>>>

��������

oooooooooooooo

the configurations are:

∅ {a} {a,b} {a, c}{a, c′

}{a,b, c}

{a,b, c′

}

112 / 117

Page 249: DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS · 2017. 4. 23. · DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS SamuelMimram ÉcolePolytechnique AppliedandComputationalAlgebraicTopology

Configuration spaces

A configuration of an event structure is a downward closed setof events.

For instance, in the event structure

b c /o/o/o c′

a

>>>>>>>>

��������

oooooooooooooo

the configurations are:

∅ {a} {a,b} {a, c}{a, c′

}{a,b, c}

{a,b, c′

}

112 / 117

Page 250: DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS · 2017. 4. 23. · DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS SamuelMimram ÉcolePolytechnique AppliedandComputationalAlgebraicTopology

Configuration spacesThe configuration space of an event structure has▶ vertices: the configurations▶ edges: an edge x→ y when y = x ⊎ {e}▶ n-cubes for n ≥ 2: fill all possible cubes

d /o/o/o/o d′

b

yyyyyyyyyc

EEEEEEEEEE

a

333333

abcd abcd′

abc

ddJJJJJ99ttttt

ab

::ttttt⋄ ac

eeKKKKKK

a

eeKKKKKK99ssssss

OO

113 / 117

Page 251: DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS · 2017. 4. 23. · DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS SamuelMimram ÉcolePolytechnique AppliedandComputationalAlgebraicTopology

Configuration spacesThe configuration space of an event structure has▶ vertices: the configurations▶ edges: an edge x→ y when y = x ⊎ {e}▶ n-cubes for n ≥ 2: fill all possible cubes

d /o/o/o/o d′

b

yyyyyyyyyc

EEEEEEEEEE

a

333333

abcd abcd′

abc

ddJJJJJ99ttttt

ab

::ttttt⋄ ac

eeKKKKKK

a

eeKKKKKK99ssssss

OO

113 / 117

Page 252: DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS · 2017. 4. 23. · DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS SamuelMimram ÉcolePolytechnique AppliedandComputationalAlgebraicTopology

Configuration spaces

The configuration space of an event structure is always a CAT(0)precubical set:

Theorem (Chepoi, Ardila-Owen-Sullivant, Goubault-M.)The rooted (globally) CAT(0) precubical sets are in bijection withevent structures.

114 / 117

Page 253: DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS · 2017. 4. 23. · DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS SamuelMimram ÉcolePolytechnique AppliedandComputationalAlgebraicTopology

Configuration spaces

The configuration space of an event structure is always a CAT(0)precubical set:

Theorem (Chepoi, Ardila-Owen-Sullivant, Goubault-M.)The rooted (globally) CAT(0) precubical sets are in bijection withevent structures.

114 / 117

Page 254: DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS · 2017. 4. 23. · DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS SamuelMimram ÉcolePolytechnique AppliedandComputationalAlgebraicTopology

CONCLUSION

115 / 117

Page 255: DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS · 2017. 4. 23. · DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS SamuelMimram ÉcolePolytechnique AppliedandComputationalAlgebraicTopology

Conclusion

This was only a very brief overview, we can also mention:▶ applications in verification of programs▶ the geometry of tracespaces▶ applications to distributed computing▶ directed topology: from groupoids to categories(e.g. directed homology)

▶ directed homotopy type theory

116 / 117

Page 256: DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS · 2017. 4. 23. · DIRECTED GEOMETRIC MODELSOF CONCURRENT PROGRAMS SamuelMimram ÉcolePolytechnique AppliedandComputationalAlgebraicTopology

Thanks!

117 / 117