and analy larative sis w - mit csaillarative m o d e llin g and analy sis w ith allo y le c tu re 1:...

150
micromodels of software declarative modelling and analysis with Alloy lecture 1: introduction Daniel Jackson MIT Lab for Computer Science Marktoberdorf, August 2002

Upload: others

Post on 06-Mar-2021

1 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: and analy larative sis w - MIT CSAILlarative m o d e llin g and analy sis w ith Allo y le c tu re 1: in tro d u c tio n Daniel Jackson MIT La b for Computer Science Marktoberdorf,

microm

odels of software

declarative modelling

and analysis with A

lloy

lecture 1: introduction

Daniel JacksonM

IT Lab for Computer Science

Marktoberdorf, August 2002

Page 2: and analy larative sis w - MIT CSAILlarative m o d e llin g and analy sis w ith Allo y le c tu re 1: in tro d u c tio n Daniel Jackson MIT La b for Computer Science Marktoberdorf,

2

lightweight m

odels

Page 3: and analy larative sis w - MIT CSAILlarative m o d e llin g and analy sis w ith Allo y le c tu re 1: in tro d u c tio n Daniel Jackson MIT La b for Computer Science Marktoberdorf,

2

lightweight m

odels

a foundation for robust, useable programs

Page 4: and analy larative sis w - MIT CSAILlarative m o d e llin g and analy sis w ith Allo y le c tu re 1: in tro d u c tio n Daniel Jackson MIT La b for Computer Science Marktoberdorf,

2

lightweight m

odels

a foundation for robust, useable programs

elements

›small & sim

ple notations›partial m

odels & analyses›full autom

ation

Page 5: and analy larative sis w - MIT CSAILlarative m o d e llin g and analy sis w ith Allo y le c tu re 1: in tro d u c tio n Daniel Jackson MIT La b for Computer Science Marktoberdorf,

2

lightweight m

odels

a foundation for robust, useable programs

elements

›small & sim

ple notations›partial m

odels & analyses›full autom

ation

focus on risky aspects›hard to get right, or to check›structure-determ

ining›high cost of failure

Page 6: and analy larative sis w - MIT CSAILlarative m o d e llin g and analy sis w ith Allo y le c tu re 1: in tro d u c tio n Daniel Jackson MIT La b for Computer Science Marktoberdorf,

3

what assurance costs

Page 7: and analy larative sis w - MIT CSAILlarative m o d e llin g and analy sis w ith Allo y le c tu re 1: in tro d u c tio n Daniel Jackson MIT La b for Computer Science Marktoberdorf,

3

cost

assurance

what assurance costs

Page 8: and analy larative sis w - MIT CSAILlarative m o d e llin g and analy sis w ith Allo y le c tu re 1: in tro d u c tio n Daniel Jackson MIT La b for Computer Science Marktoberdorf,

3

cost

assurance

hacking

what assurance costs

Page 9: and analy larative sis w - MIT CSAILlarative m o d e llin g and analy sis w ith Allo y le c tu re 1: in tro d u c tio n Daniel Jackson MIT La b for Computer Science Marktoberdorf,

3

cost

assurance

hacking

what assurance costs

Page 10: and analy larative sis w - MIT CSAILlarative m o d e llin g and analy sis w ith Allo y le c tu re 1: in tro d u c tio n Daniel Jackson MIT La b for Computer Science Marktoberdorf,

3

cost

assurance

hackingsketching

what assurance costs

Page 11: and analy larative sis w - MIT CSAILlarative m o d e llin g and analy sis w ith Allo y le c tu re 1: in tro d u c tio n Daniel Jackson MIT La b for Computer Science Marktoberdorf,

3

cost

assurance

hackingsketchingw

rite-only models

what assurance costs

Page 12: and analy larative sis w - MIT CSAILlarative m o d e llin g and analy sis w ith Allo y le c tu re 1: in tro d u c tio n Daniel Jackson MIT La b for Computer Science Marktoberdorf,

3

cost

assurance

hackingsketchingw

rite-only models

type-checked models

what assurance costs

Page 13: and analy larative sis w - MIT CSAILlarative m o d e llin g and analy sis w ith Allo y le c tu re 1: in tro d u c tio n Daniel Jackson MIT La b for Computer Science Marktoberdorf,

3

cost

assurance

hackingsketchingw

rite-only models

type-checked models

proven models

what assurance costs

Page 14: and analy larative sis w - MIT CSAILlarative m o d e llin g and analy sis w ith Allo y le c tu re 1: in tro d u c tio n Daniel Jackson MIT La b for Computer Science Marktoberdorf,

3

cost

assurance

hackingsketchingw

rite-only models

type-checked models

analyzed models

proven models

what assurance costs

Page 15: and analy larative sis w - MIT CSAILlarative m o d e llin g and analy sis w ith Allo y le c tu re 1: in tro d u c tio n Daniel Jackson MIT La b for Computer Science Marktoberdorf,

4

my w

ork in marktoberdorf context

Page 16: and analy larative sis w - MIT CSAILlarative m o d e llin g and analy sis w ith Allo y le c tu re 1: in tro d u c tio n Daniel Jackson MIT La b for Computer Science Marktoberdorf,

4

my w

ork in marktoberdorf context

computation, not interaction

›complem

entary to Harel & Pnueli›relational, not algebraic (cf. Tarlecki and M

eseguer)›underlying idiom

s due to Hoare, Woodcock et al

Page 17: and analy larative sis w - MIT CSAILlarative m o d e llin g and analy sis w ith Allo y le c tu re 1: in tro d u c tio n Daniel Jackson MIT La b for Computer Science Marktoberdorf,

4

my w

ork in marktoberdorf context

computation, not interaction

›complem

entary to Harel & Pnueli›relational, not algebraic (cf. Tarlecki and M

eseguer)›underlying idiom

s due to Hoare, Woodcock et al

designed for experts, but not super-experts›like Harel, not Rushby & M

oore›sim

ulation, not just checking

Page 18: and analy larative sis w - MIT CSAILlarative m o d e llin g and analy sis w ith Allo y le c tu re 1: in tro d u c tio n Daniel Jackson MIT La b for Computer Science Marktoberdorf,

4

my w

ork in marktoberdorf context

computation, not interaction

›complem

entary to Harel & Pnueli›relational, not algebraic (cf. Tarlecki and M

eseguer)›underlying idiom

s due to Hoare, Woodcock et al

designed for experts, but not super-experts›like Harel, not Rushby & M

oore›sim

ulation, not just checking

role of mathem

atics›only way to m

ake things simple

›semantics in term

s of sets, and SAT

Page 19: and analy larative sis w - MIT CSAILlarative m o d e llin g and analy sis w ith Allo y le c tu re 1: in tro d u c tio n Daniel Jackson MIT La b for Computer Science Marktoberdorf,

4

my w

ork in marktoberdorf context

computation, not interaction

›complem

entary to Harel & Pnueli›relational, not algebraic (cf. Tarlecki and M

eseguer)›underlying idiom

s due to Hoare, Woodcock et al

designed for experts, but not super-experts›like Harel, not Rushby & M

oore›sim

ulation, not just checking

role of mathem

atics›only way to m

ake things simple

›semantics in term

s of sets, and SAT

started this in 1994, and have had some successes

but much less m

ature than ACL2, PVS, Statemate, etc

