on research strategy · bakery algorithm w h y th is e xam ple? › curiosity -- i hadn’t done it...

95
micromodels of software declarative modelling and analysis with Alloy lecture 4: a case study Daniel Jackson MIT Lab for Computer Science Marktoberdorf, August 2002

Upload: others

Post on 30-Sep-2020

0 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: on research strategy · bakery algorithm w h y th is e xam ple? › curiosity -- I hadn’t done it before › familiarity -- you can compare to Rushby › illustrate aspects of Alloy

microm

odels of software

declarative modelling

and analysis with A

lloy

lecture 4: a case study

Daniel JacksonM

IT Lab for Computer Science

Marktoberdorf, August 2002

Page 2: on research strategy · bakery algorithm w h y th is e xam ple? › curiosity -- I hadn’t done it before › familiarity -- you can compare to Rushby › illustrate aspects of Alloy

2

on research strategy

Page 3: on research strategy · bakery algorithm w h y th is e xam ple? › curiosity -- I hadn’t done it before › familiarity -- you can compare to Rushby › illustrate aspects of Alloy

2

on research strategy

I have grown more and m

ore aware that success in science …com

es not so much to the m

ost gifted, nor the most skillful,

nor the most knowledgeable, but rather to the superior

strategist and tactician. -- Jack Oliver

Page 4: on research strategy · bakery algorithm w h y th is e xam ple? › curiosity -- I hadn’t done it before › familiarity -- you can compare to Rushby › illustrate aspects of Alloy

2

on research strategy

I have grown more and m

ore aware that success in science …com

es not so much to the m

ost gifted, nor the most skillful,

nor the most knowledgeable, but rather to the superior

strategist and tactician. -- Jack Oliver

To make an im

portant discovery, you must study an im

portantproblem

. -- Peter Medawar

Page 5: on research strategy · bakery algorithm w h y th is e xam ple? › curiosity -- I hadn’t done it before › familiarity -- you can compare to Rushby › illustrate aspects of Alloy

2

on research strategy

I have grown more and m

ore aware that success in science …com

es not so much to the m

ost gifted, nor the most skillful,

nor the most knowledgeable, but rather to the superior

strategist and tactician. -- Jack Oliver

To make an im

portant discovery, you must study an im

portantproblem

. -- Peter Medawar

Know your secret weapon. -- Herb Simon

Page 6: on research strategy · bakery algorithm w h y th is e xam ple? › curiosity -- I hadn’t done it before › familiarity -- you can compare to Rushby › illustrate aspects of Alloy

3

know w

here you are

knowledge

time

age of discovery

Page 7: on research strategy · bakery algorithm w h y th is e xam ple? › curiosity -- I hadn’t done it before › familiarity -- you can compare to Rushby › illustrate aspects of Alloy

4

Page 8: on research strategy · bakery algorithm w h y th is e xam ple? › curiosity -- I hadn’t done it before › familiarity -- you can compare to Rushby › illustrate aspects of Alloy

4

collection of aphorisms at

theory.lcs.mit.edu/~dnj/6898/lecture-notes.htm

l

Session 20: Hints on Research Strategy

Page 9: on research strategy · bakery algorithm w h y th is e xam ple? › curiosity -- I hadn’t done it before › familiarity -- you can compare to Rushby › illustrate aspects of Alloy

5

bakery algorithm

Page 10: on research strategy · bakery algorithm w h y th is e xam ple? › curiosity -- I hadn’t done it before › familiarity -- you can compare to Rushby › illustrate aspects of Alloy

5

bakery algorithm

why this example?

Page 11: on research strategy · bakery algorithm w h y th is e xam ple? › curiosity -- I hadn’t done it before › familiarity -- you can compare to Rushby › illustrate aspects of Alloy

5

bakery algorithm

why this example?

›curiosity -- I hadn’t done it before

Page 12: on research strategy · bakery algorithm w h y th is e xam ple? › curiosity -- I hadn’t done it before › familiarity -- you can compare to Rushby › illustrate aspects of Alloy

5

bakery algorithm

why this example?

›curiosity -- I hadn’t done it before›fam

iliarity -- you can compare to Rushby

Page 13: on research strategy · bakery algorithm w h y th is e xam ple? › curiosity -- I hadn’t done it before › familiarity -- you can compare to Rushby › illustrate aspects of Alloy

