• No results found

Petri Nets.

N/A
N/A
Protected

Academic year: 2022

Share "Petri Nets."

Copied!
52
0
0

Loading.... (view fulltext now)

Full text

(1)

Linear algebra + Petri nets

Piotr Hofman

University of Warsaw

(2)

Petri Nets.

P1 T1 P2

P3 T2 P4

Places.

Transitions.

Tokens, a Marking. Firing a transition.

(3)

Petri Nets.

P1 T1 P2

P3 T2 P4

Places.

Transitions.

Tokens, a Marking.

Firing a transition.

(4)

Petri Nets.

P1 T1 P2

P3 T2 P4

Places.

Transitions.

Tokens, a Marking.

Firing a transition.

(5)

Petri Nets.

P1 T1 P2

P3 T2 P4

Places.

Transitions.

Tokens, a Marking.

Firing a transition.

(6)

Petri Nets.

P1 T1 P2

P3 T2 P4

Places.

Transitions.

Tokens, a Marking.

Firing a transition.

(7)

Questions and tools.

We focus on analysis of systems modelled with Petri nets.

Most important questions:

1 Place coverability,

2 Reachability,

3 Liveness,

4 Death of a transition,

5 Deadlock-freeness.

Most important tools:

1 Coverability: ExpSpace complete,

2 Boundedness: ExpSpace complete,

3 Reachability: at least ExpSpace Hard.

(8)

Two solutions:

Do not try to be precise (approximations).

1 Place invariant.

2 State equation.

3 Continuous reachability.

4 Traps and siphons.

Do not try to be general (sub-classes).

1 Free-choice Petri Nets.

2 Conflict free Petri nets.

3 One counter systems.

4 2-dimensional VASS.

5 Flat systems.

(9)

Linear algebra

Integer programming.

Input: An integer matrixM and a vector~y.

Question: If there is a vector~x ∈Nd such that M·~x =~y?

Theorem

The integer programming problem is NP-complete.

(10)

Linear algebra.

Linear programming.

Input: An integer matrixM and a vector~y.

Question: If there is a vector~x ∈Qd>0 such that M·~x =~y?

Theorem

The linear programming problem is P-complete.

(11)

Description of the net, three matrices.

P1 T1 P2

P3 T2 P4

~0[i] = 0 for alli

1~p[i] =

