Topological sort and NFAs.

main
Joshua Potter 2025-01-17 08:29:07 -07:00
parent f0f7eb4621
commit e25be7b823
13 changed files with 741 additions and 23 deletions

View File

@ -233,7 +233,9 @@
"schroder-bernstein.png",
"dfs.gif",
"dfs-edge-classification.png",
"complex-plane-point.png"
"complex-plane-point.png",
"nfa-example.png",
"topological-sort.png"
],
"File Hashes": {
"algorithms/index.md": "3ac071354e55242919cc574eb43de6f8",
@ -910,7 +912,7 @@
"_journal/2024-10/2024-10-16.md": "cd778e1be2737462d885ae038c7b9744",
"_journal/2024-10/2024-10-15.md": "c21679bd2c3b29f5a86d56a1fd23b18f",
"_journal/2024-10-22.md": "4af65962007cfecdb2c679b44b56d25f",
"algorithms/dfs.md": "0f86e65b9ac6c4dbdd3b9c2a108a65fb",
"algorithms/dfs.md": "12a95fbc2fafaf87ee648c480ee041c3",
"_journal/2024-10/2024-10-21.md": "de1a0861e87df29aeff11a291f8fbd45",
"_journal/2024-10-23.md": "51b2ca6edf23b6a64fd7d3638a0b54cb",
"_journal/2024-10/2024-10-22.md": "5ff4eb7eba58e77c4fb65b7162a485e6",
@ -962,7 +964,7 @@
"_journal/2024-11/2024-11-21.md": "951b6034d60a40dbd8201c50abf0dbb9",
"_journal/2024-11/2024-11-20.md": "951b6034d60a40dbd8201c50abf0dbb9",
"_journal/2024-11/2024-11-19.md": "d879f57154cb27cb168eb1f1f430e312",
"set/cardinality.md": "9610578a6ef32f70f90bfc7b52dea844",
"set/cardinality.md": "4c76186740c2ad2ae29ca9b8d9343065",
"geometry/area.md": "7f947bb5ac782495a1fb4a63bb2463e7",
"_journal/2024-11-23.md": "911f82ab8aede5ecdb96493aef64b0b9",
"_journal/2024-11/2024-11-22.md": "51117030e2364dbce3a8d507dead86ae",
@ -995,7 +997,7 @@
"_journal/2024-12/2024-12-04.md": "965f6619edf1002d960203e3e12a413b",
"_journal/2024-12-06.md": "d75323d0fec57f4fc1f13cb4370df18d",
"_journal/2024-12/2024-12-05.md": "4f3b1e7a43e01cc97b0eed6fbc6c1f96",
"calculus/integrals.md": "beb50fc6a61c39a2808fda142fbbc36b",
"calculus/integrals.md": "bd32e10748a897647ccb04a7bc1144bb",
"_journal/2024-12-07.md": "bfb6c4db0acbacba19f03a04ec29fa5c",
"_journal/2024-12/2024-12-06.md": "d73b611d2d15827186a0252d9b9a6580",
"_journal/2024-12-08.md": "5662897539b222db1af45dcd217f0796",
@ -1046,7 +1048,7 @@
"_journal/2024-12-22.md": "015dbf675853a81db07d641e8dab7fd4",
"_journal/2024-12/2024-12-21.md": "1c1a5791f7519c92e882957cf417b51f",
"formal-system/language.md": "7797d33a0b0eb187d43dda46a138fb25",
"computability/automaton.md": "fbcaa13a3e2053f252c58f0662fe7ada",
"computability/automaton.md": "1dd5048ea2a66d8090a85945593fcf68",
"computability/index.md": "d7938428ed0b0224c1fe1e59d1fab118",
"_journal/2024-12-23.md": "72b0964a8a5ed8ba0acf7fe10b5de279",
"_journal/2024-12/2024-12-22.md": "75375a867efc5b3aff406c73394d4814",
@ -1429,7 +1431,17 @@
"_journal/2025-01/2025-01-09.md": "166ff75c5ea1bf5110931fa054e1565e",
"_journal/2025-01/2025-01-08.md": "d8dbe63942449a91fbf793c318032e10",
"_journal/2025-01-12.md": "78a1a91743280f9caf2e700ee0a0f830",
"_journal/2025-01/2025-01-11.md": "057a8b69a650941d1a838d220d5f59ab"
"_journal/2025-01/2025-01-11.md": "057a8b69a650941d1a838d220d5f59ab",
"_journal/2025-01-13.md": "d961f4b6134e31c91d34abfc46348557",
"_journal/2025-01/2025-01-12.md": "78a1a91743280f9caf2e700ee0a0f830",
"_journal/2025-01-14.md": "e97c7a14d5aa75d10b96f6dd392ffc50",
"_journal/2025-01/2025-01-13.md": "c0ab363c3b496dc24eb282715d9ffb15",
"_journal/2025-01-15.md": "a26cc179123037eebbb33f4cf87b27fb",
"_journal/2025-01/2025-01-14.md": "88eb99d4319693c7f4cd2357618a19f8",
"_journal/2025-01/2025-01-15.md": "a559a6eba2958e2664ad25c1e3236d87",
"_journal/2025-01-16.md": "e3a21059205784a4e88bfe3b4deac7f7",
"_journal/2025-01-17.md": "ba60278a6cca1832ad28c273b01b0745",
"_journal/2025-01/2025-01-16.md": "e3a21059205784a4e88bfe3b4deac7f7"
},
"fields_dict": {
"Basic": [

View File

@ -0,0 +1,9 @@
---
title: "2025-01-17"
---
- [ ] Anki Flashcards
- [x] KoL
- [x] OGS
- [ ] Sheet Music (10 min.)
- [ ] Korean (Read 1 Story)

View File

@ -0,0 +1,11 @@
---
title: "2025-01-13"
---
- [x] Anki Flashcards
- [x] KoL
- [x] OGS
- [ ] Sheet Music (10 min.)
- [ ] Korean (Read 1 Story)
* Formal definition of [[automaton#Nondeterminism|NFA]]s.

View File

@ -0,0 +1,11 @@
---
title: "2025-01-14"
---
- [x] Anki Flashcards
- [x] KoL
- [x] OGS
- [ ] Sheet Music (10 min.)
- [ ] Korean (Read 1 Story)
* [[integrals#Integrable Functions|Integrals]] of more general functions.

View File

@ -0,0 +1,9 @@
---
title: "2025-01-15"
---
- [x] Anki Flashcards
- [x] KoL
- [x] OGS
- [ ] Sheet Music (10 min.)
- [ ] Korean (Read 1 Story)

View File

@ -0,0 +1,11 @@
---
title: "2025-01-16"
---
- [x] Anki Flashcards
- [x] KoL
- [x] OGS
- [ ] Sheet Music (10 min.)
- [ ] Korean (Read 1 Story)
* Notes on [[dfs#Topological Sort|topological sorting]].

View File

@ -614,6 +614,128 @@ Reference: Thomas H. Cormen et al., Introduction to Algorithms, Fourth edition (
<!--ID: 1735785623439-->
END%%
## Topological Sort
A topological sort of a directed acyclic graph $G$ is an ordering of all its vertices such that if $G$ contains an edge $\langle u, v \rangle$, then $u$ appears before $v$ in the ordering.
> Call depth-first search on $G$ to compute finish times $v{.}f$ for each vertex $v$. As each vertex is finished, insert it onto the front of a linked list. Return the list when all vertices are processed.
%%ANKI
Basic
*What* is a topological sort?
Back: An ordering of vertices such that if a DAG has edge $\langle u, v \rangle$, then $u$ appears before $v$.
Reference: Thomas H. Cormen et al., Introduction to Algorithms, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022).
<!--ID: 1737086266647-->
END%%
%%ANKI
Basic
Which basic graph algorithm is used in toplogical sorting?
Back: Depth-first search.
Reference: Thomas H. Cormen et al., Introduction to Algorithms, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022).
<!--ID: 1737086266658-->
END%%
%%ANKI
Basic
*Why* isn't toplogical sort applicable to digraphs with cycles?
Back: In the case of cycles, there is no notion of a vertex coming before another.
Reference: Thomas H. Cormen et al., Introduction to Algorithms, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022).
<!--ID: 1737086266662-->
END%%
%%ANKI
Basic
Let $G$ be a DAG with edge $\langle u, v \rangle$. How do $u$ and $v$ relate in $G$'s topological sort?
Back: $u$ comes before $v$.
Reference: Thomas H. Cormen et al., Introduction to Algorithms, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022).
<!--ID: 1737086266665-->
END%%
%%ANKI
Basic
Let $G$ be a DAG with path $\langle v_1, \ldots, v_n \rangle$. How do $v_1$ and $v_n$ relate in $G$'s topological sort?
Back: $v_1$ comes before $v_n$.
Reference: Thomas H. Cormen et al., Introduction to Algorithms, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022).
<!--ID: 1737086266668-->
END%%
%%ANKI
Basic
What kind of graph is a topological sort applicable to?
Back: A directed acyclic graph.
Reference: Thomas H. Cormen et al., Introduction to Algorithms, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022).
<!--ID: 1737086266673-->
END%%
%%ANKI
Basic
How many topological sorts might a DAG have?
Back: One or more.
Reference: Thomas H. Cormen et al., Introduction to Algorithms, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022).
<!--ID: 1737086266676-->
END%%
%%ANKI
Basic
DFS on a DAG cannot produce what edge classification?
Back: Back edges.
Reference: Thomas H. Cormen et al., Introduction to Algorithms, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022).
<!--ID: 1737086266680-->
END%%
%%ANKI
Cloze
A directed graph is {acyclic} if and only if DFS produces no {back} edges.
Reference: Thomas H. Cormen et al., Introduction to Algorithms, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022).
<!--ID: 1737086266684-->
END%%
%%ANKI
Basic
Describe how the toplogical sort algorithm on a directed acyclic graph $G$ is performed.
Back: Run DFS. As each vertex is finished processing, prepend it to a return list.
Reference: Thomas H. Cormen et al., Introduction to Algorithms, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022).
<!--ID: 1737086266688-->
END%%
%%ANKI
Basic
Assuming an adjacency-list represention of a DAG, what is topological sort's runtime?
Back: $\Theta(\lvert V \rvert + \lvert E \rvert)$
Reference: Thomas H. Cormen et al., Introduction to Algorithms, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022).
<!--ID: 1737086266692-->
END%%
%%ANKI
Basic
Assuming an adjacency-matrix represention of a DAG, what is topological sort's runtime?
Back: $\Theta(\lvert V \rvert^2)$
Reference: Thomas H. Cormen et al., Introduction to Algorithms, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022).
<!--ID: 1737086266695-->
END%%
%%ANKI
Basic
How many topological sorts exist in the following graph?
![[topological-sort.png]]
Back: Three.
Reference: Thomas H. Cormen et al., Introduction to Algorithms, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022).
<!--ID: 1737086266699-->
END%%
%%ANKI
Basic
What are the possible topological sorts of the following graph?
![[topological-sort.png]]
Back:
1. `B -> D -> A -> C`
2. `A -> B -> D -> C`
3. `A -> B -> C -> D`
Reference: Thomas H. Cormen et al., Introduction to Algorithms, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022).
<!--ID: 1737086266703-->
END%%
## Bibliography
* Thomas H. Cormen et al., Introduction to Algorithms, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022).

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.8 KiB

