SlideShare a Scribd company logo
Formal Verification
Formal Verification…
“…is the act of proving or disproving the correctness of
intended algorithms underlying a system in respect to a
certain formal specification or property, using formal
methods of mathematics” – Wikipedia
☺
System S → Model M, where M ∋ [finite state
machine, labeled transition system, timed automata, 

Petri net,…)
!
(M ∈ ⊨) ∧ ((S ⩰ M) ∈ ⊨) ⇒ S ∈ ⊨
Why
• find more bugs in design
and implementation
• prove correctness
• cut down testing and
maintenance cost
• Common Criteria (ISO
15408), FIPS-140-2 

Level 4,…
• build high-assurance
systems
Formal Verification of Design
• Make a formal design by using a specification
language etc.
• Define and formalize desired properties
• Verify that the chosen formal property holds for
the formal design
!
describe → design → formalise → verify
Formal Verification of Design
• Making formal design is (mostly) not fun
• May not be enough details for interesting
properties
• Far away from actual implementation
Formal Verification of Program
• Use code as formal design document
• Easier to combine with debugging and testing
• Closer to actual implementation
• Can benefit from additional methods like static
program analysis etc.
Code to Model Example
#include <stdio.h>
#include <stdlib.h>
!
int main(int argc, const char* argv[])
{
FILE* f;
int c, n = 0, w = 0;
!
if (argc < 2)
{
printf("Filename?n");
return 1;
}
!
f = fopen(argv[1], "r");
if (f == NULL)
{
printf("open error:%sn", argv[1]);
return 1;
}
!
!
!
!
!
while ((c = fgetc(f)) != -1)
{
if (!isspace(c))
{
if (!w)
++n, w = 1;
else
w = 0;
}
}
printf("Word count: %dn", n);
!
fclose(f);
return 0;
}
Code to Model Example
#include <stdio.h>
#include <stdlib.h>
!
int main(int argc, const char* argv[])
{
FILE* f;
int c, n = 0, w = 0;
!
if (argc < 2)
{
printf("Filename?n");
return 1;
}
!
f = fopen(argv[1], "r");
if (f == NULL)
{
printf("open error:%sn", argv[1]);
return 1;
}
!
!
!
!
!
while ((c = fgetc(f)) != -1)
{
if (!isspace(c))
{
if (!w)
++n, w = 1;
else
w = 0;
}
}
printf("Word count: %dn", n);
!
fclose(f);
return 0;
}
Code to Model Example
#include <stdio.h>
#include <stdlib.h>
!
int main(int argc, const char* argv[])
{
FILE* f;
int c, n = 0, w = 0;
!
if (argc < 2)
{
printf("Filename?n");
return 1;
}
!
f = fopen(argv[1], "r");
if (f == NULL)
{
printf("open error:%sn", argv[1]);
return 1;
}
!
!
!
!
!
while ((c = fgetc(f)) != -1)
{
if (!isspace(c))
{
if (!w)
++n, w = 1;
else
w = 0;
}
}
printf("Word count: %dn", n);
!
fclose(f);
return 0;
}
Code to Model Example
#include <stdio.h>
#include <stdlib.h>
!
int main()
{
FILE* f;
int c, n = 0, w = 0;
enum {FALSE,TRUE} B1;
!
if (B1 = any())
{
return 1;
}
!
f = fopen(“sample”, "r");
if (f == NULL)
{
return 1;
}
!
!
!
!
!
while ((c = fgetc(f)) != -1)
{
if (!isspace(c))
{
if (!w)
++n, w = 1;
else
w = 0;
}
}
fclose(f);
return 0;
}
Code to Model Example
#include <stdio.h>
#include <stdlib.h>
!
int main()
{
FILE* f;
int w = 0;
enum {FALSE,TRUE} B1, B2, B3;
!
if (B1 = any())
{
return 1;
}
!
f = fopen(“sample”, "r");
if (f == NULL)
{
return 1;
}
!
!
!
!
!
while (B2 = any())
{
if (B3 = any())
{
if (!w)
w = 1;
else
w = 0;
}
}
fclose(f);
return 0;
}
Code to Model Example
int main()
{
enum {FALSE,TRUE} B1, B2, B3;
enum {FCLOSED, FOPEN, FERROR} fileState;
enum {V0, V1} W = V0;
fileState = FCLOSED;
!
if (B1 = any())
{
return 1;
}
if (any())
{
fileState = FOPEN;
}
else
{
fileState = FERROR;
}
if (fileState == FERROR)
{
return 1;
}
!
!
!
!
!
while (B2 = any())
{
if (B3 = any())
{
if (!w)
W = V1;
else
W = V0;
}
}
fileState = FCLOSED;
return 0;
}
Code to Model Example
int main()
{
enum {FCLOSED, FOPEN, FERROR} fileState;
!
fileState = FCLOSED;
!
if (any())
{
fileState = FERROR;
}
else if (any())
{
fileState = FOPEN;
while (any());
fileState = FCLOSED;
}
return 0;
}
!
entry
FCLOSED1
FERROR FOPEN
FCLOSED2
exit
Formal Verification Techniques
• Theorem Proving
• Model Checking
• Ad hoc voodoo magic
!
!
!
!
!
Although these appear to be contradictory approaches, there has been considerable
effort to incorporate theorem proving and model checking
Theorem Proving
• Logical deduction at the intersection of
mathematics and logics
• Prove that implementation satisfies specification
by mathematical reasoning
• implementation and specification as formulae in a some
formal logic
• required relationship (equivalence/implication) as a
theorem to prove by using a set of axioms and inference
rules (simplification, induction, etc.)
Theorem Proving
by hand – classic approach
• human errors (similar to programming)
• unsuitable for verifying large software and
hardware systems
Theorem Proving
with some machine support – machine
checks the syntax, fixes layout, translates into
different (meta)languages
• less errors, readable consistent statements
• still unsuitable for verifying large software and
hardware systems
Theorem Proving
interactive – proofs are fully checked by machine
based on proof steps provided by user
• guaranteed correctness (if the prover is correct)
• can prove everything that is provable by hand
Theorem Proving
automated – theorem is shown by machine; user
must state it in a proper form so that the prover can
solve the problem within reasonable amount of
time
• may be used by non-specialists
• may be faster than interactive proving
• many problems cannot be proved automatically
• can often deal only with finite problems
Limitations of Theorem Proving
• Large manpower investment to prove small
theorems, difficult to prove large or hard
theorems
• Usable only by experts, requires deep
understanding of both the system design and
proving methodology
• Automated for narrow class of system designs
Model Checking
Automated technique that, given a finite-state
model of a system and a formal property,
systematically checks whether this property holds
for (a given state in) that model.
!
Modelling → Running → Analysing
Modelling
• Model the system under consideration using the
model description language of the model
checker at hand
• As a first sanity check and quick assessment of
the model perform some simulations
• Formalise the property to be checked using the
property specification language.
Running
• Run the model checker to check the validity of
the property in the system model.
Analysis
• Property satisfied?
• Check next property (if any)
• Property violated?
• Analyse generated counterexample by simulation
• Refine the model, design, or property
• Repeat the entire procedure.
• Out of memory?
• Try to reduce the model and try again.
Temporal Logic Model Checking
• Specifications are written in propositional
temporal logic to specify time related system
behaviour properties either in absolute time or
in terms of sequences of state transitions
• Verification is an exhaustive search of the state
space of the design
Basic Temporal Operators
Let p be an atomic proposition, e.g. device_Enabled
• Xp – p holds next time
• Fp – p holds sometime in a future
• Gp – p holds globally in a future (always)
• pUq – p holds until another atomic proposition
q holds
!
Use with ¬∧∨ etc. to form temporal logic formulae
Temporal Logic Formula Example
The microwave oven does not heat up until
the door is closed
!
Not heat_up holds until door_closed
!
(¬heat_up) U door_closed
Temporal Logic Formula Example
The microwave oven does not heat up until
the door is closed
!
Not heat_up holds until door_closed
!
(¬heat_up) U (door_closed ∧ powered_on)
Temporal Logic Model Checking Goals
Safety – something bad will never happen.