Page 20: and analy larative sis w - MIT CSAILlarative m o d e llin g and analy sis w ith Allo y le c tu re 1: in tro d u c tio n Daniel Jackson MIT La b for Computer Science Marktoberdorf,

5

features of Alloy

Page 21: and analy larative sis w - MIT CSAILlarative m o d e llin g and analy sis w ith Allo y le c tu re 1: in tro d u c tio n Daniel Jackson MIT La b for Computer Science Marktoberdorf,

5

features of Alloy

structural›express com

plex structure, static and dynamic

›with just a few powerful operators

Page 22: and analy larative sis w - MIT CSAILlarative m o d e llin g and analy sis w ith Allo y le c tu re 1: in tro d u c tio n Daniel Jackson MIT La b for Computer Science Marktoberdorf,

5

features of Alloy

structural›express com

plex structure, static and dynamic

›with just a few powerful operators

declarative›a full logic, with conjunction and negation›describe system

as collection of constraints

Page 23: and analy larative sis w - MIT CSAILlarative m o d e llin g and analy sis w ith Allo y le c tu re 1: in tro d u c tio n Daniel Jackson MIT La b for Computer Science Marktoberdorf,

5

features of Alloy

structural›express com

plex structure, static and dynamic

›with just a few powerful operators

declarative›a full logic, with conjunction and negation›describe system

as collection of constraints

analyzable›sim

ulation & checking›fully autom

atic

Page 24: and analy larative sis w - MIT CSAILlarative m o d e llin g and analy sis w ith Allo y le c tu re 1: in tro d u c tio n Daniel Jackson MIT La b for Computer Science Marktoberdorf,

6

structural

Page 25: and analy larative sis w - MIT CSAILlarative m o d e llin g and analy sis w ith Allo y le c tu re 1: in tro d u c tio n Daniel Jackson MIT La b for Computer Science Marktoberdorf,

6

structural

structure is everywhere›highway system

s, postal routes, company organizations,

library catalogues, address books, phone networks, …

Page 26: and analy larative sis w - MIT CSAILlarative m o d e llin g and analy sis w ith Allo y le c tu re 1: in tro d u c tio n Daniel Jackson MIT La b for Computer Science Marktoberdorf,

6

structural

structure is everywhere›highway system

s, postal routes, company organizations,

library catalogues, address books, phone networks, …

structure is becoming m

ore pervasive›self-assem

bling software (eg, Observer pattern)

›mem

ory gets cheaper: address books in every phone

Page 27: and analy larative sis w - MIT CSAILlarative m o d e llin g and analy sis w ith Allo y le c tu re 1: in tro d u c tio n Daniel Jackson MIT La b for Computer Science Marktoberdorf,

6

structural

structure is everywhere›highway system

s, postal routes, company organizations,

library catalogues, address books, phone networks, …

structure is becoming m

ore pervasive›self-assem

bling software (eg, Observer pattern)

›mem

ory gets cheaper: address books in every phone

tool researchers have neglected structure›one traffic light is a state m

achine, but a city’s lights are a net

Page 28: and analy larative sis w - MIT CSAILlarative m o d e llin g and analy sis w ith Allo y le c tu re 1: in tro d u c tio n Daniel Jackson MIT La b for Computer Science Marktoberdorf,

6

structural

structure is everywhere›highway system

s, postal routes, company organizations,

library catalogues, address books, phone networks, …

structure is becoming m

ore pervasive›self-assem

bling software (eg, Observer pattern)

›mem

ory gets cheaper: address books in every phone

tool researchers have neglected structure›one traffic light is a state m

achine, but a city’s lights are a net

There is no problem in com

puter science that cannot be solvedby introducing another level of indirection, but that usuallyreveals new problem

s --David Wheeler

Page 29: and analy larative sis w - MIT CSAILlarative m o d e llin g and analy sis w ith Allo y le c tu re 1: in tro d u c tio n Daniel Jackson MIT La b for Computer Science Marktoberdorf,

7

declarative

Page 30: and analy larative sis w - MIT CSAILlarative m o d e llin g and analy sis w ith Allo y le c tu re 1: in tro d u c tio n Daniel Jackson MIT La b for Computer Science Marktoberdorf,

7

declarative

declarative description›m

odel is collection of properties›the m

ore you say, the less happens

Page 31: and analy larative sis w - MIT CSAILlarative m o d e llin g and analy sis w ith Allo y le c tu re 1: in tro d u c tio n Daniel Jackson MIT La b for Computer Science Marktoberdorf,

7

declarative

declarative description›m

odel is collection of properties›the m

ore you say, the less happens

advantages›increm

entality: to say more, add a property

›partiality: doesn’t require special constructs›sim

plicity: no separate language of propertiesSys m

eets Prop: Sys => Prop

Page 32: and analy larative sis w - MIT CSAILlarative m o d e llin g and analy sis w ith Allo y le c tu re 1: in tro d u c tio n Daniel Jackson MIT La b for Computer Science Marktoberdorf,

7

declarative

declarative description›m

odel is collection of properties›the m

ore you say, the less happens

advantages›increm

entality: to say more, add a property

›partiality: doesn’t require special constructs›sim

plicity: no separate language of propertiesSys m

eets Prop: Sys => Prop

why less is more

›less constrained system m

eans implem

entation freedom›less constrained environm

ent means greater safety

Page 33: and analy larative sis w - MIT CSAILlarative m o d e llin g and analy sis w ith Allo y le c tu re 1: in tro d u c tio n Daniel Jackson MIT La b for Computer Science Marktoberdorf,

8

analyzable

Page 34: and analy larative sis w - MIT CSAILlarative m o d e llin g and analy sis w ith Allo y le c tu re 1: in tro d u c tio n Daniel Jackson MIT La b for Computer Science Marktoberdorf,

8

analyzable

‘write-only’ models

›useful if precise enough›but m

issed opportunity (and wishful thinking)

Page 35: and analy larative sis w - MIT CSAILlarative m o d e llin g and analy sis w ith Allo y le c tu re 1: in tro d u c tio n Daniel Jackson MIT La b for Computer Science Marktoberdorf,

8

analyzable

‘write-only’ models

›useful if precise enough›but m

issed opportunity (and wishful thinking)

tool-assisted modelling

›simulate and check increm

entally›catch errors early, develop confidence›optim

ize for failing case: most of m

y examples will be wrong

Page 36: and analy larative sis w - MIT CSAILlarative m o d e llin g and analy sis w ith Allo y le c tu re 1: in tro d u c tio n Daniel Jackson MIT La b for Computer Science Marktoberdorf,

8

analyzable

‘write-only’ models

›useful if precise enough›but m

issed opportunity (and wishful thinking)

tool-assisted modelling

›simulate and check increm

entally›catch errors early, develop confidence›optim

ize for failing case: most of m

y examples will be wrong

Alloy’s analysis›fully autom

atic, with no user intervention›concrete: generates sam

ples & counterexamples

›like testing, sound but not complete

›unlike testing, billions cases/second

Page 37: and analy larative sis w - MIT CSAILlarative m o d e llin g and analy sis w ith Allo y le c tu re 1: in tro d u c tio n Daniel Jackson MIT La b for Computer Science Marktoberdorf,

9

declarative & executable?

Small Tow

er of 6 Gears, Arthur Ganson

