SlideShare a Scribd company logo
Formal Definition of Computation
Let M = (Q, ∑ , δ, q0, F) be a finite automaton
and let w = w1w2.....wn be a string where
each wi is a member of the alphabet ∑. Then
M accepts w if a sequence of states r0, r1, ….,rn In
Q exists with three conditions:
1- r0= q0,
2- δ(ri, wi+1)=ri+1, for i=0,...,n-1, and
3- rn∈ F
Cont.






Condition 1 says that the machine starts in
the start state.
Condition 2 says that the machine goes
from state to another according to the
transition function
Condition 3 says that the machine accepts
its input if it ends up in an accept state. We
say that M recognizes language A if

A = {w | M accepts w}
Regular Language


Definition:

A language is called a regular language if
some finite automaton recognizes it.
See example 1.17 p. 41
Designing Finite Automata






Just like artwork, design is a creative
process...
Suppose you are given some language,
and you want to design a FA that
recognizes it...pretend that you are the
machine!
Take symbols, one by one, and and after
each symbol, you should decide whether
the string so far is in the language or not.
Designing Finite Automata –Cont.




What if the string is from earth to moon
long? And your memory (as a FA) is like a
sheet of paper? Worry-less, you will have
to memorize the crucial info only, like:
“What's my status now?”
Example: suppose: alphabet = {0,1}, and
that the language consists of all strings
with an odd number of 1s. You want to
construct a FA E1 to recognize this
language
Designing Finite Automata –Cont.
By pretending that you're the FA, get the
symbols (1 by 1), do you need to
remember all the string? No! Just
remembering the number of 1s so far is
even or not is enough, so that if next is 0,
don't change, if 1, change!


Therefore, you have 2 states, say: q odd, qeven.
Designing Finite Automata –Cont.




Next, assign transitions.
Assign a start state (qeven) in our example,
since no symbol has been entered so far
(0) and 0 is even.



What about Final state (accept)?



See example 1.21 - P.43
Regular Operations


We use them to study properties of regular
languages, those properties will help us
develop a toolbox that will include ways of
proving certain other languages are
nonregular (i.e. beyond the capability of
FA)
Regular Operations


If A and B are languages, then:



Union: A∪B = {x|x ∈ A or x ∈ B}







Concatenation: A ○ B = {xy | x ∈ A and y ∈
B}
Star: A* = {x1x2....xk | k>=0 and each xi∈A}
The star operation is unary operation (on 1
language) while the union and conc. are
binary operations
Regular Operations – cont.
Let ∑ = {a,b,....,z}, if A = {good, bad}, and B = {boy,
girl} the:

A ∪ B = {good, bad, boy, girl}
A ○ B = {goodboy, goodgirl, badboy, badgirl}
A*= {ε, good, bad, goodgood, badbad, badgood,
goodgoodgood, goodgoodbad, etc.....}
Regular Operations Cont.


Closed under multiplication:

example, if x and y are two numbers from N,
then x*y results a number also from N.




But N is not closed under division,
because x/y may result a number which
isn't member of N, ex. X=1, y=2, x/y=1/2
which isn't member of N
Please read theorems 1.25, 1.26 p.45, 46
Nondeterminism


DFA vs. NFA:

DFA has exactly one exiting transition arrow
for each symbol in the alphabet, NFA
violets that.




DFA uses symbols from alphabet only for
arrow labels, NFA may use others, such as
ε.
What will happen if a state has two arrows
for same input? Or if input is ε?
NFA
0,1
q1

0,1
1

q2

0,ε

q3

1

q
q4
4


Examples:

1.30, 1.33, 1.35 P: 51-53
Formal definition of NFA






Similar to DFA, the NFA has the 5-tuple,
yet the difference is in δ (The Transition
Function)
In DFA, δ takes a state and an input
symbol and produces the next state.
In NFA, δ takes a state and an an input
symbol OR the empty string and produces
the set of possible next states.
Cont.
Therefore, point 3 of the tuple would be as:
δ : Q X ∑ε → P(Q), where
∑ε is the result of ∑ ∪ ε
Example
The formal definition of N1 (slide 13):
1- Q = {q1,q2,q3,q4}
2- ∑ = {0,1}
3- δ is given as:
4- q1 =start state
5- F ={q4}

0

1

ε

q1

{q1}

{q1,q2}

Ф

q2

{q3}

Ф

{q3}

q3

Ф

{q4}

Ф

q4

{q4}

{q4}

Ф
Reading


Every NFA has an equivalent DFA...

To prove, read P.54- P.58


Based on your previous reading (P.45),
read Closure under the regular operations
(P.58-63). Which is similar to, yet easier
than example P.45.
Regular Expressions




In math, we use + and x to build up
expressions like: (5+3)x4 (Gives 32)
Similarly, we use∪ and * to build up

expressions describing languages, called
Regular Expressions (RegEx):
(0 ∪ 1)0* … (Gives a language)

What does (0 ∪ 1)0* mean?


It's a language consisting of all strings starting
with a 0 or 1 followed by any number of 0s.
RegEx – Cont.
(0 ∪ 1)0* is:
- (0 ∪ 1) = ({0}∪{1}) = {0,1}
- 0* means {0}*, means a language consisting of of any
number of 0s.
The concatenation between (0 ∪ 1) and 0* is a
shorthand for for (0 ∪ 1) ○ 0*




