From 22c6429e3225f00f80a6732b5437b368a2b794d5 Mon Sep 17 00:00:00 2001 From: Joshua Potter Date: Wed, 23 Oct 2024 18:08:21 -0600 Subject: [PATCH] DFS and top-down/bottom-up closure equivalence. --- .../plugins/obsidian-to-anki-plugin/data.json | 31 ++- notes/_journal/2024-10-23.md | 11 + notes/_journal/{ => 2024-10}/2024-10-20.md | 2 +- notes/_journal/2024-10/2024-10-21.md | 11 + notes/_journal/2024-10/2024-10-22.md | 12 ++ notes/algebra/floor-ceiling.md | 4 +- notes/algorithms/bfs.md | 4 +- notes/algorithms/dfs.md | 129 +++++++++++ notes/c17/types/simple.md | 2 +- .../logical-system/prop-logic.md | 8 - notes/set/functions.md | 158 ++++++++++++++ notes/set/index.md | 14 ++ notes/x86-64/procedures.md | 200 ++++++++++++++++++ 13 files changed, 563 insertions(+), 23 deletions(-) create mode 100644 notes/_journal/2024-10-23.md rename notes/_journal/{ => 2024-10}/2024-10-20.md (61%) create mode 100644 notes/_journal/2024-10/2024-10-21.md create mode 100644 notes/_journal/2024-10/2024-10-22.md create mode 100644 notes/algorithms/dfs.md diff --git a/notes/.obsidian/plugins/obsidian-to-anki-plugin/data.json b/notes/.obsidian/plugins/obsidian-to-anki-plugin/data.json index a490009..05943c1 100644 --- a/notes/.obsidian/plugins/obsidian-to-anki-plugin/data.json +++ b/notes/.obsidian/plugins/obsidian-to-anki-plugin/data.json @@ -214,7 +214,8 @@ "b-tree-split-node.png", "b-tree-initial.png", "b-tree-inserted-b.png", - "b-tree-inserted-q.png" + "b-tree-inserted-q.png", + "dfs.gif" ], "File Hashes": { "algorithms/index.md": "3ac071354e55242919cc574eb43de6f8", @@ -301,7 +302,7 @@ "_journal/2024-02/2024-02-14.md": "aa009f9569e175a8104b0537ebcc5520", "_journal/2024-02-16.md": "5cc129254afd553829be3364facd23db", "_journal/2024-02/2024-02-15.md": "16cb7563d404cb543719b7bb5037aeed", - "algebra/floor-ceiling.md": "a22efe853ad1234b2d3e0d7cc7e6fc47", + "algebra/floor-ceiling.md": "78496445da3054dd720f00a485fc433a", "algebra/index.md": "90b842eb694938d87c7c68779a5cacd1", "algorithms/binary-search.md": "8533a05ea372e007ab4e8a36fd2772a9", "_journal/2024-02-17.md": "7c37cb10515ed3d2f5388eaf02a67048", @@ -394,7 +395,7 @@ "_journal/2024-03-18.md": "8479f07f63136a4e16c9cd07dbf2f27f", "_journal/2024-03/2024-03-17.md": "23f9672f5c93a6de52099b1b86834e8b", "set/directed-graph.md": "b4b8ad1be634a0a808af125fe8577a53", - "set/index.md": "05a73d62902e3eecec7ce7b902027590", + "set/index.md": "14daeda39c344ea1d4b8c8eac9fb99b0", "set/graphs.md": "a56f867f51e69cb7438bbdf6215fca36", "_journal/2024-03-19.md": "a0807691819725bf44c0262405e97cbb", "_journal/2024-03/2024-03-18.md": "2c711c50247a9880f7ed0d33b16e1101", @@ -606,7 +607,7 @@ "_journal/2024-06/2024-06-12.md": "f82dfa74d0def8c3179d3d076f94558e", "_journal/2024-06-14.md": "5d12bc272238ac985a1d35d3d63ea307", "_journal/2024-06/2024-06-13.md": "e2722a00585d94794a089e8035e05728", - "set/functions.md": "3d08bbd3fb31eba419058264ed804e22", + "set/functions.md": "979e5fcf8cda2ab0bbabe67c589c6a5c", "_journal/2024-06-15.md": "92cb8dc5c98e10832fb70c0e3ab3cec4", "_journal/2024-06/2024-06-14.md": "5d12bc272238ac985a1d35d3d63ea307", "lambda-calculus/beta-reduction.md": "0935987f2bac0e6298735f2b26fd5885", @@ -698,7 +699,7 @@ "formal-system/proof-system/equiv-trans.md": "72d96306d5bc818e67b5a6aa777b7036", "formal-system/logical-system/index.md": "708bb1547e7343c236068c18da3f5dc0", "formal-system/logical-system/pred-logic.md": "4559020fde708b9d0184d9fd56559c98", - "formal-system/logical-system/prop-logic.md": "b61ce051795d5a951c763b928ec5cea8", + "formal-system/logical-system/prop-logic.md": "e486b55b20298d41fddce0d1ec53f391", "formal-system/index.md": "28b596a8ffa7dca05e8c0b890be43aec", "programming/short-circuit.md": "c256ced42dc3b493aff5a356e5383b6e", "formal-system/abstract-rewriting.md": "8424314a627851c5b94be6163f64ba30", @@ -791,7 +792,7 @@ "c17/enums.md": "9414fb67aa256a0a11b7240534c67bf6", "c17/derived-types.md": "6fb8f23a2423f05d5bdccb6672a32e38", "c17/basic-types.md": "7c6653bf6dc24c2f2aa72fc95c4f7875", - "c17/types/simple.md": "48e455d1cb6a631fe74e419e52e0a695", + "c17/types/simple.md": "b53fd365671848f09e6a0cd46e17c1bf", "c17/types/enumerated.md": "e1f70a30677c776b7b44ac3e0ff4e76d", "c17/types/derived.md": "cd77112313bd0f9cf99b0f224a364179", "c17/types/basic.md": "5064e21e683c0218890058882e06b6f3", @@ -843,7 +844,7 @@ "_journal/2024-09/2024-09-20.md": "69cf79bb0cb8c116a9c0f671671fdc44", "_journal/2024-09-22.md": "2d00b00b4eb9964465f30210187603cf", "_journal/2024-09/2024-09-21.md": "2e6425f4db0187082947c3e0cb24f754", - "algorithms/bfs.md": "bc322d510fe25389b3996344b126e497", + "algorithms/bfs.md": "082644a948180337a0065bb11d28aff9", "_journal/2024-09-23.md": "c0a87ca092a36e2761e844f34296f2f7", "_journal/2024-09/2024-09-22.md": "c27835ce1d82d10c906b40b420145d0c", "_journal/2024-09-25.md": "4527ac5c132aaf5adc6e624c5e4aca5e", @@ -874,7 +875,7 @@ "_journal/2024-10/2024-10-06.md": "65a8e538144f59ee9e7296110cc9aa14", "_journal/2024-10-09.md": "66acb6c8abbf0c860966223f3299c2bc", "_journal/2024-10/2024-10-08.md": "2f737d8198b12bf635808964c4887ae1", - "x86-64/procedures.md": "c36268b99c0681bfca245e0538a302e0", + "x86-64/procedures.md": "b7b8233deb29727b53938a78e1a797f4", "_journal/2024-10-10.md": "29e4be2c164c63f8b7aab56bddee3dd6", "_journal/2024-10/2024-10-09.md": "b718c6f4cfe3069fcc0faf07ec414f73", "_journal/2024-10-15.md": "6e696a8d16ba257ed89e8564b771d290", @@ -882,7 +883,19 @@ "_journal/2024-10/2024-10-13.md": "8882c01060a4a909fd890180db356e73", "_journal/2024-10/2024-10-12.md": "1c299384b7f1fffa4e9f50fa5a1c05c2", "_journal/2024-10/2024-10-11.md": "6c98c6541efcb92854c1de68a2881d89", - "_journal/2024-10/2024-10-10.md": "b7c386d47a9f1e860effaa36001404ba" + "_journal/2024-10/2024-10-10.md": "b7c386d47a9f1e860effaa36001404ba", + "_journal/2024-10-21.md": "de1a0861e87df29aeff11a291f8fbd45", + "_journal/2024-10/2024-10-20.md": "cae8694ffce3aed71a29446d8444c7a3", + "_journal/2024-10/2024-10-19.md": "2b221729d097a67c8d8f68a416889fe8", + "_journal/2024-10/2024-10-18.md": "b44458dad4be715a62b21d0621209e36", + "_journal/2024-10/2024-10-17.md": "6e1e71cac789280fd228591afac83e55", + "_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": "5fe40544db71b5cc79f4f8149478fc8e", + "_journal/2024-10/2024-10-21.md": "de1a0861e87df29aeff11a291f8fbd45", + "_journal/2024-10-23.md": "51b2ca6edf23b6a64fd7d3638a0b54cb", + "_journal/2024-10/2024-10-22.md": "5ff4eb7eba58e77c4fb65b7162a485e6" }, "fields_dict": { "Basic": [ diff --git a/notes/_journal/2024-10-23.md b/notes/_journal/2024-10-23.md new file mode 100644 index 0000000..39a30b8 --- /dev/null +++ b/notes/_journal/2024-10-23.md @@ -0,0 +1,11 @@ +--- +title: "2024-10-23" +--- + +- [ ] Anki Flashcards +- [x] KoL +- [ ] OGS +- [ ] Sheet Music (10 min.) +- [ ] Korean (Read 1 Story) + +* Notes on closures and proof bottom-up and top-down are equal. \ No newline at end of file diff --git a/notes/_journal/2024-10-20.md b/notes/_journal/2024-10/2024-10-20.md similarity index 61% rename from notes/_journal/2024-10-20.md rename to notes/_journal/2024-10/2024-10-20.md index 8abc985..3c4b50c 100644 --- a/notes/_journal/2024-10-20.md +++ b/notes/_journal/2024-10/2024-10-20.md @@ -2,7 +2,7 @@ title: "2024-10-20" --- -- [ ] Anki Flashcards +- [x] Anki Flashcards - [x] KoL - [ ] OGS - [ ] Sheet Music (10 min.) diff --git a/notes/_journal/2024-10/2024-10-21.md b/notes/_journal/2024-10/2024-10-21.md new file mode 100644 index 0000000..4d9c9ee --- /dev/null +++ b/notes/_journal/2024-10/2024-10-21.md @@ -0,0 +1,11 @@ +--- +title: "2024-10-21" +--- + +- [x] Anki Flashcards +- [x] KoL +- [ ] OGS +- [ ] Sheet Music (10 min.) +- [ ] Korean (Read 1 Story) + +* More notes on the third integral argument for x86-64 procedures. \ No newline at end of file diff --git a/notes/_journal/2024-10/2024-10-22.md b/notes/_journal/2024-10/2024-10-22.md new file mode 100644 index 0000000..ff41572 --- /dev/null +++ b/notes/_journal/2024-10/2024-10-22.md @@ -0,0 +1,12 @@ +--- +title: "2024-10-22" +--- + +- [x] Anki Flashcards +- [x] KoL +- [ ] OGS +- [ ] Sheet Music (10 min.) +- [ ] Korean (Read 1 Story) + +* Added notes on [[dfs|DFS]]. +* Proof on isomorphism between Peano systems and $\langle \omega, \sigma, 0 \rangle$. \ No newline at end of file diff --git a/notes/algebra/floor-ceiling.md b/notes/algebra/floor-ceiling.md index 48b3f13..5e67708 100644 --- a/notes/algebra/floor-ceiling.md +++ b/notes/algebra/floor-ceiling.md @@ -44,7 +44,7 @@ END%% %%ANKI Basic -When does $\lfloor x / 2 \rfloor = \lceil x / 2 \rceil$? +Given integer $x$, when does $\lfloor x / 2 \rfloor = \lceil x / 2 \rceil$? Back: When $x$ is even. Reference: Ronald L. Graham, Donald Ervin Knuth, and Oren Patashnik, *Concrete Mathematics: A Foundation for Computer Science*, 2nd ed (Reading, Mass: Addison-Wesley, 1994). @@ -52,7 +52,7 @@ END%% %%ANKI Basic -When does $\lfloor x / 2 \rfloor \neq \lceil x / 2 \rceil$? +Given integer $x$, when does $\lfloor x / 2 \rfloor \neq \lceil x / 2 \rceil$? Back: When $x$ is odd. Reference: Ronald L. Graham, Donald Ervin Knuth, and Oren Patashnik, *Concrete Mathematics: A Foundation for Computer Science*, 2nd ed (Reading, Mass: Addison-Wesley, 1994). diff --git a/notes/algorithms/bfs.md b/notes/algorithms/bfs.md index ac5312b..fd26bf8 100644 --- a/notes/algorithms/bfs.md +++ b/notes/algorithms/bfs.md @@ -9,7 +9,7 @@ tags: ## Overview -Bread-first search operates on a graph $G = \langle V, E \rangle$ and a **source** vertex $s$. It works by distinguishing between discovered and undiscovered nodes, incrementally marking nodes adjacent to discovered nodes from undiscovered to discovered. +Bread-first search operates on a graph $G = \langle V, E \rangle$ and a **source** vertex $s$. ![[bfs.gif]] @@ -167,7 +167,7 @@ END%% %%ANKI Basic *Why* is BFS of an adjacency-list representation $O(\lvert V \rvert + \lvert E \rvert)$? -Back: For each vertex being analyzed, we only examine its immediately adjacent vertices. +Back: For each vertex being analyzed, we examine all of its adjacent vertices. Reference: Thomas H. Cormen et al., Introduction to Algorithms, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022). END%% diff --git a/notes/algorithms/dfs.md b/notes/algorithms/dfs.md new file mode 100644 index 0000000..3511de7 --- /dev/null +++ b/notes/algorithms/dfs.md @@ -0,0 +1,129 @@ +--- +title: Depth-First Search +TARGET DECK: Obsidian::STEM +FILE TAGS: algorithm data_structure::graph +tags: + - dfs + - graph +--- + +## Overview + +Depth-first search operates on a graph $G = \langle V, E \rangle$ and a **source** vertex $s$. + +![[dfs.gif]] + +%%ANKI +Basic +What is DFS an acronym for? +Back: **D**epth-**f**irst **s**earch. +Reference: Thomas H. Cormen et al., Introduction to Algorithms, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022). + +END%% + +%%ANKI +Cloze +Depth-first search is characterized by a graph and a {source vertex}. +Reference: Thomas H. Cormen et al., Introduction to Algorithms, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022). + +END%% + +%%ANKI +Basic +Which of undirected and directed graphs is DFS applicable to? +Back: Both. +Reference: Thomas H. Cormen et al., Introduction to Algorithms, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022). + +END%% + +%%ANKI +Basic +With respect to depth-first trees, what does the predecessor of a node $N$ refer to? +Back: The node from which $N$ was discovered. +Reference: Thomas H. Cormen et al., Introduction to Algorithms, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022). + +END%% + +%%ANKI +Basic +What ADT is typically used to manage the set of most recently discovered DFS vertices? +Back: A stack. +Reference: Thomas H. Cormen et al., Introduction to Algorithms, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022). + +END%% + +%%ANKI +Cloze +A {1:queue} is to {2:BFS} whereas a {2:stack} is to {1:DFS}. +Reference: Thomas H. Cormen et al., Introduction to Algorithms, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022). + +END%% + +%%ANKI +Basic +Which vertices are not discovered during a graph DFS? +Back: Those not reachable from the source vertex. +Reference: Thomas H. Cormen et al., Introduction to Algorithms, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022). + +END%% + +%%ANKI +Basic +What basic graph algorithm is the following a demonstration of? +![[dfs.gif]] +Back: Depth-first search. +Reference: Thomas H. Cormen et al., Introduction to Algorithms, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022). + +END%% + +%%ANKI +Basic +Which standard graph representation has worst-case DFS running time of $O(\lvert V \rvert + \lvert E \rvert)$? +Back: The adjacency-list representation. +Reference: Thomas H. Cormen et al., Introduction to Algorithms, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022). + +END%% + +%%ANKI +Basic +Given graph $\langle V, E \rangle$ with adjacency-list representation, what is the worst-case run time of DFS? +Back: $O(\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 +Which standard graph representation has worst-case DFS running time of $O(\lvert V \rvert^2)$? +Back: The adjacency-matrix representation. +Reference: Thomas H. Cormen et al., Introduction to Algorithms, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022). + +END%% + +%%ANKI +Basic +Given graph $\langle V, E \rangle$ with adjacency-matrix representation, what is the worst-case run time of DFS? +Back: $O(\lvert V \rvert^2)$ +Reference: Thomas H. Cormen et al., Introduction to Algorithms, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022). + +END%% + +%%ANKI +Basic +*Why* is DFS of an adjacency-list representation $O(\lvert V \rvert + \lvert E \rvert)$? +Back: For each vertex being analyzed, we examine all of its adjacent vertices. +Reference: Thomas H. Cormen et al., Introduction to Algorithms, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022). + +END%% + +%%ANKI +Basic +*Why* is DFS of an adjacency-matrix representation $O(\lvert V \rvert^2)$? +Back: For each vertex being analyzed, we must examine $\lvert V \rvert$ entries for adjacent vertices. +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/c17/types/simple.md b/notes/c17/types/simple.md index 6cbf4ce..54610ad 100644 --- a/notes/c17/types/simple.md +++ b/notes/c17/types/simple.md @@ -1211,7 +1211,7 @@ END%% %%ANKI Basic Suppose `uintN_t` exists. What is its precision? -Back: `N` +Back: `N` bits. Reference: Jens Gustedt, _Modern C_ (Shelter Island, NY: Manning Publications Co, 2020). END%% diff --git a/notes/formal-system/logical-system/prop-logic.md b/notes/formal-system/logical-system/prop-logic.md index 94784a2..7bb384c 100644 --- a/notes/formal-system/logical-system/prop-logic.md +++ b/notes/formal-system/logical-system/prop-logic.md @@ -34,14 +34,6 @@ Reference: Oscar Levin, *Discrete Mathematics: An Open Introduction*, 3rd ed., n END%% -%%ANKI -Basic -What two categories do propositions fall within? -Back: Atomic and molecular propositions. -Reference: Oscar Levin, *Discrete Mathematics: An Open Introduction*, 3rd ed., n.d., [https://discrete.openmathbooks.org/pdfs/dmoi3-tablet.pdf](https://discrete.openmathbooks.org/pdfs/dmoi3-tablet.pdf). - -END%% - %%ANKI Basic What is an atomic proposition? diff --git a/notes/set/functions.md b/notes/set/functions.md index 3b10cc5..a8d4687 100644 --- a/notes/set/functions.md +++ b/notes/set/functions.md @@ -1708,6 +1708,164 @@ Reference: Herbert B. Enderton, *Elements of Set Theory* (New York: Academic Pre END%% +Let $f$ be a function from $B$ into $B$ and assume $A \subseteq B$. There are two possible methods for constructing the **closure** $C$ of $A$ under $f$. The top-down approach defines $C^*$ to be the intersection of all closed supersets of $A$: $$C^* = \bigcap\, \{X \mid A \subseteq X \subseteq B \land f[\![X]\!] \subseteq X \}$$ + +The bottom-up approach defines $C_*$ to be $$C_* = \bigcup_{i \in \omega} h(i)$$ +where $h \colon \omega \rightarrow \mathscr{P}(B)$ is recursively defined as: $$\begin{align*} h(0) & = A, \\ h(n^+) &= h(n) \cup f[\![h(n)]\!]. \end{align*}$$ + +Note that the [[natural-numbers#Recursion Theorem|recursion theorem]] proves $h$ is indeed a function. + +%%ANKI +Basic +Let $f \colon B \rightarrow B$ and $A \subseteq B$. How is the top-down closure $C^*$ of $A$ under $f$ defined? +Back: $\bigcap\, \{ X \mid A \subseteq X \subseteq B \land f[\![X]\!] \subseteq X \}$ +Reference: Herbert B. Enderton, *Elements of Set Theory* (New York: Academic Press, 1977). + +END%% + +%%ANKI +Basic +Let $f \colon B \rightarrow B$ and $A \subseteq B$. What is the smallest set the closure $C^*$ of $A$ under $f$ can be? +Back: $A$ +Reference: Herbert B. Enderton, *Elements of Set Theory* (New York: Academic Press, 1977). + +END%% + +%%ANKI +Basic +Let $f \colon B \rightarrow B$ and $A \subseteq B$. What is the largest set the closure $C^*$ of $A$ under $f$ can be? +Back: $B$ +Reference: Herbert B. Enderton, *Elements of Set Theory* (New York: Academic Press, 1977). + +END%% + +%%ANKI +Basic +Let $f \colon B \rightarrow B$ and $A \subseteq B$. How is the bottom-up closure $C_*$ of $A$ under $f$ defined assuming appropriate $h \colon \omega \rightarrow \mathscr{P}(B)$? +Back: $\bigcup \mathop{\text{ran}} h$ +Reference: Herbert B. Enderton, *Elements of Set Theory* (New York: Academic Press, 1977). + +END%% + +%%ANKI +Basic +Let $f \colon B \rightarrow B$ and $A \subseteq B$. What is the smallest set the closure $C_*$ of $A$ under $f$ can be? +Back: $A$ +Reference: Herbert B. Enderton, *Elements of Set Theory* (New York: Academic Press, 1977). + +END%% + +%%ANKI +Basic +Let $f \colon B \rightarrow B$ and $A \subseteq B$. What is the largest set the closure $C_*$ of $A$ under $f$ can be? +Back: $B$ +Reference: Herbert B. Enderton, *Elements of Set Theory* (New York: Academic Press, 1977). + +END%% + +%%ANKI +Basic +Let $C$ be the closure of $A$ under $f$. What kind of mathematical entity is $A$? +Back: A set. +Reference: Herbert B. Enderton, *Elements of Set Theory* (New York: Academic Press, 1977). + +END%% + +%%ANKI +Basic +Let $C$ be the closure of $A$ under $f$. What kind of mathematical entity is $f$? +Back: A function. +Reference: Herbert B. Enderton, *Elements of Set Theory* (New York: Academic Press, 1977). + +END%% + +%%ANKI +Basic +Let $C$ be the closure of $A$ under $f$. What kind of mathematical entity is $C$? +Back: A set. +Reference: Herbert B. Enderton, *Elements of Set Theory* (New York: Academic Press, 1977). + +END%% + +%%ANKI +Basic +Let $C$ be the closure of $A$ under $f$. What two ways can $C$ be defined? +Back: Bottom-up or top-down. +Reference: Herbert B. Enderton, *Elements of Set Theory* (New York: Academic Press, 1977). + +END%% + +%%ANKI +Basic +Let $C$ be the closure of $A$ under $f$. How is the top-down closure denoted? +Back: As $C^*$. +Reference: Herbert B. Enderton, *Elements of Set Theory* (New York: Academic Press, 1977). + +END%% + +%%ANKI +Basic +Let $C$ be the closure of $A$ under $f$. How is the bottom-up closure denoted? +Back: As $C_*$. +Reference: Herbert B. Enderton, *Elements of Set Theory* (New York: Academic Press, 1977). + +END%% + +%%ANKI +Basic +Let $C$ be the closure of $A$ under $f$. What is the "signature" of $f$? +Back: $f \colon B \rightarrow B$ for some $B \supseteq A$. +Reference: Herbert B. Enderton, *Elements of Set Theory* (New York: Academic Press, 1977). + +END%% + +%%ANKI +Basic +Let $C_*$ be the closure of $A$ under $f$ defined in terms of function $h$. What is $h$'s domain? +Back: $\omega$ +Reference: Herbert B. Enderton, *Elements of Set Theory* (New York: Academic Press, 1977). + +END%% + +%%ANKI +Basic +Let $C_*$ be the closure of $A$ under $f$ defined in terms of function $h$. What is $h$'s codomain? +Back: Assume $f$ maps $B$ into $B$, Then $h$'s codomain is $B$. +Reference: Herbert B. Enderton, *Elements of Set Theory* (New York: Academic Press, 1977). + +END%% + +%%ANKI +Basic +Let $C_*$ be the closure of $A$ under $f$ defined in terms of function $h$. What does $h(0)$ evaluate to? +Back: $A$ +Reference: Herbert B. Enderton, *Elements of Set Theory* (New York: Academic Press, 1977). + +END%% + +%%ANKI +Basic +Let $C_*$ be the closure of $A$ under $f$ defined in terms of function $h$. What does $h(n^+)$ evaluate to? +Back: $h(n) \cup f[\![h(n)]\!]$ +Reference: Herbert B. Enderton, *Elements of Set Theory* (New York: Academic Press, 1977). + +END%% + +%%ANKI +Basic +Let $C_*$ be the closure of $A$ under $f$ defined in terms of function $h$. What theorem proves $h$'s existence? +Back: The recursion theorem. +Reference: Herbert B. Enderton, *Elements of Set Theory* (New York: Academic Press, 1977). + +END%% + +%%ANKI +Cloze +The top-down closure $C^*$ of $A$ under $f$ is the {intersection} of all {closed supersets} of $A$. +Reference: Herbert B. Enderton, *Elements of Set Theory* (New York: Academic Press, 1977). + +END%% + ## Kernels Let $F \colon A \rightarrow B$. Define [[relations#Equivalence Relations|equivalence relation]] $\sim$ as $$x \sim y \Leftrightarrow f(x) = f(y)$$ diff --git a/notes/set/index.md b/notes/set/index.md index 7074d42..64e2fef 100644 --- a/notes/set/index.md +++ b/notes/set/index.md @@ -735,6 +735,13 @@ Reference: Herbert B. Enderton, *Elements of Set Theory* (New York: Academic Pre END%% +%%ANKI +Cloze +Let $A$ be a set and $C = \bigcup\, \{ x \mid \_\_\_ \}$. Then $C$ {$\supseteq$} $A$ if $A$ satisfies the {entrance requirement}. +Reference: Herbert B. Enderton, *Elements of Set Theory* (New York: Academic Press, 1977). + +END%% + ## Power Set Axiom For any set $a$, there is a set whose members are exactly the subsets of $a$: $$\forall a, \exists B, \forall x, (x \in B \Leftrightarrow x \subseteq a)$$ @@ -988,6 +995,13 @@ Reference: Herbert B. Enderton, *Elements of Set Theory* (New York: Academic Pre END%% +%%ANKI +Cloze +Let $A$ be a set and $C = \bigcap\, \{ x \mid \_\_\_ \}$. Then $C$ {$\subseteq$} $A$ if $A$ satisfies the {entrance requirement}. +Reference: Herbert B. Enderton, *Elements of Set Theory* (New York: Academic Press, 1977). + +END%% + %%ANKI Basic What set operation is shaded green in the following venn diagram? diff --git a/notes/x86-64/procedures.md b/notes/x86-64/procedures.md index a688f63..39588d6 100644 --- a/notes/x86-64/procedures.md +++ b/notes/x86-64/procedures.md @@ -401,6 +401,206 @@ Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Program END%% +%%ANKI +Basic +How many bytes make up the `%rdx` register? +Back: $8$ +Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016. + +END%% + +%%ANKI +Basic +How many bytes make up the `%dx` register? +Back: $2$ +Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016. + +END%% + +%%ANKI +Basic +How many bytes make up the `%dl` register? +Back: $1$ +Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016. + +END%% + +%%ANKI +Basic +How many bytes make up the `%edx` register? +Back: $4$ +Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016. + +END%% + +%%ANKI +Cloze +By convention, register {`%rdx`} is used for {the third integral argument}. +Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016. + +END%% + +%%ANKI +Cloze +{1:Words} are to {2:`%dx`} whereas {2:double words} are to {1:`%edx`}. +Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016. + +END%% + +%%ANKI +Cloze +{1:Bytes} are to {2:`%dl`} whereas {2:quad words} are to {1:`%rdx`}. +Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016. + +END%% + +%%ANKI +Basic +How do you access the low-order 2 bytes of `%rdx`? +Back: By using `%dx`. +Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016. + +END%% + +%%ANKI +Basic +How do you access the low-order 4 bytes of `%rdx`? +Back: By using `%edx`. +Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016. + +END%% + +%%ANKI +Basic +How do you access the low-order byte of `%rdx`? +Back: By using `%dl`. +Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016. + +END%% + +%%ANKI +Basic +Which register should the third integral argument of a procedure be placed in? +Back: `%rdx` +Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016. + +END%% + +%%ANKI +Basic +From smallest to largest, list the four "third integral argument" registers. +Back: `%dl`, `%dx`, `%edx`, and `%rdx`. +Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016. + +END%% + +%%ANKI +Cloze +{1:`%dil`} is to the {2:first} integral argument whereas {2:`%dl`} is to the {1:third} integral argument. +Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016. + +END%% + +%%ANKI +Basic +How many bytes make up the `%rcx` register? +Back: $8$ +Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016. + +END%% + +%%ANKI +Basic +How many bytes make up the `%ecx` register? +Back: $4$ +Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016. + +END%% + +%%ANKI +Basic +How many bytes make up the `%cx` register? +Back: $2$ +Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016. + +END%% + +%%ANKI +Basic +How many bytes make up the `%cl` register? +Back: $1$ +Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016. + +END%% + +%%ANKI +Cloze +By convention, register {`%rcx`} is used for {the fourth integral argument}. +Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016. + +END%% + +%%ANKI +Cloze +{1:Words} are to {2:`%cx`} whereas {2:quad words} are to {1:`%rcx`}. +Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016. + +END%% + +%%ANKI +Cloze +{1:Bytes} are to {2:`%cl`} whereas {2:double words} are to {1:`%ecx`}. +Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016. + +END%% + +%%ANKI +Basic +How do you access the low-order 2 bytes of `%rcx`? +Back: By using `%cx`. +Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016. + +END%% + +%%ANKI +Basic +How do you access the low-order 4 bytes of `%rcx`? +Back: By using `%ecx`. +Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016. + +END%% + +%%ANKI +Basic +How do you access the low-order byte of `%rcx`? +Back: By using `%cl`. +Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016. + +END%% + +%%ANKI +Basic +Which register should the fourth integral argument of a procedure be placed in? +Back: `%rcx` +Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016. + +END%% + +%%ANKI +Basic +From smallest to largest, list the four "fourth integral argument" registers. +Back: `%cl`, `%cx`, `%ecx`, and `%rcx`. +Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016. + +END%% + +%%ANKI +Cloze +{1:`%di`} is to the {2:first} integral argument whereas {2:`%cx`} is to the {1:fourth} integral argument. +Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016. + +END%% + ## Bibliography * Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016.