View File

@ -238,7 +238,192 @@ END%%
## Integrable Functions
TODO
Let $f$ be a function defined and bounded on $[a, b]$. Let $s$ and $t$ denote arbitrary step functions defined on $[a, b]$ such that $s(x) \leq f(x) \leq t(x)$ for all $x \in [a, b]$. If for every such $s$ and $t$, there is exactly one number $I$ satisfying $$\int_a^b s(x) \,dx \leq I \leq \int_a^b t(x) \,dx,$$
then $I$ is said to be the **integral of $f$ from $a$ to $b$** and is denoted by symbol $\int_a^b f(x) \,dx$. When such an $I$ exists, the function $f$ is said to be **integrable** on $[a, b]$.
%%ANKI
Basic
The integral of a function is approximated above and below by integrals of what kind of functions?
Back: Step functions.
Reference: Tom M. Apostol, _Calculus, Vol. 1: One-Variable Calculus, with an Introduction to Linear Algebra_, 2nd ed. (New York: Wiley, 1980).
<!--ID: 1736892432232-->
END%%
%%ANKI
Basic
How is the integral of $f$ from $a$ to $b$ denoted?
Back: As $\int_a^b f(x) \,dx$.
Reference: Tom M. Apostol, _Calculus, Vol. 1: One-Variable Calculus, with an Introduction to Linear Algebra_, 2nd ed. (New York: Wiley, 1980).
END%%
%%ANKI
Basic
*Why* does Apostol only consider integrals of functions that are bounded over an interval?
Back: Because the integral is defined by approximating step functions above and below the function.
Reference: Tom M. Apostol, _Calculus, Vol. 1: One-Variable Calculus, with an Introduction to Linear Algebra_, 2nd ed. (New York: Wiley, 1980).
<!--ID: 1736892432249-->
END%%
%%ANKI
Basic
What does it mean for function $f$ to be bounded on $[a, b]$?
Back: There exists some $M > 0$ such that $-M \leq f(x) \leq M$ for all $x \in [a, b]$.
Reference: Tom M. Apostol, _Calculus, Vol. 1: One-Variable Calculus, with an Introduction to Linear Algebra_, 2nd ed. (New York: Wiley, 1980).
<!--ID: 1736892432252-->
END%%
%%ANKI
Cloze
The {integral of $f$ from $a$ to $b$} is denoted as {$\int_a^b f(x) \,dx$}.
Reference: Tom M. Apostol, _Calculus, Vol. 1: One-Variable Calculus, with an Introduction to Linear Algebra_, 2nd ed. (New York: Wiley, 1980).
<!--ID: 1736892432255-->
END%%
%%ANKI
Basic
What does it mean for step function $s$ to be below function $f$ on $[a, b]$?
Back: That $s(x) \leq f(x)$ for all $x \in [a, b]$.
Reference: Tom M. Apostol, _Calculus, Vol. 1: One-Variable Calculus, with an Introduction to Linear Algebra_, 2nd ed. (New York: Wiley, 1980).
<!--ID: 1736892432259-->
END%%
%%ANKI
Basic
What does it mean for step function $s$ to be above function $f$ on $[a, b]$?
Back: That $f(x) \leq s(x)$ for all $x \in [a, b]$.
Reference: Tom M. Apostol, _Calculus, Vol. 1: One-Variable Calculus, with an Introduction to Linear Algebra_, 2nd ed. (New York: Wiley, 1980).
<!--ID: 1736892432262-->
END%%
%%ANKI
Basic
Let $f$ be a function. Let $s$ and $t$ be step functions such that $s$ is above $f$ and $t$ is below $f$. What inequality arises?
Back: $t \leq f \leq s$
Reference: Tom M. Apostol, _Calculus, Vol. 1: One-Variable Calculus, with an Introduction to Linear Algebra_, 2nd ed. (New York: Wiley, 1980).
<!--ID: 1736892432266-->
END%%
%%ANKI
Cloze
Let $f$ be a function defined and {bounded} on $[a, b]$. Let $s$ and $t$ denote {arbitrary step functions} such that {$$s(x) \leq f(x) \leq t(x)$$} for all $x \in [a, b]$. If for every such $s$ and $t$, there is {exactly one} $I$ such that {$$\int_a^b s(x) \,dx \leq I \leq \int_a^b t(x) \,dx,$$} then $I$ is said to be the {integral of $f$ from $a$ to $b$}.
Reference: Tom M. Apostol, _Calculus, Vol. 1: One-Variable Calculus, with an Introduction to Linear Algebra_, 2nd ed. (New York: Wiley, 1980).
<!--ID: 1736892432271-->
END%%
%%ANKI
Basic
Let $f$ be a function defined and bounded on $[a, b]$. What must there exist exactly one of for $f$ to be integrable on $[a, b]$?
Back: A number $I$ such that $\int_a^b s(x) \,dx \leq I \leq \int_a^b t(x) \,dx$ for all step functions $s$ and $t$ satisfying $s \leq f \leq t$.
Reference: Tom M. Apostol, _Calculus, Vol. 1: One-Variable Calculus, with an Introduction to Linear Algebra_, 2nd ed. (New York: Wiley, 1980).
<!--ID: 1736892432277-->
END%%
%%ANKI
Basic
Let $f$ be a function defined and bounded on $[a, b]$. What does it mean for $f$ to be integrable on $[a, b]$?
Back: There exists exactly one number $I$ such that $\int_a^b s(x) \,dx \leq I \leq \int_a^b t(x) \,dx$ for all step functions $s$ and $t$ satisfying $s \leq f \leq t$.
Reference: Tom M. Apostol, _Calculus, Vol. 1: One-Variable Calculus, with an Introduction to Linear Algebra_, 2nd ed. (New York: Wiley, 1980).
<!--ID: 1736892432282-->
END%%
The **lower integral** of $f$, denoted by $\underline{I}(f)$, is defined as $$\underline{I}(f) = \mathop{\text{sup}} \left\{ \int_a^b s(x) \,dx \mid s \leq f \right\}.$$
Likewise, the **upper integral** of $f$, denoted by $\bar{I}(f)$, is defined as $$\bar{I}(f) = \mathop{\text{inf}} \left\{ \int_a^b t(x) \,dx \mid f \leq t \right\}.$$
Thus $f$ is integrable on $[a, b]$ if and only if $\int_a^b f(x) \,dx = \underline{I}(f) = \bar{I}(f)$.
%%ANKI
Basic
Let $f$ be a function defined and bounded on $[a, b]$. How is the lower integral of $f$ denoted?
Back: $\underline{I}(f)$
Reference: Tom M. Apostol, _Calculus, Vol. 1: One-Variable Calculus, with an Introduction to Linear Algebra_, 2nd ed. (New York: Wiley, 1980).
<!--ID: 1736893396749-->
END%%
%%ANKI
Basic
Let $f$ be a function defined and bounded on $[a, b]$. What does $\underline{I}(f)$ denote?
Back: The lower integral of $f$.
Reference: Tom M. Apostol, _Calculus, Vol. 1: One-Variable Calculus, with an Introduction to Linear Algebra_, 2nd ed. (New York: Wiley, 1980).
<!--ID: 1736893441504-->
END%%
%%ANKI
Basic
Let $f$ be a function defined and bounded on $[a, b]$. How is the upper integral of $f$ denoted?
Back: $\bar{I}(f)$
Reference: Tom M. Apostol, _Calculus, Vol. 1: One-Variable Calculus, with an Introduction to Linear Algebra_, 2nd ed. (New York: Wiley, 1980).
<!--ID: 1736893396757-->
END%%
%%ANKI
Basic
Let $f$ be a function defined and bounded on $[a, b]$. What does $\bar{I}(f)$ denote?
Back: The upper integral of $f$.
Reference: Tom M. Apostol, _Calculus, Vol. 1: One-Variable Calculus, with an Introduction to Linear Algebra_, 2nd ed. (New York: Wiley, 1980).
<!--ID: 1736893441509-->
END%%
%%ANKI
Cloze
Let $f$ be a function defined and bounded on $[a, b]$. Then {1: $\underline{I}(f)$} is to a {2:supremum} whereas {2:$\bar{I}(f)$} is to an {1:infimum}.
Reference: Tom M. Apostol, _Calculus, Vol. 1: One-Variable Calculus, with an Introduction to Linear Algebra_, 2nd ed. (New York: Wiley, 1980).
<!--ID: 1736893396764-->
END%%
%%ANKI
Basic
Let $f$ be a function defined and bounded on $[a, b]$. How do we know the following set is nonempty? $$\left\{ \int_a^b t(x) \, dx \mid s \text{ is a step function below } f \right\}$$
Back: It's nonempty because $f$ is bounded.
Reference: Tom M. Apostol, _Calculus, Vol. 1: One-Variable Calculus, with an Introduction to Linear Algebra_, 2nd ed. (New York: Wiley, 1980).
<!--ID: 1736893396770-->
END%%
%%ANKI
Basic
Let $f$ be a function defined and bounded on $[a, b]$. $\underline{I}(f)$ equals the supremum of what set?
Back: $\left\{ \int_a^b s(x) \, dx \mid s \text{ is a step function below } f \right\}$
Reference: Tom M. Apostol, _Calculus, Vol. 1: One-Variable Calculus, with an Introduction to Linear Algebra_, 2nd ed. (New York: Wiley, 1980).
<!--ID: 1736893396776-->
END%%
%%ANKI
Basic
Let $f$ be a function defined and bounded on $[a, b]$. $\underline{I}(f)$ equals the infimum of what set?
Back: N/A. The lower integral is a supremum.
Reference: Tom M. Apostol, _Calculus, Vol. 1: One-Variable Calculus, with an Introduction to Linear Algebra_, 2nd ed. (New York: Wiley, 1980).
<!--ID: 1736893396782-->
END%%
%%ANKI
Basic
Let $f$ be a function defined and bounded on $[a, b]$. How do we know the following set is nonempty? $$\left\{ \int_a^b t(x) \, dx \mid t \text{ is a step function above } f \right\}$$
Back: It's nonempty because $f$ is bounded.
Reference: Tom M. Apostol, _Calculus, Vol. 1: One-Variable Calculus, with an Introduction to Linear Algebra_, 2nd ed. (New York: Wiley, 1980).
<!--ID: 1736893396788-->
END%%
%%ANKI
Basic
Let $f$ be a function defined and bounded on $[a, b]$. $\bar{I}(f)$ equals the supremum of what set?
Back: N/A. The upper integral is an infimum.
Reference: Tom M. Apostol, _Calculus, Vol. 1: One-Variable Calculus, with an Introduction to Linear Algebra_, 2nd ed. (New York: Wiley, 1980).
<!--ID: 1736893396794-->
END%%
%%ANKI
Basic
Let $f$ be a function defined and bounded on $[a, b]$. $\bar{I}(f)$ equals the infimum of what set?
Back: $\left\{ \int_a^b t(x) \, dx \mid t \text{ is a step function above } f \right\}$
Reference: Tom M. Apostol, _Calculus, Vol. 1: One-Variable Calculus, with an Introduction to Linear Algebra_, 2nd ed. (New York: Wiley, 1980).
<!--ID: 1736893396799-->
END%%
%%ANKI
Basic
Let $f$ be a function defined and bounded on $[a, b]$. If $s$ and $t$ are step functions s.t. $s \leq f \leq t$, what integral property guarantees $\int_a^b s(x) \,dx \leq \int_a^b t(x) \,dx$?
Back: The comparison theorem.
Reference: Tom M. Apostol, _Calculus, Vol. 1: One-Variable Calculus, with an Introduction to Linear Algebra_, 2nd ed. (New York: Wiley, 1980).
<!--ID: 1736893396804-->
END%%
### Integrand Additivity

