module2-print

# module2-print - Module 2 Regular languages The simplest...

This preview shows pages 1–4. Sign up to view the full content.

Module 2 Regular languages The simplest languages for the simplest computers CS 360: Introduction to the Theory of Computing Daniel G. Brown, University of Waterloo 2.1 Topics of Module 2 Deterministic ﬁnite automata Nondeterministic ﬁnite automata and the equivalence to DFAs ε -NFAs, and their equivalence to DFAs. 2.2 1 Deterministic ﬁnite automata Deterministic ﬁnite automata Finite automaton : a simple computing machine Given a ﬁnite input word, it moves from one program state to another. Each move is based on one input letter At the input’s end, it either accepts or rejects the input, depending on the program state. Vital limitation of FAs: Can’t look back in their input. Only memory is in the state; aside from that, they’ve forgotten everything. 2.3 Deﬁnitions Finite automaton described by 5 parameters: Q = set of computation states Σ = ﬁnite input alphabet δ = transition function q 0 = start state F = accept states 0 0 1 0 , 1 q 0 q 1 q 2 2.4 1

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
This FA 0 0 1 0 , 1 q 0 q 1 q 2 In this ﬁnite automaton: Q = { q 0 , q 1 , q 2 } , Σ = { 0 , 1 } , δ is a function from Q × Σ Q . It includes ( q 0 , 0 ) q 1 q 0 = q 0 F = { q 3 } . This FA accepts the language of words with 00 as a substring. 2.5 Acceptance, extension Given a FA M , what does “ M accepts w ” mean? Starting at q 0 , follow transition function δ for each letter in w , in turn. String w accepted by M if at the end of w ’s transitions, we wind up in a state from F . More formal deﬁnition comes by looking at the extended transition function, ˆ δ . ˆ δ ( q , w ) : state we wind up in if we start at state q and follow δ for each letter in w in turn. 2.6 Formal deﬁnition of extended transition function Formally, ˆ δ ( q , w ) is deﬁned recursively: ˆ δ ( q , ε ) = q , for all states q . If | w | > 0, and w = xa , then ˆ δ ( q , w ) = δ ( ˆ δ ( q , x ) , a ) . Here, x is all but the last letter of w , and a is the last letter of w . Unpack that: q 1 = ˆ δ ( q , x ) : where we get from q when we read x . Then, process letter a : δ ( q 1 , a ) = δ ( ˆ δ ( q , x ) , a ) . Can be deﬁned from the other end: If w = ax , then ˆ δ ( q , w ) = ˆ δ ( δ ( q , a ) , x ) . Textbook gives the ﬁrst deﬁnition. 2.7 Language of an FA The language of the ﬁnite automaton M : all words M accepts. Formally, acceptance of a word: M = ( Q , Σ , δ , q 0 , F ) accepts w exactly when ˆ δ ( q 0 , w ) F . Language of the FA: all such words. L ( M ) = { w Σ * where ˆ δ ( q 0 , w ) F } . (or just { w Σ * where M accepts w } ) Terminlogy: L ( M ) can be called: The language of the FA The language accepted by the FA The language recognized by the FA 2.8 2
Do FAs compute? In a certain sense, yes. Example: if x % 3 == 0: “Is x a multiple of 3?” can be answered by a FA The input word is the binary representation of x The machine accepts if x is a multiple of 3.

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

## This note was uploaded on 01/14/2012 for the course CS 360 taught by Professor Johnwatrous during the Winter '08 term at Waterloo.

### Page1 / 10

module2-print - Module 2 Regular languages The simplest...

This preview shows document pages 1 - 4. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online