Applications of RegEx: many, Grep (text-search)in
Unix and Linux, Perl, C++, text editors etc....
In C++, you can use regex r("(+|-)?[[:digit:]]+");, but
why?
Regex- Example
(0 ∪ 1)* = the language consisting of all possible
strings of 0s and 1s.
If ∑ ={0,1}, then ∑ is a shorthand for (0 ∪ 1).




Generally, if ∑ is any alphabet, the regex ∑
describes the language consisting of all strings of
length 1 over the alphabet, and ∑* describes the
language consisting of all strings over the
alphabet.
∑*1 is the language that contains all strings that
end with 1
Regex- Example-cont.


The language (0∑*) ∪ (∑*1) consists of all

strings that either start with a 0 or end with a 1.
* similar to mathematical precedence ( x before +
for example), in regex, * is done first ,then
concatenation, finally the union. Unless
parentheses are used.
Formal Definition of regex


We say that R is a regex if R:

1. a for some a in the alphabet
2. ε,
3. ᶲ
4. (R1 ∪ R2)
5. (R1 ○ R2)
6. (R1*), where R1 is a regex
Ad

More Related Content

What's hot (19)

3.1 intro toautomatatheory h1
3.1 intro toautomatatheory  h13.1 intro toautomatatheory  h1
3.1 intro toautomatatheory h1
Rajendran
 
Formal language & automata theory
Formal language & automata theoryFormal language & automata theory
Formal language & automata theory
NYversity
 
Finite automata-for-lexical-analysis
Finite automata-for-lexical-analysisFinite automata-for-lexical-analysis
Finite automata-for-lexical-analysis
Dattatray Gandhmal
 
Thoery of Computaion and Chomsky's Classification
Thoery of Computaion and Chomsky's ClassificationThoery of Computaion and Chomsky's Classification
Thoery of Computaion and Chomsky's Classification
PrafullMisra
 
Theory of Computation Lecture Notes
Theory of Computation Lecture NotesTheory of Computation Lecture Notes
Theory of Computation Lecture Notes
FellowBuddy.com
 
Introduction to fa and dfa
Introduction to fa  and dfaIntroduction to fa  and dfa
Introduction to fa and dfa
deepinderbedi
 
Automata
AutomataAutomata
Automata
Gaditek
 
Finite automata examples
Finite automata examplesFinite automata examples
Finite automata examples
ankitamakin
 
NFA Non Deterministic Finite Automata by Mudasir khushik
NFA Non Deterministic Finite Automata by Mudasir khushikNFA Non Deterministic Finite Automata by Mudasir khushik
NFA Non Deterministic Finite Automata by Mudasir khushik
MudsaraliKhushik
 
Minimizing DFA
Minimizing DFAMinimizing DFA
Minimizing DFA
Animesh Chaturvedi
 
Regular expressions and languages pdf
Regular expressions and languages pdfRegular expressions and languages pdf
Regular expressions and languages pdf
Dilouar Hossain
 
Regular expressions-Theory of computation
Regular expressions-Theory of computationRegular expressions-Theory of computation
Regular expressions-Theory of computation
Bipul Roy Bpl
 
Ch3
Ch3Ch3
Ch3
kinnarshah8888
 
Finite automata
Finite automataFinite automata
Finite automata
Bipul Roy Bpl
 
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
 
Finite automata(For college Seminars)
Finite automata(For college Seminars)Finite automata(For college Seminars)
Finite automata(For college Seminars)
Naman Joshi
 
Theory of computation and automata
Theory of computation and automataTheory of computation and automata
Theory of computation and automata
Prof. Dr. K. Adisesha
 
Finite Automata in compiler design
Finite Automata in compiler designFinite Automata in compiler design
Finite Automata in compiler design
Riazul Islam
 
Finite automata
Finite automataFinite automata
Finite automata
ankitamakin
 
3.1 intro toautomatatheory h1
3.1 intro toautomatatheory  h13.1 intro toautomatatheory  h1
3.1 intro toautomatatheory h1
Rajendran
 
Formal language & automata theory
Formal language & automata theoryFormal language & automata theory
Formal language & automata theory
NYversity
 
Finite automata-for-lexical-analysis
Finite automata-for-lexical-analysisFinite automata-for-lexical-analysis
Finite automata-for-lexical-analysis
Dattatray Gandhmal
 
Thoery of Computaion and Chomsky's Classification
Thoery of Computaion and Chomsky's ClassificationThoery of Computaion and Chomsky's Classification
Thoery of Computaion and Chomsky's Classification
PrafullMisra
 
Theory of Computation Lecture Notes
Theory of Computation Lecture NotesTheory of Computation Lecture Notes
Theory of Computation Lecture Notes
FellowBuddy.com
 
Introduction to fa and dfa
Introduction to fa  and dfaIntroduction to fa  and dfa
Introduction to fa and dfa
deepinderbedi
 
Automata
AutomataAutomata
Automata
Gaditek
 
Finite automata examples
Finite automata examplesFinite automata examples
Finite automata examples
ankitamakin
 