5

bakery algorithm

why this example?

›curiosity -- I hadn’t done it before›fam

iliarity -- you can compare to Rushby

›illustrate aspects of Alloy modelling

Page 14: on research strategy · bakery algorithm w h y th is e xam ple? › curiosity -- I hadn’t done it before › familiarity -- you can compare to Rushby › illustrate aspects of Alloy

5

bakery algorithm

why this example?

›curiosity -- I hadn’t done it before›fam

iliarity -- you can compare to Rushby

›illustrate aspects of Alloy modelling

aspects

Page 15: on research strategy · bakery algorithm w h y th is e xam ple? › curiosity -- I hadn’t done it before › familiarity -- you can compare to Rushby › illustrate aspects of Alloy

5

bakery algorithm

why this example?

›curiosity -- I hadn’t done it before›fam

iliarity -- you can compare to Rushby

›illustrate aspects of Alloy modelling

aspects›no com

mitm

ent to fixed topology in model itself

Page 16: on research strategy · bakery algorithm w h y th is e xam ple? › curiosity -- I hadn’t done it before › familiarity -- you can compare to Rushby › illustrate aspects of Alloy

5

bakery algorithm

why this example?

›curiosity -- I hadn’t done it before›fam

iliarity -- you can compare to Rushby

›illustrate aspects of Alloy modelling

aspects›no com

mitm

ent to fixed topology in model itself

›can easily encode traces in the logic

Page 17: on research strategy · bakery algorithm w h y th is e xam ple? › curiosity -- I hadn’t done it before › familiarity -- you can compare to Rushby › illustrate aspects of Alloy

5

bakery algorithm

why this example?

›curiosity -- I hadn’t done it before›fam

iliarity -- you can compare to Rushby

›illustrate aspects of Alloy modelling

aspects›no com

mitm

ent to fixed topology in model itself

›can easily encode traces in the logic›both invariant reasoning & trace analysis

Page 18: on research strategy · bakery algorithm w h y th is e xam ple? › curiosity -- I hadn’t done it before › familiarity -- you can compare to Rushby › illustrate aspects of Alloy

5

bakery algorithm

why this example?

›curiosity -- I hadn’t done it before›fam

iliarity -- you can compare to Rushby

›illustrate aspects of Alloy modelling

aspects›no com

mitm

ent to fixed topology in model itself

›can easily encode traces in the logic›both invariant reasoning & trace analysis›can m

itigate effects of finite bounds

Page 19: on research strategy · bakery algorithm w h y th is e xam ple? › curiosity -- I hadn’t done it before › familiarity -- you can compare to Rushby › illustrate aspects of Alloy

6

general observations

Page 20: on research strategy · bakery algorithm w h y th is e xam ple? › curiosity -- I hadn’t done it before › familiarity -- you can compare to Rushby › illustrate aspects of Alloy

6

general observations

Rushby on PVS›nothing’s easy, but everything’s possible

Page 21: on research strategy · bakery algorithm w h y th is e xam ple? › curiosity -- I hadn’t done it before › familiarity -- you can compare to Rushby › illustrate aspects of Alloy

6

general observations

Rushby on PVS›nothing’s easy, but everything’s possible

Jackson on Alloy›everything’s easy, but nothing’s possible

Page 22: on research strategy · bakery algorithm w h y th is e xam ple? › curiosity -- I hadn’t done it before › familiarity -- you can compare to Rushby › illustrate aspects of Alloy

6

general observations

Rushby on PVS›nothing’s easy, but everything’s possible

Jackson on Alloy›everything’s easy, but nothing’s possible

not quite…›it’s not always so easy›m

ore is possible than you might have guessed

Page 23: on research strategy · bakery algorithm w h y th is e xam ple? › curiosity -- I hadn’t done it before › familiarity -- you can compare to Rushby › illustrate aspects of Alloy

7

signatures

Page 24: on research strategy · bakery algorithm w h y th is e xam ple? › curiosity -- I hadn’t done it before › familiarity -- you can compare to Rushby › illustrate aspects of Alloy

7

signatures

module bakery

open std/ord

sig Process {}

sig Ticket {}

sig State {

ticket: Process ->? Ticket,

part idle, trying, critical: set Process

}