(1 if p =i 0 otherwise

Pre(N) =

1 0 0 1 0 1 0 0

Post(N) =

0 1 1 0 1 0 0 1

∆ =Post(N)−Pre(N)

−1 1

1 −1

1 −1

0 1

(12)

Description of the net, three matrices.

P1 T1 P2

P3 T2 P4

~0[i] = 0 for alli

1~p[i] =

(1 if p =i 0 otherwise

Pre(N) =

1 0 0 1 0 1 0 0

Post(N) =

0 1 1 0 1 0 0 1

∆ =Post(N)−Pre(N)

−1 1

1 −1

1 −1

0 1

(13)

State equation.

LetReach(N,i) be a set of configurations reachable fromi inN.

Hard to describe.

LetLNRS(N,i) = {~y :∃~x∈

Nd M·~x =~y−i}. Easier to describe

(NP-complete). LetLZRS(N,i) =

{~y :∃~x∈Zd M·~x=~y−i}. Easy to describe

(PTime). Lemma

Reach(N,i)⊆LNRS(N,i)⊆LZRS(N,i).

(14)

State equation.

LetReach(N,i) be a set of configurations reachable fromi inN.

Hard to describe.

LetLNRS(N,i) =

{~y :∃~x∈Nd M·~x =~y−i}.

Easier to describe (NP-complete). LetLZRS(N,i) =

{~y :∃~x∈Zd M·~x=~y−i}. Easy to describe

(PTime). Lemma

Reach(N,i)⊆LNRS(N,i)⊆LZRS(N,i).

(15)

State equation.

LetReach(N,i) be a set of configurations reachable fromi inN.

Hard to describe.

LetLNRS(N,i) =

{~y :∃~x∈Nd M·~x =~y−i}.

Easier to describe (NP-complete).

LetLZRS(N,i) =

{~y :∃~x∈Zd M·~x=~y−i}. Easy to describe

(PTime). Lemma

Reach(N,i)⊆LNRS(N,i)⊆LZRS(N,i).

(16)

State equation.

LetReach(N,i) be a set of configurations reachable fromi inN.

Hard to describe.

LetLNRS(N,i) =

{~y :∃~x∈Nd M·~x =~y−i}.

Easier to describe (NP-complete).

LetLZRS(N,i) =

{~y :∃~x∈Zd M·~x=~y−i}.

Easy to describe (PTime). Lemma

Reach(N,i)⊆LNRS(N,i)⊆LZRS(N,i).

(17)

State equation.

LetReach(N,i) be a set of configurations reachable fromi inN.

Hard to describe.

LetLNRS(N,i) =

{~y :∃~x∈Nd M·~x =~y−i}.

Easier to describe (NP-complete).

LetLZRS(N,i) =

{~y :∃~x∈Zd M·~x=~y−i}.

Easy to describe (PTime).

Lemma

Reach(N,i)⊆LNRS(N,i)⊆LZRS(N,i).

(18)

State equation.

LetReach(N,i) be a set of configurations reachable fromi inN.

Hard to describe.

LetLNRS(N,i) =

{~y :∃~x∈Nd M·~x =~y−i}.

Easier to describe (NP-complete).

LetLZRS(N,i) =

{~y :∃~x∈Zd M·~x=~y−i}.

Easy to describe (PTime).

Lemma

Reach(N,i)⊆LNRS(N,i)⊆LZRS(N,i).

(19)

An application.

Algorithm 1 for reachability.

Start from the initial configuration iand exhaustively build a graph of reachable configurations adding nodes one by one.

if you findf then return 1;

if you can not visit any new configuration then return 0;

if you run out of memory then return I don’t know.

Algorithm 2 for reachability.

Start from the initial configuration iand exhaustively build a graph of reachable configurations adding nodes one by one; but whenever you want to add a new node~x to the graph you check if f∈LNSR(N, ~x).You add the node if and only if the answer is yes.

if you findf then return 1;

if you can not add any new node then return 0; if you run out of memory then return ”I don’t know”.

(20)

An application.

Algorithm 1 for reachability.

Start from the initial configuration iand exhaustively build a graph of reachable configurations adding nodes one by one.

if you findf then return 1;

if you can not visit any new configuration then return 0;

if you run out of memory then return I don’t know.

Algorithm 2 for reachability.

Start from the initial configuration iand exhaustively build a graph of reachable configurations adding nodes one by one; but whenever you want to add a new node~x to the graph you check if f∈LNSR(N, ~x).You add the node if and only if the answer is yes.

if you findf then return 1;

if you can not add any new node then return 0;

if you run out of memory then return ”I don’t know”.

(21)

P-flows

~y is called a P-flow iff~y·M = 0.

If~y >0 then we call it P-semiflow.

Lemma

Iff is reachable fromithen~y·f=~y·i. Question

How do we test a boundedness of a place using P-semiflows?

Lemma

Let~y be a P-semiflow of the net N, then the number of tokens is bounded for all 16i 6d such that~y[i]>0.

(22)

P-flows

~y is called a P-flow iff~y·M = 0.

If~y >0 then we call it P-semiflow.

Lemma

Iff is reachable fromithen~y·f=~y·i.

Question

How do we test a boundedness of a place using P-semiflows?

Lemma

Let~y be a P-semiflow of the net N, then the number of tokens is bounded for all 16i 6d such that~y[i]>0.

(23)

P-flows

~y is called a P-flow iff~y·M = 0.

If~y >0 then we call it P-semiflow.

Lemma

Iff is reachable fromithen~y·f=~y·i.

Question

How do we test a boundedness of a place using P-semiflows?

Lemma

Let~y be a P-semiflow of the net N, then the number of tokens is bounded for all 16i 6d such that~y[i]>0.

(24)

P-flows

~y is called a P-flow iff~y·M = 0.

If~y >0 then we call it P-semiflow.

Lemma

Iff is reachable fromithen~y·f=~y·i.

Question

How do we test a boundedness of a place using P-semiflows?

Lemma

Let~y be a P-semiflow of the net N, then the number of tokens is bounded for all 16i 6d such that~y[i]>0.

(25)

Structural boundedness

A place p in a net N is structurally bounded if for every initial markingi the

max{1~p

T ·m~ :m~RS(N,i)} is finite.

Theorem

A following conditions are equivalent:

1 a placep in the netN is structurally bounded,

2 there exists~y >1~p such that~y·∆6~0,

3 there does not exist~x >~0 such that ∆·~x >1~p.

(26)

Structural boundedness

A place p in a net N is structurally bounded if for every initial markingi the

max{1~p

T ·m~ :m~RS(N,i)} is finite.

Theorem

A following conditions are equivalent:

1 a placep in the netN is structurally bounded,

2 there exists~y >1~p such that~y·∆6~0,

3 there does not exist~x >~0 such that ∆·~x >1~p.

(27)

Proof

Theorem

A following conditions are equivalent:

1 a placep in the netN is structurally bounded,

2 there exists~y >1~p such that~y·∆6~0,

3 there does not exist~x >~0 such that ∆·~x >1~p.

1 1 = 3 by¬3 =⇒ ¬1

2 3 = 2 by a theorem related to dual programs theorem called alternative theorem.

Theorem

Exactly one of the following systems of equations has a solution:

A~x>~b. ~y>~0

~yT·A=~0

~yT·~b>0.

3 2 = 1 Direct.

(28)

Proof

Theorem

A following conditions are equivalent:

1 a placep in the netN is structurally bounded,

2 there exists~y >1~p such that~y·∆6~0,

3 there does not exist~x >~0 such that ∆·~x >1~p.

1 1 = 3 by¬3 =⇒ ¬1

2 3 = 2 by a theorem related to dual programs theorem called alternative theorem.

Theorem

Exactly one of the following systems of equations has a solution:

A~x>~b. ~y>~0

~yT·A=~0

~yT·~b>0.

3 2 = 1 Direct.

(29)

Proof

Theorem

A following conditions are equivalent:

1 a placep in the netN is structurally bounded,

2 there exists~y >1~p such that~y·∆6~0,

3 there does not exist~x >~0 such that ∆·~x >1~p.

1 1 = 3 by¬3 =⇒ ¬1

2 3 = 2 by a theorem related to dual programs theorem called alternative theorem.

Theorem

Exactly one of the following systems of equations has a solution:

A~x>~b. ~y>~0

~yT·A=~0

~yT·~b>0.

3 2 = 1 Direct.

(30)

Proof

Theorem

A following conditions are equivalent:

1 a placep in the netN is structurally bounded,

2 there exists~y >1~p such that~y·∆6~0,

3 there does not exist~x >~0 such that ∆·~x >1~p.

1 1 = 3 by¬3 =⇒ ¬1

2 3 = 2 by a theorem related to dual programs theorem called alternative theorem.

Theorem

Exactly one of the following systems of equations has a solution:

A~x>~b. ~y>~0

~yT·A=~0

~yT·~b>0.

3 2 = 1 Direct.

(31)

Continuous reachability.

(32)

Linear programming + If formula.

Input: A r×c- integer matrixM and a vector~y ∈Zr and a set of predicates of a form~x[i]>0 =⇒ ~x[j]>0.

Question: If there is a vector~x ∈Qc>0 such thatM·~x=~y and all predicates are satisfied?

Theorem

The Linear programming + If formula problem is in PTime.

Proof

1 The set of solutions is convex.

2 If for everyi there is a solution such that~x[i]>0 then there is a solution such that~x[j]>0 for all j.

(33)

Linear programming + If formula.

Input: A r×c- integer matrixM and a vector~y ∈Zr and a set of predicates of a form~x[i]>0 =⇒ ~x[j]>0.

Question: If there is a vector~x ∈Qc>0 such thatM·~x=~y and all predicates are satisfied?

Theorem

The Linear programming + If formula problem is in PTime.

Proof

1 The set of solutions is convex.

2 If for everyi there is a solution such that~x[i]>0 then there is a solution such that~x[j]>0 for all j.

(34)

Linear programming + If formula (the algorithm).

solve( Matrix ∆, Vector~y, set of implications S, set of zerosX) {

If there is no solution ∆·~x =~y in Qd>0,

wherexi = 0 for allxi ∈Xthen return false;

If there is a solution ∆·~x=~y in Qd>0,

wherexi = 0 iffxi ∈Xthen return true;

Find a new coordinate xi

which has to be equal 0 in every solution;

Add xi to X;

Add to Xallxj that has to be added due to implications;

return solve(M,~y,S,X);

}

(35)

Continuous Petri Nets.

T1

T2

Marking: M:PQ Transitions: T

Firing a transitiontTwith a coefficientaQ.

(36)

Continuous Petri Nets.

T1

1

1 T2

3 2

Marking: M:PQ Transitions: T

Firing a transitiontTwith a coefficientaQ.

(37)

Continuous Petri Nets.

T1

1

1 T2

1 3

3 2

Marking: M:PQ Transitions: T

Firing a transitiontTwith a coefficientaQ.

(38)

Continuous Petri Nets.

T1 2 3

2 3

T2

1 3

3 2

Marking: M:PQ Transitions: T

Firing a transitiontTwith a coefficientaQ.

(39)

Continuous Petri Nets.

1 3

T1 2 3

2 3

T2

1 3

10 6

Marking: M:PQ Transitions: T

Firing a transitiontTwith a coefficientaQ.

(40)

Continuous Petri Nets Reachability.

Input: Two configurationsiand f

Question: If there is a run form itof under continuous semantics.

A simpler variant of the problem.

Suppose, that

i (i[i]>0 and f[i]>0). f is reachable fromiiff

f−i= ∆·~x where~x ∈Qd>0.

(41)

Continuous Petri Nets Reachability.

Lemma

f is reachable fromiif

1

f−i= ∆·~x where~x ∈Qd>0

2

~x[i]>0 and Pre[j,i]>0 =⇒ i[j]>0,

3

~x[i]>0 and Post[j,i]>0 =⇒ f[j]>0.

(42)

Continuous Petri Nets Reachability.

Lemma

f is reachable fromiif

1 f−i= ∆·~x where~x ∈Qd>0

2 ~x[i]>0 and Pre[j,i]>0 =⇒ i[j]>0,

3 ~x[i]>0 and Post[j,i]>0 =⇒ f[j]>0.

Theorem

f is reachable fromiiff there are two configurationsi0 andf0 such that

1 there is a run formito i0 that is using at mostd steps.

2 there is a run formf0 to f that is using at mostd steps.

3 There is a run form i0 tof0 due to Lemma.

(43)

Translation to a formula (linear + If).

Lemma

For a given Petri netN and two configurationsiand fin PTime one can compute a formula (linear programming + if) such that it is satisfiable if and only iff is continuously reachable from iin the netN.

We use:

Theorem

f is reachable fromiiff there are two configurationsi0 andf0 such that

1 there is a run formito i0 that is using at mostd steps.

2 there is a run formf0 to f that is using at mostd steps.

3 There is a run form i0 tof0 due to Lemma.

(44)

Q-cover 2015.

IDEA:Take a backward coverability algorithm, and speed it up.

CHALLENGE: Size of the representation of the representation of the upward-closed set may get too big.

IDEA:Let~xM ↑, if there is no~y >~x such that~yRS(N,i) then we can throw~x away.

M. Blondin, A. Finkel, Ch. Haase, S. Haddad, 2015

SOLUTION: Let~xM ↑, if there is no~y~x such that~yCRS(N,i) then we can throw~x away.

Thomas Geffroy, J´erˆome Leroux, Gr´egoire Sutre, 2017 Actually, any over-approximation will work: LRS instead ofCRS.

(45)

Q-cover 2015.

IDEA:Take a backward coverability algorithm, and speed it up.

What is the main obstacle?

IDEA:Let~xM ↑, if there is no~y >~x such that~yRS(N,i) then we can throw~x away.

M. Blondin, A. Finkel, Ch. Haase, S. Haddad, 2015

SOLUTION: Let~xM ↑, if there is no~y~x such that~yCRS(N,i) then we can throw~x away.

Thomas Geffroy, J´erˆome Leroux, Gr´egoire Sutre, 2017 Actually, any over-approximation will work: LRS instead ofCRS.

(46)

Q-cover 2015.

IDEA:Take a backward coverability algorithm, and speed it up.

CHALLENGE: Size of the representation of the representation of the upward-closed set may get too big.

IDEA:Let~xM ↑, if there is no~y >~x such that~yRS(N,i) then we can throw~x away.

M. Blondin, A. Finkel, Ch. Haase, S. Haddad, 2015

SOLUTION: Let~xM ↑, if there is no~y~x such that~yCRS(N,i) then we can throw~x away.

Thomas Geffroy, J´erˆome Leroux, Gr´egoire Sutre, 2017 Actually, any over-approximation will work: LRS instead ofCRS.

(47)

Q-cover 2015.

IDEA:Take a backward coverability algorithm, and speed it up.

CHALLENGE: Size of the representation of the representation of the upward-closed set may get too big.

How to cut the upward-closed set?

M. Blondin, A. Finkel, Ch. Haase, S. Haddad, 2015

SOLUTION: Let~xM ↑, if there is no~y~x such that~yCRS(N,i) then we can throw~x away.

Thomas Geffroy, J´erˆome Leroux, Gr´egoire Sutre, 2017 Actually, any over-approximation will work: LRS instead ofCRS.

(48)

Q-cover 2015.

IDEA:Take a backward coverability algorithm, and speed it up.

CHALLENGE: Size of the representation of the representation of the upward-closed set may get too big.

IDEA:Let~xM ↑, if there is no~y >~x such that~yRS(N,i) then we can throw~x away.

M. Blondin, A. Finkel, Ch. Haase, S. Haddad, 2015

SOLUTION: Let~xM ↑, if there is no~y~x such that~yCRS(N,i) then we can throw~x away.

Thomas Geffroy, J´erˆome Leroux, Gr´egoire Sutre, 2017 Actually, any over-approximation will work: LRS instead ofCRS.

(49)

Q-cover 2015.

IDEA:Take a backward coverability algorithm, and speed it up.

CHALLENGE: Size of the representation of the representation of the upward-closed set may get too big.

IDEA:Let~xM ↑, if there is no~y >~x such that~yRS(N,i) then we can throw~x away.

M. Blondin, A. Finkel, Ch. Haase, S. Haddad, 2015

SOLUTION: Let~xM ↑, if there is no~y~x such that~yCRS(N,i) then we can throw~x away.

Thomas Geffroy, J´erˆome Leroux, Gr´egoire Sutre, 2017 Actually, any over-approximation will work: LRS instead ofCRS.

(50)

Q-cover 2015.

IDEA:Take a backward coverability algorithm, and speed it up.

CHALLENGE: Size of the representation of the representation of the upward-closed set may get too big.

IDEA:Let~xM ↑, if there is no~y >~x such that~yRS(N,i) then we can throw~x away.

M. Blondin, A. Finkel, Ch. Haase, S. Haddad, 2015

SOLUTION: Let~xM ↑, if there is no~y~x such that~yCRS(N,i) then we can throw~x away.

Thomas Geffroy, J´erˆome Leroux, Gr´egoire Sutre, 2017 Actually, any over-approximation will work: LRS instead ofCRS.

(51)

Advertisement.

(52)

Internships at the University of Warsaw.

Possibilities:

Prof. Miko laj Bojanczyk

Logic, Automata, Formal Languages.

Email: bojan@mimuw.edu.pl

Prof. Piotr Sankowski

Algorithms.

Email: sank@mimuw.edu.pl

Prof. Stefan Dziembowski

Cryptography.

Email: S.Dziembowski@crypto.edu.pl

References

Related documents

IF YOU HAVE A VALID DRIVING LICENCE FOR A LIGHT MOTOR VEHICLE, WHAT ARE YOU ALLOWED TO DRIVE.. 0 MOTOR CAR ONLY MOTOR

development team is distributed or if part of the development is being outsourced, then you may need to develop design documents to communicate across the development teams.. You

• Recall that if you click the hand icon with the left mouse button, you will get the freehand move tool that lets you move pictures freely to any location on the screen.. If you

His domestic schemes were mainly concerned with the education and exaltation of the democracy; His great idea has to raise all the Athenian citizens to intelligence and good taste

As you collect data and if you have time, roughly sketch in structure symbols and contacts on your base maps. You can plot these more accurately with a

If this is a regular happening in your home, then chances are that you are a hoarder – someone whose clutter is a big part of their lives. You are attached to the clutter, will

The scan line algorithm which is based on the platform of calculating the coordinate of the line in the image and then finding the non background pixels in those lines and

10. If it is linked with cost of living then why not demand from the govt, : 11. Special allowance.5. 10.