Title: Tiling Transactions in Rewriting Logic
1Tiling Transactions in Rewriting Logic
WRLA 2002 Pisa, Italia, 19-21 Sept. 2002
- Roberto Bruni (Pisa/Illinois)
- José Meseguer (Illinois)
- Ugo Montanari (Pisa)
- Research supported by
- IST-2001-32747 Project AGILE
- Italian MIUR Project COMETA
- ONR Grant N00014-02-1-0715
- CNR Fellowship on Information Sciences and
Technologies
2Outline
- Transactions
- Zero-Safe Nets (shortly)
- A Word on Adjunctions Coreflections
- Zero-Safe Nets as Tiles
- Tiling Transactions
- Example Minimal Communication Tree
- Conclusions Future Work
3Mission
- Fully General Notion of Concurrent Transaction
- Graphical Representation
- Formal Specification
- Refined and Abstract view
- Refinement morphism
- (Distributed Commit)
4Transactions one, no one, one hundred thousands
- In databases
- a transaction groups actions into a single
logical unit which terminates either with a
commit or with an abort - the commit operation permanently applies all the
changes to the database, making them visible - the abort operation cancels all the changes, as
they were never executed - ACID Atomic, Consistent, Isolated, Durable
- Several variants
- transactions with checkpoints, hierarchical,
timed, long-lived, nested, with compensation
5Distributed Transactions
- In global computing applications
- data integration and process cooperation is
required across sites and organizations - different platforms, policies, data formats
- Multi-way transactions
- distributed processes start local transactions,
then - they interact by exchanging information and
joining their transactions - they must agree on commit/abort
6Theory, Pragmatics Ethics
- What are the abstract models?
- Mathematical description
- How do they relate to concrete model?
- How to define formal abstraction/refinement
techniques? - TM Servers can be overloaded
- A dedicated machine is necessary (e.g. .NET)
- Distribution is important
- When two or more organizations participate in the
same transaction, which TM should take control? - Mediator trusted sites
- Inter-corporation agreement
7Zero-Safe Nets
stable places
zero places
transitions
tokens
8Zero-Safe Nets
stable places
zero places
transitions
tokens
9Example Multicasting I
Administrator
Interacting Processes
new
send
buffer
2
copy
receive
connect
Disconnected Processes
10Parallel composition ?
11Horizontal Composition
12Transaction
13Example Multicasting II
Administrator
Abstract Net
Interacting Processes
new
2
3
n1
1-to-1
connect
1-to-2
1-to-n
2
3
n1
Disconnected Processes
14Main Features of ZS Nets
- Graphical Presentation
- Formal Theory
- Horizontal states in S?
- Vertical states in Z? (observations)
- Horizontal composition as coordination
- parallel composition on (horizontal) states
- sequential composition on observations
- Abstraction / Refinement
- Refinement morphism
- Abstraction via coreflection
- Concurrent Transactions Distributed Interpreter
- Portability under Orthogonal Flavors of Nets
- coloured, reconfigurable, dynamic, probabilistic,
timed, with read and inhibitor arcs, with
priorities,
15Objects Messages
- Object Messages as Places in Coloured Nets
- Rewrites as Transitions
- Partitioning stable/zero used to model
participation in transactions (for objects) and
transactional messages - Example A Day at WRLA2002
- Objects participants, overhead projector,
beamer, microphone, - Messages words, gestures,
- Transitions speaking, moving, changing slides,
- Transactions presentations, intervals,
- (TM chair-men, organizers, )
16A Constructive View of Adjunctions
B
A
17A Constructive View of Adjunctions
B
F(A)
F
A
18A Constructive View of Adjunctions
What is the best approximation of b?
B
b
F(A)
F
A
19A Constructive View of Adjunctions
What is the best approximation of b?
B
b
F(A)
F
A
20A Constructive View of Adjunctions
What is the best approximation of b?
B
b
F(A)
F
A
21Adjunctions Formally
B
A
b
For any b?B
22Adjunctions Formally
B
A
?b
F(Gb)
b
Gb
We want to find a Gb?A with approximation ?b
F(Gb)?b ? B which is universal
23Adjunctions Formally
B
A
?b
F(Gb)
b
Gb
g
F(a)
a
i.e., any other approximation (via a?A) g F(a)?b
? B factorizes uniquely through ?b
24Adjunctions Formally
B
A
?b
F(Gb)
b
Gb
g
F(g)
g
F(a)
a
i.e., ?! g a?Gb ? A such that g F (g) gb ?
?bb?B is called the counit
25Duality
B
F(A)
F
A
26Duality
B
F(A)
F
G
G(B)
A
27Duality
B
F(A)
F
?b
Gb
F(Gb)
b
G
G(B)
A
?b
Gb
F(Gb)
b
28Duality
B
F(A)
F
?b
Gb
F(Gb)
b
G
G(B)
h
A
?b
Gb
F(Gb)
b
29Duality
B
F(A)
F
?b
Gb
F(Gb)
b
G
G(B)
?b h
A
?b h
Gb
F(Gb)
30Duality
?a idF(a) is called the unit
B
F(A)
F
?F(a)
GF(a)
F(GF(a))
F(a)
F(a)
F(a)
G
G(B)
idF(a)
A
idF(a)
a
F(a)
31Adjunctions Properties
- Left Adjoints (e.g. F) preserve Colimits
- Right Adjoints (e.g. G) preserve Limits
- (Co)Limits are the categorical way of expressing
operations - ? Adjunctions are Compositional Interpretations
- Typical Scenario
- B has more structure than A
- G is the obvious forgetful functor
- F is the best way of adding the extra structure
to A
32Building Transactions I
objects ZS nets whose transitions possess ?,,
id arrows disjoint graph homomorphisms,
preserving place partitioning and all operations
on transitions
HCatZPetri
objects ZS nets arrows graph homomorphisms,
preserving place partitioning disjoint image
property for zero places
ZPetri
33Building Transactions II
- Given N?ZPetri, take Z(N)
- arrows from u?S? to v?S? are the concurrent
transactions of N - Prime arrows are the basic transactions of N
- from u?S? to v?S?
- non decomposable in parallel
- e.g., in the multicast example, each basic
transaction contains at most one sender
34Coreflection
when ?a a?G(F(a)) is a natural iso
B
F(A)
F
G
G(B)
A
35Coreflection
when ?a a?G(F(a)) is a natural iso, then A can
be seen as a subcategory of B, with F the
inclusion
B
A
36Coreflection
when ?a a?G(F(a)) is a natural iso, then A can
be seen as a subcategory of B, with F the
inclusion
B
A
- Typical Scenario
- B category of operational models
- A category of abstract models
- G(b) is the same as b when observed from A
37Abstract Net via Coreflection
objects ZS nets arrows refinement morphisms
ZSN
Petri
- A refinement morphism R N1? N2
- is a zero-safe net morphism R N1? Z(N2)
- that maps transitions of N1
- either to prime arrows of Z(N2)
- or to transitions of N2
38From Nets to Computads
- Can we generalize the ZS approach?
- Meta-theory for transactions
- formal models
- fully general notion refinement / abstraction
- Extension of the distributed commit algorithm
- Petri Nets based on multiset rewriting
- Zero-Safe Nets bidimensional multiset rewriting
- horizontal composition computes transactions
- vertical composition builds computations on the
abstract net - RL TL seem to be the natural candidates
39RL 2-Computads
- Main Ingredients of Rewriting Logic
- Signature ? of system configurations
- Structural axioms E
- Rewrite rules over tE
- Categorically (in the initial model)
- States form a cartesian category L?,E the
Lawvere Theory associated with (?,E) - underlined natural number as objects
- substitutions as arrows
- composition substitution application
- Proof terms form a cartesian 2-category
- 2-Computad
- Monoidal category of configurations C
- Rewrite rules over the arrows of C
40Nets as 2-Computads
- S? seen as monoidal category
- unique object 0
- u?S? seen as an arrow u0?0
- sequential composition tensor product
- uv u?v
- Transitions as rewrites
- pre-set source
- post-set target
41RL TL
- In (Unconditional) RL
- Rewrites ? f(x)?g(x) can be applied
- in any context C. C?(x) Cf(x) ?Cg(x)
- with any argument p(y) ?(p(y)) f(p(y)) ?g(p(y))
- Horizontal composition is total
- In TL
- Rewrites are coordinated via observations
- applicable in context if C accept the effect of ?
- applicable with argument p if it provides the
trigger - Horizontal composition is partial
42TL D-Computads
- Main Ingredients of Tile Logic
- (?H,EH) system configurations
- (?V,EV) Observations
- Tiles ? pEH ? ? ? qEH
- D-Computad
- Monoidal category of configurations H
- Monoidal category of observations V
- Tiles over the arrows of H and C
uEV
vEV
43ZS Nets as D-Computads
- S? , Z? seen as monoidal categories
- unique object 0
- u?S? seen as a configuration u0?0
- a?Z? seen as an observation a0?0
- (S?Z)? S? ? Z?
- sequential composition tensor product
- uv u?v
- ab a?b
- Transitions as tiles
- stable pre-set initial configuration (north)
- stable post-set final configuration (south)
- zero pre-set trigger (west)
- zero post-set effect (east)
44Tiling Transactions I
objects D-Computads whose tiles possess ?,,
id arrows disjoint D-Computad morphisms,
preserving all operations on tiles
HCatZComp
objects D-Computads arrows disjoint D-Computads
morphisms (on observations injective on
objects, faithful on arrows)
ZComp
45Tiling Transactions II
- Given D?ZComp, take D(D)
- cells with indentities as trigger and effect are
the concurrent transactions of D - Elementary cells are the basic transactions of D
- trigger is an identity
- effect is an identity
- minimal
- non decomposable in parallel
- non decomposable sequentially
- without unnecessary idle configurations
46Tiling Transactions III
D recovers Z
HCatZComp
HCatZPetri
D
forgets ?,, id
ZPetri
ZComp
47Abstraction via Coreflection I
objects D-Computads arrows refinement morphisms
Rcomp
2Comp
- A refinement morphism M D1? D2
- is a disjoint D-Computad morphism M D1? D(D2)
- that maps tiles of D1
- either to elementary elements of D(D2)
- or to tiles of D2
48Abstraction via Coreflection II
Ad recovers AZ
ZSN
Rcomp
Petri
2Comp
Ad
49Example CCS-like PC
P 0 ?.P PP
action prefix is frozen
?.P
PQ
PQ
id
?
id
?
??id
???
act
lpar
com
P
PQ
PQ
PQ
?
id??
rpar
PQ
50Example a Tile Transaction
51Abstract Communications
__
__
__
__
__
__
__
P3
P2
P4
P5
P6
P7
P8
P1
52Abstract Communications
__
__
__
__
__
__
__
P3
P2
P4
P5
P6
P7
P8
P1
53Abstract Communications
__
__
__
__
__
__
__
P3
P2
P4
P5
P6
P7
P8
P1
54Abstract Communications
__
__
__
__
__
__
__
P3
P2
P4
P5
P6
P7
P8
P1
55Abstract Communications
__
__
__
__
__
__
__
P3
P2
P4
P5
P6
P7
P8
P1
56Abstract Communications
(X1(a.X2X3))(X4(a.X5X6))
__
Each time, we want to consider just the most
general context, which is essential to the
interaction
?
(X1(X2X3))(X4(X5X6))
__
__
__
X1
X4
__
a.X2
X3
a.X5
X6
57Abstract Communications
(X1(a.X2X3))(X4a.X5)
__
?
OK
(X1(X2X3))(X4X5)
__
__
__
X1
X4
a.X5
a.X2
X3
58Abstract Communications
(X1a.X2)(X3(X4a.X5))
__
?
OK
(X1X2)(X3(X4X5))
__
__
a.X2
X1
__
X3
X4
a.X5
59Abstract Communications
(X1a.X2)((X3X4)a.X5)
__
?
NO!
(X1X2)((X3X4)X5)
__
__
a.X2
X1
__
a.X5
X3
X4
60Abstract Communications
__
Concurrent rewrites
__
__
a.X2
X1
__
a.X4
b.Y1
b.Y2
61Conclusions Future Work
- We have fully generalized the ZS approach
- Refinement morphisms between Tiles
- Abstract Rewrite Theory (aka 2-computad)
- Compositional specification of transactions
- To investigate
- Connection with conditional RL
62- Tiling Transactions in RL
- a paper by Roberto Bruni
- José Meseguer
- Ugo Montanari
- a WRLA presentation by Roberto Bruni
- Research supported by
- IST-2001-32747 Project AGILE
- Italian MIUR Project COMETA
- ONR Grant N00014-02-1-0715
- CNR Fellowship on Inf. Sci. and Techn.
- Electronic watercolor by Roberto Bruni