Finite Automata Theory and Formal Languages TMV027/DIT321 LP4 2018
|
|
- Christian Little
- 6 years ago
- Views:
Transcription
1 Finite Automt Theory nd Forml Lnguges TMV027/DIT321 LP Lecture 10 An Bove April 23rd 2018 Recp: Regulr Lnguges We cn convert between FA nd RE; Hence both FA nd RE ccept/generte regulr lnguges; More on lgebric lws for RE nd how to prove them; We use the Pumping lemm to show tht lnguge is NOT regulr; RL re closed under: Union, complement, intersection, difference, conctention, closure; Prefix, reversl; Closure properties cn be used both to prove tht lnguge IS regulr or tht lnguge is NOT regulr. April 23rd 2018, Lecture 10 TMV027/DIT321 1/25
2 Overview of Tody s Lecture Decision properties for RL; Equivlence of RL; Minimistion of utomt. Contributes to the following lerning outcome: Explin nd mnipulte the diff. concepts in utomt theory nd forml lng; Understnd the power nd the limittions of regulr lng nd context-free lng; Prove properties of lnguges, grmmrs nd utomt with rigorously forml mthemticl methods; Design utomt, regulr expressions nd context-free grmmrs ccepting or generting certin lnguge; Describe the lnguge ccepted by n utomt or generted by regulr expression or context-free grmmr; Simplify utomt nd context-free grmmrs; Determine if certin word belongs to lnguge; Differentite nd mnipulte forml descriptions of lng, utomt nd grmmrs. April 23rd 2018, Lecture 10 TMV027/DIT321 2/25 Decision Properties of Regulr Lnguges We wnt to be ble to nswer YES/NO to questions such s Is string w in the lnguge L? Is this lnguge empty? Are these 2 lnguges equivlent? In generl lnguges re infinite so we cnnot do mnul checking. Insted we work with the finite description of the lnguges (DFA, NFA. ǫ-nfa, RE). Which description is most convenient depends on the property nd on the lnguge. April 23rd 2018, Lecture 10 TMV027/DIT321 3/25
3 Testing Membership in Regulr Lnguges Given RL L nd word w over the lphbet of L, is w L? When L is given by FA we cn simply run the FA with the input w nd see if the word is ccepted by the FA. We hve seen n lgorithm simulting the running of DFA (nd you hve implemented lgorithms simulting the running of NFA nd ǫ-nfa, right? :-). Using derivtives (see exercises nd 4.2.5) there is nice lgorithm checking membership on RE. Let M = L(R) nd w = 1... n. Let \R = D R = {x x M} (in the book dm d ). D w R = D n (... (D 1 R)...). It cn then be shown tht w M iff ǫ D w R. April 23rd 2018, Lecture 10 TMV027/DIT321 4/25 Testing Emptiness of Regulr Lnguges given FA Given FA for lnguge, testing whether the lnguge is empty or not mounts to checking if there is pth from the strt stte to finl stte. Let D = (Q, Σ, δ, q 0, F ) be DFA. Recll the notion of ccessible sttes: Acc = {ˆδ(q 0, x) x Σ }. Proposition: Given D s bove, then D = (Q Acc, Σ, δ Q Acc, q 0, F Acc) is DFA such tht L(D) = L(D ). In prticulr, L(D) = if F Acc =. (Actully, L(D) = iff F Acc = since if ˆδ(q 0, x) F then ˆδ(q 0, x) F Acc.) April 23rd 2018, Lecture 10 TMV027/DIT321 5/25
4 Testing Emptiness of Regulr Lnguges given FA A recursive lgorithm to test whether stte is ccessible/rechble is s follows: Bse cse: The strt stte q 0 is rechble from q 0. Recursive step: If q is rechble from q 0 nd there is n rc from q to p (with ny lbel, including ǫ) then p is lso rechble from q 0. (This step is repeted until no new rechble stte is found.) (This lgorithm is n instnce of grph-rechbility.) If the set of rechble sttes contins t lest one finl stte then the RL is NOT empty. Exercise: Progrm this! April 23rd 2018, Lecture 10 TMV027/DIT321 6/25 Testing Emptiness of Regulr Lnguges given RE Given RE for the lnguge we cn insted define the function: isempty : RE Bool isempty( ) = True isempty(ǫ) = Flse isempty() = Flse isempty(r 1 + R 2 ) = isempty(r 1 ) isempty(r 2 ) isempty(r 1 R 2 ) = isempty(r 1 ) isempty(r 2 ) isempty(r ) = Flse April 23rd 2018, Lecture 10 TMV027/DIT321 7/25
5 Functionl Representtion of Testing Emptiness for RE dt RExp = Empty Epsilon Atom Plus (RExp ) (RExp ) Conct (RExp ) (RExp ) Str (RExp ) isempty :: RExp -> Bool isempty Empty = True isempty (Plus e1 e2) = isempty e1 && isempty e2 isempty (Conct e1 e2) = isempty e1 isempty e2 isempty _ = Flse April 23rd 2018, Lecture 10 TMV027/DIT321 8/25 Other Testing Algorithms on Regulr Expressions Tests if RE genertes ǫ. hsepsilon : RE Bool hsepsilon( ) = Flse hsepsilon(ǫ) = True hsepsilon() = Flse hsepsilon(r 1 + R 2 ) = hsepsilon(r 1 ) hsepsilon(r 2 ) hsepsilon(r 1 R 2 ) = hsepsilon(r 1 ) hsepsilon(r 2 ) hsepsilon(r ) = True April 23rd 2018, Lecture 10 TMV027/DIT321 9/25
6 Other Testing Algorithms on Regulr Expressions Tests if R genertes t most ǫ: L(R) {ǫ}. tmosteps : RE Bool tmosteps( ) = True tmosteps(ǫ) = True tmosteps() = Flse tmosteps(r 1 + R 2 ) = tmosteps(r 1 ) tmosteps(r 2 ) tmosteps(r 1 R 2 ) = isempty(r 1 ) isempty(r 2 ) (tmosteps(r 1 ) tmosteps(r 2 )) tmosteps(r ) = tmosteps(r) April 23rd 2018, Lecture 10 TMV027/DIT321 10/25 Other Testing Algorithms on Regulr Expressions Tests if regulr expression genertes n infinite lnguge. infinite : RE Bool infinite( ) = Flse infinite(ǫ) = Flse infimote() = Flse infinite(r 1 + R 2 ) = infinite(r 1 ) infinite(r 2 ) infinite(r 1 R 2 ) = (infinite(r 1 ) (isempty(r 2 )) ( (isempty(r 1 )) infinite(r 2 )) infinite(r ) = (tmosteps(r)) April 23rd 2018, Lecture 10 TMV027/DIT321 11/25
7 Testing Equivlence of Regulr Lnguges We hve seen how one cn prove tht 2 RE re equl, hence the lnguges they represent re equivlent (but this is not n esy process). We will see now how to test when 2 DFA describe the sme lnguge. April 23rd 2018, Lecture 10 TMV027/DIT321 12/25 Testing Equivlence of Sttes in DFA How to nswer the question do sttes p nd q behve in the sme wy? Definition: We sy tht sttes p nd q re equivlent if for ll w, ˆδ(p, w) is n ccepting stte iff ˆδ(q, w) is n ccepting stte. Note: We do not require tht ˆδ(p, w) = ˆδ(q, w)! Definition: If p nd q re not equivlent, then they re distinguishble. Tht is, there exists t lest one w such tht one of ˆδ(p, w) nd ˆδ(q, w) is n ccepting stte nd the other is not. April 23rd 2018, Lecture 10 TMV027/DIT321 13/25
8 Exmple: Identifying Distinguishble Pirs Let us find the distinguishble pirs in the following DFA. q 0 b q 1 q 2 b b q 3 q 4, b, b q 5, b q 0 q 1 q 2 q 3 q 4 q 5 X X X X X q 4 X X X q 3 X X X q 2 X X q 1 If p is ccepting nd q is not, then the word ǫ distinguish them. δ(q 1, ) = q 3 nd δ(q 5, ) = q 5. Since (q 3, q 5 ) is distinguishble so must be (q 1, q 5 ). Wht bout δ(q 2, ) nd δ(q 5, )? Wht bout the pirs (q 0, q 3 ) nd (q 0, q 4 ) with the input? Finlly, let us consider the pirs (q 3, q 4 ) nd (q 1, q 2 ). April 23rd 2018, Lecture 10 TMV027/DIT321 14/25 Tble-Filling Algorithm This lgorithm finds pirs of sttes tht re distinguishble. Any 2 sttes tht we do not find distinguishble re equivlent (see slide 17). Let D = (Q, Σ, δ, q 0, F ) be DFA. The tble-filling lgorithm is s follows: Bse cse: If p is n ccepting stte nd q is not, then (p, q) re distinguishble. Recursive step: Let p nd q be such tht for some, δ(p, ) = r nd δ(q, ) = s with (r, s) known to be distinguishble. Then (p, q) re lso distinguishble. (This step is repeted until no new distinguishble pir is found.) (If w distinguishes r nd s then w must distinguish p nd q since ˆδ(p, w) = ˆδ(r, w) nd ˆδ(q, w) = ˆδ(s, w).) April 23rd 2018, Lecture 10 TMV027/DIT321 15/25
9 Exmple: Tble-Filling Algorithm Let us fill the tble of distinguishble pirs in the following DFA. q 0 q 1 q 2 q 3 q 4 q 5 q 0 q 1 q 2 q 3 q 4 q 5 X X X X q 4 X X X q 3 X X q 2 X X q 1 X Let us consider the bse cse of the lgorithm. Let us consider the pir (q 0, q 5 ). Let us consider the pir (q 0, q 2 ). Let us consider (q 2, q 3 ) nd (q 3, q 5 ). Finlly, let us consider the remining pirs. April 23rd 2018, Lecture 10 TMV027/DIT321 16/25 Equivlent Sttes Theorem: Let D = (Q, Σ, δ, q 0, F ) be DFA. If 2 sttes re not distinguishble by the tble-filling lgorithm then the sttes re equivlent. Proof: Let us ssume there is bd pir (p, q) such tht p nd q re distinguishble but the tble-filling lgorithm doesn t find them so. If there re bd pirs, let (p, q ) be bd pir with the shortest string w = n tht distinguishes 2 sttes. Note w is not ǫ otherwise (p, q ) is found distinguishble in the bse step. Let δ(p, 1 ) = r nd δ(q, 1 ) = s. Sttes r nd s re distinguished by 2... n since this string tkes r to ˆδ(p, w) nd s to ˆδ(q, w). Now string 2... n distinguishes 2 sttes nd is shorter thn w which is the shortest string tht distinguishes bd pir. Then (r, s) cnnot be bd pir nd hence it must be found distinguishble by the lgorithm. Then the recursive step should hve found (p, q ) distinguishble. This contrdicts the ssumption tht bd pirs exist. April 23rd 2018, Lecture 10 TMV027/DIT321 17/25
10 Testing Equivlence of Regulr Lnguges We cn use the tble-filling lgorithm to test equivlence of regulr lnguges. Let M nd N be 2 regulr lnguges. Let D M = (Q M, Σ, δ M, q M, F M ) nd D N = (Q N, Σ, δ N, q N, F N ) be their corresponding DFA. Let us ssume Q M Q N = (esy to obtin by renming). Construct D = (Q M Q N, Σ, δ,, F M F N ) (initil stte irrelevnt). δ is the union of δ M nd δ N s function (we need to mke δ totl!). One should now check if the pir (q M, q N ) is equivlent. If so, string is ccepted by D M iff it is ccepted by D N. Hence M nd N re equivlent lnguges. April 23rd 2018, Lecture 10 TMV027/DIT321 18/25 Equivlence of Sttes: An Equivlence Reltion The reltion stte p is equivlent to stte q, denoted p q, is n equivlence reltion. Reflexive: p. p p; Symmetric: p q. p q q p; Trnsitive: p q r. p q q r p r. (See Theorem 4.23 for proof of the trnsitivity prt.) Exercise: Prove these properties! April 23rd 2018, Lecture 10 TMV027/DIT321 19/25
11 Prtition of Sttes Let D = (Q, Σ, δ, q 0, F ) be DFA. The tble-filling lgo. defines the equivlence of sttes reltion over Q. This is n equivlence reltion so we cn define the quotient Q/. This quotient gives us prtition into clsses of mutully equivlent sttes. Exmple: The prtition for the exmple in slide 14 is the following (note the singleton clsses!) {q 0 } {q 1, q 2 } {q 3, q 4 } {q 5 } Exmple: The prtition for the exmple in slide 16 is the following {q 0, q 3 } {q 1, q 4 } {q 2, q 5 } Note: Clsses might lso hve more thn 2 elements. April 23rd 2018, Lecture 10 TMV027/DIT321 20/25 Exmple: Minimistion of DFA How to use the prtition into clsses of equivlent sttes to minimise DFA? Exmple: The miniml DFA corresponding to the DFA in slide 14 is, b, b, b, b q 0 q 1 q 2 q 3 q 4 q 5 Exmple: The miniml DFA corresponding to the DFA in slide 16 is q 0 q 3 q 1 q 4 q 2 q 5 Exercise: Progrm the minimistion lgorithm! April 23rd 2018, Lecture 10 TMV027/DIT321 21/25
12 Minimistion of DFA: The Algorithm Let D = (Q, Σ, δ, q 0, F ) be DFA. Q/ llows to build n equivlent DFA with the minimum nr. of sttes. This minimum DFA is unique (modulo the nme of the sttes). The lgorithm for building the minimum DFA D = (Q, Σ, δ, q 0, F ) is: 1 Eliminte ny non ccessible stte; 2 Prtition the remining sttes using the tble-filling lgorithm; 3 Use ech clss s single stte in the new DFA; 4 The strt stte is the clss contining q 0 ; 5 The finl sttes re ll those clsses contining elements in F ; 6 δ (S, ) = T if given ny q S, δ(q, ) = p for some p T. (Actully, the prtition gurntees tht q S. p T. δ(q, ) = p.) April 23rd 2018, Lecture 10 TMV027/DIT321 22/25 Does the Minimistion Algorithm Give Miniml DFA? Given DFA D, the minimistion lgorithm gives us DFA D with the miniml number of sttes with respect to those of D. But, could there exist DFA A completely unrelted to D, lso ccepting the sme lnguge nd with less sttes thn those in D? Section in the book shows by contrdiction tht A cnnot exist. Theorem: If D is DFA nd D the DFA constructed from D with the minimistion lgorithm described before, then D hs s few sttes s ny DFA equivlent to D. April 23rd 2018, Lecture 10 TMV027/DIT321 23/25
13 Cn we Minimise NFA? One could find smller NFA, but not with this lgorithm. 0, 1 Exmple: Consider the following NFA q 0 0 q q 2 The tble-filling lgorithm does not find equivlent sttes in this cse. However, the following is smller nd equivlent NFA for the lnguge. 0, 1 q 0 0 q 1 April 23rd 2018, Lecture 10 TMV027/DIT321 24/25 Overview of Next Lecture Sections , nd notes on Inductive sets nd induction: Context-free grmmrs; Derivtions; Prse trees; Proofs in grmmrs. April 23rd 2018, Lecture 10 TMV027/DIT321 25/25
Theory of Computation Regular Languages. (NTU EE) Regular Languages Fall / 38
Theory of Computtion Regulr Lnguges (NTU EE) Regulr Lnguges Fll 2017 1 / 38 Schemtic of Finite Automt control 0 0 1 0 1 1 1 0 Figure: Schemtic of Finite Automt A finite utomton hs finite set of control
More informationTheory of Computation Regular Languages
Theory of Computtion Regulr Lnguges Bow-Yw Wng Acdemi Sinic Spring 2012 Bow-Yw Wng (Acdemi Sinic) Regulr Lnguges Spring 2012 1 / 38 Schemtic of Finite Automt control 0 0 1 0 1 1 1 0 Figure: Schemtic of
More informationMinimal DFA. minimal DFA for L starting from any other
Miniml DFA Among the mny DFAs ccepting the sme regulr lnguge L, there is exctly one (up to renming of sttes) which hs the smllest possile numer of sttes. Moreover, it is possile to otin tht miniml DFA
More informationHarvard University Computer Science 121 Midterm October 23, 2012
Hrvrd University Computer Science 121 Midterm Octoer 23, 2012 This is closed-ook exmintion. You my use ny result from lecture, Sipser, prolem sets, or section, s long s you quote it clerly. The lphet is
More informationAssignment 1 Automata, Languages, and Computability. 1 Finite State Automata and Regular Languages
Deprtment of Computer Science, Austrlin Ntionl University COMP2600 Forml Methods for Softwre Engineering Semester 2, 206 Assignment Automt, Lnguges, nd Computility Smple Solutions Finite Stte Automt nd
More informationFinite Automata-cont d
Automt Theory nd Forml Lnguges Professor Leslie Lnder Lecture # 6 Finite Automt-cont d The Pumping Lemm WEB SITE: http://ingwe.inghmton.edu/ ~lnder/cs573.html Septemer 18, 2000 Exmple 1 Consider L = {ww
More information1. For each of the following theorems, give a two or three sentence sketch of how the proof goes or why it is not true.
York University CSE 2 Unit 3. DFA Clsses Converting etween DFA, NFA, Regulr Expressions, nd Extended Regulr Expressions Instructor: Jeff Edmonds Don t chet y looking t these nswers premturely.. For ech
More informationLecture 08: Feb. 08, 2019
4CS4-6:Theory of Computtion(Closure on Reg. Lngs., regex to NDFA, DFA to regex) Prof. K.R. Chowdhry Lecture 08: Fe. 08, 2019 : Professor of CS Disclimer: These notes hve not een sujected to the usul scrutiny
More informationNFAs and Regular Expressions. NFA-ε, continued. Recall. Last class: Today: Fun:
CMPU 240 Lnguge Theory nd Computtion Spring 2019 NFAs nd Regulr Expressions Lst clss: Introduced nondeterministic finite utomt with -trnsitions Tody: Prove n NFA- is no more powerful thn n NFA Introduce
More informationFormal languages, automata, and theory of computation
Mälrdlen University TEN1 DVA337 2015 School of Innovtion, Design nd Engineering Forml lnguges, utomt, nd theory of computtion Thursdy, Novemer 5, 14:10-18:30 Techer: Dniel Hedin, phone 021-107052 The exm
More informationHomework 4. 0 ε 0. (00) ε 0 ε 0 (00) (11) CS 341: Foundations of Computer Science II Prof. Marvin Nakayama
CS 341: Foundtions of Computer Science II Prof. Mrvin Nkym Homework 4 1. UsetheproceduredescriedinLemm1.55toconverttheregulrexpression(((00) (11)) 01) into n NFA. Answer: 0 0 1 1 00 0 0 11 1 1 01 0 1 (00)
More informationAnatomy of a Deterministic Finite Automaton. Deterministic Finite Automata. A machine so simple that you can understand it in less than one minute
Victor Admchik Dnny Sletor Gret Theoreticl Ides In Computer Science CS 5-25 Spring 2 Lecture 2 Mr 3, 2 Crnegie Mellon University Deterministic Finite Automt Finite Automt A mchine so simple tht you cn
More informationFinite Automata. Informatics 2A: Lecture 3. John Longley. 22 September School of Informatics University of Edinburgh
Lnguges nd Automt Finite Automt Informtics 2A: Lecture 3 John Longley School of Informtics University of Edinburgh jrl@inf.ed.c.uk 22 September 2017 1 / 30 Lnguges nd Automt 1 Lnguges nd Automt Wht is
More information1.3 Regular Expressions
56 1.3 Regulr xpressions These hve n importnt role in describing ptterns in serching for strings in mny pplictions (e.g. wk, grep, Perl,...) All regulr expressions of lphbet re 1.Ønd re regulr expressions,
More information1.4 Nonregular Languages
74 1.4 Nonregulr Lnguges The number of forml lnguges over ny lphbet (= decision/recognition problems) is uncountble On the other hnd, the number of regulr expressions (= strings) is countble Hence, ll
More informationFinite-State Automata: Recap
Finite-Stte Automt: Recp Deepk D Souz Deprtment of Computer Science nd Automtion Indin Institute of Science, Bnglore. 09 August 2016 Outline 1 Introduction 2 Forml Definitions nd Nottion 3 Closure under
More informationNon-Deterministic Finite Automata. Fall 2018 Costas Busch - RPI 1
Non-Deterministic Finite Automt Fll 2018 Costs Busch - RPI 1 Nondeterministic Finite Automton (NFA) Alphbet ={} q q2 1 q 0 q 3 Fll 2018 Costs Busch - RPI 2 Nondeterministic Finite Automton (NFA) Alphbet
More informationCS 301. Lecture 04 Regular Expressions. Stephen Checkoway. January 29, 2018
CS 301 Lecture 04 Regulr Expressions Stephen Checkowy Jnury 29, 2018 1 / 35 Review from lst time NFA N = (Q, Σ, δ, q 0, F ) where δ Q Σ P (Q) mps stte nd n lphet symol (or ) to set of sttes We run n NFA
More informationNon Deterministic Automata. Linz: Nondeterministic Finite Accepters, page 51
Non Deterministic Automt Linz: Nondeterministic Finite Accepters, pge 51 1 Nondeterministic Finite Accepter (NFA) Alphbet ={} q 1 q2 q 0 q 3 2 Nondeterministic Finite Accepter (NFA) Alphbet ={} Two choices
More informationNondeterminism. Nondeterministic Finite Automata. Example: Moves on a Chessboard. Nondeterminism (2) Example: Chessboard (2) Formal NFA
Nondeterminism Nondeterministic Finite Automt Nondeterminism Subset Construction A nondeterministic finite utomton hs the bility to be in severl sttes t once. Trnsitions from stte on n input symbol cn
More informationNon-deterministic Finite Automata
Non-deterministic Finite Automt Eliminting non-determinism Rdoud University Nijmegen Non-deterministic Finite Automt H. Geuvers nd T. vn Lrhoven Institute for Computing nd Informtion Sciences Intelligent
More informationGNFA GNFA GNFA GNFA GNFA
DFA RE NFA DFA -NFA REX GNFA Definition GNFA A generlize noneterministic finite utomton (GNFA) is grph whose eges re lele y regulr expressions, with unique strt stte with in-egree, n unique finl stte with
More informationCS:4330 Theory of Computation Spring Regular Languages. Equivalences between Finite automata and REs. Haniel Barbosa
CS:4330 Theory of Computtion Spring 208 Regulr Lnguges Equivlences between Finite utomt nd REs Hniel Brbos Redings for this lecture Chpter of [Sipser 996], 3rd edition. Section.3. Finite utomt nd regulr
More informationNFAs continued, Closure Properties of Regular Languages
Algorithms & Models of Computtion CS/ECE 374, Fll 2017 NFAs continued, Closure Properties of Regulr Lnguges Lecture 5 Tuesdy, Septemer 12, 2017 Sriel Hr-Peled (UIUC) CS374 1 Fll 2017 1 / 31 Regulr Lnguges,
More informationCMSC 330: Organization of Programming Languages. DFAs, and NFAs, and Regexps (Oh my!)
CMSC 330: Orgniztion of Progrmming Lnguges DFAs, nd NFAs, nd Regexps (Oh my!) CMSC330 Spring 2018 Types of Finite Automt Deterministic Finite Automt (DFA) Exctly one sequence of steps for ech string All
More informationState Minimization for DFAs
Stte Minimiztion for DFAs Red K & S 2.7 Do Homework 10. Consider: Stte Minimiztion 4 5 Is this miniml mchine? Step (1): Get rid of unrechle sttes. Stte Minimiztion 6, Stte is unrechle. Step (2): Get rid
More informationCSCI 340: Computational Models. Kleene s Theorem. Department of Computer Science
CSCI 340: Computtionl Models Kleene s Theorem Chpter 7 Deprtment of Computer Science Unifiction In 1954, Kleene presented (nd proved) theorem which (in our version) sttes tht if lnguge cn e defined y ny
More informationCMSC 330: Organization of Programming Languages
CMSC 330: Orgniztion of Progrmming Lnguges Finite Automt 2 CMSC 330 1 Types of Finite Automt Deterministic Finite Automt (DFA) Exctly one sequence of steps for ech string All exmples so fr Nondeterministic
More informationNon-deterministic Finite Automata
Non-deterministic Finite Automt From Regulr Expressions to NFA- Eliminting non-determinism Rdoud University Nijmegen Non-deterministic Finite Automt H. Geuvers nd J. Rot Institute for Computing nd Informtion
More informationCS 330 Formal Methods and Models
CS 330 Forml Methods nd Models Dn Richrds, George Mson University, Spring 2017 Quiz Solutions Quiz 1, Propositionl Logic Dte: Ferury 2 1. Prove ((( p q) q) p) is tutology () (3pts) y truth tle. p q p q
More informationFinite Automata. Informatics 2A: Lecture 3. Mary Cryan. 21 September School of Informatics University of Edinburgh
Finite Automt Informtics 2A: Lecture 3 Mry Cryn School of Informtics University of Edinburgh mcryn@inf.ed.c.uk 21 September 2018 1 / 30 Lnguges nd Automt Wht is lnguge? Finite utomt: recp Some forml definitions
More informationRecursively Enumerable and Recursive. Languages
Recursively Enumerble nd Recursive nguges 1 Recll Definition (clss 19.pdf) Definition 10.4, inz, 6 th, pge 279 et S be set of strings. An enumertion procedure for Turing Mchine tht genertes ll strings
More informationFirst Midterm Examination
Çnky University Deprtment of Computer Engineering 203-204 Fll Semester First Midterm Exmintion ) Design DFA for ll strings over the lphet Σ = {,, c} in which there is no, no nd no cc. 2) Wht lnguge does
More informationDeterministic Finite Automata
Finite Automt Deterministic Finite Automt H. Geuvers nd J. Rot Institute for Computing nd Informtion Sciences Version: fll 2016 J. Rot Version: fll 2016 Tlen en Automten 1 / 21 Outline Finite Automt Finite
More informationClosure Properties of Regular Languages
Closure Properties of Regulr Lnguges Regulr lnguges re closed under mny set opertions. Let L 1 nd L 2 e regulr lnguges. (1) L 1 L 2 (the union) is regulr. (2) L 1 L 2 (the conctention) is regulr. (3) L
More informationTypes of Finite Automata. CMSC 330: Organization of Programming Languages. Comparing DFAs and NFAs. Comparing DFAs and NFAs (cont.) Finite Automata 2
CMSC 330: Orgniztion of Progrmming Lnguges Finite Automt 2 Types of Finite Automt Deterministic Finite Automt () Exctly one sequence of steps for ech string All exmples so fr Nondeterministic Finite Automt
More informationRegular expressions, Finite Automata, transition graphs are all the same!!
CSI 3104 /Winter 2011: Introduction to Forml Lnguges Chpter 7: Kleene s Theorem Chpter 7: Kleene s Theorem Regulr expressions, Finite Automt, trnsition grphs re ll the sme!! Dr. Neji Zgui CSI3104-W11 1
More informationJava II Finite Automata I
Jv II Finite Automt I Bernd Kiefer Bernd.Kiefer@dfki.de Deutsches Forschungszentrum für künstliche Intelligenz Finite Automt I p.1/13 Processing Regulr Expressions We lredy lerned out Jv s regulr expression
More informationFundamentals of Computer Science
Fundmentls of Computer Science Chpter 3: NFA nd DFA equivlence Regulr expressions Henrik Björklund Umeå University Jnury 23, 2014 NFA nd DFA equivlence As we shll see, it turns out tht NFA nd DFA re equivlent,
More informationCS375: Logic and Theory of Computing
CS375: Logic nd Theory of Computing Fuhu (Frnk) Cheng Deprtment of Computer Science University of Kentucky 1 Tble of Contents: Week 1: Preliminries (set lgebr, reltions, functions) (red Chpters 1-4) Weeks
More informationGrammar. Languages. Content 5/10/16. Automata and Languages. Regular Languages. Regular Languages
5//6 Grmmr Automt nd Lnguges Regulr Grmmr Context-free Grmmr Context-sensitive Grmmr Prof. Mohmed Hmd Softwre Engineering L. The University of Aizu Jpn Regulr Lnguges Context Free Lnguges Context Sensitive
More informationTypes of Finite Automata. CMSC 330: Organization of Programming Languages. Comparing DFAs and NFAs. NFA for (a b)*abb.
CMSC 330: Orgniztion of Progrmming Lnguges Finite Automt 2 Types of Finite Automt Deterministic Finite Automt () Exctly one sequence of steps for ech string All exmples so fr Nondeterministic Finite Automt
More informationAutomata and Languages
Automt nd Lnguges Prof. Mohmed Hmd Softwre Engineering Lb. The University of Aizu Jpn Grmmr Regulr Grmmr Context-free Grmmr Context-sensitive Grmmr Regulr Lnguges Context Free Lnguges Context Sensitive
More informationFirst Midterm Examination
24-25 Fll Semester First Midterm Exmintion ) Give the stte digrm of DFA tht recognizes the lnguge A over lphet Σ = {, } where A = {w w contins or } 2) The following DFA recognizes the lnguge B over lphet
More informationMore on automata. Michael George. March 24 April 7, 2014
More on utomt Michel George Mrch 24 April 7, 2014 1 Automt constructions Now tht we hve forml model of mchine, it is useful to mke some generl constructions. 1.1 DFA Union / Product construction Suppose
More informationAUTOMATA AND LANGUAGES. Definition 1.5: Finite Automaton
25. Finite Automt AUTOMATA AND LANGUAGES A system of computtion tht only hs finite numer of possile sttes cn e modeled using finite utomton A finite utomton is often illustrted s stte digrm d d d. d q
More informationFABER Formal Languages, Automata and Models of Computation
DVA337 FABER Forml Lnguges, Automt nd Models of Computtion Lecture 5 chool of Innovtion, Design nd Engineering Mälrdlen University 2015 1 Recp of lecture 4 y definition suset construction DFA NFA stte
More informationCHAPTER 1 Regular Languages. Contents. definitions, examples, designing, regular operations. Non-deterministic Finite Automata (NFA)
Finite Automt (FA or DFA) CHAPTER Regulr Lnguges Contents definitions, exmples, designing, regulr opertions Non-deterministic Finite Automt (NFA) definitions, equivlence of NFAs DFAs, closure under regulr
More informationHomework Solution - Set 5 Due: Friday 10/03/08
CE 96 Introduction to the Theory of Computtion ll 2008 Homework olution - et 5 Due: ridy 10/0/08 1. Textook, Pge 86, Exercise 1.21. () 1 2 Add new strt stte nd finl stte. Mke originl finl stte non-finl.
More informationCS 330 Formal Methods and Models
CS 330 Forml Methods nd Models Dn Richrds, section 003, George Mson University, Fll 2017 Quiz Solutions Quiz 1, Propositionl Logic Dte: Septemer 7 1. Prove (p q) (p q), () (5pts) using truth tles. p q
More informationLexical Analysis Finite Automate
Lexicl Anlysis Finite Automte CMPSC 470 Lecture 04 Topics: Deterministic Finite Automt (DFA) Nondeterministic Finite Automt (NFA) Regulr Expression NFA DFA A. Finite Automt (FA) FA re grph, like trnsition
More informationMyhill-Nerode Theorem
Overview Myhill-Nerode Theorem Correspondence etween DA s nd MN reltions Cnonicl DA for L Computing cnonicl DFA Myhill-Nerode Theorem Deepk D Souz Deprtment of Computer Science nd Automtion Indin Institute
More informationNondeterminism and Nodeterministic Automata
Nondeterminism nd Nodeterministic Automt 61 Nondeterminism nd Nondeterministic Automt The computtionl mchine models tht we lerned in the clss re deterministic in the sense tht the next move is uniquely
More informationHomework 3 Solutions
CS 341: Foundtions of Computer Science II Prof. Mrvin Nkym Homework 3 Solutions 1. Give NFAs with the specified numer of sttes recognizing ech of the following lnguges. In ll cses, the lphet is Σ = {,1}.
More informationCS 275 Automata and Formal Language Theory
CS 275 Automt nd Forml Lnguge Theory Course Notes Prt II: The Recognition Problem (II) Chpter II.5.: Properties of Context Free Grmmrs (14) Anton Setzer (Bsed on book drft by J. V. Tucker nd K. Stephenson)
More information5. (±±) Λ = fw j w is string of even lengthg [ 00 = f11,00g 7. (11 [ 00)± Λ = fw j w egins with either 11 or 00g 8. (0 [ ffl)1 Λ = 01 Λ [ 1 Λ 9.
Regulr Expressions, Pumping Lemm, Right Liner Grmmrs Ling 106 Mrch 25, 2002 1 Regulr Expressions A regulr expression descries or genertes lnguge: it is kind of shorthnd for listing the memers of lnguge.
More informationIntermediate Math Circles Wednesday, November 14, 2018 Finite Automata II. Nickolas Rollick a b b. a b 4
Intermedite Mth Circles Wednesdy, Novemer 14, 2018 Finite Automt II Nickols Rollick nrollick@uwterloo.c Regulr Lnguges Lst time, we were introduced to the ide of DFA (deterministic finite utomton), one
More informationNFA DFA Example 3 CMSC 330: Organization of Programming Languages. Equivalence of DFAs and NFAs. Equivalence of DFAs and NFAs (cont.
NFA DFA Exmple 3 CMSC 330: Orgniztion of Progrmming Lnguges NFA {B,D,E {A,E {C,D {E Finite Automt, con't. R = { {A,E, {B,D,E, {C,D, {E 2 Equivlence of DFAs nd NFAs Any string from {A to either {D or {CD
More informationCS415 Compilers. Lexical Analysis and. These slides are based on slides copyrighted by Keith Cooper, Ken Kennedy & Linda Torczon at Rice University
CS415 Compilers Lexicl Anlysis nd These slides re sed on slides copyrighted y Keith Cooper, Ken Kennedy & Lind Torczon t Rice University First Progrmming Project Instruction Scheduling Project hs een posted
More informationCSC 473 Automata, Grammars & Languages 11/9/10
CSC 473 utomt, Grmmrs & Lnguges 11/9/10 utomt, Grmmrs nd Lnguges Discourse 06 Decidbility nd Undecidbility Decidble Problems for Regulr Lnguges Theorem 4.1: (embership/cceptnce Prob. for DFs) = {, w is
More informationCoalgebra, Lecture 15: Equations for Deterministic Automata
Colger, Lecture 15: Equtions for Deterministic Automt Julin Slmnc (nd Jurrin Rot) Decemer 19, 2016 In this lecture, we will study the concept of equtions for deterministic utomt. The notes re self contined
More informationFormal Language and Automata Theory (CS21004)
Forml Lnguge nd Automt Forml Lnguge nd Automt Theory (CS21004) Khrgpur Khrgpur Khrgpur Forml Lnguge nd Automt Tle of Contents Forml Lnguge nd Automt Khrgpur 1 2 3 Khrgpur Forml Lnguge nd Automt Forml Lnguge
More informationFormal Languages and Automata
Moile Computing nd Softwre Engineering p. 1/5 Forml Lnguges nd Automt Chpter 2 Finite Automt Chun-Ming Liu cmliu@csie.ntut.edu.tw Deprtment of Computer Science nd Informtion Engineering Ntionl Tipei University
More informationCS 275 Automata and Formal Language Theory
CS 275 utomt nd Forml Lnguge Theory Course Notes Prt II: The Recognition Prolem (II) Chpter II.5.: Properties of Context Free Grmmrs (14) nton Setzer (Bsed on ook drft y J. V. Tucker nd K. Stephenson)
More informationCS311 Computational Structures Regular Languages and Regular Grammars. Lecture 6
CS311 Computtionl Strutures Regulr Lnguges nd Regulr Grmmrs Leture 6 1 Wht we know so fr: RLs re losed under produt, union nd * Every RL n e written s RE, nd every RE represents RL Every RL n e reognized
More informationCMPSCI 250: Introduction to Computation. Lecture #31: What DFA s Can and Can t Do David Mix Barrington 9 April 2014
CMPSCI 250: Introduction to Computtion Lecture #31: Wht DFA s Cn nd Cn t Do Dvid Mix Brrington 9 April 2014 Wht DFA s Cn nd Cn t Do Deterministic Finite Automt Forml Definition of DFA s Exmples of DFA
More informationAutomata Theory 101. Introduction. Outline. Introduction Finite Automata Regular Expressions ω-automata. Ralf Huuck.
Outline Automt Theory 101 Rlf Huuck Introduction Finite Automt Regulr Expressions ω-automt Session 1 2006 Rlf Huuck 1 Session 1 2006 Rlf Huuck 2 Acknowledgement Some slides re sed on Wolfgng Thoms excellent
More informationChapter Five: Nondeterministic Finite Automata. Formal Language, chapter 5, slide 1
Chpter Five: Nondeterministic Finite Automt Forml Lnguge, chpter 5, slide 1 1 A DFA hs exctly one trnsition from every stte on every symol in the lphet. By relxing this requirement we get relted ut more
More informationChapter 2 Finite Automata
Chpter 2 Finite Automt 28 2.1 Introduction Finite utomt: first model of the notion of effective procedure. (They lso hve mny other pplictions). The concept of finite utomton cn e derived y exmining wht
More informationConvert the NFA into DFA
Convert the NF into F For ech NF we cn find F ccepting the sme lnguge. The numer of sttes of the F could e exponentil in the numer of sttes of the NF, ut in prctice this worst cse occurs rrely. lgorithm:
More informationClosure Properties of Regular Languages
of Regulr Lnguges Dr. Neil T. Dntm CSCI-561, Colordo School of Mines Fll 2018 Dntm (Mines CSCI-561) Closure Properties of Regulr Lnguges Fll 2018 1 / 50 Outline Introduction Closure Properties Stte Minimiztion
More informationCHAPTER 1 Regular Languages. Contents
Finite Automt (FA or DFA) CHAPTE 1 egulr Lnguges Contents definitions, exmples, designing, regulr opertions Non-deterministic Finite Automt (NFA) definitions, euivlence of NFAs nd DFAs, closure under regulr
More informationHandout: Natural deduction for first order logic
MATH 457 Introduction to Mthemticl Logic Spring 2016 Dr Json Rute Hndout: Nturl deduction for first order logic We will extend our nturl deduction rules for sententil logic to first order logic These notes
More informationConverting Regular Expressions to Discrete Finite Automata: A Tutorial
Converting Regulr Expressions to Discrete Finite Automt: A Tutoril Dvid Christinsen 2013-01-03 This is tutoril on how to convert regulr expressions to nondeterministic finite utomt (NFA) nd how to convert
More informationTalen en Automaten Test 1, Mon 7 th Dec, h45 17h30
Tlen en Automten Test 1, Mon 7 th Dec, 2015 15h45 17h30 This test consists of four exercises over 5 pges. Explin your pproch, nd write your nswer to ech exercise on seprte pge. You cn score mximum of 100
More informationDFA minimisation using the Myhill-Nerode theorem
DFA minimistion using the Myhill-Nerode theorem Johnn Högerg Lrs Lrsson Astrct The Myhill-Nerode theorem is n importnt chrcteristion of regulr lnguges, nd it lso hs mny prcticl implictions. In this chpter,
More information1 Structural induction, finite automata, regular expressions
Discrete Structures Prelim 2 smple uestions s CS2800 Questions selected for spring 2017 1 Structurl induction, finite utomt, regulr expressions 1. We define set S of functions from Z to Z inductively s
More informationSpeech Recognition Lecture 2: Finite Automata and Finite-State Transducers. Mehryar Mohri Courant Institute and Google Research
Speech Recognition Lecture 2: Finite Automt nd Finite-Stte Trnsducers Mehryr Mohri Cournt Institute nd Google Reserch mohri@cims.nyu.com Preliminries Finite lphet Σ, empty string. Set of ll strings over
More informationSpeech Recognition Lecture 2: Finite Automata and Finite-State Transducers
Speech Recognition Lecture 2: Finite Automt nd Finite-Stte Trnsducers Eugene Weinstein Google, NYU Cournt Institute eugenew@cs.nyu.edu Slide Credit: Mehryr Mohri Preliminries Finite lphet, empty string.
More informationFor convenience, we rewrite m2 s m2 = m m m ; where m is repeted m times. Since xyz = m m m nd jxyj»m, we hve tht the string y is substring of the fir
CSCI 2400 Models of Computtion, Section 3 Solutions to Homework 4 Problem 1. ll the solutions below refer to the Pumping Lemm of Theorem 4.8, pge 119. () L = f n b l k : k n + lg Let's ssume for contrdiction
More information1 From NFA to regular expression
Note 1: How to convert DFA/NFA to regulr expression Version: 1.0 S/EE 374, Fll 2017 Septemer 11, 2017 In this note, we show tht ny DFA cn e converted into regulr expression. Our construction would work
More informationLet's start with an example:
Finite Automt Let's strt with n exmple: Here you see leled circles tht re sttes, nd leled rrows tht re trnsitions. One of the sttes is mrked "strt". One of the sttes hs doule circle; this is terminl stte
More informationCS 330 Formal Methods and Models Dana Richards, George Mason University, Spring 2016 Quiz Solutions
CS 330 Forml Methods nd Models Dn Richrds, George Mson University, Spring 2016 Quiz Solutions Quiz 1, Propositionl Logic Dte: Ferury 9 1. (4pts) ((p q) (q r)) (p r), prove tutology using truth tles. p
More informationNFAs continued, Closure Properties of Regular Languages
lgorithms & Models of omputtion S/EE 374, Spring 209 NFs continued, losure Properties of Regulr Lnguges Lecture 5 Tuesdy, Jnury 29, 209 Regulr Lnguges, DFs, NFs Lnguges ccepted y DFs, NFs, nd regulr expressions
More informationLecture 6 Regular Grammars
Lecture 6 Regulr Grmmrs COT 4420 Theory of Computtion Section 3.3 Grmmr A grmmr G is defined s qudruple G = (V, T, S, P) V is finite set of vribles T is finite set of terminl symbols S V is specil vrible
More informationCISC 4090 Theory of Computation
9/6/28 Stereotypicl computer CISC 49 Theory of Computtion Finite stte mchines & Regulr lnguges Professor Dniel Leeds dleeds@fordhm.edu JMH 332 Centrl processing unit (CPU) performs ll the instructions
More informationProbabilistic Model Checking Michaelmas Term Dr. Dave Parker. Department of Computer Science University of Oxford
Probbilistic Model Checking Michelms Term 2011 Dr. Dve Prker Deprtment of Computer Science University of Oxford Long-run properties Lst lecture: regulr sfety properties e.g. messge filure never occurs
More informationCS 373, Spring Solutions to Mock midterm 1 (Based on first midterm in CS 273, Fall 2008.)
CS 373, Spring 29. Solutions to Mock midterm (sed on first midterm in CS 273, Fll 28.) Prolem : Short nswer (8 points) The nswers to these prolems should e short nd not complicted. () If n NF M ccepts
More informationCS375: Logic and Theory of Computing
CS375: Logic nd Theory of Computing Fuhu (Frnk) Cheng Deprtment of Computer Science University of Kentucky 1 Tle of Contents: Week 1: Preliminries (set lger, reltions, functions) (red Chpters 1-4) Weeks
More information(e) if x = y + z and a divides any two of the integers x, y, or z, then a divides the remaining integer
Divisibility In this note we introduce the notion of divisibility for two integers nd b then we discuss the division lgorithm. First we give forml definition nd note some properties of the division opertion.
More information1. For each of the following theorems, give a two or three sentence sketch of how the proof goes or why it is not true.
York University CSE 2 Unit 3. DFA Clsses Converting etween DFA, NFA, Regulr Expressions, nd Extended Regulr Expressions Instructor: Jeff Edmonds Don t chet y looking t these nswers premturely.. For ech
More informationCSE : Exam 3-ANSWERS, Spring 2011 Time: 50 minutes
CSE 260-002: Exm 3-ANSWERS, Spring 20 ime: 50 minutes Nme: his exm hs 4 pges nd 0 prolems totling 00 points. his exm is closed ook nd closed notes.. Wrshll s lgorithm for trnsitive closure computtion is
More informationCSCI FOUNDATIONS OF COMPUTER SCIENCE
1 CSCI- 2200 FOUNDATIONS OF COMPUTER SCIENCE Spring 2015 My 7, 2015 2 Announcements Homework 9 is due now. Some finl exm review problems will be posted on the web site tody. These re prcqce problems not
More informationCS 330 Formal Methods and Models
CS 0 Forml Methods nd Models Dn Richrds, George Mson University, Fll 2016 Quiz Solutions Quiz 1, Propositionl Logic Dte: Septemer 8 1. Prove q (q p) p q p () (4pts) with truth tle. p q p q p (q p) p q
More informationDFA Minimization and Applications
DFA Minimiztion nd Applictions Mondy, Octoer 15, 2007 Reding: toughton 3.12 C235 Lnguges nd Automt Deprtment of Computer cience Wellesley College Gols for ody o Answer ny P3 questions you might hve. o
More information1 Structural induction
Discrete Structures Prelim 2 smple questions Solutions CS2800 Questions selected for Spring 2018 1 Structurl induction 1. We define set S of functions from Z to Z inductively s follows: Rule 1. For ny
More informationNon Deterministic Automata. Formal Languages and Automata - Yonsei CS 1
Non Deterministic Automt Forml Lnguges nd Automt - Yonsei CS 1 Nondeterministic Finite Accepter (NFA) We llow set of possible moves insted of A unique move. Alphbet = {} Two choices q 1 q2 Forml Lnguges
More informationUNIFORM CONVERGENCE. Contents 1. Uniform Convergence 1 2. Properties of uniform convergence 3
UNIFORM CONVERGENCE Contents 1. Uniform Convergence 1 2. Properties of uniform convergence 3 Suppose f n : Ω R or f n : Ω C is sequence of rel or complex functions, nd f n f s n in some sense. Furthermore,
More informationCS 311 Homework 3 due 16:30, Thursday, 14 th October 2010
CS 311 Homework 3 due 16:30, Thursdy, 14 th Octoer 2010 Homework must e sumitted on pper, in clss. Question 1. [15 pts.; 5 pts. ech] Drw stte digrms for NFAs recognizing the following lnguges:. L = {w
More informationa,b a 1 a 2 a 3 a,b 1 a,b a,b 2 3 a,b a,b a 2 a,b CS Determinisitic Finite Automata 1
CS4 45- Determinisitic Finite Automt -: Genertors vs. Checkers Regulr expressions re one wy to specify forml lnguge String Genertor Genertes strings in the lnguge Deterministic Finite Automt (DFA) re nother
More information