NFA Non Deterministic Finite Automata by Mudasir khushik
NFA Non Deterministic Finite Automata by Mudasir khushikNFA Non Deterministic Finite Automata by Mudasir khushik
NFA Non Deterministic Finite Automata by Mudasir khushik
MudsaraliKhushik
 
Regular expressions and languages pdf
Regular expressions and languages pdfRegular expressions and languages pdf
Regular expressions and languages pdf
Dilouar Hossain
 
Regular expressions-Theory of computation
Regular expressions-Theory of computationRegular expressions-Theory of computation
Regular expressions-Theory of computation
Bipul Roy Bpl
 
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
 
Finite automata(For college Seminars)
Finite automata(For college Seminars)Finite automata(For college Seminars)
Finite automata(For college Seminars)
Naman Joshi
 
Finite Automata in compiler design
Finite Automata in compiler designFinite Automata in compiler design
Finite Automata in compiler design
Riazul Islam
 

Viewers also liked (13)

Theory of computation Lec6
Theory of computation Lec6Theory of computation Lec6
Theory of computation Lec6
Arab Open University and Cairo University
 
Music advert analysis rihanna
Music advert analysis rihannaMusic advert analysis rihanna
Music advert analysis rihanna
heatherjanewx
 
Presentacion 4 pre teen 2 a.
Presentacion 4 pre teen 2 a.Presentacion 4 pre teen 2 a.
Presentacion 4 pre teen 2 a.
missyanina
 
Theory of computation Lec2
Theory of computation Lec2Theory of computation Lec2
Theory of computation Lec2
Arab Open University and Cairo University
 
Theory of computation Lec3 dfa
Theory of computation Lec3 dfaTheory of computation Lec3 dfa
Theory of computation Lec3 dfa
Arab Open University and Cairo University
 
Theory of Automata
Theory of AutomataTheory of Automata
Theory of Automata
Farooq Mian
 
Deterministic Finite Automata
Deterministic Finite AutomataDeterministic Finite Automata
Deterministic Finite Automata
Mohammad jawad khan
 
declamation piece for high school, english TRAGEDY
declamation piece for high school, english TRAGEDYdeclamation piece for high school, english TRAGEDY
declamation piece for high school, english TRAGEDY
Carie Justine Estrellado
 
NFA or Non deterministic finite automata
NFA or Non deterministic finite automataNFA or Non deterministic finite automata
NFA or Non deterministic finite automata
deepinderbedi
 
Introduction to Object Oriented Programming
Introduction to Object Oriented ProgrammingIntroduction to Object Oriented Programming
Introduction to Object Oriented Programming
Moutaz Haddara
 
Dfa vs nfa
Dfa vs nfaDfa vs nfa
Dfa vs nfa
raosir123
 
Object Oriented Programming Concepts
Object Oriented Programming ConceptsObject Oriented Programming Concepts
Object Oriented Programming Concepts
thinkphp
 
Declamation pieces
Declamation piecesDeclamation pieces
Declamation pieces
Sa Je La
 
Ad

Similar to Theory of Computation - Lectures 4 and 5 (20)

Resumen material MIT
Resumen material MITResumen material MIT
Resumen material MIT
Rawel Luciano
 
Automata_Theory_and_compiler_design_UNIT-1.pptx.pdf
Automata_Theory_and_compiler_design_UNIT-1.pptx.pdfAutomata_Theory_and_compiler_design_UNIT-1.pptx.pdf
Automata_Theory_and_compiler_design_UNIT-1.pptx.pdf
TONY562
 
a simple idealized machine used to recognize patterns within input taken from...
a simple idealized machine used to recognize patterns within input taken from...a simple idealized machine used to recognize patterns within input taken from...
a simple idealized machine used to recognize patterns within input taken from...
NALESVPMEngg
 
TCS MUBAI UNIVERSITY ATHARVA COLLEGE OF ENGINEERING.pptx
TCS MUBAI UNIVERSITY ATHARVA COLLEGE OF ENGINEERING.pptxTCS MUBAI UNIVERSITY ATHARVA COLLEGE OF ENGINEERING.pptx
TCS MUBAI UNIVERSITY ATHARVA COLLEGE OF ENGINEERING.pptx
userqwerty2612
 
0227 regularlanguages
 0227 regularlanguages 0227 regularlanguages
0227 regularlanguages
issbp
 
F_Autómatas_MIT_2010--------------------
F_Autómatas_MIT_2010--------------------F_Autómatas_MIT_2010--------------------
F_Autómatas_MIT_2010--------------------
MIGUELANGEL2672
 
Finite automata
Finite automataFinite automata
Finite automata
ankitamakin
 
TCS GOLDEN NOTES THEORY OF COMPUTATION .pdf
TCS GOLDEN NOTES THEORY OF COMPUTATION .pdfTCS GOLDEN NOTES THEORY OF COMPUTATION .pdf
TCS GOLDEN NOTES THEORY OF COMPUTATION .pdf
userqwerty2612
 
Chapter 3 REGULAR EXPRESSION.pdf
Chapter 3 REGULAR EXPRESSION.pdfChapter 3 REGULAR EXPRESSION.pdf
Chapter 3 REGULAR EXPRESSION.pdf
dawod yimer
 
