Deterministic FA/ PDA - PowerPoint PPT Presentation

About This Presentation
Title:

Deterministic FA/ PDA

Description:

Sequential Machine Theory Prof. K. J. Hintz Department of Electrical and Computer Engineering Lecture 4 Updated by Marek Perkowski Numerical Acceptor A Non-intuitive ... – PowerPoint PPT presentation

Number of Views:49
Avg rating:3.0/5.0
Slides: 43
Provided by: ecePdxEd
Learn more at: http://web.cecs.pdx.edu
Category:

less

Transcript and Presenter's Notes

Title: Deterministic FA/ PDA


1
Deterministic FA/ PDA
  • Sequential Machine Theory
  • Prof. K. J. Hintz
  • Department of Electrical and Computer Engineering
  • Lecture 4

Updated by Marek Perkowski
2
Numerical Acceptor
  • A Non-intuitive Concept of a Language Is One
    Which Can Accept Binary Arithmetic Values, e.g.

Moret, Theory of Computation
Check all strings, from shortest that are
accepted. What is their language?
3
Languages Accepted by FA
  • The Class of Languages Accepted by a
    Deterministic or Nondeterministic FA Is Closed
    Under
  • Union
  • Concatenation
  • Kleene Star
  • Complementation
  • Intersection

4
Union of Languages

5
Concatenation of Languages

6
Kleene Star of Languages

e
e
e
gt
q0
7
Difference of Languages

L1
L2
8
Intersection of Languages

L1
L2
L
9
Languages and FA
  • Kleenes Theorem
  • A Language Is Regular iff It Is Accepted by a
    Deterministic or Nondeterministic Finite Automata
  • A Regular Language Is One Which Can Be Defined by
    a Regular Expression
  • Not all languages are regular

Give examples of languages that are not regular
10
Context Free Languages
  • Up Until Now we learned the following
  • But This Is a Limited Class of Languages
  • There Are Other Context-Free Languages Which
    Cannot Be Recognized by a DFA
  • There Are Other Types of Machines Which Can
    Accept More Context-Free Languages

11
A Non-Regular Language
  • Since a Language, L, Is a Subset of the Set of
    All Strings, I, Are There Some Strings Which
    Cannot Be Produced by a Regular Expression or
    Recognized by a DFA? Yes, e.g.,

12
an bn Regular?
  • Theorem1 Let L be an infinite regular language.
    Then there are strings x, y, and z such that y ?
    e and x yn z ? L for each n ? 0
  • Proof based on pigeonhole principle
  • If there are n 1 pigeons and n pigeonholes,
    then at least two pigeons must be in the same
    hole
  • If a string has more characters than there are
    states in the language recognizer, then some
    state must be entered more than once

1 Lewis Papadimitriou, Elements of the Theory
of Computation
13
an bn Regular?
  • Language Is Infinite, Therefore Theorem Applies
  • Is This Language Regular? If So, the Theorem
    Must Apply
  • Three Cases to Study see next slides

14
an bn Regular?
  • Case 1 y consists entirely of as

15
an bn Regular?
  • Case 2 y consists entirely of bs
  • Similar argument to Case 1

16
an bn Regular?
  • Case 3 y contains both as and bs
  • For n gt 1, x yn z has an occurrence of b
    preceding an occurrence of a and therefore cannot
    be in L

17
Context Free Grammars idea
  • A More General Way to Describe and/or Generate
    Languages
  • Context-Free
  • Replacement Rules Can Be Applied Independently of
    the Preceding or Following Elements.

18
Context Free Grammar definition
  • A Quadruple, ( I, ?, R, s) where
  • I An alphabet
  • ? A set of terminals,
  • R A finite set of rules, a subset of the
    crossproduct of the set of non-terminals and
    all strings,

19
Context Free Grammar definition cont
  • s The start symbol, a non-terminal
  • The set of non-terminals
  • AND ...

20
Context Free Grammar definition cont
  • For All Non-terminals,
  • And Strings
  • The Grammar, G, Maps the Non-Terminals to Strings
  • for strings u, v, x, y, v ?
    I
  • and non-terminals

21
Context Free Grammar definition of G-related
  • u is G-related to v
  • iff
  • u x A y
  • v x v y
  • and

22
Context Free Grammar the set of all possible
relations
  • The relation, , the meaning the set of
  • all possible relations, is
  • reflexive
  • transitive
  • has closure

I
G
23
Context Free Language
  • The Language Generated by the Context Free
    Grammar, G, Is the Set of Strings Which Map From
    the Start Symbol, s, Under the Reflexive,
    Transitive, and Closed Relation,

24
Context Free Language
  • A Context Free Language Is One Which Can Be
    Generated by a Context Free Grammar, and,
  • The Context Free Grammar (CFG) Can Be Used to
    Generate Strings of the Language

25
A Derivation Example
  • The Steps in Applying the Rules From the Start
    Symbol to Any String Is Called a Derivation in G,
    e.g.,

26
Pushdown Automata
  • All Context-Free Languages can Be Recognized by a
    PDA
  • an bn Is Context-Free, but Not Regular
  • Problem is same number of as and bs
  • PDA Assumes
  • An unlimited memory in the form of a stack, LIFO
  • The machine only has access to the top of the
    stack.

27
Pushdown Automata formal definition
  • A PDA is a Sextuple,

28
Pushdown Relation
  • where top of stack
  • is replaced by
  • new top of stack.

29
Pushdown Relation Example

x
sp
30
PDA Properties
  • One Can Have the Same State Before and After a
    Transition, but Have Different Stack Contents
    Which Makes It Non-Deterministic
  • State Changes May Occur in the Absence of an
    Input, but Only If the Stack Is Not Empty. i.e.,
    non-causal behavior.

31
PDA Properties what is the state of PDA?
  • The State of the PDA Is Determined Not Only by
    S, and Not Only by the Top-of-Stack, but Rather
    by Both the Current State and the Complete
    Contents of the Stack, x
  • This State of the PDA Is Called the
    Configuration of the PDA

32
PDA Notation
  • The Input May Cause the PDA to Change From
    Configuration 1 to Configuration 2

33
PDA Recognizer
  • A string w ? I is accepted by a PDA

34
PDA Example
  • A Machine to Recognize Strings of the Form wcwR

Lewis Papadimitriou, pg. 114
35
PDA Example
  • wcwR Can Be Represented by a Context Free Grammar,

36
Equivalent NPDA
  • wcwR can be represented by a NPDA where

37
Is abccba Accepted?

38
Is abccba Accepted?

39
Is abccba Accepted?
  • The machine halts with unread inputs since there
    is no
  • to be executed.

40
Is bacab Accepted?
41
Is bacab Accepted?
42
Is bacab Accepted?
  • The machine halts with no unread input and
    nothing on the stack, therefore,
  • bacab ? language wcwR.
Write a Comment
User Comments (0)
About PowerShow.com