SlideShare a Scribd company logo
Towards a Probabilistic Extension to
Non-Deterministic Transitions in Model-Based
Checking
Sergey Staroletov
Polzunov Altai State Technical University,
Lenin avenue 46, Barnaul, 656038, Russia
Email: serg soft@mail.ru
June 10, 2019
1 / 27
The Goal
The work is considered a problem of modeling probabilistic transitions
in Promela language (SPIN verification tool) and a technique of
enhancing its grammar for the purpose of probabilistic verification. The
extension is based on non-deterministic choice operator in Promela.
Motivation:
Study Probabilistic Model Checking
Study grammar of Promela Modeling language
Study internals of SPIN verifier
Propose a Probability-Driven Programming technique
2 / 27
Testing and Formal Verification
Software engineering world has already developed a sufficient
amount of testing technologies and they are applicable well when
creating typical desktop applications or web sites with their
business logic.
For systems that need to work in the critical industries such as
embedded control systems, aircraft management entities,
operating system components, the testing process does not
guarantee sufficient output quality of the product and the
appearance of an error can lead to costly consequences.
It is because the testing is not able to prove the absence of errors
over all possible states and can only show their lack at a particular
test.
3 / 27
Model Checking
Formal verification is a way to mathematically prove the model
program with respect to the requirements (assumptions of correct
model behavior). In the Model Checking approach, these requirements
are usually expressed in a timed logic, such as LTL or CTL. The
models for verification are usually written in a special modeling
language, which simplifies ordinary imperative or functional
programming language with some reduction of types, available
memory, standard library but adds some kind of modeling of process
interoperations and non-deterministic transitions. 4 / 27
Towards the Probabilistic Model Checking
The Probabilistic Model Checking Problem is stated as follows:
Given a property φ, the Problem consists of checking whether a
stochastic system satisfies φ with a probability greater than or equal to
a certain threshold θ. Herein we consider to LTL properties φ.
5 / 27
Towards the Probabilistic Model Checking: An
Example
Refer to the Roundabout Maneuver [Platzer] – is a behavior of two
aircraft to make Collision Avoidance, and it is a subject to cooperation
in air traffic control. The avoidance of collision is achieved by an
agreement on some common angular velocity ωxy and common centre
cxy around which both can fly by the circle safely without coming close
to each other not more than Rsafe. There is the following precondition
to the entry procedure of the Maneuver and the safe property to verify:
isSafe ::= (x1 − y1)2
+ (x2 − y2)2
R2
safe (1)
where x = (x1, x2) is a first planar position, y = (y1, y2) is a second
planar position.
6 / 27
Probabilistic Model Based Checking vs Model Based
Checking
Model checking approach can be applied to this problem by specifying
an LTL property:
[ ] (isSafe == 1) (2)
where ”[]” is the ”Globaly” LTL operator and 1 is an alias for true.
Statement (2) in natural language means ”during the execution in all
the states of the program model, the rule (1) will be preserved as true”.
When we move to the Probabilistic Model Checking, we can specify a
PLTL property as
[ ] θ>90% (isSafe == 1) (3)
and here we like to verify that the system satisfies the safe property
with probability of 90% or higher (that means the system will be safe in
90% cases for some reasons when it start working from an initial state
and finish in a final state; or: in 10% cases or less two aircraft can be
closer than Rsafe).
7 / 27
Probabilistic languages and models to verify
In the work [David] the SMC (Statistical model checking) approach has
been introduced, and the tool Uppaal has been extended to check
system properties using an extended automaton model. The tool offers
probabilistic simulation and verification by specifying in the user
interface probability distributions that drive the timed behaviors, and
the engine offers computing an estimate of probabilities and
comparison between estimated probabilities without actually
computing them.
In the book [Pfeffer] the author decided to implement classes in Scala
language to allow developers to make complex probabilistic and
statistical programs.
In the paper [Probmela] the authors decided to implement from scratch
a language similar to Promela with some probabilistic additions to
satisfy the probabilistic model checking goals. They used SOS-rules in
the Plotkin style to describe the language formally. For example, this
language offers to write code with PIF (probability IF clause):
PIF [p1] ⇒ P1...[pn] ⇒ Pn FIP (4)
8 / 27
SPIN and Promela
SPIN [spinroot.com] is a verifier for models written in the special
Promela input language with respect to given LTL requirements
consisted of model key variables. Some language features:
it is an actor-based (process-oriented) language;
a C-style syntax in some cases;
code in the language looks having the functional style, but the
language does not offer to define functions, it uses inline
declarations quite similar to the macros in C;
allows non-deterministic transitions;
primarily designed to describe protocols interoperations.
9 / 27
SPIN and Promela example
int var = 2;
int count = 0;
l t l formula { [ ] ( var >= 0)}
active proctype main ( ) {
do
: : count != 3 −>
{
i f
: : true−> var = var + 1;
: : true−> var = var − 1;
f i
count = count + 1;
}
: : else −>
break
od
}
10 / 27
SPIN internal automaton for the example program
11 / 27
SPIN internal automaton for the example formula
12 / 27
Towards the extensibility of a modeling language
In the current work, we are going to follow this approach, but without
creating a ”yet another” language and a new tool, because now
Promela language and SPIN tool are well-designed and
community-approved, and new language creation instead of extension
of an existing one should be well justified. Of course, it is possible to
declare some inductive rules for a theorem prover for making the
evidence of particular problems like it is done in [Shishkin], but
extending a modeling language to some conventional structures and
rules can involve additional engineers to the formal proof process of
software.
13 / 27
Towards the extensibility of a modeling language: IF
clause
The Promela language contains conditions in the form
i f
: : boolean expression1 −> actions1
: : boolean expression2 −> actions2
: : boolean expressionN −> actionsN
f i
It is considered that in order to perform a certain action, it is necessary
that the corresponding logical expression was true.
14 / 27
Towards the extensibility of a modeling language:
non-detetministic IF clause
The Promela language contains conditions in the form
Refer to the code snippet in Promela, modeling the Leader Selection
algorithm (Dolev, Klawe & Rodeh):
i f /∗ non−d e t e r m i n i s t i c choice ∗/
: : I n i [ 0 ] == 0 && N >= 1 −> I n i [ 0 ] = I
: : I n i [ 1 ] == 0 && N >= 2 −> I n i [ 1 ] = I
: : I n i [ 2 ] == 0 && N >= 3 −> I n i [ 2 ] = I
: : I n i [ 3 ] == 0 && N >= 4 −> I n i [ 3 ] = I
: : I n i [ 4 ] == 0 && N >= 5 −> I n i [ 4 ] = I
: : I n i [ 5 ] == 0 && N >= 6 −> I n i [ 5 ] = I
f i
with N equal to, for example, 3 and the zero value of Ini, it has four
variants of non-deterministic steps in the Promela model to continue at
this point.
15 / 27
Towards the extensibility of a modeling language:
Naive probabilies
For example in this case the probabilities of both actions are identical
(50 and 50 percents):
i f
: : boolean expression1 −> actions1
: : boolean expression2 −> actions2
f i
If we want to increase the likelihood of action1, the following code
i f
: : boolean expression1 −> actions1
: : boolean expression1 −> actions1
: : boolean expression2 −> actions2
f i
does not change the logic of the transition, it changes the likelihood of
the first step in the model.
16 / 27
Towards the extensibility of a modeling language: what
do we want
We propose first to extend the Promela grammar with an annotation of
probabilistic transition:
i f
: : [ prob = value %] condition −> actions
. . .
f i
where the ”prob value” (probability value) is an integer of [0..100].
17 / 27
Towards the extensibility of a modeling language:
extension to the grammar
SPIN is shipped in the open source code, now available in Github
repository. Promela language parser is implemented using Yacc tools.
A fragment of the grammar is introducing the changes described here
(modified source from spin.y):
options : option
| option options
;
option : SEP
prob
sequence OS
;
prob :/* empty */
| ’[’ PROB ASGN const_expr ’%’ ’]’
;
18 / 27
Towards the extensibility of a modeling language:
additional extension to the grammar
Further, we propose to extend this idea, putting the probability of not
only as a constant number but the value of a variable. In this case, the
probability may dynamically be recalculated during program execution
on Promela. So, the following Promela grammar addition is presented:
prob :/* empty */
| ’[’ PROB ASGN const_expr ’%’ ’]’
| ’[’ PROB ASGN expr ’]’
;
where expr – is a grammar rule for the Promela expression.
19 / 27
Towards the extensibility of a modeling language: how
to wrap the SPIN simulation engine
In the current SPIN implementation, a next running node in a
non-deterministic transition is selected using seed-based random
generator, see run.c:
/∗ CACM 31(10) , Oct 1988 ∗/
Seed = 16807∗(Seed%127773) − 2836
∗(Seed/127773);
i f (Seed <= 0) Seed += 2147483647;
return Seed ;
So the patch do the following: calculate current likehood of code node
execution and move from the random to probabilities.
20 / 27
Towards the extensibility of a modeling language:
advantages
Thus we will be able, for example, simulate and verify various training
and recognition algorithms. A new probability value will be received
from a different process, changed in code based on a given
probabilistic transition or other different cases. So, with simple
grammar additions and some changing to semantic of SPIN code, we
can speak of ”Probability driven programming” in Promela.
21 / 27
Towards the extensibility of a modeling language:
channels
To continue this idea, we can propose some ”syntactic sugar” for
probabilistic actions with Promela channels. To simulate some
networking protocols it is required to specify a loss/reliability value for a
channel, that means: with a given probability a channel lose/guarantee
some messages and protocols should correctly handle this.
22 / 27
Towards the extensibility of a modeling language: our
toy simulation language
mtype = {s1 , s2 , s3 };
int count = 0;
/∗ now define a normal chan ∗/
chan a = [ 1 ] of { short };
/∗ now define a chan with 30% loss value ∗/
chan [ loss = 30%] b = [ 1 ] of { short };
/∗ now define a chan with 70% r e l y
value ( or 30% loss ) ∗/
chan [ r e l y = 70%] c = [ 1 ] of { short };
int pp = 70;
23 / 27
Towards the extensibility of a modeling language: our
toy simulation language
active proctype main ( ) {
mtype state = s1 ;
count = pp − 10;
/∗ send to a normal chan ∗/
a ! 1
/∗ send to a 30% loss chan ∗/
b ! count ;
/∗ send to a chan with re−defined 10%
loss ∗/
c ! [ loss = 10%] 3;
/∗ send to a chan with 70% r e l i a b i l i t y ∗/
c ! 2;
/∗ send to a chan with re−defined 99%
r e l i a b i l i t y ∗/
c ! [ r e l y = 99%] 4;
/∗ send to a chan with re−defined loss 24 / 27
Towards the extensibility of a modeling language: our
toy simulation language
b ! [ loss = count ] 1;
i f
: : true −> state = s2 ;
/∗ 10% prob t r a n s i t i o n ∗/
: : [ prob = 10%] true −> state = s3 ;
/∗ dynamic prob t r a n s i t i o n ∗/
: : [ prob = pp ] true −> state = s3 ;
/∗ f o r the others prob w i l l be ∗/
calculated as 100% − a l l
specified probs ∗/
: : true −> state = s2 ;
: : true −> state = s3 ;
f i
printf ( ” state = %d ” , state ) ;
}
25 / 27
Status and Results
Currently, we implemented the extension to the grammar with a
goal to extend the semantics and understanding of the SPIN
internal logic.
The advanced program simulation in Promela as well as
verification code generation are in progress.
Adding probabilities to the transitions and channels with losses
will allow SPIN users to model some complex interactions and
probabilistic algorithms. We are making some additions on
internal nodes (at the parsing time), and some – on dynamic
values calculation after SPIN processes are scheduled.
This approach also allows verification engineers to extend the
class of verifiable systems with the SPIN verifier.
26 / 27
Learn more about Model Checking
27 / 27