FSA.pptx natural language prsgdsgocessing
FSA.pptx natural language prsgdsgocessingFSA.pptx natural language prsgdsgocessing
FSA.pptx natural language prsgdsgocessing
ssuser77162c
 
FiniteAutomata.ppt
FiniteAutomata.pptFiniteAutomata.ppt
FiniteAutomata.ppt
RohitPaul71
 
FiniteAutomata (1).ppt
FiniteAutomata (1).pptFiniteAutomata (1).ppt
FiniteAutomata (1).ppt
ssuser47f7f2
 
TOC Introduction
TOC Introduction TOC Introduction
TOC Introduction
Thapar Institute
 
The Theory of Finite Automata.pptx
The Theory of Finite Automata.pptxThe Theory of Finite Automata.pptx
The Theory of Finite Automata.pptx
ssuser039bf6
 
FiniteAutomata-DFA and NFA from Theory of Computation.ppt
FiniteAutomata-DFA and NFA from Theory of Computation.pptFiniteAutomata-DFA and NFA from Theory of Computation.ppt
FiniteAutomata-DFA and NFA from Theory of Computation.ppt
AdharshKumarSingh
 
Unit2 Toc.pptx
Unit2 Toc.pptxUnit2 Toc.pptx
Unit2 Toc.pptx
viswanath kani
 
Automata
AutomataAutomata
Automata
Gaditek
 
Complier Design - Operations on Languages, RE, Finite Automata
Complier Design - Operations on Languages, RE, Finite AutomataComplier Design - Operations on Languages, RE, Finite Automata
Complier Design - Operations on Languages, RE, Finite Automata
Faculty of Computers and Informatics, Suez Canal University, Ismailia, Egypt
 
Dfa
DfaDfa
Dfa
azamcse29
 
Lecture1.pptxjendfkdmdmmdmmedhf bf fbbd ed
Lecture1.pptxjendfkdmdmmdmmedhf bf fbbd edLecture1.pptxjendfkdmdmmdmmedhf bf fbbd ed
Lecture1.pptxjendfkdmdmmdmmedhf bf fbbd ed
zoobiarana76
 
Resumen material MIT
Resumen material MITResumen material MIT
Resumen material MIT
Rawel Luciano
 
Automata_Theory_and_compiler_design_UNIT-1.pptx.pdf
Automata_Theory_and_compiler_design_UNIT-1.pptx.pdfAutomata_Theory_and_compiler_design_UNIT-1.pptx.pdf
Automata_Theory_and_compiler_design_UNIT-1.pptx.pdf
TONY562
 
a simple idealized machine used to recognize patterns within input taken from...
a simple idealized machine used to recognize patterns within input taken from...a simple idealized machine used to recognize patterns within input taken from...
a simple idealized machine used to recognize patterns within input taken from...
NALESVPMEngg
 
TCS MUBAI UNIVERSITY ATHARVA COLLEGE OF ENGINEERING.pptx
TCS MUBAI UNIVERSITY ATHARVA COLLEGE OF ENGINEERING.pptxTCS MUBAI UNIVERSITY ATHARVA COLLEGE OF ENGINEERING.pptx
TCS MUBAI UNIVERSITY ATHARVA COLLEGE OF ENGINEERING.pptx
userqwerty2612
 
0227 regularlanguages
 0227 regularlanguages 0227 regularlanguages
0227 regularlanguages
issbp
 
F_Autómatas_MIT_2010--------------------
F_Autómatas_MIT_2010--------------------F_Autómatas_MIT_2010--------------------
F_Autómatas_MIT_2010--------------------
MIGUELANGEL2672
 
TCS GOLDEN NOTES THEORY OF COMPUTATION .pdf
TCS GOLDEN NOTES THEORY OF COMPUTATION .pdfTCS GOLDEN NOTES THEORY OF COMPUTATION .pdf
TCS GOLDEN NOTES THEORY OF COMPUTATION .pdf
userqwerty2612
 
Chapter 3 REGULAR EXPRESSION.pdf
Chapter 3 REGULAR EXPRESSION.pdfChapter 3 REGULAR EXPRESSION.pdf
Chapter 3 REGULAR EXPRESSION.pdf
dawod yimer
 
FSA.pptx natural language prsgdsgocessing
FSA.pptx natural language prsgdsgocessingFSA.pptx natural language prsgdsgocessing
FSA.pptx natural language prsgdsgocessing
ssuser77162c
 
FiniteAutomata.ppt
FiniteAutomata.pptFiniteAutomata.ppt
FiniteAutomata.ppt
RohitPaul71
 
FiniteAutomata (1).ppt
FiniteAutomata (1).pptFiniteAutomata (1).ppt
FiniteAutomata (1).ppt
ssuser47f7f2
 
The Theory of Finite Automata.pptx
The Theory of Finite Automata.pptxThe Theory of Finite Automata.pptx
The Theory of Finite Automata.pptx
ssuser039bf6
 
FiniteAutomata-DFA and NFA from Theory of Computation.ppt
FiniteAutomata-DFA and NFA from Theory of Computation.pptFiniteAutomata-DFA and NFA from Theory of Computation.ppt
FiniteAutomata-DFA and NFA from Theory of Computation.ppt
AdharshKumarSingh
 