Page 38: and analy larative sis w - MIT CSAILlarative m o d e llin g and analy sis w ith Allo y le c tu re 1: in tro d u c tio n Daniel Jackson MIT La b for Computer Science Marktoberdorf,

9

declarative & executable?

traditionally›declarative XO

R executable›good argum

ents for both

Small Tow

er of 6 Gears, Arthur Ganson

Page 39: and analy larative sis w - MIT CSAILlarative m o d e llin g and analy sis w ith Allo y le c tu re 1: in tro d u c tio n Daniel Jackson MIT La b for Computer Science Marktoberdorf,

9

declarative & executable?

traditionally›declarative XO

R executable›good argum

ents for both

but can have cake and eat it›with right analysis technology

Small Tow

er of 6 Gears, Arthur Ganson

Page 40: and analy larative sis w - MIT CSAILlarative m o d e llin g and analy sis w ith Allo y le c tu re 1: in tro d u c tio n Daniel Jackson MIT La b for Computer Science Marktoberdorf,

9

declarative & executable?

traditionally›declarative XO

R executable›good argum

ents for both

but can have cake and eat it›with right analysis technology

Alloy’s analysis can ‘execute’ a model

›forwards or backwards›without test cases›no ad hoc restrictions on logic

Small Tow

er of 6 Gears, Arthur Ganson

Page 41: and analy larative sis w - MIT CSAILlarative m o d e llin g and analy sis w ith Allo y le c tu re 1: in tro d u c tio n Daniel Jackson MIT La b for Computer Science Marktoberdorf,

10

a numbering problem

Page 42: and analy larative sis w - MIT CSAILlarative m o d e llin g and analy sis w ith Allo y le c tu re 1: in tro d u c tio n Daniel Jackson MIT La b for Computer Science Marktoberdorf,

10

a numbering problem

given›docum

ent whose paragraphs are tagged with styles›style sheet that gives num

bering rules for styles

Page 43: and analy larative sis w - MIT CSAILlarative m o d e llin g and analy sis w ith Allo y le c tu re 1: in tro d u c tio n Daniel Jackson MIT La b for Computer Science Marktoberdorf,

10

a numbering problem

given›docum

ent whose paragraphs are tagged with styles›style sheet that gives num

bering rules for styles

produce›docum

ent with numbered paragraphs

(like my M

arktoberdorf notes)

Page 44: and analy larative sis w - MIT CSAILlarative m o d e llin g and analy sis w ith Allo y le c tu re 1: in tro d u c tio n Daniel Jackson MIT La b for Computer Science Marktoberdorf,

10

a numbering problem

given›docum

ent whose paragraphs are tagged with styles›style sheet that gives num

bering rules for styles

produce›docum

ent with numbered paragraphs

(like my M

arktoberdorf notes)

\part Introduction\section M

otivation\subsection W

hy?\section Overview\part Conclusions\section Unrelated W

ork

\part Introduction\section M

otivation\subsection W

hy?\section Overview\part Conclusions\section Unrelated W

ork

Page 45: and analy larative sis w - MIT CSAILlarative m o d e llin g and analy sis w ith Allo y le c tu re 1: in tro d u c tio n Daniel Jackson MIT La b for Computer Science Marktoberdorf,

10

a numbering problem

given›docum

ent whose paragraphs are tagged with styles›style sheet that gives num

bering rules for styles

produce›docum

ent with numbered paragraphs

(like my M

arktoberdorf notes)

\part Introduction\section M

otivation\subsection W

hy?\section Overview\part Conclusions\section Unrelated W

ork

\part Introduction\section M

otivation\subsection W

hy?\section Overview\part Conclusions\section Unrelated W

ork

Part A: IntroductionA.1 M

otivationA.1.1 W

hy?A.2 OverviewPart B: ConclusionsB.1 Unrelated W

ork

Part A: IntroductionA.1 M

otivationA.1.1 W

hy?A.2 OverviewPart B: ConclusionsB.1 Unrelated W

ork

Page 46: and analy larative sis w - MIT CSAILlarative m o d e llin g and analy sis w ith Allo y le c tu re 1: in tro d u c tio n Daniel Jackson MIT La b for Computer Science Marktoberdorf,

11

a candidate solution

style sheet assigns to each style›an initial value for num

bering›optionally, a parent

Page 47: and analy larative sis w - MIT CSAILlarative m o d e llin g and analy sis w ith Allo y le c tu re 1: in tro d u c tio n Daniel Jackson MIT La b for Computer Science Marktoberdorf,

11

a candidate solution

style sheet assigns to each style›an initial value for num

bering›optionally, a parent

section1

section1 partA

partA

subsection1

subsection1

parent<style:part><init:A><style:section><parent:part><init:1><style:subsection><parent: section><init:1>

<style:part><init:A><style:section><parent:part><init:1><style:subsection><parent: section><init:1>

Page 48: and analy larative sis w - MIT CSAILlarative m o d e llin g and analy sis w ith Allo y le c tu re 1: in tro d u c tio n Daniel Jackson MIT La b for Computer Science Marktoberdorf,

11

a candidate solution

style sheet assigns to each style›an initial value for num

bering›optionally, a parent

\part Introduction\section M

otivation\subsection W

hy?\section Overview\part Conclusions\section Unrelated W

ork

\part Introduction\section M

otivation\subsection W

hy?\section Overview\part Conclusions\section Unrelated W

ork

section1

section1 partA

partA

subsection1

subsection1

parent<style:part><init:A><style:section><parent:part><init:1><style:subsection><parent: section><init:1>

<style:part><init:A><style:section><parent:part><init:1><style:subsection><parent: section><init:1>

Page 49: and analy larative sis w - MIT CSAILlarative m o d e llin g and analy sis w ith Allo y le c tu re 1: in tro d u c tio n Daniel Jackson MIT La b for Computer Science Marktoberdorf,

11

a candidate solution

style sheet assigns to each style›an initial value for num

bering›optionally, a parent

\part Introduction\section M

otivation\subsection W

hy?\section Overview\part Conclusions\section Unrelated W

ork

\part Introduction\section M

otivation\subsection W

hy?\section Overview\part Conclusions\section Unrelated W

ork

section1

section1 partA

partA

subsection1

subsection1

parent<style:part><init:A><style:section><parent:part><init:1><style:subsection><parent: section><init:1>

<style:part><init:A><style:section><parent:part><init:1><style:subsection><parent: section><init:1>Part A: Introduction

A.1 Motivation

A.1.1 Why?

A.2 OverviewPart B: ConclusionsB.1 Unrelated W

ork

Part A: IntroductionA.1 M

otivationA.1.1 W

hy?A.2 OverviewPart B: ConclusionsB.1 Unrelated W

ork

Page 50: and analy larative sis w - MIT CSAILlarative m o d e llin g and analy sis w ith Allo y le c tu re 1: in tro d u c tio n Daniel Jackson MIT La b for Computer Science Marktoberdorf,

12

styles

Page 51: and analy larative sis w - MIT CSAILlarative m o d e llin g and analy sis w ith Allo y le c tu re 1: in tro d u c tio n Daniel Jackson MIT La b for Computer Science Marktoberdorf,

12

styles

declare styles & parent relationsig Style {parent: option Style}

Page 52: and analy larative sis w - MIT CSAILlarative m o d e llin g and analy sis w ith Allo y le c tu re 1: in tro d u c tio n Daniel Jackson MIT La b for Computer Science Marktoberdorf,

