Download presentation

Presentation is loading. Please wait.

Published byKasey Reynard Modified over 2 years ago

1
YES-NO machines Finite State Automata as language recognizers

2
A YES-NO machine 0123 a abb Designed to recognize a specific language final state A YES-NO machine has two kinds of states—”final” and “non-final” states. If, after the whole input string has been fed in, (i) the machine is in one of the final states, its “output” is a YES (the machine has accepted the string) (ii) the machine is in one of the non-final states, its “output” is a NO (the machine has rejected the string) The set of strings accepted by a YES-NO machine is the language recognized by it.

3
Example of a YES-NO machine 2 b a a b 1 4 a b b a 3 L = {strings of a’s and b’s—starting with ‘a’, ending with ‘b’} final state YES-NO machine recognizing L expecting ‘a’ expecting ‘b’ trapped!

4
The two “laws” of YES-NO machines 1. A YES-NO machine accepts no string that is “outside the set” (i.e., strings that don’t belong to L, the language recognized by the machine ). 2. A YES-NO machine accepts ALL strings that are “inside the set” (i.e., strings that belong to L).

5
Any computing problem can be seen as a “language recognition” problem! Even problems that seem remotely connected to language recognition such as adding two numbers, for instance, can be posed as language recognition problems. Recognizing languages : What has it to do with computing ?

6
Definitions of technical terms Alphabet ( Σ) A finite set of symbols. e.g. {a, b, c … z} (the English alphabet) {0, 1} (binary alphabet used in computer “machine language”) { —,. } (“dashes” and “dots”: the Morse code alphabet) Rudiments of formal languages

7
e.g. cat, rat, automata (words/strings over the English alphabet) String (over an alphabet) A finite sequence of symbols from the alphabet. Length of a string w (denoted as | w | ) Number of symbols in the string. Note: ε is known as the empty string whose length is ZERO. Definitions of technical terms Rudiments of formal languages

8
Concatenation of strings x and y Appending y to the end of x. Concatenating a string x to itself: xx… x ( k times) is often written as x k. Let x = x 1 x 2 … x m ; y = y 1 y 2 … y n x 1 x 2 … x m y 1 y 2 … y n represents the concatenation of x and y. Definitions of technical terms Rudiments of formal languages

9
More formally, Σ* = {Strings (over Σ ) of length 0} U {Strings of length 1} U {Strings of length 2} … = Σ 0 U Σ 1 U Σ 2 …. Note: Let Σ = {a, b} Σ 2 = Σ Σ = {aa, ab, ba, bb} Σ 0 = { ε } Kleene Closure (denoted by Σ*) Informally, it is the (infinite) set of all strings one can construct with Σ, the alphabet. e.g. Let Σ = {a, b} Σ* = { ε, a, b, aa, bb, ab, ba, aaa, … } Definitions of technical terms Rudiments of formal languages

10
Language L (over Σ) A subset of Σ*. (A language can either be finite or infinite.) e.g. Let Σ = {a, b} L 1 = {a, aa, ab, aaa, aab, aba, abb, …} L 1 represents the language, “strings that start with a ” Definitions of technical terms Rudiments of formal languages Complement of a language L (denoted as L ’) Contains strings in Σ* that are not in L. L ’ = Σ* — L e.g. Let Σ = {a, b} L = {a, aa, ab, aaa, aab, aba, abb, …} (“strings that start with a ”) Then, L’ represents the language “strings that don’t start with a ”: { ε, b, bb, ba, …}

11
Deterministic Finite State Automaton (DFA) Definitions of technical terms Rudiments of formal languages A 5-tuple ( Q, Σ, δ, s, F ) finite set of states input alphabet transition function δ: Q x Σ Q start state s є Q set of states Q (includes s and F ) δ: Q x Σ Q string w over Σ set of final states U FQ x 123123 Q abab Σ 123123 Q δ : 1 ? ? a b (earlier, we had referred to a DFA as a “YES-NO machine”.)

12
b a b 2 a 1 A typical DFA Rudiments of formal languages Σ = {a, b} Consider L = { x a y | x, y є Σ* } (strings that have an ‘a’ “somewhere”) Σ = {a, b} Q = {1, 2} F = {2} s = 1 Inputs abab 1212 2121 2 δ is given by a Transition table DFA that recognizes L

13
If after inputting a string, the DFA is in one of the final states F, it is said to accept the input string; otherwise, it is said to it is said to reject the input string. The set of strings accepted by a DFA is the language recognized by it. Definitions of technical terms Rudiments of formal languages

Similar presentations

© 2017 SlidePlayer.com Inc.

All rights reserved.

Ads by Google