module2-print

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

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

View Full Document Right Arrow Icon
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 finite automata Nondeterministic finite automata and the equivalence to DFAs ε -NFAs, and their equivalence to DFAs. 2.2 1 Deterministic finite automata Deterministic finite automata Finite automaton : a simple computing machine Given a finite 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 Definitions Finite automaton described by 5 parameters: Q = set of computation states Σ = finite 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
Background image of page 1

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

View Full DocumentRight Arrow Icon
This FA 0 0 1 0 , 1 q 0 q 1 q 2 In this finite 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 definition 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 definition of extended transition function Formally, ˆ δ ( q , w ) is defined 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 defined from the other end: If w = ax , then ˆ δ ( q , w ) = ˆ δ ( δ ( q , a ) , x ) . Textbook gives the first definition. 2.7 Language of an FA The language of the finite 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
Background image of page 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.
Background image of page 3

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

View Full DocumentRight Arrow Icon
Image of page 4
This is the end of the preview. Sign up to access the rest of the document.

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 Right Arrow Icon
Ask a homework question - tutors are online