SlideShare uma empresa Scribd logo
1 de 37
Introduction to Finite
Automata
Languages
Deterministic Finite Automata
Representations of Automata
1
Alphabets
An alphabet is any finite set of
symbols.
Examples: ASCII, Unicode, {0,1} (binary
alphabet ), {a,b,c}.

2
Strings
The set of strings over an alphabet Σ is
the set of lists, each element of which is
a member of Σ.
Strings shown with no commas, e.g., abc.

Σ* denotes this set of strings.
ε stands for the empty string (string of
length 0).
3
Example: Strings
{0,1}* = {ε, 0, 1, 00, 01, 10, 11, 000,
001, . . . }
Subtlety: 0 as a string, 0 as a symbol
look the same.
Context determines the type.

4
Languages
A language is a subset of Σ* for some
alphabet Σ.
Example: The set of strings of 0’s and
1’s with no two consecutive 1’s.
L = {ε, 0, 1, 00, 01, 10, 000, 001, 010,
100, 101, 0000, 0001, 0010, 0100,
0101, 1000, 1001, 1010, . . . }
Hmm… 1 of length 0, 2 of length 1, 3, of length 2, 5 of length
3, 8 of length 4. I wonder how many of length 5?
5
Deterministic Finite Automata
A formalism for defining languages,
consisting of:
1.
2.
3.
4.

A finite set of states (Q, typically).
An input alphabet (Σ, typically).
A transition function (δ, typically).
A start state (q0, in Q, typically).

5. A set of final states (F ⊆ Q, typically).
“Final” and “accepting” are synonyms.
6
The Transition Function
Takes two arguments: a state and an
input symbol.
δ(q, a) = the state that the DFA goes to
when it is in state q and input a is
received.

7
Graph Representation of
DFA’s
Nodes = states.
Arcs represent transition function.
Arc from state p to state q labeled by all
those input symbols that have transitions
from p to q.

Arrow labeled “Start” to the start state.
Final states indicated by double circles.
8
Example: Graph of a DFA
Accepts all strings without two consecutive 1’s.
0
A

0,1
1

Start
Previous
string OK,
does not
end in 1.

B

1

C

0
Consecutive
Previous
String OK, 1’s have
ends in a been seen.
single 1.
9
Alternative Representation:
Transition Table
Final states
starred
Arrow for
start state

* A
* B
C

0

1

A
A
C

B
C
C

Columns =
input symbols

Rows = states

10
Extended Transition Function
We describe the effect of a string of
inputs on a DFA by extending δ to a
state and a string.
Induction on length of string.
Basis: δ(q, ε) = q
Induction: δ(q,wa) = δ(δ(q,w),a)
w is a string; a is an input symbol.
11
Extended δ: Intuition
Convention:
… w, x, y, x are strings.
a, b, c,… are single symbols.

Extended δ is computed for state q and
inputs a1a2…an by following a path in the
transition graph, starting at q and
selecting the arcs with labels a1, a2,…,an
in turn.
12
Example: Extended Delta
A
B
C

0
A
A
C

1
B
C
C

δ(B,011) = δ(δ(B,01),1) = δ(δ(δ(B,0),1),1) =
δ(δ(A,1),1) = δ(B,1) = C
13
Delta-hat
In book, the extended δ has a “hat” to
distinguish it from δ itself.
Not needed, because both agree when
the string is a single symbol.
˄
˄
δ(q, a) = δ(δ(q, ε), a) = δ(q, a)
Extended deltas
14
Language of a DFA
Automata of all kinds define languages.
If A is an automaton, L(A) is its
language.
For a DFA A, L(A) is the set of strings
labeling paths from the start state to a
final state.
Formally: L(A) = the set of strings w
such that δ(q0, w) is in F.
15
Example: String in a
Language
String 101 is in the language of the DFA below.
Start at A.
0
A
Start

0,1
1

B

1

C

0

16
Example: String in a
Language
String 101 is in the language of the DFA below.
Follow arc labeled 1.
0
A
Start

0,1
1

B

1

C

0

17
Example: String in a
Language
String 101 is in the language of the DFA below.
Then arc labeled 0 from current state B.
0
0,1
A
Start

1

B

1

C

0

18
Example: String in a
Language

String 101 is in the language of the DFA below.
Finally arc labeled 1 from current state A. Result
is an accepting state, so 101 is in the language.
0
0,1
A
Start

