midterm review
This commit is contained in:
parent
2514500823
commit
647c69aa69
@ -59,4 +59,99 @@ Symbol: Member of alphabet
|
||||
|
||||
String: Sequence of symbols
|
||||
|
||||
Language: Set of strings
|
||||
Language: Set of strings
|
||||
|
||||
# Lecture Jan 24
|
||||
|
||||
idk he was talking about proofs in stuff I wasn't paying attention
|
||||
|
||||
# Lecture Jan 27
|
||||
|
||||
## 1.1 Finite Automata
|
||||
|
||||
One of the simplest models of computation is the finite state machine also called finite automata
|
||||
|
||||
### Example
|
||||
|
||||
Smoke Alarm
|
||||
|
||||
| Sensors | Values |
|
||||
| ------------ | -------------------- |
|
||||
| Smoke Sensor | Smoke, No smoke |
|
||||
| Button | Not pressed, pressed |
|
||||
|
||||
#### State Diagram
|
||||
|
||||
![[fsm-diagram.png]]
|
||||
|
||||
#### State Transition Table
|
||||
|
||||
| | No Smoke, unpressed | No smoke, pressed | Smoke, unpressed | Smoke, pressed |
|
||||
| -------- | ------------------- | ----------------- | ---------------- | -------------- |
|
||||
| No Alarm | No Alarm | No Alarm | Alarm | No Alarm |
|
||||
| Alarm | No Alarm | No Alarm | Alarm | No Alarm |
|
||||
|
||||
|
||||
### Formal Definition of a Finite State Machine
|
||||
|
||||
A finite automaton is a 5 tuple (Q, $\Sigma$, $\delta$, q, F) where
|
||||
1) Q is a finite set called the states
|
||||
2) $\Sigma$ is a finite set called the _alphabet_
|
||||
3) $\delta = Q \times \Sigma \rightarrow Q$ is the transition function
|
||||
4) $q \in Q$ is the start state
|
||||
5) $F \subset Q$ is the set of accept state
|
||||
|
||||
# Lecture Jan 29
|
||||
|
||||
__Define__ A language is called a _regular language_ if some FSM recognizes it.
|
||||
|
||||
# Lecture Feb 5
|
||||
|
||||
The transition function is taking in the current state ($Q$), a symbol ($\Sigma$), and outputs a new state ($Q$).
|
||||
|
||||
DFA - Determinant Finite Automata
|
||||
|
||||
$\delta((q_{01}, q_2), b) = (\delta(q_{01}, b), \delta(q_2, b))$
|
||||
|
||||
# Lecture Feb 7th
|
||||
|
||||
![[Pasted image 20250207085048.png]]
|
||||
|
||||
^ NFA that accepts any string that has a zero three places from the end
|
||||
|
||||
## Formal Definition of an NFA
|
||||
|
||||
An NFA is a 5 tuple ($Q$, $\Sigma$, $\delta$, $q_o$, F) where
|
||||
|
||||
1) $Q$ is a finite set of states
|
||||
2) $\Sigma$ is the alphabet
|
||||
3) $\delta : Q \times \Sigma_\epsilon \rightarrow P(Q)$
|
||||
4) $q_0 \in Q$
|
||||
|
||||
|
||||
# Lecture Feb 10th
|
||||
|
||||
When reading a particular symbol $a$ in a state $R_1$ our DFA simulator will apply the following the transition $f^n$
|
||||
|
||||
$\delta^1(R,a) = {r \in R} | \delta(r,a)$
|
||||
|
||||
## NFA to DFA example
|
||||
|
||||
![[NFA-to-DFA.png]]
|
||||
|
||||
Top is an NFA, lower is DFA version of it
|
||||
|
||||
# Lecture Feb 14th
|
||||
|
||||
$A^\star = \{x | x \in \{0, \text{None}\}\}$
|
||||
$B^\star = \{x | x \in \{1, \text{None}\}\}$
|
||||
|
||||
Is $01 \in \{A^\star \cup B^\star \}$? No.
|
||||
$\{A^\star \cup B^\star \} = \{\{0\}^\star \cup \{1\}^\star \}$
|
||||
|
||||
Is $01 \in (A \cup B)^\star$? Yes.
|
||||
$= (0 \cup 1)^\star$
|
||||
$A \cup B = \{0, 1\}$
|
||||
|
||||
Empty set != empty string
|
||||
$\{\varnothing\} \neq \{\epsilon\}$
|
||||
|
||||
40
Formal Midterm Review.md
Normal file
40
Formal Midterm Review.md
Normal file
@ -0,0 +1,40 @@
|
||||
# Pumping Lemma
|
||||
|
||||
Show $L = \{0^n1^n | n=03 \text{ is not regular}\}$.
|
||||
Assume $L$ is regular.
|
||||
|
||||
Pick a string and some pumping length, $P$.
|
||||
|
||||
$s=0^p1^p$
|
||||
|
||||
Now show that for any way to divide the string into $xyz$, pumping $s$ results in a string outside of the language.
|
||||
|
||||
$xy^2z$ contains symbols out of order, and more 0s than 1s.
|
||||
|
||||
# Finite State Machine
|
||||
|
||||
A finite automaton is a 5 tuple (Q, $\Sigma$, $\delta$, q, F) where
|
||||
1) Q is a finite set called the states
|
||||
2) $\Sigma$ is a finite set called the _alphabet_
|
||||
3) $\delta = Q \times \Sigma \rightarrow Q$ is the transition function
|
||||
4) $q \in Q$ is the start state
|
||||
5) $F \subset Q$ is the set of accept state
|
||||
|
||||
# Chomsky Normal Form
|
||||
|
||||
Let $G$ be a Context Free Grammar (CFG). $G$ is in Chomsky Normal Form provided that all rules are of the form
|
||||
1) $A \rightarrow AA$
|
||||
2) $A \rightarrow u$
|
||||
|
||||
The start state cannot appear on the right hand side. Cannot $A \rightarrow \epsilon$ unless start state.
|
||||
|
||||
# NFA that's the union of two languages
|
||||
|
||||
|
||||
|
||||
# Misc.
|
||||
|
||||
$\text{REG} \in \text{CFL}$
|
||||
but
|
||||
$\text{REG} \neq \text{CFL}$
|
||||
|
||||
BIN
NFA-to-DFA.png
Normal file
BIN
NFA-to-DFA.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 51 KiB |
BIN
Pasted image 20250207085048.png
Normal file
BIN
Pasted image 20250207085048.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 10 KiB |
BIN
fsm-diagram.png
Normal file
BIN
fsm-diagram.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 32 KiB |
Loading…
x
Reference in New Issue
Block a user