0% found this document useful (0 votes)
15 views

Lecture 2 Final

Uploaded by

Mado Saeed
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
15 views

Lecture 2 Final

Uploaded by

Mado Saeed
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 12

18.404/6.

840 Lecture 2

Last time: (Sipser §1.1)


- Finite automata, regular languages
- Regular operations
- Regular expressions
- Closure under

Today: (Sipser §1.2 – §1.3)


- Nondeterminism
- Closure under and
- Regular expressions → finite automata
Goal: Show finite automata equivalent to regular expressions

- This week’s check-ins will not be counted


- TA office hours will be posted tomorrow
- Chat is restricted to TAs only.
Problem Sets

- 35% of overall grade


- Problems are hard! Leave time to think about them.
- Writeups need to be clear and understandable, handwritten ok.
Level of detail in proofs comparable to lecture: focus on main ideas.
Don’t need to include minor details.
- Submit via gradescope (see Canvas) by 2:30pm Cambridge time.
Late submission accepted (on gradescope) until 11:59pm following day:
1 point (out of 10 points) per late problem penalty.
After that solutions are posted so not accepted without S3 excuse.
- Optional problems:
Don’t count towards grade except for A+.
Value to you (besides the challenge):
Recommendations, employment (future grading, TA, UROP)
- Problem Set 1 is due in one week.
Closure Properties for Regular Languages
Theorem: If are regular languages, so is (closure under )
Recall proof attempt: Let recognize
recognize
Construct recognizing

𝑀1 𝑀2

should accept input


if where
accepts and accepts .
𝑀
𝑤
𝑥 𝑦
Doesn’t work: Where to split ?
Hold off. Need new concept.
Nondeterministic Finite Automata
𝑁1 a a
b a,ε
𝑞1 𝑞2 𝑞3 𝑞4
b

New features of nondeterminism:


- multiple paths possible (0, 1 or many at each step)
- ε-transition is a “free” move without reading input
- Accept input if some path leads to accept
Check-in 2.1
Example inputs:
- ab accept What does do on input aab
Nondeterminism ?
doesn’t
- aa reject (a) Accept
correspond to a physical
- aba accept (b)machine
Reject
- abb reject
we can build.
(c) Both Accept and
However, Reject
it is useful Check-in 2.1

mathematically.
NFA – Formal Definition
𝑁1 a a
b a,ε
𝑞1 𝑞2 𝑞3 𝑞4
b

Defn: A nondeterministic finite automaton (NFA)


is a 5-tuple a
Ways to think about
sta alp tran sta cce
tes ha siti rt s pt
be o ta st
t n f te ate
nondeterminism:
un s
cti
on Computational: Fork new parallel
- all same as before except thread and accept if any thread
- leads to an accept state.
power set
Σ ∪{ε } Mathematical: Tree with
- In the example: branches.
Accept if any branch leads to an
accept state.
Magical: Guess at each
Converting NFAs to DFAs
Theorem: If an NFA recognizes then is regular
Proof: Let NFA recognize
Construct DFA recognizing
(Ignore the ε-transitions, can easily modify to handle them)
ID E A : D FA keeps track of the subset of possible states in
NFA .
Check-in 2.2
𝑀 𝑀′ Construction of :
If has states,
𝑞 3 how many
states does have by this
construction? , for some
(a)
𝑞7
(b)
(c) intersects
NFA DFA
Check-in 2.2
Return to Closure Properties
Recall Theorem: If are regular languages, so is
(The class of regular languages is closed under
union)
New Proof (sketch): Given DFAs and recognizing
and
𝑀 𝑀1 Construct NFA recognizing
Nondetermini
sm
ε parallelism
vs
𝑀2 guessing
ε
Closure under (concatenation)
Theorem: If are regular languages, so is
Proof sketch: Given DFAs and recognizing and
Construct NFA recognizing

𝑀
𝑀1 𝑀2
ε
should accept input
ε if where
accepts and accepts .

𝑤=¿ 𝑥 𝑦
Nondeterministic has the option to
jump to when accepts.
Closure under (star)
Theorem: If is a regular language, so is
Proof sketch: Given DFA recognizing
Construct NFA recognizing

𝑀′
Check-in 2.3
𝑀 ε should accept input
ε If has states,
if how many states does
ε
have bywhere
this construction?
and accepts each
(a)
(b) 𝑤=¿
𝑥1 𝑥 2 𝑥 3 𝑥4
Make sure accepts ε (c)

Check-in 2.3
Regular Expressions NFA
Theorem: If is a regular expr and then is regular
Proof: Convert to equivalent NFA :

If is atomic: Equivalent is:


𝑎 Example:
for
Convert to equivalent NFA
: a
: b
: a ε b
If is composite:

}
: ε a
Use closure constructions ε a ε b
:
a ε
ε ε a ε b
ε
ε
Quick review of today
1. Nondeterministic fi nite automata (NFA)
2. Proved: NFA and DFA are equivalent in power
3. Proved: Class of regular languages is closed
under
4. Conversion of regular expressions to NFA
Check-in 2.4
Recitations start tomorrow online (same link as for lectures).
They are optional, unless you need more help.
You may attend any recitation(s).
Which do you think you’ll attend? (you may check several)
(a) 10:00 (b) 11:00 (c) 12:00
(d) 1:00 (e) 2:00 (f) I prefer a different time (please Check-in 2.4
post on piazza, but no promises)

You might also like