More Related Content

What's hot

Basic structure of C++ program
Basic structure of C++ programBasic structure of C++ program
Basic structure of C++ program
matiur rahman
 
Unit1
Unit1Unit1
C programming interview questions
C programming interview questionsC programming interview questions
C programming interview questions
adarshynl
 
structured programming Introduction to c fundamentals
structured programming Introduction to c fundamentalsstructured programming Introduction to c fundamentals
structured programming Introduction to c fundamentals
OMWOMA JACKSON
 
Specification-based Verification of Incomplete Programs
Specification-based Verification of Incomplete ProgramsSpecification-based Verification of Incomplete Programs
Specification-based Verification of Incomplete Programs
IDES Editor
 
C programming notes
C programming notesC programming notes
C programming notes
Prof. Dr. K. Adisesha
 
Lecture13 control statementswitch.ppt
Lecture13 control statementswitch.pptLecture13 control statementswitch.ppt
Lecture13 control statementswitch.ppt
eShikshak
 
01 c++ Intro.ppt
01 c++ Intro.ppt01 c++ Intro.ppt
01 c++ Intro.pptTareq Hasan
 
C notes diploma-ee-3rd-sem
C notes diploma-ee-3rd-semC notes diploma-ee-3rd-sem
C notes diploma-ee-3rd-sem
Kavita Dagar
 