Automata
AutomataAutomata
Automata
Gaditek
 
Lecture1.pptxjendfkdmdmmdmmedhf bf fbbd ed
Lecture1.pptxjendfkdmdmmdmmedhf bf fbbd edLecture1.pptxjendfkdmdmmdmmedhf bf fbbd ed
Lecture1.pptxjendfkdmdmmdmmedhf bf fbbd ed
zoobiarana76
 
Ad

More from Dr. Maamoun Ahmed (7)

A* - Astar - A-Star
A* - Astar - A-StarA* - Astar - A-Star
A* - Astar - A-Star
Dr. Maamoun Ahmed
 
Minimum spanning trees – prim's and kruskal's algorithms
Minimum spanning trees – prim's and kruskal's algorithmsMinimum spanning trees – prim's and kruskal's algorithms
Minimum spanning trees – prim's and kruskal's algorithms
Dr. Maamoun Ahmed
 
Finding Minimum Spanning Tree using Prim's Algorithm - Matrix approach
Finding Minimum Spanning Tree using Prim's Algorithm - Matrix approachFinding Minimum Spanning Tree using Prim's Algorithm - Matrix approach
Finding Minimum Spanning Tree using Prim's Algorithm - Matrix approach
Dr. Maamoun Ahmed
 
Solving linear homogeneous recurrence relations
Solving linear homogeneous recurrence relationsSolving linear homogeneous recurrence relations
Solving linear homogeneous recurrence relations
Dr. Maamoun Ahmed
 
Theory of Computation - Lectures 6 & 7
Theory of Computation - Lectures 6 & 7Theory of Computation - Lectures 6 & 7
Theory of Computation - Lectures 6 & 7
Dr. Maamoun Ahmed
 
Theory of Computation - Lecture 3
Theory of Computation - Lecture 3Theory of Computation - Lecture 3
Theory of Computation - Lecture 3
Dr. Maamoun Ahmed
 
Theory of Computation - Strings and Languages and Proofs (Lecture 2)
Theory of Computation  - Strings and Languages and Proofs (Lecture 2)Theory of Computation  - Strings and Languages and Proofs (Lecture 2)
Theory of Computation - Strings and Languages and Proofs (Lecture 2)
Dr. Maamoun Ahmed
 
Minimum spanning trees – prim's and kruskal's algorithms
Minimum spanning trees – prim's and kruskal's algorithmsMinimum spanning trees – prim's and kruskal's algorithms
Minimum spanning trees – prim's and kruskal's algorithms
Dr. Maamoun Ahmed
 
Finding Minimum Spanning Tree using Prim's Algorithm - Matrix approach
Finding Minimum Spanning Tree using Prim's Algorithm - Matrix approachFinding Minimum Spanning Tree using Prim's Algorithm - Matrix approach
Finding Minimum Spanning Tree using Prim's Algorithm - Matrix approach
Dr. Maamoun Ahmed
 
Solving linear homogeneous recurrence relations
Solving linear homogeneous recurrence relationsSolving linear homogeneous recurrence relations
Solving linear homogeneous recurrence relations
Dr. Maamoun Ahmed
 
Theory of Computation - Lectures 6 & 7
Theory of Computation - Lectures 6 & 7Theory of Computation - Lectures 6 & 7
Theory of Computation - Lectures 6 & 7
Dr. Maamoun Ahmed
 
Theory of Computation - Lecture 3
Theory of Computation - Lecture 3Theory of Computation - Lecture 3
Theory of Computation - Lecture 3
Dr. Maamoun Ahmed
 
Theory of Computation - Strings and Languages and Proofs (Lecture 2)
Theory of Computation  - Strings and Languages and Proofs (Lecture 2)Theory of Computation  - Strings and Languages and Proofs (Lecture 2)
Theory of Computation - Strings and Languages and Proofs (Lecture 2)
Dr. Maamoun Ahmed
 

Recently uploaded (20)

EUPHORIA GENERAL QUIZ PRELIMS | QUIZ CLUB OF PSGCAS | 21 MARCH 2025
EUPHORIA GENERAL QUIZ PRELIMS | QUIZ CLUB OF PSGCAS | 21 MARCH 2025EUPHORIA GENERAL QUIZ PRELIMS | QUIZ CLUB OF PSGCAS | 21 MARCH 2025
EUPHORIA GENERAL QUIZ PRELIMS | QUIZ CLUB OF PSGCAS | 21 MARCH 2025
Quiz Club of PSG College of Arts & Science
 
Capitol Doctoral Presentation -May 2025.pptx
Capitol Doctoral Presentation -May 2025.pptxCapitol Doctoral Presentation -May 2025.pptx
Capitol Doctoral Presentation -May 2025.pptx
CapitolTechU
 
PUBH1000 Slides - Module 10: Health Promotion
PUBH1000 Slides - Module 10: Health PromotionPUBH1000 Slides - Module 10: Health Promotion
PUBH1000 Slides - Module 10: Health Promotion
JonathanHallett4
 
Rebuilding the library community in a post-Twitter world
Rebuilding the library community in a post-Twitter worldRebuilding the library community in a post-Twitter world
Rebuilding the library community in a post-Twitter world
Ned Potter
 