1

B

1

C

0

19
Example – Concluded
The language of our example DFA is:
{w | w is in {0,1}* and w does not have
two consecutive 1’s}
Such that…

These conditions
about w are true.

Read a set former as
“The set of strings w…
20
Proofs of Set Equivalence
Often, we need to prove that two
descriptions of sets are in fact the same
set.
Here, one set is “the language of this
DFA,” and the other is “the set of strings
of 0’s and 1’s with no consecutive 1’s.”

21
Proofs – (2)
In general, to prove S=T, we need to
prove two parts: S ⊆ T and T ⊆ S.
That is:
1. If w is in S, then w is in T.
2. If w is in T, then w is in S.

As an example, let S = the language
of our running DFA, and T = “no
consecutive 1’s.”
22
Part 1: S ⊆ T

0

A 1 B 1C

To prove: if w is accepted by
Start 0
then w has no consecutive 1’s.
Proof is an induction on length of w.
Important trick: Expand the inductive
hypothesis to be more detailed than you
need.

23

0,1
The Inductive Hypothesis
1. If δ(A, w) = A, then w has no
consecutive 1’s and does not end in 1.
2. If δ(A, w) = B, then w has no
consecutive 1’s and ends in a single 1.
Basis: |w| = 0; i.e., w = ε.
(1) holds since ε has no 1’s at all.
(2) holds vacuously, since δ(A, ε) is not B.
“length of”

Important concept:
If the “if” part of “if..then” is false,
the statement is true.

24
Inductive Step

0

A 1 B 1C

0,1

Start 0

Assume (1) and (2) are true for strings
shorter than w, where |w| is at least 1.
Because w is not empty, we can write w
= xa, where a is the last symbol of w,
and x is the string that precedes.
IH is true for x.

25
Inductive Step – (2)

0

A 1 B 1C

0,1

Start 0

Need to prove (1) and (2) for w = xa.
(1) for w is: If δ(A, w) = A, then w has no
consecutive 1’s and does not end in 1.
Since δ(A, w) = A, δ(A, x) must be A or B,
and a must be 0 (look at the DFA).
By the IH, x has no 11’s.
Thus, w has no 11’s and does not end in 1.
26
Inductive Step – (3)

0

A 1 B 1C

0,1

Start 0

Now, prove (2) for w = xa: If δ(A, w) = B,
then w has no 11’s and ends in 1.
Since δ(A, w) = B, δ(A, x) must be A, and
a must be 1 (look at the DFA).
By the IH, x has no 11’s and does not end
in 1.
Thus, w has no 11’s and ends in 1.
27
Part 2: T ⊆ S

X

Now, we must prove: if w has no 11’s,
then w is accepted by 0
0,1
A 1 B 1C
Y
Start 0

Contrapositive : If w is not accepted by
0

A 1 B 1C
Start 0

0,1

then w has 11.

Key idea: contrapositive
of “if X then Y” is the
equivalent statement
“if not Y then not X.”
28
Using the Contrapositive

0

A 1 B 1C

0,1

Start 0

Every w gets the DFA to exactly one
state.
Simple inductive proof based on:
• Every state has exactly one transition on 1, one
transition on 0.

The only way w is not accepted is if it
gets to C.
29
Using the Contrapositive
– (2)

0

A 1 B 1C

0,1

Start 0

The only way to get to C [formally:
δ(A,w) = C] is if w = x1y, x gets to B,
and y is the tail of w that follows what
gets to C for the first time.
If δ(A,x) = B then surely x = z1 for some
z.
Thus, w = z11y and has 11.
30
Regular Languages
A language L is regular if it is the
language accepted by some DFA.
Note: the DFA must accept only the strings
in L, no others.

Some languages are not regular.
Intuitively, regular languages “cannot
count” to arbitrarily high integers.
31
Example: A Nonregular Language
L1 = {0n1n | n ≥ 1}
Note: ai is conventional for i a’s.
Thus, 04 = 0000, e.g.

Read: “The set of strings consisting of n
0’s followed by n 1’s, such that n is at
least 1.
Thus, L1 = {01, 0011, 000111,…}
32
Another Example
L2 = {w | w in {(, )}* and w is balanced }
Note: alphabet consists of the parenthesis
symbols ’(’ and ’)’.
Balanced parens are those that can appear
in an arithmetic expression.
• E.g.: (), ()(), (()), (()()),…