To satisfy, the system must not demonstrate
forbidden behaviour
!
Liveness – something good will happen in future.

To satisfy, the system must demonstrate desired
behaviour
Model Checking: Older Approaches
• Construct a model of a system in terms of a
finite state machine
• Choose a property, express it in some sort of
temporal logic and use a tool to explore the
state space and to check if the property holds
• Explicit-state checker enumerates all possible states
[SPIN]
• Symbolic checker uses binary decision diagram (BDD) to
encode the state transition function [NuSMV etc.]
Model Checking: Older Approaches
• Good for liveness and safety properties
• “is a state with property p reachable?”
• “if I see x, will I eventually see y?”
• “is property p true for all states?”
• Ill-suitable for functional properties
• “does this function compute AES-256?”
Model Checking: Newer Approaches
SAT-based model checkers
• Bounded model-checking (BMC) – an otherwise
large or even infinite-state FSM can be analysed
by checking a finite number of state transitions
• Property directed reachability (PDR) – combination
of induction, over-approximation and SAT
solving
Model Checking: Newer Approaches
Going into details of SAT and SMT solvers is
probably too much to handle for this session.
!
X(explain_sat ∧ explain_smt)
Model Checking Strengths
• General verification approach that is applicable
to a wide range of systems
• Supports partial verification (properties can be
checked individually, essential ones first)
• Provides diagnostic information in case a
property is invalidated (useful for debugging)
Model Checking Strengths (cont.)
• Requires neither a high degree of user
interaction nor a high degree of expertise
• Can be easily integrated in existing
development cycles
• Sound mathematical underpinning, based on
theory of graph algorithms, data structures,
logic etc.
Model Checking Weaknesses
• Mainly for control-intensive systems, less
suitable for data-intensive ones
• Verifies a model and not the actual system itself;
complimentary techniques are needed (testing
etc.)
• Check only stated requirements, completeness is
not guaranteed
Model Checking Weaknesses (cont.)
• Suffers from the state-space explosion problem
• Requires some expertise in finding appropriate
abstractions to obtain smaller system models
and to state properties in the logical formalism
used
• Does not allow checking generalisations
• A model checker may contain software defects
Model Checking
Provided various approaches, it is an effective
technique to expose design errors
Formally Verified System
Design
Model
Implementation
theorem proving
model checking
logic/syntax checkers
testing
Thank you
This presentation is based on materials provided courtesy of and various publicly available Internet sources.
All grammar and syntax errors are, let’s say, for watermarking purposes

2013

More Related Content

What's hot

testing strategies and tactics
 testing strategies and tactics testing strategies and tactics
testing strategies and tactics
Preeti Mishra
 
Case based reasoning
Case based reasoningCase based reasoning
Case based reasoning
Mohammad Al Amawi
 
Test Process Maturity Measurement and Related Measurements
Test Process Maturity Measurement and Related MeasurementsTest Process Maturity Measurement and Related Measurements
Test Process Maturity Measurement and Related Measurements
STAG Software Private Limited
 
Unit Testing vs Integration Testing
Unit Testing vs Integration TestingUnit Testing vs Integration Testing
Unit Testing vs Integration Testing
Rock Interview
 