Password protected diary
Password protected diaryPassword protected diary
Password protected diary
SHARDA SHARAN
 
Code obfuscation
Code obfuscationCode obfuscation
Code obfuscation
Amol Kamble
 
Advanced Java Topics
Advanced Java TopicsAdvanced Java Topics
Advanced Java Topics
Salahaddin University-Erbil
 
C++ Basics introduction to typecasting Webinar Slides 1
C++ Basics introduction to typecasting Webinar Slides 1C++ Basics introduction to typecasting Webinar Slides 1
C++ Basics introduction to typecasting Webinar Slides 1
Ali Raza Jilani
 
Sta unit 4(abimanyu)
Sta unit 4(abimanyu)Sta unit 4(abimanyu)
Sta unit 4(abimanyu)
Abhimanyu Mishra
 
best notes in c language
best notes in c languagebest notes in c language
best notes in c language
India
 
How c/c++ works
How c/c++ worksHow c/c++ works
How c/c++ works
Md. Ekhlasur Rahman
 
BERT
BERTBERT
1 puc programming using c++
1 puc programming using c++1 puc programming using c++
1 puc programming using c++
Prof. Dr. K. Adisesha
 

What's hot (20)

Basic structure of C++ program
Basic structure of C++ programBasic structure of C++ program
Basic structure of C++ program
 
Unit1
Unit1Unit1
Unit1
 
C programming interview questions
C programming interview questionsC programming interview questions
C programming interview questions
 
structured programming Introduction to c fundamentals
structured programming Introduction to c fundamentalsstructured programming Introduction to c fundamentals
structured programming Introduction to c fundamentals
 
Specification-based Verification of Incomplete Programs
Specification-based Verification of Incomplete ProgramsSpecification-based Verification of Incomplete Programs
Specification-based Verification of Incomplete Programs
 
C programming notes
C programming notesC programming notes
C programming notes
 
Lecture13 control statementswitch.ppt
Lecture13 control statementswitch.pptLecture13 control statementswitch.ppt
Lecture13 control statementswitch.ppt
 
01 c++ Intro.ppt
01 c++ Intro.ppt01 c++ Intro.ppt
01 c++ Intro.ppt
 
C notes diploma-ee-3rd-sem
C notes diploma-ee-3rd-semC notes diploma-ee-3rd-sem
C notes diploma-ee-3rd-sem
 
Password protected diary
Password protected diaryPassword protected diary
Password protected diary
 
Code obfuscation
Code obfuscationCode obfuscation
Code obfuscation
 
Advanced Java Topics
Advanced Java TopicsAdvanced Java Topics
Advanced Java Topics
 
Switch case and looping
Switch case and loopingSwitch case and looping
Switch case and looping
 
Basics1
Basics1Basics1
Basics1
 
C++ Basics introduction to typecasting Webinar Slides 1
C++ Basics introduction to typecasting Webinar Slides 1C++ Basics introduction to typecasting Webinar Slides 1
C++ Basics introduction to typecasting Webinar Slides 1
 
