Pumping lemma for regular languages From lecture 2: Theorem Suppose - - PowerPoint PPT Presentation

pumping lemma for regular languages
SMART_READER_LITE
LIVE PREVIEW

Pumping lemma for regular languages From lecture 2: Theorem Suppose - - PowerPoint PPT Presentation

Pumping lemma for regular languages From lecture 2: Theorem Suppose L is a language over the alphabet . If L is accepted by a finite automaton M, and if n is the number of states of M, then for every x L satisfying | x | n


slide-1
SLIDE 1

Pumping lemma for regular languages

From lecture 2:

Theorem

Suppose L is a language over the alphabet Σ. If L is accepted by a finite automaton M, and if n is the number of states of M, then ∀ for every x ∈ L satisfying |x| n ∃ there are three string u, v, and w, such that x = uvw and the following three conditions are true: (1) |uv| n, (2) |v| 1 ∀ and (3) for all i 0, uviw belongs to L

[M] Thm. 2.29

Automata Theory (Deterministic) Finite Automata Pumping lemma 67 / 101

slide-2
SLIDE 2

C programs

Let L be the set of legal C programs. x = main(){{{...}}}

[M] E 2.33

Automata Theory (Deterministic) Finite Automata Pumping lemma 68 / 101

slide-3
SLIDE 3

Excercise 2.24

Prove the following generalization of the pumping lemma, which can sometimes make it unnecessary to break the proof into cases. If L can be accepted by an FA, then there is an integer n such that for any x ∈ L with |x| n and for any way of writing x as x1x2x3 with |x2| = n, there are strings u, v and w such that

  • a. x2 = uvw
  • b. |v| 1
  • c. For every i 0, x1uviwx3 ∈ L

Automata Theory (Deterministic) Finite Automata Pumping lemma 69 / 101

slide-4
SLIDE 4

Not a characterization

L = { aibjcj | i 1 and j 0 } ∪ { bjck | j, k 0 } – can be pumped, as in the pumping lemma – is not accepted by FA

[M] E 2.39

Automata Theory (Deterministic) Finite Automata Pumping lemma 70 / 101

slide-5
SLIDE 5

Decision problems

Decision problem: problem for which the answer is ‘yes’ or ‘no’: Given . . . , is it true that . . . ? Given an undirected graph G = (V , E), does G contain a Hamiltonian path? Given a list of integers x1, x2, . . . , xn, is the list sorted? decidable ⇐ ⇒ ∃ algorithm that decides

Automata Theory (Deterministic) Finite Automata Decision problems 71 / 101

slide-6
SLIDE 6

Decision problems

M = (Q, Σ, δ, q0, A) membership problem x ∈ L(M)? Specific to M: Given x ∈ Σ∗, is x ∈ L(M)? Arbitrary M: Given FA M with alphabet Σ, and x ∈ Σ∗, is x ∈ L(M)? Decidable, easy

[M] E 2.34

Automata Theory (Deterministic) Finite Automata Decision problems 72 / 101

slide-7
SLIDE 7

Decision problems

Theorem

The following two problems are decidable

  • 1. Given an FA M, is L(M) nonempty?
  • 2. Given an FA M, is L(M) infinite?

[M] E 2.34

Automata Theory (Deterministic) Finite Automata Decision problems 73 / 101

slide-8
SLIDE 8

Decision problems

Lemma

Let M be an FA with n states and let L = L(M). L is nonempty, if and only if L contains an element x with |x| < n (at least one such element).

Automata Theory (Deterministic) Finite Automata Decision problems 74 / 101

slide-9
SLIDE 9

Decision problems

Theorem

The following two problems are decidable

  • 1. Given an FA M, is L(M) nonempty?
  • 2. Given an FA M, is L(M) infinite?

[M] E 2.34

Automata Theory (Deterministic) Finite Automata Decision problems 75 / 101

slide-10
SLIDE 10

Decision problems

Lemma

Let M be an FA with n states and let L = L(M). L is infinite, if and only if L contains an element x with |x| n (at least one such element).

Automata Theory (Deterministic) Finite Automata Decision problems 76 / 101

slide-11
SLIDE 11

Decision problems

Lemma

Let M be an FA with n states and let L = L(M). L is infinite, if and only if L contains an element x with |x| n (at least one such element).

Lemma

Let M be an FA with n states and let L = L(M). L contains an element x with |x| n (at least one such element) if and only if L contains an element x with n |x| < 2n (at least one such element).

