Homework Homework #1 returned today Kleene Theorem Homework #2 - - PDF document

homework
SMART_READER_LITE
LIVE PREVIEW

Homework Homework #1 returned today Kleene Theorem Homework #2 - - PDF document

Homework Homework #1 returned today Kleene Theorem Homework #2 due today Homework Before We Start Speaking of Homework Any questions? Heres Homework #3 (Due April 4) From the textbook 4.15b.c (No need to use


slide-1
SLIDE 1

1

Kleene Theorem Homework

  • Homework #1 returned today
  • Homework #2 due today

Homework

  • Speaking of Homework

– Here’s Homework #3 (Due April 4)

  • From the textbook

– 4.15b.c (No need to use proof of Kleene Theorem) – 4.16a,d – 4.29a – 4.35a,b (Do not simplify) – 4.38a (Must use proof of Kleene)

Before We Start

  • Any questions?

Languages

  • Recall.

– What is a language? – What is a class of languages?

Regular Languages

  • Regular languages

– Means of defining: Regular Expressions – Machine for accepting: Finite Automata

slide-2
SLIDE 2

2

Finite Automata

  • A finite automaton (finite-state machine) is

a 5-tuple (Q, Σ, qo, δ, A) where

– Q is a finite set (of states) – Σ is a finite alphabet of symbols – qo ∈ Q is the start state – A ⊆ Q is the set of accepting states – δ is a function from Q x Σ to Q (transition function)

Did I happen to mention?

  • Steven Cole Kleene

– 1909-1994 – b. Hartford, Conn. – PhD – Princeton (1934) – Prof at U of Wisc at Madison (1935 – 1979) – Introduced Kleene Star op – Defined regular expressions

Kleene Theorem

  • A language L over Σ is regular iff there

exists an FA that accepts L.

  • 1. If L is regular there exists an FA M such that

L = L(M)

  • 2. For any FA, M, L(M) is regular

L(M), the language accepted by the FA can be expressed as a regular expression.

Proving Kleene Theorem

  • Approach

– Define 2 variants of the Finite Automata

  • Nondeterministic Finite Automata (NDFA)
  • Nondeterministic Finite Automata with Λ transitions (NDFA-

Λ)

– Prove that FA, NDFA, and NDFA- Λ are equivalent w.r.t. the languages they accept – For a regular expression, build a NDFA- Λ that accepts the same language – For an FA build a regular expression that describes the language accepted by the FA.

Tonight

  • Last time we defined these two FA variants:

– Nondeterministic Finite Automata (NDFA) – Nondeterministic Finite Automata with Λ transitions (NDFA- Λ)

  • In part 1 we show they are equivalent
  • Questions?

Equivalence

  • If L is a language over Σ*, then the

following 3 statements are equivalent:

  • 1. L is accepted by a FA
  • 2. L is accepted by a NDFA
  • 3. L is accepted by a NDFA-Λ
slide-3
SLIDE 3

3

Equivalence

  • How we will show this
  • 1. Given an NDFA that accepts L, create an FA

that also accepts L

  • 2. Given an NDFA- Λ that accepts L, create an

NDFA that also accepts L

  • 3. Given an FA that accepts L, create a NDFA-

Λ that also accepts L.

Are we ready?

Step 1: NDFA->FA

  • Given NDFA find FA

– Let M = (Q, Σ, q0, A, δ) be a NDFA then

  • There exists a FA, M1 = (Q1, Σ, q1, A1, δ1)
  • Such that L(M) = L(M1)

Step 1: NDFA -> FA

  • Basic idea

– Recall that for a NDFA, δ: Q x Σ → 2Q – Use the states of M1 to represent subsets of Q. – If there is one state of M1 for every subset of Q, then the non-determinism of M can be eliminated. – This technique, called subset construction, is a primary means for removing non-determinism from an NDFA.

Step 1: NDFA -> FA

  • Formal definition

– M = (Q, Σ, q0, A, δ) be a NDFA – We define FA, M1 = (Q1, Σ, q1, A1, δ1)

  • Q1 = 2Q
  • q1 = {q0}
  • For q ∈ Q1 and a ∈ Σ,
  • A1 = {q ∈ Q1 | q ∩ A ≠ ∅ }