Page 25: on research strategy · bakery algorithm w h y th is e xam ple? › curiosity -- I hadn’t done it before › familiarity -- you can compare to Rushby › illustrate aspects of Alloy

7

signatures

module bakery

open std/ord

sig Process {}

sig Ticket {}

sig State {

ticket: Process ->? Ticket,

part idle, trying, critical: set Process

}

process in critical phaseholds no ticket: hand in ticket

when you’re being served

Page 26: on research strategy · bakery algorithm w h y th is e xam ple? › curiosity -- I hadn’t done it before › familiarity -- you can compare to Rushby › illustrate aspects of Alloy

8

safety condition

Page 27: on research strategy · bakery algorithm w h y th is e xam ple? › curiosity -- I hadn’t done it before › familiarity -- you can compare to Rushby › illustrate aspects of Alloy

8

safety condition

at most one process is in the critical phase:

sig State {

ticket: Process ->? Ticket,

part idle, trying, critical: set Process

}fun Safe (s: State) {

sole s.critical

}

Page 28: on research strategy · bakery algorithm w h y th is e xam ple? › curiosity -- I hadn’t done it before › familiarity -- you can compare to Rushby › illustrate aspects of Alloy

9

transition relation

Page 29: on research strategy · bakery algorithm w h y th is e xam ple? › curiosity -- I hadn’t done it before › familiarity -- you can compare to Rushby › illustrate aspects of Alloy

9

transition relation

fun Trans (s, s': State, p: Process) {

let otherTickets = s.ticket[Process-p],

next = Ord[Ticket].next |

{p in s.trying

otherTickets in s.ticket[p].^next

p in s'.critical && no s'.ticket[p]

}or …

}

Page 30: on research strategy · bakery algorithm w h y th is e xam ple? › curiosity -- I hadn’t done it before › familiarity -- you can compare to Rushby › illustrate aspects of Alloy

9

transition relation

fun Trans (s, s': State, p: Process) {

let otherTickets = s.ticket[Process-p],

next = Ord[Ticket].next |

{p in s.trying

otherTickets in s.ticket[p].^next

p in s'.critical && no s'.ticket[p]

}or …

}

precondition:p is in trying phaseand all other ticketsfollow

its ticket

Page 31: on research strategy · bakery algorithm w h y th is e xam ple? › curiosity -- I hadn’t done it before › familiarity -- you can compare to Rushby › illustrate aspects of Alloy

9

transition relation

fun Trans (s, s': State, p: Process) {

let otherTickets = s.ticket[Process-p],

next = Ord[Ticket].next |

{p in s.trying

otherTickets in s.ticket[p].^next

p in s'.critical && no s'.ticket[p]

}or …

}

precondition:p is in trying phaseand all other ticketsfollow

its ticket

postcondition:p is in critical phase after, and holdsno ticket

Page 32: on research strategy · bakery algorithm w h y th is e xam ple? › curiosity -- I hadn’t done it before › familiarity -- you can compare to Rushby › illustrate aspects of Alloy

10

other cases

Page 33: on research strategy · bakery algorithm w h y th is e xam ple? › curiosity -- I hadn’t done it before › familiarity -- you can compare to Rushby › illustrate aspects of Alloy

10

other cases