CS8494 SOFTWARE ENGINEERING Unit-2
CS8494 SOFTWARE ENGINEERING Unit-2CS8494 SOFTWARE ENGINEERING Unit-2
CS8494 SOFTWARE ENGINEERING Unit-2
SIMONTHOMAS S
 
Requirements validation - requirements engineering
Requirements validation - requirements engineeringRequirements validation - requirements engineering
Requirements validation - requirements engineering
Ra'Fat Al-Msie'deen
 
Parallel computing persentation
Parallel computing persentationParallel computing persentation
Parallel computing persentation
VIKAS SINGH BHADOURIA
 
State transition testing-software_testing
State transition testing-software_testingState transition testing-software_testing
State transition testing-software_testing
Midhun S
 
Principles of programming languages. Detail notes
Principles of programming languages. Detail notesPrinciples of programming languages. Detail notes
Principles of programming languages. Detail notes
VIKAS SINGH BHADOURIA
 
Requirements management
Requirements managementRequirements management
Requirements management
Syed Zaid Irshad
 
Software testing
Software testingSoftware testing
Software Process Models
Software Process ModelsSoftware Process Models
Software Process Models
Hassan A-j
 
Unit 2 - Test Case Design
Unit 2 - Test Case DesignUnit 2 - Test Case Design
Unit 2 - Test Case Design
Selvi Vts
 
Walkthroughs
WalkthroughsWalkthroughs
Walkthroughs
NancyBeaulah_R
 
Requirements engineering for agile methods
Requirements engineering for agile methodsRequirements engineering for agile methods
Requirements engineering for agile methods
Syed Zaid Irshad
 
Software Testing Introduction
Software Testing IntroductionSoftware Testing Introduction
Software Testing Introduction
ArunKumar5524
 
Software Reliability
Software ReliabilitySoftware Reliability
Software Reliability
Gurkamal Rakhra
 
Software quality assurance
Software quality assuranceSoftware quality assurance
Software quality assurance
Aman Adhikari
 
The Software Development Process
The Software Development ProcessThe Software Development Process
The Software Development Process
Cesar Augusto Nogueira
 
Software testing & Quality Assurance
Software testing & Quality Assurance Software testing & Quality Assurance
Software testing & Quality Assurance
Webtech Learning
 

What's hot (20)

testing strategies and tactics
 testing strategies and tactics testing strategies and tactics
testing strategies and tactics
 
Case based reasoning
Case based reasoningCase based reasoning
Case based reasoning
 
Test Process Maturity Measurement and Related Measurements
Test Process Maturity Measurement and Related MeasurementsTest Process Maturity Measurement and Related Measurements
Test Process Maturity Measurement and Related Measurements
 
Unit Testing vs Integration Testing
Unit Testing vs Integration TestingUnit Testing vs Integration Testing
Unit Testing vs Integration Testing
 
CS8494 SOFTWARE ENGINEERING Unit-2
CS8494 SOFTWARE ENGINEERING Unit-2CS8494 SOFTWARE ENGINEERING Unit-2
CS8494 SOFTWARE ENGINEERING Unit-2
 
Requirements validation - requirements engineering
Requirements validation - requirements engineeringRequirements validation - requirements engineering
Requirements validation - requirements engineering
 
Parallel computing persentation
Parallel computing persentationParallel computing persentation
Parallel computing persentation
 
State transition testing-software_testing
State transition testing-software_testingState transition testing-software_testing
State transition testing-software_testing
 
Principles of programming languages. Detail notes
Principles of programming languages. Detail notesPrinciples of programming languages. Detail notes
Principles of programming languages. Detail notes
 
Requirements management
Requirements managementRequirements management
Requirements management
 
Software testing
Software testingSoftware testing
Software testing
 
Software Process Models
Software Process ModelsSoftware Process Models
Software Process Models
 
Unit 2 - Test Case Design
Unit 2 - Test Case DesignUnit 2 - Test Case Design
Unit 2 - Test Case Design
 
Walkthroughs
WalkthroughsWalkthroughs
Walkthroughs
 
Requirements engineering for agile methods
Requirements engineering for agile methodsRequirements engineering for agile methods
Requirements engineering for agile methods
 
Software Testing Introduction
Software Testing IntroductionSoftware Testing Introduction
Software Testing Introduction
 
Software Reliability
Software ReliabilitySoftware Reliability
Software Reliability
 
Software quality assurance
Software quality assuranceSoftware quality assurance
Software quality assurance
 
The Software Development Process
The Software Development ProcessThe Software Development Process
The Software Development Process
 
Software testing & Quality Assurance
Software testing & Quality Assurance Software testing & Quality Assurance
Software testing & Quality Assurance
 

Viewers also liked

Formal Verification Techniques
Formal Verification TechniquesFormal Verification Techniques
Formal Verification TechniquesDVClub
 
Session 8 assertion_based_verification_and_interfaces
Session 8 assertion_based_verification_and_interfacesSession 8 assertion_based_verification_and_interfaces
Session 8 assertion_based_verification_and_interfacesNirav Desai
 
"Formal Verification in Java" by Shura Iline, Vladimir Ivanov @ JEEConf 2013,...
"Formal Verification in Java" by Shura Iline, Vladimir Ivanov @ JEEConf 2013,..."Formal Verification in Java" by Shura Iline, Vladimir Ivanov @ JEEConf 2013,...
"Formal Verification in Java" by Shura Iline, Vladimir Ivanov @ JEEConf 2013,...Vladimir Ivanov
 
