Pt.1
Formally defining a FA (finite automaton)
-
Language of machine M is the set of strings that M accepts.
- Notation: L(M) = A
-

-
two machines are equivalent if they recognize the same language
Closed language (slide 17)
- Do note that operations on sets DO matter
- We note that for
- Class of closed languages, if are regular, then rsult must be regular Hence, if we wanted to find what accepted states M is (formally defining FA)
- Create graph with all possible states on q&y, highlight accepted states on each

pt2. Nondet
NFA Formal Defition

DFA: Deterministic Finite Automaton vs NFA: Nondeterministic Finite Automaton
- In below NFA means if q1 accepts 1, it can either loop back to itself OR go to q2
- In a 11 we cannot have duplicate states (eg. below cannot have 0,1 and would just be 0)
- may hv arrows exiting from each state per each node and edge

- Every NFA has a DFA (its just a lot longer/larger)
Example!

Then we can formally describe this FA as:
Converting NFA to DFA steps

- We first take the powerset of all possible states in the DFA and draw them out
- We can denote this by , where n= all possible states
- So if we have , we have 8 total possible states, we start at the empty set (which loops all possible inputs into itself),
- When we cut about a slice of a DFA we are esentially making a slice in the tree.
(left off on slide 41)
Theroms regarding regular languages
How can we prove regular languages are closed under union operatiopn?
- Esentially because we can accept into either set, and both sets are regular, our restult must be regular
Kleene star
An infinite set which contains one set that has the powerset and all elements with their repitions
- eg.
- When proving this, we need to create a new state (empty state) to get into the actual NFA
Proving under DFA
How would we prove this using a DFA? (Since they can always be represnrted as the same)
Closure under Regular operations, proving
Proving Closure in Union Operation (slide 43)
Therom
The class of regular languages is closed under the union operation.
We can create 2 NFAs, and can realise that any input into either NFA will result in a closed language, thus combining the first input to be either NFA, we realise that the overall NFA combinging both is closed.
Proving Closure under Concat Operation (Slide 45)
Therom
The class of regular languages is closed under the Concat operation
Realise that all outputs of the regular langauge leading to the input of the next language must end (in any order) to a regular language.
pt.3 Regular Expressions
We know our symbols such as +, -, hence we can extend the same operations to our sets/languages. Esentially, we’re creating basic operators on our sets
Generating regex from words:
Converting regex to NFA
TOC_regex_ex21.excalidraw
Excalidraw Data
Text Elements
start construct a&b, so we can construct all possible states
then slowly construct the full expression
Embedded Files
81ca14d59dea541da9ccde48ab2cfa0550dee005: Pasted Image 20250916123432_727.png
Link to original
Converting DFA to regex: (p75)
tTOC_ch1_ex25.excalidraw
Excalidraw Data
Text Elements
- Remove state 2, to obtain:
\epsilon
1
b(\cupb)*\epsilon
a
Draw empty in/out nodes into start/end state
Remove the final node, combine → \epsilon(a)b(\cupb)\epsilon \cup \empty
Embedded Files
03faf9683a305785f7db8da2551824b0a3b914f9: Pasted Image 20250923121425_887.png
Link to original
Steps for conversion
- Start by taking out the in node
- Take out rest of the nodes (in any order), save out node for last
- Use * to concat expressions, if more than 1 expr for IN, use to denote
,
For large example (p80)
Generalized Nondeterministic Finite Automata (GNFA)
Why care? TODO!
GNFA Conditions:
A NFA w/ arrows may hv regex as label, has the following conditions:
- Start state transition arrows to every other state, but no arrows coming in from any other state
- only ONE accept state with arrows coming in from every state
- No arrows going out to other state
- accept state != start state
- Every other state (!start || Finish):
- Out arrow to every other state
- In arrow to itself
Formal Defition
5 tuple : (just change)
- Q: finite set of states
- input alphabet
- transition function
- : start, accept
Converting DFA to GNFA
- New start state w/ old start state
- New accept state w/ all old accept states
Converting GNFA down to only 2 states from k > 2 states
Sho0uld note that the start state for every empty state always contains some
TOC_slide65_problem.excalidraw
Excalidraw Data
Text Elements
Want to rip out q_{rip} Take into account conditions, need to see what goes to q_j Because q_j cannot hv go out
If we hv langauge A, take A*, can language still be empty? No! Always have eplison for every A
Embedded Files
582279f767afd11ead4070779b0de8faf8d07a12: Pasted Image 20250916124526_724.png
Link to original
DFA to CFG
- Generate the DFA,
Regular Langauges TODO should ask for example on this 4 u 2 solve..
Proof
Let M be some DFA for langauge A, create GNFA G starting frm M We use procedure like so:
- let k = # of states of G
- k=2 ? G start&accept state + 1 arrow
- k>2? select any state, let G’ be GNFA, then for any other state, we need to define transition function, start func should be
todoStudy I should ask about this and for an actual example.. I should also finish below..
Proof: For any GNFA G, CONVERT(G) G (slide 72)
Base case:
- Prove by induction,
- base case: k=2, Regex seen onn label R describes all strings allow start→end
- Hence expr G
Induction step
Convert DFA into regex
1) Add new start and accept state (so now we have 4 nodes)
2) Take out one of the original states (can -rm 1 || 2)
1) Rip 2 out, draw arrow from 1 to new end state, arrow has
to end state
3) Remove the remaining original state to now have just new start & end state
1) Result in start →
Non Regular Languages
Pumping Lemma
For some regular language A , there must be some length p s/t
- s is any string in A of at least p length
- s can be divided into 3 pieces: xyz:
- for i>0, , i++
https://math.stackexchange.com/a/113949
Steps
- Replace n with p in given equastion eg.
- We generate our sample string s:
- Where each comma delimits xyz, and are assumed to have the following properties (since they are normal):
- |y| > 0
So we can generate
Which shows that there are more 0’s than 1’s, (denoted by p+l for length of 0s, m for length of 1s which is ) and hecne is inval
Example1:
little more Show following is noyt regular:
- Proof using contradiction, assuming B is regular
- Because it is regular, we then create some string s of length p
- We create some valid language string:
s=0011, where the size ofsp- Note
s=0101isn’t valid - So for p times we have
- Note
- We can split into the three parts (for some n length), and assume we add y’s length to be , is the language still regular? Nope, we can realise
Esentially, the goal is to create some string S that is outside the language (so coming up with xyz is up 2 u). Obv its a lot of redunent cases
Example 2:
C= {w | w has equal amnt of 0’s and 1’s}
Show not regular!,
- Assuming C is regular, create our random pair string length =++
- Esentially just need to come up with some S that doesn’t make the language regular, then because for that length, we realise that the language must not be regular.
Ex3
Towards contreadiction, assume D regular. W/ pumping len p. Consider
Sicne D and |s| are 2p +2 p then we can apply pumping lema to s (need to prove that the length is greather than the original)
- We then need to prove the other 2 points, which aren’t too bad.
- Finally, we create ourt sample string and make some diffrernt that makes the language not regular By inflatinbg our y^i, the langauge does not fit the conditions to ensure the language is regular. From these 2, S’ is not ww for some w, QED
Ex4!
We have following rules Pumping Lemma Defition
Prove is not regular. We take the first case of n, and the rest so we have:
So lets make our xyz from our original S string, and that we know the following conditials form the defition to create the partitions, where | x + y| p. We know which is not of ^2 length
Ex 5!
- Show that E is not regular
- Proof: Towards contradiction assume is regular, then:
- Consider Where we must show that there are always more 0’s than 1’s
tldr. we took out several 0’s that weren’t supposed to be thr. We ended up with an atleast equal amount of 0’s and 1’s which isnt allowed (it could be more but doesn’t matter as long as one of the cases hold true).
vs
Empty set vs null set
- can be used as a transition state in edges. For example we can go to q_1 → q_2 with no action ()
- Literially means no action can be made for this space, usually reserved when generating table to say that from this node, 1 will go nowhere (no edges denoting it)