90 likes | 218 Views
This document presents formal methodologies for behavior specification in systems as outlined by Dr. Vered Gafni. It covers system signatures, trace behaviors, and the formalism for specifying assertions, which include state constraints (safety) and temporal constraints (liveness). Additionally, it discusses regular expressions and ω-regular expressions in detail, along with their properties and example applications, focusing on their role in specifying behaviors of systems such as in railroad crossing scenarios. The content serves as a comprehensive guide for understanding formal specification methods in system design.
E N D
Formalisms for Behaviors Specification Dr. Vered Gafni
System Behaviors • System - (2E)-- E system signature (finite set of events) • Trace (behavior) - = 0 1 2… where i2E • Assertion – A(2E)(subset of system behaviors) Specification formalism - means to specify assertions (subsets of system behaviors). • Two types of assertions: - state constraints (safety) • e.g., The gate is closed a.l.a. a train is within the crossing • - temporal constraints (liveness). • e.g., Every train that entersthe crossing shall exit eventually Dr. VeredGafni
Specification Formalisms Dr. Vered Gafni
Regular expressions • a set of symbols, • * is the set of finite words over (including - empty word) • L*– a language over • the regular expressions over are: • , , p for p • For r,s regular expressions: rs (concatenation), r+s (selection), r*(0 or more finite repetition ) Notation: r+=rr*, rk=r…r– k times • Semantics: L()=, L()={}, L(p)={p}, L(rs)=L(r)L(s), L(r+s)=L(r)L(s), L(r*)=L(r)* Regular languages (RL) – those represented by regular expressions RL are closed under union, concatenation, Kleene star, intersection, complementation. Dr. VeredGafni
Regular expressions properties • RL are closed under union, concatenation, Kleene star, intersection, complementation. • Notations: =2E; pE, [p]= +( | p), [~p]=+( | p) • Examples: E={send, ack} • [send][~{ack,send}]*[ack] • ([send][~{ack,send}]*[ack])* • [~send]* + ([~send]*[send][~{ack,send}]*[ack])* • ([~send]* + ([send][~{ack,send}]*[ack]))* • ([~send]*([send][~{ack,send}]*[ack])*)* A RL may have several representations by different RE Dr. Vered Gafni
-regular expressions - Basic Representation Formalism Noteis not an extension of * To ensure enumerable word • - the set of infinite sequences (words) over • L– an -language over • For R*, , • R = { r| rR, } • R= { r1r2…| iN, riR/{} } • regular expressions - terms of the form: i=1..nRiSi where Ri, Si are regular expression • Semantics: L(i=1..nRiSi)= i=1..nL(Ri)L(Si) S is regular (={}S). • Example: ([~send]* + ([send][~{ack,send}]*[ack])) Dr. Vered Gafni
-regular expressions/languages -regular expressionsG1, G2are equivalent ifL(G1)=L(G2) regular languages are closed under: • Union • Intersection • Complementation Dr. Vered Gafni
Examples of -regular expressions any that contains p ({p}+{p,q}) Given system signature E=p,q E, = 2E, • p occurs at every time instant [p] • p occurs infinitely often (*[p]) • Every time p occurs q occurs as well ([~p]*[p,q])*[~p] ([~p]*[p,q]) • Every p is (strict) followed by q with no p ([~p]*[p][~q]*[q/p]) ([~p]*[p][~q]*[q/p])*[~p] any word over any that does not contain p any that contain q but not p Dr. Vered Gafni
Railroad crossing assertions Min. delay of 40 seconds between successive trains. ([~Tin]*[Tin][~Tin]40)*[~Tin] ([~Tin]*[Tin][~Tin]40) No more than one train in XR at a time ([~Tin]*[Tin][~{Tin,Tout}]*[Tout])*[~Tin] ([~Tin]*[Tin][~{Tin,Tout}]*[Tout]) ([~Tin]*[Tin] [~{Tin,Tout}] Gate closed as long as a train is in XR. ([~Tin]*[{Tin,Closed}][Closed/Tout}]*[{Closed,Tout}])*[~Tin] ([~Tin]*[{Tin,Closed}][Closed/Tout}]*[{Closed,Tout}]) ([~Tin]*[{Tin,Closed}] [Closed/{Tin,Tout}] No exit