"Optimizing Memory Footprint in Java" @ JEEConf 2013, Kiev, Ukraine
"Optimizing Memory Footprint in Java" @ JEEConf 2013, Kiev, Ukraine "Optimizing Memory Footprint in Java" @ JEEConf 2013, Kiev, Ukraine
"Optimizing Memory Footprint in Java" @ JEEConf 2013, Kiev, Ukraine Vladimir Ivanov
 
#1 formal methods – introduction for software engineering
#1 formal methods – introduction for software engineering#1 formal methods – introduction for software engineering
#1 formal methods – introduction for software engineering
Sharif Omar Salem
 
Ch8-Software Engineering 9
Ch8-Software Engineering 9Ch8-Software Engineering 9
Ch8-Software Engineering 9Ian Sommerville
 
Ch8.testing
Ch8.testingCh8.testing
DCS PRESENTATION
DCS PRESENTATIONDCS PRESENTATION
DCS PRESENTATION
bvent2005
 
Chapter 5 software design
Chapter 5 software designChapter 5 software design
Chapter 5 software designPiyush Gogia
 
Lec1
Lec1Lec1

Viewers also liked (11)

Formal Verification Techniques
Formal Verification TechniquesFormal Verification Techniques
Formal Verification Techniques
 
Session 8 assertion_based_verification_and_interfaces
Session 8 assertion_based_verification_and_interfacesSession 8 assertion_based_verification_and_interfaces
Session 8 assertion_based_verification_and_interfaces
 
Formal verification
Formal verificationFormal verification
Formal verification
 
"Formal Verification in Java" by Shura Iline, Vladimir Ivanov @ JEEConf 2013,...
"Formal Verification in Java" by Shura Iline, Vladimir Ivanov @ JEEConf 2013,..."Formal Verification in Java" by Shura Iline, Vladimir Ivanov @ JEEConf 2013,...
"Formal Verification in Java" by Shura Iline, Vladimir Ivanov @ JEEConf 2013,...
 
"Optimizing Memory Footprint in Java" @ JEEConf 2013, Kiev, Ukraine
"Optimizing Memory Footprint in Java" @ JEEConf 2013, Kiev, Ukraine "Optimizing Memory Footprint in Java" @ JEEConf 2013, Kiev, Ukraine
"Optimizing Memory Footprint in Java" @ JEEConf 2013, Kiev, Ukraine
 
#1 formal methods – introduction for software engineering
#1 formal methods – introduction for software engineering#1 formal methods – introduction for software engineering
#1 formal methods – introduction for software engineering
 
Ch8-Software Engineering 9
Ch8-Software Engineering 9Ch8-Software Engineering 9
Ch8-Software Engineering 9
 
Ch8.testing
Ch8.testingCh8.testing
Ch8.testing
 
DCS PRESENTATION
DCS PRESENTATIONDCS PRESENTATION
DCS PRESENTATION
 
Chapter 5 software design
Chapter 5 software designChapter 5 software design
Chapter 5 software design
 
Lec1
Lec1Lec1
Lec1
 

Similar to Formal Verification

The Evolution of Development Testing
The Evolution of Development TestingThe Evolution of Development Testing
The Evolution of Development Testing
Cathal King
 
Developer testing 101: Become a Testing Fanatic
Developer testing 101: Become a Testing FanaticDeveloper testing 101: Become a Testing Fanatic
Developer testing 101: Become a Testing Fanatic
LB Denker
 
Algorithm Analysis.pdf
Algorithm Analysis.pdfAlgorithm Analysis.pdf
Algorithm Analysis.pdf
NayanChandak1
 
Unit Testng with PHP Unit - A Step by Step Training
Unit Testng with PHP Unit - A Step by Step TrainingUnit Testng with PHP Unit - A Step by Step Training
Unit Testng with PHP Unit - A Step by Step Training
Ram Awadh Prasad, PMP
 
Parallel run selenium tests in a good way
Parallel run selenium tests in a good  wayParallel run selenium tests in a good  way
Parallel run selenium tests in a good way
COMAQA.BY
 
CodeChecker Overview Nov 2019
CodeChecker Overview Nov 2019CodeChecker Overview Nov 2019
CodeChecker Overview Nov 2019
Olivera Milenkovic
 
Project FoX: A Tool That Offers Automated Testing Using a Formal Approach
Project FoX: A Tool That Offers Automated Testing Using a Formal ApproachProject FoX: A Tool That Offers Automated Testing Using a Formal Approach
Project FoX: A Tool That Offers Automated Testing Using a Formal Approach
Ivo Neskovic
 
Software testing
Software testingSoftware testing
Software testing
Enamul Haque
 
Leveling Up With Unit Testing - LonghornPHP 2022
Leveling Up With Unit Testing - LonghornPHP 2022Leveling Up With Unit Testing - LonghornPHP 2022
Leveling Up With Unit Testing - LonghornPHP 2022
Mark Niebergall
 
Sva.pdf
Sva.pdfSva.pdf
Sva.pdf
SamHoney6
 
Into The Box 2018 | Assert control over your legacy applications
Into The Box 2018 | Assert control over your legacy applicationsInto The Box 2018 | Assert control over your legacy applications
Into The Box 2018 | Assert control over your legacy applications
Ortus Solutions, Corp
 
Design Like a Pro: Scripting Best Practices
Design Like a Pro: Scripting Best PracticesDesign Like a Pro: Scripting Best Practices
Design Like a Pro: Scripting Best Practices
Inductive Automation
 
11 whiteboxtesting
11 whiteboxtesting11 whiteboxtesting
11 whiteboxtesting
asifusman1998
 
Design Like a Pro: Scripting Best Practices
Design Like a Pro: Scripting Best PracticesDesign Like a Pro: Scripting Best Practices
Design Like a Pro: Scripting Best Practices
Inductive Automation
 