View File

@ -125,6 +125,20 @@ Reference: Michael Sipser, _Introduction to the Theory of Computation_, Third ed
<!--ID: 1735160593029-->
END%%
%%ANKI
Cloze
{1:Edges} are to {2:graphs} whereas {2:transitions} are to {1:state diagrams}.
Reference: Michael Sipser, _Introduction to the Theory of Computation_, Third edition, international edition (Australia Brazil Japan Korea Mexiko Singapore Spain United Kingdom United States: Cengage Learning, 2013).
<!--ID: 1734999643325-->
END%%
%%ANKI
Cloze
{1:Vertices} are to {2:graphs} whereas {2:states} are to {1:state diagrams}.
Reference: Michael Sipser, _Introduction to the Theory of Computation_, Third edition, international edition (Australia Brazil Japan Korea Mexiko Singapore Spain United Kingdom United States: Cengage Learning, 2013).
<!--ID: 1734999643328-->
END%%
## Determinism
A **deterministic finite automaton** (DFA) is a $5$-tuple $\langle Q, \Sigma, \delta, q_0, F \rangle$, where
@ -315,6 +329,31 @@ Reference: Michael Sipser, _Introduction to the Theory of Computation_, Third ed
<!--ID: 1734999643291-->
END%%
%%ANKI
Basic
Let $M$ be a DFA. What labels are permitted over arrows in its state diagram?
Back: Members of its alphabet.
Reference: Michael Sipser, _Introduction to the Theory of Computation_, Third edition, international edition (Australia Brazil Japan Korea Mexiko Singapore Spain United Kingdom United States: Cengage Learning, 2013).
<!--ID: 1736781769438-->
END%%
%%ANKI
Basic
Let $M$ be a DFA. How many edges must leave a given state?
Back: One for each symbol in its alphabet.
Reference: Michael Sipser, _Introduction to the Theory of Computation_, Third edition, international edition (Australia Brazil Japan Korea Mexiko Singapore Spain United Kingdom United States: Cengage Learning, 2013).
<!--ID: 1736781769445-->
END%%
%%ANKI
Basic
Is the following state diagram that of an NFA or DFA?
![[dfa-example.png]]
Back: Indeterminate.
Reference: Michael Sipser, _Introduction to the Theory of Computation_, Third edition, international edition (Australia Brazil Japan Korea Mexiko Singapore Spain United Kingdom United States: Cengage Learning, 2013).
<!--ID: 1736781769448-->
END%%
%%ANKI
Basic
Let $M = \langle Q, \Sigma, \delta, q_0, F \rangle$ be the depicted DFA. What does $Q$ evaluate to?
@ -377,20 +416,6 @@ Reference: Michael Sipser, _Introduction to the Theory of Computation_, Third ed
<!--ID: 1734999643321-->
END%%
%%ANKI
Cloze
{1:Edges} are to {2:graphs} whereas {2:transitions} are to {1:state diagrams}.
Reference: Michael Sipser, _Introduction to the Theory of Computation_, Third edition, international edition (Australia Brazil Japan Korea Mexiko Singapore Spain United Kingdom United States: Cengage Learning, 2013).
<!--ID: 1734999643325-->
END%%
%%ANKI
Cloze
{1:Vertices} are to {2:graphs} whereas {2:states} are to {1:state diagrams}.
Reference: Michael Sipser, _Introduction to the Theory of Computation_, Third edition, international edition (Australia Brazil Japan Korea Mexiko Singapore Spain United Kingdom United States: Cengage Learning, 2013).
<!--ID: 1734999643328-->
END%%
%%ANKI
Cloze
The {final} states of a DFA are also called the {accept} states.
@ -524,6 +549,329 @@ Reference: Michael Sipser, _Introduction to the Theory of Computation_, Third ed
<!--ID: 1734999643459-->
END%%
## Nondeterminism
A **nondeterministic finite automaton** (NFA) is a $5$-tuple $\langle Q, \Sigma, \delta, q_0, F \rangle$, where
1. $Q$ is a finite set called the **states**;
2. $\Sigma$ is a finite set called the alphabet;
3. $\delta: Q \times (\Sigma \cup \{\epsilon\}) \rightarrow \mathscr{P}(Q)$ is the **transition function**;
4. $q_0 \in Q$ is the **start state**; and
5. $F \subseteq Q$ is the set of **final states**.
Like DFAs, these automaton are typically denoted using a **state diagram**. Unlike DFAs, not every state needs an exiting transition arrow for each symbol in the alphabet. Also, arrows can be labeled $\epsilon$ for the empty string.
%%ANKI
Basic
A nondeterministic finite automaton is defined as a tuple of how many components?
Back: Five.
Reference: Michael Sipser, _Introduction to the Theory of Computation_, Third edition, international edition (Australia Brazil Japan Korea Mexiko Singapore Spain United Kingdom United States: Cengage Learning, 2013).
<!--ID: 1736781769451-->
END%%
%%ANKI
Basic
What is NFA an acronym for?
Back: **N**ondeterministic **f**inite **a**utomata.
Reference: Michael Sipser, _Introduction to the Theory of Computation_, Third edition, international edition (Australia Brazil Japan Korea Mexiko Singapore Spain United Kingdom United States: Cengage Learning, 2013).
<!--ID: 1736781769454-->
END%%
%%ANKI
Basic
Let $M = \langle Q, \Sigma, \delta, q_0, F \rangle$ be an NFA. What kind of mathematical entity is $Q$?
Back: A finite set of states.
Reference: Michael Sipser, _Introduction to the Theory of Computation_, Third edition, international edition (Australia Brazil Japan Korea Mexiko Singapore Spain United Kingdom United States: Cengage Learning, 2013).
<!--ID: 1736781769457-->
END%%
%%ANKI
Basic
Let $M = \langle Q, \Sigma, \delta, q_0, F \rangle$ be an NFA. What name is given to $Q$?
Back: $M$'s states.
Reference: Michael Sipser, _Introduction to the Theory of Computation_, Third edition, international edition (Australia Brazil Japan Korea Mexiko Singapore Spain United Kingdom United States: Cengage Learning, 2013).
<!--ID: 1736781769460-->
END%%
%%ANKI
Basic
Let $M = \langle Q, \Sigma, \delta, q_0, F \rangle$ be an NFA. What is $\Sigma$?
Back: An alphabet.
Reference: Michael Sipser, _Introduction to the Theory of Computation_, Third edition, international edition (Australia Brazil Japan Korea Mexiko Singapore Spain United Kingdom United States: Cengage Learning, 2013).
<!--ID: 1736781769463-->
END%%
%%ANKI
Basic
Let $M = \langle Q, \Sigma, \delta, q_0, F \rangle$ be an NFA. What kind of mathematical entity is $\delta$?
Back: A function.
Reference: Michael Sipser, _Introduction to the Theory of Computation_, Third edition, international edition (Australia Brazil Japan Korea Mexiko Singapore Spain United Kingdom United States: Cengage Learning, 2013).
<!--ID: 1736781769465-->
END%%
%%ANKI
Basic
Let $M = \langle Q, \Sigma, \delta, q_0, F \rangle$ be an NFA. What name is given to $\delta$?
Back: $M$'s transition function.
Reference: Michael Sipser, _Introduction to the Theory of Computation_, Third edition, international edition (Australia Brazil Japan Korea Mexiko Singapore Spain United Kingdom United States: Cengage Learning, 2013).
<!--ID: 1736781769468-->
END%%
%%ANKI
Basic
Let $M = \langle Q, \Sigma, \delta, q_0, F \rangle$ be an NFA. What is $\delta$'s domain?
Back: $Q \times (\Sigma \cup \{\epsilon\})$
Reference: Michael Sipser, _Introduction to the Theory of Computation_, Third edition, international edition (Australia Brazil Japan Korea Mexiko Singapore Spain United Kingdom United States: Cengage Learning, 2013).
<!--ID: 1736781769471-->
END%%
%%ANKI
Basic
Let $M = \langle Q, \Sigma, \delta, q_0, F \rangle$ be an NFA. What is $\delta$'s codomain?
Back: $\mathscr{P}(Q)$
Reference: Michael Sipser, _Introduction to the Theory of Computation_, Third edition, international edition (Australia Brazil Japan Korea Mexiko Singapore Spain United Kingdom United States: Cengage Learning, 2013).
<!--ID: 1736781769474-->
END%%
%%ANKI
Basic
Let $M = \langle Q, \Sigma, \delta, q_0, F \rangle$ be an NFA. What kind of mathematical entity is $q_0$?
Back: An urelement.
Reference: Michael Sipser, _Introduction to the Theory of Computation_, Third edition, international edition (Australia Brazil Japan Korea Mexiko Singapore Spain United Kingdom United States: Cengage Learning, 2013).
<!--ID: 1736781769477-->
END%%
%%ANKI
Basic
Let $M = \langle Q, \Sigma, \delta, q_0, F \rangle$ be an NFA. What name is given to $q_0$?
Back: $M$'s start state.
Reference: Michael Sipser, _Introduction to the Theory of Computation_, Third edition, international edition (Australia Brazil Japan Korea Mexiko Singapore Spain United Kingdom United States: Cengage Learning, 2013).
<!--ID: 1736781769480-->
END%%
%%ANKI
Basic
Let $M = \langle Q, \Sigma, \delta, q_0, F \rangle$ be an NFA. What name is given to $F$?
Back: $M$'s final states.
Reference: Michael Sipser, _Introduction to the Theory of Computation_, Third edition, international edition (Australia Brazil Japan Korea Mexiko Singapore Spain United Kingdom United States: Cengage Learning, 2013).
<!--ID: 1736781769483-->
END%%
%%ANKI
Basic
Let $M = \langle Q, \Sigma, \delta, q_0, F \rangle$ be an NFA. What kind of mathematical entity is $F$?
Back: A finite set.
Reference: Michael Sipser, _Introduction to the Theory of Computation_, Third edition, international edition (Australia Brazil Japan Korea Mexiko Singapore Spain United Kingdom United States: Cengage Learning, 2013).
<!--ID: 1736781769486-->
END%%
%%ANKI
Basic
Let $M = \langle Q, \Sigma, \delta, q_0, F \rangle$ be an NFA. How does $F$ relate to $Q$?
Back: $F \subseteq Q$
Reference: Michael Sipser, _Introduction to the Theory of Computation_, Third edition, international edition (Australia Brazil Japan Korea Mexiko Singapore Spain United Kingdom United States: Cengage Learning, 2013).
<!--ID: 1736781769490-->
END%%
%%ANKI
Basic
Let $M = \langle Q, \Sigma, \delta, q_0, F \rangle$ be an NFA. How does $q_0$ relate to $Q$?
Back: $q_0 \in Q$
Reference: Michael Sipser, _Introduction to the Theory of Computation_, Third edition, international edition (Australia Brazil Japan Korea Mexiko Singapore Spain United Kingdom United States: Cengage Learning, 2013).
<!--ID: 1736781769493-->
END%%
%%ANKI
Basic
Let $M = \langle Q, \Sigma, \delta, q_0, F \rangle$ be an NFA. How does $q_0$ relate to $F$?
Back: N/A.
Reference: Michael Sipser, _Introduction to the Theory of Computation_, Third edition, international edition (Australia Brazil Japan Korea Mexiko Singapore Spain United Kingdom United States: Cengage Learning, 2013).
<!--ID: 1736781769496-->
END%%
%%ANKI
Basic
Let $M$ be an NFA. How many start states does $M$ have?
Back: One.
Reference: Michael Sipser, _Introduction to the Theory of Computation_, Third edition, international edition (Australia Brazil Japan Korea Mexiko Singapore Spain United Kingdom United States: Cengage Learning, 2013).
<!--ID: 1736781769500-->
END%%
%%ANKI
Basic
Let $M$ be an NFA. How many accept states does $M$ have?
Back: Zero or more.
Reference: Michael Sipser, _Introduction to the Theory of Computation_, Third edition, international edition (Australia Brazil Japan Korea Mexiko Singapore Spain United Kingdom United States: Cengage Learning, 2013).
<!--ID: 1736781769503-->
END%%
%%ANKI
Basic
Let $M$ be an NFA. How is $M$'s start state denoted in a state diagram?
Back: With an arrow pointing to it from nowhere.
Reference: Michael Sipser, _Introduction to the Theory of Computation_, Third edition, international edition (Australia Brazil Japan Korea Mexiko Singapore Spain United Kingdom United States: Cengage Learning, 2013).
<!--ID: 1736781769506-->
END%%
%%ANKI
Basic
Let $M$ be an NFA. How is $M$'s final states denoted in a state diagram?
Back: With double circles.
Reference: Michael Sipser, _Introduction to the Theory of Computation_, Third edition, international edition (Australia Brazil Japan Korea Mexiko Singapore Spain United Kingdom United States: Cengage Learning, 2013).
<!--ID: 1736781769510-->
END%%
%%ANKI
Basic
Let $M$ be an NFA. How is $M$'s transition function denoted in a state diagram?
Back: As edges to and from states.
Reference: Michael Sipser, _Introduction to the Theory of Computation_, Third edition, international edition (Australia Brazil Japan Korea Mexiko Singapore Spain United Kingdom United States: Cengage Learning, 2013).
<!--ID: 1736781769513-->
END%%
%%ANKI
Basic
Let $M$ be an NFA. How is $M$'s alphabet denoted in a state diagram?
Back: With symbols labeling each edge.
Reference: Michael Sipser, _Introduction to the Theory of Computation_, Third edition, international edition (Australia Brazil Japan Korea Mexiko Singapore Spain United Kingdom United States: Cengage Learning, 2013).
<!--ID: 1736781769517-->
END%%
%%ANKI
Basic
Let $M$ be an NFA. What labels are permitted over arrows in its state diagram?
Back: Members of its alphabet or $\epsilon$.
Reference: Michael Sipser, _Introduction to the Theory of Computation_, Third edition, international edition (Australia Brazil Japan Korea Mexiko Singapore Spain United Kingdom United States: Cengage Learning, 2013).
<!--ID: 1736781769520-->
END%%
%%ANKI
Basic
Let $M$ be an NFA. How many edges must leave a given state?
Back: Zero or more.
Reference: Michael Sipser, _Introduction to the Theory of Computation_, Third edition, international edition (Australia Brazil Japan Korea Mexiko Singapore Spain United Kingdom United States: Cengage Learning, 2013).
<!--ID: 1736781769523-->
END%%
%%ANKI
Basic
Is the following state diagram that of an NFA or DFA?
![[nfa-example.png]]
Back: NFA.
Reference: Michael Sipser, _Introduction to the Theory of Computation_, Third edition, international edition (Australia Brazil Japan Korea Mexiko Singapore Spain United Kingdom United States: Cengage Learning, 2013).
<!--ID: 1736781769525-->
END%%
%%ANKI
Basic
What two reasons explain why the following state diagram depicts an NFA?
![[nfa-example.png]]
Back: Missing labels/edges and existence of an $\epsilon$-labeled edge.
Reference: Michael Sipser, _Introduction to the Theory of Computation_, Third edition, international edition (Australia Brazil Japan Korea Mexiko Singapore Spain United Kingdom United States: Cengage Learning, 2013).
<!--ID: 1736781769528-->
END%%
%%ANKI
Let $M = \langle Q, \Sigma, \delta, q_0, F \rangle$ be the depicted NFA. What does $Q$ evaluate to?
![[nfa-example.png]]
Back: $Q = \{q_1, q_2, q_3\}$
Reference: Michael Sipser, _Introduction to the Theory of Computation_, Third edition, international edition (Australia Brazil Japan Korea Mexiko Singapore Spain United Kingdom United States: Cengage Learning, 2013).
END%%
%%ANKI
Let $M = \langle Q, \Sigma, \delta, q_0, F \rangle$ be the depicted NFA. What does $\Sigma$ evaluate to?
![[nfa-example.png]]
Back: $\Sigma = \{a, b\}$ or $\Sigma = \{a, b, \epsilon\}$.
Reference: Michael Sipser, _Introduction to the Theory of Computation_, Third edition, international edition (Australia Brazil Japan Korea Mexiko Singapore Spain United Kingdom United States: Cengage Learning, 2013).
END%%
%%ANKI
Basic
Let $M = \langle Q, \Sigma, \delta, q_0, F \rangle$ be the depicted NFA. What does $q_0$ evaluate to?
![[nfa-example.png]]
Back: $q_0 = q_1$
Reference: Michael Sipser, _Introduction to the Theory of Computation_, Third edition, international edition (Australia Brazil Japan Korea Mexiko Singapore Spain United Kingdom United States: Cengage Learning, 2013).
<!--ID: 1736781769531-->
END%%
%%ANKI
Basic
Let $M = \langle Q, \Sigma, \delta, q_0, F \rangle$ be the depicted NFA. What does $\mathop{\text{dom}}\delta$ evaluate to?
![[nfa-example.png]]
Back: $\{q_1, q_2, q_3\} \times \{a, b, \epsilon\}$
Reference: Michael Sipser, _Introduction to the Theory of Computation_, Third edition, international edition (Australia Brazil Japan Korea Mexiko Singapore Spain United Kingdom United States: Cengage Learning, 2013).
<!--ID: 1736781769534-->
END%%
%%ANKI
Basic
Let $M = \langle Q, \Sigma, \delta, q_0, F \rangle$ be the depicted NFA. What does $\mathop{\text{ran}}\delta$ evaluate to?
![[nfa-example.png]]
Back: $\mathscr{P}(\{q_1, q_2, q_3\})$
Reference: Michael Sipser, _Introduction to the Theory of Computation_, Third edition, international edition (Australia Brazil Japan Korea Mexiko Singapore Spain United Kingdom United States: Cengage Learning, 2013).
<!--ID: 1736781769536-->
END%%
%%ANKI
Basic
Let $M = \langle Q, \Sigma, \delta, q_0, F \rangle$ be the depicted NFA. What does $F$ evaluate to?
![[nfa-example.png]]
Back: $\{q_1\}$
Reference: Michael Sipser, _Introduction to the Theory of Computation_, Third edition, international edition (Australia Brazil Japan Korea Mexiko Singapore Spain United Kingdom United States: Cengage Learning, 2013).
<!--ID: 1736781769539-->
END%%
%%ANKI
Basic
What name is given to an NFA's standard graphical depiction?
Back: Its state diagram.
Reference: Michael Sipser, _Introduction to the Theory of Computation_, Third edition, international edition (Australia Brazil Japan Korea Mexiko Singapore Spain United Kingdom United States: Cengage Learning, 2013).
<!--ID: 1736781769541-->
END%%
%%ANKI
Cloze
The {final} states of an NFA are also called the {accept} states.
Reference: Michael Sipser, _Introduction to the Theory of Computation_, Third edition, international edition (Australia Brazil Japan Korea Mexiko Singapore Spain United Kingdom United States: Cengage Learning, 2013).
<!--ID: 1736781769544-->
END%%
%%ANKI
Basic
Does the following NFA accept string `baba`?
![[nfa-example.png]]
Back: Yes.
Reference: Michael Sipser, _Introduction to the Theory of Computation_, Third edition, international edition (Australia Brazil Japan Korea Mexiko Singapore Spain United Kingdom United States: Cengage Learning, 2013).
<!--ID: 1736781769547-->
END%%
%%ANKI
Basic
Does the following NFA accept string `abab`?
![[nfa-example.png]]
Back: No.
Reference: Michael Sipser, _Introduction to the Theory of Computation_, Third edition, international edition (Australia Brazil Japan Korea Mexiko Singapore Spain United Kingdom United States: Cengage Learning, 2013).
<!--ID: 1736781769550-->
END%%
%%ANKI
Basic
Does the following NFA accept string `abba`?
![[nfa-example.png]]
Back: Yes.
Reference: Michael Sipser, _Introduction to the Theory of Computation_, Third edition, international edition (Australia Brazil Japan Korea Mexiko Singapore Spain United Kingdom United States: Cengage Learning, 2013).
<!--ID: 1736781769553-->
END%%
%%ANKI
Basic
Does the following NFA accept string `baab`?
![[nfa-example.png]]
Back: No.
Reference: Michael Sipser, _Introduction to the Theory of Computation_, Third edition, international edition (Australia Brazil Japan Korea Mexiko Singapore Spain United Kingdom United States: Cengage Learning, 2013).
<!--ID: 1736781769556-->
END%%
## Regular Operations
Let $A$ and $B$ be languages. Then the **regular operations** union, intersection, concatenation, and Kleene star are defined as:

Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

View File

@ -1482,7 +1482,7 @@ END%%
%%ANKI
Basic
What does it mean for cardinal numbers to obey transitivity?
What does it mean for cardinal number ordering to obey transitivity?
Back: Let $\kappa$, $\lambda$, and $\mu$ be cardinal numbers. If $\kappa \leq \lambda$ and $\lambda \leq \mu$, then $\kappa \leq \mu$.
Reference: Herbert B. Enderton, *Elements of Set Theory* (New York: Academic Press, 1977).
<!--ID: 1736702905252-->
@ -1560,7 +1560,7 @@ END%%
%%ANKI
Basic
Consider injections $f \colon A \rightarrow B$ and $g \colon B \rightarrow A$. What set is "reflected" in the proof of the Schröder-Bernstein theorem?
Back: $A - \mathop{\text{ran}}g$
Back: Either $A - \mathop{\text{ran}}g$ or $B - \mathop{\text{ran}} f$.
Reference: Herbert B. Enderton, *Elements of Set Theory* (New York: Academic Press, 1977).
<!--ID: 1736711693546-->
END%%