Parameterized Programs

Temporal Verification of Reactive Systems: Safety

Info icon This preview shows pages 1–12. Sign up to view the full content.

View Full Document Right Arrow Icon
CS256/Winter 2007 — Lecture #09 Zohar Manna Chapter 2 Invariance: Applications 9-1
Image of page 1

Info icon This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Parameterized Programs S : : 0 : loop forever do 1 : noncritical 2 : request y 3 : critical 4 : release y P 3 : : [ local y : integer where y = 1; [ S || S || S ] ] (with some renaming of labels of the S ’s.) P 4 : : [ local y : integer where y = 1; [ S || S || S || S ] ] . . . P n : : ? 9-2
Image of page 2
Mutual exclusion: P 3 : 0 ( ¬ ( at - 3 at - m 3 ) ∧ ¬ ( at - 3 at k 3 ) ¬ ( at - m 3 at k 3 )) P 4 : 0 ( ¬ ( . . . ) . . . ∧ ¬ ( . . . )) P n : ? We want to deal with these programs, i.e., programs with an arbitrary number of identical components , in a more uniform way. Solution: parametrization 9-3
Image of page 3

Info icon This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Syntax Compound statements of variable size cooperation: M j =1 S [ j ] : [ S [1] || . . . || S [ M ] ] Selection: M OR j =1 S [ j ] : [ S [1] or . . . or S [ M ] ] S [ j ] is a parameterized statement . In what ways can j appear in S ? explicit variable in expression . . . := j + . . . explicit subscript in array x . . . := x [ j ] + . . . or x [ j ] := . . . implicit subscript of all local variables in S [ j ] z stands for z [ j ] implicit subscript of all labels in S [ j ] 3 stands for 3 [ j ] 9-4
Image of page 4
Example: Program par-sum (Fig. 2.1) (parallel sum of squares) M 1 z = x [1] 2 + x [2] 2 + . . . + x [ M ] 2 9-5
Image of page 5

Info icon This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Program par-sum-e (Fig. 2.2) (Explicit subscripted parameterized statements of par-sum ) We write the short version, but we reason about this one. 9-6
Image of page 6
Parameterized transition systems The number M of processes is not fixed, so there is an unbounded number of transitions. To finitely represent these, we use parameterization of transition relations. Example: par-sum The unbounded number of transitions associated with 0 are represented by a single transition relation using parameter j : ρ 0 [ j ]: move ( 0 [ j ] , ‘ 1 [ j ]) y 0 [ j ] = x [ j ] pres ( { x, z } ) where j = 1 . . . M. 9-7
Image of page 7

Info icon This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Array Operations Arrays (explicit or implicit) are treated as variables that range over functions: [1 . . . M ] 7→ integers Representation of array operations in transition relations: Retrieval: y [ k ] to retrieve the value of the k th element of array y Modification: update ( y, k, e ) the resulting array agrees with y on all i , i 6 = k , and y [ k ] = e 9-8
Image of page 8
Properties of update update ( y, k, e )[ k ] = e update ( y, k, e )[ j ] = y [ j ] for j 6 = k Example: par-sum The proper representation of the transition relation for 0 [ j ] is ρ 0 [ j ]: move ( 0 [ j ] , ‘ 1 [ j ]) y 0 = update ( y, j, x [ j ]) pres ( { x, z } ) 9-9
Image of page 9

Info icon This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Parameterized Programs: Specification Notation: L i = { j | i [ j ] π } ⊆ { 1 , . . . , M } The set of indices of processes that currently reside at i N i = | L i | The number of processes currently residing at i Example: L i = { 3 , 5 } means i [3] , ‘ i [5] π and we have N i = 2 Invariant: 0 ( N i 0) Abbreviations: L i 1 ,i 2 ,...,i k = L i 1 L i 2 . . . L i k L i..j = L i L i +1 . . . L j N i 1 ,i 2 ,...,i k = | L i 1 ,i 2 ,...,i k | N i..j = | L i..j | 9-10
Image of page 10
Parameterized Programs: Specification (Con’d) Example: Program mpx-sem (Fig 2.3) M 2 (multiple mutual exclusion by semaphores) where j M 1 = ( j mod M ) + 1 = ( j + 1 if j < M 1 if j = M Elaboration for M = 2 : Program mpx-sem-2 (Fig 2.4) mutual exclusion: 0 i, j [1 ..M ] . i 6 = j . ¬ ( at - 3 [ i ] at -
Image of page 11

Info icon This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Image of page 12
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern