Lovely Professional University TERM PAPERCSE – 526 Software Testing and Qality Assran!e To"i!# Co$"arison of varios %inite state Ma!&ines for testing "r"oses for a given in"t ' S($itted )y# *a$e# Ro&it Roll *o# A+5 Reg *o# ++,,,556 S($itted To# Mr' Sd&ansPra-as& Tiwari
16
Embed
Term Paper on Different Types of Finite State Machines - Rohit Ahlawat
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
8/13/2019 Term Paper on Different Types of Finite State Machines - Rohit Ahlawat
T&e si$"lest ty"e of !o$"ting $a!&ine t&at is wort& !onsidering is !alled a1finite state $a!&ine' As it &a""ens3 t&e finite state $a!&ine is also a sefl a""roa!& to $any
"ro(le$s in software ar!&ite!tre3 only in t&is !ase yo dont (ild one yo si$late it'
Essentially a finite state $a!&ine !onsists of a n$(er of states – finite natrally4 &en a
sy$(ol3 a !&ara!ter fro$ so$e al"&a(et say3 is in"t to t&e $a!&ine it !&anges state in s!& a
way t&at t&e ne/t state de"ends only on t&e !rrent state and t&e in"t sy$(ol'
*oti!e t&at t&is is $ore so"&isti!ated t&an yo $ig&t t&in- (e!ase in"tting t&e sa$e sy$(ol
doesnt always "rod!e t&e sa$e (e&avior or reslt (e!ase of t&e !&ange of state'
• T&e new state de"ends on t&e old state and t&e in"t'
&at t&is $eans t&at t&e entire &istory of t&e $a!&ine is s$$aried in its !rrent state' All t&at
$atters is t&e state t&at it is in and not &ow it rea!&ed t&is state' )efore yo write off t&e finite
state $a!&ine as so fee(le as to (e not wort& !onsidering as a $odel of !o$"tation it is wort& "ointing ot t&at as yo !an &ave as $any states as yo !are to invent t&e $a!&ine !an re!ord
ar(itrarily long &istories' All yo need is a state for ea!& of t&e "ossi(le "ast &istories and t&en
t&e state t&at yo find t&e $a!&ine in is an indi!ation of not only its !rrent state (t &ow it
arrived in t&at state')e!ase a finite state $a!&ine !an re"resent any &istory and a rea!tion3 (y regarding t&e !&ange
of state as a res"onse to t&e &istory3 it &as (een arged t&at it is a sffi!ient $odel of &$an (e&avior i'e' &$ans are finite state $a!&ines'
.f yo -now so$e "ro(a(ility t&eory yo will re!ognie a !onne!tion (etween finite state$a!&ines and Mar-ov !&ains' A Mar-ov !&ain s$s " t&e "ast &istory in ter$s of t&e !rrent
state and t&e "ro(a(ility of transition to t&e ne/t state only de"ends on t&e !rrent state' T&e
Mar-ov !&ain is a sort of "ro(a(ilisti! version of t&e finite state $a!&ine
8/13/2019 Term Paper on Different Types of Finite State Machines - Rohit Ahlawat
• D is defined (y t&e following state transition ta(le#
table for DFA :
$ %
S % 2 +
S & + 2
Modes of !FA:
A 9%A re"resenting a reglar langage !an (e sed eit&er in
Accepting mode:
.n t&e a!!e"t $ode an in"t string is "rovided w&i!& t&e ato$aton !an read
in left to rig&t3 one sy$(ol at a ti$e' T&e !o$"tation (egins at t&e start state and
"ro!eeds (y reading t&e first sy$(ol fro$ t&e in"t string and following t&e state
transition !orres"onding to t&at sy$(ol' T&e syste$ !ontines reading sy$(ols and
following transitions ntil t&ere are no $ore sy$(ols in t&e in"t3 w&i!& $ar-s t&e end
of t&e !o$"tation' .f after all in"t sy$(ols &ave (een "ro!essed t&e syste$ is in an
a!!e"t state t&en we -now t&at t&e in"t string was indeed "art of t&e langage3 and it is
said to (e a!!e"ted3 ot&erwise it is not "art of t&e langage and it is not a!!e"ted'
'enerating mode:
.t is si$ilar e/!e"t t&at rat&er t&an validating an in"t string its goal is to
"rod!e a list of all t&e strings in t&e langage' .nstead of following a single transition
ot of ea!& state3 it follows all of t&e$' .n "ra!ti!e t&is !an (e a!!o$"lis&ed (y $assive "arallelis$ <&aving t&e "rogra$ (ran!& into two or $ore "ro!esses ea!& ti$e it is fa!ed
wit& a de!ision= or t&rog& re!rsion' As (efore3 t&e !o$"tation (egins at t&e start state
and t&en "ro!eeds to follow ea!& availa(le transition3 -ee"ing tra!- of w&i!& (ran!&es it
too-' Every ti$e t&e ato$aton finds itself in an a!!e"t state it -nows t&at t&e se?en!e
of (ran!&es it too- for$s a valid string in t&e langage and it adds t&at string to t&e list
t&at it is generating' .f t&e langage t&is ato$aton des!ri(es is infinite <i'e' !ontains an
s"a!e to solve3 !annot (e re!ognied (y a 9%A' T&e !lassi!al e/a$"le of a si$"ly des!ri(ed
langage t&at no 9%A !an re!ognie is (ra!-et langage3 i'e'3 langage t&at !onsists of "ro"erly
"aired (ra!-ets s!& as word J<<=<==J' *o 9%A !an re!ognie t&e (ra!-et langage (e!ase t&ere
is no li$it to re!rsion3 i'e'3 one !an always e$(ed anot&er "air of (ra!-ets inside' .t wold
re?ire an infinite a$ont of states to re!ognie'
*on-!eterministic Finite Automata "*!FA#:
.n ato$ata t&eory3 a nondeter$inisti! finite ato$aton <*9%A=3 or nondeter$inisti! finite state
$a!&ine3 is a finite state $a!&ine t&at
9oes not re?ire in"t sy$(ols for state transitions
.s !a"a(le of transitioning to ero or two or $ore states for a given start state and in"t
sy$(ol'
T&is distingis&es it fro$ a deter$inisti! finite ato$aton <9%A=3 in w&i!& all transitions areni?ely deter$ined and in w&i!& an in"t sy$(ol is re?ired for all state transitions' Alt&og&
*9%A and 9%A &ave distin!t definitions3 all *9%As !an (e translated to e?ivalent 9%As
sing t&e s(set !onstr!tion algorit&$3 i'e'3 !onstr!ted 9%As and t&eir !orres"onding *9%As
Sin!e *9%As are e?ivalent to nondeter$inisti! finite ato$aton wit& 0$oves<*9%A0=3 t&e
a(ove !losres are "roved sing !losre "ro"erties of *9%A0' T&e a(ove !losre "ro"erties
i$"ly t&at *9%As only re!ognie reglar langages'
roperties of *!FA :
T&e $a!&ine starts in t&e s"e!ified initial state and reads in a string of sy$(ols fro$
its al"&a(et' T&e ato$aton ses t&e state transition fn!tion N to deter$ine t&e ne/t state sing
t&e !rrent state3 and t&e sy$(ol ;st read or t&e e$"ty string' 8owever3 Jt&e ne/t state of an
*9%A de"ends not only on t&e !rrent in"t event3 (t also on an ar(itrary n$(er of
s(se?ent in"t events' Until t&ese s(se?ent events o!!r it is not "ossi(le to deter$ine
w&i!& state t&e $a!&ine is inJ' .f3 w&en t&e ato$aton &as finis&ed reading3 it is in an a!!e"ting
state3 t&e *9%A is said to a!!e"t t&e string3 ot&erwise it is said to re;e!t t&e string'
T&e set of all strings a!!e"ted (y an *9%A is t&e langage t&e *9%A a!!e"ts' T&is langage is
a reglar langage'
%or every *9%A a deter$inisti! finite ato$aton <9%A= !an (e fond t&at a!!e"ts t&e sa$e
langage' T&erefore it is "ossi(le to !onvert an e/isting *9%A into a 9%A for t&e "r"ose of
i$"le$enting a <"er&a"s= si$"ler $a!&ine' T&is !an (e "erfor$ed sing t&e "ower set
!onstr!tion3 w&i!& $ay lead to an e/"onential rise in t&e n$(er of ne!essary states' A for$al
"roof of t&e "ower set !onstr!tion is given &ere.
Implementation of *!FA :
T&ere are $any ways to i$"le$ent a *9%A#
• Convert to t&e e?ivalent 9%A' .n so$e !ases t&is $ay !ase e/"onential (low" in t&e
sie of t&e ato$aton and t&s a/iliary s"a!e "ro"ortional to t&e n$(er of states in t&e *9%A <as storage of t&e state vale re?ires at $ost one (it for every state in t&e *9%A=
• ee" a set data str!tre of all states w&i!& t&e $a!&ine $ig&t !rrently (e in' :n t&e
!ons$"tion of t&e last in"t sy$(ol3 if one of t&ese states is a final state3 t&e $a!&ine
n$(er of states in t&e *9%AK if t&e set str!tre ses one (it "er *9%A state3 t&en t&is
soltion is e/a!tly e?ivalent to t&e a(ove'
• Create $lti"le !o"ies' %or ea!& n way de!ision3 t&e *9%A !reates " to !o"ies
of t&e $a!&ine' Ea!& will enter a se"arate state' .f3 "on !ons$ing t&e last in"t sy$(ol3 atleast one !o"y of t&e *9%A is in t&e a!!e"ting state3 t&e *9%A will a!!e"t' <T&is3 too3
re?ires linear storage wit& res"e!t to t&e n$(er of *9%A states3 as t&ere !an (e one
$a!&ine for every *9%A state'=
• E/"li!itly "ro"agate to-ens t&rog& t&e transition str!tre of t&e *9%A and $at!&
w&enever a to-en rea!&es t&e final state' T&is is so$eti$es sefl w&en t&e *9%A s&old