33
But Many Languages are
Regular
Regular Languages can be described in
many ways, e.g., regular expressions.
They appear in many contexts and
have many useful properties.
Example: the strings that represent
floating point numbers in your favorite
language is a regular language.
34
Example: A Regular
Language
L3 = { w | w in {0,1}* and w, viewed as a
binary integer is divisible by 23}
The DFA:
23 states, named 0, 1,…,22.
Correspond to the 23 remainders of an
integer divided by 23.
Start and only final state is 0.
35
Transitions of the DFA for L3
If string w represents integer i, then
assume δ(0, w) = i%23.
Then w0 represents integer 2i, so we
want δ(i%23, 0) = (2i)%23.
Similarly: w1 represents 2i+1, so we
want δ(i%23, 1) = (2i+1)%23.
Example: δ(15,0) = 30%23 = 7; δ(11,1)
Key idea: design a DFA
= 23%23 = 0.

by figuring out what
each state needs to
remember about the 36
past.
Another Example
L4 = { w | w in {0,1}* and w, viewed as the
reverse of a binary integer is divisible
by 23}
Example: 01110100 is in L4, because its
reverse, 00101110 is 46 in binary.
Hard to construct the DFA.
But theorem says the reverse of a
regular language is also regular.
37

Mais conteúdo relacionado

Mais procurados

Lecture 1,2
Lecture 1,2Lecture 1,2
Lecture 1,2shah zeb
 
Finite Automata: Deterministic And Non-deterministic Finite Automaton (DFA)
Finite Automata: Deterministic And Non-deterministic Finite Automaton (DFA)Finite Automata: Deterministic And Non-deterministic Finite Automaton (DFA)
Finite Automata: Deterministic And Non-deterministic Finite Automaton (DFA)Mohammad Ilyas Malik
 
1.3.2 non deterministic finite automaton
1.3.2 non deterministic finite automaton1.3.2 non deterministic finite automaton
1.3.2 non deterministic finite automatonSampath Kumar S
 
Nondeterministic Finite Automata
Nondeterministic Finite AutomataNondeterministic Finite Automata
Nondeterministic Finite AutomataAdel Al-Ofairi
 
Equivalence and minimization of DFA
Equivalence and minimization of DFAEquivalence and minimization of DFA
Equivalence and minimization of DFABadrul Alam
 
Theory of Computation Grammar Concepts and Problems
Theory of Computation Grammar Concepts and ProblemsTheory of Computation Grammar Concepts and Problems
Theory of Computation Grammar Concepts and ProblemsRushabh2428
 
Context free grammars
Context free grammarsContext free grammars
Context free grammarsRonak Thakkar
 
Theory of Automata Lesson 02
Theory of Automata Lesson 02Theory of Automata Lesson 02
Theory of Automata Lesson 02hamzamughal39
 
Ch3 4 regular expression and grammar
Ch3 4 regular expression and grammarCh3 4 regular expression and grammar
Ch3 4 regular expression and grammarmeresie tesfay
 
Deterministic Finite Automata
Deterministic Finite AutomataDeterministic Finite Automata
Deterministic Finite AutomataShiraz316
 

Mais procurados (20)

Lecture 7
Lecture 7Lecture 7
Lecture 7
 
Lecture 1,2
Lecture 1,2Lecture 1,2
Lecture 1,2
 
Finite Automata: Deterministic And Non-deterministic Finite Automaton (DFA)
Finite Automata: Deterministic And Non-deterministic Finite Automaton (DFA)Finite Automata: Deterministic And Non-deterministic Finite Automaton (DFA)
Finite Automata: Deterministic And Non-deterministic Finite Automaton (DFA)
 
Turing machine-TOC
Turing machine-TOCTuring machine-TOC
Turing machine-TOC
 
1.3.2 non deterministic finite automaton
1.3.2 non deterministic finite automaton1.3.2 non deterministic finite automaton
1.3.2 non deterministic finite automaton
 
Theory of computation Lec3 dfa
Theory of computation Lec3 dfaTheory of computation Lec3 dfa
Theory of computation Lec3 dfa
 
Nondeterministic Finite Automata
Nondeterministic Finite AutomataNondeterministic Finite Automata
Nondeterministic Finite Automata
 
Equivalence and minimization of DFA
Equivalence and minimization of DFAEquivalence and minimization of DFA
Equivalence and minimization of DFA
 