Module 1: Foundations of Research
Module 1: Foundations of ResearchModule 1: Foundations of Research
Module 1: Foundations of Research
drroxannekemp
 
20250515 Ntegra San Francisco 20250515 v15.pptx
20250515 Ntegra San Francisco 20250515 v15.pptx20250515 Ntegra San Francisco 20250515 v15.pptx
20250515 Ntegra San Francisco 20250515 v15.pptx
home
 
How to Configure Extra Steps During Checkout in Odoo 18 Website
How to Configure Extra Steps During Checkout in Odoo 18 WebsiteHow to Configure Extra Steps During Checkout in Odoo 18 Website
How to Configure Extra Steps During Checkout in Odoo 18 Website
Celine George
 
Mental Health Assessment in 5th semester bsc. nursing and also used in 2nd ye...
Mental Health Assessment in 5th semester bsc. nursing and also used in 2nd ye...Mental Health Assessment in 5th semester bsc. nursing and also used in 2nd ye...
Mental Health Assessment in 5th semester bsc. nursing and also used in 2nd ye...
parmarjuli1412
 
Antepartum fetal surveillance---Dr. H.K.Cheema pdf.pdf
Antepartum fetal surveillance---Dr. H.K.Cheema pdf.pdfAntepartum fetal surveillance---Dr. H.K.Cheema pdf.pdf
Antepartum fetal surveillance---Dr. H.K.Cheema pdf.pdf
Dr H.K. Cheema
 
How To Maximize Sales Performance using Odoo 18 Diverse views in sales module
How To Maximize Sales Performance using Odoo 18 Diverse views in sales moduleHow To Maximize Sales Performance using Odoo 18 Diverse views in sales module
How To Maximize Sales Performance using Odoo 18 Diverse views in sales module
Celine George
 
INDIA QUIZ FOR SCHOOLS | THE QUIZ CLUB OF PSGCAS | AUGUST 2024
INDIA QUIZ FOR SCHOOLS | THE QUIZ CLUB OF PSGCAS | AUGUST 2024INDIA QUIZ FOR SCHOOLS | THE QUIZ CLUB OF PSGCAS | AUGUST 2024
INDIA QUIZ FOR SCHOOLS | THE QUIZ CLUB OF PSGCAS | AUGUST 2024
Quiz Club of PSG College of Arts & Science
 
libbys peer assesment.docx..............
libbys peer assesment.docx..............libbys peer assesment.docx..............
libbys peer assesment.docx..............
19lburrell
 
Peer Assesment- Libby.docx..............
Peer Assesment- Libby.docx..............Peer Assesment- Libby.docx..............
Peer Assesment- Libby.docx..............
19lburrell
 
Conditions for Boltzmann Law – Biophysics Lecture Slide
Conditions for Boltzmann Law – Biophysics Lecture SlideConditions for Boltzmann Law – Biophysics Lecture Slide
Conditions for Boltzmann Law – Biophysics Lecture Slide
PKLI-Institute of Nursing and Allied Health Sciences Lahore , Pakistan.
 
The Pedagogy We Practice: Best Practices for Critical Instructional Design
The Pedagogy We Practice: Best Practices for Critical Instructional DesignThe Pedagogy We Practice: Best Practices for Critical Instructional Design
The Pedagogy We Practice: Best Practices for Critical Instructional Design
Sean Michael Morris
 
The role of wall art in interior designing
The role of wall art in interior designingThe role of wall art in interior designing
The role of wall art in interior designing
meghaark2110
 
UPSA JUDGEMENT.pdfCopyright Infringement: High Court Rules against UPSA: A Wa...
UPSA JUDGEMENT.pdfCopyright Infringement: High Court Rules against UPSA: A Wa...UPSA JUDGEMENT.pdfCopyright Infringement: High Court Rules against UPSA: A Wa...
UPSA JUDGEMENT.pdfCopyright Infringement: High Court Rules against UPSA: A Wa...
businessweekghana
 
Dastur_ul_Amal under Jahangir Key Features.pptx
Dastur_ul_Amal under Jahangir Key Features.pptxDastur_ul_Amal under Jahangir Key Features.pptx
Dastur_ul_Amal under Jahangir Key Features.pptx
omorfaruqkazi
 
LDMMIA 2024 Crystal Gold Lecture 1 Bonus
LDMMIA 2024 Crystal Gold Lecture 1 BonusLDMMIA 2024 Crystal Gold Lecture 1 Bonus
LDMMIA 2024 Crystal Gold Lecture 1 Bonus
LDM & Mia eStudios
 
materi 3D Augmented Reality dengan assemblr
materi 3D Augmented Reality dengan assemblrmateri 3D Augmented Reality dengan assemblr
materi 3D Augmented Reality dengan assemblr
fatikhatunnajikhah1
 
Capitol Doctoral Presentation -May 2025.pptx
Capitol Doctoral Presentation -May 2025.pptxCapitol Doctoral Presentation -May 2025.pptx
Capitol Doctoral Presentation -May 2025.pptx
CapitolTechU
 
PUBH1000 Slides - Module 10: Health Promotion
PUBH1000 Slides - Module 10: Health PromotionPUBH1000 Slides - Module 10: Health Promotion
PUBH1000 Slides - Module 10: Health Promotion
JonathanHallett4
 
