230 likes | 491 Views
2. Goals. Designing FAModify existing onesFrom scratchCombine existing ones <<<Regular languagesRegular operationsUnionConcatenationStarClosure property. 3. Finite Automata . We see finite automata as computing devices for recognizing languagesThe main question when we study finite automat
E N D
1. 1 Formal Methods in Computer ScienceCS1502Design of Finite Automata Patchrawat Uthaisombut
University of Pittsburgh
2. 2 Goals Designing FA
Modify existing ones
From scratch
Combine existing ones <<<
Regular languages
Regular operations
Union
Concatenation
Star
Closure property
3. 3 Finite Automata We see finite automata as computing devices for recognizing languages
The main question when we study finite automata is
What are the capabilities and limitations of finite automata in recognizing languages?
4. 4 Languages and FAs Given a language L, is it recognized by some FA?
Is ?x (Language(x) ? ?y (FA(y) /\ L(y) = x)) a logical truth? (L(y) = language of machine y)
{ 0, 00, 000, }
{ w | w = wR }
{ w | w has even number of 1s and odd number of 0s }
5. 5 Regular Languages
6. 6 Regular Languages A language is called a regular language if some finite automaton recognizes it.
?x (Regular(x) ? ?y (FA(y) /\ L(y) = x))
Given a language L, is it regular?
We will come back to this question as we learn more about FAs.
7. 7 Designing FA Combination of the following strategies
From scratch
Modify existing ones
Combine existing ones
8. 8 Designing FA from scratch Like other design problems, it requires practice to develop the skills.
Some helpful guidelines
Try to identify what needs to be remember as a string is processed.
Identify short strings in the language.
Create an (incomplete) FA accepting the shortest string. (No loops)
Modify the machine to also accept the second shortest string and so on. (Try adding loops)
Make sure the machine accepts those and only those strings in the language.
9. 9 Exercise: Design FA from scratch Assume that the alphabet is {0,1}.
L1 = all strings that end with a 1.
L2 = all strings that begin with a 0 and end with a 1.
L3 = all strings that contains 101 as substring.
L4 = all strings that end with 10.
L5 = all strings that end with 011.
10. 10 Creating new languages from existing ones Languages are sets of strings.
Many operations on sets are applicable on languages.
Union, intersection, complement, difference
Power set?
11. 11 Regular Operations
12. 12 Regular Operations Union
A ? B = { x | x ? A or x ? B }
{ a, ab, abb } ? { b, ab } = { a, b, ab, abb }
Concatenation
A ? B = { xy | x ? A and x ? B }
{ a, aa } ? { ab, b } = { aab, ab, aaab }
Star
A* = { x1x2xk | k ? 0 and xi ? A }
{ a, bb }* = { ?, a, bb, aa, abb, bba, bbbb, }
13. 13 Exercises { } ? { ab, b } = ?
{ ? } ? { ab, b } = ?
{ ? } ? { ab, b } = ?
{ } ? { ab, b } = ?
Define Ak = A ? A ? ? A (k copies)
Can you write A* in terms of Ak ?
Suppose ? = { a, b }. Can you describe ?* ?
If L is a language over alphabet ?, what is the relationship between L and ?*?
? ? L for any language L. True or False?
? ? L* for any language L. True or False?
L* contains infinitely many strings for any language L. True or False?
14. 14 Questions Suppose A and B are regular languages. Is A ? B regular? Recall: A language is regular if some FA recognizes it. Is A ? B regular? Is A* regular? Is (A ? B ? C*) ? D regular given that A,B,C,D are regular?