– Note that we need only include states on M1 (subsets of Q) if the state is reachable.

U

q p

a p a q

= ) , ( ) , (

1

δ δ

Step 1: NDFA -> FA

  • Algorithm for building M1

– Add {q0} to Q1 – While there are states of Q1 whose transitions are yet to be defined

  • Let q ∈ Q1
  • For each a ∈ Σ, determine the set of states, P, in M that are

reachable from q on input a

  • If there is no state in Q1 corresponding to P, add one.
  • Define δ1 (q, a) = state in Q1 corresponding to P

– Define A1 as any state in Q1 that corresponds to a subset containing any of the final states of M

Step 1: NDFA -> FA

  • Example
slide-4
SLIDE 4

4

Step 1: NDFA -> FA

q0 q0q1 q0q2

q0q1q2

q0q3

q0q1q3 q0q2q3

q0q1q2q3

1 1 1 1 1 1 1 1

Step 1: NDFA -> FA

  • Now we must show that M1 accepts the

same language as M

– It can be shown (by structural induction) that for all x ∈ Σ*

  • δ*

1 (q1, x) = δ* (q0, x)

Step 1: NDFA -> FA

  • Show that M and M1 recognize the same

language

– x is accepted by M1 iff δ*1 (q1, x) ∈ A1 – x is accepted by M1 iff δ* (q0, x) ∈ A1 – By def of A1,

  • x is accepted by M1 iff δ* (q0, x) ∩ A ≠ ∅

– Thus

  • x is accepted by M1 iff x is accepted by M

What have we shown

  • In Step 1 we’ve shown:

– Given a NDFA

  • There exists an FA that accepts the same language
  • Non-determinism can be removed from an NDFA

by using a subset construction algorithm.

– Questions?

What have we shown

NDFA FA If L ∈ NDFA then L ∈ FA

Step 2: NDFA-Λ -> NDFA

  • Given NDFA-Λ find NDFA

– Let M = (Q, Σ, q0, A, δ) be a NDFA-Λ then

  • There exists a NDFA, M1 = (Q1, Σ, q1, A1, δ1)
  • Such that L(M) = L(M1)
slide-5
SLIDE 5

5

Step 2: NDFA-Λ -> NDFA

  • Basic idea

– Recall that a NDFA-Λ is still non-deterministic – Replace Λ transitions with non-Λ transitions – Let δ1(q,a) be the set of states reachable from q, reading symbol a, including those reachable via Λ transitions

  • Which is just δ* (q,a)

Λ

Step 2: NDFA-Λ -> NDFA

  • Basic idea

– Accepting states

  • If q0 is not an accepting state of M but it is possible

to get to an accepting state by just using Λ transitions, then q0 must be added to the set of accepting states of M1

Step 2: NDFA-Λ -> NDFA

  • Formal definition

– M = (Q, Σ, q0, A, δ) be a NDFA-Λ – We define NDFA, M1 = (Q1, Σ, q1, A1, δ1)

  • Q1 = Q
  • q1 = q0
  • δ1 (q,a) = δ* (q,a)
  • A1 = A ∪ {qo} if Λ({qo} ) ∩ A ≠ ∅ in M
  • = A otherwise

Step 2: NDFA-Λ -> NDFA

  • Algorithm for constructing M1

– Set of states is the same as M – Start state is the same as M – Accepting states is the same as M – For each state, q, in M

  • compute the Λ closure
  • For each state in the Λ closure,p, and for each symbol a, add all

elements of the Λ closure of δ (p,a) to the set δ1(q, a)

– If you can get to to an accepting state in M from qo by

  • nly using Λ transitions, add q0 to A1

Step 2: NDFA-Λ -> NDFA

  • Example

Step 2: NDFA-Λ -> NDFA

{w, q0, p, t} w {v, w, q0, p, t } v {u} u {t} t {s, w, q0, p, t } s {r} r {p} p {q0, p, t } q0 Λ closure State

slide-6
SLIDE 6

6

Step 2: NDFA-Λ -> NDFA

q0 p r s t u v w 1 1 1 1 1 1 1 1

Step 2: NDFA-Λ -> NDFA

  • Now we must show that M1 accepts the

same language as M

– Can be shown (using structural induction) that for all x ∈ Σ*

  • δ*

1 (q, x) = δ* (q, x)

Step 2: NDFA-Λ -> NDFA

  • Show that M and M1 recognize the same

language

– x is accepted by M1 iff δ*1 (q0, x) ∩ A ≠ ∅ – x is accepted by M1 iff δ* (q0, x) ∩ A ≠ ∅ – Thus,

  • x is accepted by M1 iff x is accepted by M
  • We showed this true for |x| > 0

Step 2: NDFA-Λ -> NDFA

  • Show that M and M1 recognize the same language

– If |x| = 0, I.e. x = Λ

  • If Λ accepted by M then Λ(qo) contains an accepting state, in

which case we’ve added qo to the set of accepting states of M1

  • Thus Λ is accepted by M1
  • If Λ rejected by M, then qo is not an accepting state. Since the

set of accepting states of M1 is the same as M (except for the special case above), then q- will not be in the set of accepting states for M1.

  • This Λ is rejected by M1

Where we are

  • In Step 2 we’ve shown:

– Given an NDFA- Λ

  • There exists an NDFA that accepts the same

language

  • Λ transitions can be removed from an NDFA- Λ by

replacing Λ transitions with non- Λ transitions in an already non-deterministic NDFA.

Where we are

NDFA- Λ NDFA If L ∈ NDFA- Λ then L ∈ NDFA

slide-7
SLIDE 7

7

Where we are

– We’ve shown that:

  • If L is accepted by an NDFA- Λ it is also accepted by an

NDFA

  • If L is accepted by an NDFA it is also accepted by an FA
  • So if L is accepted by an NDFA- Λ, it is accepted by an FA.

– We still need to show:

  • If L is accepted by an FA, it is also accepted by an NDFA- Λ

– Questions?

Where we are

NDFA- Λ NDFA FA

Step 3: FA-> NDFA-Λ

  • Given FA find NDFA-Λ

– Let M = (Q, Σ, q0, A, δ) be a FA then

  • There exists a NDFA -Λ, M1 = (Q1, Σ, q1, A1, δ1)
  • Such that L(M) = L(M1)

Step 3: FA-> NDFA-Λ

  • Basic idea

– Since FAs are more restrictive than NDFA-Λs, any FA is essentially an NDFA-Λ that doesn’t take advantage of:

  • Non-determinism
  • Λ-transitions

– Must consider details of transition functions

Step 3: FA-> NDFA-Λ

  • Formal definition

– M = (Q, Σ, q0, A, δ) be a FA – We define NDFA-Λ, M1 = (Q1, Σ, q1, A1, δ1)

  • Q1 = Q
  • q1 = q0
  • A1 = A
  • δ1 (q, Λ) = ∅ for all q ∈ Q
  • δ1 (q, a) = {δ (q, a)} for all q ∈ Q, a ∈ Σ

Step 3: FA-> NDFA-Λ

  • Now we must show that M1 accepts the

same language as M

– Can show (using structural induction) that for all x ∈ Σ*

  • δ*

1 (q, x) = {δ* (q, x) }

slide-8
SLIDE 8

8

Step 3: FA-> NDFA-Λ

  • Show that M and M1 recognize the same

language

– x is accepted by M1 iff δ*1 (q0, x) ∩ A ≠ ∅ – x is accepted by M1 iff {δ* (q0, x)} ∩ A ≠ ∅ – That’s the same as saying

  • δ* (q0, x) ∈ A or
  • x is accepted by M

– Thus

  • x is accepted by M1 iff x is accepted by M

Equivalence!

  • What we have shown
  • 1. Given an NDFA that accepts L, create an FA

that also accepts L

  • 2. Given an NDFA- Λ that accepts L, create an

NDFA that also accepts L

  • 3. Given an FA that accepts L, create a NDFA-

Λ that also accepts L.

  • All 3 are equivalent

Equivalence!

NDFA- Λ NDFA FA

Equivalence!

NDFA- Λ NDFA FA

Let’s try an example

  • Find a FA for the regular expression

– 0*(01)*0*

Example: RE -> NDFA-Λ

  • 0*(01)*0*
slide-9
SLIDE 9

9

Example: NDFA-Λ -> NDFA

{D} D {C} C {B, D} B {A, B, D} A

Λ closure

State

Example: NDFA-Λ -> NDFA

A C B D 1 1

Example: NDFA-> FA

A ∅ ABCD BD CD D 1 1 1 1 1 0,1

Summary

  • If L is a language over Σ*, then the

following 3 statements are equivalent:

1.L is accepted by a FA 2.L is accepted by a NDFA 3.L is accepted by a NDFA-Λ

Summary

  • How we showed this

1.Given an NDFA that accepts L, create an FA that also accepts L (subset construction) 2.Given an NDFA- Λ that accepts L, create an NDFA that also accepts L (Λ-transition

elimination)

3.Given an FA that accepts L, create a NDFA- Λ that also accepts L.

After the break

  • Now we have all the tools needed to prove

Kleene’s Theorem directly

  • Will do this after the break
slide-10
SLIDE 10

10

Kleene’s Theorem

  • To prove Kleene’s Theorem, we will have

two show two things:

  • 1. Given a Regular Expression, there is a FA

that accepts the language described by the regular expression

  • 2. Given a FA, the language accepted by the FA

can be expressed by a regular expression.

Pt 1: RE -> FA

  • Since NDFA-Λs are equivalent to FAs w.r.t

the class of languages they accept

– We can, given an RE, build an NDFA-Λ instead of an FA that accepts the language described by the RE – We can always then convert that NDFA-Λ to an equivalent FA (using the algorithms presented in the first half)

Regular Expression

  • Recursive definition of regular languages /

expression over Σ :

  • 1. ∅ is a regular language and its regular

expression is ∅

  • 2. {Λ} is a regular language and Λ is its regular

expression

  • 3. For each a ∈ Σ, {a} is a regular language and

its regular expression is a

Regular Expression

  • 4. If L1 and L2 are regular languages with regular

expressions r1 and r2 then

  • - L1 ∪ L2 is a regular language with regular expression

(r1 + r2)

  • - L1L2 is a regular language with regular expression

(r1r2)

  • - L1

* is a regular language with regular expression (r1 *)

Only languages obtainable by using rules 1-4 are regular languages.

Pt 1: RE -> FA

  • We will build our NDFA-Λ by structural

induction:

– Base case: Build an NDFA-Λ for ∅, {Λ} , and {a}, a ∈ Σ

a

∅ {Λ} {a}

Pt 1: RE -> FA

– Induction:

  • Assume R1 and R2 are regular expressions that

describe languages L1 and L2. Then, by the induction hypothesis, there exists NDFA-Λ, M1 and M2 that accept L1 and L2

  • Create NDFA-Λ that accept the languages described

by:

– R1 + R2 – R1 R2 – R1

*

slide-11
SLIDE 11

11

Pt 1: RE -> FA

  • Induction Hypothesis:

– L1 = L(M1) where M1 = (Q1,Σ, q1, A1, δ1) – L2 = L(M2) where M2 = (Q2,Σ, q2, A2, δ2)

  • Assume Q1 and Q2 are disjoint
  • Will build

– Mu = (Qu,Σ, qu, Au, δu) L(Mu) = L1 + L2 – Mc = (Qc,Σ, qc, Ac, δc) L(Mc) = L1L2 – Mk = (Qk,Σ, qk, Ak, δk) L(Mk) = L1

*

Pt 1: RE -> FA: Union

  • Basic idea

– Using Λ transitions, create a “branch” where the machine can either following one branch (representing one RE) or the other branch (representing the other RE)

Start state of M1 Start state of M2

Λ Λ

Start state of M

Pt 1: RE -> FA: Union

  • Basic idea

– If a string is accepted by either of the existing Ms, it will be accepted by the new M.

  • The set of accepting states of M will include each of

the accepting states from M1 and M2.

Pt 1: RE -> FA: Union

  • Let’s formalize this:

– Mu = (Qu,Σ, qu, Au, δu) – Qu = Q1 ∪ Q2 ∪ {qu} – Au = A1 ∪ A2 – Transition function: δu

  • δu (qu, Λ) = {q1, q2}
  • δu (qu, a) = ∅ for all a ∈ Σ
  • δu (q, a) = δ1 (q, a) if q ∈ Q1
  • δu (q, a) = δ2 (q, a) if q ∈ Q2

Pt 1: RE -> FA: Union

Pt 1: RE -> FA: Concatenation

  • Basic idea

– Build M to start at the start state of M1 and from any accepting state of M1 move directly to the start state of M2 via a Λ transition.

… … NDFA- Λ for L1 NDFA- Λ for L2 Λ

slide-12
SLIDE 12

12

Pt 1: RE -> FA: Concatenation

  • Basic idea

– After being accepted by the first machine, a string will immediately be tested on the 2nd machine

  • The set of accepting states of the new M will be the

same as that of the 2nd machine.

Pt 1: RE -> FA: Concatenation

  • Let’s formalize this:

– Mc = (Qc,Σ, qc, Ac, δc) – Qc = Q1 ∪ Q2 – Qc = q1 – Ac = A2

Pt 1: RE -> FA: Concatenation

  • Let’s formalize this:

– Transition function δc :

  • δc (q, a) = δ1 (q, a) if q ∈ Q1
  • δc (q, a) = δ2 (q, a) if q ∈ Q2
  • For all q ∈A1, δc (q, Λ) = δ1 (q, Λ) ∪ {q2}

Pt 1: RE -> FA: Concatenation Pt 1: RE -> FA: Kleene Star

  • Basic idea

– Create a new start state

  • Go from new start state to original start state via a Λ

transition

  • Go from any accepting state back to the new start

state via a Λ transition … Λ Λ

Pt 1: RE -> FA: Kleene Star

  • Basic idea

– Make new start state the accepting state. – Note that you can get from any excepting state to the new start state via a Λ transition.

slide-13
SLIDE 13

13

Pt 1: RE -> FA: Kleene Star

  • Let’s formalize this:

– Mk = (Qk,Σ, qk, Ak, δk) – Qk = Q1 ∪ {qk} – Ak = {qk} – Transition function δk

  • δk (q, a) = δ1 (q, a) if q ∈ Q1,
  • δk (qk,Λ) = {q1}
  • δu (qu, a) = ∅ for all a ∈ Σ
  • For all q ∈ A1, δk (q, Λ) = δ1 (q, Λ) ∪ {qk}

Pt 1: RE -> FA: Kleene Star Pt 1: RE -> FA: Example

  • Let’s try an example

– Create an NDFA-Λ for the regular expression:

  • (00 + 1)*(10)*

Pt 1: RE -> FA: Example

  • (00 + 1)*(10)*

Λ

(00 + 1)*(10)*

Pt 1: RE -> FA: Example

  • (00 + 1)*(10)*

Λ 1 Λ Λ

Pt 1: RE -> FA: Example

  • (00 + 1)*(10)*

Λ 1 Λ Λ Λ Λ Λ

slide-14
SLIDE 14

14

Pt 1: RE -> FA: Example

  • (00 + 1)*(10)*

(00 + 1)*(10)*

1 Λ 1 Λ Λ Λ

Pt 1: RE -> FA: Example

  • (00 + 1)*(10)*

1 Λ Λ Λ 1 Λ Λ Λ Λ Λ Λ Λ

Pt 1: RE -> FA: Summary

  • What have we shown:

– Given a language L described by a regular expression, we can build an NDFA-Λ that accepts L – Since NDFA-Λ are equivalent to FAs, we can, if we wanted to, build an FA to accept L. – Part 1 of the proof is complete. – Questions?

Pt 2: FA -> RE

  • Given a FA, M, there is a regular

expression R that described the language accepted by M.

Pt 2: FA -> RE

  • Basic idea

– This proof is surprisingly much trickier than the first – We will consider a path of states taken by the machine

  • n a given input:
  • Will develop a recursive definition for a path from one state to

another using the operations +, concatenation, Kleene Star

  • This will be sufficient, since the language accepted by the FA

is merely the union of paths starting from the start state leading to accepting states, and that Regular Languages are closed under union (by definition).

Pt 2: FA -> RE

  • Some definitions:

– M = (Q, Σ, qo, A, δ) – L(p, q)

  • Set of all strings that, on input, takes you from state

p to state q.

  • {x ∈ Σ* | δ* (p,x) = q}
slide-15
SLIDE 15

15

Pt 2: FA -> RE

  • More definitions:

– In creating the RE, we will actually consider paths that start at one state, ends at another, and goes through even another.

r s t a b

Pt 2: FA -> RE

  • More definitions:

– For a string x: we say that x represents a path from p to q going through s if:

  • There are non-null strings y,z such that
  • x = yz
  • δ* (p, y) = s
  • δ* (s, z) = q

p s q y z

Pt 2: FA -> RE

  • Even more definitions

– We will re-label each of the states of M to correspond with the integers 1…n, where n is the number of states – L(p,q, r)

  • Set of strings representing paths starting from p,

ending at q, and going through no state numbered higher than r.

Pt 2: FA -> RE

  • Finally

– L(p, q, n) =

  • The set of strings represented by paths starting at p, ending at

q, going through no state higher than n

  • L (p, q)
  • We will show that

– L(p, q, n) is regular – Will do so via induction on n – Questions?

Pt 2: FA -> RE

  • Base step

– Show L(p, q, 0) is regular – L(p, q, 0) =

  • Set of all strings represented by paths from p to q

going through no state number higher than 0.

  • In other words, consists of paths of a single

transition

  • This is clearly regular since this set is finite

r s a

Pt 2: FA -> RE

  • Induction

– Assume that L(p, q, k) is regular – L(p, q, k) =

  • Set of all strings represented by paths starting at p,

ending at q, going through no state numbered higher than k.

– Must show that L(p, q, k+1) is regular

slide-16
SLIDE 16

16

Pt 2: FA -> RE

  • Let’s consider L(p, q, k+1)

– Set of all strings represented by paths starting at p, ending at q, going through no state numbered higher than k+1. – For an x ∈ L(p, q, k+1), there are two ways this can

  • ccur:
  • The path bypasses state k+1 altogether. In this case x ∈ L(p, q,

k)

  • The path can start at p, get to state k+1, loop from k+1 back to

k+1 (0 or more times), then finally get to q

Pt 2: FA -> RE

  • Rewrite x as yzw where

– y is a string represented by the path from p to k+1 – z is a string represented by the looping from k+1 to itself – w is a string represented by the path from k+1 to q

p

k+1

q y w z

Pt 2: FA -> RE

  • Take special note

– y does not go through any state higher than k, so y ∈ L(p, k+1, k) – w does not go through any state higher than k, so y ∈ L(k+1, q, k) – A single loop of z does not go through any state higher than k, so z ∈ L(k+1, k+1, k)*

Pt 2: FA -> RE

  • Putting it all together
  • x ∈ L(p,q,k) ∪ L(p,k+1, k) L(k+1, k+1, k)*L(k+1, q, k)
  • Each of these are regular by the inductive hypothesis
  • The set of strings x above describe L(p,q,k+1)
  • We found an expression for L(p,q,k+1) using just union,

concatenation, and Kleene star

  • L(p,q,k+1) is regular.

Pt 2: FA -> RE

  • Recursive Algorithm to find RE

– Basic idea:

  • Calculate L(p,q,0)
  • Use recursive definition from proof to create

L(p,q,k+1) from L(p,q,k)

  • Repeat until L(p,q,n) is calculated
  • Recall L(p,q,n) = L(p,q)
  • Take union of all L(qo, r) for all accepting states r.

Pt 2: FA -> RE

  • Recursive Algorithm – Base cases :

– L(p,p,0)

  • The set of all strings of a single character a, such that there is a

transition from p to p on input a.

  • Λ
  • {a ∈ Σ | δ (p,a) = p } ∪ {Λ}

– L(p,q,0)

  • The set of all strings of a single character a such that there is a

transition from a p to q on input a

  • {a ∈ Σ | δ (p,a) = q }
slide-17
SLIDE 17

17

Pt 2: FA -> RE

  • Recursive Algorithm – Recursion
  • L(p,q,k+1) =

– L(p,q,k) ∪ L(p,k+1, k) L(k+1, k+1, k)*L(k+1, q, k)

Pt 2: FA -> RE

  • Let’s look at an example

Pt 2: FA -> RE

  • The set of all x accepted by this FA is:

– Set of all strings starting at state 1, ending in states 1 or 2, going through no state higher than state 3.

  • L(1,1,3) ∪ L(1,2,3)

– We will construct these starting from base case.

Pt 2: FA -> RE

  • L (p, q, 0)

3 2 1 r(p, 3, 0) r(p,2,0) r(p,1,0)

a + Λ b ∅ a Λ b a b Λ

Pt 2: FA -> RE

  • L(p,q,1) =

– L(p,q,0) ∪ L(p,1, 0) L(1, 1, 0)*L(1, q, 0)

  • Let’s try a few

– L (1,1,1) =

  • L(1,1,0) + L (1,1,0)L(1,1,0)*L(1,1,0)
  • (a + Λ) + (a + Λ) (a + Λ) * (a + Λ)
  • a*

Pt 2: FA -> RE

  • Let’s try a few

– L (1,2,1) =

  • L(1,2,0) + L (1,1,0)L(1,1,0)*L(1,2,0)
  • b + (a + Λ) (a + Λ) * b
  • a*b

– L (3,2,1) =

  • L(3,2,0) + L (3,1,0)L(1,1,0)*L(1,2,0)
  • b + a (a + Λ) * b
  • a*b
slide-18
SLIDE 18

18

Pt 2: FA -> RE

  • L(p,q,1) =

– L(p,q,0) ∪ L(p,1, 0) L(1, 1, 0)*L(1, q, 0) Λ

a*b aa* 3 b

Λ + aa*b

aa* 2

a*b a* 1 r(p, 3, 1) r(p,2,1) r(p,1,1)

Pt 2: FA -> RE

  • L(p,q,2) =

– L(p,q,1) ∪ L(p,2, 1) L(2, 2, 1)*L(2, q,1) Λ + a*b (aa*b)*b

a*b(aa*b)*

aa* + a* (baa*) (baa*)*

3 (aa*b)*b (aa*b)* aa*(baa*)* 2 a*(baa*)*bb a*(baa*)*b a*(baa*)* 1 r(p,3,2) r(p,2,2) r(p,1,2)

Pt 2: FA -> RE

  • L(p,q,3) =

– L(p,q,2) ∪ L(p,3, 2) L(3, 3, 2)*L(3, q,2) – We only need L(1, 1, 3) and L (1,2,3) – L(1,1,3) =

  • L(1,1,2) + L(1,3,2)L(3,3,2)*L(3,1,2)
  • a*(baa*)* + a*(baa*)*bb(Λ + a*b (aa*b)*b)*(aa* + a*

(baa*) (baa*)*)

– You get the idea?

Pt 2: FA -> RE

  • What have we found?

– Given an FA, we can find express the language accepted by the FA as a regular expression – I never claimed that this regular expression would be pretty!

Summary

  • Pt 1

– Given a regular language we built an NDFA-Λ that accepts the language

  • Pt 2

– Given a FA, we constructed a regular expression that describes the language accepted by the FA

Summary

  • The proof of Kleene Theorem is complete!
  • Questions
slide-19
SLIDE 19

19

Next time

  • Finding the FA with the minimal number of

states.

  • Look at the Question:

– Are there languages that are not regular?