Sta unit 4(abimanyu)
Sta unit 4(abimanyu)Sta unit 4(abimanyu)
Sta unit 4(abimanyu)
 
best notes in c language
best notes in c languagebest notes in c language
best notes in c language
 
How c/c++ works
How c/c++ worksHow c/c++ works
How c/c++ works
 
BERT
BERTBERT
BERT
 
1 puc programming using c++
1 puc programming using c++1 puc programming using c++
1 puc programming using c++
 

Similar to Towards a Probabilistic Extension to Non-Deterministic Transitions in Model-Based Checking

Rapport_Cemracs2012
Rapport_Cemracs2012Rapport_Cemracs2012
Rapport_Cemracs2012Jussara F.M.
 
A study of the Behavior of Floating-Point Errors
A study of the Behavior of Floating-Point ErrorsA study of the Behavior of Floating-Point Errors
A study of the Behavior of Floating-Point Errors
ijpla
 
Staroletov MBC (Model Based Checking)
Staroletov MBC (Model Based Checking)Staroletov MBC (Model Based Checking)
Staroletov MBC (Model Based Checking)
Sergey Staroletov
 
Abhik-Satish-dagstuhl
Abhik-Satish-dagstuhlAbhik-Satish-dagstuhl
Abhik-Satish-dagstuhl
Abhik Roychoudhury
 
DEFECT PREDICTION USING ORDER STATISTICS
DEFECT PREDICTION USING ORDER STATISTICSDEFECT PREDICTION USING ORDER STATISTICS
DEFECT PREDICTION USING ORDER STATISTICS
IAEME Publication
 
Validation and Verification of SYSML Activity Diagrams Using HOARE Logic
Validation and Verification of SYSML Activity Diagrams Using HOARE Logic Validation and Verification of SYSML Activity Diagrams Using HOARE Logic
Validation and Verification of SYSML Activity Diagrams Using HOARE Logic
ijseajournal
 
Turbo prolog 2.0 basics
Turbo prolog 2.0 basicsTurbo prolog 2.0 basics
Turbo prolog 2.0 basics
Soham Kansodaria
 
Model-based GUI testing using Uppaal
Model-based GUI testing using UppaalModel-based GUI testing using Uppaal
Model-based GUI testing using UppaalUlrik Hørlyk Hjort
 
Recent Advances in Flower Pollination Algorithm
Recent Advances in Flower Pollination AlgorithmRecent Advances in Flower Pollination Algorithm
Recent Advances in Flower Pollination Algorithm
Editor IJCATR
 
LNCS 5050 - Bilevel Optimization and Machine Learning
LNCS 5050 - Bilevel Optimization and Machine LearningLNCS 5050 - Bilevel Optimization and Machine Learning
LNCS 5050 - Bilevel Optimization and Machine Learningbutest
 
Test design techniques
Test design techniquesTest design techniques
Test design techniques
Gregory Solovey
 
Scientific calculator project in c language
Scientific calculator project in c languageScientific calculator project in c language
Scientific calculator project in c language
AMIT KUMAR
 
Cl32990995
Cl32990995Cl32990995
Cl32990995IJMER
 
ismm2009.pdfismm2009.pdfismm2009.pdfismm2009.pdfismm2009.pdfismm2009.pdf
ismm2009.pdfismm2009.pdfismm2009.pdfismm2009.pdfismm2009.pdfismm2009.pdfismm2009.pdfismm2009.pdfismm2009.pdfismm2009.pdfismm2009.pdfismm2009.pdf
ismm2009.pdfismm2009.pdfismm2009.pdfismm2009.pdfismm2009.pdfismm2009.pdf
这是自动改成得中文名啊老弟
 
Quality Assurance
Quality AssuranceQuality Assurance
Quality Assurance
Kiran Kumar
 
Finding latent code errors via machine learning over program ...
Finding latent code errors via machine learning over program ...Finding latent code errors via machine learning over program ...
Finding latent code errors via machine learning over program ...butest
 
STATICMOCK : A Mock Object Framework for Compiled Languages
STATICMOCK : A Mock Object Framework for Compiled Languages STATICMOCK : A Mock Object Framework for Compiled Languages
STATICMOCK : A Mock Object Framework for Compiled Languages
ijseajournal
 

Similar to Towards a Probabilistic Extension to Non-Deterministic Transitions in Model-Based Checking (20)

Rapport_Cemracs2012
Rapport_Cemracs2012Rapport_Cemracs2012
Rapport_Cemracs2012
 
A study of the Behavior of Floating-Point Errors
A study of the Behavior of Floating-Point ErrorsA study of the Behavior of Floating-Point Errors
A study of the Behavior of Floating-Point Errors
 
final pl paper
final pl paperfinal pl paper
final pl paper
 
Staroletov MBC (Model Based Checking)
Staroletov MBC (Model Based Checking)Staroletov MBC (Model Based Checking)
Staroletov MBC (Model Based Checking)
 
Abhik-Satish-dagstuhl
Abhik-Satish-dagstuhlAbhik-Satish-dagstuhl
Abhik-Satish-dagstuhl
 
DEFECT PREDICTION USING ORDER STATISTICS
DEFECT PREDICTION USING ORDER STATISTICSDEFECT PREDICTION USING ORDER STATISTICS
DEFECT PREDICTION USING ORDER STATISTICS
 
