mcrl2 by [email protected], [email protected]
TRANSCRIPT
![Page 1: Mcrl2 by kashif.namal@gmail.com, adnanskyousafzai@gmail.com](https://reader033.vdocuments.pub/reader033/viewer/2022061608/5883c83c1a28abb7308b4c7f/html5/thumbnails/1.jpg)
MCRL2 By
Kashif [email protected]
Muhammad Yasir khan Adnan Saleem
[email protected] Ejaz khan
University of Camerino Italy
![Page 2: Mcrl2 by kashif.namal@gmail.com, adnanskyousafzai@gmail.com](https://reader033.vdocuments.pub/reader033/viewer/2022061608/5883c83c1a28abb7308b4c7f/html5/thumbnails/2.jpg)
Introduction to mCRL2 LPS , LTS,PBES Operators Vending Machine Odd counter Login Car park Phone book
Outlines
![Page 3: Mcrl2 by kashif.namal@gmail.com, adnanskyousafzai@gmail.com](https://reader033.vdocuments.pub/reader033/viewer/2022061608/5883c83c1a28abb7308b4c7f/html5/thumbnails/3.jpg)
Micro Common representation language 2 Specification Language Used for modeling , verification and
validation Based on Algebra of communicating process
include data and time. Process perform actions, can carry data as
parameter Every process has LTS contain all states
mCRL2
![Page 4: Mcrl2 by kashif.namal@gmail.com, adnanskyousafzai@gmail.com](https://reader033.vdocuments.pub/reader033/viewer/2022061608/5883c83c1a28abb7308b4c7f/html5/thumbnails/4.jpg)
mCRL2 Principle
![Page 5: Mcrl2 by kashif.namal@gmail.com, adnanskyousafzai@gmail.com](https://reader033.vdocuments.pub/reader033/viewer/2022061608/5883c83c1a28abb7308b4c7f/html5/thumbnails/5.jpg)
Flow Diagram
![Page 6: Mcrl2 by kashif.namal@gmail.com, adnanskyousafzai@gmail.com](https://reader033.vdocuments.pub/reader033/viewer/2022061608/5883c83c1a28abb7308b4c7f/html5/thumbnails/6.jpg)
Stored in binary Format LTS constructed from LPS LPS, symbolic representation of LTS to
describe behavior of system explicitly LPS can be printed in Human Readable
format LPS is speedy than LTS Statistical info Can be collected in LPSPP
LPS
![Page 7: Mcrl2 by kashif.namal@gmail.com, adnanskyousafzai@gmail.com](https://reader033.vdocuments.pub/reader033/viewer/2022061608/5883c83c1a28abb7308b4c7f/html5/thumbnails/7.jpg)
Generated from LPS It show the LPS as node link Diagram
(ltsgraph) LTSVIEW to reduce the complexity of
image(3D) DIAGRAPHICA reduce complexity to 2D LTSCONVERT smaller than Original LTS LTSCOMPARE check weather the two LTS are
behaviorally equal or not
LTS
![Page 8: Mcrl2 by kashif.namal@gmail.com, adnanskyousafzai@gmail.com](https://reader033.vdocuments.pub/reader033/viewer/2022061608/5883c83c1a28abb7308b4c7f/html5/thumbnails/8.jpg)
Parameterized Boolean Equation system Input needed for model checking, is a
formula expressing a desired property that the system should not violate (or satisfy)
Pbes stored in Binary format Pbespp stored in human readable format. BES genrated from PBES
PBES
![Page 9: Mcrl2 by kashif.namal@gmail.com, adnanskyousafzai@gmail.com](https://reader033.vdocuments.pub/reader033/viewer/2022061608/5883c83c1a28abb7308b4c7f/html5/thumbnails/9.jpg)
Sortdata type definition using keyword sort. Sorts are
non-empty, possibly infinite sets with data elements.
sort D; cons c, d : D; declares sort D in which all elements can be
denoted by either c or d. Now for Boolean sort B cons true, false : B;
Data Specification
![Page 10: Mcrl2 by kashif.namal@gmail.com, adnanskyousafzai@gmail.com](https://reader033.vdocuments.pub/reader033/viewer/2022061608/5883c83c1a28abb7308b4c7f/html5/thumbnails/10.jpg)
The sum operator allows to formulate the choice between a possibly infinite number of processes in a very concise way.
The process sum n: Nat . p(n) can be seen as a shorthand for p(0) + p(1) + p(2) + .... The use of the sum operator is often to indicate that some value must be read, i.e., the process wants to read either a 0 or a 1 or a 2,
sort Val = struct c2 | c5 | c10; act coin: Val; init sum v: Val . coin(v); act num: Nat; init sum v: Nat . num(2 * v);
Sum operator
![Page 11: Mcrl2 by kashif.namal@gmail.com, adnanskyousafzai@gmail.com](https://reader033.vdocuments.pub/reader033/viewer/2022061608/5883c83c1a28abb7308b4c7f/html5/thumbnails/11.jpg)
sort Val = struct c2 | c5 | c10; act coffee; coin, rej: Val; proc P = sum v: Val . coin(v) . ( (v != c10) -> rej(v) . P + (v == c10) ->
coffee . P ); init P;
Sum
![Page 12: Mcrl2 by kashif.namal@gmail.com, adnanskyousafzai@gmail.com](https://reader033.vdocuments.pub/reader033/viewer/2022061608/5883c83c1a28abb7308b4c7f/html5/thumbnails/12.jpg)
We can let data influence the course of events by adding conditions to the process
c -> p <> q implies if c then do process p else do process q
act tick, reset; proc Clock(n: Nat) = (n < 99) -> tick . Clock(n +
1) <> tick . Clock(0) + (n < 50) -> reset . Clock(0);
init Clock(0);
Condition
![Page 13: Mcrl2 by kashif.namal@gmail.com, adnanskyousafzai@gmail.com](https://reader033.vdocuments.pub/reader033/viewer/2022061608/5883c83c1a28abb7308b4c7f/html5/thumbnails/13.jpg)
comm({a|b -> c}, p) .. multi-actions are renamed to a single action... actions a and b must communicate to c in process p.
act a, b, c: Nat; proc P = a(1) || b(1); init comm({a|b->c}, P);
Communication
![Page 14: Mcrl2 by kashif.namal@gmail.com, adnanskyousafzai@gmail.com](https://reader033.vdocuments.pub/reader033/viewer/2022061608/5883c83c1a28abb7308b4c7f/html5/thumbnails/14.jpg)
Allow (allow(A, P)) removes all multi-actions from the
transition system that do not occur in A. Any states that have become unreachable will also be removed by mCRL2, as the resulting system is smaller and bisimilar.
allow({c}; p) only multi-actions consisting of a single c are allowed in p.
allow({c},comm({send|read- > c}, send||read))
Allow
![Page 15: Mcrl2 by kashif.namal@gmail.com, adnanskyousafzai@gmail.com](https://reader033.vdocuments.pub/reader033/viewer/2022061608/5883c83c1a28abb7308b4c7f/html5/thumbnails/15.jpg)
After inserting a coin of 10 cents, the user can push the button for an apple. An apple will then be put in the drawer of the machine.
act ins10, optA, acc10, putA, coin, ready ; proc User = ins10 . optA . User ; Mach = acc10 . putA . Mach ; init allow( { coin, ready }, comm( { ins10|acc10 -> coin, optA|putA -
> ready }, User || Mach ) ) ;
Simple Vending Machine
![Page 16: Mcrl2 by kashif.namal@gmail.com, adnanskyousafzai@gmail.com](https://reader033.vdocuments.pub/reader033/viewer/2022061608/5883c83c1a28abb7308b4c7f/html5/thumbnails/16.jpg)
sort Value= struct even | odd; act r1,r2:Nat; s1,s2,s3 : Value; proc P=sum n:Nat.(n<5)->r1(n).s1(if(n mod 2 == 0, even, odd)).P; Q(n:Nat)=sum v:Value.s2(v).((v==even)->tau +(v==odd)->r2(n)).Q(n=min(5,n+1)); init allow ({r1,r2}, comm ({s1|s2->s3}, P||Q(0)));
Odd counterFilterP
Counter Q
r1 r2s1 s2s3
![Page 17: Mcrl2 by kashif.namal@gmail.com, adnanskyousafzai@gmail.com](https://reader033.vdocuments.pub/reader033/viewer/2022061608/5883c83c1a28abb7308b4c7f/html5/thumbnails/17.jpg)
◦ no deadlock?[true*]<true>true
◦ an input (r1) is always followed by an output (s3)?[true*.r1.(!s3)*]<(!s3)*.s3>true
Formula
![Page 18: Mcrl2 by kashif.namal@gmail.com, adnanskyousafzai@gmail.com](https://reader033.vdocuments.pub/reader033/viewer/2022061608/5883c83c1a28abb7308b4c7f/html5/thumbnails/18.jpg)
User first check the system if the system working the user enter password and username, if it is already in the database the user login to the system if not available then the user first go for signup and insert all the data.
Login system
![Page 19: Mcrl2 by kashif.namal@gmail.com, adnanskyousafzai@gmail.com](https://reader033.vdocuments.pub/reader033/viewer/2022061608/5883c83c1a28abb7308b4c7f/html5/thumbnails/19.jpg)
[true*]<true>true
password needed (1): [loginpage] < true* . enterpassword > true (that is: the first ‘loginpage’ can be followed by ‘enterpassword’)
password needed (2): [true* . loginpage] < true* . enterpassword > true (that is: every ‘loginpage’ can be followed by ‘enterpassword’)
Formula
![Page 20: Mcrl2 by kashif.namal@gmail.com, adnanskyousafzai@gmail.com](https://reader033.vdocuments.pub/reader033/viewer/2022061608/5883c83c1a28abb7308b4c7f/html5/thumbnails/20.jpg)
mCRL2 specication before linearisation: act order, receive, keep, refund; return; proc Start = order .Ordered; Ordered = receive. Received +
refund .Start; Received = return .Ordered + keep; init Start;
Linearization
![Page 21: Mcrl2 by kashif.namal@gmail.com, adnanskyousafzai@gmail.com](https://reader033.vdocuments.pub/reader033/viewer/2022061608/5883c83c1a28abb7308b4c7f/html5/thumbnails/21.jpg)
sort State = struct start | ordered | received; act order, receive, keep, refund, return;proc P(s : State) = (s =start) -> order . P(ordered)+ (s =ordered) -> receive . P(received)+ (s = ordered) ->refund . P(start)+ (s =received) -> return . P(ordered)+ (s = received) -> keep;init P(start);
After linearization
![Page 22: Mcrl2 by kashif.namal@gmail.com, adnanskyousafzai@gmail.com](https://reader033.vdocuments.pub/reader033/viewer/2022061608/5883c83c1a28abb7308b4c7f/html5/thumbnails/22.jpg)
Counter
![Page 23: Mcrl2 by kashif.namal@gmail.com, adnanskyousafzai@gmail.com](https://reader033.vdocuments.pub/reader033/viewer/2022061608/5883c83c1a28abb7308b4c7f/html5/thumbnails/23.jpg)
act enter_car,
enter_cash,recive_recipt,car_park,open_gate,acc_cash,give_recipt, entercar,cash,recipt,park,acc_gate;proc User = enter_car . enter_cash. recive_recipt . car_park . User; Machine =acc_gate . acc_cash . give_recipt. open_gate . Machine; init allow( {entercar,cash,recipt,park },comm( {enter_car|acc_gate -> entercar, enter_cash|acc_cash->cash,
recive_recipt|give_recipt->recipt, car_park|open_gate->park }, User || Machine
) ) ;
Car Park
![Page 24: Mcrl2 by kashif.namal@gmail.com, adnanskyousafzai@gmail.com](https://reader033.vdocuments.pub/reader033/viewer/2022061608/5883c83c1a28abb7308b4c7f/html5/thumbnails/24.jpg)
sort Name = struct n0 | n1 ; PhoneNumber = struct p0 | p1 ; PhoneBook = Name -> PhoneNumber; map book: Name -> PhoneNumber; var n: Name; eqn book(n) = p0; act addPhone: Name # PhoneNumber; delPhone: Name; findPhone: Name; proc PhoneDir(b: PhoneBook) = sum n: Name, p: PhoneNumber . (p != p0) -> addPhone(n, p) . PhoneDir(b[n->p]) + sum n: Name . findPhone(n) . PhoneDir() + sum n: Name . delPhone(n) . PhoneDir(b[n->p0]); init PhoneDir(book);
Phone Book
![Page 25: Mcrl2 by kashif.namal@gmail.com, adnanskyousafzai@gmail.com](https://reader033.vdocuments.pub/reader033/viewer/2022061608/5883c83c1a28abb7308b4c7f/html5/thumbnails/25.jpg)
Any Question