Course Mteril CS 301 - Lecture 1 Determiistic Fiite Automt Fll 2008 Wesite:http://www.cs.colostte.edu/~cs301 Syllus, Outlie, Grdig Policies Homework d Slides Istructor: D Mssey Office hours: 2-3pm Tues d Wed Emil: mssey@cs.colostte.edu Techig Assistt: Willim Spriger Emil: wmsprig@cs.colostte.edu Grdig d Policies Grdig 10% Homework 30% Quizes 30% Midterm 30% Fil Grdig Policy No credit for lte homework. No exceptios. No credit for missed exms. No mke-up exms. Worklod Weekly Redig Assigmets Course will cover most of oth ooks Weekly Homework Assigmets Aville from course wesite y Fridy morig Due i lecture the followig Thursdy Exms Midterm + fil (comprehesive) I clss, closed ook, oe doule-sided chet sheet llowed 1
Admiistrtive You re resposile for kowig course, deprtmet, d uiversity policies READ THE SYLLABUS PROVIDES LINKS TO DEPT POLICIES Plgirism see defiitio http://writig.colostte.edu/guides/techig/ plgirism/ Coflict Resolutio we site http://www.coflictresolutio.colostte.edu/ Aout These Slides Slides Origilly Developed y Prof. Costs Busch (2004) My thks to Prof. Busch for developig the origil slide set. Adpted with permissio y Prof. D Mssey (Sprig 2007) Susequet modifictios Lguges A lguge is set of strigs Strig: A sequece of letters Exmples: ct, dog, house, Defied over lphet: Σ {,, c,, z} Alphets d Strigs We will use smll lphets: Strigs Σ { } u v w 2
Strig Coctetio w 1 2 v wv 1 2 m 1 2 1 2 m Strig Reverse w w R 1 2 2 1 Coctetio > Reverse > Strig Legth w 1 2 w Legth 4 2 1 Legth d Coctetio uv u + v u, u 3 v, v 5 uv 8 uv u + v 3 + 5 8 Does this prove the formul is true? C you prove the formul is true? 3
Empty Strig A strig with o letters: λ 0 Oservtios: λ λw wλ w λ λ Sustrig Susequece of cosecutive chrcters Strig Sustrig prefix λ Prefix d Suffix w uv suffix λ More Coctetio w ww w 0 w λ ( ) 2 0 ( ) λ 4
Σ Σ* Σ* The * Opertio Give lphet {, } { λ,,,,,,,,, } Σ Is the set of ll strigs over the lphet + Σ Σ Σ* Σ + The + Opertio Give lphet Is the set of ll strigs over the lphet mius Σ Σ + Σ* λ {, } { λ,,,,,,,,, } {,,,,,,,, } λ Give lphet: Σ Σ* Lguges A Lguge is y suset of Σ* {, } { λ,,,,,,,, } Some Lguges over this lphet iclude: { λ} {,, } { λ,,,,, } Lguges, Sets, d Nottios Sets Set size Set size Strig legth {} { λ} {} 0 { λ} 1 λ 0 5
λ A Ifiite Lguge L { : 0} L L Wht is the lphet ssocited with this lguge? Lguges d Opertios A lguge is set d set opertios pply {,, } {, } {,,, {,, } {, } { } {,, } {, } {, } } The Complemet of Lguge Ituitively, ll strigs ot i the lguge. More precisely: L Σ* L {, } { λ,,,,,, } Is ccc i the complemet of this lguge? L R Reverse R { w : w L} R {,, } {,, } L { : 0} L R { : 0} 6
L Coctetio { xy : x L y L } 1 L 2 1, 2 More Coctetio L LL L 0 L { λ} {,, }{, } {,,,,, } 0 {,, } { λ} 3 {, } {, }{, }{, } {,,,,,,, } {, } Str-Closure (Kleee *) 0 1 L * L L L 2 λ,,, *,,,,,,,, Is Our Nottio Sufficiet? Descrie lguge y listig ll the strigs i the lguge L 2 But this oly works for fiite lguges Descrie lguge y listig some ptter such s: L { : 0} m m { :, m 0} 2 L But this hs limits s well. Cosider the lguge of ll vlid Eglish seteces 7
Automt Fiite Automto Iput Strig Fiite Automto Output Strig Fiite Accepter Iput Strig Fiite Automto Output Accept or Reject iitil stte Trsitio Grph A -Fiite Accepter stte trsitio fil stte ccept 8
Iitil Cofigurtio Iput Strig Redig the Iput q 0 9
Iput fiished Output: ccept Strig Rejectio 10
Iput fiished The Empty Strig λ Output: reject q 0 11
Aother Exmple λ q 0, Output: reject Would it e possile to ccept the empty strig?,, 12
Iput fiished Output: ccept,, Rejectio,, 13
,, Iput fiished Which strigs re ccepted?, Output: reject Formlities M ( Q Σ, δ, q, F), 0 Determiistic Fiite Accepter (DFA) Q Σ δ q 0 F : set of sttes : iput lphet : trsitio fuctio : iitil stte : set of fil sttes 14
Iput Alphet Σ Σ { } Q Set of Sttes Q { q, q, q, q, q q } 0 1 2 3 4, 5 Iitil Stte Set of Fil Sttes F F { } q 4 q 0 q 4 15
Trsitio Fuctio δ δ : Q Σ Q δ ( q 0, ) q 1 q 1 δ ( q ) 5 0, q δ ( q ) 3 2, q 16
δ q 0 q 1 q 2 q 3 q 4 Trsitio Fuctio δ q5 q5 q5 q5 Exteded Trsitio Fuctio δ * δ *: Q Σ* Q ( q ) 2 δ * 0, q ( q ) 4 δ * 0, q q 2 17
( q 0, ) 5 δ * q Oservtio: There is wlk from with lel w δ * (, w) q q q to q q w q q 0 σ σ 2 w σ 1 σ 2 σ k 1 k q q σ Exmple: There is wlk from q 0 to with lel ( q ) 5 δ * 0, q Recursive Defiitio δ *( q, λ) q δ *( q, wσ ) δ ( δ *( q, w), σ ) w q σ q q 1 q 0 δ *( q, wσ ) q δ (, σ ) q δ *( q, wσ ) δ ( q, σ ) δ *( q, w) 1 δ *( q, wσ ) δ ( δ *( q, w), σ ) 18
δ δ δ δ δ q * (, ) ( δ * (, ), ) ( δ ( δ * (, λ), ), ) ( δ (, ), ) ( q, ) 2 1 Lguges Accepted y DFAs Tke DFA M Defiitio: The lguge L( M ) cotis ll iput strigs ccepted y M L ( M ) M { strigs tht drive to fil stte} Wht s Next Red Liz Chpter 1, Chpter 2.1-2.3 JFLAP Strtup, Chpter 1, 2.1 Next Lecture Topics from Chpter 2.1 d 2.2 Regulr Lguges NoDetermiistic Fiite Automt Homework 1 Due Thursdy 19