Validation and Verification of SYSML Activity Diagrams Using HOARE Logic
Validation and Verification of SYSML Activity Diagrams Using HOARE Logic Validation and Verification of SYSML Activity Diagrams Using HOARE Logic
Validation and Verification of SYSML Activity Diagrams Using HOARE Logic
 
Turbo prolog 2.0 basics
Turbo prolog 2.0 basicsTurbo prolog 2.0 basics
Turbo prolog 2.0 basics
 
Model-based GUI testing using Uppaal
Model-based GUI testing using UppaalModel-based GUI testing using Uppaal
Model-based GUI testing using Uppaal
 
Recent Advances in Flower Pollination Algorithm
Recent Advances in Flower Pollination AlgorithmRecent Advances in Flower Pollination Algorithm
Recent Advances in Flower Pollination Algorithm
 
LNCS 5050 - Bilevel Optimization and Machine Learning
LNCS 5050 - Bilevel Optimization and Machine LearningLNCS 5050 - Bilevel Optimization and Machine Learning
LNCS 5050 - Bilevel Optimization and Machine Learning
 
Test design techniques
Test design techniquesTest design techniques
Test design techniques
 
Scientific calculator project in c language
Scientific calculator project in c languageScientific calculator project in c language
Scientific calculator project in c language
 
Cl32990995
Cl32990995Cl32990995
Cl32990995
 
ismm2009.pdfismm2009.pdfismm2009.pdfismm2009.pdfismm2009.pdfismm2009.pdf
ismm2009.pdfismm2009.pdfismm2009.pdfismm2009.pdfismm2009.pdfismm2009.pdfismm2009.pdfismm2009.pdfismm2009.pdfismm2009.pdfismm2009.pdfismm2009.pdf
ismm2009.pdfismm2009.pdfismm2009.pdfismm2009.pdfismm2009.pdfismm2009.pdf
 
干法
干法干法
干法
 
Quality Assurance
Quality AssuranceQuality Assurance
Quality Assurance
 
3.5
3.53.5
3.5
 
Finding latent code errors via machine learning over program ...
Finding latent code errors via machine learning over program ...Finding latent code errors via machine learning over program ...
Finding latent code errors via machine learning over program ...
 
STATICMOCK : A Mock Object Framework for Compiled Languages
STATICMOCK : A Mock Object Framework for Compiled Languages STATICMOCK : A Mock Object Framework for Compiled Languages
STATICMOCK : A Mock Object Framework for Compiled Languages
 

More from Sergey Staroletov

Distributed Systems Presentation for Business informatics students (Staroletov)
Distributed Systems Presentation for Business informatics students (Staroletov)Distributed Systems Presentation for Business informatics students (Staroletov)
Distributed Systems Presentation for Business informatics students (Staroletov)
Sergey Staroletov
 
Теория языков программирования некоторые слайды к лекциям
Теория языков программирования некоторые слайды к лекциямТеория языков программирования некоторые слайды к лекциям
Теория языков программирования некоторые слайды к лекциям
Sergey Staroletov
 
Staroletov Design by Contract, verification of Cyber-physical systems
Staroletov Design by Contract, verification of Cyber-physical systemsStaroletov Design by Contract, verification of Cyber-physical systems
Staroletov Design by Contract, verification of Cyber-physical systems
Sergey Staroletov
 
Staroletov testing TDD BDD MBT
Staroletov testing TDD BDD MBTStaroletov testing TDD BDD MBT
Staroletov testing TDD BDD MBT
Sergey Staroletov
 
An Application of Test-Driven Development Methodology into the Process of Ha...
 An Application of Test-Driven Development Methodology into the Process of Ha... An Application of Test-Driven Development Methodology into the Process of Ha...
An Application of Test-Driven Development Methodology into the Process of Ha...
Sergey Staroletov
 
Applying Model Checking Approach with Floating Point Arithmetic for Verificat...
Applying Model Checking Approach with Floating Point Arithmetic for Verificat...Applying Model Checking Approach with Floating Point Arithmetic for Verificat...
Applying Model Checking Approach with Floating Point Arithmetic for Verificat...
Sergey Staroletov
 
Cameroun (Francophone day)
Cameroun (Francophone day)Cameroun (Francophone day)
Cameroun (Francophone day)
Sergey Staroletov
 

More from Sergey Staroletov (7)

Distributed Systems Presentation for Business informatics students (Staroletov)
Distributed Systems Presentation for Business informatics students (Staroletov)Distributed Systems Presentation for Business informatics students (Staroletov)
Distributed Systems Presentation for Business informatics students (Staroletov)
 
Теория языков программирования некоторые слайды к лекциям
Теория языков программирования некоторые слайды к лекциямТеория языков программирования некоторые слайды к лекциям
Теория языков программирования некоторые слайды к лекциям
 
Staroletov Design by Contract, verification of Cyber-physical systems
Staroletov Design by Contract, verification of Cyber-physical systemsStaroletov Design by Contract, verification of Cyber-physical systems
Staroletov Design by Contract, verification of Cyber-physical systems
 
Staroletov testing TDD BDD MBT
Staroletov testing TDD BDD MBTStaroletov testing TDD BDD MBT
Staroletov testing TDD BDD MBT
 
An Application of Test-Driven Development Methodology into the Process of Ha...
 An Application of Test-Driven Development Methodology into the Process of Ha... An Application of Test-Driven Development Methodology into the Process of Ha...
An Application of Test-Driven Development Methodology into the Process of Ha...
 