Rebuilding the library community in a post-Twitter world
Rebuilding the library community in a post-Twitter worldRebuilding the library community in a post-Twitter world
Rebuilding the library community in a post-Twitter world
Ned Potter
 
Module 1: Foundations of Research
Module 1: Foundations of ResearchModule 1: Foundations of Research
Module 1: Foundations of Research
drroxannekemp
 
20250515 Ntegra San Francisco 20250515 v15.pptx
20250515 Ntegra San Francisco 20250515 v15.pptx20250515 Ntegra San Francisco 20250515 v15.pptx
20250515 Ntegra San Francisco 20250515 v15.pptx
home
 
How to Configure Extra Steps During Checkout in Odoo 18 Website
How to Configure Extra Steps During Checkout in Odoo 18 WebsiteHow to Configure Extra Steps During Checkout in Odoo 18 Website
How to Configure Extra Steps During Checkout in Odoo 18 Website
Celine George
 
Mental Health Assessment in 5th semester bsc. nursing and also used in 2nd ye...
Mental Health Assessment in 5th semester bsc. nursing and also used in 2nd ye...Mental Health Assessment in 5th semester bsc. nursing and also used in 2nd ye...
Mental Health Assessment in 5th semester bsc. nursing and also used in 2nd ye...
parmarjuli1412
 
Antepartum fetal surveillance---Dr. H.K.Cheema pdf.pdf
Antepartum fetal surveillance---Dr. H.K.Cheema pdf.pdfAntepartum fetal surveillance---Dr. H.K.Cheema pdf.pdf
Antepartum fetal surveillance---Dr. H.K.Cheema pdf.pdf
Dr H.K. Cheema
 
How To Maximize Sales Performance using Odoo 18 Diverse views in sales module
How To Maximize Sales Performance using Odoo 18 Diverse views in sales moduleHow To Maximize Sales Performance using Odoo 18 Diverse views in sales module
How To Maximize Sales Performance using Odoo 18 Diverse views in sales module
Celine George
 
libbys peer assesment.docx..............
libbys peer assesment.docx..............libbys peer assesment.docx..............
libbys peer assesment.docx..............
19lburrell
 
Peer Assesment- Libby.docx..............
Peer Assesment- Libby.docx..............Peer Assesment- Libby.docx..............
Peer Assesment- Libby.docx..............
19lburrell
 
The Pedagogy We Practice: Best Practices for Critical Instructional Design
The Pedagogy We Practice: Best Practices for Critical Instructional DesignThe Pedagogy We Practice: Best Practices for Critical Instructional Design
The Pedagogy We Practice: Best Practices for Critical Instructional Design
Sean Michael Morris
 
The role of wall art in interior designing
The role of wall art in interior designingThe role of wall art in interior designing
The role of wall art in interior designing
meghaark2110
 
UPSA JUDGEMENT.pdfCopyright Infringement: High Court Rules against UPSA: A Wa...
UPSA JUDGEMENT.pdfCopyright Infringement: High Court Rules against UPSA: A Wa...UPSA JUDGEMENT.pdfCopyright Infringement: High Court Rules against UPSA: A Wa...
UPSA JUDGEMENT.pdfCopyright Infringement: High Court Rules against UPSA: A Wa...
businessweekghana
 
Dastur_ul_Amal under Jahangir Key Features.pptx
Dastur_ul_Amal under Jahangir Key Features.pptxDastur_ul_Amal under Jahangir Key Features.pptx
Dastur_ul_Amal under Jahangir Key Features.pptx
omorfaruqkazi
 
LDMMIA 2024 Crystal Gold Lecture 1 Bonus
LDMMIA 2024 Crystal Gold Lecture 1 BonusLDMMIA 2024 Crystal Gold Lecture 1 Bonus
LDMMIA 2024 Crystal Gold Lecture 1 Bonus
LDM & Mia eStudios
 
materi 3D Augmented Reality dengan assemblr
materi 3D Augmented Reality dengan assemblrmateri 3D Augmented Reality dengan assemblr
materi 3D Augmented Reality dengan assemblr
fatikhatunnajikhah1
 