Lec1.ppt
Lec1.pptLec1.ppt
Lec1.ppt
ssuser8bddb2
 
Measuring Your Code
Measuring Your CodeMeasuring Your Code
Measuring Your Code
Nate Abele
 
Measuring Your Code 2.0
Measuring Your Code 2.0Measuring Your Code 2.0
Measuring Your Code 2.0
Nate Abele
 
Cs 331 Data Structures
Cs 331 Data StructuresCs 331 Data Structures
Системный взгляд на параллельный запуск Selenium тестов
Системный взгляд на параллельный запуск Selenium тестовСистемный взгляд на параллельный запуск Selenium тестов
Системный взгляд на параллельный запуск Selenium тестов
COMAQA.BY
 
A la découverte des google/test (aka gtest)
A la découverte des google/test (aka gtest)A la découverte des google/test (aka gtest)
A la découverte des google/test (aka gtest)
Thierry Gayet
 

Similar to Formal Verification (20)

The Evolution of Development Testing
The Evolution of Development TestingThe Evolution of Development Testing
The Evolution of Development Testing
 
Developer testing 101: Become a Testing Fanatic
Developer testing 101: Become a Testing FanaticDeveloper testing 101: Become a Testing Fanatic
Developer testing 101: Become a Testing Fanatic
 
Algorithm Analysis.pdf
Algorithm Analysis.pdfAlgorithm Analysis.pdf
Algorithm Analysis.pdf
 
Unit Testng with PHP Unit - A Step by Step Training
Unit Testng with PHP Unit - A Step by Step TrainingUnit Testng with PHP Unit - A Step by Step Training
Unit Testng with PHP Unit - A Step by Step Training
 
Parallel run selenium tests in a good way
Parallel run selenium tests in a good  wayParallel run selenium tests in a good  way
Parallel run selenium tests in a good way
 
CodeChecker Overview Nov 2019
CodeChecker Overview Nov 2019CodeChecker Overview Nov 2019
CodeChecker Overview Nov 2019
 
Project FoX: A Tool That Offers Automated Testing Using a Formal Approach
Project FoX: A Tool That Offers Automated Testing Using a Formal ApproachProject FoX: A Tool That Offers Automated Testing Using a Formal Approach
Project FoX: A Tool That Offers Automated Testing Using a Formal Approach
 
Software testing
Software testingSoftware testing
Software testing
 
Leveling Up With Unit Testing - LonghornPHP 2022
Leveling Up With Unit Testing - LonghornPHP 2022Leveling Up With Unit Testing - LonghornPHP 2022
Leveling Up With Unit Testing - LonghornPHP 2022
 
Sva.pdf
Sva.pdfSva.pdf
Sva.pdf
 
Into The Box 2018 | Assert control over your legacy applications
Into The Box 2018 | Assert control over your legacy applicationsInto The Box 2018 | Assert control over your legacy applications
Into The Box 2018 | Assert control over your legacy applications
 
Design Like a Pro: Scripting Best Practices
Design Like a Pro: Scripting Best PracticesDesign Like a Pro: Scripting Best Practices
Design Like a Pro: Scripting Best Practices
 
11 whiteboxtesting
11 whiteboxtesting11 whiteboxtesting
11 whiteboxtesting
 
Design Like a Pro: Scripting Best Practices
Design Like a Pro: Scripting Best PracticesDesign Like a Pro: Scripting Best Practices
Design Like a Pro: Scripting Best Practices
 
Lec1.ppt
Lec1.pptLec1.ppt
Lec1.ppt
 
Measuring Your Code
Measuring Your CodeMeasuring Your Code
Measuring Your Code
 
Measuring Your Code 2.0
Measuring Your Code 2.0Measuring Your Code 2.0
Measuring Your Code 2.0
 
Cs 331 Data Structures
Cs 331 Data StructuresCs 331 Data Structures
Cs 331 Data Structures
 
Системный взгляд на параллельный запуск Selenium тестов
Системный взгляд на параллельный запуск Selenium тестовСистемный взгляд на параллельный запуск Selenium тестов
Системный взгляд на параллельный запуск Selenium тестов
 
A la découverte des google/test (aka gtest)
A la découverte des google/test (aka gtest)A la découverte des google/test (aka gtest)
A la découverte des google/test (aka gtest)
 

Recently uploaded

Enterprise Software Development with No Code Solutions.pptx
Enterprise Software Development with No Code Solutions.pptxEnterprise Software Development with No Code Solutions.pptx
Enterprise Software Development with No Code Solutions.pptx
QuickwayInfoSystems3
 
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Globus
 
Prosigns: Transforming Business with Tailored Technology Solutions
Prosigns: Transforming Business with Tailored Technology SolutionsProsigns: Transforming Business with Tailored Technology Solutions
Prosigns: Transforming Business with Tailored Technology Solutions
Prosigns
 
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, BetterWebinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
XfilesPro
 
Enhancing Research Orchestration Capabilities at ORNL.pdf
Enhancing Research Orchestration Capabilities at ORNL.pdfEnhancing Research Orchestration Capabilities at ORNL.pdf
Enhancing Research Orchestration Capabilities at ORNL.pdf
Globus
 
APIs for Browser Automation (MoT Meetup 2024)
APIs for Browser Automation (MoT Meetup 2024)APIs for Browser Automation (MoT Meetup 2024)
APIs for Browser Automation (MoT Meetup 2024)
Boni García
 
Understanding Globus Data Transfers with NetSage
Understanding Globus Data Transfers with NetSageUnderstanding Globus Data Transfers with NetSage
Understanding Globus Data Transfers with NetSage
Globus
 
