Académique Documents
Professionnel Documents
Culture Documents
SolutionstoMidterm1RegularLanguages
Problem1.(4points)Circletruestatementsamongthefollowing:
1. ThenumberofoutgoingarcsfromastateofaDFAisalwaysequalto ||. (True)
2. ThenumberofoutgoingarcsfromastateofaNFAisalwaysequalto||. (False)
3. Notallfinitelanguagesareregular. (False)
4. IfLisregularlanguage,thenLRisalsoaregularlanguage.(True)
2
5. IfLisregularlanguage,thenL maynotbearegularlanguage.(False)
6. Thefamilyofregularlanguagesisclosedunderintersection.(True)
7. Thegrammar { G = ({S}, {a}, S , {S Saaa aS a })} isnotregular.(True)
Problem2.(6points)
a) ConvertthefollowingNFAintoregularexpression:
Solution:Createanewinitialstateandanew,uniqueacceptingstate,neitherofwhichispartofaloop.
Removestate3:
Removestate2:
Removestate1:
CD5560FormalLanguages,AutomataandTheoryofComputation,MlardalenUniversitySchoolofInnovation,DesignandEngineering,04022010
b)LetMbethefollowingDFA.
MinimizeMbysetpartitioning.
Solution:
Initially,wehaveclasses={[1,3],[2,4,5,6]}.
Atstep1:
((1,a),[2,4,5,6])((3,a),[2,4,5,6]) Nosplittingrequiredhere.
((1,b),[2,4,5,6]) ((3,b),[2,4,5,6])
((2,a),[1,3]) ((4,a),[2,4,5,6])((5,a),[2,4,5,6])((6,a),[2,4,5,6])
((2,b),[2,4,5,6]) ((4,b),[1,3]) ((5,b),[2,4,5,6]) ((6,b),[1,3])
Thesesplitintothreegroups:[2],[4,6],and[5].Soclassesisnow{[1,3],[2],[4,6],[5]}.
Atstep2,wemustconsider[4,6]:
((4,a),[5]) ((6,a),[5])
((4,b),[1]) ((6,b),[1])
Nofurthersplittingisrequired.
Theminimalmachinehasthestates:{[1,3],[2],[4,6],[5]},withtransitionsasshownabove.
Problem3(4points)Regularornot?Ifregular,constructanautomaton,regularexpressionoragrammar.
Ifnotregular,usepumpinglemmaforregularlanguages.
a) Setofallstringsofform { 0 k 1l k + l = 8} overalphabet={0,1}.
Solution:
Regular.Asimplefinitestatemachinewithfinitenumberofstateswhichtakescareoftheorderofsymbolsandcountsthetotal
numberofcharacters.
b) Setofallstringsofform { 0 k 1l k l = 8} overalphabet={0,1}.
Solution:
Notregular.LanguageLconsistsofallstringsoftheform0*1*wherethenumberof0siseightmorethanthenumberof1s.Wecan
m+8
showthatLisnotregularbyapplyingpumpinglemma.Letw=0 1m.Since|xy|m,ymustequal0kforsomek>0.Wecanpump
youtonce,whichwillgeneratethestring0m+8k1m,whichisnotinLbecausethenumberof0sisislessthan8morethanthenumber
of1s.
References
LinzPeter,AnIntroductiontoFormalLanguagesandAutomata,Jones&Bartlett,2006
SallingLennart:Formellasprk,automaterochberkningar,2001
RichElaine,Automata,ComputabilityandComplexity:TheoryandApplications,PrenticeHall,2007