pushdown automata
pushdown automatapushdown automata
pushdown automata
 
Finite automata
Finite automataFinite automata
Finite automata
 
Regular expressions
Regular expressionsRegular expressions
Regular expressions
 
push down automata
push down automatapush down automata
push down automata
 
Lecture 6
Lecture 6Lecture 6
Lecture 6
 
Theory of Computation Grammar Concepts and Problems
Theory of Computation Grammar Concepts and ProblemsTheory of Computation Grammar Concepts and Problems
Theory of Computation Grammar Concepts and Problems
 
Context free grammars
Context free grammarsContext free grammars
Context free grammars
 
Lecture 8
Lecture 8Lecture 8
Lecture 8
 
Theory of Automata Lesson 02
Theory of Automata Lesson 02Theory of Automata Lesson 02
Theory of Automata Lesson 02
 
Ch3 4 regular expression and grammar
Ch3 4 regular expression and grammarCh3 4 regular expression and grammar
Ch3 4 regular expression and grammar
 
Deterministic Finite Automata
Deterministic Finite AutomataDeterministic Finite Automata
Deterministic Finite Automata
 
NFA & DFA
NFA & DFANFA & DFA
NFA & DFA
 

Destaque

Finite automata examples
Finite automata examplesFinite automata examples
Finite automata examplesankitamakin
 
[ENG] 22nd International Symposium on Current Issues and Controversies in Psy...
[ENG] 22nd International Symposium on Current Issues and Controversies in Psy...[ENG] 22nd International Symposium on Current Issues and Controversies in Psy...
[ENG] 22nd International Symposium on Current Issues and Controversies in Psy...Symposiums Controversias en Psiquiatría
 
Second Briefing - 1st Buikwe District Teachers' Project
Second Briefing - 1st Buikwe District Teachers' ProjectSecond Briefing - 1st Buikwe District Teachers' Project
Second Briefing - 1st Buikwe District Teachers' Projectlissalourenco
 
рус. язык
рус. языкрус. язык
рус. языкyankaaa
 
[ENG] 21st International Symposium on Current Issues and Controversies in Psy...
[ENG] 21st International Symposium on Current Issues and Controversies in Psy...[ENG] 21st International Symposium on Current Issues and Controversies in Psy...
[ENG] 21st International Symposium on Current Issues and Controversies in Psy...Symposiums Controversias en Psiquiatría
 
Legacy of sound sydney
Legacy of sound sydneyLegacy of sound sydney
Legacy of sound sydneyjeemjohns
 
Giới thiệu dự án
Giới thiệu dự ánGiới thiệu dự án
Giới thiệu dự ánnhomhopestar
 
F2 rangel irayda mipresentacion
F2 rangel irayda mipresentacionF2 rangel irayda mipresentacion
F2 rangel irayda mipresentacionirayda2
 
[ENG] 3rd International Symposium on Controversies in Psychiatry. Mexico 2014
[ENG] 3rd International Symposium on Controversies in Psychiatry. Mexico 2014[ENG] 3rd International Symposium on Controversies in Psychiatry. Mexico 2014
[ENG] 3rd International Symposium on Controversies in Psychiatry. Mexico 2014Symposiums Controversias en Psiquiatría
 
1st Buikwe District Teachers' Forum - 1st Briefing Session
1st Buikwe District Teachers' Forum - 1st Briefing Session1st Buikwe District Teachers' Forum - 1st Briefing Session
1st Buikwe District Teachers' Forum - 1st Briefing Sessionlissalourenco
 
Music Video Evaluation
Music Video EvaluationMusic Video Evaluation
Music Video EvaluationAnnaSubbotina
 

Destaque (19)

Question 2
Question 2Question 2
Question 2
 
Finite automata examples
Finite automata examplesFinite automata examples
Finite automata examples
 
[ENG] 22nd International Symposium on Current Issues and Controversies in Psy...
[ENG] 22nd International Symposium on Current Issues and Controversies in Psy...[ENG] 22nd International Symposium on Current Issues and Controversies in Psy...
[ENG] 22nd International Symposium on Current Issues and Controversies in Psy...
 
Second Briefing - 1st Buikwe District Teachers' Project
Second Briefing - 1st Buikwe District Teachers' ProjectSecond Briefing - 1st Buikwe District Teachers' Project
Second Briefing - 1st Buikwe District Teachers' Project
 
