Download presentation

Presentation is loading. Please wait.

Published byThalia Nix Modified over 2 years ago

1
CS 3240: Languages and Computation Introducing Regular Languages: Deterministic Finite Automata and Regular Expressions

2
Automata Finite Automata model many design and analysis tasks, e.g. Lexical analyzer in a compiler Digital cicuit design Keywork searching in texts or on the web. Software for verifying finite state systems, such as communication protocols. Your ATM, vendig machine, Etc McCulloch&Pitts, Rabin&Scott, Moore, Huffman

3

4

5

6

7
Finite State Machine and Finite Automata

8
Deterministic Finite Automata A simplest model for computing Deterministic: Machine is in a state. Upon receipt of a symbol will go to a unique state. Finite: Have a finite number of states Automata: (pl. of automaton) Self-operating machine DFA: finite-state machine without ambiguity

9
DFA and Strings DFA can recognize strings String is input If DFA ends at accept state, string is recognized A language is called a regular language if some finite automaton recognizes it Let us look at a few example before giving formal mathematical definition

10
DFA Examples Accept all strings that end in 1 Note: The alphabet for this example is {0, 1}. Each state has a transition for every symbol in the alphabet accept state transition start state

11
DFA Examples Accept strings of 'a's and 'b's that begin and end with same symbol a a a a a b b b b b

12
DFA Examples 2 Keep running count of total of symbols read in mod 3. Accept on Start

13
DFA Examples Strings with an odd number of ones. Even Odd

14
DFA Examples Strings containing the substring 001 '001' '0''00' 0 1 0,1

15
Formal Definition of DFA A DFA consists of: Alphabet A set of states Q A transition function δ : Q Q One start state q 0 One or more accepting states F Q Language accepted by a DFA is the set of strings such that DFA ends at an accepting state Each string is c 1 c 2 …c n with c i States are q i = δ(q i-1,c i ) for i=1…n q n is an accepting state

16
Can DFA's be designed to accept any string? No!

17
Examples Design a DFA to recognize strings that start out with k zeros followed by k ones. Impossible Design a DFA to recognize strings with an equal number of ones and zeros. Impossible Design a DFA to recognize strings with an equal number of strings "01" and "10". Possible!

18
Actually the third one is regular! DFA to recognize strings with an equal number of strings "01" and "10"

19
DFA More examples

20
A,B are the input into which the marble is dropped. The x-levers cause fall either to left or right, but lever reverses upon a marble passing Accept if marble exits through D

21
Non-Deterministic Finite Automata

22
NFA and -NFA Nondeterministic Finite Automata Same input may produce multiple paths Allows transition with an empty string or transition from one state to different states given a character q1q1 q2q2 empty string transition q1q1 q2q2 1 q3q3 1 nondeterministic transition

23

24

Similar presentations

© 2017 SlidePlayer.com Inc.

All rights reserved.

Ads by Google