Tutorial Perti Nets Geeraerts

Embed Size (px)

Citation preview

  • 8/13/2019 Tutorial Perti Nets Geeraerts

    1/341

  • 8/13/2019 Tutorial Perti Nets Geeraerts

    2/341

    Introduction

    2

  • 8/13/2019 Tutorial Perti Nets Geeraerts

    3/341

    Introduction

    Concurrency: propertyof a system in whichmany entities actat the same time and

    interact. Often found in many application: Computer science (e.g.: parallel computing)

    Workflow Manufacturing systems

    ....

    3

  • 8/13/2019 Tutorial Perti Nets Geeraerts

    4/341

    Introduction

    Concurrenc

    4

  • 8/13/2019 Tutorial Perti Nets Geeraerts

    5/341

    Introduction

    Concurrenc

    Work in parallel4

  • 8/13/2019 Tutorial Perti Nets Geeraerts

    6/341

    Introduction

    Concurrenc

    Work in parallel

    Must wait for thetwo other machines

    4

  • 8/13/2019 Tutorial Perti Nets Geeraerts

    7/341

    Can write orread on the DB

    Can write or

    read on the DB

    Introduction

    Concurrenc

    5

  • 8/13/2019 Tutorial Perti Nets Geeraerts

    8/341

    Introduction

    ConcurrencBoss

    6

  • 8/13/2019 Tutorial Perti Nets Geeraerts

    9/341

    Introduction

    ConcurrencBoss

    6

  • 8/13/2019 Tutorial Perti Nets Geeraerts

    10/341

    Introduction

    ConcurrencBoss

    Employees: work in parallel6

  • 8/13/2019 Tutorial Perti Nets Geeraerts

    11/341

  • 8/13/2019 Tutorial Perti Nets Geeraerts

    12/341

  • 8/13/2019 Tutorial Perti Nets Geeraerts

    13/341

    Introduction

    ConcurrencBoss

    Employees: work in parallel

    gives work

    6

  • 8/13/2019 Tutorial Perti Nets Geeraerts

    14/341

    Introduction

    ConcurrencBoss

    Employees: work in parallel

    gives workreceives creditfor the results

    6

  • 8/13/2019 Tutorial Perti Nets Geeraerts

    15/341

    Introduction

    Petri netsare a tool to modelconcurrent systems andreasonabout them.

    Inventedin 1962 by C.A.Petri.

    7

  • 8/13/2019 Tutorial Perti Nets Geeraerts

    16/341

    The aim of the talk

    Introduceyou to Petri nets (and some oftheir extensions)

    Explain several analysis methods for PN i.e., what can you ask about a PN ?

    Give a rough idea of the researchin theverification groupat ULB...

    ... and foster new collaborations?

    8

  • 8/13/2019 Tutorial Perti Nets Geeraerts

    17/341

    How I use Petri nets

    template T Max(T a,

    T b)

    {

    return a < b ? b : a;

    }

    #include

    int main() // fonction main

    {

    int i = Max(3, 5);

    char c = Max('e', 'b');

    std::string s = Max(std::string

    ("hello"), std::string("world"));

    float f = Max(1, 2.2f);

    p1

    p2

    p4

    p5

    p3

    p6 p7

    t1

    t3

    t4

    t5 t6t2

    t7 t8

    2

    Analysis methodof PN

    abstraction

    9

  • 8/13/2019 Tutorial Perti Nets Geeraerts

    18/341

    Howyoumight use PN

    p1

    p2

    p4

    p5

    p3

    p6 p7

    t1

    t3

    t4

    t5 t6t2

    t7 t8

    2

    Analysis methodof PN

    abstraction

    Your favorite

    application

    10

  • 8/13/2019 Tutorial Perti Nets Geeraerts

    19/341

    Intuitions

    11

  • 8/13/2019 Tutorial Perti Nets Geeraerts

    20/341

    Ingredients

    A Petri net is made up of...

    Places

    Transitions

    Tokens

    = some type of resource

    consume and produceresources

    = one unity of acertain resource

    Tokens live in the places12

  • 8/13/2019 Tutorial Perti Nets Geeraerts

    21/341

  • 8/13/2019 Tutorial Perti Nets Geeraerts

    22/341

    Firing a transition

    2

    3

    Transitions consumetokens from the inputplacesand produce tokens in the outputplaces

    14

  • 8/13/2019 Tutorial Perti Nets Geeraerts

    23/341

    Firing a transition

    2

    3

    Transitions consumetokens from the inputplacesand produce tokens in the outputplaces

    Now, the transition

    cannot be fired anymore15

  • 8/13/2019 Tutorial Perti Nets Geeraerts

    24/341

    Example 1

    Can write or

    read on the DB

    Can write orread on the DB

    The two machines cannot write at the

    same time16

  • 8/13/2019 Tutorial Perti Nets Geeraerts

    25/341

    Example1

    read

    write

    idle

    write

    read

    idle

    The tokentells us the stateof the process17

  • 8/13/2019 Tutorial Perti Nets Geeraerts

    26/341

    Example1

    read

    write

    idle

    write

    read

    idle

    The tokentells us the stateof the process18

  • 8/13/2019 Tutorial Perti Nets Geeraerts

    27/341

    Example1

    read

    write

    idle

    write

    read

    idle

    The tokentells us the stateof the process19

  • 8/13/2019 Tutorial Perti Nets Geeraerts

    28/341

    Example1

    read

    write

    idle

    write

    read

    idle

    The tokentells us the stateof the process20

  • 8/13/2019 Tutorial Perti Nets Geeraerts

    29/341

    Example1

    read

    write

    idle

    write

    read

    idle

    The tokentells us the stateof the process21

  • 8/13/2019 Tutorial Perti Nets Geeraerts

    30/341

    Example 1read

    write

    idle

    write

    read

    idle

    Add a lockto ensure mutual exclusion22

  • 8/13/2019 Tutorial Perti Nets Geeraerts

    31/341

    Example 1read

    write

    idle

    write

    idle

    23

  • 8/13/2019 Tutorial Perti Nets Geeraerts

    32/341

    Example 2

    p1

    p2

    p3

    t1

    t3 t2

    mutexM ;

    Process P {

    repeat {

    take M ;

    critical;

    release M ; }

    }

    24

  • 8/13/2019 Tutorial Perti Nets Geeraerts

    33/341

    Example 2

    p1

    p2

    p3

    t1

    t3 t2

    mutexM ;

    Process P {

    repeat {

    take M ;

    critical;

    release M ; }

    }

    Here, we have applied a counting abstraction24

  • 8/13/2019 Tutorial Perti Nets Geeraerts

    34/341

    Plan of the talk

    Preliminaries Toolsfor the analysis of PN

    reachability tree and reachability graph

    place invariants Karp & Miller and the coverability set

    The coverability problem Moreon PN: extensions... Conclusion

    25

  • 8/13/2019 Tutorial Perti Nets Geeraerts

    35/341

    Plan of the talk

    Preliminaries Toolsfor the analysis of PN

    reachability tree and reachability graph

    place invariants Karp & Miller and the coverability set

    The coverability problem Moreon PN: extensions... Conclusion

    Detailedcoverage

    Survey

    25

  • 8/13/2019 Tutorial Perti Nets Geeraerts

    36/341

    Preliminaries

    26

  • 8/13/2019 Tutorial Perti Nets Geeraerts

    37/341

    Formal definition

    A Petri netis a tuple P,Twhere:

    Pis the (finite) set of places

    Tis the (finite) set of transitions. Eachtransition tis a tuple I,Owhere:

    I: is a function s.t. tconsumesI(p) tokensin each place p

    Ois a function s.t. tproducesO(p)tokens in each place p

    27

  • 8/13/2019 Tutorial Perti Nets Geeraerts

    38/341

    Example

    2

    3

    tp1

    p2

    p5

    p4

    p3

    I(p1)=2 I(p2)=1 I(p3)=0 I(p4)=0 I(p5)=0O(p1)=0 O(p2)=0 O(p3)=1 O(p4)=3 O(p5)=1

    28

  • 8/13/2019 Tutorial Perti Nets Geeraerts

    39/341

    Markings

    The distribution of the tokens in the placesis formalised by the notion of marking, which

    can be seen:

    either as a functionm, s.t. m(p) is thenumber of tokensin place p

    or as a vectorm=m1, m2,... mnwheremi is the number of tokensin place pi

    29

  • 8/13/2019 Tutorial Perti Nets Geeraerts

    40/341

    Example

    2

    3

    tp1

    p2

    p5

    p4

    p3

    m =1,1,1,2,0m = p1, p2, p3, 2p4

    m(p1)=1, m(p2)=1, m(p3)=1, m(p4)=2, m(p5)=0

    30

  • 8/13/2019 Tutorial Perti Nets Geeraerts

    41/341

    Firing a transition

    A transition t = I,Ocan be firedfrom mifffor any place p:

    m(p) !I(p)

    The firing transformsthe marking minto amarking ms.t. for any place p:

    m(p) = m(p) - I(p) + O(p)

    Notation: m!m

    Notation: Post(m) = {m| m!m}

    31

  • 8/13/2019 Tutorial Perti Nets Geeraerts

    42/341

    Example

    p1

    p2

    p3

    t1

    t3 t2

    32

  • 8/13/2019 Tutorial Perti Nets Geeraerts

    43/341

    Example

    p1

    p2

    p3

    t1

    t3 t2

    Post(1, 1, 0)={2, 1, 0,0, 0, 1}

    32

  • 8/13/2019 Tutorial Perti Nets Geeraerts

    44/341

    Example

    p1

    p2

    p3

    t1

    t3 t2

    Post(1, 1, 0)={2, 1, 0,0, 0, 1}

    32

  • 8/13/2019 Tutorial Perti Nets Geeraerts

    45/341

    Example

    p1

    p2

    p3

    t1

    t3 t2

    Post(1, 1, 0)={2, 1, 0,0, 0, 1}

    32

  • 8/13/2019 Tutorial Perti Nets Geeraerts

    46/341

    Example

    p1

    p2

    p3

    t1

    t3 t2

    Post(1, 1, 0)={2, 1, 0,0, 0, 1}

    32

  • 8/13/2019 Tutorial Perti Nets Geeraerts

    47/341

    Example

    p1

    p2

    p3

    t1

    t3 t2

    Post(1, 1, 0)={2, 1, 0,0, 0, 1}

    32

    I l k

  • 8/13/2019 Tutorial Perti Nets Geeraerts

    48/341

    Initial marking

    Reachable markin s All PN are equipped with aninitial markingm0

    If two markings mand mare s.t.: m!m1!m2!!mThenm is reachablefrom m

    Let N be a PN with initial marking m0:Reach(N) = {m reachablefrom m0}

    is the set of reachable markingsof N.

    33

  • 8/13/2019 Tutorial Perti Nets Geeraerts

    49/341

    Example

    p1

    p2

    p3

    t1

    t3 t2

    34

  • 8/13/2019 Tutorial Perti Nets Geeraerts

    50/341

    Example

    p1

    p2

    p3

    t1

    t3 t2

    Reach(N) ={i,1,0| i N}

    {i,0,1| i N}

    34

  • 8/13/2019 Tutorial Perti Nets Geeraerts

    51/341

    Example

    p1

    p2

    p3

    t1

    t3 t2

    Reach(N) ={i,1,0| i N}

    {i,0,1| i N}

    This set allows us toprove that the mutual

    exclusion is indeedenforced

    34

  • 8/13/2019 Tutorial Perti Nets Geeraerts

    52/341

    Ordering on markings

    Markings can be comparedthanks to 4: m4miff for any place p: m(p)6m(p)

    mpmiff m4m andmm

    Examples:

    1, 0, 0p1, 1, 041, 1, 045, 7, 2 1, 0, 0is not comparableto 0, 1, 0

    35

  • 8/13/2019 Tutorial Perti Nets Geeraerts

    53/341

    Questions on PN Meaningful questionsabout PN include: Boundedness: is the number of reachable

    markings bounded?

    Place boundedness: is there a boundonthe maximal numberof tokens that can becreated in a given place ?

    Semi-liveness: is there a reachable markingfrom which a given transitioncan fire? Coverability

    36

  • 8/13/2019 Tutorial Perti Nets Geeraerts

    54/341

    Exampleread

    write

    idle

    write

    read

    idle

    BoundedPN All the places are bounded

    All the transitions are semi-live

    37

  • 8/13/2019 Tutorial Perti Nets Geeraerts

    55/341

  • 8/13/2019 Tutorial Perti Nets Geeraerts

    56/341

    Some tools for theanalysis of PN

    39

  • 8/13/2019 Tutorial Perti Nets Geeraerts

    57/341

  • 8/13/2019 Tutorial Perti Nets Geeraerts

    58/341

    Reachability Tree

    Idea: the rootis labeled by m0 for each node labeled by m, create one

    childfor each marking of Post(m)

    41

    Reachability Tree

  • 8/13/2019 Tutorial Perti Nets Geeraerts

    59/341

    I1

    R1W1

    W2 R2

    I2

    M

    Reachability Tree

    42

    Reachability Tree

  • 8/13/2019 Tutorial Perti Nets Geeraerts

    60/341

    I1

    R1W1

    W2 R2

    I2

    M

    M, I1, I2

    Reachability Tree

    42

    Reachability Tree

  • 8/13/2019 Tutorial Perti Nets Geeraerts

    61/341

    I1

    R1W1

    W2 R2

    I2

    M

    M, I1, I2

    W1, I2

    I1,W2

    M, R1, I2

    M, I1, R2

    Reachability Tree

    42

    Reachability Tree

  • 8/13/2019 Tutorial Perti Nets Geeraerts

    62/341

    I1

    R1W1

    W2 R2

    I2

    M

    M, I1, I2

    W1, I2

    I1,W2

    M, R1, I2

    M, I1, R2

    M, I1, I2

    R1,W2

    Reachability Tree

    42

    Reachability Tree

  • 8/13/2019 Tutorial Perti Nets Geeraerts

    63/341

    I1

    R1W1

    W2 R2

    I2

    M

    M, I1, I2

    W1, I2

    I1,W2

    M, R1, I2

    M, I1, R2

    M, I1, I2

    R1,W2

    W1, I2I1,W2 M, R1, I2

    M, I1, R2

    Reachability Tree

    42

    Reachability Tree

  • 8/13/2019 Tutorial Perti Nets Geeraerts

    64/341

    I1

    R1W1

    W2 R2

    I2

    M

    M, I1, I2

    W1, I2

    I1,W2

    M, R1, I2

    M, I1, R2

    M, I1, I2

    R1,W2

    M, I1, I2W1, R2

    W1, I2I1,W2 M, R1, I2

    M, I1, R2

    Reachability Tree

    42

    Reachability Tree

  • 8/13/2019 Tutorial Perti Nets Geeraerts

    65/341

    I1

    R1W1

    W2 R2

    I2

    M

    M, I1, I2

    W1, I2

    I1,W2

    M, R1, I2

    M, I1, R2

    M, I1, I2

    R1,W2

    M, I1, I2W1, R2

    W1, I2I1,W2 M, R1, I2

    M, I1, R2

    Reachability Tree

    42

    Reachability Tree

  • 8/13/2019 Tutorial Perti Nets Geeraerts

    66/341

    I1

    R1W1

    W2 R2

    I2

    M

    M, I1, I2

    W1, I2

    I1,W2

    M, R1, I2

    M, I1, R2

    M, I1, I2

    R1,W2

    M, I1, I2W1, R2

    W1, I2I1,W2 M, R1, I2

    M, I1, R2

    Reachability Tree

    Reachability trees canbe infinite

    42

  • 8/13/2019 Tutorial Perti Nets Geeraerts

    67/341

    Reachability graph

    Idea: build a nodefor each reachablemarkingand add an edgefrom m to m ifsome transition transforms m into m

    remark: now, if we meet the same markingtwice, we do not createa new node, but

    re-use the previously created node.

    43

  • 8/13/2019 Tutorial Perti Nets Geeraerts

    68/341

  • 8/13/2019 Tutorial Perti Nets Geeraerts

    69/341

    Reachability graph

    I1

    R1W1

    W2 R2

    I2

    MM, I1, I2

    44

  • 8/13/2019 Tutorial Perti Nets Geeraerts

    70/341

    Reachability graph

    I1

    R1W1

    W2R2

    I2

    MM, I1, I2

    M, R1, I2 M, I1, R2

    44

  • 8/13/2019 Tutorial Perti Nets Geeraerts

    71/341

    Reachability graph

    I1

    R1W1

    W2R2

    I2

    MM, I1, I2

    M, R1, I2 M, I1, R2

    M, R1, R2

    44

  • 8/13/2019 Tutorial Perti Nets Geeraerts

    72/341

    Reachability graph

    I1

    R1W1

    W2R2

    I2

    MM, I1, I2

    W1, I2I1,W2

    M, R1, I2 M, I1, R2

    M, R1, R2

    44

  • 8/13/2019 Tutorial Perti Nets Geeraerts

    73/341

    Reachability graph

    I1

    R1W1

    W2R2

    I2

    MM, I1, I2

    W1, I2I1,W2

    W1, R2R1,W2

    M, R1, I2 M, I1, R2

    M, R1, R2

    44

  • 8/13/2019 Tutorial Perti Nets Geeraerts

    74/341

  • 8/13/2019 Tutorial Perti Nets Geeraerts

    75/341

    Reachability graph

    I1

    R1W1

    W2R2

    I2

    MM, I1, I2

    W1, I2I1,W2

    W1, R2R1,W2

    M, R1, I2 M, I1, R2

    M, R1, R2

    The reachability graphallows us to prove thatthe mutual exclusion is

    indeed enforced

    44

  • 8/13/2019 Tutorial Perti Nets Geeraerts

    76/341

    Reachability graph

    The reachability graph of a PN contains allthe necessary information to decide:

    boundedness place boundedness

    semi-liveness ...

    45

  • 8/13/2019 Tutorial Perti Nets Geeraerts

    77/341

    Reachability graph

    Unfortunately...

    p1

    p2

    p3

    t1

    t3 t2

    p2

    46

  • 8/13/2019 Tutorial Perti Nets Geeraerts

    78/341

    Reachability graph

    Unfortunately...

    p1

    p2

    p3

    t1

    t3 t2

    p2

    p1,p2

    46

  • 8/13/2019 Tutorial Perti Nets Geeraerts

    79/341

  • 8/13/2019 Tutorial Perti Nets Geeraerts

    80/341

    Reachability graph

    Unfortunately...

    p1

    p2

    p3

    t1

    t3 t2

    p2

    p1,p2

    2p1,p2 p3

    3p1,p2 p1,p3

    46

  • 8/13/2019 Tutorial Perti Nets Geeraerts

    81/341

    Reachability graph

    Unfortunately...

    p1

    p2

    p3

    t1

    t3 t2

    p2

    p1,p2

    2p1,p2 p3

    3p1,p2 p1,p3

    46

  • 8/13/2019 Tutorial Perti Nets Geeraerts

    82/341

    Reachability graph

    Unfortunately...

    p1

    p2

    p3

    t1

    t3 t2

    p2

    p1,p2

    2p1,p2 p3

    3p1,p2 p1,p3

    Reachability graphs canbe infinite

    46

  • 8/13/2019 Tutorial Perti Nets Geeraerts

    83/341

    The hard stuff...

    The main difficulty in analysing Petri nets is

    due to the possibly infinitenumber ofreachable markings.

    We have to find techniquesto deal withthis infiniteset.

    47

  • 8/13/2019 Tutorial Perti Nets Geeraerts

    84/341

    The hard stuff...

    Remark: finitedoesnt mean easy

    The set of reachable markingsof aboundednet can be huge! Efficient techniquesto deal with bounded

    nets have been developped.

    e.g.: net unfoldings

    48

  • 8/13/2019 Tutorial Perti Nets Geeraerts

    85/341

    Place invariants

    49

  • 8/13/2019 Tutorial Perti Nets Geeraerts

    86/341

    Place Invariantsread

    write

    idle

    write

    read

    idle

    R1 R2

    I2

    m(R1) + m(R2) + m(I2) =1

    50

  • 8/13/2019 Tutorial Perti Nets Geeraerts

    87/341

    Place Invariantsread

    write

    idle

    write

    read

    idle

    R1 R2

    I2

    m(R1) + m(R2) + m(I2) =1

    51

  • 8/13/2019 Tutorial Perti Nets Geeraerts

    88/341

    Place Invariantsread

    write

    idle

    write

    read

    idle

    R1 R2

    I2

    m(R1) + m(R2) + m(I2) = 2

    52

  • 8/13/2019 Tutorial Perti Nets Geeraerts

    89/341

  • 8/13/2019 Tutorial Perti Nets Geeraerts

    90/341

    Place Invariantsread

    write

    idle

    write

    read

    idle

    R1 R2

    I2

    m(R1) + m(R2) + m(I2) = 0

    The total number oftokens in these placesis not constant

    53

  • 8/13/2019 Tutorial Perti Nets Geeraerts

    91/341

    Place Invariantsread

    write

    idle

    write

    read

    idle

    R1

    I1

    m(R1) + m(W1) + m(I1) = 1

    W1

    54

  • 8/13/2019 Tutorial Perti Nets Geeraerts

    92/341

    Pl I

  • 8/13/2019 Tutorial Perti Nets Geeraerts

    93/341

    Place Invariantsread

    write

    idle

    write

    read

    idle

    R1

    I1

    m(R1) + m(W1) + m(I1) = 1

    W1

    56

    Pl I

  • 8/13/2019 Tutorial Perti Nets Geeraerts

    94/341

    Place Invariantsread

    write

    idle

    write

    read

    idle

    R1

    I1

    m(R1) + m(W1) + m(I1) = 1

    W1

    The total number oftokens in these places

    is constant

    56

    Pl I i

  • 8/13/2019 Tutorial Perti Nets Geeraerts

    95/341

    Place Invariantsread

    write

    idle

    write

    read

    idle

    R1

    I1

    m(R1) + m(W1) + m(I1) = 1

    W1

    The total number oftokens in these places

    is constant

    This providesmeaningful information

    about the system: a

    process is either idle,or reading or writing

    56

  • 8/13/2019 Tutorial Perti Nets Geeraerts

    96/341

    Pl I i

  • 8/13/2019 Tutorial Perti Nets Geeraerts

    97/341

    p1

    p2

    p3

    p42

    2

    Place Invariants

    m(p1) + m(p2) + m(p3) + m(p4) = 3

    58

    Pl I i

  • 8/13/2019 Tutorial Perti Nets Geeraerts

    98/341

    p1

    p2

    p3

    p42

    2

    Place Invariants

    m(p1) + m(p2) + m(p3) + m(p4) = 2

    59

    Pl I i

  • 8/13/2019 Tutorial Perti Nets Geeraerts

    99/341

    p1

    p2

    p3

    p42

    2

    Place Invariants

    m(p1) + m(p2) + m(p3) + m(p4) = 1

    60

    Pl I i

  • 8/13/2019 Tutorial Perti Nets Geeraerts

    100/341

    p1

    p2

    p3

    p42

    2

    Place Invariants

    m(p1) + m(p2) + m(p3) + m(p4) = 1

    The total number oftokens in these places

    is not constant

    60

    Pl I i

  • 8/13/2019 Tutorial Perti Nets Geeraerts

    101/341

    p1

    p2

    p3

    p42

    2

    Place Invariants

    m(p1) + m(p2) + m(p3) + m(p4) = 1

    The total number oftokens in these places

    is not constant

    In some sense, tokensin p1are heavierthan

    those in p2

    60

    Pl I i

  • 8/13/2019 Tutorial Perti Nets Geeraerts

    102/341

    p1

    p2

    p3

    p42

    2

    Place Invariants

    m(p1) + m(p2) + m(p3) + m(p4) = 1

    The total number oftokens in these places

    is not constant

    In some sense, tokensin p1are heavierthan

    those in p2

    Lets add weightstothe places !

    60

    Pl I i t

  • 8/13/2019 Tutorial Perti Nets Geeraerts

    103/341

    p1

    p2

    p3

    p42

    2

    Place Invariants

    3 m(p1) + m(p2) + m(p3) + 2 m(p4) = 3

    61

    Pl I i t

  • 8/13/2019 Tutorial Perti Nets Geeraerts

    104/341

    p1

    p2

    p3

    p42

    2

    Place Invariants

    3 m(p1) + m(p2) + m(p3) + 2 m(p4) = 3

    62

    Pl I i t

  • 8/13/2019 Tutorial Perti Nets Geeraerts

    105/341

    p1

    p2

    p3

    p42

    2

    Place Invariants

    3 m(p1) + m(p2) + m(p3) + 2 m(p4) = 3

    63

  • 8/13/2019 Tutorial Perti Nets Geeraerts

    106/341

    Example: other

  • 8/13/2019 Tutorial Perti Nets Geeraerts

    107/341

    p1

    p2

    p3

    p42

    2

    p

    invariants

    m(p1) + m(p3) = 1

    2 m(p1) + m(p2) + 2 m(p4) = 2

    65

    Invariants as over-

  • 8/13/2019 Tutorial Perti Nets Geeraerts

    108/341

    a roximations A place-invariant expresses a constrainton

    the reachable markings.

    Ifm is reachableand i is an invariant, then:

    The reverseis not true!

    pP

    i(p)m(p) = pP

    i(p)m0(p)

    66

    E l

  • 8/13/2019 Tutorial Perti Nets Geeraerts

    109/341

    p1

    p2

    p3

    p42

    2

    Example

    m(p1) + m(p3) = 1is an invariant

    but1, 25, 0, 234isnot reachable

    67

    Invariants as over-

  • 8/13/2019 Tutorial Perti Nets Geeraerts

    110/341

    Theorem: For any Petri net N:

    Reach(N)

    {m| mrespects some invariant of N}

    approximations

    68

    Invariants as over-

  • 8/13/2019 Tutorial Perti Nets Geeraerts

    111/341

    Theorem: For any Petri net N:

    Reach(N)

    {m| mrespects some invariant of N}

    approximations

    This setoverapproximatesthe

    reachable markings

    68

    Invariants as over-

  • 8/13/2019 Tutorial Perti Nets Geeraerts

    112/341

    Theorem: For any Petri net N:

    Reach(N)

    {m| mrespects some invariant of N}

    approximations

    This setoverapproximatesthe

    reachable markings

    Place invariants arethus usefulto finitely

    approximatethe set of

    reachable markings68

    Place invariant and

  • 8/13/2019 Tutorial Perti Nets Geeraerts

    113/341

    boundedness Theorem: Ifthere exists a place invariant i

    and a place p s.t. i(p)>0 thenp is bounded.

    Remark: the reverseis not true. One can find a boundednet that doesnt

    have a place invariant i with i(p)>0 foreach place.

    69

    Place invariant

  • 8/13/2019 Tutorial Perti Nets Geeraerts

    114/341

    Place invariant

    Question: how do we computethem ?

    70

    Matrix characterisation

  • 8/13/2019 Tutorial Perti Nets Geeraerts

    115/341

    Matrix characterisation

    The negative effect(consumption) of allthe transitions on all the places can besummarisedin one matrix:

    where, for any i: ti =Ii,Oi

    W=

    I1(p1)I2(p1) Ik(p1)I1(p2)I2(p2) Ik(p2)

    .

    .. .

    .. .

    . . ...

    I1(pn)I2(pn) Ik(pn)

    neg. eff. on p1

    neg. eff. on p2

    71

    Matrix characterisation

  • 8/13/2019 Tutorial Perti Nets Geeraerts

    116/341

    The same can be done with the positiveeffects:

    where, for any i: ti =Ii,Oi

    W+ =

    O1(p1)O2(p1)

    Ok(p1)O1(p2)O2(p2) Ok(p2)

    ... ... . . . ...

    O1(pn)O2(pn)

    Ok(pn)

    pos. eff. on p1

    pos. eff. on p2

    Matrix characterisation

    72

    Incidence Matrix

  • 8/13/2019 Tutorial Perti Nets Geeraerts

    117/341

    Incidence Matrix

    The global effectof every transition can besummarised as a single matrix:

    W=W+W

    W is called the incidence matrixof the net

    73

    Example

  • 8/13/2019 Tutorial Perti Nets Geeraerts

    118/341

    Example

    W+=

    1 0 1

    0 0 1

    0 1 0

    W

    =

    0 1 0

    0 1 0

    0 0 1

    W =

    1 1 1

    0

    1 10 1 1

    p1

    p2

    p3

    t1

    t3 t2

    74

  • 8/13/2019 Tutorial Perti Nets Geeraerts

    119/341

    Example

  • 8/13/2019 Tutorial Perti Nets Geeraerts

    120/341

    Example

    W+=

    1 0 1

    0 0 1

    0 1 0

    W

    =

    0 1 0

    0 1 0

    0 0 1

    W =

    1 1 1

    0

    1 10 1 1

    p1

    p2

    p3

    t1

    t3 t2

    74

    Computing place

  • 8/13/2019 Tutorial Perti Nets Geeraerts

    121/341

    p g p

    invariants Intuitively, if i is a place invariant it shouldassign weightsto the places such that thepositiveand negativeeffects of every

    transition are balanced

    Thus, for any transition t =I,Oweshould have:

    pPI(p) i(p) = pPO(p)

    i(p)

    75

    Computing place

  • 8/13/2019 Tutorial Perti Nets Geeraerts

    122/341

    invariants Intuitively, if i is a place invariant it shouldassign weightsto the places such that thepositiveand negativeeffects of every

    transition are balanced

    Thus, for any transition t =I,Oweshould have:

    pPI(p) i(p) = pPO(p)

    i(p)

    2

    1 2

    75

  • 8/13/2019 Tutorial Perti Nets Geeraerts

    123/341

    Computing place

  • 8/13/2019 Tutorial Perti Nets Geeraerts

    124/341

    invariants Intuitively, if i is a place invariant it shouldassign weightsto the places such that thepositiveand negativeeffects of every

    transition are balanced

    Thus, for any transition t =I,Oweshould have:

    pPI(p) i(p) = pPO(p)

    i(p)

    2

    1 2

    75

    Computing place

  • 8/13/2019 Tutorial Perti Nets Geeraerts

    125/341

    invariants Intuitively, if i is a place invariant it shouldassign weightsto the places such that thepositiveand negativeeffects of every

    transition are balanced

    Thus, for any transition t =I,Oweshould have:

    pPI(p) i(p) = pPO(p)

    i(p)

    2

    1 2

    75

    Computing place

  • 8/13/2019 Tutorial Perti Nets Geeraerts

    126/341

    invariantspP

    I(p) i(p) = pP

    O(p) i(p)

    pP

    O(p)I(p)

    i(p) = 0

    means

    76

    Computing place

  • 8/13/2019 Tutorial Perti Nets Geeraerts

    127/341

    invariantspP

    I(p) i(p) = pP

    O(p) i(p)

    pP

    O(p)I(p)

    i(p) = 0

    means

    t=I,O

    76

    Computing place

  • 8/13/2019 Tutorial Perti Nets Geeraerts

    128/341

    invariantspP

    I(p) i(p) = pP

    O(p) i(p)

    pP

    O(p)I(p)

    i(p) = 0

    means

    t=I,O W=

    O(p1)I(p1)

    O(p2)

    I(p2)

    ... ... ...

    O(pn)I(pn)

    76

  • 8/13/2019 Tutorial Perti Nets Geeraerts

    129/341

    Computing place

  • 8/13/2019 Tutorial Perti Nets Geeraerts

    130/341

    invariantspP

    O(p)I(p)

    i(p) = 0

    is thus the scalar productof i and the columnof W that corresponds to transitiont

    77

    Computing place

  • 8/13/2019 Tutorial Perti Nets Geeraerts

    131/341

    invariantspP

    O(p)I(p)

    i(p) = 0

    is thus the scalar productof i and the columnof W that corresponds to transitiont

    Since this must hold for any t, we obtain:

    77

    Computing place

  • 8/13/2019 Tutorial Perti Nets Geeraerts

    132/341

    invariantspP

    O(p)I(p)

    i(p) = 0

    is thus the scalar productof i and the columnof W that corresponds to transitiont

    Since this must hold for any t, we obtain:

    Theorem: any solutioni to the following system ofequationsis a place-invariant:

    77

    Computing place

  • 8/13/2019 Tutorial Perti Nets Geeraerts

    133/341

    invariantspP

    O(p)I(p)

    i(p) = 0

    is thus the scalar productof i and the columnof W that corresponds to transitiont

    Since this must hold for any t, we obtain:

    iW = 0

    Theorem: any solutioni to the following system ofequationsis a place-invariant:

    77

    Example

  • 8/13/2019 Tutorial Perti Nets Geeraerts

    134/341

    Example

    p1

    p2

    p3

    t1

    t3 t2

    W =

    1

    1 1

    0 1 1

    0 1 1

    78

    Example

  • 8/13/2019 Tutorial Perti Nets Geeraerts

    135/341

    Example

    p1

    p2

    p3

    t1

    t3 t2

    i1, i2, i3W = 0

    W =

    1

    1 1

    0 1 1

    0 1 1

    78

    Example

  • 8/13/2019 Tutorial Perti Nets Geeraerts

    136/341

    Example

    p1

    p2

    p3

    t1

    t3 t2

    i1 = 0i1i2+i3 = 0

    i1+i2i3 = 0

    i1, i2, i3W = 0

    W =

    1

    1 1

    0 1 1

    0 1 1

    78

    Example

  • 8/13/2019 Tutorial Perti Nets Geeraerts

    137/341

    Example

    p1

    p2

    p3

    t1

    t3 t2

    i1 = 0i1i2+i3 = 0

    i1+i2i3 = 0

    i1, i2, i3W = 0

    W =

    1

    1 1

    0 1 1

    0 1 1

    i1 = 0i2+i3 = 0

    +i2i3 = 0

    78

    Example

  • 8/13/2019 Tutorial Perti Nets Geeraerts

    138/341

    Example

    p1

    p2

    p3

    t1

    t3 t2

    i1 = 0i1i2+i3 = 0

    i1+i2i3 = 0

    i1, i2, i3W = 0

    W =

    1

    1 1

    0 1 1

    0 1 1

    i1 = 0i2+i3 = 0

    +i2i3 = 0

    Any vector of the form

    0, i, iis a place invariant

    78

  • 8/13/2019 Tutorial Perti Nets Geeraerts

    139/341

    Proving properties

  • 8/13/2019 Tutorial Perti Nets Geeraerts

    140/341

    p1

    p2

    p3

    t1

    t3 t2

    Let us choose 0, 1, 1as place-invariant

    This means that p2and p3arebounded!

    79

    Proving properties

  • 8/13/2019 Tutorial Perti Nets Geeraerts

    141/341

    p1

    p2

    p3

    t1

    t3 t2

    For any reachable marking m:

    0m(p1) +1m(p2) + 1m(p3) = 0m0(p1) + 1m0(p2) + 1m0(p3)

    m(p2) + m(p3) = 1

    Let us choose 0, 1, 1as place-invariant

    This means that p2and p3arebounded!

    79

    Proving properties

  • 8/13/2019 Tutorial Perti Nets Geeraerts

    142/341

    p1

    p2

    p3

    t1

    t3 t2

    For any reachable marking m:

    0m(p1) +1m(p2) + 1m(p3) = 0m0(p1) + 1m0(p2) + 1m0(p3)

    m(p2) + m(p3) = 1

    Let us choose 0, 1, 1as place-invariant

    Hence, mutual exclusionis enforced !

    This means that p2and p3arebounded!

    79

    Proving properties

  • 8/13/2019 Tutorial Perti Nets Geeraerts

    143/341

    read

    write

    idle

    write

    read

    idle

    M

    W1 W2

    i(M) = i(W1) = i(W2) = 1 and i(p) = 0 otherwiseis a place invariant

    80

    Proving properties

  • 8/13/2019 Tutorial Perti Nets Geeraerts

    144/341

    read

    write

    idle

    write

    read

    idle

    M

    W1 W2

    i(M) = i(W1) = i(W2) = 1 and i(p) = 0 otherwiseis a place invariant

    Hence, mutual exclusionis enforced !80

  • 8/13/2019 Tutorial Perti Nets Geeraerts

    145/341

    Karp & Miller

    andthe coverability set

    81

    The reachability tree

  • 8/13/2019 Tutorial Perti Nets Geeraerts

    146/341

    revisited Reminder: reachability trees can be infinite

    p1

    p2

    p3

    t1

    t3 t2

    0p1,p2

    1p1,p2

    2p1,p2 p3

    3p1,p2 p1,p3

    82

    The reachability tree

  • 8/13/2019 Tutorial Perti Nets Geeraerts

    147/341

    revisited Reminder: reachability trees can be infinite

    p1

    p2

    p3

    t1

    t3 t2

    0p1,p2

    1p1,p2

    2p1,p2 p3

    3p1,p2 p1,p3

    82

    The reachability tree

  • 8/13/2019 Tutorial Perti Nets Geeraerts

    148/341

    revisited Reminder: reachability trees can be infinite

    p1

    p2

    p3

    t1

    t3 t2

    0p1,p2

    1p1,p2

    2p1,p2 p3

    3p1,p2 p1,p3

    Increasing sequencesof markings appear

    on unbounded

    places

    82

    The reachability tree

  • 8/13/2019 Tutorial Perti Nets Geeraerts

    149/341

    revisited Let us summarisethis infinite sequence

    0p1,p2

    1p1,p2

    2p1,p2

    3p1,p2

    83

    The reachability tree

  • 8/13/2019 Tutorial Perti Nets Geeraerts

    150/341

    revisited Let us summarisethis infinite sequence

    0p1,p2

    1p1,p2

    2p1,p2

    3p1,p2

    limit

    83

    The reachability treei i d

  • 8/13/2019 Tutorial Perti Nets Geeraerts

    151/341

    revisited Let us summarisethis infinite sequence

    0p1,p2

    1p1,p2

    2p1,p2

    3p1,p2

    "p1,p2limit

    83

    The reachability treei i d

  • 8/13/2019 Tutorial Perti Nets Geeraerts

    152/341

    revisited Let us summarisethis infinite sequence

    0p1,p2

    1p1,p2

    2p1,p2

    3p1,p2

    "p1,p2limit

    "must be regarded as:

    any number of tokens

    83

    The reachability treei it d

  • 8/13/2019 Tutorial Perti Nets Geeraerts

    153/341

    revisited Let us summarisethis infinite sequence

    0p1,p2

    1p1,p2

    2p1,p2

    3p1,p2

    "p1,p2limit

    "must be regarded as:

    any number of tokens

    Main idea of theKarp andMiller algorithm

    83

  • 8/13/2019 Tutorial Perti Nets Geeraerts

    154/341

    Monotonicity

  • 8/13/2019 Tutorial Perti Nets Geeraerts

    155/341

    y

    Petri nets induce (strongly) monotonictransition systems:

    In articular:m1 m2

    m3

    t

    if

    85

    Monotonicity

  • 8/13/2019 Tutorial Perti Nets Geeraerts

    156/341

    y

    Petri nets induce (strongly) monotonictransition systems:

    In articular:

    m4

    m1 m2

    m3

    t

    if

    85

    Monotonicity

  • 8/13/2019 Tutorial Perti Nets Geeraerts

    157/341

    y

    Petri nets induce (strongly) monotonictransition systems:

    In articular:

    m4

    m1 m2

    m3

    t

    t

    if

    85

    Monotonicity

  • 8/13/2019 Tutorial Perti Nets Geeraerts

    158/341

    y

    Petri nets induce (strongly) monotonictransition systems:

    In articular:

    m4

    m1 m2

    m3

    t

    t

    if

    85

  • 8/13/2019 Tutorial Perti Nets Geeraerts

    159/341

    Monotonicity

  • 8/13/2019 Tutorial Perti Nets Geeraerts

    160/341

    y

    Petri nets induce (strongly) monotonictransition systems:

    In articular:

    m4

    m1 m2

    m3

    t

    t

    if

    i1, i2, i3 i1, i2, i3

    85

    Monotonicity

  • 8/13/2019 Tutorial Perti Nets Geeraerts

    161/341

    y

    Petri nets induce (strongly) monotonictransition systems:

    In articular:

    m4

    m1 m2

    m3

    t

    t

    if

    i1, i2, i3 i1, i2, i3

    85

    Monotonicity

  • 8/13/2019 Tutorial Perti Nets Geeraerts

    162/341

    y

    Petri nets induce (strongly) monotonictransition systems:

    In articular:

    m4

    m1 m2

    m3

    t

    t

    if

    i1, i2, i3 i1, i2, i3

    85

    Monotonicity

  • 8/13/2019 Tutorial Perti Nets Geeraerts

    163/341

    y

    Petri nets induce (strongly) monotonictransition systems:

    In articular:

    m4

    m1 m2

    m3

    t

    t