Acceptance by DFA. Defining DFAs For each description let’s draw a DFA that recognizes the language it describes { aa,ab,ac} {  a, abb, abbbb, …,ab.

Slides:



Advertisements
Similar presentations
YES-NO machines Finite State Automata as language recognizers.
Advertisements

1 Languages. 2 A language is a set of strings String: A sequence of letters Examples: “cat”, “dog”, “house”, … Defined over an alphabet: Languages.
Finite Automata Section 1.1 CSC 4170 Theory of Computation.
Intro to DFAs Readings: Sipser 1.1 (pages 31-44) With basic background from Sipser 0.
Intro to DFAs Readings: Sipser 1.1 (pages 31-44) With basic background from Sipser 0.
Lecture 3UofH - COSC Dr. Verma 1 COSC 3340: Introduction to Theory of Computation University of Houston Dr. Verma Lecture 3.
CS5371 Theory of Computation
Transparency No. 2-1 Formal Language and Automata Theory Chapter 2 Deterministic Finite Automata (DFA) (include Lecture 3 and 4)
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.
CSC 3130: Automata theory and formal languages Andrej Bogdanov The Chinese University of Hong Kong Regular.
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)
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.
Finite Automata Costas Busch - RPI.
Finite State Machines Data Structures and Algorithms for Information Processing 1.
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 Languages A language is regular over  if it can be built from ;, {  }, and { a } for every a 2 , using operators union ( [ ), concatenation.
Formal Language Finite set of alphabets Σ: e.g., {0, 1}, {a, b, c}, { ‘{‘, ‘}’ } Language L is a subset of strings on Σ, e.g., {00, 110, 01} a finite language,
Rosen 5th ed., ch. 11 Ref: Wikipedia
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.
Lecture 2UofH - COSC Dr. Verma 1 COSC 3340: Introduction to Theory of Computation University of Houston Dr. Verma Lecture 2.
CSCI 2670 Introduction to Theory of Computing August 24, 2005.
Introduction to CS Theory Lecture 3 – Regular Languages Piotr Faliszewski
1 Chapter 2 Finite Automata (part b) Windmills in Holland.
Fall 2006Costas Busch - RPI1 Deterministic Finite Automaton (DFA) Input Tape “Accept” or “Reject” String Finite Automaton Output.
Lecture 1 Computation and Languages CS311 Fall 2012.
4b 4b Lexical analysis Finite Automata. Finite Automata (FA) FA also called Finite State Machine (FSM) –Abstract model of a computing entity. –Decides.
Complexity and Computability Theory I Lecture #2 Rina Zviel-Girshin Leah Epstein Winter
Finite Automata – Definition and Examples Lecture 6 Section 1.1 Mon, Sep 3, 2007.
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.
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.
Chapter 5 Finite Automata Finite State Automata n Capable of recognizing numerous symbol patterns, the class of regular languages n Suitable for.
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.
NFA’s with  Transitions We extend the class of NFAs by allowing instantaneous transitions: 1.The automaton may be allowed to change its state without.
Set, Alphabets, Strings, and Languages. The regular languages. Clouser properties of regular sets. Finite State Automata. Types of Finite State Automata.
1 Example: Graph of a DFA Start 1 0 ACB 1 0 0,1 Previous string OK, does not end in 1. Previous String OK, ends in a single 1. Consecutive 1’s have been.
1/29/02CSE460 - MSU1 Nondeterminism-NFA Section 4.1 of Martin Textbook CSE460 – Computability & Formal Language Theory Comp. Science & Engineering Michigan.
  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.
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 Σ:
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.
Lecture Three: Finite Automata Finite Automata, Lecture 3, slide 1 Amjad Ali.
Introduction to Automata Theory Theory of Computation Lecture 3 Tasneem Ghnaimat.
Languages.
Lexical analysis Finite Automata
Lecture2 Regular Language
CSE 105 theory of computation
Chapter 2 Finite Automata
Recognizer for a Language
Finite Automata & Regular Languages
Jaya Krishna, M.Tech, Assistant Professor
COSC 3340: Introduction to Theory of Computation
Hierarchy of languages
Non-Determinism 12CS45 Finite Automata.
Deterministic Finite Automata And Regular Languages Prof. Busch - LSU.
COSC 3340: Introduction to Theory of Computation
Deterministic Finite State Automata
Intro to Data Structures
4b Lexical analysis Finite Automata
Closure Properties of Regular Languages
Deterministic Finite Automaton (DFA)
4b Lexical analysis Finite Automata
CSC 4170 Theory of Computation Finite Automata Section 1.1.
AUTOMATA THEORY.
CSE 105 theory of computation
Presentation transcript:

Acceptance by DFA

Defining DFAs For each description let’s draw a DFA that recognizes the language it describes { aa,ab,ac} {  a, abb, abbbb, …,ab 2n, … } {a m bc n | m,n  N }

Formal definition Recall a DFA is a quintuple A=(Q, ,s,F,  ), where – Q is a set of states –  is the alphabet of input symbols – s is an element of Q --- the initial state – F is a subset of Q ---the set of final states –  Q   Q is the transition function

Example In the example below, Q={q 0,q 1,q 2 },  ={0,1}, s=q 0, F={q 2 }, anT T is given by 6 equalities  (q 0,0)=q 1,  (q 0,1)=q 0,  (q 2,1)=q 2 … q0q0 q1q1 q2q ,1

Transition Table (Hein ) All the information presenting a TFA can be given by a single thing -- its transition table: The initial and final states are denoted by  and * respectively. 01 Q0Q0 Q1Q1 Q0Q0 Q1Q1 Q2Q2 Q1Q1 *Q2*Q2 Q2Q2 Q2Q2

Extension of  to Strings Given a state q anT a string w, there is a unique path labeled w that starts at q (why?). The endpoint of that path is denoted T (q,w) Formally, the function T  Q  *  Q is defined recursively : – T (q,  )=q – T (q,ua)= T ( T (q,u),a) Note that T (q,a)= T (q,a) for every a  ; so T Toes extend T.

Example trace Diagrams (when available) make it very easy to compute T (q,w) --- just trace the path labeled w starting at q. E.g. trace 101 on the Diagram below starting at q 0 q0q0 qq11qq11 q2q ,1

Implementation and precise arguments need the formal definition. T (q 0,101)=  ( T (q 0,10),1) =  (  ( T (q 0,1),0),1) =  (  (  (q 0,1),0),1) =  (  (q 0,0),1) =  (q 1,1) =q 1 01 q0q0 q1q1 q0q0 q1q1 q2q2 q1q1 *q 2 q2q2 q2q2

Language of accepted strings A DFA =(Q, ,s,F,  ), accepts a string w iff T (s,w)  F The language of the automaton A is L(A)={w | A accepts w}. More formally L(A)={w | T (Start(A),w)  Final(A)} Example: Find a DFA whose language is the set of all strings over {a,b,c} that contain aaa as a substring.

DFA’s as Haskell Programs data DFA q s = DFA { states :: [q], symbols :: [s], delta :: q -> s -> q, start :: q, final :: [q]} Haskell is a functional language that makes it easy to describe formal (or mathematical) objects.

Transition function trans :: (q -> s -> q) -> q -> [s] -> q trans T q [] = q trans T q (s:ss) = trans T (T q s) ss accept :: (Eq q) => TFA q s -> [s] -> Bool accept = T,start = q0,final = f}) w = elem (trans T q0 w) f

An Example ma = DFA { states = [0,1,2], symbols = [0,1], delta = \p a -> (2*p+a) `mod` 3, start = 0, final = [2] }

Another definition of acceptance A DFA A =(Q, ,s,F,  ), accepts a string x 1 x 2..x n (an element of    iff – There exists a sequence of states q 1 q 2..q n q n+1 such that 1.q 1 = s 2.q i+1 =  (q i,x i ) 3.Q n+1 is an element of F How does this relate to our previous definition? L(A)={w | T (s,w)  F } Note, one more state than characters in the input string