2024-01-26 13:20:09
This commit is contained in:
parent
791a076e11
commit
2a3cb44d47
12
.obsidian/workspace.json
vendored
12
.obsidian/workspace.json
vendored
@ -13,7 +13,7 @@
|
|||||||
"state": {
|
"state": {
|
||||||
"type": "markdown",
|
"type": "markdown",
|
||||||
"state": {
|
"state": {
|
||||||
"file": "UNB/Year 4/Semester 2/CS3873/2024-01-26.md",
|
"file": "UNB/Year 4/Semester 2/CS2333/2024-01-26.md",
|
||||||
"mode": "source",
|
"mode": "source",
|
||||||
"source": false
|
"source": false
|
||||||
}
|
}
|
||||||
@ -85,7 +85,7 @@
|
|||||||
"state": {
|
"state": {
|
||||||
"type": "backlink",
|
"type": "backlink",
|
||||||
"state": {
|
"state": {
|
||||||
"file": "UNB/Year 4/Semester 2/CS3873/2024-01-26.md",
|
"file": "UNB/Year 4/Semester 2/CS2333/2024-01-26.md",
|
||||||
"collapseAll": false,
|
"collapseAll": false,
|
||||||
"extraContext": false,
|
"extraContext": false,
|
||||||
"sortOrder": "alphabetical",
|
"sortOrder": "alphabetical",
|
||||||
@ -102,7 +102,7 @@
|
|||||||
"state": {
|
"state": {
|
||||||
"type": "outgoing-link",
|
"type": "outgoing-link",
|
||||||
"state": {
|
"state": {
|
||||||
"file": "UNB/Year 4/Semester 2/CS3873/2024-01-26.md",
|
"file": "UNB/Year 4/Semester 2/CS2333/2024-01-26.md",
|
||||||
"linksCollapsed": false,
|
"linksCollapsed": false,
|
||||||
"unlinkedCollapsed": true
|
"unlinkedCollapsed": true
|
||||||
}
|
}
|
||||||
@ -125,7 +125,7 @@
|
|||||||
"state": {
|
"state": {
|
||||||
"type": "outline",
|
"type": "outline",
|
||||||
"state": {
|
"state": {
|
||||||
"file": "UNB/Year 4/Semester 2/CS3873/2024-01-26.md"
|
"file": "UNB/Year 4/Semester 2/CS2333/2024-01-26.md"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -158,8 +158,9 @@
|
|||||||
},
|
},
|
||||||
"active": "64b233ae6a058454",
|
"active": "64b233ae6a058454",
|
||||||
"lastOpenFiles": [
|
"lastOpenFiles": [
|
||||||
"UNB/Year 4/Semester 2/STAT2593/2024-01-26.md",
|
|
||||||
"UNB/Year 4/Semester 2/CS3873/2024-01-26.md",
|
"UNB/Year 4/Semester 2/CS3873/2024-01-26.md",
|
||||||
|
"UNB/Year 4/Semester 2/CS2333/2024-01-26.md",
|
||||||
|
"UNB/Year 4/Semester 2/STAT2593/2024-01-26.md",
|
||||||
"UNB/Year 4/Semester 2/CS2333/2024-01-22.md",
|
"UNB/Year 4/Semester 2/CS2333/2024-01-22.md",
|
||||||
"UNB/Year 4/Semester 2/CS2333/2024-01-24.md",
|
"UNB/Year 4/Semester 2/CS2333/2024-01-24.md",
|
||||||
"UNB/Year 4/Semester 2/CS3873/2024-01-24.md",
|
"UNB/Year 4/Semester 2/CS3873/2024-01-24.md",
|
||||||
@ -190,7 +191,6 @@
|
|||||||
"Semester 2/CS3873",
|
"Semester 2/CS3873",
|
||||||
"Semester 1/CS3418/11-27-2023.md",
|
"Semester 1/CS3418/11-27-2023.md",
|
||||||
"Semester 1/CS3418/11-24-2023.md",
|
"Semester 1/CS3418/11-24-2023.md",
|
||||||
"Semester 1/CS3418/11-15-2023.md",
|
|
||||||
"Semester 1/CS2418",
|
"Semester 1/CS2418",
|
||||||
"Semester 1/CS3418"
|
"Semester 1/CS3418"
|
||||||
]
|
]
|
||||||
|
85
UNB/Year 4/Semester 2/CS2333/2024-01-26.md
Normal file
85
UNB/Year 4/Semester 2/CS2333/2024-01-26.md
Normal file
@ -0,0 +1,85 @@
|
|||||||
|
# Finite Automata
|
||||||
|
Simple machines that take in strings (sequences of symbols) as input and recognize whether or note each input string satisfies some condition(s)
|
||||||
|
|
||||||
|
Finite automata use states to keep track of important information about symbols
|
||||||
|
|
||||||
|
## Mathematical definition of a finite automaton
|
||||||
|
$M = (Q, \sum, \delta, q, F)$
|
||||||
|
- $Q$ is a finite set of states
|
||||||
|
- $\sum$ is a finite set of input symbols called the input alphabet
|
||||||
|
- $\delta$ is the transition function
|
||||||
|
- Takes every pair consisting of a state and an input smbol and returns the next state, this tells us everything we need to know about what the machine does in one computation step
|
||||||
|
- $q \in Q$ is the start state
|
||||||
|
- $F \subseteq Q$ is the set of accept states
|
||||||
|
|
||||||
|
## Acceptance by a finite automaton
|
||||||
|
Let M be a finite automaton
|
||||||
|
Let $w = w_1, w_2, ..., w_n$ be n input string over \sum
|
||||||
|
As input string w is process by $M$, define the sequence of visited states $r_0, r_1, ..., r_n$ as follows:
|
||||||
|
- $r_0 = q$
|
||||||
|
- $\forall i = 0,1, ... n-1, r_{i+1} = \delta(r_i, w_{i+1})$
|
||||||
|
If $r_n \in F$ then $M$ accepts $w$, otherwise $M$ rejects $w$
|
||||||
|
|
||||||
|
Note: The empty string $\epsilon$ has length $0$, it is accepted by $M$ if any only if the start state is an accept state
|
||||||
|
|
||||||
|
For a given finite automaton $M$, the set of stings accepted by $M$ is the language of $M$ and is denoted $L(M)$
|
||||||
|
|
||||||
|
A language $A$ is called regular if there exists a finite automaton $M$ such that $A = L(M)$
|
||||||
|
|
||||||
|
## Example of finite automata
|
||||||
|
A finite automation $M_1$ that accepts
|
||||||
|
$$\{w \in \{0,1\}^* \ | \ n_1(w) \geq 2\}$$
|
||||||
|
(State diagram on board)
|
||||||
|
A is the start sate and C is the accept state
|
||||||
|
A -> B (On 1)
|
||||||
|
B -> C (On 1)
|
||||||
|
A -> A (On 0)
|
||||||
|
B -> B (On 0)
|
||||||
|
C -> C (On 0, 1)
|
||||||
|
|
||||||
|
A: we have seen no ones yet
|
||||||
|
B: we have seen exactly one 1
|
||||||
|
C: we have seen two ore more 1's
|
||||||
|
|
||||||
|
## Example 2 of finite automata
|
||||||
|
A finite automation $M_2$ that accepts
|
||||||
|
$$\{w \in \{0,1\}^* \ | \ n_1(w) = 2\}$$
|
||||||
|
(State diagram on board)
|
||||||
|
A is the start state and C is the accept state
|
||||||
|
A -> B (On 1)
|
||||||
|
B -> C (On 1)
|
||||||
|
C -> D (On 1)
|
||||||
|
A -> A (On 0)
|
||||||
|
B -> B (On 0)
|
||||||
|
C -> C (On 0)
|
||||||
|
D -> D (On 0, 1)
|
||||||
|
|
||||||
|
Note: D is an example of a dead state, in which you cannot escape after
|
||||||
|
|
||||||
|
## Example 3 of finite automata
|
||||||
|
A finite automation $M_3$ that accepts
|
||||||
|
$$\{w \in \{a,b\}^* \ | \ \text{w starts with abb}\}$$
|
||||||
|
(State diagram on board)
|
||||||
|
A is the start state and D is the accept state
|
||||||
|
A -> B (On a)
|
||||||
|
B -> C (On b)
|
||||||
|
C -> D (On b)
|
||||||
|
D -> D (On a, b)
|
||||||
|
A -> X (On b)
|
||||||
|
B -> X (On a)
|
||||||
|
C -> X (On a)
|
||||||
|
X -> X (On a ,b)
|
||||||
|
|
||||||
|
## Example 4 of finite automata
|
||||||
|
A finite automation $M_4$ that accepts
|
||||||
|
(Didn't catch the definition)
|
||||||
|
$$\{w \in \{0,1\}^* \ | \ n_1(w) = 2\}$$
|
||||||
|
(State diagram on board)
|
||||||
|
A is the start state and D is the accept state
|
||||||
|
|
||||||
|
(state transitions would go here)
|
||||||
|
|
||||||
|
A: the most recent symbol was 1 or we have seen no symbols
|
||||||
|
B: the last symbol was 0, but we have noon seen 010 yet
|
||||||
|
C: the last two symbols were 01, but we have not seen 010
|
||||||
|
D: we have seen the pattern 010
|
Loading…
Reference in New Issue
Block a user