Deterministic Finite Automata (DFAs). Reminder: Functions vs Relations Let P = {p: p is a person} M = {m: m is a male} S 1 = {(m,p): m is in M, p is in.

Slides:



Advertisements
Similar presentations
Recognising Languages We will tackle the problem of defining languages by considering how we could recognise them. Problem: Is there a method of recognising.
Advertisements

CS 208: Computing Theory Assoc. Prof. Dr. Brahim Hnich Faculty of Computer Sciences Izmir University of Economics.
YES-NO machines Finite State Automata as language recognizers.
Bina Nusantara Finite Automata II (FA) Pertemuan 24: Mata kuliah:K0144/ Matematika Diskrit Tahun:2008.
Finite Automata Section 1.1 CSC 4170 Theory of Computation.
NFAs Sipser 1.2 (pages 47–54). CS 311 Fall Recall… Last time we showed that the class of regular languages is closed under: –Complement –Union.
Intro to DFAs Readings: Sipser 1.1 (pages 31-44) With basic background from Sipser 0.
NFAs Sipser 1.2 (pages 47–54). CS 311 Mount Holyoke College 2 Recall… Last time we showed that the class of regular languages is closed under: –Complement.
Intro to DFAs Readings: Sipser 1.1 (pages 31-44) With basic background from Sipser 0.
CS5371 Theory of Computation
61 Nondeterminism and Nodeterministic Automata. 62 The computational machine models that we learned in the class are deterministic in the sense that the.
Fall 2006Costas Busch - RPI1 Deterministic Finite Automata And Regular Languages.
Lecture 3 Goals: Formal definition of NFA, acceptance of a string by an NFA, computation tree associated with a string. Algorithm to convert an NFA to.
1 Languages and Finite Automata or how to talk to machines...
Lecture 3 Goals: Formal definition of NFA, acceptance of a string by an NFA, computation tree associated with a string. Algorithm to convert an NFA to.
CS5371 Theory of Computation Lecture 4: Automata Theory II (DFA = NFA, Regular Language)
FSA Lecture 1 Finite State Machines. Creating a Automaton  Given a language L over an alphabet , design a deterministic finite automaton (DFA) M such.
CSC 361Finite Automata1. CSC 361Finite Automata2 Formal Specification of Languages Generators Grammars Context-free Regular Regular Expressions Recognizers.
1.Defs. a)Finite Automaton: A Finite Automaton ( FA ) has finite set of ‘states’ ( Q={q 0, q 1, q 2, ….. ) and its ‘control’ moves from state to state.
Nondeterminism (Deterministic) FA required for every state q and every symbol  of the alphabet to have exactly one arrow out of q labeled . What happens.
Regular Expressions (RE) Empty set Φ A RE denotes the empty set Empty string λ A RE denotes the set {λ} Symbol a A RE denotes the set {a} Alternation M.
Finite-State Machines with No Output
Fall 2006Costas Busch - RPI1 Deterministic Finite Automaton (DFA) Input Tape “Accept” or “Reject” String Finite Automaton Output.
1 CD5560 FABER Formal Languages, Automata and Models of Computation Lecture 3 Mälardalen University 2010.
CS 208: Computing Theory Assoc. Prof. Dr. Brahim Hnich Faculty of Computer Sciences Izmir University of Economics.
NFA defined. NFA A Non-deterministic Finite-state Automata (NFA) is a language recognizing system similar to a DFA. It supports a level of non-determinism.
Recognising Languages We will tackle the problem of defining languages by considering how we could recognise them. Problem: Is there a method of recognising.
Modeling Computation: Finite State Machines without Output
Lecture Notes 
Transparency No. 2-1 Formal Language and Automata Theory Homework 2.
Nondeterministic Finite Automata (NFAs). Reminder: Deterministic Finite Automata (DFA) q For every state q in Q and every character  in , one and only.
CSCI 4325 / 6339 Theory of Computation Zhixiang Chen.
Finite Automata A simple model of computation. 2 Finite Automata2 Outline Deterministic finite automata (DFA) –How a DFA works.
1 Chapter 2 Finite Automata (part a) Hokkaido, Japan.
  An alphabet is any finite set of symbols.  Examples: ASCII, Unicode, {0,1} ( binary alphabet ), {a,b,c}. Alphabets.
Costas Busch - LSU1 Deterministic Finite Automata And Regular Languages.
Theory of Computation Automata Theory Dr. Ayman Srour.
Recap: Nondeterministic Finite Automaton (NFA) A deterministic finite automaton (NFA) is a 5-tuple (Q, , ,s,F) where: Q is a finite set of elements called.
Fall 2004COMP 3351 Finite Automata. Fall 2004COMP 3352 Finite Automaton Input String Output String Finite Automaton.
Deterministic Finite-State Machine (or Deterministic Finite Automaton) A DFA is a 5-tuple, (S, Σ, T, s, A), consisting of: S: a finite set of states Σ:
Lecture Three: Finite Automata Finite Automata, Lecture 3, slide 1 Amjad Ali.
Nondeterminism The Chinese University of Hong Kong Fall 2011
Languages.
Lecture2 Regular Language
Chapter 2 Finite Automata
Finite Automata a b A simplest computational model
Push-down Automata Section 3.3 Wed, Oct 27, 2004.
Push-down Automata.
Deterministic Finite Automata
Finite Automata & Regular Languages
Jaya Krishna, M.Tech, Assistant Professor
An Introduction to Finite Automata
Chapter 2 FINITE AUTOMATA.
Solution Prove by induction the following statement:
Deterministic Finite Automata
CSC 4170 Theory of Computation Nondeterminism Section 1.2.
Non-Determinism 12CS45 Finite Automata.
THEORY OF COMPUTATION Lecture One: Automata Theory Automata Theory.
Deterministic Finite Automata And Regular Languages Prof. Busch - LSU.
Chapter Two: Finite Automata
Nondeterministic Finite Automata
Non Deterministic Automata
Introduction to Finite Automata
Finite Automata.
Chapter Five: Nondeterministic Finite Automata
Deterministic Finite Automaton (DFA)
CSC 4170 Theory of Computation Nondeterminism Section 1.2.
Chapter 1 Regular Language
What is it? The term "Automata" is derived from the Greek word "αὐτόματα" which means "self-acting". An automaton (Automata in plural) is an abstract self-propelled.
Nondeterminism The Chinese University of Hong Kong Fall 2010
Presentation transcript:

Deterministic Finite Automata (DFAs)

Reminder: Functions vs Relations Let P = {p: p is a person} M = {m: m is a male} S 1 = {(m,p): m is in M, p is in P and m is the father of m} S 2 = {(m,p): m is in M, p is in P and m is an ancestor of m} 1.True or false: S 1  M  P 2.True or false: S 2  M  P 3.Is either S 1 or S 2 a relation in M  P? 4.Is either S 1 or S 2 a function f:M  P?

Deterministic Automata (Informal) Key questions: if a automaton is confronted with a certain state where a choice must be made, 1. are all the alternatives transitions known?, and 2. given some input data, is it known which transition the machine will make? If the answer to both of these questions is “yes”, the automaton is said to be deterministic “current state” “transition” “new state”

Nondeterministic Automata (Informal) If the answer to any of these questions is “no”, the automaton is said to be nondeterministic That is, either some transitions are unknown, or given some input data, the machine can make more than one transition

Deterministic Automata (Informal) We are going to define automata indicating for a state s and some input data d, which is the state that will be reached Transition: ((s,d), s’) s d s’ Let Q be the set of all states and  be the set of all input data. Then, the set of transitions is a subset of (Q   )  Q of the computation

Determinism, Nondeterminism, Relations and Functions The set of transitions defining an automaton is a subset of (Q   )  Q If the automaton is deterministic, should the set of transitions be a relation or a function? Deterministic automata: Since for each pair (s,d) there should be one and only one s’, the set of transitions must be a function Nondeterministic automata: Since for each pair (s,d) there might not be any s’ or there might be more than one s’, the set of transitions must be a relation

Finite Automata Problem 1: Design a computer program that given a sequence of numbers a 1, a 2, …, a n returns their sum a 1 + a 2 +… + a n Problem 2: Design a computer program that given a sequence of numbers a 1, a 2, …, a n returns the list in the inverted order: a n, …, a 2, a 1 How many memory units are needed for a program to execute:  problem 1:  Problem 2: Finite automata use a constant amount of memory 1n1n

Deterministic Finite Automaton (DFA) A deterministic finite automaton (DFA) is a 5-tuple (Q, , ,s,F) where: Q is a finite set of elements called states  is a finite input alphabet  is a transition function, (Q ×  ) × Q (or  : (Q ×  )  Q) s  Q called the initial state F  Q called the favorable states … a1a1 a2a2 Constant! The fact that  is a function makes the automaton deterministic no! (or yes!)

Finite State Diagram A finite state diagram is a graphic representation for a DFA A finite state diagram is a directed graph, where nodes represent elements in Q (i.e., states) and arrows are characters in  such that: q q’ a Indicates: ((q,a),q’) is a transition in  The initial state is marked with: > The favorable states are marked with:

Example # 1 sq b a b a r a b Trap/ Dead State q b a a r >  = {a,b} Q = {s,q,r}  : 6 transitions: ((s,b), a) ((s,a), q) ((q,a), r) ((q,b), s) ((r,a), r) ((r,b), r) s: initial state F = {r} Formally, this automaton (Q, , ,s,F) is defined as: Is this automaton deterministic?

Real-Life Example: Finite Automaton Controlling a computer-Generated character States –Attack –Chase –Spawn –Wander Events –E: see an enemy –S: hear a sound –D: die Spawn Wander ~E D Attack ~E E E D ~S inspect E S S D Thief movie

Preliminary Definitions Given a set B, B* denote the set of all strings made of elements in B. Strings in B* are also called words. For example, if  = {a,b}, then  * = {a, b, aa, ab, bb, …, baaaba, …} Given an DFA A = (Q, , ,s,F), A configuration is any element in Q ×  * In the example in the previous slide possible configurations include (s,abbba), (s, aaa), (q,bab) and (r, bbbb) The symbol e denotes the empty string

Configuration Yields Configuration Given an DFA A= (Q, , ,s,F), the configuration (q,w) yields the configuration (q’,w’) in one step, if w =  w’ with    and q’ =  (q,  ) q q’  (q,w) yields (q’,w’) if there is a sequence of configurations: (q 1,w 1 ), (q 2,w 2 ), …, (q k,w k ) such that (q i,w i ) yields (q i+1,w i+1 ) in one step

Example 1.What is the configuration yield after 3 yield-steps for (s,aab)? 2.What is the configuration yield after 4 yield-steps for (s,baab)? sq b a b a r a b Trap/ Dead State q b a a r >

String Accepted by Automaton Given an automaton A = (Q, , ,s,F), and a string w   *, we say that w is accepted by A if the configuration (s,w) yields the configuration (f,e), where f is a favorable state, and e is the empty string In Example # 1, the automaton accepts aaabbbb but not b Given an automaton A, the language accepted by A, written L(A), is defined by: L(A) = {w   * : w is accepted by A} “such that” The language accepted in Example # 1 is all the words that contains two consecutive a’s

Example What is the language accepted by this finite automaton? sq b a b a r a b Trap/ Dead State q b a a r >

Example # 2 What is the language accepted by this automaton? sq b a b a r a b q b a a r >