Herpetic esophagitis
Herpetic esophagitisHerpetic esophagitis
Herpetic esophagitis
 
рус. язык
рус. языкрус. язык
рус. язык
 
Hosobaiday
HosobaidayHosobaiday
Hosobaiday
 
[ENG] 21st International Symposium on Current Issues and Controversies in Psy...
[ENG] 21st International Symposium on Current Issues and Controversies in Psy...[ENG] 21st International Symposium on Current Issues and Controversies in Psy...
[ENG] 21st International Symposium on Current Issues and Controversies in Psy...
 
Legacy of sound sydney
Legacy of sound sydneyLegacy of sound sydney
Legacy of sound sydney
 
презентация
презентацияпрезентация
презентация
 
Giới thiệu dự án
Giới thiệu dự ánGiới thiệu dự án
Giới thiệu dự án
 
F2 rangel irayda mipresentacion
F2 rangel irayda mipresentacionF2 rangel irayda mipresentacion
F2 rangel irayda mipresentacion
 
презентация
презентацияпрезентация
презентация
 
[ENG] 3rd International Symposium on Controversies in Psychiatry. Mexico 2014
[ENG] 3rd International Symposium on Controversies in Psychiatry. Mexico 2014[ENG] 3rd International Symposium on Controversies in Psychiatry. Mexico 2014
[ENG] 3rd International Symposium on Controversies in Psychiatry. Mexico 2014
 
презентация
презентацияпрезентация
презентация
 
1st Buikwe District Teachers' Forum - 1st Briefing Session
1st Buikwe District Teachers' Forum - 1st Briefing Session1st Buikwe District Teachers' Forum - 1st Briefing Session
1st Buikwe District Teachers' Forum - 1st Briefing Session
 
Pneumococcal Vaccination in Saudi Arabia 2016
Pneumococcal Vaccination  in Saudi Arabia 2016Pneumococcal Vaccination  in Saudi Arabia 2016
Pneumococcal Vaccination in Saudi Arabia 2016
 
Music Video Evaluation
Music Video EvaluationMusic Video Evaluation
Music Video Evaluation
 
презентация
презентацияпрезентация
презентация
 

Semelhante a Dfa basics

F_Autómatas_MIT_2010--------------------
F_Autómatas_MIT_2010--------------------F_Autómatas_MIT_2010--------------------
F_Autómatas_MIT_2010--------------------MIGUELANGEL2672
 
Lecture: Regular Expressions and Regular Languages
Lecture: Regular Expressions and Regular LanguagesLecture: Regular Expressions and Regular Languages
Lecture: Regular Expressions and Regular LanguagesMarina Santini
 
Theory of Computation - Lectures 4 and 5
Theory of Computation - Lectures 4 and 5Theory of Computation - Lectures 4 and 5
Theory of Computation - Lectures 4 and 5Dr. Maamoun Ahmed
 
Automata
AutomataAutomata
AutomataGaditek
 
Automata
AutomataAutomata
AutomataGaditek
 
End semexam | Theory of Computation | Akash Anand | MTH 401A | IIT Kanpur
End semexam | Theory of Computation | Akash Anand | MTH 401A | IIT KanpurEnd semexam | Theory of Computation | Akash Anand | MTH 401A | IIT Kanpur
End semexam | Theory of Computation | Akash Anand | MTH 401A | IIT KanpurVivekananda Samiti
 
Top school in ghaziabad
Top school in ghaziabadTop school in ghaziabad
Top school in ghaziabadEdhole.com
 
01 alphabets strings and languages
01 alphabets strings and languages01 alphabets strings and languages
01 alphabets strings and languagesJohnDevaPrasanna1
 
Resumen material MIT
Resumen material MITResumen material MIT
Resumen material MITRawel Luciano
 
Regular expression with DFA
Regular expression with DFARegular expression with DFA
Regular expression with DFAMaulik Togadiya
 
Introduction to the Theory of Computation, Winter 2003 A. Hevia and J. Mao S...
 Introduction to the Theory of Computation, Winter 2003 A. Hevia and J. Mao S... Introduction to the Theory of Computation, Winter 2003 A. Hevia and J. Mao S...
Introduction to the Theory of Computation, Winter 2003 A. Hevia and J. Mao S...parmeet834
 