Automata Theory (Deterministic) Finite Automata Decision problems 77 / 101

slide-12
SLIDE 12

Quiz

Give 2-state FA for each of the languages over {a, b}

strings with even number of a’s strings with at least one b

Use the product construction to obtain a 4-state FA for the language

  • f strings with even number of a’s or at least one b

Investigate which states can be merged

Automata Theory (Deterministic) Finite Automata Distinguishing strings 78 / 101

slide-13
SLIDE 13

x ends with aa

From lecture 1:

Example

L1 = { x ∈ {a, b}∗ | x ends with aa } q0 q1 q2 a b a b a b

[M] E. 2.1

Automata Theory (Deterministic) Finite Automata Distinguishing strings 79 / 101

slide-14
SLIDE 14

Same state, same future

q0 δ∗(q0, x) δ∗(q0, y) x y

δ∗(q0, xz1) = δ∗(q0, yz1)

z2 z3 z1

Automata Theory (Deterministic) Finite Automata Distinguishing strings 80 / 101

slide-15
SLIDE 15

Distinguishing strings

Definition

Let L be language over Σ, and let x, y ∈ Σ∗. Then x, y are distinguishable wrt L (L-distinguishable), if there exists z ∈ Σ∗ with xz ∈ L and yz / ∈ L

  • r

xz / ∈ L and yz ∈ L Such z distinguishes x and y wrt L. Equivalent definition: let L/x = { z ∈ Σ∗ | xz ∈ L } x and y are L-distinguishable if L/x = L/y. Otherwise, they are L-indistinguishable. The strings in a set S ⊆ Σ∗ are pairwise L-distinguishable, if for every pair x, y of distinct strings in S, x and y are L-distinguishable. Definition independent of FAs

[M] D 2.20

Automata Theory (Deterministic) Finite Automata Distinguishing strings 81 / 101

slide-16
SLIDE 16

x ends with aa

From lecture 1:

Example

L1 = { x ∈ {a, b}∗ | x ends with aa } q0 q1 q2 a b a b a b S = {Λ, a, aa}

Automata Theory (Deterministic) Finite Automata Distinguishing strings 82 / 101

slide-17
SLIDE 17

Theorem

Suppose M = (Q, Σ, q0, A, δ) is an FA accepting L ⊆ Σ∗. If x, y ∈ Σ∗ are L-distinguishable, then δ∗(q0, x) = δ∗(q0, y). For every n 2, if there is a set of n pairwise L-distinguishable strings in Σ∗, then Q must contain at least n states.

  • Proof. . .

[M] Thm 2.21

Automata Theory (Deterministic) Finite Automata Distinguishing strings 83 / 101

slide-18
SLIDE 18

x ends with aa

From lecture 1:

Example

L1 = { x ∈ {a, b}∗ | x ends with aa } q0 q1 q2 a b a b a b S = {Λ, a, aa}

Automata Theory (Deterministic) Finite Automata Distinguishing strings 84 / 101

slide-19
SLIDE 19

Distinguishing states

L = {aa, aab}∗{b}

[M] E 2.22

Automata Theory (Deterministic) Finite Automata Distinguishing strings 85 / 101

slide-20
SLIDE 20

Distinguishing states

L = {aa, aab}∗{b}

q0 p t u r s a b b a b a b a a, b a, b

[M] E 2.22

Automata Theory (Deterministic) Finite Automata Distinguishing strings 86 / 101

slide-21
SLIDE 21

Strings with a in the nth symbol from the end

[M] E. 2.24

Automata Theory (Deterministic) Finite Automata Distinguishing strings 87 / 101

slide-22
SLIDE 22

Strings with a in the nth symbol from the end

aaa aab aba abb baa bab bba bbb a b a b a b a b a b a b a b a b

[M] E. 2.24

Automata Theory (Deterministic) Finite Automata Distinguishing strings 88 / 101

slide-23
SLIDE 23

Theorem

For every language L ⊆ Σ∗, if there is an infinite set S of pairwise L-distinguishable strings, then L cannot be accepted by a finite automaton.

  • Proof. . .

[M] Thm 2.26

Automata Theory (Deterministic) Finite Automata Distinguishing strings 89 / 101

slide-24
SLIDE 24

Pal

Pal = {x ∈ {a, b}∗ | x = xr}

Automata Theory (Deterministic) Finite Automata Distinguishing strings 90 / 101