CS 228: Logic in Computer Science: Krishna. S
CS 228: Logic in Computer Science: Krishna. S
Krishna. S
1/23
Some Real Life Stories
2/23
Therac-25(1987)
3/23
Therac-25(1987)
3/23
Therac-25(1987)
3/23
Intel Pentium Bug (1994)
◮ The Intel FDIV bug : Bug in the intel P5 floating point unit
4/23
Intel Pentium Bug (1994)
◮ The Intel FDIV bug : Bug in the intel P5 floating point unit
◮ Discovered by a professor working on Brun’s constant
◮ ( 31 + 51 ) + ( 15 + 17 ) + ( 11
1
+ 1
13 )
1
+ ( 17 + 1
19 ) + . . . converges to
∼
B = 1.90216054
4/23
Intel Pentium Bug (1994)
◮ The Intel FDIV bug : Bug in the intel P5 floating point unit
◮ Discovered by a professor working on Brun’s constant
◮ ( 31 + 51 ) + ( 15 + 17 ) + ( 11
1
+ 1
13 )
1
+ ( 17 + 1
19 ) + . . . converges to
∼
B = 1.90216054
◮ Intel offered to replace all flawed processors
4/23
Ariane 5 (1996)
5/23
Ariane 5 (1996)
5/23
Ariane 5 (1996)
5/23
Ariane 5 (1996)
6/23
Toyota Prius (2010)
6/23
Nest Thermostat (2016)
7/23
Nest Thermostat (2016)
7/23
What do these stories have in
common?
8/23
What do these stories have in
common?
8/23
What do these stories have in
common?
8/23
Formal Methods
Intuitive Description
“Applied Mathematics for modelling and analysing ICT systems”
9/23
Formal Methods
Intuitive Description
“Applied Mathematics for modelling and analysing ICT systems”
9/23
Formal Methods
Intuitive Description
“Applied Mathematics for modelling and analysing ICT systems”
9/23
Formal Methods
Intuitive Description
“Applied Mathematics for modelling and analysing ICT systems”
9/23
Simulation and Testing
Basic procedure
◮ Take a model
◮ Simulate it with certain inputs
◮ Observe what happens, and if this is desired
Important Drawbacks
◮ possible behaviours very large/infinite
◮ unexplored behaviours may contain fatal bug
◮ can show presence of errors, not their absence
10/23
Model Checking
11/23
Model checking
12/23
Model checking
12/23
What is Model Checking?
System specification
satisfy?
good/bad properties
13/23
What is Model Checking?
System specification
satisfy?
model-checking
System Model Spec Model
|=?
13/23
Model Checker as a Black Box
14/23
What are Models?
Transition Systems
◮ States labeled with propositions
◮ Transition relation between states
◮ Action-labeled transitions to facilitate composition
15/23
What are Models?
Transition Systems
◮ States labeled with propositions
◮ Transition relation between states
◮ Action-labeled transitions to facilitate composition
Expressivity
◮ Programs are transition systems
◮ Multi-threading programs are transition systems
◮ Communicating processes are transition systems
◮ Hardware circuits are transition systems
◮ What else?
15/23
What are Properties?
Example properties
◮ Can the system reach a deadlock?
◮ Can two processes ever be together in a critical section?
◮ On termination, does a program provide correct output?
16/23
What are Properties?
Example properties
◮ Can the system reach a deadlock?
◮ Can two processes ever be together in a critical section?
◮ On termination, does a program provide correct output?
Logics of Relevance
◮ Classical Logics
◮ First Order Logic
◮ Monadic Second Order Logic
◮ Temporal Logics
◮ Propositional Logic, enriched with modal operators such as 2
(always) and 3 (eventually)
◮ Interpreted over state sequences (linear)
◮ Or over infinite trees (branching)
16/23
Two Traffic Lights
17/23
The Model Checking Process
◮ Modeling Phase
◮ model the system under consideration
◮ as a first sanity check, perform some simulations
◮ formalise property to be checked
18/23
The Model Checking Process
◮ Modeling Phase
◮ model the system under consideration
◮ as a first sanity check, perform some simulations
◮ formalise property to be checked
◮ Running Phase
◮ run the model checker to check the validity of the property in the
model
18/23
The Model Checking Process
◮ Modeling Phase
◮ model the system under consideration
◮ as a first sanity check, perform some simulations
◮ formalise property to be checked
◮ Running Phase
◮ run the model checker to check the validity of the property in the
model
◮ Analysis Phase
◮ property satisfied? → check next property (if any)
◮ property violated? →
◮ analyse generated counter example by simulation
◮ refine the model, design, property, . . . and repeat entire procedure
◮ out of memory? → try to reduce the model and try again
18/23
The Pros of Model Checking
19/23
The Cons of Model Checking
20/23
Striking Model-Checking Examples
21/23
Relevant Topics
22/23
Relevant Topics
22/23
Relevant Topics
22/23
Relevant Topics
23/23
Relevant Topics
23/23