Chapter 3 REGULAR EXPRESSION.pdf
Chapter 3 REGULAR EXPRESSION.pdfChapter 3 REGULAR EXPRESSION.pdf
Chapter 3 REGULAR EXPRESSION.pdfdawod yimer
 
Regular expression (compiler)
Regular expression (compiler)Regular expression (compiler)
Regular expression (compiler)Jagjit Wilku
 

Semelhante a Dfa basics (20)

FSM.pdf
FSM.pdfFSM.pdf
FSM.pdf
 
F_Autómatas_MIT_2010--------------------
F_Autómatas_MIT_2010--------------------F_Autómatas_MIT_2010--------------------
F_Autómatas_MIT_2010--------------------
 
Lecture: Regular Expressions and Regular Languages
Lecture: Regular Expressions and Regular LanguagesLecture: Regular Expressions and Regular Languages
Lecture: Regular Expressions and Regular Languages
 
Theory of Computation - Lectures 4 and 5
Theory of Computation - Lectures 4 and 5Theory of Computation - Lectures 4 and 5
Theory of Computation - Lectures 4 and 5
 
Automata
AutomataAutomata
Automata
 
Automata
AutomataAutomata
Automata
 
End semexam | Theory of Computation | Akash Anand | MTH 401A | IIT Kanpur
End semexam | Theory of Computation | Akash Anand | MTH 401A | IIT KanpurEnd semexam | Theory of Computation | Akash Anand | MTH 401A | IIT Kanpur
End semexam | Theory of Computation | Akash Anand | MTH 401A | IIT Kanpur
 
Top school in ghaziabad
Top school in ghaziabadTop school in ghaziabad
Top school in ghaziabad
 
rs1.ppt
rs1.pptrs1.ppt
rs1.ppt
 
Linear algebra
Linear algebraLinear algebra
Linear algebra
 
01 alphabets strings and languages
01 alphabets strings and languages01 alphabets strings and languages
01 alphabets strings and languages
 
Vector spaces
Vector spaces Vector spaces
Vector spaces
 
Resumen material MIT
Resumen material MITResumen material MIT
Resumen material MIT
 
Module 1 TOC.pptx
Module 1 TOC.pptxModule 1 TOC.pptx
Module 1 TOC.pptx
 
Regular expression with DFA
Regular expression with DFARegular expression with DFA
Regular expression with DFA
 
Introduction to the Theory of Computation, Winter 2003 A. Hevia and J. Mao S...
 Introduction to the Theory of Computation, Winter 2003 A. Hevia and J. Mao S... Introduction to the Theory of Computation, Winter 2003 A. Hevia and J. Mao S...
Introduction to the Theory of Computation, Winter 2003 A. Hevia and J. Mao S...
 
Chapter 3 REGULAR EXPRESSION.pdf
Chapter 3 REGULAR EXPRESSION.pdfChapter 3 REGULAR EXPRESSION.pdf
Chapter 3 REGULAR EXPRESSION.pdf
 
Theory of computation
Theory of computationTheory of computation
Theory of computation
 
Unit i
Unit iUnit i
Unit i
 
Regular expression (compiler)
Regular expression (compiler)Regular expression (compiler)
Regular expression (compiler)
 

Último

The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEarley Information Science
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...Neo4j
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Igalia
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Enterprise Knowledge
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUK Journal
 

Último (20)

The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 

