Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 10

CIS 2620

Automata, Computability, and Complexity

Fall 2023

Instructor: Rajeev Alur

Midterm 1 Review
Midterm Exam

Midterm 1: Tuesday, Oct 3, Noon -1.30pm

o Last name: A-L : Heilmeier Hall (Towne 101)


o Last name: M-S: DRLB A2
o Last name: T-Z: DRLB A6

Out of 50pts

Topics: Automata; Lectures A1 – A9

Open textbook, lecture slides, handouts, homework solutions

See Piazza for two past midterms

2
DFAs, NFAs, and Regular Expressions

S = {a, b, c };

DFA M: a
b
q0 q1
b
c a,c
q2 a, b, c

Is this regular expression correct for above M: (a* b b )*

Need to know: How to construct a DFA/NFA/Reg-exp from a


description, and how to understand the constraint expressed by a
given DFA/NFA/Reg-exp

3
a
Correctness Proof for DFAs q0
a
q1

b b
a a
Given A described by a mathematical constraint over strings q2 q3
how to show that a DFA M accepts exactly strings in A
b b

To prove: For all strings w,

d*(q0, w) = q0 if count(w,a) is even and w does not end with b


= q1 if count(w,a) is odd and w does not end with b
= q2 if count(w,a) is even and w ends with b
= q3 if count(w,a) is odd and w ends with b

Prove the claim by induction on string w


Need to know: What is the proof technique, how to use it, and why do we
need it ?

Aside: Write reg-exp that describes strings corresponding to q 1


4
Lower Bounds and Non-regularity

Given A, how do we show that every DFA accepting A must have at least k
states ? Or that A is not regular ?

Two strings u and v are distinguishable w.r.t. A if there exists an


extension w such that only one of u.w and v.w is in A

To show DFA for A needs at least k states, find a set S of k pair-wise


distinguishable strings
To show A is not regular, find an infinite set S of pair-wise
distinguishable strings

Complete the proof: don’t just give S


Consider all possible cases of pairs of strings in S
Don’t apply proof patterns without careful thought!

5
Lower Bounds and Non-regularity

Exercise: A = { w | count(w,a) > count(w, b) }

Exercise: S = {a, b}; Ak = { w | w contains a^k as a substring }

Exercise: S contains k symbols;


Ak = { w | no symbol occurs more than once in w }

6
Closure Properties

What does it mean for regular languages to be closed under operation X?

Know basic closure constructions:


Product (for intersection)
How to complement
Concatenation, Kleene-star

If we define new operation X on strings, then to show that regular


languages are closed under this operation X:
Consider a DFA M for A
Show how to construct NFA/DFA M’ which accepts a string w
if and only if w can be obtained by applying X to a string accepted by M

First step in construction: understanding what M’ needs to check

7
Closure Properties Example Problem

Substring(A) = { w | w is a substring of some string in A }

Show that regular languages are closed under Substring operation

8
Automata Constructions

1. How to translate an NFA (or e-NFA) to a DFA ?


Subset construction, what’s its cost?

2. How to translate a regular expression to e-NFA?


Closure constructions for union, concatenation, Kleene-star

3. How to minimize a DFA ?


Polynomial-time algorithm to find pairs of distinguishable
states

9
Decision Procedures

Membership question:
Given a DFA M and input w, does M accept w ?
Non-acceptance :
Given a DFA M and input w, does M reject w ?
Emptiness question:
Given a DFA M, is there a string that M accepts ?
Universality question:
Given a DFA M, does M accept all strings ?
Equivalence question:
Given two DFAs M and M’, do they accept exactly same languages ?

What happens if instead of DFA, input is an NFA, or a regular expression?

10

You might also like