fun Trans (s, s': State, p: Process) {let otherTickets = s.ticket[Process-p], next = Ord[Ticket].next |

…or

{p in s.criticalp in s'.idles'.ticket[p] = s.ticket[p]}

or{p in s.idlep in s'.tryingsom

e s'.ticket[p] & otherTickets.^next}}

Page 34: on research strategy · bakery algorithm w h y th is e xam ple? › curiosity -- I hadn’t done it before › familiarity -- you can compare to Rushby › illustrate aspects of Alloy

11

frame condition

Page 35: on research strategy · bakery algorithm w h y th is e xam ple? › curiosity -- I hadn’t done it before › familiarity -- you can compare to Rushby › illustrate aspects of Alloy

11

frame condition

define a condition saying that a process p doesn’t change:

fun NoChange (s, s': State, p: Process) {

s.ticket[p] = s'.ticket[p]

p in s.idle => p in s'.idle

p in s.trying => p in s'.trying

p in s.critical => p in s'.critical

}

Page 36: on research strategy · bakery algorithm w h y th is e xam ple? › curiosity -- I hadn’t done it before › familiarity -- you can compare to Rushby › illustrate aspects of Alloy

12

initial condition

Page 37: on research strategy · bakery algorithm w h y th is e xam ple? › curiosity -- I hadn’t done it before › familiarity -- you can compare to Rushby › illustrate aspects of Alloy

12

initial condition

fun Init (s: State) {

Safe (s)

}

Page 38: on research strategy · bakery algorithm w h y th is e xam ple? › curiosity -- I hadn’t done it before › familiarity -- you can compare to Rushby › illustrate aspects of Alloy

13

putting things together

Page 39: on research strategy · bakery algorithm w h y th is e xam ple? › curiosity -- I hadn’t done it before › familiarity -- you can compare to Rushby › illustrate aspects of Alloy

13

putting things together

fun Interleaving () {

Init (Ord[State].first)

all s: State - Ord[State].last, s’: Ord[State].next[s] |

some p: Process {

Trans (s,s',p)

all x: Process - p | NoChange(s,s',x)

}

}

Page 40: on research strategy · bakery algorithm w h y th is e xam ple? › curiosity -- I hadn’t done it before › familiarity -- you can compare to Rushby › illustrate aspects of Alloy

13

putting things together

fun Interleaving () {

Init (Ord[State].first)

all s: State - Ord[State].last, s’: Ord[State].next[s] |

some p: Process {

Trans (s,s',p)

all x: Process - p | NoChange(s,s',x)

}

}use of ordering:instantiation im

posesa total order onthe set State

Page 41: on research strategy · bakery algorithm w h y th is e xam ple? › curiosity -- I hadn’t done it before › familiarity -- you can compare to Rushby › illustrate aspects of Alloy

14

allowing sim

ultaneous actions

Page 42: on research strategy · bakery algorithm w h y th is e xam ple? › curiosity -- I hadn’t done it before › familiarity -- you can compare to Rushby › illustrate aspects of Alloy

14

allowing sim

ultaneous actions

fun Simultaneity () {

Init (Ord[State].first)

all s: State - Ord[State].last, s': Ord[State].next[s] |

all p: Process | Trans (s,s',p) or NoChange(s,s',p)

}

Page 43: on research strategy · bakery algorithm w h y th is e xam ple? › curiosity -- I hadn’t done it before › familiarity -- you can compare to Rushby › illustrate aspects of Alloy

15

checking a conjecture

Page 44: on research strategy · bakery algorithm w h y th is e xam ple? › curiosity -- I hadn’t done it before › familiarity -- you can compare to Rushby › illustrate aspects of Alloy

15

checking a conjecture

assert InterleavingSafe {

Interleaving () => all s: State | Safe (s)

}

check InterleavingSafe for 4 but 2 Process

Page 45: on research strategy · bakery algorithm w h y th is e xam ple? › curiosity -- I hadn’t done it before › familiarity -- you can compare to Rushby › illustrate aspects of Alloy

16

counterexamples…

Page 46: on research strategy · bakery algorithm w h y th is e xam ple? › curiosity -- I hadn’t done it before › familiarity -- you can compare to Rushby › illustrate aspects of Alloy

17

how m

uch assurance?

Page 47: on research strategy · bakery algorithm w h y th is e xam ple? › curiosity -- I hadn’t done it before › familiarity -- you can compare to Rushby › illustrate aspects of Alloy

17

how m

uch assurance?

analysis within bounded scope:check InterleavingSafe for 4 but 2 Process

Page 48: on research strategy · bakery algorithm w h y th is e xam ple? › curiosity -- I hadn’t done it before › familiarity -- you can compare to Rushby › illustrate aspects of Alloy

17

how m

uch assurance?

analysis within bounded scope:check InterleavingSafe for 4 but 2 Process

2 processes … seem

s reasonable›we’ve learned som

ething about a real scenario

Page 49: on research strategy · bakery algorithm w h y th is e xam ple? › curiosity -- I hadn’t done it before › familiarity -- you can compare to Rushby › illustrate aspects of Alloy

17

how m

uch assurance?

analysis within bounded scope:check InterleavingSafe for 4 but 2 Process

2 processes … seem

s reasonable›we’ve learned som

ething about a real scenario

4 tickets? 4 states? … not at all reasonable

›running out of tickets is a poor approximation

›not considering all states may m

iss bugs

Page 50: on research strategy · bakery algorithm w h y th is e xam ple? › curiosity -- I hadn’t done it before › familiarity -- you can compare to Rushby › illustrate aspects of Alloy

18

when is a trace long enough?

Page 51: on research strategy · bakery algorithm w h y th is e xam ple? › curiosity -- I hadn’t done it before › familiarity -- you can compare to Rushby › illustrate aspects of Alloy

18

when is a trace long enough?

for safety properties, check all traces›but how long? ie, what is scope of State?

Page 52: on research strategy · bakery algorithm w h y th is e xam ple? › curiosity -- I hadn’t done it before › familiarity -- you can compare to Rushby › illustrate aspects of Alloy

18

when is a trace long enough?

for safety properties, check all traces›but how long? ie, what is scope of State?

idea: bound the diameter

›if all states reached in path ≤ k›enough to consider only traces ≤ k

Page 53: on research strategy · bakery algorithm w h y th is e xam ple? › curiosity -- I hadn’t done it before › familiarity -- you can compare to Rushby › illustrate aspects of Alloy

18

when is a trace long enough?

for safety properties, check all traces›but how long? ie, what is scope of State?

idea: bound the diameter

›if all states reached in path ≤ k›enough to consider only traces ≤ k

strategy›ask for loopless trace of length k+1

if none, then k is a bound›tighter bounds possible: eg, no shortcuts

Page 54: on research strategy · bakery algorithm w h y th is e xam ple? › curiosity -- I hadn’t done it before › familiarity -- you can compare to Rushby › illustrate aspects of Alloy

18

when is a trace long enough?

for safety properties, check all traces›but how long? ie, what is scope of State?

idea: bound the diameter

›if all states reached in path ≤ k›enough to consider only traces ≤ k

strategy›ask for loopless trace of length k+1

if none, then k is a bound›tighter bounds possible: eg, no shortcuts

like bounded model checking

›but can express conditions directly

Page 55: on research strategy · bakery algorithm w h y th is e xam ple? › curiosity -- I hadn’t done it before › familiarity -- you can compare to Rushby › illustrate aspects of Alloy

18

when is a trace long enough?

for safety properties, check all traces›but how long? ie, what is scope of State?

idea: bound the diameter

›if all states reached in path ≤ k›enough to consider only traces ≤ k

strategy›ask for loopless trace of length k+1

if none, then k is a bound›tighter bounds possible: eg, no shortcuts

like bounded model checking

›but can express conditions directly

diameter = 1

max loopless = 1

Page 56: on research strategy · bakery algorithm w h y th is e xam ple? › curiosity -- I hadn’t done it before › familiarity -- you can compare to Rushby › illustrate aspects of Alloy

18

when is a trace long enough?

for safety properties, check all traces›but how long? ie, what is scope of State?

idea: bound the diameter

›if all states reached in path ≤ k›enough to consider only traces ≤ k

strategy›ask for loopless trace of length k+1

if none, then k is a bound›tighter bounds possible: eg, no shortcuts

like bounded model checking

›but can express conditions directly

diameter = 1

max loopless = 1

diameter = 1

max loopless = 5

Page 57: on research strategy · bakery algorithm w h y th is e xam ple? › curiosity -- I hadn’t done it before › familiarity -- you can compare to Rushby › illustrate aspects of Alloy

19

finding the diameter

Page 58: on research strategy · bakery algorithm w h y th is e xam ple? › curiosity -- I hadn’t done it before › familiarity -- you can compare to Rushby › illustrate aspects of Alloy

19

finding the diameter

fun NoRepetitionsI () {

Interleaving ()

no disj s, s': State | Equiv (s,s')

}fun Equiv (s, s': State) {

s.ticket = s'.ticket

s.idle = s'.idle && s.critical = s'.critical

}run NoRepetitionsI for 3 but 2 Process, 8 State

Page 59: on research strategy · bakery algorithm w h y th is e xam ple? › curiosity -- I hadn’t done it before › familiarity -- you can compare to Rushby › illustrate aspects of Alloy

20

can we fix the tickets in the sam

e way?

Page 60: on research strategy · bakery algorithm w h y th is e xam ple? › curiosity -- I hadn’t done it before › familiarity -- you can compare to Rushby › illustrate aspects of Alloy

20

can we fix the tickets in the sam

e way?

what we want to do›bound the ticket scope for fast analysis›but know that we never run out of tickets

Page 61: on research strategy · bakery algorithm w h y th is e xam ple? › curiosity -- I hadn’t done it before › familiarity -- you can compare to Rushby › illustrate aspects of Alloy

20

can we fix the tickets in the sam

e way?

what we want to do›bound the ticket scope for fast analysis›but know that we never run out of tickets

one idea›find diam

eter of machine

›ensure enough tickets for longest trace

Page 62: on research strategy · bakery algorithm w h y th is e xam ple? › curiosity -- I hadn’t done it before › familiarity -- you can compare to Rushby › illustrate aspects of Alloy

20

can we fix the tickets in the sam

e way?

what we want to do›bound the ticket scope for fast analysis›but know that we never run out of tickets

one idea›find diam

eter of machine

›ensure enough tickets for longest trace

a better idea›ticket allocations with sam

e process order are equivalent›so find diam

eter with respect to ticket ordering›and show not all tickets are used

Page 63: on research strategy · bakery algorithm w h y th is e xam ple? › curiosity -- I hadn’t done it before › familiarity -- you can compare to Rushby › illustrate aspects of Alloy

21

defining the order

Page 64: on research strategy · bakery algorithm w h y th is e xam ple? › curiosity -- I hadn’t done it before › familiarity -- you can compare to Rushby › illustrate aspects of Alloy

21

defining the order

introduce process ordering as a new fieldsig StateW

ithOrder extends State {

precedes: Process -> Process

}{all p, p': Process |

p->p' in precedes iff

ticket[p'] in ^(Ord[Ticket].next)[ticket[p]]

}fact {State = StateWithOrder}

Page 65: on research strategy · bakery algorithm w h y th is e xam ple? › curiosity -- I hadn’t done it before › familiarity -- you can compare to Rushby › illustrate aspects of Alloy

22

defining state equivalence

Page 66: on research strategy · bakery algorithm w h y th is e xam ple? › curiosity -- I hadn’t done it before › familiarity -- you can compare to Rushby › illustrate aspects of Alloy

22

defining state equivalence

define equivalence modulo ordering

fun EquivProcessOrder (s, s': State) {

s.precedes = s'.precedes

s.idle = s'.idle && s.critical = s'.critical

}

Page 67: on research strategy · bakery algorithm w h y th is e xam ple? › curiosity -- I hadn’t done it before › familiarity -- you can compare to Rushby › illustrate aspects of Alloy

22

defining state equivalence

define equivalence modulo ordering

fun EquivProcessOrder (s, s': State) {

s.precedes = s'.precedes

s.idle = s'.idle && s.critical = s'.critical

}

define no repetition constraintfun NoRepetitionsUnderOrderI () {

Interleaving ()

no disj s, s': State | EquivProcessOrder (s,s')

}

Page 68: on research strategy · bakery algorithm w h y th is e xam ple? › curiosity -- I hadn’t done it before › familiarity -- you can compare to Rushby › illustrate aspects of Alloy

23

finding the bounds

Page 69: on research strategy · bakery algorithm w h y th is e xam ple? › curiosity -- I hadn’t done it before › familiarity -- you can compare to Rushby › illustrate aspects of Alloy

23

finding the bounds

find a diameter

run NoRepetitionsUnderOrderI for 7 but 3 Process, 13 State

Page 70: on research strategy · bakery algorithm w h y th is e xam ple? › curiosity -- I hadn’t done it before › familiarity -- you can compare to Rushby › illustrate aspects of Alloy

23

finding the bounds

find a diameter

run NoRepetitionsUnderOrderI for 7 but 3 Process, 13 State

check that tickets not all usedassert EnoughTicketsI {

Interleaving () => Ord[Ticket].last !in State.ticket [Process]

}check EnoughTicketsI for 7 but 3 Process, 12 State

Page 71: on research strategy · bakery algorithm w h y th is e xam ple? › curiosity -- I hadn’t done it before › familiarity -- you can compare to Rushby › illustrate aspects of Alloy

23

finding the bounds

find a diameter

run NoRepetitionsUnderOrderI for 7 but 3 Process, 13 State

check that tickets not all usedassert EnoughTicketsI {

Interleaving () => Ord[Ticket].last !in State.ticket [Process]

}check EnoughTicketsI for 7 but 3 Process, 12 State

so now we know›for 3 processes, 12 states and 7 tickets is fully general

Page 72: on research strategy · bakery algorithm w h y th is e xam ple? › curiosity -- I hadn’t done it before › familiarity -- you can compare to Rushby › illustrate aspects of Alloy

24

getting full coverage

Page 73: on research strategy · bakery algorithm w h y th is e xam ple? › curiosity -- I hadn’t done it before › familiarity -- you can compare to Rushby › illustrate aspects of Alloy

24

getting full coverage

finally, we check thischeck InterleavingSafe for 7 but 3 Process, 12 State

Page 74: on research strategy · bakery algorithm w h y th is e xam ple? › curiosity -- I hadn’t done it before › familiarity -- you can compare to Rushby › illustrate aspects of Alloy

24

getting full coverage

finally, we check thischeck InterleavingSafe for 7 but 3 Process, 12 State

if no counterexample

›we have a ‘proof’ for 3 processes

Page 75: on research strategy · bakery algorithm w h y th is e xam ple? › curiosity -- I hadn’t done it before › familiarity -- you can compare to Rushby › illustrate aspects of Alloy

25

what w

e did

Page 76: on research strategy · bakery algorithm w h y th is e xam ple? › curiosity -- I hadn’t done it before › familiarity -- you can compare to Rushby › illustrate aspects of Alloy

25

what w

e did

unbounded model of bakery

›no fixed number of processes or tickets

Page 77: on research strategy · bakery algorithm w h y th is e xam ple? › curiosity -- I hadn’t done it before › familiarity -- you can compare to Rushby › illustrate aspects of Alloy

25

what w

e did

unbounded model of bakery

›no fixed number of processes or tickets

analysis in small finite scope

›may m

iss counterexamples

Page 78: on research strategy · bakery algorithm w h y th is e xam ple? › curiosity -- I hadn’t done it before › familiarity -- you can compare to Rushby › illustrate aspects of Alloy

25

what w

e did

unbounded model of bakery

›no fixed number of processes or tickets

analysis in small finite scope

›may m

iss counterexamples

established diameter

›for 3 processes, 12 states and 7 tickets is enough

Page 79: on research strategy · bakery algorithm w h y th is e xam ple? › curiosity -- I hadn’t done it before › familiarity -- you can compare to Rushby › illustrate aspects of Alloy

25

what w

e did

unbounded model of bakery

›no fixed number of processes or tickets

analysis in small finite scope

›may m

iss counterexamples

established diameter

›for 3 processes, 12 states and 7 tickets is enough

full analysis for bounded topology›all scenarios for 3 processes

Page 80: on research strategy · bakery algorithm w h y th is e xam ple? › curiosity -- I hadn’t done it before › familiarity -- you can compare to Rushby › illustrate aspects of Alloy

26

summ

ary of Alloy

Page 81: on research strategy · bakery algorithm w h y th is e xam ple? › curiosity -- I hadn’t done it before › familiarity -- you can compare to Rushby › illustrate aspects of Alloy

26

summ

ary of Alloy

a simple language

›relational first-order logic›signatures for structuring: global relations›description is set of constraints

Page 82: on research strategy · bakery algorithm w h y th is e xam ple? › curiosity -- I hadn’t done it before › familiarity -- you can compare to Rushby › illustrate aspects of Alloy

26

summ

ary of Alloy

a simple language

›relational first-order logic›signatures for structuring: global relations›description is set of constraints

an effective analysis›sim

ulation & checking are instance-finding›user provides scope, distinct from

model

›tool reduces Alloy to SAT

Page 83: on research strategy · bakery algorithm w h y th is e xam ple? › curiosity -- I hadn’t done it before › familiarity -- you can compare to Rushby › illustrate aspects of Alloy

26

summ

ary of Alloy

a simple language

›relational first-order logic›signatures for structuring: global relations›description is set of constraints

an effective analysis›sim

ulation & checking are instance-finding›user provides scope, distinct from

model

›tool reduces Alloy to SAT

applications›a variety of case studies›used for teaching in ~15 universities

Page 84: on research strategy · bakery algorithm w h y th is e xam ple? › curiosity -- I hadn’t done it before › familiarity -- you can compare to Rushby › illustrate aspects of Alloy

27

challenges: better analysis

Page 85: on research strategy · bakery algorithm w h y th is e xam ple? › curiosity -- I hadn’t done it before › familiarity -- you can compare to Rushby › illustrate aspects of Alloy

27

challenges: better analysis

improving analysis

›exploiting equalities?›elim

inating irrelevant constraints?›choosing sym

metry predicates?

Page 86: on research strategy · bakery algorithm w h y th is e xam ple? › curiosity -- I hadn’t done it before › familiarity -- you can compare to Rushby › illustrate aspects of Alloy

27

challenges: better analysis

improving analysis

›exploiting equalities?›elim

inating irrelevant constraints?›choosing sym

metry predicates?

mitigating effects of scope

›data independence: scope of 3 enough?›decision procedure for subset?

Page 87: on research strategy · bakery algorithm w h y th is e xam ple? › curiosity -- I hadn’t done it before › familiarity -- you can compare to Rushby › illustrate aspects of Alloy

27

challenges: better analysis

improving analysis

›exploiting equalities?›elim

inating irrelevant constraints?›choosing sym

metry predicates?

mitigating effects of scope

›data independence: scope of 3 enough?›decision procedure for subset?

analyzing inconsistency›what when no instances are found?›m

ight have shownfalse => property

›tool might show which constraints used

Page 88: on research strategy · bakery algorithm w h y th is e xam ple? › curiosity -- I hadn’t done it before › familiarity -- you can compare to Rushby › illustrate aspects of Alloy

28

challenges: applications

Page 89: on research strategy · bakery algorithm w h y th is e xam ple? › curiosity -- I hadn’t done it before › familiarity -- you can compare to Rushby › illustrate aspects of Alloy

28

challenges: applications

finding bugs in code›extract form

ula from procedure

p(s,s0,s1,…,s’)

›check the conjecturepre(s) && p(s,s0,s1,…

,s’) => post(s,s’)›counterexam

ple is trace

Page 90: on research strategy · bakery algorithm w h y th is e xam ple? › curiosity -- I hadn’t done it before › familiarity -- you can compare to Rushby › illustrate aspects of Alloy

28

challenges: applications

finding bugs in code›extract form

ula from procedure

p(s,s0,s1,…,s’)

›check the conjecturepre(s) && p(s,s0,s1,…

,s’) => post(s,s’)›counterexam

ple is trace

build veneers on Alloy›on API, or as m

acro language›eg, role-based access control›eg, sem

antic web design

Page 91: on research strategy · bakery algorithm w h y th is e xam ple? › curiosity -- I hadn’t done it before › familiarity -- you can compare to Rushby › illustrate aspects of Alloy

29

challenges: case studies

Page 92: on research strategy · bakery algorithm w h y th is e xam ple? › curiosity -- I hadn’t done it before › familiarity -- you can compare to Rushby › illustrate aspects of Alloy

29

challenges: case studies

source code control›m

odel CVS at multiple levels

›is it correct?

Page 93: on research strategy · bakery algorithm w h y th is e xam ple? › curiosity -- I hadn’t done it before › familiarity -- you can compare to Rushby › illustrate aspects of Alloy

29

challenges: case studies

source code control›m

odel CVS at multiple levels

›is it correct?

meta m

odelling›check consistency of UM

L metam

odel›check theorem

s of Unified Theory?

Page 94: on research strategy · bakery algorithm w h y th is e xam ple? › curiosity -- I hadn’t done it before › familiarity -- you can compare to Rushby › illustrate aspects of Alloy

29

challenges: case studies

source code control›m

odel CVS at multiple levels

›is it correct?

meta m

odelling›check consistency of UM

L metam

odel›check theorem

s of Unified Theory?

dynamic topology algorithm

s›reverse path forwarding, eg

Page 95: on research strategy · bakery algorithm w h y th is e xam ple? › curiosity -- I hadn’t done it before › familiarity -- you can compare to Rushby › illustrate aspects of Alloy

30

thank you!dnj@

mit.edu