First Steps with Globus Compute Multi-User Endpoints
First Steps with Globus Compute Multi-User EndpointsFirst Steps with Globus Compute Multi-User Endpoints
First Steps with Globus Compute Multi-User Endpoints
Globus
 
Large Language Models and the End of Programming
Large Language Models and the End of ProgrammingLarge Language Models and the End of Programming
Large Language Models and the End of Programming
Matt Welsh
 
Launch Your Streaming Platforms in Minutes
Launch Your Streaming Platforms in MinutesLaunch Your Streaming Platforms in Minutes
Launch Your Streaming Platforms in Minutes
Roshan Dwivedi
 
Top 7 Unique WhatsApp API Benefits | Saudi Arabia
Top 7 Unique WhatsApp API Benefits | Saudi ArabiaTop 7 Unique WhatsApp API Benefits | Saudi Arabia
Top 7 Unique WhatsApp API Benefits | Saudi Arabia
Yara Milbes
 
Beyond Event Sourcing - Embracing CRUD for Wix Platform - Java.IL
Beyond Event Sourcing - Embracing CRUD for Wix Platform - Java.ILBeyond Event Sourcing - Embracing CRUD for Wix Platform - Java.IL
Beyond Event Sourcing - Embracing CRUD for Wix Platform - Java.IL
Natan Silnitsky
 
Essentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FMEEssentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FME
Safe Software
 
Orion Context Broker introduction 20240604
Orion Context Broker introduction 20240604Orion Context Broker introduction 20240604
Orion Context Broker introduction 20240604
Fermin Galan
 
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
Globus
 
OpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoam
OpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoamOpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoam
OpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoam
takuyayamamoto1800
 
Introduction to Pygame (Lecture 7 Python Game Development)
Introduction to Pygame (Lecture 7 Python Game Development)Introduction to Pygame (Lecture 7 Python Game Development)
Introduction to Pygame (Lecture 7 Python Game Development)
abdulrafaychaudhry
 
Providing Globus Services to Users of JASMIN for Environmental Data Analysis
Providing Globus Services to Users of JASMIN for Environmental Data AnalysisProviding Globus Services to Users of JASMIN for Environmental Data Analysis
Providing Globus Services to Users of JASMIN for Environmental Data Analysis
Globus
 
May Marketo Masterclass, London MUG May 22 2024.pdf
May Marketo Masterclass, London MUG May 22 2024.pdfMay Marketo Masterclass, London MUG May 22 2024.pdf
May Marketo Masterclass, London MUG May 22 2024.pdf
Adele Miller
 
GraphSummit Paris - The art of the possible with Graph Technology
GraphSummit Paris - The art of the possible with Graph TechnologyGraphSummit Paris - The art of the possible with Graph Technology
GraphSummit Paris - The art of the possible with Graph Technology
Neo4j
 

Recently uploaded (20)

Enterprise Software Development with No Code Solutions.pptx
Enterprise Software Development with No Code Solutions.pptxEnterprise Software Development with No Code Solutions.pptx
Enterprise Software Development with No Code Solutions.pptx
 
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
 
Prosigns: Transforming Business with Tailored Technology Solutions
Prosigns: Transforming Business with Tailored Technology SolutionsProsigns: Transforming Business with Tailored Technology Solutions
Prosigns: Transforming Business with Tailored Technology Solutions
 
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, BetterWebinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
 
Enhancing Research Orchestration Capabilities at ORNL.pdf
Enhancing Research Orchestration Capabilities at ORNL.pdfEnhancing Research Orchestration Capabilities at ORNL.pdf
Enhancing Research Orchestration Capabilities at ORNL.pdf
 
APIs for Browser Automation (MoT Meetup 2024)
APIs for Browser Automation (MoT Meetup 2024)APIs for Browser Automation (MoT Meetup 2024)
APIs for Browser Automation (MoT Meetup 2024)
 
Understanding Globus Data Transfers with NetSage
Understanding Globus Data Transfers with NetSageUnderstanding Globus Data Transfers with NetSage
Understanding Globus Data Transfers with NetSage
 
First Steps with Globus Compute Multi-User Endpoints
First Steps with Globus Compute Multi-User EndpointsFirst Steps with Globus Compute Multi-User Endpoints
First Steps with Globus Compute Multi-User Endpoints
 
Large Language Models and the End of Programming
Large Language Models and the End of ProgrammingLarge Language Models and the End of Programming
Large Language Models and the End of Programming
 
Launch Your Streaming Platforms in Minutes
Launch Your Streaming Platforms in MinutesLaunch Your Streaming Platforms in Minutes
Launch Your Streaming Platforms in Minutes
 
Top 7 Unique WhatsApp API Benefits | Saudi Arabia
Top 7 Unique WhatsApp API Benefits | Saudi ArabiaTop 7 Unique WhatsApp API Benefits | Saudi Arabia
Top 7 Unique WhatsApp API Benefits | Saudi Arabia
 
Beyond Event Sourcing - Embracing CRUD for Wix Platform - Java.IL
Beyond Event Sourcing - Embracing CRUD for Wix Platform - Java.ILBeyond Event Sourcing - Embracing CRUD for Wix Platform - Java.IL
Beyond Event Sourcing - Embracing CRUD for Wix Platform - Java.IL
 
Essentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FMEEssentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FME
 
Orion Context Broker introduction 20240604
Orion Context Broker introduction 20240604Orion Context Broker introduction 20240604
Orion Context Broker introduction 20240604
 
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
 
OpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoam
OpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoamOpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoam
OpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoam
 