Theory of Computation - Lectures 4 and 5

  • 1. Formal Definition of Computation Let M = (Q, ∑ , δ, q0, F) be a finite automaton and let w = w1w2.....wn be a string where each wi is a member of the alphabet ∑. Then M accepts w if a sequence of states r0, r1, ….,rn In Q exists with three conditions: 1- r0= q0, 2- δ(ri, wi+1)=ri+1, for i=0,...,n-1, and 3- rn∈ F
  • 2. Cont.    Condition 1 says that the machine starts in the start state. Condition 2 says that the machine goes from state to another according to the transition function Condition 3 says that the machine accepts its input if it ends up in an accept state. We say that M recognizes language A if A = {w | M accepts w}
  • 3. Regular Language  Definition: A language is called a regular language if some finite automaton recognizes it. See example 1.17 p. 41
  • 4. Designing Finite Automata    Just like artwork, design is a creative process... Suppose you are given some language, and you want to design a FA that recognizes it...pretend that you are the machine! Take symbols, one by one, and and after each symbol, you should decide whether the string so far is in the language or not.
  • 5. Designing Finite Automata –Cont.   What if the string is from earth to moon long? And your memory (as a FA) is like a sheet of paper? Worry-less, you will have to memorize the crucial info only, like: “What's my status now?” Example: suppose: alphabet = {0,1}, and that the language consists of all strings with an odd number of 1s. You want to construct a FA E1 to recognize this language
  • 6. Designing Finite Automata –Cont. By pretending that you're the FA, get the symbols (1 by 1), do you need to remember all the string? No! Just remembering the number of 1s so far is even or not is enough, so that if next is 0, don't change, if 1, change!  Therefore, you have 2 states, say: q odd, qeven.
  • 7. Designing Finite Automata –Cont.   Next, assign transitions. Assign a start state (qeven) in our example, since no symbol has been entered so far (0) and 0 is even.  What about Final state (accept)?  See example 1.21 - P.43
  • 8. Regular Operations  We use them to study properties of regular languages, those properties will help us develop a toolbox that will include ways of proving certain other languages are nonregular (i.e. beyond the capability of FA)
  • 9. Regular Operations  If A and B are languages, then:  Union: A∪B = {x|x ∈ A or x ∈ B}    Concatenation: A ○ B = {xy | x ∈ A and y ∈ B} Star: A* = {x1x2....xk | k>=0 and each xi∈A} The star operation is unary operation (on 1 language) while the union and conc. are binary operations
  • 10. Regular Operations – cont. Let ∑ = {a,b,....,z}, if A = {good, bad}, and B = {boy, girl} the: A ∪ B = {good, bad, boy, girl} A ○ B = {goodboy, goodgirl, badboy, badgirl} A*= {ε, good, bad, goodgood, badbad, badgood, goodgoodgood, goodgoodbad, etc.....}
  • 11. Regular Operations Cont.  Closed under multiplication: example, if x and y are two numbers from N, then x*y results a number also from N.   But N is not closed under division, because x/y may result a number which isn't member of N, ex. X=1, y=2, x/y=1/2 which isn't member of N Please read theorems 1.25, 1.26 p.45, 46
  • 12. Nondeterminism  DFA vs. NFA: DFA has exactly one exiting transition arrow for each symbol in the alphabet, NFA violets that.   DFA uses symbols from alphabet only for arrow labels, NFA may use others, such as ε. What will happen if a state has two arrows for same input? Or if input is ε?
  • 15. Formal definition of NFA    Similar to DFA, the NFA has the 5-tuple, yet the difference is in δ (The Transition Function) In DFA, δ takes a state and an input symbol and produces the next state. In NFA, δ takes a state and an an input symbol OR the empty string and produces the set of possible next states.
  • 16. Cont. Therefore, point 3 of the tuple would be as: δ : Q X ∑ε → P(Q), where ∑ε is the result of ∑ ∪ ε
  • 17. Example The formal definition of N1 (slide 13): 1- Q = {q1,q2,q3,q4} 2- ∑ = {0,1} 3- δ is given as: 4- q1 =start state 5- F ={q4} 0 1 ε q1 {q1} {q1,q2} Ф q2 {q3} Ф {q3} q3 Ф {q4} Ф q4 {q4} {q4} Ф
  • 18. Reading  Every NFA has an equivalent DFA... To prove, read P.54- P.58  Based on your previous reading (P.45), read Closure under the regular operations (P.58-63). Which is similar to, yet easier than example P.45.
  • 19. Regular Expressions   In math, we use + and x to build up expressions like: (5+3)x4 (Gives 32) Similarly, we use∪ and * to build up expressions describing languages, called Regular Expressions (RegEx): (0 ∪ 1)0* … (Gives a language) What does (0 ∪ 1)0* mean?  It's a language consisting of all strings starting with a 0 or 1 followed by any number of 0s.
  • 20. RegEx – Cont. (0 ∪ 1)0* is: - (0 ∪ 1) = ({0}∪{1}) = {0,1} - 0* means {0}*, means a language consisting of of any number of 0s. The concatenation between (0 ∪ 1) and 0* is a shorthand for for (0 ∪ 1) ○ 0*   Applications of RegEx: many, Grep (text-search)in Unix and Linux, Perl, C++, text editors etc.... In C++, you can use regex r("(+|-)?[[:digit:]]+");, but why?
  • 21. Regex- Example (0 ∪ 1)* = the language consisting of all possible strings of 0s and 1s. If ∑ ={0,1}, then ∑ is a shorthand for (0 ∪ 1).   Generally, if ∑ is any alphabet, the regex ∑ describes the language consisting of all strings of length 1 over the alphabet, and ∑* describes the language consisting of all strings over the alphabet. ∑*1 is the language that contains all strings that end with 1
  • 22. Regex- Example-cont.  The language (0∑*) ∪ (∑*1) consists of all strings that either start with a 0 or end with a 1. * similar to mathematical precedence ( x before + for example), in regex, * is done first ,then concatenation, finally the union. Unless parentheses are used.
  • 23. Formal Definition of regex  We say that R is a regex if R: 1. a for some a in the alphabet 2. ε, 3. ᶲ 4. (R1 ∪ R2) 5. (R1 ○ R2) 6. (R1*), where R1 is a regex
  翻译: