A Geometric Approach to the Problem of Unique Decomposition of Processes I Thibaut Balabonski & Emmanuel Haucourt Geometric Semantics PPS Université Paris Diderot LIST CEA Definition of Independence Decomposition Theorem CONCUR’10: September 3 Implementation T. Balabonski & E. Haucourt Geometric Decomposition of Processes — CONCUR’10: September 3 — 1/22 Concurrent programming Background • A set of concurrent processes • Some shared resources I Geometric Semantics Definition of Independence Decomposition Theorem Tools for peaceful interaction • Semaphores • Synchronisation barriers • Communications • ... Implementation T. Balabonski & E. Haucourt Geometric Decomposition of Processes — CONCUR’10: September 3 — 2/22 A toy language for semaphores Two instructions Pa Take one occurrence of a. Va Release a. I Geometric Semantics Each semaphore a is characterized by its arity. Definition of Independence Decomposition Theorem Implementation T. Balabonski & E. Haucourt Geometric Decomposition of Processes — CONCUR’10: September 3 — 3/22 Nontrivial independence k k k I Geometric Semantics Definition of Independence a, b c π1 π2 π3 π4 = Pa.Pc.Vc.Va = Pa.Pc.Vc.Va = Pb.Pc.Vc.Vb = Pb.Pc.Vc.Vb mutual exclusion two occurrences Decomposition Theorem Implementation T. Balabonski & E. Haucourt Geometric Decomposition of Processes — CONCUR’10: September 3 — 4/22 Nontrivial independence k k k I Geometric Semantics Definition of Independence a, b c π1 π2 π3 π4 = Pa.Pc.Vc.Va = Pa.Pc.Vc.Va = Pb.Pc.Vc.Vb = Pb.Pc.Vc.Vb mutual exclusion two occurrences Decomposition Theorem Implementation T. Balabonski & E. Haucourt Geometric Decomposition of Processes — CONCUR’10: September 3 — 4/22 Nontrivial independence k k k I Geometric Semantics Definition of Independence a, b c π1 π2 π3 π4 = Pa. = Pa. = Pb. = Pb. Va Va Vb Vb mutual exclusion two occurrences Decomposition Theorem Implementation T. Balabonski & E. Haucourt Geometric Decomposition of Processes — CONCUR’10: September 3 — 4/22 Roadmap 1 A Geometric Semantics for Concurrence 2 Semantic Definition of Independence 3 A General Decomposition Theorem 4 Implementation T. Balabonski & E. Haucourt Geometric Decomposition of Processes — CONCUR’10: September 3 — 5/22 A Geometric Semantics for Concurrence Interpreting programs by Euclidean spaces. Semantic Definition of Independence A General Decomposition Theorem Implementation T. Balabonski & E. Haucourt Geometric Decomposition of Processes — CONCUR’10: September 3 — 6/22 One process, one dimension Pa.Pb.Vb.Va IGeometric Semantics Definition of Independence · Pa · Pb · Vb · Va · Decomposition Theorem Implementation T. Balabonski & E. Haucourt Geometric Decomposition of Processes — CONCUR’10: September 3 — 6/22 Two processes, two dimensions ? Pa.Pb.Vb.Va k Pb.Pa.Va.Vb · · · · · · · · · · · · · · · · · · · · Vb IGeometric Semantics Va Pa Definition of Independence Pb · Pa · Pb · Vb · Va · Decomposition Theorem Implementation T. Balabonski & E. Haucourt Geometric Decomposition of Processes — CONCUR’10: September 3 — 7/22 Two processes, two dimensions ? Pa.Pb.Vb.Va k Pb.Pa.Va.Vb · · · · · · · · · · · · · · · · · · · · Vb IGeometric Semantics Va Pa Definition of Independence Pb · Pa · Pb · Vb · Va · Decomposition Theorem Implementation T. Balabonski & E. Haucourt Geometric Decomposition of Processes — CONCUR’10: September 3 — 7/22 Euclidean spaces with holes Pa.Pb.Vb.Va k Pb.Pa.Va.Vb Vb IGeometric Semantics Va Pa Pb Definition of Independence Decomposition Theorem Pa Pb Vb Va Implementation T. Balabonski & E. Haucourt Geometric Decomposition of Processes — CONCUR’10: September 3 — 8/22 Euclidean spaces with holes Pa.Pb.Vb.Va k Pb.Pa.Va.Vb Vb IGeometric Semantics Va Fa Pa Pb Definition of Independence Decomposition Theorem Pa Pb Vb Va Implementation T. Balabonski & E. Haucourt Geometric Decomposition of Processes — CONCUR’10: September 3 — 8/22 Euclidean spaces with holes Pa.Pb.Vb.Va k Pb.Pa.Va.Vb Vb IGeometric Semantics Va Fb Pa Pb Definition of Independence Decomposition Theorem Pa Pb Vb Va Implementation T. Balabonski & E. Haucourt Geometric Decomposition of Processes — CONCUR’10: September 3 — 8/22 Euclidean spaces with holes Pa.Pb.Vb.Va k Pb.Pa.Va.Vb Vb IGeometric Semantics Va F Pa Pb Definition of Independence Decomposition Theorem Pa Pb Vb Va Implementation T. Balabonski & E. Haucourt Geometric Decomposition of Processes — CONCUR’10: September 3 — 8/22 A 3D example π1 = Pa.Pc.Vc.Va k π2 = Pa.Pc.Vc.Va k π3∗ = Pc.Vc IGeometric Semantics Fa Fc Definition of Independence Decomposition Theorem Implementation T. Balabonski & E. Haucourt Geometric Decomposition of Processes — CONCUR’10: September 3 — 9/22 A Geometric Semantics for Concurrence Semantic Definition of Independence Cartesian product and factorization are the key. A General Decomposition Theorem Implementation T. Balabonski & E. Haucourt Geometric Decomposition of Processes — CONCUR’10: September 3 — 10/22 Independence of programs Geometric Semantics Σ1 independent from Σ2 : Σ2 has no effect on the execution of Σ1 . IDefinition of Independence Semantic definition Σ1 and Σ2 are independent iff J Σ1 k Σ2 K = J Σ1 K × J Σ2 K Decomposition Theorem Implementation T. Balabonski & E. Haucourt Geometric Decomposition of Processes — CONCUR’10: September 3 — 10/22 Independent programs: an example Geometric Semantics Pa.Pc.Vc.Va k Pa.Pc.Vc.Va Pc.Vc IDefinition of Independence Decomposition Theorem Pa.Pc.Vc.Va k Pa.Pc.Vc.Va k Pc.Vc Implementation T. Balabonski & E. Haucourt Geometric Decomposition of Processes — CONCUR’10: September 3 — 11/22 Algebraic notions Irreducibles A decomposition always exists. Primes Any decomposition is unique. Prime element x: if x|y1 ...yn then there is i such that x|yi T. Balabonski & E. Haucourt Geometric Decomposition of Processes — CONCUR’10: September 3 — 12/22 A Geometric Semantics for Concurrence Semantic Definition of Independence A General Decomposition Theorem Homogeneous tuples of coordinates, up to permutation. Implementation T. Balabonski & E. Haucourt Geometric Decomposition of Processes — CONCUR’10: September 3 — 13/22 Homogeneous sets of words Geometric Semantics Definition of Independence N-dimensional geometric objects • Point: N-uple of coordinates. • Box: N-uple of intervals. • Gist: word of length N. (on a given alphabet) IDecomposition Theorem Implementation T. Balabonski & E. Haucourt Geometric Decomposition of Processes — CONCUR’10: September 3 — 13/22 Homogeneous sets of words Geometric Semantics Definition of Independence N-dimensional geometric objects • Point: N-uple of coordinates. • Box: N-uple of intervals. • Gist: word of length N. (on a given alphabet) IDecomposition Theorem Homogeneous sets of words Sets whose elements have the same length. Implementation T. Balabonski & E. Haucourt Geometric Decomposition of Processes — CONCUR’10: September 3 — 13/22 Product of sets Geometric Semantics Definition of Independence Cartesian product Concatenation of all pairs. IDecomposition Theorem × = With homogeneous sets: dim(S1 × S2 ) = dim(S1 ) + dim(S2 ) Implementation T. Balabonski & E. Haucourt Geometric Decomposition of Processes — CONCUR’10: September 3 — 14/22 Permutation of coordinates Geometric Semantics Gap Definition of Independence Parallel composition should be commutative, Cartesian product is not. IDecomposition Theorem Permutation of coordinates (group action) Homogeneous monoid: quotient by permutation. Implementation T. Balabonski & E. Haucourt Geometric Decomposition of Processes — CONCUR’10: September 3 — 15/22 Factorization result Geometric Semantics Definition of Independence Equivalence Theorem On the homogeneous monoid, Irreducibility = Primality IDecomposition Theorem Factorization Corollary Each element of the homogeneous monoid has a unique finest decomposition. Implementation T. Balabonski & E. Haucourt Geometric Decomposition of Processes — CONCUR’10: September 3 — 16/22 A Geometric Semantics for Concurrence Semantic Definition of Independence A General Decomposition Theorem Implementation The constructive side of the factorization result. T. Balabonski & E. Haucourt Geometric Decomposition of Processes — CONCUR’10: September 3 — 17/22 A Galois connection γ(F) := Families of n-cubes S F Subsets of Rn α(A) := {maximal cubes of A} T. Balabonski & E. Haucourt Geometric Decomposition of Processes — CONCUR’10: September 3 — 17/22 Cubical Areas Subsets of Rn with finitely many maximal cubes. T. Balabonski & E. Haucourt Geometric Decomposition of Processes — CONCUR’10: September 3 — 18/22 The ALCOOL analyzer: features Geometric Semantics Definition of Independence Decomposition Theorem IImplementation • Based on the structure of cubical areas. • Recognizes an extension of the PV language. • Detects deadlocks, overflows, unreachable states... • Factorizes concurrent programs. • Modelling of loops in progress. T. Balabonski & E. Haucourt Geometric Decomposition of Processes — CONCUR’10: September 3 — 19/22 Algorithm: An Example Geometric Semantics Definition of Independence Decomposition Theorem IImplementation T. Balabonski & E. Haucourt k k k π1 π2 π3 π4 = Pa.Pc.Vc.Va = Pb.Pc.Vc.Vb = Pa.Pc.Vc.Va = Pb.Pc.Vc.Vb Geometric Decomposition of Processes — CONCUR’10: September 3 — 20/22 Algorithm: The State Space Geometric Semantics Definition of Independence Decomposition Theorem IImplementation T. Balabonski & E. Haucourt [0, 1[ [0, 1[ [0, 1[ [0, 1[ [4, ∞[ [4, ∞[ [4, ∞[ [4, ∞[ [0, ∞[ [0, ∞[ [0, ∞[ [0, ∞[ [0, ∞[ [0, ∞[ [0, ∞[ [0, ∞[ × × × × × × × × × × × × × × × × [0, 1[ [4, ∞[ [0, ∞[ [0, ∞[ [0, 1[ [4, ∞[ [0, ∞[ [0, ∞[ [0, 1[ [0, 1[ [4, ∞[ [4, ∞[ [0, ∞[ [0, ∞[ [0, ∞[ [0, ∞[ × × × × × × × × × × × × × × × × [0, ∞[ [0, ∞[ [0, ∞[ [0, ∞[ [0, ∞[ [0, ∞[ [0, ∞[ [0, ∞[ [0, 1[ [4, ∞[ [0, 1[ [4, ∞[ [0, 1[ [0, 1[ [4, ∞[ [4, ∞[ × × × × × × × × × × × × × × × × [0, ∞[ [0, ∞[ [0, 1[ [4, ∞[ [0, ∞[ [0, ∞[ [0, 1[ [4, ∞[ [0, ∞[ [0, ∞[ [0, ∞[ [0, ∞[ [0, 1[ [4, ∞[ [0, 1[ [4, ∞[ Geometric Decomposition of Processes — CONCUR’10: September 3 — 20/22 Algorithm: testing {2, 3} T. Balabonski & E. Haucourt [0, 1[ [0, 1[ [4, ∞[ [4, ∞[ × [0, ∞[ × [0, ∞[ × [0, 1[ [4, ∞[ [0, 1[ [4, ∞[ [0, ∞[ [0, ∞[ × [0, ∞[ × [0, 1[ × [0, 1[ [4, ∞[ [0, ∞[ [0, ∞[ × [0, ∞[ × [4, ∞[ × [0, 1[ [4, ∞[ [0, 1[ [4, ∞[ × [0, 1[ × [0, ∞[ × [0, ∞[ [0, ∞[ [0, 1[ [4, ∞[ × [4, ∞[ × [0, ∞[ × [0, ∞[ [0, ∞[ [0, ∞[ [0, ∞[ [0, ∞[ [0, ∞[ × × × × [0, 1[ [0, 1[ [4, ∞[ [4, ∞[ × × × × [0, 1[ [4, ∞[ [0, 1[ [4, ∞[ × × × × [0, ∞[ [0, ∞[ [0, ∞[ [0, ∞[ Geometric Decomposition of Processes — CONCUR’10: September 3 — 20/22 Algorithm: testing {2, 4} [0, 1[ [4, ∞[ [0, ∞[ [0, ∞[ × [0, 1[ [0, 1[ [4, ∞[ [0, ∞[ [0, ∞[ × [4, ∞[ [0, 1[ [4, ∞[ [0, ∞[ [0, ∞[ [0, 1[ [4, ∞[ [0, ∞[ [0, ∞[ T. Balabonski & E. Haucourt × × [0, ∞[ [0, ∞[ × [0, ∞[ [0, ∞[ [0, 1[ [4, ∞[ × [0, ∞[ × [0, ∞[ [0, ∞[ [0, 1[ [4, ∞[ × [0, ∞[ × [0, ∞[ [0, ∞[ [0, 1[ [4, ∞[ × [0, 1[ × [0, ∞[ [0, ∞[ [0, 1[ [4, ∞[ × [4, ∞[ Geometric Decomposition of Processes — CONCUR’10: September 3 — 20/22 Some tests Example 6 philosophers 7 philosophers 8 philosophers 9 philosophers 10 philosophers Example Σ2,2 Σ2,2,2 Σ3,3 Σ2,2,2,2 Σ4,4 Σ3,3,3 Σ4,5 Σ5,5 Time 0.1 0.1 0.13 0.13 1 1.5 6.1 50 T. Balabonski & E. Haucourt Time 0.2 0.7 3.5 21 152 Decomp. No No No No No Time is given in seconds. Decomposition {1, 3}{2, 4} {1, 4}{2, 5}{3, 6} {1, 3, 5}{2, 4, 6} {1, 5}{2, 6}{3, 7}{4, 8} {1, 3, 5, 7}{2, 4, 6, 8} {1, 4, 7}{2, 5, 8}{3, 6, 9} {1, 3, 5, 7}{2, 4, 6, 8, 9} {1, 3, 5, 7, 9}{2, 4, 6, 8, 10} Example Σ02,2 Σ02,2,2 Σ03,3 Σ02,2,2,2 Σ04,4 Σ03,3,3 Σ04,5 Σ05,5 Time 0.1 0.3 0.52 7.1 33 293 327 2875 Decomp. No No No No No No No No Geometric Decomposition of Processes — CONCUR’10: September 3 — 21/22 Conclusion Geometric Semantics Definition of Independence Decomposition Theorem Implementation • Geometry is cool. • Cubical areas can model several mainstream concurrent primitives. • “Torical” areas give support for loops. • Relation to algebraic topology and directed homotopy. I T. Balabonski & E. Haucourt Geometric Decomposition of Processes — CONCUR’10: September 3 — 22/22