CS350 Midterm 1
Tokenizing NFA to accept {ab*, aba*}
- Standard shorthand NFA -𝜀 transition version of choice (from the start state)
NFA's allow choice by (two things):
0,1,or multiple edges from a state transitions on epsilon
powerset of S
2^S, the powerset of S is the set of all subsets of S.
When doing NFA -> Regex make sure to add what first
A new start state and new final state
How do you do closure for Union?
Add a new start state and draw two separate epsilon transitions leaving it, this is to show the aspect of choice.
Difference between transition function for DFA and NFA's
An NFA can move to multiple states for a given input, while a DFA always moves to only one state for each input. DFA transition: δ(q0, 'a') = 1 NFA transition:δ(q0, 'a') = {1,2}
a GNFA is
An NFA where we allow transitions ot be regular expressions rather than just single characters
oracle
Ask the oracle, it will suggest a path that leads towards accepting the string if it exists.
How do you do closure for Concatenation
Connect the final states of the first NFA to the start state of the seconf NFA by epsilon transitions. Make the the first NFA's unfinal.
Union(or)
Contains elements i either S or T, the union of two sets joins them together
How do you do closure for Kleene star?
For NFA 1, Add a new start state and connect it to the old start state with an epsilon transition. Make the new start state final. Connect the final states in NFA 2 to the new final state in NFA 1 with epsilon transitions.
Injective, Surjective, Bijective
Injective: one to one, every input has a different unique output Surjective: every output is hit and has atleast one input mapping to it. Bijective: Both, every input is matched to a unique output and every output is hit.
Formalization
Make things fully precise
Dfas can have how many start states and how many final states?
One start state and one or more final states
Transition function for DFA:
Q x 𝚺 -> Q
Difference between regular transition function and extended transition function
Regular: Only tells what happens with one letter, like 'a' or 'b'. Ex: δ(q0, 'a') = q1 Extended: Tells what happens with a whole string, like 'ab' or 'aab'. δ*(q0, 'ab') = q2
Formal defintion of Kleene Star
S* = {X1X2...Xn: Xi∈S, n∈N} or {ε} U S U S^2 U S^3 U S^4....S^n}
Abstraction
Strip something down to its essence
Intersection(and)
The elements in both sets, what both sets have in common
Regular language
The language accepted by NFA's and DFA's
What condition is necessary for a DFA to accept 𝜀? Formally express this condition in terms of the DFA quintuplet.
The start state must be one of the final states. q0 ∈ F
When combining languages using closure what is the order you should do it in?
Union, concatenation, kleene star
Cloning/Forking
When we face a choice, make a clone and have each clone take a different path. If atleast one clone, survives the string is accpeted.
When drawing tokenizing NFAs for languages like {ab*,aba*} or {bb*,bbb*} and you are drawing the union style NFA, make sure to:
connect the last states in each, to the start state with an epsilon transition, and make the start state a final state because of the kleene star
Clones behave
deterministically
Empty string is written as
epsilon
When drawing the transition function diagrams for NFA's dont forget to add which transition, a, b and
epsilon
string
finite sequence of alphabet characters
alphabet
finite set of symbols
A set S is closed under unary operation if
if applying that operation to any element of S results in an element that is also in S. For all a∈S, we have f(a)∈S. Let S={1,2,3} and the unary operation f(a)=a^2 f(1) = 1 ∈ S f(2) = 4 ∉ S Not closed
Kleene Star
means 'repeat 0 or more times
Diff between DFA and NFA
only change is the transition function 𝛅: Q × (𝚺 ∪ {𝛆}) ➝ 2^Q (the transition function)
DFA's, NFA's and regular expressions all correspond to:
regular languages
language
set of strings;
The Kleene star of a set S, denoted S∗, is usually infinite in size when
the set S contains at least one string that is not the empty string (i.e., S is non-empty).
A set S is closed under binay operation if
whenever you apply the operation to any two elements of S, the result is also an element of S. For all a,b∈S, we have a∗b∈S.
What language is accepted by a DFA M = (𝑄, Σ, 𝛿, 𝑞0 , 𝐹) ?
𝐿(𝑀) = {𝑤 ∈ Σ* : 𝛿∗(𝑞0,w) ∈ 𝐹}
Extended transition function
𝛅*: Q × 𝚺* -> Q