Dfa basics

  • 1. Introduction to Finite Automata Languages Deterministic Finite Automata Representations of Automata 1
  • 2. Alphabets An alphabet is any finite set of symbols. Examples: ASCII, Unicode, {0,1} (binary alphabet ), {a,b,c}. 2
  • 3. Strings The set of strings over an alphabet Σ is the set of lists, each element of which is a member of Σ. Strings shown with no commas, e.g., abc. Σ* denotes this set of strings. ε stands for the empty string (string of length 0). 3
  • 4. Example: Strings {0,1}* = {ε, 0, 1, 00, 01, 10, 11, 000, 001, . . . } Subtlety: 0 as a string, 0 as a symbol look the same. Context determines the type. 4
  • 5. Languages A language is a subset of Σ* for some alphabet Σ. Example: The set of strings of 0’s and 1’s with no two consecutive 1’s. L = {ε, 0, 1, 00, 01, 10, 000, 001, 010, 100, 101, 0000, 0001, 0010, 0100, 0101, 1000, 1001, 1010, . . . } Hmm… 1 of length 0, 2 of length 1, 3, of length 2, 5 of length 3, 8 of length 4. I wonder how many of length 5? 5
  • 6. Deterministic Finite Automata A formalism for defining languages, consisting of: 1. 2. 3. 4. A finite set of states (Q, typically). An input alphabet (Σ, typically). A transition function (δ, typically). A start state (q0, in Q, typically). 5. A set of final states (F ⊆ Q, typically). “Final” and “accepting” are synonyms. 6
  • 7. The Transition Function Takes two arguments: a state and an input symbol. δ(q, a) = the state that the DFA goes to when it is in state q and input a is received. 7
  • 8. Graph Representation of DFA’s Nodes = states. Arcs represent transition function. Arc from state p to state q labeled by all those input symbols that have transitions from p to q. Arrow labeled “Start” to the start state. Final states indicated by double circles. 8
  • 9. Example: Graph of a DFA Accepts all strings without two consecutive 1’s. 0 A 0,1 1 Start Previous string OK, does not end in 1. B 1 C 0 Consecutive Previous String OK, 1’s have ends in a been seen. single 1. 9
  • 10. Alternative Representation: Transition Table Final states starred Arrow for start state * A * B C 0 1 A A C B C C Columns = input symbols Rows = states 10
  • 11. Extended Transition Function We describe the effect of a string of inputs on a DFA by extending δ to a state and a string. Induction on length of string. Basis: δ(q, ε) = q Induction: δ(q,wa) = δ(δ(q,w),a) w is a string; a is an input symbol. 11
  • 12. Extended δ: Intuition Convention: … w, x, y, x are strings. a, b, c,… are single symbols. Extended δ is computed for state q and inputs a1a2…an by following a path in the transition graph, starting at q and selecting the arcs with labels a1, a2,…,an in turn. 12
  • 13. Example: Extended Delta A B C 0 A A C 1 B C C δ(B,011) = δ(δ(B,01),1) = δ(δ(δ(B,0),1),1) = δ(δ(A,1),1) = δ(B,1) = C 13
  • 14. Delta-hat In book, the extended δ has a “hat” to distinguish it from δ itself. Not needed, because both agree when the string is a single symbol. ˄ ˄ δ(q, a) = δ(δ(q, ε), a) = δ(q, a) Extended deltas 14
  • 15. Language of a DFA Automata of all kinds define languages. If A is an automaton, L(A) is its language. For a DFA A, L(A) is the set of strings labeling paths from the start state to a final state. Formally: L(A) = the set of strings w such that δ(q0, w) is in F. 15
  • 16. Example: String in a Language String 101 is in the language of the DFA below. Start at A. 0 A Start 0,1 1 B 1 C 0 16
  • 17. Example: String in a Language String 101 is in the language of the DFA below. Follow arc labeled 1. 0 A Start 0,1 1 B 1 C 0 17
  • 18. Example: String in a Language String 101 is in the language of the DFA below. Then arc labeled 0 from current state B. 0 0,1 A Start 1 B 1 C 0 18
  • 19. Example: String in a Language String 101 is in the language of the DFA below. Finally arc labeled 1 from current state A. Result is an accepting state, so 101 is in the language. 0 0,1 A Start 1 B 1 C 0 19
  • 20. Example – Concluded The language of our example DFA is: {w | w is in {0,1}* and w does not have two consecutive 1’s} Such that… These conditions about w are true. Read a set former as “The set of strings w… 20
  • 21. Proofs of Set Equivalence Often, we need to prove that two descriptions of sets are in fact the same set. Here, one set is “the language of this DFA,” and the other is “the set of strings of 0’s and 1’s with no consecutive 1’s.” 21
  • 22. Proofs – (2) In general, to prove S=T, we need to prove two parts: S ⊆ T and T ⊆ S. That is: 1. If w is in S, then w is in T. 2. If w is in T, then w is in S. As an example, let S = the language of our running DFA, and T = “no consecutive 1’s.” 22
  • 23. Part 1: S ⊆ T 0 A 1 B 1C To prove: if w is accepted by Start 0 then w has no consecutive 1’s. Proof is an induction on length of w. Important trick: Expand the inductive hypothesis to be more detailed than you need. 23 0,1
  • 24. The Inductive Hypothesis 1. If δ(A, w) = A, then w has no consecutive 1’s and does not end in 1. 2. If δ(A, w) = B, then w has no consecutive 1’s and ends in a single 1. Basis: |w| = 0; i.e., w = ε. (1) holds since ε has no 1’s at all. (2) holds vacuously, since δ(A, ε) is not B. “length of” Important concept: If the “if” part of “if..then” is false, the statement is true. 24
  • 25. Inductive Step 0 A 1 B 1C 0,1 Start 0 Assume (1) and (2) are true for strings shorter than w, where |w| is at least 1. Because w is not empty, we can write w = xa, where a is the last symbol of w, and x is the string that precedes. IH is true for x. 25
  • 26. Inductive Step – (2) 0 A 1 B 1C 0,1 Start 0 Need to prove (1) and (2) for w = xa. (1) for w is: If δ(A, w) = A, then w has no consecutive 1’s and does not end in 1. Since δ(A, w) = A, δ(A, x) must be A or B, and a must be 0 (look at the DFA). By the IH, x has no 11’s. Thus, w has no 11’s and does not end in 1. 26
  • 27. Inductive Step – (3) 0 A 1 B 1C 0,1 Start 0 Now, prove (2) for w = xa: If δ(A, w) = B, then w has no 11’s and ends in 1. Since δ(A, w) = B, δ(A, x) must be A, and a must be 1 (look at the DFA). By the IH, x has no 11’s and does not end in 1. Thus, w has no 11’s and ends in 1. 27
  • 28. Part 2: T ⊆ S X Now, we must prove: if w has no 11’s, then w is accepted by 0 0,1 A 1 B 1C Y Start 0 Contrapositive : If w is not accepted by 0 A 1 B 1C Start 0 0,1 then w has 11. Key idea: contrapositive of “if X then Y” is the equivalent statement “if not Y then not X.” 28
  • 29. Using the Contrapositive 0 A 1 B 1C 0,1 Start 0 Every w gets the DFA to exactly one state. Simple inductive proof based on: • Every state has exactly one transition on 1, one transition on 0. The only way w is not accepted is if it gets to C. 29
  • 30. Using the Contrapositive – (2) 0 A 1 B 1C 0,1 Start 0 The only way to get to C [formally: δ(A,w) = C] is if w = x1y, x gets to B, and y is the tail of w that follows what gets to C for the first time. If δ(A,x) = B then surely x = z1 for some z. Thus, w = z11y and has 11. 30
  • 31. Regular Languages A language L is regular if it is the language accepted by some DFA. Note: the DFA must accept only the strings in L, no others. Some languages are not regular. Intuitively, regular languages “cannot count” to arbitrarily high integers. 31
  • 32. Example: A Nonregular Language L1 = {0n1n | n ≥ 1} Note: ai is conventional for i a’s. Thus, 04 = 0000, e.g. Read: “The set of strings consisting of n 0’s followed by n 1’s, such that n is at least 1. Thus, L1 = {01, 0011, 000111,…} 32
  • 33. Another Example L2 = {w | w in {(, )}* and w is balanced } Note: alphabet consists of the parenthesis symbols ’(’ and ’)’. Balanced parens are those that can appear in an arithmetic expression. • E.g.: (), ()(), (()), (()()),… 33
  • 34. But Many Languages are Regular Regular Languages can be described in many ways, e.g., regular expressions. They appear in many contexts and have many useful properties. Example: the strings that represent floating point numbers in your favorite language is a regular language. 34
  • 35. Example: A Regular Language L3 = { w | w in {0,1}* and w, viewed as a binary integer is divisible by 23} The DFA: 23 states, named 0, 1,…,22. Correspond to the 23 remainders of an integer divided by 23. Start and only final state is 0. 35
  • 36. Transitions of the DFA for L3 If string w represents integer i, then assume δ(0, w) = i%23. Then w0 represents integer 2i, so we want δ(i%23, 0) = (2i)%23. Similarly: w1 represents 2i+1, so we want δ(i%23, 1) = (2i+1)%23. Example: δ(15,0) = 30%23 = 7; δ(11,1) Key idea: design a DFA = 23%23 = 0. by figuring out what each state needs to remember about the 36 past.
  • 37. Another Example L4 = { w | w in {0,1}* and w, viewed as the reverse of a binary integer is divisible by 23} Example: 01110100 is in L4, because its reverse, 00101110 is 46 in binary. Hard to construct the DFA. But theorem says the reverse of a regular language is also regular. 37