1 sep 21, 2007 mc model checking 2007 exercises barbara jobstmann

12
1 Sep 21, 2007 MC Model Checking 2007 Exercises Barbara Jobstmann

Post on 22-Dec-2015

219 views

Category:

Documents


4 download

TRANSCRIPT

1

Sep 21, 2007 MC

Model Checking 2007Exercises

Barbara Jobstmann

2

Sep 21, 2007 MC

Today

• General• Mocha• Examples

3

Sep 21, 2007 MC

Contact

• Email: [email protected]• Office: BC 358

• Mailing list: [email protected]• For all participants • subscribe

• http://mtc.epfl.ch/courses/ModelChecking-2007/

4

Sep 21, 2007 MC

Homework

• Theoretical:• Examples and proofs on paper

• Practical• Using MOCHA

• Schedule• Given out: Thursday afternoon• Handed in: Thursday morning (before the lecture) or send an email• Discussed: Friday afternoon (from 13:15 to 15:00)

5

Sep 21, 2007 MC

MOCHA

• “MOCHA is a growing interactive software environment for system specification and verification.”

• Three universities:• University of California at Berkeley• University of Pennsylvania• State University of New York at Stony Brook

• Versions:• cmocha, jmocha • We will use jmocha 2.0

6

Sep 21, 2007 MC

MOCHA

• Systems written in RML (finite-state subset)

• Specifications as invariants

• Provides• Simulator• Checkers (enumerative, symbolic)

7

Sep 21, 2007 MC

MOCHA

• Where to find MOCHA?• http://embedded.eecs.berkeley.edu/research/mocha/

• Information and Help• MOCHA manual• Collection of “Do’s and Don’ts” at homepage of the lecture

8

Sep 21, 2007 MC

Examples

• Tiny examples• Boat example• Lock example• Sunscreen example

9

Sep 21, 2007 MC

Cabbage, Goat, Wolf

10

Sep 21, 2007 MC

Lock Example

int got_lock = 0; do{1 if (*) {2 lock();}3 got_lock = got_lock + 1;4 if (got_lock != 0) {5 unlock();6 got_lock = got_lock - 1;}7 } while(*)

void lock() {11 assert(L = 0);12 L = 1; }

void unlock(){21 assert(L = 1);22 L = 0; }

11

Sep 21, 2007 MC

Buggy Sunscreen

12

Sep 21, 2007 MC

Buggy Sunscreen

Control

buttondown

buttonup

open

close

Window

Screen

doClose

ss

ws

doOpen

godown

goup