12

styles

declare styles & parent relationsig Style {parent: option Style}

ask for a sample

fun Show () {som

e parent}run Show

Page 53: and analy larative sis w - MIT CSAILlarative m o d e llin g and analy sis w ith Allo y le c tu re 1: in tro d u c tio n Daniel Jackson MIT La b for Computer Science Marktoberdorf,

12

styles

declare styles & parent relationsig Style {parent: option Style}

ask for a sample

fun Show () {som

e parent}run Show

Page 54: and analy larative sis w - MIT CSAILlarative m o d e llin g and analy sis w ith Allo y le c tu re 1: in tro d u c tio n Daniel Jackson MIT La b for Computer Science Marktoberdorf,

12

styles

declare styles & parent relationsig Style {parent: option Style}

ask for a sample

fun Show () {som

e parent}run Show

constrain parent relation to be acyclicfact {Acyclic (parent)}

Page 55: and analy larative sis w - MIT CSAILlarative m o d e llin g and analy sis w ith Allo y le c tu re 1: in tro d u c tio n Daniel Jackson MIT La b for Computer Science Marktoberdorf,

12

styles

declare styles & parent relationsig Style {parent: option Style}

ask for a sample

fun Show () {som

e parent}run Show

constrain parent relation to be acyclicfact {Acyclic (parent)}

Page 56: and analy larative sis w - MIT CSAILlarative m o d e llin g and analy sis w ith Allo y le c tu re 1: in tro d u c tio n Daniel Jackson MIT La b for Computer Science Marktoberdorf,

12

styles

declare styles & parent relationsig Style {parent: option Style}

ask for a sample

fun Show () {som

e parent}run Show

how to define acyclicfun Acyclic [t] (r: t -> t) {no iden[t] & ^r}

constrain parent relation to be acyclicfact {Acyclic (parent)}

Page 57: and analy larative sis w - MIT CSAILlarative m o d e llin g and analy sis w ith Allo y le c tu re 1: in tro d u c tio n Daniel Jackson MIT La b for Computer Science Marktoberdorf,

13

numbers

Page 58: and analy larative sis w - MIT CSAILlarative m o d e llin g and analy sis w ith Allo y le c tu re 1: in tro d u c tio n Daniel Jackson MIT La b for Computer Science Marktoberdorf,

13

numbers

introduce numbers

sig Number {

next: option Number

}{this != next}

Page 59: and analy larative sis w - MIT CSAILlarative m o d e llin g and analy sis w ith Allo y le c tu re 1: in tro d u c tio n Daniel Jackson MIT La b for Computer Science Marktoberdorf,

13

numbers

introduce numbers

sig Number {

next: option Number

}{this != next}

add numbers to styles

sig NumberedStyle extends Style {init: Num

ber}fact {Style = Num

beredStyle}

Page 60: and analy larative sis w - MIT CSAILlarative m o d e llin g and analy sis w ith Allo y le c tu re 1: in tro d u c tio n Daniel Jackson MIT La b for Computer Science Marktoberdorf,

13

numbers

introduce numbers

sig Number {

next: option Number

}{this != next}

add numbers to styles

sig NumberedStyle extends Style {init: Num

ber}fact {Style = Num

beredStyle}

ask for a sample

fun Show () {

some parent}

run Show

Page 61: and analy larative sis w - MIT CSAILlarative m o d e llin g and analy sis w ith Allo y le c tu re 1: in tro d u c tio n Daniel Jackson MIT La b for Computer Science Marktoberdorf,

13

numbers

introduce numbers

sig Number {

next: option Number

}{this != next}

add numbers to styles

sig NumberedStyle extends Style {init: Num

ber}fact {Style = Num

beredStyle}

ask for a sample

fun Show () {

some parent}

run Show

Page 62: and analy larative sis w - MIT CSAILlarative m o d e llin g and analy sis w ith Allo y le c tu re 1: in tro d u c tio n Daniel Jackson MIT La b for Computer Science Marktoberdorf,

14

numbering

Page 63: and analy larative sis w - MIT CSAILlarative m o d e llin g and analy sis w ith Allo y le c tu re 1: in tro d u c tio n Daniel Jackson MIT La b for Computer Science Marktoberdorf,

14

numbering

declare numbering

sig Numbering {

num: Style ->? Num

ber}

Page 64: and analy larative sis w - MIT CSAILlarative m o d e llin g and analy sis w ith Allo y le c tu re 1: in tro d u c tio n Daniel Jackson MIT La b for Computer Science Marktoberdorf,

14

numbering

declare numbering

sig Numbering {

num: Style ->? Num

ber}

ask for a sample

fun ShowNum

bering () {some num

}run Show

Numbering

for 2 but 1 Numbering

Page 65: and analy larative sis w - MIT CSAILlarative m o d e llin g and analy sis w ith Allo y le c tu re 1: in tro d u c tio n Daniel Jackson MIT La b for Computer Science Marktoberdorf,

14

numbering

declare numbering

sig Numbering {

num: Style ->? Num

ber}

ask for a sample

fun ShowNum

bering () {some num

}run Show

Numbering

for 2 but 1 Numbering

Page 66: and analy larative sis w - MIT CSAILlarative m o d e llin g and analy sis w ith Allo y le c tu re 1: in tro d u c tio n Daniel Jackson MIT La b for Computer Science Marktoberdorf,

14

numbering

declare numbering

sig Numbering {

num: Style ->? Num

ber}

ask for a sample

fun ShowNum

bering () {some num

}run Show

Numbering

for 2 but 1 Numbering

Page 67: and analy larative sis w - MIT CSAILlarative m o d e llin g and analy sis w ith Allo y le c tu re 1: in tro d u c tio n Daniel Jackson MIT La b for Computer Science Marktoberdorf,

15

numbering algorithm

Page 68: and analy larative sis w - MIT CSAILlarative m o d e llin g and analy sis w ith Allo y le c tu re 1: in tro d u c tio n Daniel Jackson MIT La b for Computer Science Marktoberdorf,

15

numbering algorithm

what numbering n’ follows n for paragraph of style s?

›ie, just gave numbering n

›encounter paragraph with style s›m

ust now generate numbering n’

Page 69: and analy larative sis w - MIT CSAILlarative m o d e llin g and analy sis w ith Allo y le c tu re 1: in tro d u c tio n Daniel Jackson MIT La b for Computer Science Marktoberdorf,

15

numbering algorithm

what numbering n’ follows n for paragraph of style s?

›ie, just gave numbering n

›encounter paragraph with style s›m

ust now generate numbering n’

an attempt:

fun Next (n,n': Numbering, s: Style) {

n'.num =

{d: s.^parent, x: Number | x = n.num

[d]} +s -> if no n.num

[s] then s.init else n.num[s].next

}

Page 70: and analy larative sis w - MIT CSAILlarative m o d e llin g and analy sis w ith Allo y le c tu re 1: in tro d u c tio n Daniel Jackson MIT La b for Computer Science Marktoberdorf,

16

showing next

Page 71: and analy larative sis w - MIT CSAILlarative m o d e llin g and analy sis w ith Allo y le c tu re 1: in tro d u c tio n Daniel Jackson MIT La b for Computer Science Marktoberdorf,

16

showing next

run Next for 3 but 2 Numbering

