Download presentation
Presentation is loading. Please wait.
1
COMMONWEALTH OF AUSTRALIA Copyright Regulations 1969 WARNING This material has been reproduced and communicated to you by or on behalf of Monash University pursuant to Part VB of the Copyright Act 1968 (the Act). The material in this communication may be subject to copyright under the Act. Any further reproduction or communication of this material by you may be the subject of copyright protection under the Act. Do not remove this notice.
2
Finite Automata CSE2303 Formal Methods I Lecture 3
3
Overview Definition How they are used to define languages Representations Complement Languages Comparison with Regular Expressions
4
Finite Automaton Sometimes known as a Deterministic Finite Automaton. Used for determining whether a word does or does not belong to a Regular Language. Used for defining a Regular Language. Used in Lexical Analysers.
5
Notation Final State Start State Transitions b a -+ b a a, b
6
Alternative Notation Final State Start State b b a a a, b
7
Begin in the Start State Move along the edge with this label Is there INPUT? YesRead next letter in the INPUT Are you in a Final State? Yes Accept String No Reject String No
8
A Finite Automaton is a collection of: A finite set of states –One called the Start State –Some (maybe none) called Final States An alphabet of possible input letters A finite set of transitions –That tell for each state and each letter in the alphabet which state to go to next. Note: There is an unique transition from any state for each letter in the alphabet.
9
1-3+ b b a a a, b Representations 2
10
24+ a 35+ a 1- a a a b b b b b
11
Special Cases All words accepted. Only the empty word accepted. A single word accepted.
12
Complements If L is a language over an alphabet, then its complement L´ is set of strings of letters from the alphabet that are not words in L.
13
EVEN-EVEN’ EVEN-EVEN is the set of strings that contain an even number of a ’s and an even number of b ’s. E.g. aa bb aaaa aabb abab abba baab EVEN-EVEN´ is the set of strings which contain an odd number of a ’s or an odd number of b ’s. E.g. a b ab ba aaa aab aba abb baa …
14
b a EVEN-EVEN b b b aa a
15
Complement FA Suppose some FA accepts the language L Change all the final states in this FA to non- final states, and all the non-final states to final states. This new FA now accepts all the strings not accepted by the original FA (ie. all the words in L´), and rejects all the words that the original accepted (i.e. the words in L). So the new FA accepts L´.
16
-+ b a EVEN-EVEN’ ++ b b b aa a
17
Comparison with Regular Expressions It is easier to write down a regular expression that defines language than to design a FA to accept this language. It is easier to check whether a given string is accepted by a FA than it is to see whether it matches a regular expression. It is easier to find complements using a FA, than by using a regular expression.
18
Revision Finite Automata –Definition. How to use them. –How to construct a FA to accept a language. Complement Languages –What they are. Designing FA to accept them. Preparation Read Chapter 6 in the Text Book
Similar presentations
© 2024 SlidePlayer.com Inc.
All rights reserved.