Applying Model Checking Approach with Floating Point Arithmetic for Verificat...
Applying Model Checking Approach with Floating Point Arithmetic for Verificat...Applying Model Checking Approach with Floating Point Arithmetic for Verificat...
Applying Model Checking Approach with Floating Point Arithmetic for Verificat...
 
Cameroun (Francophone day)
Cameroun (Francophone day)Cameroun (Francophone day)
Cameroun (Francophone day)
 

Recently uploaded

Orion Context Broker introduction 20240604
Orion Context Broker introduction 20240604Orion Context Broker introduction 20240604
Orion Context Broker introduction 20240604
Fermin Galan
 
Lecture 1 Introduction to games development
Lecture 1 Introduction to games developmentLecture 1 Introduction to games development
Lecture 1 Introduction to games development
abdulrafaychaudhry
 
Quarkus Hidden and Forbidden Extensions
Quarkus Hidden and Forbidden ExtensionsQuarkus Hidden and Forbidden Extensions
Quarkus Hidden and Forbidden Extensions
Max Andersen
 
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...
informapgpstrackings
 
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
Globus
 
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
 
AI Pilot Review: The World’s First Virtual Assistant Marketing Suite
AI Pilot Review: The World’s First Virtual Assistant Marketing SuiteAI Pilot Review: The World’s First Virtual Assistant Marketing Suite
AI Pilot Review: The World’s First Virtual Assistant Marketing Suite
Google
 
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
 
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
Shahin Sheidaei
 
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
 
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
 
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
 
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
 
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
 
Understanding Globus Data Transfers with NetSage
Understanding Globus Data Transfers with NetSageUnderstanding Globus Data Transfers with NetSage
Understanding Globus Data Transfers with NetSage
Globus
 
Cracking the code review at SpringIO 2024
Cracking the code review at SpringIO 2024Cracking the code review at SpringIO 2024
Cracking the code review at SpringIO 2024
Paco van Beckhoven
 
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
 
Utilocate provides Smarter, Better, Faster, Safer Locate Ticket Management
Utilocate provides Smarter, Better, Faster, Safer Locate Ticket ManagementUtilocate provides Smarter, Better, Faster, Safer Locate Ticket Management
Utilocate provides Smarter, Better, Faster, Safer Locate Ticket Management
Utilocate
 
BoxLang: Review our Visionary Licenses of 2024
BoxLang: Review our Visionary Licenses of 2024BoxLang: Review our Visionary Licenses of 2024
BoxLang: Review our Visionary Licenses of 2024
Ortus Solutions, Corp
 
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
 

Recently uploaded (20)

Orion Context Broker introduction 20240604
Orion Context Broker introduction 20240604Orion Context Broker introduction 20240604
Orion Context Broker introduction 20240604
 
Lecture 1 Introduction to games development
Lecture 1 Introduction to games developmentLecture 1 Introduction to games development
Lecture 1 Introduction to games development
 
Quarkus Hidden and Forbidden Extensions
Quarkus Hidden and Forbidden ExtensionsQuarkus Hidden and Forbidden Extensions
Quarkus Hidden and Forbidden Extensions
 
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...
 
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
 
Launch Your Streaming Platforms in Minutes
Launch Your Streaming Platforms in MinutesLaunch Your Streaming Platforms in Minutes
Launch Your Streaming Platforms in Minutes
 
AI Pilot Review: The World’s First Virtual Assistant Marketing Suite
AI Pilot Review: The World’s First Virtual Assistant Marketing SuiteAI Pilot Review: The World’s First Virtual Assistant Marketing Suite
AI Pilot Review: The World’s First Virtual Assistant Marketing Suite
 
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
 
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
 
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
 
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
 
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)
 
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
 
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...
 
Understanding Globus Data Transfers with NetSage
Understanding Globus Data Transfers with NetSageUnderstanding Globus Data Transfers with NetSage
Understanding Globus Data Transfers with NetSage
 
Cracking the code review at SpringIO 2024
Cracking the code review at SpringIO 2024Cracking the code review at SpringIO 2024
Cracking the code review at SpringIO 2024
 
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
 
Utilocate provides Smarter, Better, Faster, Safer Locate Ticket Management
Utilocate provides Smarter, Better, Faster, Safer Locate Ticket ManagementUtilocate provides Smarter, Better, Faster, Safer Locate Ticket Management
Utilocate provides Smarter, Better, Faster, Safer Locate Ticket Management
 
BoxLang: Review our Visionary Licenses of 2024
BoxLang: Review our Visionary Licenses of 2024BoxLang: Review our Visionary Licenses of 2024
BoxLang: Review our Visionary Licenses of 2024
 
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
 

