diff --git a/notes/.obsidian/plugins/obsidian-to-anki-plugin/data.json b/notes/.obsidian/plugins/obsidian-to-anki-plugin/data.json index d54b9e6..039868f 100644 --- a/notes/.obsidian/plugins/obsidian-to-anki-plugin/data.json +++ b/notes/.obsidian/plugins/obsidian-to-anki-plugin/data.json @@ -237,7 +237,10 @@ "abs-down.png", "abs-right-down.png", "abs-left-down.png", - "triple-table-repr.png" + "triple-table-repr.png", + "state-diagram.png", + "state-diagram-ends1.png", + "state-diagram-ends0.png" ], "File Hashes": { "algorithms/index.md": "3ac071354e55242919cc574eb43de6f8", @@ -578,7 +581,7 @@ "_journal/2024-05/2024-05-25.md": "3e8a0061fa58a6e5c48d12800d1ab869", "_journal/2024-05-27.md": "b36636d10eab34380f17f288868df3ae", "_journal/2024-05/2024-05-26.md": "abe84b5beae74baa25501c818e64fc95", - "algebra/set.md": "6cf503bd1118d22a45f1571057bea96d", + "algebra/set.md": "ae08c25c07ecedb2a05c02b258b4542a", "algebra/boolean.md": "c9bd5abb601be6d2bedd24d5f54848b0", "git/merge-conflicts.md": "761ad6137ec51d3877f7d5b3615ca5cb", "_journal/2024-05-28.md": "0f6aeb5ec126560acdc2d8c5c6570337", @@ -976,7 +979,7 @@ "_journal/2024-11/2024-11-24.md": "894b021e6335d4e6947448c8d362c083", "_journal/2024-11-26.md": "29bc0b54d23034b9108e567a1d5fa8ac", "_journal/2024-11/2024-11-25.md": "1ec17a8473fa9c4779090ecbd22d70ef", - "calculus/intervals.md": "6a317fb5053b172611e9e7ae6f66f609", + "calculus/intervals.md": "7da1830e226834566eab2c5bd2cae466", "c17/storage.md": "07f0aa969d502df97f757318bde3c166", "c17/functions.md": "76b12732875998c44b22ba3531cf88a0", "_journal/2024-11-27.md": "5a58e3a0bd08c689d30600021937495d", @@ -999,7 +1002,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": "e8d36a8fae9cd785374f419996ef5269", + "calculus/integrals.md": "edc4e00d8e2b9a7cd14836bb543bb8b6", "_journal/2024-12-07.md": "bfb6c4db0acbacba19f03a04ec29fa5c", "_journal/2024-12/2024-12-06.md": "d73b611d2d15827186a0252d9b9a6580", "_journal/2024-12-08.md": "5662897539b222db1af45dcd217f0796", @@ -1015,7 +1018,7 @@ "_journal/2024-12-11.md": "e7393c01b44c5b804f86f45b8b899b59", "_journal/2024-12/2024-12-10.md": "d4f43b32220dbe174be514397b1bb035", "_journal/2024-12/2024-12-11.md": "e7393c01b44c5b804f86f45b8b899b59", - "encoding/uri.md": "394abe477b882e1414dd2fb151fea823", + "encoding/uri.md": "09552882689f55414786d709c43f6697", "encoding/xml.md": "01a66b1a102cccc682f8f1cab0f50bc6", "encoding/rdf.md": "87a47be25bc5754a11166a4b7663cada", "_journal/2024-12-15.md": "be66c8808d8bb66d4e7b91db7c93c94a", @@ -1042,7 +1045,19 @@ "encoding/xml/rdf.md": "f4491dd28b937da3182d701a863e40fe", "encoding/xml/index.md": "01a66b1a102cccc682f8f1cab0f50bc6", "ontology/reification.md": "ef8275957dcc1a7e5501722d4652e41c", - "ontology/rdf.md": "fd273c30bec6f46b68547f0d392620b1" + "ontology/rdf.md": "fd273c30bec6f46b68547f0d392620b1", + "data-models/rdf.md": "a07c290d11087346757185b8047c94c7", + "serialization/xml.md": "84b632282ebcc2b6216923a02abdd4c2", + "serialization/index.md": "5ed7e99e4efc4844839ea357d351f5d8", + "data-models/index.md": "9e60f40798490f0743f291e55f492033", + "_journal/2024-12-22.md": "015dbf675853a81db07d641e8dab7fd4", + "_journal/2024-12/2024-12-21.md": "1c1a5791f7519c92e882957cf417b51f", + "formal-system/language.md": "7797d33a0b0eb187d43dda46a138fb25", + "computability/automaton.md": "e01a115d4df90f565c51435e3f558d1e", + "computability/index.md": "92042eac186e5772144f86141fbac155", + "_journal/2024-12-23.md": "0a7cf306d477020e020ed23ce3c2d68d", + "_journal/2024-12/2024-12-22.md": "75375a867efc5b3aff406c73394d4814", + "computability/language.md": "9ee8bd16c231e71855ab1d8dae3188cb" }, "fields_dict": { "Basic": [ diff --git a/notes/_journal/2024-12-21.md b/notes/_journal/2024-12-21.md deleted file mode 100644 index 013dcdd..0000000 --- a/notes/_journal/2024-12-21.md +++ /dev/null @@ -1,9 +0,0 @@ ---- -title: "2024-12-21" ---- - -- [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/2024-12-23.md b/notes/_journal/2024-12-23.md new file mode 100644 index 0000000..e9f400c --- /dev/null +++ b/notes/_journal/2024-12-23.md @@ -0,0 +1,11 @@ +--- +title: "2024-12-23" +--- + +- [x] Anki Flashcards +- [x] KoL +- [ ] OGS +- [ ] Sheet Music (10 min.) +- [ ] Korean (Read 1 Story) + +* Added [[automaton|finite automata]] definition and related introductory notes. \ No newline at end of file diff --git a/notes/_journal/2024-12/2024-12-21.md b/notes/_journal/2024-12/2024-12-21.md new file mode 100644 index 0000000..86b5dfd --- /dev/null +++ b/notes/_journal/2024-12/2024-12-21.md @@ -0,0 +1,12 @@ +--- +title: "2024-12-21" +--- + +- [x] Anki Flashcards +- [x] KoL +- [x] OGS +- [ ] Sheet Music (10 min.) +- [ ] Korean (Read 1 Story) + +* Notes on properties of [[integrals#Step Functions|step function integrals]]. +* Additional notes on [[cardinality|cardinal numbers]]. \ No newline at end of file diff --git a/notes/_journal/2024-12/2024-12-22.md b/notes/_journal/2024-12/2024-12-22.md new file mode 100644 index 0000000..ee9b20d --- /dev/null +++ b/notes/_journal/2024-12/2024-12-22.md @@ -0,0 +1,11 @@ +--- +title: "2024-12-22" +--- + +- [x] Anki Flashcards +- [x] KoL +- [x] OGS +- [ ] Sheet Music (10 min.) +- [ ] Korean (Read 1 Story) + +* Notes on [[language]] (e.g. strings, alphabets, etc.). \ No newline at end of file diff --git a/notes/algebra/set.md b/notes/algebra/set.md index 5cb9b92..dc87d0a 100644 --- a/notes/algebra/set.md +++ b/notes/algebra/set.md @@ -366,7 +366,7 @@ For any sets $A$, $B$, and $C$, $$\begin{align*} A \cap (B \cup C) & = (A \cap B %%ANKI Basic The distributive laws of the algebra of sets apply to what operators? -Back: $\cup$ and $\cap$ +Back: $\cup$ and $\cap$. Reference: Herbert B. Enderton, *Elements of Set Theory* (New York: Academic Press, 1977). END%% diff --git a/notes/bash/index.md b/notes/bash/index.md deleted file mode 100644 index 725aa16..0000000 --- a/notes/bash/index.md +++ /dev/null @@ -1,43 +0,0 @@ ---- -title: Bash -TARGET DECK: Obsidian::STEM -FILE TAGS: bash -tags: - - bash ---- - -%%ANKI -Basic -How do you escape a `'` within a single-quote string? -Back: This is impossible. -Reference: Robbins, Arnold D. “GAWK: Effective AWK Programming,” October 2023. [https://www.gnu.org/software/gawk/manual/gawk.pdf](https://www.gnu.org/software/gawk/manual/gawk.pdf) - -END%% - -%%ANKI -Basic -What does the null string refer to? -Back: The empty string, i.e. `""`. -Reference: Robbins, Arnold D. “GAWK: Effective AWK Programming,” October 2023. [https://www.gnu.org/software/gawk/manual/gawk.pdf](https://www.gnu.org/software/gawk/manual/gawk.pdf) - -END%% - -%%ANKI -Basic -When does Bash remove null strings from a command? -Back: When they occur as part of a non-null command-line argument. -Reference: Robbins, Arnold D. “GAWK: Effective AWK Programming,” October 2023. [https://www.gnu.org/software/gawk/manual/gawk.pdf](https://www.gnu.org/software/gawk/manual/gawk.pdf) - -END%% - -%%ANKI -Basic -Why does the following not work correctly? -```bash -$ # -F specifies the field separator -$ awk -F"" 'program' files -``` -Back: Bash removes the null string before executing the command. -Reference: Robbins, Arnold D. “GAWK: Effective AWK Programming,” October 2023. [https://www.gnu.org/software/gawk/manual/gawk.pdf](https://www.gnu.org/software/gawk/manual/gawk.pdf) - -END%% \ No newline at end of file diff --git a/notes/bash/prompts.md b/notes/bash/prompts.md deleted file mode 100644 index 802906e..0000000 --- a/notes/bash/prompts.md +++ /dev/null @@ -1,61 +0,0 @@ ---- -title: Prompts -TARGET DECK: Obsidian::STEM -FILE TAGS: bash -tags: - - bash ---- - -## Overview - -According to Robbins a POSIX-compliant shell (like Bash) generally has the primary and secondary prompts denoted with `$` and `>` respectively. Adjust these values using environment variables `$PS1` and `PS2` respectively. - -%%ANKI -Basic -What symbol is usually used to denote the primary prompt? -Back: `$$` -Reference: Robbins, Arnold D. “GAWK: Effective AWK Programming,” October 2023. [https://www.gnu.org/software/gawk/manual/gawk.pdf](https://www.gnu.org/software/gawk/manual/gawk.pdf) - -END%% - -%%ANKI -Basic -What environment variable controls Bash's primary prompt? -Back: `$$PS1` -Reference: Cooper, Mendel. “Advanced Bash-Scripting Guide,” n.d., 916. - -END%% - -%%ANKI -Basic -What symbol is usually used to denote the secondary prompt? -Back: `>` -Reference: Robbins, Arnold D. “GAWK: Effective AWK Programming,” October 2023. [https://www.gnu.org/software/gawk/manual/gawk.pdf](https://www.gnu.org/software/gawk/manual/gawk.pdf) - -END%% - -%%ANKI -Basic -What environment variable controls Bash's secondary prompt? -Back: `$$PS2` -Reference: Cooper, Mendel. “Advanced Bash-Scripting Guide,” n.d., 916. - -END%% - -Paths supplied to commands are typically "sanitized" by prefixing the path name with `./`. This is mentioned in a few different places: - -* `find -execdir` performs this prefixing automatically on all found files. -* `awk` ambiguously interprets a file named e.g. `count=1` as variable assignment. Should write `$ awk -f program.awk ./count=1`. - -%%ANKI -Basic -What methodology is commonly used to "sanitize" paths supplied as command-line arguments? -Back: Prefixing the paths with `./`. -Reference: Cooper, Mendel. “Advanced Bash-Scripting Guide,” n.d., 916. - -END%% - -## Bibliography - -* Cooper, Mendel. “Advanced Bash-Scripting Guide,” n.d., 916. -* Robbins, Arnold D. “GAWK: Effective AWK Programming,” October 2023. [https://www.gnu.org/software/gawk/manual/gawk.pdf](https://www.gnu.org/software/gawk/manual/gawk.pdf) \ No newline at end of file diff --git a/notes/bash/robustness.md b/notes/bash/robustness.md deleted file mode 100644 index 20a1892..0000000 --- a/notes/bash/robustness.md +++ /dev/null @@ -1,69 +0,0 @@ ---- -title: Measuring Command Robustness -TARGET DECK: Obsidian::STEM -FILE TAGS: bash -tags: - - bash - - shell ---- - -## Overview - -An interesting point Robbins discusses in his introduction to [[posix/awk/index|gawk]] is this idea of command robustness. He states that: - -> A self-contained shell script is more reliable because there are no other files to misplace. - -%%ANKI -Basic -What is a self-contained shell script? -Back: A shell script that does not rely on the presence of other files. -Reference: Robbins, Arnold D. “GAWK: Effective AWK Programming,” October 2023. [https://www.gnu.org/software/gawk/manual/gawk.pdf](https://www.gnu.org/software/gawk/manual/gawk.pdf) - -END%% - -%%ANKI -Basic -What makes a self-contained shell script more reliable? -Back: There are no other files to misplace. -Reference: Robbins, Arnold D. “GAWK: Effective AWK Programming,” October 2023. [https://www.gnu.org/software/gawk/manual/gawk.pdf](https://www.gnu.org/software/gawk/manual/gawk.pdf) - -END%% - -He argues that the first command below is more robust than the second since the command is more loosely coupled to its environment: - -```bash -$ awk 'program' input-file1 input-file2 ... -$ awk -f program-file input-file1 input-file2 ... -``` - -It's interesting to think what else can be used as a measure of a command's robustness: - -* Required environment variables or environment variables formatted in a certain way - * `$PATH` needs to point to a specific location -* Whether the invoked program is present by default in a distribution or must be installed -* The ability to run with or without an associated TTY -* The ability to run with or without associated standard streams - * `stdout`, `stderr`, `stdin` -* How backwards compatible the invoked program is - * Version mismatch may silently cause the same invocation to fail -* Expected permissions - * EUID, read permissions on an input file, etc. -* Determinism of the program itself - * Does output rely entirely on input or can it make nondeterministic choices -* The amount of resources dedicated to the program - * Failure may occur if not enough memory is provided to the command -* Whether a program acts idempotently - * What happens if I run the command twice in a row? -* Whether a program acts atomically - * Is it possible intermediate files are left that affect subsequent runs? -* The presence of timeouts - * Perhaps a program waits a specified amount of time before input is available. The command's success is now externally determined. -* Locale-aware functionality - * Consider for instance [[posix/awk/index|gawk]]'s `\u` [[escape-sequences|sequence]] which targets characters in the current locale's character set as opposed to specifically Unicode. - * POSIX standard [[posix/regexp#Character Classes|character classes]] serve as another example. - -The above scenarios are what makes something like [[nix/index|nix]] so compelling. - -## Bibliography - -* Robbins, Arnold D. “GAWK: Effective AWK Programming,” October 2023. [https://www.gnu.org/software/gawk/manual/gawk.pdf](https://www.gnu.org/software/gawk/manual/gawk.pdf) diff --git a/notes/bash/shebang.md b/notes/bash/shebang.md deleted file mode 100644 index a476fe7..0000000 --- a/notes/bash/shebang.md +++ /dev/null @@ -1,58 +0,0 @@ ---- -title: Shebang -TARGET DECK: Obsidian::STEM -FILE TAGS: bash -tags: - - bash ---- - -## Overview - -The shebang (also writting shabang or sha-bang) is a magic character at the start of a script indicating what command should be run when invoking the script directly. It always begins with ASCII characters `#!`. - -%%ANKI -Basic -What ASCII characters do shebangs start with? -Back: `#!` -Reference: Cooper, Mendel. “Advanced Bash-Scripting Guide,” n.d., 916. - -END%% - -%%ANKI -Basic -What class of programs can be specified in a shebang? -Back: Interpreters -Reference: Robbins, Arnold D. “GAWK: Effective AWK Programming,” October 2023. [https://www.gnu.org/software/gawk/manual/gawk.pdf](https://www.gnu.org/software/gawk/manual/gawk.pdf) - -END%% - -%%ANKI -Basic -The OS will parse a shebang into what three parts? -Back: `#!`, the interpreter, and the rest of the line as a single argument. -Reference: Robbins, Arnold D. “GAWK: Effective AWK Programming,” October 2023. [https://www.gnu.org/software/gawk/manual/gawk.pdf](https://www.gnu.org/software/gawk/manual/gawk.pdf) - -END%% - -%%ANKI -Basic -What gotcha does Robbins highlight with shebang parsing? -Back: The remainder of the line following the interpreter is passed as a *single* argument. -Reference: Robbins, Arnold D. “GAWK: Effective AWK Programming,” October 2023. [https://www.gnu.org/software/gawk/manual/gawk.pdf](https://www.gnu.org/software/gawk/manual/gawk.pdf) - -END%% - -Some systems limit the length of interpreters to just 32 characters. A simple workaround when encountering this limitation is to introduce a symbolic link. - -%%ANKI -Basic -What workaround is used when shebang interpreter names are too long? -Back: Introduce a symbolic link. -Reference: Robbins, Arnold D. “GAWK: Effective AWK Programming,” October 2023. [https://www.gnu.org/software/gawk/manual/gawk.pdf](https://www.gnu.org/software/gawk/manual/gawk.pdf) - -END%% - -## Bibliography - -* Cooper, Mendel. “Advanced Bash-Scripting Guide,” n.d., 916. -* Robbins, Arnold D. “GAWK: Effective AWK Programming,” October 2023. [https://www.gnu.org/software/gawk/manual/gawk.pdf](https://www.gnu.org/software/gawk/manual/gawk.pdf) \ No newline at end of file diff --git a/notes/calculus/integrals.md b/notes/calculus/integrals.md index d369cd1..6d5b3a6 100644 --- a/notes/calculus/integrals.md +++ b/notes/calculus/integrals.md @@ -1,18 +1,26 @@ --- title: Integrals TARGET DECK: Obsidian::STEM -FILE TAGS: calculus::integrals +FILE TAGS: calculus::integral tags: - calculus - integral --- +## Overview + +The integral is usually defined first in terms of step functions and then general ordinate sets. It is closely tied to [[area]]. In particular, the integral of some nonnegative function on a closed interval is defined so that its area is equal to the area of the ordinate set in question. + ## Step Functions Let $s$ be a step function defined on [[intervals|interval]] $[a, b]$, and let $P = \{x_0, x_1, \ldots, x_n\}$ be a [[intervals#Partitions|partition]] of $[a, b]$ such that $s$ is constant on the open subintervals of $P$. Denote by $s_k$ the constant value that $s$ takes in the $k$th open subinterval, so that $$s(x) = s_k \quad\text{if}\quad x_{k-1} < x < x_k, \quad k = 1, 2, \ldots, n.$$ The **integral of $s$ from $a$ to $b$**, denoted by the symbol $\int_a^b s(x)\,dx$, is defined by the following formula: $$\int_a^b s(x) \,dx = \sum_{k=1}^n s_k \cdot (x_k - x_{k - 1})$$ +Furthermore, $$\int_a^b s(x) \,dx = -\int_b^a s(x) \,dx$$ + +and $$\int_a^a s(x)\,dx = 0.$$ + %%ANKI Basic Apostol first introduces the integral for the ordinate sets of what kind of function? @@ -132,6 +140,183 @@ Reference: Tom M. Apostol, _Calculus, Vol. 1: One-Variable Calculus, with an Int END%% +%%ANKI +Basic +Let $s$ be a step function over $[a, b]$. How is $\int_b^a s(x) \,dx$ defined? +Back: As $-\int_a^b s(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 +Let $s$ be a step function over $[a, b]$. How is $\int_a^b s(x) \,dx$ defined? +Back: Given partition $P = \{x_0, x_1, \ldots, x_n\}$ with constant value $s_k$ on the $k$th open subinterval, $$\int_a^b s(x) \,dx = \sum_{k=1}^n s_k \cdot (x_k - x_{k - 1})$$ +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 $s$ be a step function over $[a, b]$. What does $\int_a^b s(x) \,dx$ evaluate to after swapping limits of integration? +Back: As $-\int_b^a s(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 +Let $s$ be a step function over $[a, b]$. What does $\int_a^a s(x) \,dx$ evaluate to? +Back: $0$. +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 $s$ be a step function over $[a, b]$. What name is given to $a$ in $\int_a^b s(x) \,dx$? +Back: The lower limit of integration. +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 $s$ be a step function over $[a, b]$. What name is given to $b$ in $\int_a^b s(x) \,dx$? +Back: The upper limit of integration. +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 $s$ be a step function over $[a, b]$. What name is given to $a$ and $b$ in $\int_a^b s(x) \,dx$? +Back: The limits of integration. +Reference: Tom M. Apostol, _Calculus, Vol. 1: One-Variable Calculus, with an Introduction to Linear Algebra_, 2nd ed. (New York: Wiley, 1980). + +END%% + +### Additivity + +Let $s$ and $t$ be step functions defined on $[a, b]$. Then $$\int_a^b s(x) + t(x) \,dx = \int_a^b s(x) \,dx + \int_a^b t(x) \,dx$$ + +%%ANKI +Basic +Let $s$ and $t$ be step functions over $[a, b]$. What does the additive property state? +Back: $\int_a^b s(x) + t(x) \,dx = \int_a^b s(x) \,dx + \int_a^b t(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 +Let $s$ and $t$ be step functions over $[a, b]$. What is the following identity called? $$\int_a^b s(x) + t(x) \,dx = \int_a^b s(x) \,dx + \int_a^b t(x) \,dx$$ + +Back: The additive property. +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 $s$ and $t$ be step functions over $[a, b]$. How is the following more compactly written? $$\int_a^b s(x) \,dx + \int_a^b t(x) \,dx$$ +Back: $\int_a^b s(x) + t(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%% + +### Homogeneousness + +Let $s$ be a step function defined on $[a, b]$. Let $c \in \mathbb{R}$. Then $$\int_a^b c \cdot s(x) \,dx = c\int_a^b s(x) \,dx$$ + +%%ANKI +Basic +Let $s$ be a step function over $[a, b]$. What does the homogeneous property state? +Back: For all $c \in \mathbb{R}$, $\int_a^b c \cdot s(x) \,dx = c \int_a^b s(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 +Let $s$ be a step function defined over $[a, b]$ and $c \in \mathbb{R}$. What is the following identity called? $$\int_a^b c \cdot s(x) \,dx = c\int_a^b s(x) \,dx$$ + +Back: The homogeneous property. +Reference: Tom M. Apostol, _Calculus, Vol. 1: One-Variable Calculus, with an Introduction to Linear Algebra_, 2nd ed. (New York: Wiley, 1980). + +END%% + +### Linearity + +Let $s$ and $t$ be step functions defined on $[a, b]$. Let $c_1, c_2 \in \mathbb{R}$. Then $$\int_a^b [c_1s(x) + c_2t(x)] \,dx = c_1 \int_a^b s(x) \,dx + c_2 \int_a^b t(x) \,dx$$ + +%%ANKI +Basic +Let $s$ and $t$ be step functions over $[a, b]$ and $c_1, c_2 \in \mathbb{R}$. What does the linearity property state? +Back: $\int_a^b [c_1 s(x) + c_2 t(x)] \,dx = c_1 \int_a^b s(x) \,dx + c_2 \int_a^b t(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 +Let $s$ and $t$ be step functions over $[a, b]$ and $c_1, c_2 \in \mathbb{R}$. What is the following identity called? $$\int_a^b [c_1s(x) + c_2t(x)] \,dx = c_1 \int_a^b s(x) \,dx + c_2 \int_a^b t(x) \,dx$$ +Back: The linearity property. +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 +The linearity property is immediately derived from what other two properties? +Back: The additive and homogeneous properties. +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 {linearity} property is a combination of the {additive} and {homogenous} properties. +Reference: Tom M. Apostol, _Calculus, Vol. 1: One-Variable Calculus, with an Introduction to Linear Algebra_, 2nd ed. (New York: Wiley, 1980). + +END%% + +### Comparison Theorem + +Let $s$ and $t$ be step functions defined on $[a, b]$. Suppose $s(x) < t(x)$ for all $x \in [a, b]$. Then $$\int_a^b s(x) \,dx < \int_a^b t(x) \,dx$$ + +%%ANKI +Basic +Let $s$ and $t$ be step functions over $[a, b]$. What does the comparison theorem state? +Back: If $s(x) < t(x)$ for all $x \in [a, b]$, $\int_a^b s(x) \,dx < \int_a^b t(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 +Let $s$ and $t$ be step functions over $[a, b]$ such that $s(x) < t(x)$ for all $x \in [a, b]$. What is the following called? $$\int_a^b s(x) \,dx < \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%% + +%%ANKI +Basic +The comparison theorem of step function integrals corresponds to what property of area? +Back: The monotone property of area. +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 +The monotone property of area corresponds to what theorem of step function integrals? +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%% + ## Bibliography * Tom M. Apostol, _Calculus, Vol. 1: One-Variable Calculus, with an Introduction to Linear Algebra_, 2nd ed. (New York: Wiley, 1980). \ No newline at end of file diff --git a/notes/calculus/intervals.md b/notes/calculus/intervals.md index 25313e8..9ec0f78 100644 --- a/notes/calculus/intervals.md +++ b/notes/calculus/intervals.md @@ -1,7 +1,7 @@ --- title: Intervals TARGET DECK: Obsidian::STEM -FILE TAGS: calculus::intervals +FILE TAGS: calculus::interval tags: - calculus --- diff --git a/notes/computability/automaton.md b/notes/computability/automaton.md new file mode 100644 index 0000000..b8b57c4 --- /dev/null +++ b/notes/computability/automaton.md @@ -0,0 +1,501 @@ +--- +title: Automaton +TARGET DECK: Obsidian::STEM +FILE TAGS: computability::automaton +tags: + - automaton + - computability +--- + +## Finite Automata + +A **finite automaton** 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 \colon Q \times \Sigma \rightarrow 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**. + +These automaton are typically denoted using a **state diagram** like below. The start state is indicated by an arrow pointing at it from nowhere. An accept state is denoted with a double circle. + +![[state-diagram.png]] + +A [[language]] is called a **regular language** if a finite automaton recognizes it. + +%%ANKI +Basic +A finite automaton comprises 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 +Consider finite automaton $M = \langle Q, \Sigma, \delta, q_0, F \rangle$. 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 +Consider finite automaton $M = \langle Q, \Sigma, \delta, q_0, F \rangle$. 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 +Consider finite automaton $M = \langle Q, \Sigma, \delta, q_0, F \rangle$. 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 +Consider finite automaton $M = \langle Q, \Sigma, \delta, q_0, F \rangle$. 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 +Consider finite automaton $M = \langle Q, \Sigma, \delta, q_0, F \rangle$. 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 +Consider finite automaton $M = \langle Q, \Sigma, \delta, q_0, F \rangle$. What is $\delta$'s domain? +Back: $Q \times \Sigma$ +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 +Consider finite automaton $M = \langle Q, \Sigma, \delta, q_0, F \rangle$. What is $\delta$'s codomain? +Back: $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 +Consider finite automaton $M = \langle Q, \Sigma, \delta, q_0, F \rangle$. 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 +Consider finite automaton $M = \langle Q, \Sigma, \delta, q_0, F \rangle$. 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 +Consider finite automaton $M = \langle Q, \Sigma, \delta, q_0, F \rangle$. 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 +Consider finite automaton $M = \langle Q, \Sigma, \delta, q_0, F \rangle$. 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 +Consider finite automaton $M = \langle Q, \Sigma, \delta, q_0, F \rangle$. 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 +Consider finite automaton $M = \langle Q, \Sigma, \delta, q_0, F \rangle$. How does $q_0$ relate to $Q$? +Back: $q_0 \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 +Consider finite automaton $M = \langle Q, \Sigma, \delta, q_0, F \rangle$. 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 +Consider finite automaton $M$. 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 +Consider finite automaton $M$. 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 +Consider finite automaton $M$. 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 +Consider finite automaton $M$. 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 +Consider finite automaton $M$. 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 +Consider finite automaton $M$. 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 +Consider diagram of finite automaton $M = \langle Q, \Sigma, \delta, q_0, F \rangle$. What does $Q$ evaluate to? +![[state-diagram.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 +Basic +Consider diagram of finite automaton $M = \langle Q, \Sigma, \delta, q_0, F \rangle$. What does $\Sigma$ evaluate to? +![[state-diagram.png]] +Back: $\Sigma = \{0, 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 +Consider diagram of finite automaton $M = \langle Q, \Sigma, \delta, q_0, F \rangle$. What does $q_0$ evaluate to? +![[state-diagram.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 +Consider diagram of finite automaton $M = \langle Q, \Sigma, \delta, q_0, F \rangle$. What does $\mathop{\text{dom}}\delta$ evaluate to? +![[state-diagram.png]] +Back: $\{q_1, q_2, q_3\} \times \{0, 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 +Consider diagram of finite automaton $M = \langle Q, \Sigma, \delta, q_0, F \rangle$. What does $\mathop{\text{ran}}\delta$ evaluate to? +![[state-diagram.png]] +Back: $\{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 +Consider diagram of finite automaton $M = \langle Q, \Sigma, \delta, q_0, F \rangle$. What does $F$ evaluate to? +![[state-diagram.png]] +Back: $F = \{q_2\}$ +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 a finite automaton'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 +{1:Edges} are to {2:diagraphs} 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 finite automaton 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%% + +If $s$ is processed by machine $M$ such that $M$ finishes in an accept state, we say $M$ **accepts** $s$. Otherwise $M$ **rejects** $s$. If $A$ is the set of all strings that $M$ accepts, we say that $A$ is the **language of machine $M$**, denoted $L(M) = A$. We say that $M$ **recognizes** $A$. + +%%ANKI +Basic +What does it mean for finite automaton $M$ to accept string $s$? +Back: $M$ finishes processing $s$ on an accept 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 +What does it mean for finite automaton $M$ to reject string $s$? +Back: $M$ finishes processing $s$ on a non-accept 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$ be a finite automaton. What is the language of $M$? +Back: The set of strings $M$ accepts. +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 +Finite automaton $M$ {1:accepts} {2:strings} and {2:recognizes} {1:languages}. +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 +How is the language of finite automaton $M$ denoted? +Back: As $L(M)$. +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 finite automaton. What is $L(M)$ called? +Back: The language of $M$. +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 finite automaton. What kind of mathematical entity is $L(M)$? +Back: A set (of strings). +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 +How many strings can a finite automaton potentially accept? +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 +How many languages can a finite automaton potentially recognize? +Back: Exactly 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 +Suppoe finite automaton $M$ does not accept any strings. What language does it recognize? +Back: $\varnothing$ +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 +Consider finite automaton $M = \langle Q, \Sigma, \delta, q_0, F \rangle$ below. What does $Q$ evaluate to? +![[state-diagram-ends1.png]] +Back: $Q = \{q_1, q_2\}$ +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 +Consider finite automaton $M = \langle Q, \Sigma, \delta, q_0, F \rangle$ below. What does $\Sigma$ evaluate to? +![[state-diagram-ends1.png]] +Back: $\Sigma = \{0, 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 +Consider finite automaton $M = \langle Q, \Sigma, \delta, q_0, F \rangle$ below. What does $F$ evaluate to? +![[state-diagram-ends1.png]] +Back: $F = \{q_2\}$ +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 +Consider finite automaton $M = \langle Q, \Sigma, \delta, q_0, F \rangle$ below. What does $q_0$ evaluate to? +![[state-diagram-ends1.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 +Consider finite automaton $M = \langle Q, \Sigma, \delta, q_0, F \rangle$ below. What does $\mathop{\text{dom}}\delta$ evaluate to? +![[state-diagram-ends1.png]] +Back: $\{q_1, q_2\} \times \{0, 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 +Consider finite automaton $M = \langle Q, \Sigma, \delta, q_0, F \rangle$ below. What does $\mathop{\text{ran}}\delta$ evaluate to? +![[state-diagram-ends1.png]] +Back: $\{q_1, q_2\}$ +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 +Consider finite automaton $M = \langle Q, \Sigma, \delta, q_0, F \rangle$ below. What does $L(M)$ evaluate to? +![[state-diagram-ends1.png]] +Back: $\{w \mid w \text{ ends with a } 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 +Consider finite automaton $M = \langle Q, \Sigma, \delta, q_0, F \rangle$ below. What does $Q$ evaluate to? +![[state-diagram-ends0.png]] +Back: $Q = \{q_1, q_2\}$ +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 +Consider finite automaton $M = \langle Q, \Sigma, \delta, q_0, F \rangle$ below. What does $\Sigma$ evaluate to? +![[state-diagram-ends0.png]] +Back: $\Sigma = \{0, 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 +Consider finite automaton $M = \langle Q, \Sigma, \delta, q_0, F \rangle$ below. What does $F$ evaluate to? +![[state-diagram-ends0.png]] +Back: $F = \{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 +Consider finite automaton $M = \langle Q, \Sigma, \delta, q_0, F \rangle$ below. What does $q_0$ evaluate to? +![[state-diagram-ends0.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 +Consider finite automaton $M = \langle Q, \Sigma, \delta, q_0, F \rangle$ below. What does $\mathop{\text{dom}}\delta$ evaluate to? +![[state-diagram-ends0.png]] +Back: $\{q_1, q_2\} \times \{0, 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 +Consider finite automaton $M = \langle Q, \Sigma, \delta, q_0, F \rangle$ below. What does $\mathop{\text{ran}}\delta$ evaluate to? +![[state-diagram-ends0.png]] +Back: $\{q_1, q_2\}$ +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 +Consider finite automaton $M = \langle Q, \Sigma, \delta, q_0, F \rangle$ below. What does $L(M)$ evaluate to? +![[state-diagram-ends0.png]] +Back: $\{w \mid w = \epsilon \lor w \text{ ends with a } 0 \}$ +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 a regular language? +Back: A language recognized by some finite automaton. +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 +A {regular} language is a language {recognized by some finite automaton}. +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%% + +## Bibliography + +* 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). \ No newline at end of file diff --git a/notes/computability/images/state-diagram-ends0.png b/notes/computability/images/state-diagram-ends0.png new file mode 100644 index 0000000..e477111 Binary files /dev/null and b/notes/computability/images/state-diagram-ends0.png differ diff --git a/notes/computability/images/state-diagram-ends1.png b/notes/computability/images/state-diagram-ends1.png new file mode 100644 index 0000000..af283fe Binary files /dev/null and b/notes/computability/images/state-diagram-ends1.png differ diff --git a/notes/computability/images/state-diagram.png b/notes/computability/images/state-diagram.png new file mode 100644 index 0000000..6c95b8a Binary files /dev/null and b/notes/computability/images/state-diagram.png differ diff --git a/notes/computability/index.md b/notes/computability/index.md new file mode 100644 index 0000000..59fa92c --- /dev/null +++ b/notes/computability/index.md @@ -0,0 +1,3 @@ +--- +title: Computability +--- diff --git a/notes/computability/language.md b/notes/computability/language.md new file mode 100644 index 0000000..2aea663 --- /dev/null +++ b/notes/computability/language.md @@ -0,0 +1,290 @@ +--- +title: Language +TARGET DECK: Obsidian::STEM +FILE TAGS: language +tags: + - language +--- + +## Overview + +An **alphabet** is any nonempty finite set. The members of an alphabet are called **symbols** of the alphabet. A **string over an alphabet** is a finite sequence of symbols from that alphabet, usually written next to one another without separation. + +Then **length** of a string $w$ over an alphabet, denoted $\lvert w \rvert$, is the number of symbols $w$ contains. The **empty string**, denoted $\epsilon$, is the string of length $0$. The **reverse** of $w$ is the string obtained by writing $w$ in the opposite order. + +String $z$ is a **substring** of $w$ if $z$ appears consecutively within $w$. The **concatenation** of strings $x$ and $y$, written $xy$, is the string obtained by appending $y$ to the end of $x$. We say string $x$ is a **prefix** of string $y$ if a string $z$ exists where $xz = y$. We say $x$ is a **proper prefix** of $y$ if $x \neq y$. + +A **language** is a set of strings. A language is **prefix-free** if no member is a proper prefix of another member. + +%%ANKI +Basic +What is an alphabet? +Back: A nonempty 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 +An alphabet is a set satisfying what two properties? +Back: It is nonempty and finite. +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 a symbol of an alphabet? +Back: A member of the 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 +What name is given to members of an alphabet? +Back: Symbols. +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 +A {symbol} is a {member} of 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 +What is a string over an alphabet? +Back: A finite sequence of symbols from that 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 +What kind of mathematical entity is a string over an alphabet? +Back: A finite sequence. +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 +$01001$ is a string over what minimal alphabet? +Back: $\{0, 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 +$hello$ is a string over what minimal alphabet? +Back: $\{e, h, l, o\}$ +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 +How is the length of string $s$ over alphabet $\Sigma$ denoted? +Back: As $\lvert s \rvert$. +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 +How is the length of a string over an alphabet defined? +Back: As the number of symbols in the string. +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 $w$ be a string over some alphabet. How is the length of $w$ denoted? +Back: $\lvert w \rvert$ +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 the empty string over an alphabet? +Back: The string of length $0$. +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 +How is the empty string over an alphabet typically denoted? +Back: $\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 +What is the reverse of string $w$ over some alphabet? +Back: The string obtained by writing $w$ in opposite order. +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 +How is the reverse of string $w$ over some alphabet typically denoted? +Back: $w^R$ +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 +How does the length of a string relate to the length of its reverse? +Back: They are equal. +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 +How does the length of a string relate to the length of a substring? +Back: The latter is less than or equal to the former. +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 a substring of string $w$ over some alphabet? +Back: A string that appears consecutively within $w$. +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 $x$ and $y$ be strings over some alphabet. How is their concatenation denoted? +Back: $xy$ +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 $x$ and $y$ be strings over some alphabet. What is the length of $\lvert x y \rvert$? +Back: $\lvert x \rvert + \lvert y \rvert$ +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 +How is the concatenation of strings $x$ and $y$ over some alphabet denoted? +Back: $xy$ +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 $x$ be a string over some alphabet. What does $xx$ denote? +Back: The concatenation of $x$ with itself. +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 +Let $x$ be a string over some alphabet. Then {$xx$} $=$ {$x^2$}. +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 $x$ be a string over some alphabet. What does $x^k$ denote? +Back: The concatenation of $x$ with itself $k$ times. +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 does it mean for string $x$ to be a prefix of string $y$ over some alphabet? +Back: There exists some string $z$ such that $xz = y$. +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 does it mean for string $x$ to be a proper prefix of string $y$ over some alphabet? +Back: There exists some string $z$ such that $xz = y$ and $x \neq y$. +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 does it mean for string $x$ to be a suffix of string $y$ over some alphabet? +Back: There exists some string $z$ such that $zx = y$. +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 does it mean for string $x$ to be a proper suffix of string $y$ over some alphabet? +Back: There exists some string $z$ such that $zx = y$ and $x \neq y$. +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 a language? +Back: A nonempty set of strings. +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 +A language is a set satisfying what? +Back: It contains strings over some 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 +Cloze +{1:Symbols} are to {2:alphabets} whereas {2:strings} are to {1:languages}. +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 does it mean for a language to be prefix-free? +Back: No member is a *proper* prefix of another member. +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 does it mean for a language to be suffix-free? +Back: No member is a *proper* suffix of another member. +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%% + +## Bibliography + +* 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). \ No newline at end of file diff --git a/notes/posix/regexp.md b/notes/computability/regexp.md similarity index 99% rename from notes/posix/regexp.md rename to notes/computability/regexp.md index 6a747dc..1ced083 100644 --- a/notes/posix/regexp.md +++ b/notes/computability/regexp.md @@ -8,6 +8,10 @@ tags: ## Overview +TODO + +## Extensions + The following ERE (**E**xtended **R**egular **E**xpression) operators were defined to achieve consistency between programs like `grep`, `sed`, and `awk`. In POSIX, regexps are greedy. %%ANKI @@ -253,7 +257,7 @@ Reference: Robbins, Arnold D. “GAWK: Effective AWK Programming,” October 202 END%% -## Character Classes +### Character Classes Notation for describing a class of characters specific to a given locale/character set. diff --git a/notes/data-models/index.md b/notes/data-models/index.md new file mode 100644 index 0000000..f2be47f --- /dev/null +++ b/notes/data-models/index.md @@ -0,0 +1,3 @@ +--- +title: Data Models +--- diff --git a/notes/ontology/rdf.md b/notes/data-models/rdf.md similarity index 98% rename from notes/ontology/rdf.md rename to notes/data-models/rdf.md index 368bacc..978442e 100644 --- a/notes/ontology/rdf.md +++ b/notes/data-models/rdf.md @@ -1,8 +1,9 @@ --- title: RDF TARGET DECK: Obsidian::STEM -FILE TAGS: ontology::rdf +FILE TAGS: data_model::rdf tags: + - data_model - rdf --- @@ -173,7 +174,7 @@ END%% Cloze RDF is a {data model} whereas XML is a {serialization}. Reference: Allemang, Dean, James A. Hendler, and Fabien L. Gandon. _Semantic Web for the Working Ontologist_. 3e ed. ACM Books 33. New York: Association for computing machinery, 2020. -Tags: xml +Tags: serialization::xml END%% @@ -182,7 +183,7 @@ Basic How might RDF and XML relate to one another? Back: XML can be used to serialize RDF. Reference: Allemang, Dean, James A. Hendler, and Fabien L. Gandon. _Semantic Web for the Working Ontologist_. 3e ed. ACM Books 33. New York: Association for computing machinery, 2020. -Tags: xml +Tags: serialization::xml END%% diff --git a/notes/encoding/uri.md b/notes/encoding/uri.md index d80f0b3..42d834c 100644 --- a/notes/encoding/uri.md +++ b/notes/encoding/uri.md @@ -1,8 +1,9 @@ --- title: Uniform Resource Identifiers TARGET DECK: Obsidian::STEM -FILE TAGS: uri +FILE TAGS: encoding::uri tags: + - encoding - uri --- diff --git a/notes/posix/bash.md b/notes/posix/bash.md new file mode 100644 index 0000000..2a1a292 --- /dev/null +++ b/notes/posix/bash.md @@ -0,0 +1,204 @@ +--- +title: Bash +TARGET DECK: Obsidian::STEM +FILE TAGS: bash +tags: + - bash +--- + +## Overview + +Bash, the Bourne-Again Shell, is a shell program and command language. + +%%ANKI +Basic +How do you escape a `'` within a single-quote string? +Back: This is impossible. +Reference: Robbins, Arnold D. “GAWK: Effective AWK Programming,” October 2023. [https://www.gnu.org/software/gawk/manual/gawk.pdf](https://www.gnu.org/software/gawk/manual/gawk.pdf) + +END%% + +%%ANKI +Basic +What does the null string refer to? +Back: The empty string, i.e. `""`. +Reference: Robbins, Arnold D. “GAWK: Effective AWK Programming,” October 2023. [https://www.gnu.org/software/gawk/manual/gawk.pdf](https://www.gnu.org/software/gawk/manual/gawk.pdf) + +END%% + +%%ANKI +Basic +When does Bash remove null strings from a command? +Back: When they occur as part of a non-null command-line argument. +Reference: Robbins, Arnold D. “GAWK: Effective AWK Programming,” October 2023. [https://www.gnu.org/software/gawk/manual/gawk.pdf](https://www.gnu.org/software/gawk/manual/gawk.pdf) + +END%% + +%%ANKI +Basic +Why does the following not work correctly? +```bash +$ # -F specifies the field separator +$ awk -F"" 'program' files +``` +Back: Bash removes the null string before executing the command. +Reference: Robbins, Arnold D. “GAWK: Effective AWK Programming,” October 2023. [https://www.gnu.org/software/gawk/manual/gawk.pdf](https://www.gnu.org/software/gawk/manual/gawk.pdf) + +END%% + +## Prompts + +According to Robbins a POSIX-compliant shell (like Bash) generally has the primary and secondary prompts denoted with `$` and `>` respectively. Adjust these values using environment variables `$PS1` and `PS2` respectively. + +%%ANKI +Basic +What symbol is usually used to denote the primary prompt? +Back: `$$` +Reference: Robbins, Arnold D. “GAWK: Effective AWK Programming,” October 2023. [https://www.gnu.org/software/gawk/manual/gawk.pdf](https://www.gnu.org/software/gawk/manual/gawk.pdf) + +END%% + +%%ANKI +Basic +What environment variable controls Bash's primary prompt? +Back: `$$PS1` +Reference: Cooper, Mendel. “Advanced Bash-Scripting Guide,” n.d., 916. + +END%% + +%%ANKI +Basic +What symbol is usually used to denote the secondary prompt? +Back: `>` +Reference: Robbins, Arnold D. “GAWK: Effective AWK Programming,” October 2023. [https://www.gnu.org/software/gawk/manual/gawk.pdf](https://www.gnu.org/software/gawk/manual/gawk.pdf) + +END%% + +%%ANKI +Basic +What environment variable controls Bash's secondary prompt? +Back: `$$PS2` +Reference: Cooper, Mendel. “Advanced Bash-Scripting Guide,” n.d., 916. + +END%% + +Paths supplied to commands are typically "sanitized" by prefixing the path name with `./`. This is mentioned in a few different places: + +* `find -execdir` performs this prefixing automatically on all found files. +* `awk` ambiguously interprets a file named e.g. `count=1` as variable assignment. Should write `$ awk -f program.awk ./count=1`. + +%%ANKI +Basic +What methodology is commonly used to "sanitize" paths supplied as command-line arguments? +Back: Prefixing the paths with `./`. +Reference: Cooper, Mendel. “Advanced Bash-Scripting Guide,” n.d., 916. + +END%% + +## Shebang + +The shebang (also writting shabang or sha-bang) is a magic character at the start of a script indicating what command should be run when invoking the script directly. It always begins with ASCII characters `#!`. + +%%ANKI +Basic +What ASCII characters do shebangs start with? +Back: `#!` +Reference: Cooper, Mendel. “Advanced Bash-Scripting Guide,” n.d., 916. + +END%% + +%%ANKI +Basic +What class of programs can be specified in a shebang? +Back: Interpreters +Reference: Robbins, Arnold D. “GAWK: Effective AWK Programming,” October 2023. [https://www.gnu.org/software/gawk/manual/gawk.pdf](https://www.gnu.org/software/gawk/manual/gawk.pdf) + +END%% + +%%ANKI +Basic +The OS will parse a shebang into what three parts? +Back: `#!`, the interpreter, and the rest of the line as a single argument. +Reference: Robbins, Arnold D. “GAWK: Effective AWK Programming,” October 2023. [https://www.gnu.org/software/gawk/manual/gawk.pdf](https://www.gnu.org/software/gawk/manual/gawk.pdf) + +END%% + +%%ANKI +Basic +What gotcha does Robbins highlight with shebang parsing? +Back: The remainder of the line following the interpreter is passed as a *single* argument. +Reference: Robbins, Arnold D. “GAWK: Effective AWK Programming,” October 2023. [https://www.gnu.org/software/gawk/manual/gawk.pdf](https://www.gnu.org/software/gawk/manual/gawk.pdf) + +END%% + +Some systems limit the length of interpreters to just 32 characters. A simple workaround when encountering this limitation is to introduce a symbolic link. + +%%ANKI +Basic +What workaround is used when shebang interpreter names are too long? +Back: Introduce a symbolic link. +Reference: Robbins, Arnold D. “GAWK: Effective AWK Programming,” October 2023. [https://www.gnu.org/software/gawk/manual/gawk.pdf](https://www.gnu.org/software/gawk/manual/gawk.pdf) + +END%% + +## Robustness + +An interesting point Robbins discusses in his introduction to [[posix/awk/index|gawk]] is this idea of command robustness. He states that: + +> A self-contained shell script is more reliable because there are no other files to misplace. + +%%ANKI +Basic +What is a self-contained shell script? +Back: A shell script that does not rely on the presence of other files. +Reference: Robbins, Arnold D. “GAWK: Effective AWK Programming,” October 2023. [https://www.gnu.org/software/gawk/manual/gawk.pdf](https://www.gnu.org/software/gawk/manual/gawk.pdf) + +END%% + +%%ANKI +Basic +What makes a self-contained shell script more reliable? +Back: There are no other files to misplace. +Reference: Robbins, Arnold D. “GAWK: Effective AWK Programming,” October 2023. [https://www.gnu.org/software/gawk/manual/gawk.pdf](https://www.gnu.org/software/gawk/manual/gawk.pdf) + +END%% + +He argues that the first command below is more robust than the second since the command is more loosely coupled to its environment: + +```bash +$ awk 'program' input-file1 input-file2 ... +$ awk -f program-file input-file1 input-file2 ... +``` + +It's interesting to think what else can be used as a measure of a command's robustness: + +* Required environment variables or environment variables formatted in a certain way + * `$PATH` needs to point to a specific location +* Whether the invoked program is present by default in a distribution or must be installed +* The ability to run with or without an associated TTY +* The ability to run with or without associated standard streams + * `stdout`, `stderr`, `stdin` +* How backwards compatible the invoked program is + * Version mismatch may silently cause the same invocation to fail +* Expected permissions + * EUID, read permissions on an input file, etc. +* Determinism of the program itself + * Does output rely entirely on input or can it make nondeterministic choices +* The amount of resources dedicated to the program + * Failure may occur if not enough memory is provided to the command +* Whether a program acts idempotently + * What happens if I run the command twice in a row? +* Whether a program acts atomically + * Is it possible intermediate files are left that affect subsequent runs? +* The presence of timeouts + * Perhaps a program waits a specified amount of time before input is available. The command's success is now externally determined. +* Locale-aware functionality + * Consider for instance [[posix/awk/index|gawk]]'s `\u` [[escape-sequences|sequence]] which targets characters in the current locale's character set as opposed to specifically Unicode. + * POSIX standard [[regexp#Character Classes|character classes]] serve as another example. + +The above scenarios are what makes something like nix so compelling. + +## Bibliography + +* Cooper, Mendel. “Advanced Bash-Scripting Guide,” n.d., 916. +* Robbins, Arnold D. “GAWK: Effective AWK Programming,” October 2023. [https://www.gnu.org/software/gawk/manual/gawk.pdf](https://www.gnu.org/software/gawk/manual/gawk.pdf) \ No newline at end of file diff --git a/notes/serialization/index.md b/notes/serialization/index.md new file mode 100644 index 0000000..08b57b1 --- /dev/null +++ b/notes/serialization/index.md @@ -0,0 +1,3 @@ +--- +title: Serialization +--- diff --git a/notes/encoding/xml.md b/notes/serialization/xml.md similarity index 98% rename from notes/encoding/xml.md rename to notes/serialization/xml.md index 4e878d1..94a6fc3 100644 --- a/notes/encoding/xml.md +++ b/notes/serialization/xml.md @@ -1,8 +1,9 @@ --- title: XML TARGET DECK: Obsidian::STEM -FILE TAGS: xml +FILE TAGS: serialization::xml tags: + - serialization - xml ---