Page 72: and analy larative sis w - MIT CSAILlarative m o d e llin g and analy sis w ith Allo y le c tu re 1: in tro d u c tio n Daniel Jackson MIT La b for Computer Science Marktoberdorf,

16

showing next

run Next for 3 but 2 Numbering

n

Page 73: and analy larative sis w - MIT CSAILlarative m o d e llin g and analy sis w ith Allo y le c tu re 1: in tro d u c tio n Daniel Jackson MIT La b for Computer Science Marktoberdorf,

16

showing next

run Next for 3 but 2 Numbering

n

n’

Page 74: and analy larative sis w - MIT CSAILlarative m o d e llin g and analy sis w ith Allo y le c tu re 1: in tro d u c tio n Daniel Jackson MIT La b for Computer Science Marktoberdorf,

16

showing next

run Next for 3 but 2 Numbering

n

n’

grandchild style sis num

beredw

ith initial value

Page 75: and analy larative sis w - MIT CSAILlarative m o d e llin g and analy sis w ith Allo y le c tu re 1: in tro d u c tio n Daniel Jackson MIT La b for Computer Science Marktoberdorf,

17

guiding the simulation

Page 76: and analy larative sis w - MIT CSAILlarative m o d e llin g and analy sis w ith Allo y le c tu re 1: in tro d u c tio n Daniel Jackson MIT La b for Computer Science Marktoberdorf,

17

guiding the simulation