Introduction to Pygame (Lecture 7 Python Game Development)
Introduction to Pygame (Lecture 7 Python Game Development)Introduction to Pygame (Lecture 7 Python Game Development)
Introduction to Pygame (Lecture 7 Python Game Development)
 
Providing Globus Services to Users of JASMIN for Environmental Data Analysis
Providing Globus Services to Users of JASMIN for Environmental Data AnalysisProviding Globus Services to Users of JASMIN for Environmental Data Analysis
Providing Globus Services to Users of JASMIN for Environmental Data Analysis
 
May Marketo Masterclass, London MUG May 22 2024.pdf
May Marketo Masterclass, London MUG May 22 2024.pdfMay Marketo Masterclass, London MUG May 22 2024.pdf
May Marketo Masterclass, London MUG May 22 2024.pdf
 
GraphSummit Paris - The art of the possible with Graph Technology
GraphSummit Paris - The art of the possible with Graph TechnologyGraphSummit Paris - The art of the possible with Graph Technology
GraphSummit Paris - The art of the possible with Graph Technology
 

Formal Verification

  • 2. Formal Verification… “…is the act of proving or disproving the correctness of intended algorithms underlying a system in respect to a certain formal specification or property, using formal methods of mathematics” – Wikipedia
  • 3. ☺ System S → Model M, where M ∋ [finite state machine, labeled transition system, timed automata, 
 Petri net,…) ! (M ∈ ⊨) ∧ ((S ⩰ M) ∈ ⊨) ⇒ S ∈ ⊨
  • 4. Why • find more bugs in design and implementation • prove correctness • cut down testing and maintenance cost • Common Criteria (ISO 15408), FIPS-140-2 
 Level 4,… • build high-assurance systems
  • 5. Formal Verification of Design • Make a formal design by using a specification language etc. • Define and formalize desired properties • Verify that the chosen formal property holds for the formal design ! describe → design → formalise → verify
  • 6. Formal Verification of Design • Making formal design is (mostly) not fun • May not be enough details for interesting properties • Far away from actual implementation
  • 7. Formal Verification of Program • Use code as formal design document • Easier to combine with debugging and testing • Closer to actual implementation • Can benefit from additional methods like static program analysis etc.
  • 8. Code to Model Example #include <stdio.h> #include <stdlib.h> ! int main(int argc, const char* argv[]) { FILE* f; int c, n = 0, w = 0; ! if (argc < 2) { printf("Filename?n"); return 1; } ! f = fopen(argv[1], "r"); if (f == NULL) { printf("open error:%sn", argv[1]); return 1; } ! ! ! ! ! while ((c = fgetc(f)) != -1) { if (!isspace(c)) { if (!w) ++n, w = 1; else w = 0; } } printf("Word count: %dn", n); ! fclose(f); return 0; }
  • 9. Code to Model Example #include <stdio.h> #include <stdlib.h> ! int main(int argc, const char* argv[]) { FILE* f; int c, n = 0, w = 0; ! if (argc < 2) { printf("Filename?n"); return 1; } ! f = fopen(argv[1], "r"); if (f == NULL) { printf("open error:%sn", argv[1]); return 1; } ! ! ! ! ! while ((c = fgetc(f)) != -1) { if (!isspace(c)) { if (!w) ++n, w = 1; else w = 0; } } printf("Word count: %dn", n); ! fclose(f); return 0; }
  • 10. Code to Model Example #include <stdio.h> #include <stdlib.h> ! int main(int argc, const char* argv[]) { FILE* f; int c, n = 0, w = 0; ! if (argc < 2) { printf("Filename?n"); return 1; } ! f = fopen(argv[1], "r"); if (f == NULL) { printf("open error:%sn", argv[1]); return 1; } ! ! ! ! ! while ((c = fgetc(f)) != -1) { if (!isspace(c)) { if (!w) ++n, w = 1; else w = 0; } } printf("Word count: %dn", n); ! fclose(f); return 0; }
  • 11. Code to Model Example #include <stdio.h> #include <stdlib.h> ! int main() { FILE* f; int c, n = 0, w = 0; enum {FALSE,TRUE} B1; ! if (B1 = any()) { return 1; } ! f = fopen(“sample”, "r"); if (f == NULL) { return 1; } ! ! ! ! ! while ((c = fgetc(f)) != -1) { if (!isspace(c)) { if (!w) ++n, w = 1; else w = 0; } } fclose(f); return 0; }
  • 12. Code to Model Example #include <stdio.h> #include <stdlib.h> ! int main() { FILE* f; int w = 0; enum {FALSE,TRUE} B1, B2, B3; ! if (B1 = any()) { return 1; } ! f = fopen(“sample”, "r"); if (f == NULL) { return 1; } ! ! ! ! ! while (B2 = any()) { if (B3 = any()) { if (!w) w = 1; else w = 0; } } fclose(f); return 0; }
  • 13. Code to Model Example int main() { enum {FALSE,TRUE} B1, B2, B3; enum {FCLOSED, FOPEN, FERROR} fileState; enum {V0, V1} W = V0; fileState = FCLOSED; ! if (B1 = any()) { return 1; } if (any()) { fileState = FOPEN; } else { fileState = FERROR; } if (fileState == FERROR) { return 1; } ! ! ! ! ! while (B2 = any()) { if (B3 = any()) { if (!w) W = V1; else W = V0; } } fileState = FCLOSED; return 0; }
  • 14. Code to Model Example int main() { enum {FCLOSED, FOPEN, FERROR} fileState; ! fileState = FCLOSED; ! if (any()) { fileState = FERROR; } else if (any()) { fileState = FOPEN; while (any()); fileState = FCLOSED; } return 0; } ! entry FCLOSED1 FERROR FOPEN FCLOSED2 exit
  • 15. Formal Verification Techniques • Theorem Proving • Model Checking • Ad hoc voodoo magic ! ! ! ! ! Although these appear to be contradictory approaches, there has been considerable effort to incorporate theorem proving and model checking
  • 16. Theorem Proving • Logical deduction at the intersection of mathematics and logics • Prove that implementation satisfies specification by mathematical reasoning • implementation and specification as formulae in a some formal logic • required relationship (equivalence/implication) as a theorem to prove by using a set of axioms and inference rules (simplification, induction, etc.)
  • 17. Theorem Proving by hand – classic approach • human errors (similar to programming) • unsuitable for verifying large software and hardware systems
  • 18. Theorem Proving with some machine support – machine checks the syntax, fixes layout, translates into different (meta)languages • less errors, readable consistent statements • still unsuitable for verifying large software and hardware systems
  • 19. Theorem Proving interactive – proofs are fully checked by machine based on proof steps provided by user • guaranteed correctness (if the prover is correct) • can prove everything that is provable by hand
  • 20. Theorem Proving automated – theorem is shown by machine; user must state it in a proper form so that the prover can solve the problem within reasonable amount of time • may be used by non-specialists • may be faster than interactive proving • many problems cannot be proved automatically • can often deal only with finite problems
  • 21. Limitations of Theorem Proving • Large manpower investment to prove small theorems, difficult to prove large or hard theorems • Usable only by experts, requires deep understanding of both the system design and proving methodology • Automated for narrow class of system designs
  • 22. Model Checking Automated technique that, given a finite-state model of a system and a formal property, systematically checks whether this property holds for (a given state in) that model. ! Modelling → Running → Analysing
  • 23. Modelling • Model the system under consideration using the model description language of the model checker at hand • As a first sanity check and quick assessment of the model perform some simulations • Formalise the property to be checked using the property specification language.
  • 24. Running • Run the model checker to check the validity of the property in the system model.
  • 25. Analysis • Property satisfied? • Check next property (if any) • Property violated? • Analyse generated counterexample by simulation • Refine the model, design, or property • Repeat the entire procedure. • Out of memory? • Try to reduce the model and try again.
  • 26. Temporal Logic Model Checking • Specifications are written in propositional temporal logic to specify time related system behaviour properties either in absolute time or in terms of sequences of state transitions • Verification is an exhaustive search of the state space of the design
  • 27. Basic Temporal Operators Let p be an atomic proposition, e.g. device_Enabled • Xp – p holds next time • Fp – p holds sometime in a future • Gp – p holds globally in a future (always) • pUq – p holds until another atomic proposition q holds ! Use with ¬∧∨ etc. to form temporal logic formulae
  • 28. Temporal Logic Formula Example The microwave oven does not heat up until the door is closed ! Not heat_up holds until door_closed ! (¬heat_up) U door_closed
  • 29. Temporal Logic Formula Example The microwave oven does not heat up until the door is closed ! Not heat_up holds until door_closed ! (¬heat_up) U (door_closed ∧ powered_on)
  • 30. Temporal Logic Model Checking Goals Safety – something bad will never happen.
 To satisfy, the system must not demonstrate forbidden behaviour ! Liveness – something good will happen in future.
 To satisfy, the system must demonstrate desired behaviour
  • 31. Model Checking: Older Approaches • Construct a model of a system in terms of a finite state machine • Choose a property, express it in some sort of temporal logic and use a tool to explore the state space and to check if the property holds • Explicit-state checker enumerates all possible states [SPIN] • Symbolic checker uses binary decision diagram (BDD) to encode the state transition function [NuSMV etc.]
  • 32. Model Checking: Older Approaches • Good for liveness and safety properties • “is a state with property p reachable?” • “if I see x, will I eventually see y?” • “is property p true for all states?” • Ill-suitable for functional properties • “does this function compute AES-256?”
  • 33. Model Checking: Newer Approaches SAT-based model checkers • Bounded model-checking (BMC) – an otherwise large or even infinite-state FSM can be analysed by checking a finite number of state transitions • Property directed reachability (PDR) – combination of induction, over-approximation and SAT solving
  • 34. Model Checking: Newer Approaches Going into details of SAT and SMT solvers is probably too much to handle for this session. ! X(explain_sat ∧ explain_smt)
  • 35. Model Checking Strengths • General verification approach that is applicable to a wide range of systems • Supports partial verification (properties can be checked individually, essential ones first) • Provides diagnostic information in case a property is invalidated (useful for debugging)
  • 36. Model Checking Strengths (cont.) • Requires neither a high degree of user interaction nor a high degree of expertise • Can be easily integrated in existing development cycles • Sound mathematical underpinning, based on theory of graph algorithms, data structures, logic etc.
  • 37. Model Checking Weaknesses • Mainly for control-intensive systems, less suitable for data-intensive ones • Verifies a model and not the actual system itself; complimentary techniques are needed (testing etc.) • Check only stated requirements, completeness is not guaranteed
  • 38. Model Checking Weaknesses (cont.) • Suffers from the state-space explosion problem • Requires some expertise in finding appropriate abstractions to obtain smaller system models and to state properties in the logical formalism used • Does not allow checking generalisations • A model checker may contain software defects
  • 39. Model Checking Provided various approaches, it is an effective technique to expose design errors
  • 40. Formally Verified System Design Model Implementation theorem proving model checking logic/syntax checkers testing
  • 41. Thank you This presentation is based on materials provided courtesy of and various publicly available Internet sources. All grammar and syntax errors are, let’s say, for watermarking purposes
 2013