Model Checking 2007 Exercise

Download Report

Transcript Model Checking 2007 Exercise

Model Checking 2007
Exercises
Barbara Jobstmann
Sep 21, 2007
MC
‹#›
Today
• General
• Mocha
• Examples
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/
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)
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
Sep 21, 2007
MC
‹#›
MOCHA
• Systems written in RML (finite-state subset)
• Specifications as invariants
• Provides
• Simulator
• Checkers (enumerative, symbolic)
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
Sep 21, 2007
MC
‹#›
Examples
•
•
•
•
Tiny examples
Boat example
Lock example
Sunscreen example
Sep 21, 2007
MC
‹#›
Cabbage, Goat, Wolf
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; }
Sep 21, 2007
MC
‹#›
Buggy Sunscreen
Sep 21, 2007
MC
‹#›
Buggy Sunscreen
ws
doOpen
buttondown
Window
doClose
buttonup
Control
open
goup
close
godown
Screen
ss
Sep 21, 2007
MC
‹#›