fun ShowNext (n,n': Num

bering, s: Style) {Next (n,n',s)

&& some n.num

[s.~parent]}run Show

Next for 3 but 2 Numbering

Page 77: and analy larative sis w - MIT CSAILlarative m o d e llin g and analy sis w ith Allo y le c tu re 1: in tro d u c tio n Daniel Jackson MIT La b for Computer Science Marktoberdorf,

17

guiding the simulation

fun ShowNext (n,n': Num

bering, s: Style) {Next (n,n',s)

&& some n.num

[s.~parent]}run Show

Next for 3 but 2 Numbering

n

Page 78: and analy larative sis w - MIT CSAILlarative m o d e llin g and analy sis w ith Allo y le c tu re 1: in tro d u c tio n Daniel Jackson MIT La b for Computer Science Marktoberdorf,

17

guiding the simulation

fun ShowNext (n,n': Num

bering, s: Style) {Next (n,n',s)

&& some n.num

[s.~parent]}run Show

Next for 3 but 2 Numbering

nn’

Page 79: and analy larative sis w - MIT CSAILlarative m o d e llin g and analy sis w ith Allo y le c tu re 1: in tro d u c tio n Daniel Jackson MIT La b for Computer Science Marktoberdorf,

17

guiding the simulation

fun ShowNext (n,n': Num

bering, s: Style) {Next (n,n',s)

&& some n.num

[s.~parent]}run Show

Next for 3 but 2 Numbering

nn’

root style sloses its num

berbecause no next!

Page 80: and analy larative sis w - MIT CSAILlarative m o d e llin g and analy sis w ith Allo y le c tu re 1: in tro d u c tio n Daniel Jackson MIT La b for Computer Science Marktoberdorf,

18

fixing the operation

Page 81: and analy larative sis w - MIT CSAILlarative m o d e llin g and analy sis w ith Allo y le c tu re 1: in tro d u c tio n Daniel Jackson MIT La b for Computer Science Marktoberdorf,

18

fixing the operationfun Next (n,n': Num

bering, s: Style) {let i = n.num

[s] | some i => som

e i.nextn'.num

= {d: s.^parent, x: Number | x = n.num

[d]} +s -> if no n.num

[s] then s.init else n.num[s].next }

Page 82: and analy larative sis w - MIT CSAILlarative m o d e llin g and analy sis w ith Allo y le c tu re 1: in tro d u c tio n Daniel Jackson MIT La b for Computer Science Marktoberdorf,

18

fixing the operationfun Next (n,n': Num

bering, s: Style) {let i = n.num

[s] | some i => som

e i.nextn'.num

= {d: s.^parent, x: Number | x = n.num

[d]} +s -> if no n.num

[s] then s.init else n.num[s].next }

Page 83: and analy larative sis w - MIT CSAILlarative m o d e llin g and analy sis w ith Allo y le c tu re 1: in tro d u c tio n Daniel Jackson MIT La b for Computer Science Marktoberdorf,

18

fixing the operationfun Next (n,n': Num

bering, s: Style) {let i = n.num

[s] | some i => som

e i.nextn'.num

= {d: s.^parent, x: Number | x = n.num

[d]} +s -> if no n.num

[s] then s.init else n.num[s].next }

Page 84: and analy larative sis w - MIT CSAILlarative m o d e llin g and analy sis w ith Allo y le c tu re 1: in tro d u c tio n Daniel Jackson MIT La b for Computer Science Marktoberdorf,

18

fixing the operationfun Next (n,n': Num

bering, s: Style) {let i = n.num

[s] | some i => som

e i.nextn'.num

= {d: s.^parent, x: Number | x = n.num

[d]} +s -> if no n.num

[s] then s.init else n.num[s].next } style s gets

numbered w

ithinitial value

Page 85: and analy larative sis w - MIT CSAILlarative m o d e llin g and analy sis w ith Allo y le c tu re 1: in tro d u c tio n Daniel Jackson MIT La b for Computer Science Marktoberdorf,

19

guiding the simulation

Page 86: and analy larative sis w - MIT CSAILlarative m o d e llin g and analy sis w ith Allo y le c tu re 1: in tro d u c tio n Daniel Jackson MIT La b for Computer Science Marktoberdorf,

19

guiding the simulation

fun ShowNext (n,n': Num

bering, s: Style) {Next (n,n',s)

&& some n.num

[s.~parent] && some n.num

[s]}run Show

Next for 3 but 2 Numbering

Page 87: and analy larative sis w - MIT CSAILlarative m o d e llin g and analy sis w ith Allo y le c tu re 1: in tro d u c tio n Daniel Jackson MIT La b for Computer Science Marktoberdorf,

19

guiding the simulation

fun ShowNext (n,n': Num

bering, s: Style) {Next (n,n',s)

&& some n.num

[s.~parent] && some n.num

[s]}run Show

Next for 3 but 2 Numbering

Page 88: and analy larative sis w - MIT CSAILlarative m o d e llin g and analy sis w ith Allo y le c tu re 1: in tro d u c tio n Daniel Jackson MIT La b for Computer Science Marktoberdorf,

19

guiding the simulation

fun ShowNext (n,n': Num

bering, s: Style) {Next (n,n',s)

&& some n.num

[s.~parent] && some n.num

[s]}run Show

Next for 3 but 2 Numbering

Page 89: and analy larative sis w - MIT CSAILlarative m o d e llin g and analy sis w ith Allo y le c tu re 1: in tro d u c tio n Daniel Jackson MIT La b for Computer Science Marktoberdorf,

20

checking a property

Page 90: and analy larative sis w - MIT CSAILlarative m o d e llin g and analy sis w ith Allo y le c tu re 1: in tro d u c tio n Daniel Jackson MIT La b for Computer Science Marktoberdorf,

20

checking a property

if style is not a parent, step is reversibleassert Reversible {

all n0, n1, n: Numbering, s: Style - Style.parent |

Next(n0,n,s) && Next(n1,n,s) => n0.num = n1.num

}

check Reversible

Page 91: and analy larative sis w - MIT CSAILlarative m o d e llin g and analy sis w ith Allo y le c tu re 1: in tro d u c tio n Daniel Jackson MIT La b for Computer Science Marktoberdorf,

20

checking a property

if style is not a parent, step is reversibleassert Reversible {

all n0, n1, n: Numbering, s: Style - Style.parent |

Next(n0,n,s) && Next(n1,n,s) => n0.num = n1.num

}

check Reversible

Page 92: and analy larative sis w - MIT CSAILlarative m o d e llin g and analy sis w ith Allo y le c tu re 1: in tro d u c tio n Daniel Jackson MIT La b for Computer Science Marktoberdorf,

21

trying again…

Page 93: and analy larative sis w - MIT CSAILlarative m o d e llin g and analy sis w ith Allo y le c tu re 1: in tro d u c tio n Daniel Jackson MIT La b for Computer Science Marktoberdorf,

21

trying again…m

ake numbering injective

fact {Injective (next)}

Page 94: and analy larative sis w - MIT CSAILlarative m o d e llin g and analy sis w ith Allo y le c tu re 1: in tro d u c tio n Daniel Jackson MIT La b for Computer Science Marktoberdorf,

21

trying again…m

ake numbering injective

fact {Injective (next)}

does this fix the problem?

Page 95: and analy larative sis w - MIT CSAILlarative m o d e llin g and analy sis w ith Allo y le c tu re 1: in tro d u c tio n Daniel Jackson MIT La b for Computer Science Marktoberdorf,

22

counterexample

Page 96: and analy larative sis w - MIT CSAILlarative m o d e llin g and analy sis w ith Allo y le c tu re 1: in tro d u c tio n Daniel Jackson MIT La b for Computer Science Marktoberdorf,

22

counterexample

after numbering n

Page 97: and analy larative sis w - MIT CSAILlarative m o d e llin g and analy sis w ith Allo y le c tu re 1: in tro d u c tio n Daniel Jackson MIT La b for Computer Science Marktoberdorf,

22

counterexample

after numbering n

Page 98: and analy larative sis w - MIT CSAILlarative m o d e llin g and analy sis w ith Allo y le c tu re 1: in tro d u c tio n Daniel Jackson MIT La b for Computer Science Marktoberdorf,

22

counterexample

after numbering n

adjacent stylehas no num

berafterw

ards

Page 99: and analy larative sis w - MIT CSAILlarative m o d e llin g and analy sis w ith Allo y le c tu re 1: in tro d u c tio n Daniel Jackson MIT La b for Computer Science Marktoberdorf,

23

counterexample, ctd

Page 100: and analy larative sis w - MIT CSAILlarative m o d e llin g and analy sis w ith Allo y le c tu re 1: in tro d u c tio n Daniel Jackson MIT La b for Computer Science Marktoberdorf,

23

counterexample, ctd

beforenum

beringsn0 and n1

Page 101: and analy larative sis w - MIT CSAILlarative m o d e llin g and analy sis w ith Allo y le c tu re 1: in tro d u c tio n Daniel Jackson MIT La b for Computer Science Marktoberdorf,

23

counterexample, ctd

beforenum

beringsn0 and n1

Page 102: and analy larative sis w - MIT CSAILlarative m o d e llin g and analy sis w ith Allo y le c tu re 1: in tro d u c tio n Daniel Jackson MIT La b for Computer Science Marktoberdorf,

23

counterexample, ctd

beforenum

beringsn0 and n1

Page 103: and analy larative sis w - MIT CSAILlarative m o d e llin g and analy sis w ith Allo y le c tu re 1: in tro d u c tio n Daniel Jackson MIT La b for Computer Science Marktoberdorf,

23

counterexample, ctd

beforenum

beringsn0 and n1

adjacent style’s number

eliminated, so value

before was irrelevant!

Page 104: and analy larative sis w - MIT CSAILlarative m o d e llin g and analy sis w ith Allo y le c tu re 1: in tro d u c tio n Daniel Jackson MIT La b for Computer Science Marktoberdorf,

24

masking

Page 105: and analy larative sis w - MIT CSAILlarative m o d e llin g and analy sis w ith Allo y le c tu re 1: in tro d u c tio n Daniel Jackson MIT La b for Computer Science Marktoberdorf,

24

masking

check again, assuming styles form

a lineassert ReversibleW

henLine {Injective(parent)&& (som

e root: Style | Style in root.*~parent) =>all n0, n1, n: Num

bering, s: Style - Style.parent |Next(n0,n,s) && Next(n1,n,s) => n0.num

= n1.num}

check ReversibleWhenLine

Page 106: and analy larative sis w - MIT CSAILlarative m o d e llin g and analy sis w ith Allo y le c tu re 1: in tro d u c tio n Daniel Jackson MIT La b for Computer Science Marktoberdorf,

25

counterexample, again

Page 107: and analy larative sis w - MIT CSAILlarative m o d e llin g and analy sis w ith Allo y le c tu re 1: in tro d u c tio n Daniel Jackson MIT La b for Computer Science Marktoberdorf,

25

counterexample, again

Page 108: and analy larative sis w - MIT CSAILlarative m o d e llin g and analy sis w ith Allo y le c tu re 1: in tro d u c tio n Daniel Jackson MIT La b for Computer Science Marktoberdorf,

25

counterexample, again

Page 109: and analy larative sis w - MIT CSAILlarative m o d e llin g and analy sis w ith Allo y le c tu re 1: in tro d u c tio n Daniel Jackson MIT La b for Computer Science Marktoberdorf,

25

counterexample, again

Page 110: and analy larative sis w - MIT CSAILlarative m o d e llin g and analy sis w ith Allo y le c tu re 1: in tro d u c tio n Daniel Jackson MIT La b for Computer Science Marktoberdorf,

25

counterexample, again

initialization andincrem

ent aredistinct: theorem

is confused!

Page 111: and analy larative sis w - MIT CSAILlarative m o d e llin g and analy sis w ith Allo y le c tu re 1: in tro d u c tio n Daniel Jackson MIT La b for Computer Science Marktoberdorf,

26

checking a refactoring

Page 112: and analy larative sis w - MIT CSAILlarative m o d e llin g and analy sis w ith Allo y le c tu re 1: in tro d u c tio n Daniel Jackson MIT La b for Computer Science Marktoberdorf,

26

checking a refactoring

are these equivalent?fun Next1 (n,n’: Num

bering, s: Style) {n’.num

={d: s.^parent, x: Num

ber | x = n.num[d]} +

s -> if no n.num[s] then s.init else n.num

[s].next}fun Next2 (n,n’: Num

bering, s: Style) {all d: s.^parent | n’.num

[d] = n.num[d]

n’.num[s] = if no n.num

[s] then s.init else n.num[s].next

}

Page 113: and analy larative sis w - MIT CSAILlarative m o d e llin g and analy sis w ith Allo y le c tu re 1: in tro d u c tio n Daniel Jackson MIT La b for Computer Science Marktoberdorf,

26

checking a refactoring

are these equivalent?fun Next1 (n,n’: Num

bering, s: Style) {n’.num

={d: s.^parent, x: Num

ber | x = n.num[d]} +

s -> if no n.num[s] then s.init else n.num

[s].next}fun Next2 (n,n’: Num

bering, s: Style) {all d: s.^parent | n’.num

[d] = n.num[d]

n’.num[s] = if no n.num

[s] then s.init else n.num[s].next

}

ask the tool:assert Sam

e {all n,n’: Num

bering, s: Style | Next1(n,n’,s) iff Next2(n,n’,s)}

Page 114: and analy larative sis w - MIT CSAILlarative m o d e llin g and analy sis w ith Allo y le c tu re 1: in tro d u c tio n Daniel Jackson MIT La b for Computer Science Marktoberdorf,

27

what happened

Page 115: and analy larative sis w - MIT CSAILlarative m o d e llin g and analy sis w ith Allo y le c tu re 1: in tro d u c tio n Daniel Jackson MIT La b for Computer Science Marktoberdorf,

27

what happened

incrementality

›write a bit, analyze a bit›constrain just enough

to get key properties›avoids wasted tim

e,encourages sm

all models

Page 116: and analy larative sis w - MIT CSAILlarative m o d e llin g and analy sis w ith Allo y le c tu re 1: in tro d u c tio n Daniel Jackson MIT La b for Computer Science Marktoberdorf,

27

what happened

incrementality

›write a bit, analyze a bit›constrain just enough

to get key properties›avoids wasted tim

e,encourages sm

all models

analysis prompted questions

›number m

ust have next?›two num

bers have same next?

›style hierarchy a tree? line?

Page 117: and analy larative sis w - MIT CSAILlarative m o d e llin g and analy sis w ith Allo y le c tu re 1: in tro d u c tio n Daniel Jackson MIT La b for Computer Science Marktoberdorf,

27

what happened

incrementality

›write a bit, analyze a bit›constrain just enough

to get key properties›avoids wasted tim

e,encourages sm

all models

analysis prompted questions

›number m

ust have next?›two num

bers have same next?

›style hierarchy a tree? line?

Page 118: and analy larative sis w - MIT CSAILlarative m o d e llin g and analy sis w ith Allo y le c tu re 1: in tro d u c tio n Daniel Jackson MIT La b for Computer Science Marktoberdorf,

28

declarative vs. operational development

all behaviours;satisfies no safety properties

a safety property

declarative

operational

no behaviours;satisfies all safety properties

Page 119: and analy larative sis w - MIT CSAILlarative m o d e llin g and analy sis w ith Allo y le c tu re 1: in tro d u c tio n Daniel Jackson MIT La b for Computer Science Marktoberdorf,

29

what’s been done?

Page 120: and analy larative sis w - MIT CSAILlarative m o d e llin g and analy sis w ith Allo y le c tu re 1: in tro d u c tio n Daniel Jackson MIT La b for Computer Science Marktoberdorf,

29

what’s been done?

analyzing implem

ented systems

›Intentional naming (Khurshid)

›Chord peer-to-peer lookup (Wee)

›Transaction cache (Tucker)

Page 121: and analy larative sis w - MIT CSAILlarative m o d e llin g and analy sis w ith Allo y le c tu re 1: in tro d u c tio n Daniel Jackson MIT La b for Computer Science Marktoberdorf,

29

what’s been done?

analyzing implem

ented systems

›Intentional naming (Khurshid)

›Chord peer-to-peer lookup (Wee)

›Transaction cache (Tucker)

analyzing existing models

›Microsoft CO

M (Sullivan, from

Z)›Firewire leader election (m

e, from Vaandrager’s IO

A)›Unison file synchronizer (Nolte, from

Pierce’s maths)

›UML m

eta model (Vaziri, from

OCL)

›Classic distributed algorithms (Shlyakhter, from

SMV)

Page 122: and analy larative sis w - MIT CSAILlarative m o d e llin g and analy sis w ith Allo y le c tu re 1: in tro d u c tio n Daniel Jackson MIT La b for Computer Science Marktoberdorf,

29

what’s been done?

analyzing implem

ented systems

›Intentional naming (Khurshid)

›Chord peer-to-peer lookup (Wee)

›Transaction cache (Tucker)

analyzing existing models

›Microsoft CO

M (Sullivan, from

Z)›Firewire leader election (m

e, from Vaandrager’s IO

A)›Unison file synchronizer (Nolte, from

Pierce’s maths)

›UML m

eta model (Vaziri, from

OCL)

›Classic distributed algorithms (Shlyakhter, from

SMV)

typically›200 lines of Alloy, 30-200 hours work

Page 123: and analy larative sis w - MIT CSAILlarative m o d e llin g and analy sis w ith Allo y le c tu re 1: in tro d u c tio n Daniel Jackson MIT La b for Computer Science Marktoberdorf,

30

example: intentional nam

ing

Page 124: and analy larative sis w - MIT CSAILlarative m o d e llin g and analy sis w ith Allo y le c tu re 1: in tro d u c tio n Daniel Jackson MIT La b for Computer Science Marktoberdorf,

30

example: intentional nam

ing

query scheme

›intentional names are trees

›result of query is set of simple nam

es

Page 125: and analy larative sis w - MIT CSAILlarative m o d e llin g and analy sis w ith Allo y le c tu re 1: in tro d u c tio n Daniel Jackson MIT La b for Computer Science Marktoberdorf,

30

example: intentional nam

ing

n1n0

building

camera

service

ne43printer

database

query scheme

›intentional names are trees

›result of query is set of simple nam

es

Page 126: and analy larative sis w - MIT CSAILlarative m o d e llin g and analy sis w ith Allo y le c tu re 1: in tro d u c tio n Daniel Jackson MIT La b for Computer Science Marktoberdorf,

30

example: intentional nam

ing

building

camera

service

ne43

query

n1n0

building

camera

service

ne43printer

database

query scheme

›intentional names are trees

›result of query is set of simple nam

es

Page 127: and analy larative sis w - MIT CSAILlarative m o d e llin g and analy sis w ith Allo y le c tu re 1: in tro d u c tio n Daniel Jackson MIT La b for Computer Science Marktoberdorf,

30

example: intentional nam

ing

building

camera

service

ne43

query

n1n0

building

camera

service

ne43printer

database

n0n1

n0

n0

query scheme

›intentional names are trees

›result of query is set of simple nam

es

Page 128: and analy larative sis w - MIT CSAILlarative m o d e llin g and analy sis w ith Allo y le c tu re 1: in tro d u c tio n Daniel Jackson MIT La b for Computer Science Marktoberdorf,

31

results

Page 129: and analy larative sis w - MIT CSAILlarative m o d e llin g and analy sis w ith Allo y le c tu re 1: in tro d u c tio n Daniel Jackson MIT La b for Computer Science Marktoberdorf,

31

results

Page 130: and analy larative sis w - MIT CSAILlarative m o d e llin g and analy sis w ith Allo y le c tu re 1: in tro d u c tio n Daniel Jackson MIT La b for Computer Science Marktoberdorf,

31

results

what we did

Page 131: and analy larative sis w - MIT CSAILlarative m o d e llin g and analy sis w ith Allo y le c tu re 1: in tro d u c tio n Daniel Jackson MIT La b for Computer Science Marktoberdorf,

31

results

what we did›analyzed claim

s made in paper: m

ostly untrue

Page 132: and analy larative sis w - MIT CSAILlarative m o d e llin g and analy sis w ith Allo y le c tu re 1: in tro d u c tio n Daniel Jackson MIT La b for Computer Science Marktoberdorf,

31

results

what we did›analyzed claim

s made in paper: m

ostly untrue›analyzed algebraic properties: also untrue

eg, add is monotonic

Page 133: and analy larative sis w - MIT CSAILlarative m o d e llin g and analy sis w ith Allo y le c tu re 1: in tro d u c tio n Daniel Jackson MIT La b for Computer Science Marktoberdorf,

31

results

what we did›analyzed claim

s made in paper: m

ostly untrue›analyzed algebraic properties: also untrue

eg, add is monotonic

›adapted model for fixes in code: also broken

Page 134: and analy larative sis w - MIT CSAILlarative m o d e llin g and analy sis w ith Allo y le c tu re 1: in tro d u c tio n Daniel Jackson MIT La b for Computer Science Marktoberdorf,

31

results

what we did›analyzed claim

s made in paper: m

ostly untrue›analyzed algebraic properties: also untrue

eg, add is monotonic

›adapted model for fixes in code: also broken

›developed new semantics & checked it

Page 135: and analy larative sis w - MIT CSAILlarative m o d e llin g and analy sis w ith Allo y le c tu re 1: in tro d u c tio n Daniel Jackson MIT La b for Computer Science Marktoberdorf,

31

results

what we did›analyzed claim

s made in paper: m

ostly untrue›analyzed algebraic properties: also untrue

eg, add is monotonic

›adapted model for fixes in code: also broken

›developed new semantics & checked it

reflections

Page 136: and analy larative sis w - MIT CSAILlarative m o d e llin g and analy sis w ith Allo y le c tu re 1: in tro d u c tio n Daniel Jackson MIT La b for Computer Science Marktoberdorf,

31

results

what we did›analyzed claim

s made in paper: m

ostly untrue›analyzed algebraic properties: also untrue

eg, add is monotonic

›adapted model for fixes in code: also broken

›developed new semantics & checked it

reflections›initial analysis took 2 weeks and 100 lines of Alloy

Page 137: and analy larative sis w - MIT CSAILlarative m o d e llin g and analy sis w ith Allo y le c tu re 1: in tro d u c tio n Daniel Jackson MIT La b for Computer Science Marktoberdorf,

31

results

what we did›analyzed claim

s made in paper: m

ostly untrue›analyzed algebraic properties: also untrue

eg, add is monotonic

›adapted model for fixes in code: also broken

›developed new semantics & checked it

reflections›initial analysis took 2 weeks and 100 lines of Alloy›found all bugs in trees of 4 nodes or less -- approx 10 secs

Page 138: and analy larative sis w - MIT CSAILlarative m o d e llin g and analy sis w ith Allo y le c tu re 1: in tro d u c tio n Daniel Jackson MIT La b for Computer Science Marktoberdorf,

31

results

what we did›analyzed claim

s made in paper: m

ostly untrue›analyzed algebraic properties: also untrue

eg, add is monotonic

›adapted model for fixes in code: also broken

›developed new semantics & checked it

reflections›initial analysis took 2 weeks and 100 lines of Alloy›found all bugs in trees of 4 nodes or less -- approx 10 secs›2000 lines of tests hadn’t found bugs in a year

Page 139: and analy larative sis w - MIT CSAILlarative m o d e llin g and analy sis w ith Allo y le c tu re 1: in tro d u c tio n Daniel Jackson MIT La b for Computer Science Marktoberdorf,

32

challenge: get numbering right

Page 140: and analy larative sis w - MIT CSAILlarative m o d e llin g and analy sis w ith Allo y le c tu re 1: in tro d u c tio n Daniel Jackson MIT La b for Computer Science Marktoberdorf,

32

challenge: get numbering right

fix the numbering m

echanism to handle

›multiple childrensection and figure have parent chapter

›multiple parentssection has parent chapter and appendix

Page 141: and analy larative sis w - MIT CSAILlarative m o d e llin g and analy sis w ith Allo y le c tu re 1: in tro d u c tio n Daniel Jackson MIT La b for Computer Science Marktoberdorf,

33

what is a m

odel?

Page 142: and analy larative sis w - MIT CSAILlarative m o d e llin g and analy sis w ith Allo y le c tu re 1: in tro d u c tio n Daniel Jackson MIT La b for Computer Science Marktoberdorf,

33

what is a m

odel?

a representation of a system›m

ore or less useful, not more or less correct [Fowler]

›useful to the extent that it answers questions [Ross]

Page 143: and analy larative sis w - MIT CSAILlarative m o d e llin g and analy sis w ith Allo y le c tu re 1: in tro d u c tio n Daniel Jackson MIT La b for Computer Science Marktoberdorf,

33

what is a m

odel?

a representation of a system›m

ore or less useful, not more or less correct [Fowler]

›useful to the extent that it answers questions [Ross]

role of a model

›to explain & evaluate existing system›to explore design of system

to be built

Page 144: and analy larative sis w - MIT CSAILlarative m o d e llin g and analy sis w ith Allo y le c tu re 1: in tro d u c tio n Daniel Jackson MIT La b for Computer Science Marktoberdorf,

34

why m

odel?

Page 145: and analy larative sis w - MIT CSAILlarative m o d e llin g and analy sis w ith Allo y le c tu re 1: in tro d u c tio n Daniel Jackson MIT La b for Computer Science Marktoberdorf,

34

why m

odel?

‘plan to throw one away’ [Brooks]›100 line m

odel or 100k lines of code?›nasty surprises happen sooner

Page 146: and analy larative sis w - MIT CSAILlarative m o d e llin g and analy sis w ith Allo y le c tu re 1: in tro d u c tio n Daniel Jackson MIT La b for Computer Science Marktoberdorf,

34

why m

odel?

‘plan to throw one away’ [Brooks]›100 line m

odel or 100k lines of code?›nasty surprises happen sooner

designs with clear conceptual models

›easier to use and implem

ent›allow delegation & division of labour

Page 147: and analy larative sis w - MIT CSAILlarative m o d e llin g and analy sis w ith Allo y le c tu re 1: in tro d u c tio n Daniel Jackson MIT La b for Computer Science Marktoberdorf,

34

why m

odel?

‘plan to throw one away’ [Brooks]›100 line m

odel or 100k lines of code?›nasty surprises happen sooner

designs with clear conceptual models

›easier to use and implem

ent›allow delegation & division of labour

separation of concerns›conceptual flaws get m

ired in code›not a good use of testing

Page 148: and analy larative sis w - MIT CSAILlarative m o d e llin g and analy sis w ith Allo y le c tu re 1: in tro d u c tio n Daniel Jackson MIT La b for Computer Science Marktoberdorf,

35

lightweight form

al methods

Page 149: and analy larative sis w - MIT CSAILlarative m o d e llin g and analy sis w ith Allo y le c tu re 1: in tro d u c tio n Daniel Jackson MIT La b for Computer Science Marktoberdorf,

35

lightweight form

al methods

elements

›small & sim

ple notations›partial m

odels & analyses›full autom

ation

Page 150: and analy larative sis w - MIT CSAILlarative m o d e llin g and analy sis w ith Allo y le c tu re 1: in tro d u c tio n Daniel Jackson MIT La b for Computer Science Marktoberdorf,

35

lightweight form

al methods

elements

›small & sim

ple notations›partial m

odels & analyses›full autom

ation

focus on risky aspects›hard to get right, or to check›structure-determ

ining›high cost of failure