diff --git a/notes/.obsidian/plugins/obsidian-to-anki-plugin/data.json b/notes/.obsidian/plugins/obsidian-to-anki-plugin/data.json index eff49f9..0d4d8d0 100644 --- a/notes/.obsidian/plugins/obsidian-to-anki-plugin/data.json +++ b/notes/.obsidian/plugins/obsidian-to-anki-plugin/data.json @@ -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": [ diff --git a/notes/_journal/2025-01-17.md b/notes/_journal/2025-01-17.md new file mode 100644 index 0000000..ce35974 --- /dev/null +++ b/notes/_journal/2025-01-17.md @@ -0,0 +1,9 @@ +--- +title: "2025-01-17" +--- + +- [ ] Anki Flashcards +- [x] KoL +- [x] OGS +- [ ] Sheet Music (10 min.) +- [ ] Korean (Read 1 Story) \ No newline at end of file diff --git a/notes/_journal/2025-01-12.md b/notes/_journal/2025-01/2025-01-12.md similarity index 100% rename from notes/_journal/2025-01-12.md rename to notes/_journal/2025-01/2025-01-12.md diff --git a/notes/_journal/2025-01/2025-01-13.md b/notes/_journal/2025-01/2025-01-13.md new file mode 100644 index 0000000..3ee8e1d --- /dev/null +++ b/notes/_journal/2025-01/2025-01-13.md @@ -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. \ No newline at end of file diff --git a/notes/_journal/2025-01/2025-01-14.md b/notes/_journal/2025-01/2025-01-14.md new file mode 100644 index 0000000..5c59644 --- /dev/null +++ b/notes/_journal/2025-01/2025-01-14.md @@ -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. \ No newline at end of file diff --git a/notes/_journal/2025-01/2025-01-15.md b/notes/_journal/2025-01/2025-01-15.md new file mode 100644 index 0000000..d8a607a --- /dev/null +++ b/notes/_journal/2025-01/2025-01-15.md @@ -0,0 +1,9 @@ +--- +title: "2025-01-15" +--- + +- [x] Anki Flashcards +- [x] KoL +- [x] OGS +- [ ] Sheet Music (10 min.) +- [ ] Korean (Read 1 Story) \ No newline at end of file diff --git a/notes/_journal/2025-01/2025-01-16.md b/notes/_journal/2025-01/2025-01-16.md new file mode 100644 index 0000000..1574b27 --- /dev/null +++ b/notes/_journal/2025-01/2025-01-16.md @@ -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]]. \ No newline at end of file diff --git a/notes/algorithms/dfs.md b/notes/algorithms/dfs.md index f0f9ed6..1f9c573 100644 --- a/notes/algorithms/dfs.md +++ b/notes/algorithms/dfs.md @@ -614,6 +614,128 @@ Reference: Thomas H. Cormen et al., Introduction to Algorithms, Fourth edition ( 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). + +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). + +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). + +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). + +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). + +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). + +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). + +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). + +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). + +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). + +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). + +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). + +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). + +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). + +END%% + ## Bibliography * Thomas H. Cormen et al., Introduction to Algorithms, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022). \ No newline at end of file diff --git a/notes/algorithms/images/topological-sort.png b/notes/algorithms/images/topological-sort.png new file mode 100644 index 0000000..4218170 Binary files /dev/null and b/notes/algorithms/images/topological-sort.png differ diff --git a/notes/calculus/integrals.md b/notes/calculus/integrals.md index 1ebc4f5..6c30f6b 100644 --- a/notes/calculus/integrals.md +++ b/notes/calculus/integrals.md @@ -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). + +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). + +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). + +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). + +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). + +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). + +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). + +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). + +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). + +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). + +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). + +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). + +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). + +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). + +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). + +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). + +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). + +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). + +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). + +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). + +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). + +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). + +END%% ### Integrand Additivity diff --git a/notes/computability/automaton.md b/notes/computability/automaton.md index 8f11b46..39f38f3 100644 --- a/notes/computability/automaton.md +++ b/notes/computability/automaton.md @@ -125,6 +125,20 @@ Reference: Michael Sipser, _Introduction to the Theory of Computation_, Third ed 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). + +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). + +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 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). + +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). + +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). + +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 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). - -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). - -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 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). + +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). + +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). + +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). + +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). + +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). + +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). + +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). + +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). + +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). + +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). + +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). + +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). + +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). + +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). + +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). + +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). + +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). + +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). + +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). + +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). + +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). + +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). + +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). + +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). + +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). + +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). + +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). + +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). + +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). + +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). + +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). + +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). + +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). + +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). + +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). + +END%% + ## Regular Operations Let $A$ and $B$ be languages. Then the **regular operations** union, intersection, concatenation, and Kleene star are defined as: diff --git a/notes/computability/images/nfa-example.png b/notes/computability/images/nfa-example.png new file mode 100644 index 0000000..56db774 Binary files /dev/null and b/notes/computability/images/nfa-example.png differ diff --git a/notes/set/cardinality.md b/notes/set/cardinality.md index f2584d8..2271adf 100644 --- a/notes/set/cardinality.md +++ b/notes/set/cardinality.md @@ -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). @@ -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). END%%