Towards a Probabilistic Extension to Non-Deterministic Transitions in Model-Based Checking

  • 1. Towards a Probabilistic Extension to Non-Deterministic Transitions in Model-Based Checking Sergey Staroletov Polzunov Altai State Technical University, Lenin avenue 46, Barnaul, 656038, Russia Email: serg soft@mail.ru June 10, 2019 1 / 27
  • 2. The Goal The work is considered a problem of modeling probabilistic transitions in Promela language (SPIN verification tool) and a technique of enhancing its grammar for the purpose of probabilistic verification. The extension is based on non-deterministic choice operator in Promela. Motivation: Study Probabilistic Model Checking Study grammar of Promela Modeling language Study internals of SPIN verifier Propose a Probability-Driven Programming technique 2 / 27
  • 3. Testing and Formal Verification Software engineering world has already developed a sufficient amount of testing technologies and they are applicable well when creating typical desktop applications or web sites with their business logic. For systems that need to work in the critical industries such as embedded control systems, aircraft management entities, operating system components, the testing process does not guarantee sufficient output quality of the product and the appearance of an error can lead to costly consequences. It is because the testing is not able to prove the absence of errors over all possible states and can only show their lack at a particular test. 3 / 27
  • 4. Model Checking Formal verification is a way to mathematically prove the model program with respect to the requirements (assumptions of correct model behavior). In the Model Checking approach, these requirements are usually expressed in a timed logic, such as LTL or CTL. The models for verification are usually written in a special modeling language, which simplifies ordinary imperative or functional programming language with some reduction of types, available memory, standard library but adds some kind of modeling of process interoperations and non-deterministic transitions. 4 / 27
  • 5. Towards the Probabilistic Model Checking The Probabilistic Model Checking Problem is stated as follows: Given a property φ, the Problem consists of checking whether a stochastic system satisfies φ with a probability greater than or equal to a certain threshold θ. Herein we consider to LTL properties φ. 5 / 27
  • 6. Towards the Probabilistic Model Checking: An Example Refer to the Roundabout Maneuver [Platzer] – is a behavior of two aircraft to make Collision Avoidance, and it is a subject to cooperation in air traffic control. The avoidance of collision is achieved by an agreement on some common angular velocity ωxy and common centre cxy around which both can fly by the circle safely without coming close to each other not more than Rsafe. There is the following precondition to the entry procedure of the Maneuver and the safe property to verify: isSafe ::= (x1 − y1)2 + (x2 − y2)2 R2 safe (1) where x = (x1, x2) is a first planar position, y = (y1, y2) is a second planar position. 6 / 27
  • 7. Probabilistic Model Based Checking vs Model Based Checking Model checking approach can be applied to this problem by specifying an LTL property: [ ] (isSafe == 1) (2) where ”[]” is the ”Globaly” LTL operator and 1 is an alias for true. Statement (2) in natural language means ”during the execution in all the states of the program model, the rule (1) will be preserved as true”. When we move to the Probabilistic Model Checking, we can specify a PLTL property as [ ] θ>90% (isSafe == 1) (3) and here we like to verify that the system satisfies the safe property with probability of 90% or higher (that means the system will be safe in 90% cases for some reasons when it start working from an initial state and finish in a final state; or: in 10% cases or less two aircraft can be closer than Rsafe). 7 / 27
  • 8. Probabilistic languages and models to verify In the work [David] the SMC (Statistical model checking) approach has been introduced, and the tool Uppaal has been extended to check system properties using an extended automaton model. The tool offers probabilistic simulation and verification by specifying in the user interface probability distributions that drive the timed behaviors, and the engine offers computing an estimate of probabilities and comparison between estimated probabilities without actually computing them. In the book [Pfeffer] the author decided to implement classes in Scala language to allow developers to make complex probabilistic and statistical programs. In the paper [Probmela] the authors decided to implement from scratch a language similar to Promela with some probabilistic additions to satisfy the probabilistic model checking goals. They used SOS-rules in the Plotkin style to describe the language formally. For example, this language offers to write code with PIF (probability IF clause): PIF [p1] ⇒ P1...[pn] ⇒ Pn FIP (4) 8 / 27
  • 9. SPIN and Promela SPIN [spinroot.com] is a verifier for models written in the special Promela input language with respect to given LTL requirements consisted of model key variables. Some language features: it is an actor-based (process-oriented) language; a C-style syntax in some cases; code in the language looks having the functional style, but the language does not offer to define functions, it uses inline declarations quite similar to the macros in C; allows non-deterministic transitions; primarily designed to describe protocols interoperations. 9 / 27
  • 10. SPIN and Promela example int var = 2; int count = 0; l t l formula { [ ] ( var >= 0)} active proctype main ( ) { do : : count != 3 −> { i f : : true−> var = var + 1; : : true−> var = var − 1; f i count = count + 1; } : : else −> break od } 10 / 27
  • 11. SPIN internal automaton for the example program 11 / 27
  • 12. SPIN internal automaton for the example formula 12 / 27
  • 13. Towards the extensibility of a modeling language In the current work, we are going to follow this approach, but without creating a ”yet another” language and a new tool, because now Promela language and SPIN tool are well-designed and community-approved, and new language creation instead of extension of an existing one should be well justified. Of course, it is possible to declare some inductive rules for a theorem prover for making the evidence of particular problems like it is done in [Shishkin], but extending a modeling language to some conventional structures and rules can involve additional engineers to the formal proof process of software. 13 / 27
  • 14. Towards the extensibility of a modeling language: IF clause The Promela language contains conditions in the form i f : : boolean expression1 −> actions1 : : boolean expression2 −> actions2 : : boolean expressionN −> actionsN f i It is considered that in order to perform a certain action, it is necessary that the corresponding logical expression was true. 14 / 27
  • 15. Towards the extensibility of a modeling language: non-detetministic IF clause The Promela language contains conditions in the form Refer to the code snippet in Promela, modeling the Leader Selection algorithm (Dolev, Klawe & Rodeh): i f /∗ non−d e t e r m i n i s t i c choice ∗/ : : I n i [ 0 ] == 0 && N >= 1 −> I n i [ 0 ] = I : : I n i [ 1 ] == 0 && N >= 2 −> I n i [ 1 ] = I : : I n i [ 2 ] == 0 && N >= 3 −> I n i [ 2 ] = I : : I n i [ 3 ] == 0 && N >= 4 −> I n i [ 3 ] = I : : I n i [ 4 ] == 0 && N >= 5 −> I n i [ 4 ] = I : : I n i [ 5 ] == 0 && N >= 6 −> I n i [ 5 ] = I f i with N equal to, for example, 3 and the zero value of Ini, it has four variants of non-deterministic steps in the Promela model to continue at this point. 15 / 27
  • 16. Towards the extensibility of a modeling language: Naive probabilies For example in this case the probabilities of both actions are identical (50 and 50 percents): i f : : boolean expression1 −> actions1 : : boolean expression2 −> actions2 f i If we want to increase the likelihood of action1, the following code i f : : boolean expression1 −> actions1 : : boolean expression1 −> actions1 : : boolean expression2 −> actions2 f i does not change the logic of the transition, it changes the likelihood of the first step in the model. 16 / 27
  • 17. Towards the extensibility of a modeling language: what do we want We propose first to extend the Promela grammar with an annotation of probabilistic transition: i f : : [ prob = value %] condition −> actions . . . f i where the ”prob value” (probability value) is an integer of [0..100]. 17 / 27
  • 18. Towards the extensibility of a modeling language: extension to the grammar SPIN is shipped in the open source code, now available in Github repository. Promela language parser is implemented using Yacc tools. A fragment of the grammar is introducing the changes described here (modified source from spin.y): options : option | option options ; option : SEP prob sequence OS ; prob :/* empty */ | ’[’ PROB ASGN const_expr ’%’ ’]’ ; 18 / 27
  • 19. Towards the extensibility of a modeling language: additional extension to the grammar Further, we propose to extend this idea, putting the probability of not only as a constant number but the value of a variable. In this case, the probability may dynamically be recalculated during program execution on Promela. So, the following Promela grammar addition is presented: prob :/* empty */ | ’[’ PROB ASGN const_expr ’%’ ’]’ | ’[’ PROB ASGN expr ’]’ ; where expr – is a grammar rule for the Promela expression. 19 / 27
  • 20. Towards the extensibility of a modeling language: how to wrap the SPIN simulation engine In the current SPIN implementation, a next running node in a non-deterministic transition is selected using seed-based random generator, see run.c: /∗ CACM 31(10) , Oct 1988 ∗/ Seed = 16807∗(Seed%127773) − 2836 ∗(Seed/127773); i f (Seed <= 0) Seed += 2147483647; return Seed ; So the patch do the following: calculate current likehood of code node execution and move from the random to probabilities. 20 / 27
  • 21. Towards the extensibility of a modeling language: advantages Thus we will be able, for example, simulate and verify various training and recognition algorithms. A new probability value will be received from a different process, changed in code based on a given probabilistic transition or other different cases. So, with simple grammar additions and some changing to semantic of SPIN code, we can speak of ”Probability driven programming” in Promela. 21 / 27
  • 22. Towards the extensibility of a modeling language: channels To continue this idea, we can propose some ”syntactic sugar” for probabilistic actions with Promela channels. To simulate some networking protocols it is required to specify a loss/reliability value for a channel, that means: with a given probability a channel lose/guarantee some messages and protocols should correctly handle this. 22 / 27
  • 23. Towards the extensibility of a modeling language: our toy simulation language mtype = {s1 , s2 , s3 }; int count = 0; /∗ now define a normal chan ∗/ chan a = [ 1 ] of { short }; /∗ now define a chan with 30% loss value ∗/ chan [ loss = 30%] b = [ 1 ] of { short }; /∗ now define a chan with 70% r e l y value ( or 30% loss ) ∗/ chan [ r e l y = 70%] c = [ 1 ] of { short }; int pp = 70; 23 / 27
  • 24. Towards the extensibility of a modeling language: our toy simulation language active proctype main ( ) { mtype state = s1 ; count = pp − 10; /∗ send to a normal chan ∗/ a ! 1 /∗ send to a 30% loss chan ∗/ b ! count ; /∗ send to a chan with re−defined 10% loss ∗/ c ! [ loss = 10%] 3; /∗ send to a chan with 70% r e l i a b i l i t y ∗/ c ! 2; /∗ send to a chan with re−defined 99% r e l i a b i l i t y ∗/ c ! [ r e l y = 99%] 4; /∗ send to a chan with re−defined loss 24 / 27
  • 25. Towards the extensibility of a modeling language: our toy simulation language b ! [ loss = count ] 1; i f : : true −> state = s2 ; /∗ 10% prob t r a n s i t i o n ∗/ : : [ prob = 10%] true −> state = s3 ; /∗ dynamic prob t r a n s i t i o n ∗/ : : [ prob = pp ] true −> state = s3 ; /∗ f o r the others prob w i l l be ∗/ calculated as 100% − a l l specified probs ∗/ : : true −> state = s2 ; : : true −> state = s3 ; f i printf ( ” state = %d ” , state ) ; } 25 / 27
  • 26. Status and Results Currently, we implemented the extension to the grammar with a goal to extend the semantics and understanding of the SPIN internal logic. The advanced program simulation in Promela as well as verification code generation are in progress. Adding probabilities to the transitions and channels with losses will allow SPIN users to model some complex interactions and probabilistic algorithms. We are making some additions on internal nodes (at the parsing time), and some – on dynamic values calculation after SPIN processes are scheduled. This approach also allows verification engineers to extend the class of verifiable systems with the SPIN verifier. 26 / 27
  • 27. Learn more about Model Checking 27 / 27