Lec 1
Lec 1
(Applied)
Dr. Falak Sher (ITU Punjab) Automata Theory (Applied) January 28, 2019 1 / 34
Therac-25 radiation overdosing (1985-87)
Dr. Falak Sher (ITU Punjab) Automata Theory (Applied) January 28, 2019 2 / 34
Therac-25 radiation overdosing (1985-87)
Dr. Falak Sher (ITU Punjab) Automata Theory (Applied) January 28, 2019 2 / 34
AT&T telephone netword outage (1990)
Dr. Falak Sher (ITU Punjab) Automata Theory (Applied) January 28, 2019 3 / 34
AT&T telephone netword outage (1990)
Dr. Falak Sher (ITU Punjab) Automata Theory (Applied) January 28, 2019 3 / 34
Pentium floating point division unit (FDIV) bug (1994)
Dr. Falak Sher (ITU Punjab) Automata Theory (Applied) January 28, 2019 4 / 34
Pentium floating point division unit (FDIV) bug (1994)
Dr. Falak Sher (ITU Punjab) Automata Theory (Applied) January 28, 2019 4 / 34
Ariane 5 crash (1996)
Dr. Falak Sher (ITU Punjab) Automata Theory (Applied) January 28, 2019 5 / 34
Ariane 5 crash (1996)
Dr. Falak Sher (ITU Punjab) Automata Theory (Applied) January 28, 2019 5 / 34
Economic loss due to eronous software systems
Dr. Falak Sher (ITU Punjab) Automata Theory (Applied) January 28, 2019 6 / 34
The quest for software correctness
Henk Barendregt
(Dutch logician)
Dr. Falak Sher (ITU Punjab) Automata Theory (Applied) January 28, 2019 7 / 34
Factors contributing to eronous information and communication
technology (ICT) systems
Dr. Falak Sher (ITU Punjab) Automata Theory (Applied) January 28, 2019 8 / 34
Factors contributing to eronous information and communication
technology (ICT) systems
Dr. Falak Sher (ITU Punjab) Automata Theory (Applied) January 28, 2019 8 / 34
Factors contributing to eronous information and communication
technology (ICT) systems
Dr. Falak Sher (ITU Punjab) Automata Theory (Applied) January 28, 2019 8 / 34
Factors contributing to eronous information and communication
technology (ICT) systems
Dr. Falak Sher (ITU Punjab) Automata Theory (Applied) January 28, 2019 8 / 34
Factors contributing to eronous information and communication
technology (ICT) systems
Dr. Falak Sher (ITU Punjab) Automata Theory (Applied) January 28, 2019 8 / 34
Factors contributing to eronous information and communication
technology (ICT) systems
Dr. Falak Sher (ITU Punjab) Automata Theory (Applied) January 28, 2019 8 / 34
Legacy practice to make (so-called) correct systems
Dr. Falak Sher (ITU Punjab) Automata Theory (Applied) January 28, 2019 9 / 34
Legacy practice to make (so-called) correct systems
Dr. Falak Sher (ITU Punjab) Automata Theory (Applied) January 28, 2019 9 / 34
Software development life-cycle
Dr. Falak Sher (ITU Punjab) Automata Theory (Applied) January 28, 2019 10 / 34
What is system verification?
Dr. Falak Sher (ITU Punjab) Automata Theory (Applied) January 28, 2019 11 / 34
What is system verification?
Folklore definition
Dr. Falak Sher (ITU Punjab) Automata Theory (Applied) January 28, 2019 11 / 34
What is system verification?
Folklore definition
System verification amounts to check whether a system fulfills the
qualitative requirements that have been identified.
Dr. Falak Sher (ITU Punjab) Automata Theory (Applied) January 28, 2019 11 / 34
What is system verification?
Folklore definition
System verification amounts to check whether a system fulfills the
qualitative requirements that have been identified.
Verification 6= Validation
Dr. Falak Sher (ITU Punjab) Automata Theory (Applied) January 28, 2019 11 / 34
What is system verification?
Folklore definition
System verification amounts to check whether a system fulfills the
qualitative requirements that have been identified.
Verification 6= Validation
Validation = check that we are building the right thing .
Dr. Falak Sher (ITU Punjab) Automata Theory (Applied) January 28, 2019 11 / 34
What is system verification?
Folklore definition
System verification amounts to check whether a system fulfills the
qualitative requirements that have been identified.
Verification 6= Validation
Validation = check that we are building the right thing .
Verification = check that we are building the thing right.
Dr. Falak Sher (ITU Punjab) Automata Theory (Applied) January 28, 2019 11 / 34
Legacy verification techniques
Dr. Falak Sher (ITU Punjab) Automata Theory (Applied) January 28, 2019 12 / 34
Legacy verification techniques
Dr. Falak Sher (ITU Punjab) Automata Theory (Applied) January 28, 2019 12 / 34
Legacy verification techniques
Dr. Falak Sher (ITU Punjab) Automata Theory (Applied) January 28, 2019 12 / 34
Legacy verification techniques
Dr. Falak Sher (ITU Punjab) Automata Theory (Applied) January 28, 2019 12 / 34
Legacy verification techniques
Dr. Falak Sher (ITU Punjab) Automata Theory (Applied) January 28, 2019 12 / 34
Legacy verification techniques
Dr. Falak Sher (ITU Punjab) Automata Theory (Applied) January 28, 2019 12 / 34
Legacy verification techniques
Dr. Falak Sher (ITU Punjab) Automata Theory (Applied) January 28, 2019 12 / 34
Legacy verification techniques
Dr. Falak Sher (ITU Punjab) Automata Theory (Applied) January 28, 2019 12 / 34
Legacy verification techniques
Dr. Falak Sher (ITU Punjab) Automata Theory (Applied) January 28, 2019 12 / 34
Legacy verification techniques are insufficient
Dr. Falak Sher (ITU Punjab) Automata Theory (Applied) January 28, 2019 13 / 34
What do we need to make correct (software) systems?
Dr. Falak Sher (ITU Punjab) Automata Theory (Applied) January 28, 2019 14 / 34
What do we need to make correct (software) systems?
Dr. Falak Sher (ITU Punjab) Automata Theory (Applied) January 28, 2019 14 / 34
Formal Methods
Dr. Falak Sher (ITU Punjab) Automata Theory (Applied) January 28, 2019 15 / 34
Formal Methods
Dr. Falak Sher (ITU Punjab) Automata Theory (Applied) January 28, 2019 15 / 34
Formal Methods
Dr. Falak Sher (ITU Punjab) Automata Theory (Applied) January 28, 2019 15 / 34
High-level view of system verification
System
Specification
Properties
Design Process E.g. Deadlock free, No bugs found
termination,etc.
Product or
Verifier bug(s) found
Prototype
Dr. Falak Sher (ITU Punjab) Automata Theory (Applied) January 28, 2019 16 / 34
Verification is undecidable in general
Theorem
L = {(M, h) | System M depicts a behaviour h} is undecidable
That means there does not exist an algorithm that can tell
whether a system M depicts a behaviour h.
Dr. Falak Sher (ITU Punjab) Automata Theory (Applied) January 28, 2019 17 / 34
Verification is undecidable in general
Theorem
L = {(M, h) | System M depicts a behaviour h} is undecidable
That means there does not exist an algorithm that can tell
whether a system M depicts a behaviour h.
Dr. Falak Sher (ITU Punjab) Automata Theory (Applied) January 28, 2019 17 / 34
Verification is decidable for systems with finite configurations
Dr. Falak Sher (ITU Punjab) Automata Theory (Applied) January 28, 2019 18 / 34
Verification is decidable for systems with finite configurations
Theorem
L = {(M, h) | System M with finite configurations depicts a behaviour h}
is decidable
Dr. Falak Sher (ITU Punjab) Automata Theory (Applied) January 28, 2019 18 / 34
Verification is decidable for systems with finite configurations
Theorem
L = {(M, h) | System M with finite configurations depicts a behaviour h}
is decidable
Example
For a linear bounded automata M, it is possible to decide algorithmically
whether it will eventually halt starting with a blank input tape.
Dr. Falak Sher (ITU Punjab) Automata Theory (Applied) January 28, 2019 18 / 34
Automated verification technique
Model-checking
Model-checking is an automated technique that, given a (finite) model of
a system and a formal property, systematically checks whether this
property holds for that model.
Dr. Falak Sher (ITU Punjab) Automata Theory (Applied) January 28, 2019 19 / 34
What are models?
Dr. Falak Sher (ITU Punjab) Automata Theory (Applied) January 28, 2019 20 / 34
Peterson’s mutual exclusion algorithm (Example)
Process1 ( ) Process2 ( )
{ {
while ( t r u e ) while ( t r u e )
{ {
b1 = t r u e ; b2 = t r u e ;
x = 2; x = 1;
w h i l e ( b2 && x==2 ) w h i l e ( b1 && x==1 )
{ {
//busy waiting //busy waiting
} }
//critical section //critical section
... ...
//end of critical section //end of critical section
b1 = f a l s e ; b2 = f a l s e ;
} }
} }
Dr. Falak Sher (ITU Punjab) Automata Theory (Applied) January 28, 2019 21 / 34
Peterson’s mutual exclusion algorithm (Example)
Dr. Falak Sher (ITU Punjab) Automata Theory (Applied) January 28, 2019 23 / 34
Expressivity of labelled-transition systems (LTSs)?
Expressivity
Sequential programs are LTSs.
Multi-threaded programs are LTSs.
Communicating protocols are LTSs.
Hardware circuits are LTSs.
etc.
Dr. Falak Sher (ITU Punjab) Automata Theory (Applied) January 28, 2019 23 / 34
What are properties?
Dr. Falak Sher (ITU Punjab) Automata Theory (Applied) January 28, 2019 24 / 34
What are properties?
Example properties
Can a system reach a deadlock situation?
Dr. Falak Sher (ITU Punjab) Automata Theory (Applied) January 28, 2019 24 / 34
What are properties?
Example properties
Can a system reach a deadlock situation?
Can two processes ever be in a critical section at the same time?
Dr. Falak Sher (ITU Punjab) Automata Theory (Applied) January 28, 2019 24 / 34
What are properties?
Example properties
Can a system reach a deadlock situation?
Can two processes ever be in a critical section at the same time?
On termination, does a program provide the correct output?
Dr. Falak Sher (ITU Punjab) Automata Theory (Applied) January 28, 2019 24 / 34
What are properties?
Example properties
Can a system reach a deadlock situation?
Can two processes ever be in a critical section at the same time?
On termination, does a program provide the correct output?
Dr. Falak Sher (ITU Punjab) Automata Theory (Applied) January 28, 2019 24 / 34
The model-checking process
Dr. Falak Sher (ITU Punjab) Automata Theory (Applied) January 28, 2019 25 / 34
The model-checking process
Modeling Phase
model the system under consideration.
Dr. Falak Sher (ITU Punjab) Automata Theory (Applied) January 28, 2019 25 / 34
The model-checking process
Modeling Phase
model the system under consideration.
as a first sanity check, perform some simulations.
Dr. Falak Sher (ITU Punjab) Automata Theory (Applied) January 28, 2019 25 / 34
The model-checking process
Modeling Phase
model the system under consideration.
as a first sanity check, perform some simulations.
formalize the property to be checked.
Dr. Falak Sher (ITU Punjab) Automata Theory (Applied) January 28, 2019 25 / 34
The model-checking process
Modeling Phase
model the system under consideration.
as a first sanity check, perform some simulations.
formalize the property to be checked.
Running Phase
run the model checker to check whether the property holds for the
model.
Dr. Falak Sher (ITU Punjab) Automata Theory (Applied) January 28, 2019 25 / 34
The model-checking process
Modeling Phase
model the system under consideration.
as a first sanity check, perform some simulations.
formalize the property to be checked.
Running Phase
run the model checker to check whether the property holds for the
model.
Analysis Phase
property satisfied? → check another property (if any)
Dr. Falak Sher (ITU Punjab) Automata Theory (Applied) January 28, 2019 25 / 34
The model-checking process
Modeling Phase
model the system under consideration.
as a first sanity check, perform some simulations.
formalize the property to be checked.
Running Phase
run the model checker to check whether the property holds for the
model.
Analysis Phase
property satisfied? → check another property (if any)
property violated?
Dr. Falak Sher (ITU Punjab) Automata Theory (Applied) January 28, 2019 25 / 34
The model-checking process
Modeling Phase
model the system under consideration.
as a first sanity check, perform some simulations.
formalize the property to be checked.
Running Phase
run the model checker to check whether the property holds for the
model.
Analysis Phase
property satisfied? → check another property (if any)
property violated?
analyze generated counter-example by simulation.
Dr. Falak Sher (ITU Punjab) Automata Theory (Applied) January 28, 2019 25 / 34
The model-checking process
Modeling Phase
model the system under consideration.
as a first sanity check, perform some simulations.
formalize the property to be checked.
Running Phase
run the model checker to check whether the property holds for the
model.
Analysis Phase
property satisfied? → check another property (if any)
property violated?
analyze generated counter-example by simulation.
refine the design, model or property; and repeat the entire procedure.
Dr. Falak Sher (ITU Punjab) Automata Theory (Applied) January 28, 2019 25 / 34
The model-checking process
Modeling Phase
model the system under consideration.
as a first sanity check, perform some simulations.
formalize the property to be checked.
Running Phase
run the model checker to check whether the property holds for the
model.
Analysis Phase
property satisfied? → check another property (if any)
property violated?
analyze generated counter-example by simulation.
refine the design, model or property; and repeat the entire procedure.
out of memory? → try to reduce the model and try again.
Dr. Falak Sher (ITU Punjab) Automata Theory (Applied) January 28, 2019 25 / 34
The model-checking process
Dr. Falak Sher (ITU Punjab) Automata Theory (Applied) January 28, 2019 26 / 34
The pros of model-checking
Dr. Falak Sher (ITU Punjab) Automata Theory (Applied) January 28, 2019 27 / 34
The pros of model-checking
Dr. Falak Sher (ITU Punjab) Automata Theory (Applied) January 28, 2019 27 / 34
The pros of model-checking
Dr. Falak Sher (ITU Punjab) Automata Theory (Applied) January 28, 2019 27 / 34
The pros of model-checking
Dr. Falak Sher (ITU Punjab) Automata Theory (Applied) January 28, 2019 27 / 34
The pros of model-checking
Dr. Falak Sher (ITU Punjab) Automata Theory (Applied) January 28, 2019 27 / 34
The pros of model-checking
Dr. Falak Sher (ITU Punjab) Automata Theory (Applied) January 28, 2019 27 / 34
The pros of model-checking
Dr. Falak Sher (ITU Punjab) Automata Theory (Applied) January 28, 2019 27 / 34
The pros of model-checking
Dr. Falak Sher (ITU Punjab) Automata Theory (Applied) January 28, 2019 27 / 34
The cons of model-checking
Dr. Falak Sher (ITU Punjab) Automata Theory (Applied) January 28, 2019 28 / 34
The cons of model-checking
Dr. Falak Sher (ITU Punjab) Automata Theory (Applied) January 28, 2019 28 / 34
The cons of model-checking
Dr. Falak Sher (ITU Punjab) Automata Theory (Applied) January 28, 2019 28 / 34
The cons of model-checking
Dr. Falak Sher (ITU Punjab) Automata Theory (Applied) January 28, 2019 28 / 34
The cons of model-checking
Dr. Falak Sher (ITU Punjab) Automata Theory (Applied) January 28, 2019 28 / 34
The cons of model-checking
Nevertheless,
Dr. Falak Sher (ITU Punjab) Automata Theory (Applied) January 28, 2019 28 / 34
Model-checking in practice
Dr. Falak Sher (ITU Punjab) Automata Theory (Applied) January 28, 2019 29 / 34
Model-checking in practice
Dr. Falak Sher (ITU Punjab) Automata Theory (Applied) January 28, 2019 29 / 34
Model-checking in practice
Dr. Falak Sher (ITU Punjab) Automata Theory (Applied) January 28, 2019 29 / 34
Model-checking in practice
Dr. Falak Sher (ITU Punjab) Automata Theory (Applied) January 28, 2019 29 / 34
Model-checking in practice
Dr. Falak Sher (ITU Punjab) Automata Theory (Applied) January 28, 2019 29 / 34
Model-checking in practice
Dr. Falak Sher (ITU Punjab) Automata Theory (Applied) January 28, 2019 29 / 34
Model-checking in practice
Dr. Falak Sher (ITU Punjab) Automata Theory (Applied) January 28, 2019 29 / 34
Model-checking in practice
Dr. Falak Sher (ITU Punjab) Automata Theory (Applied) January 28, 2019 29 / 34
Course Contents
Dr. Falak Sher (ITU Punjab) Automata Theory (Applied) January 28, 2019 30 / 34
Course Contents
Dr. Falak Sher (ITU Punjab) Automata Theory (Applied) January 28, 2019 30 / 34
Course Contents
Dr. Falak Sher (ITU Punjab) Automata Theory (Applied) January 28, 2019 30 / 34
Course Contents
Dr. Falak Sher (ITU Punjab) Automata Theory (Applied) January 28, 2019 30 / 34
Course Contents
Dr. Falak Sher (ITU Punjab) Automata Theory (Applied) January 28, 2019 30 / 34
Course Contents
Dr. Falak Sher (ITU Punjab) Automata Theory (Applied) January 28, 2019 30 / 34
Course Contents
Dr. Falak Sher (ITU Punjab) Automata Theory (Applied) January 28, 2019 30 / 34
Course Contents
Dr. Falak Sher (ITU Punjab) Automata Theory (Applied) January 28, 2019 30 / 34
Course Contents
Dr. Falak Sher (ITU Punjab) Automata Theory (Applied) January 28, 2019 30 / 34
Continue...
Dr. Falak Sher (ITU Punjab) Automata Theory (Applied) January 28, 2019 31 / 34
Continue...
Dr. Falak Sher (ITU Punjab) Automata Theory (Applied) January 28, 2019 31 / 34
Continue...
Dr. Falak Sher (ITU Punjab) Automata Theory (Applied) January 28, 2019 31 / 34
Continue...
Dr. Falak Sher (ITU Punjab) Automata Theory (Applied) January 28, 2019 31 / 34
Continue...
Dr. Falak Sher (ITU Punjab) Automata Theory (Applied) January 28, 2019 31 / 34
Continue...
Dr. Falak Sher (ITU Punjab) Automata Theory (Applied) January 28, 2019 31 / 34
Continue...
Dr. Falak Sher (ITU Punjab) Automata Theory (Applied) January 28, 2019 31 / 34
Continue...
Dr. Falak Sher (ITU Punjab) Automata Theory (Applied) January 28, 2019 31 / 34
Continue...
Dr. Falak Sher (ITU Punjab) Automata Theory (Applied) January 28, 2019 31 / 34
Continue...
Dr. Falak Sher (ITU Punjab) Automata Theory (Applied) January 28, 2019 32 / 34
Continue...
Dr. Falak Sher (ITU Punjab) Automata Theory (Applied) January 28, 2019 32 / 34
Continue...
Dr. Falak Sher (ITU Punjab) Automata Theory (Applied) January 28, 2019 32 / 34
Continue...
Dr. Falak Sher (ITU Punjab) Automata Theory (Applied) January 28, 2019 32 / 34
General Information
Dr. Falak Sher (ITU Punjab) Automata Theory (Applied) January 28, 2019 33 / 34
Continue...