Alternative commands, BSTs, RDF.

c-declarations
Joshua Potter 2024-07-30 06:25:23 -06:00
parent d0da1e0453
commit 4dc9e0fab1
14 changed files with 460 additions and 32 deletions

View File

@ -145,7 +145,8 @@
"church-rosser.png", "church-rosser.png",
"infinite-cartesian-product.png", "infinite-cartesian-product.png",
"function-kernel.png", "function-kernel.png",
"triple-table-repr.png" "triple-table-repr.png",
"binary-search-tree.png"
], ],
"File Hashes": { "File Hashes": {
"algorithms/index.md": "3ac071354e55242919cc574eb43de6f8", "algorithms/index.md": "3ac071354e55242919cc574eb43de6f8",
@ -189,7 +190,7 @@
"algorithms/loop-invariants.md": "cbefc346842c21a6cce5c5edce451eb2", "algorithms/loop-invariants.md": "cbefc346842c21a6cce5c5edce451eb2",
"algorithms/loop-invariant.md": "3b390e720f3b2a98e611b49a0bb1f5a9", "algorithms/loop-invariant.md": "3b390e720f3b2a98e611b49a0bb1f5a9",
"algorithms/running-time.md": "5efc0791097d2c996f931c9046c95f65", "algorithms/running-time.md": "5efc0791097d2c996f931c9046c95f65",
"algorithms/order-growth.md": "1c3f7ff710b6e67a04e16cdfd0f63e8c", "algorithms/order-growth.md": "764610efa15de0be6d4092127b61440c",
"_journal/2024-02-08.md": "19092bdfe378f31e2774f20d6afbfbac", "_journal/2024-02-08.md": "19092bdfe378f31e2774f20d6afbfbac",
"algorithms/sorting/selection-sort.md": "73415c44d6f4429f43c366078fd4bf98", "algorithms/sorting/selection-sort.md": "73415c44d6f4429f43c366078fd4bf98",
"algorithms/index 1.md": "6fada1f3d5d3af64687719eb465a5b97", "algorithms/index 1.md": "6fada1f3d5d3af64687719eb465a5b97",
@ -418,7 +419,7 @@
"_journal/2024-04-30.md": "369f98b9d91de89cc1f4f581bc530c0d", "_journal/2024-04-30.md": "369f98b9d91de89cc1f4f581bc530c0d",
"_journal/2024-04/2024-04-29.md": "b4fa2fd62e1b4fe34c1f71dc1e9f5b0b", "_journal/2024-04/2024-04-29.md": "b4fa2fd62e1b4fe34c1f71dc1e9f5b0b",
"proofs/induction.md": "36ab5a92ae3cf9bb2def333dc41d79ff", "proofs/induction.md": "36ab5a92ae3cf9bb2def333dc41d79ff",
"proofs/index.md": "18808a0527a25af788aabb821686bcee", "proofs/index.md": "6251417184116a217e6eef39abc12077",
"_journal/2024-05-01.md": "959ff67fe3db585ba6a7b121d853bbac", "_journal/2024-05-01.md": "959ff67fe3db585ba6a7b121d853bbac",
"_journal/2024-05-02.md": "d7d6ba7e065d807986f0bd77281c0bb1", "_journal/2024-05-02.md": "d7d6ba7e065d807986f0bd77281c0bb1",
"data-structures/priority-queues.md": "8c5c6bf62b1a39d8f1f72b800fcb17ff", "data-structures/priority-queues.md": "8c5c6bf62b1a39d8f1f72b800fcb17ff",
@ -448,7 +449,7 @@
"_journal/2024-05-13.md": "71eb7924653eed5b6abd84d3a13b532b", "_journal/2024-05-13.md": "71eb7924653eed5b6abd84d3a13b532b",
"_journal/2024-05/2024-05-12.md": "ca9f3996272152ef89924bb328efd365", "_journal/2024-05/2024-05-12.md": "ca9f3996272152ef89924bb328efd365",
"git/remotes.md": "cbe2cd867f675f156e7fe71ec615890d", "git/remotes.md": "cbe2cd867f675f156e7fe71ec615890d",
"programming/pred-trans.md": "77fa537ef0b96ab1b90ebf2309bc345d", "programming/pred-trans.md": "a1e486d3665a7fab7be77120cd572b1c",
"set/axioms.md": "063955bf19c703e9ad23be2aee4f1ab7", "set/axioms.md": "063955bf19c703e9ad23be2aee4f1ab7",
"_journal/2024-05-14.md": "f6ece1d6c178d57875786f87345343c5", "_journal/2024-05-14.md": "f6ece1d6c178d57875786f87345343c5",
"_journal/2024-05/2024-05-13.md": "71eb7924653eed5b6abd84d3a13b532b", "_journal/2024-05/2024-05-13.md": "71eb7924653eed5b6abd84d3a13b532b",
@ -511,12 +512,12 @@
"_journal/2024-06/2024-06-04.md": "52b28035b9c91c9b14cef1154c1a0fa1", "_journal/2024-06/2024-06-04.md": "52b28035b9c91c9b14cef1154c1a0fa1",
"_journal/2024-06-06.md": "3f9109925dea304e7172df39922cc95a", "_journal/2024-06-06.md": "3f9109925dea304e7172df39922cc95a",
"_journal/2024-06/2024-06-05.md": "b06a0fa567bd81e3b593f7e1838f9de1", "_journal/2024-06/2024-06-05.md": "b06a0fa567bd81e3b593f7e1838f9de1",
"set/relations.md": "6063a3a4be5b5983d17600b18220897a", "set/relations.md": "ac51368a5cd0a4cc02c3f608af78cf53",
"_journal/2024-06-07.md": "795be41cc3c9c0f27361696d237604a2", "_journal/2024-06-07.md": "795be41cc3c9c0f27361696d237604a2",
"_journal/2024-06/2024-06-06.md": "db3407dcc86fa759b061246ec9fbd381", "_journal/2024-06/2024-06-06.md": "db3407dcc86fa759b061246ec9fbd381",
"_journal/2024-06-08.md": "b20d39dab30b4e12559a831ab8d2f9b8", "_journal/2024-06-08.md": "b20d39dab30b4e12559a831ab8d2f9b8",
"_journal/2024-06/2024-06-07.md": "c6bfc4c1e5913d23ea7828a23340e7d3", "_journal/2024-06/2024-06-07.md": "c6bfc4c1e5913d23ea7828a23340e7d3",
"lambda-calculus/alpha-conversion.md": "007828faf9b4ace5bd30b87a36a90dcf", "lambda-calculus/alpha-conversion.md": "4dc6cceec27ef88ab2b256c05fc5d91d",
"lambda-calculus/index.md": "76d58f85c135c7df00081f47df31168e", "lambda-calculus/index.md": "76d58f85c135c7df00081f47df31168e",
"x86-64/instructions/condition-codes.md": "1f59f0b81b2e15582b855d96d1d377da", "x86-64/instructions/condition-codes.md": "1f59f0b81b2e15582b855d96d1d377da",
"x86-64/instructions/logical.md": "818428b9ef84753920dc61e5c2de9199", "x86-64/instructions/logical.md": "818428b9ef84753920dc61e5c2de9199",
@ -628,14 +629,14 @@
"formal-system/proof-system/index.md": "800e93b72a9852ea4823ab0a40854bba", "formal-system/proof-system/index.md": "800e93b72a9852ea4823ab0a40854bba",
"formal-system/proof-system/equiv-trans.md": "abd8fe3ca5b61f0bdec0870f230734af", "formal-system/proof-system/equiv-trans.md": "abd8fe3ca5b61f0bdec0870f230734af",
"formal-system/logical-system/index.md": "708bb1547e7343c236068c18da3f5dc0", "formal-system/logical-system/index.md": "708bb1547e7343c236068c18da3f5dc0",
"formal-system/logical-system/pred-logic.md": "6db7f2a3734b6f3d48313410dc611bd5", "formal-system/logical-system/pred-logic.md": "34e872f4f920bf4e8c2cd00ee95b310f",
"formal-system/logical-system/prop-logic.md": "b61ce051795d5a951c763b928ec5cea8", "formal-system/logical-system/prop-logic.md": "b61ce051795d5a951c763b928ec5cea8",
"formal-system/index.md": "4c3d4de525e8e3254efd208341a300b1", "formal-system/index.md": "4c3d4de525e8e3254efd208341a300b1",
"programming/short-circuit.md": "c256ced42dc3b493aff5a356e5383b6e", "programming/short-circuit.md": "c256ced42dc3b493aff5a356e5383b6e",
"formal-system/abstract-rewriting.md": "8424314a627851c5b94be6163f64ba30", "formal-system/abstract-rewriting.md": "8424314a627851c5b94be6163f64ba30",
"_journal/2024-07-22.md": "d2ca7ce0bbeef76395fee33c9bf36e9d", "_journal/2024-07-22.md": "d2ca7ce0bbeef76395fee33c9bf36e9d",
"_journal/2024-07/2024-07-21.md": "62c2651999371dd9ab10d964dac3d0f8", "_journal/2024-07/2024-07-21.md": "62c2651999371dd9ab10d964dac3d0f8",
"formal-system/proof-system/natural-deduction.md": "4890ec679f68a2f86bb59f94a4114a22", "formal-system/proof-system/natural-deduction.md": "87b7b9a78ea7f038f1b4e4fd15039fe8",
"startups/term-sheet.md": "6b6152af78addb3fe818a7fc9d375fbf", "startups/term-sheet.md": "6b6152af78addb3fe818a7fc9d375fbf",
"startups/financing-rounds.md": "00a622fda2b4b442901bde2842309088", "startups/financing-rounds.md": "00a622fda2b4b442901bde2842309088",
"_journal/2024-07-23.md": "35e18a1d9a8dd0a97e1d9898bc1d8f01", "_journal/2024-07-23.md": "35e18a1d9a8dd0a97e1d9898bc1d8f01",
@ -651,11 +652,16 @@
"_journal/2024-07-28.md": "8a2393673132ac57a86b3b528bfc4a16", "_journal/2024-07-28.md": "8a2393673132ac57a86b3b528bfc4a16",
"_journal/2024-07/2024-07-27.md": "7c48690746d8320494e29e92390eb6ee", "_journal/2024-07/2024-07-27.md": "7c48690746d8320494e29e92390eb6ee",
"ontology/rdf/uri.md": "5d9f355f314a54c5fb5099d751070656", "ontology/rdf/uri.md": "5d9f355f314a54c5fb5099d751070656",
"ontology/rdf/index.md": "48e8347fa123b2c2ccc09f8b8c6ab142", "ontology/rdf/index.md": "df9ce690a970cfca741b828cf1255146",
"ontology/philosophy/permissivism.md": "643e815a79bc5c050cde9f996aa44ef5", "ontology/philosophy/permissivism.md": "643e815a79bc5c050cde9f996aa44ef5",
"ontology/philosophy/nominalism.md": "46245c644238157e15c7cb6def27d90a", "ontology/philosophy/nominalism.md": "46245c644238157e15c7cb6def27d90a",
"ontology/philosophy/index.md": "6c7c60f91f78fdc1cdd8c012b1ac4ebd", "ontology/philosophy/index.md": "6c7c60f91f78fdc1cdd8c012b1ac4ebd",
"ontology/philosophy/dialetheism.md": "56dd05b38519f90c5cab93637978b3b3" "ontology/philosophy/dialetheism.md": "56dd05b38519f90c5cab93637978b3b3",
"_journal/2024-07-29.md": "a480e577b06a94755b6ebf4ac9ee5732",
"_journal/2024-07/2024-07-28.md": "ff5dcfb3dc1b5592894363414e20b02f",
"_journal/2024-07-30.md": "025194b9b770b56a81b5a52d96a305f2",
"_journal/2024-07/2024-07-29.md": "ab496a55aacc60d9456378920c599871",
"data-structures/binary-search-tree.md": "c2076aa12f7afacc96fa504dd89dae5e"
}, },
"fields_dict": { "fields_dict": {
"Basic": [ "Basic": [

View File

@ -0,0 +1,13 @@
---
title: "2024-07-30"
---
- [x] Anki Flashcards
- [x] KoL
- [x] OGS
- [ ] Sheet Music (10 min.)
- [ ] Korean (Read 1 Story)
* Finished "Level 0: Encounter" of "Modern C".
* Initial notes on [[binary-search-tree|binary search trees]].
* Finish through 3.3 of "Semantic Web for the Working Ontologist".

View File

@ -0,0 +1,11 @@
---
title: "2024-07-29"
---
- [x] Anki Flashcards
- [x] KoL
- [x] OGS
- [ ] Sheet Music (10 min.)
- [ ] Korean (Read 1 Story)
* Notes on chapter 10 "The Alternative Command" of "The Science of Programming".

View File

@ -995,7 +995,7 @@ END%%
%%ANKI %%ANKI
Basic Basic
What theorem relates $\Theta(g(n))$, $O(g(n))$, and $\Omega(g(n))$? What theorem relates $\Theta(g(n))$, $O(g(n))$, and $\Omega(g(n))$?
Back: $f(n) = \Theta(g(n))$ if and only if $f(n) = O(g(n))$ and $f(n) = \Omega(g(n))$. Back: $f(n) = \Theta(g(n))$ iff $f(n) = O(g(n))$ and $f(n) = \Omega(g(n))$.
Reference: Thomas H. Cormen et al., Introduction to Algorithms, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022). Reference: Thomas H. Cormen et al., Introduction to Algorithms, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022).
<!--ID: 1709055157406--> <!--ID: 1709055157406-->
END%% END%%

View File

@ -0,0 +1,195 @@
---
title: Binary Search Tree
TARGET DECK: Obsidian::STEM
FILE TAGS: data_structure::bst
tags:
- bst
- data_structure
---
## Overview
A binary search tree (BST) is a [[trees#Binary Trees|binary tree]] satisfying the **binary-search-tree property**:
> Let $x$ be a node in a binary search tree. If $y$ is a node in the left subtree of $x$, then $y.key \leq x.key$. If $y$ is a node in the right subtree of $x$, then $y.key \geq x.key$.
Consider an arbitrary node $x$ of some BST. Then:
* An **inorder** traversal visits $x$'s left child, then $x$, then $x$'s right child.
* A **preorder** traversal visits $x$, then $x$'s left child, then $x$'s right child.
* A **postorder** traversal visits $x$'s left child, then $x$'s right child, then $x$.
%%ANKI
Basic
Which of binary trees and binary search trees are more general?
Back: Binary trees.
Reference: Thomas H. Cormen et al., Introduction to Algorithms, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022).
<!--ID: 1722338895668-->
END%%
%%ANKI
Basic
A binary search tree is a binary tree with what property?
Back: The binary-search-tree property.
Reference: Thomas H. Cormen et al., Introduction to Algorithms, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022).
<!--ID: 1722338895696-->
END%%
%%ANKI
Basic
What does the binary-search-tree property state?
Back: The value of a node is $\geq$ those of its left subtree and $\leq$ those of its right subtree.
Reference: Thomas H. Cormen et al., Introduction to Algorithms, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022).
<!--ID: 1722338895699-->
END%%
%%ANKI
Basic
Let $x$ be a binary search tree node and $y$ be in $x$'s left subtree. How do $x$ and $y$ compare?
Back: $y \leq x$
Reference: Thomas H. Cormen et al., Introduction to Algorithms, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022).
<!--ID: 1722338895702-->
END%%
%%ANKI
Basic
Let $x$ be a binary tree node and $y$ be in $x$'s right subtree. How do $x$ and $y$ compare?
Back: Indeterminate.
Reference: Thomas H. Cormen et al., Introduction to Algorithms, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022).
<!--ID: 1722338895705-->
END%%
%%ANKI
Basic
Let $x$ be a binary search tree node and $y$ be in $x$'s right subtree. How do $x$ and $y$ compare?
Back: $x \leq y$
Reference: Thomas H. Cormen et al., Introduction to Algorithms, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022).
<!--ID: 1722338923691-->
END%%
%%ANKI
Basic
Let $x$ be a binary tree node and $y$ be in $x$'s left subtree. How do $x$ and $y$ compare?
Back: Indeterminate.
Reference: Thomas H. Cormen et al., Introduction to Algorithms, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022).
<!--ID: 1722338937590-->
END%%
%%ANKI
Basic
In what order are nodes of a binary tree printed in an inorder traversal?
Back: Left child, root, right child.
Reference: Thomas H. Cormen et al., Introduction to Algorithms, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022).
<!--ID: 1722338895707-->
END%%
%%ANKI
Basic
In what order are nodes of a binary tree printed in a postorder traversal?
Back: Left child, right child, root.
Reference: Thomas H. Cormen et al., Introduction to Algorithms, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022).
<!--ID: 1722338895710-->
END%%
%%ANKI
Basic
In what order are nodes of a binary tree printed in a preorder traversal?
Back: Root, left child, right child.
Reference: Thomas H. Cormen et al., Introduction to Algorithms, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022).
<!--ID: 1722338895713-->
END%%
%%ANKI
Basic
Which binary tree node is printed first in an inorder traversal?
Back: The leftmost child.
Reference: Thomas H. Cormen et al., Introduction to Algorithms, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022).
<!--ID: 1722339185541-->
END%%
%%ANKI
Basic
Which binary tree node is printed last in an inorder traversal?
Back: The rightmost child.
Reference: Thomas H. Cormen et al., Introduction to Algorithms, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022).
<!--ID: 1722339185545-->
END%%
%%ANKI
Basic
Which binary tree node is printed first in a preorder traversal?
Back: The root.
Reference: Thomas H. Cormen et al., Introduction to Algorithms, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022).
<!--ID: 1722339185548-->
END%%
%%ANKI
Basic
Which binary tree node is printed last in a preorder traversal?
Back: The rightmost child.
Reference: Thomas H. Cormen et al., Introduction to Algorithms, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022).
<!--ID: 1722339320118-->
END%%
%%ANKI
Basic
Which binary tree node is printed first in a postorder traversal?
Back: The leftmost child.
Reference: Thomas H. Cormen et al., Introduction to Algorithms, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022).
<!--ID: 1722339185551-->
END%%
%%ANKI
Basic
Which binary tree node is printed last in a postorder traversal?
Back: The root.
Reference: Thomas H. Cormen et al., Introduction to Algorithms, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022).
<!--ID: 1722339320124-->
END%%
%%ANKI
Basic
Consider the following binary search tree. List the nodes visited in postorder traversal.
![[binary-search-tree.png]]
Back: 2, 5, 5, 8, 7, 6
Reference: Thomas H. Cormen et al., Introduction to Algorithms, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022).
<!--ID: 1722339465744-->
END%%
%%ANKI
Basic
Consider the following binary search tree. List the nodes visited in preorder traversal.
![[binary-search-tree.png]]
Back: 6, 5, 2, 5, 7, 8
Reference: Thomas H. Cormen et al., Introduction to Algorithms, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022).
<!--ID: 1722339465750-->
END%%
%%ANKI
Basic
Consider the following binary search tree. List the nodes visited in inorder traversal.
![[binary-search-tree.png]]
Back: 2, 5, 5, 6, 7, 8
Reference: Thomas H. Cormen et al., Introduction to Algorithms, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022).
<!--ID: 1722339465754-->
END%%
%%ANKI
Basic
What path should be followed to find the minimum of a binary search tree?
Back: The one formed by following all $left$ pointers.
Reference: Thomas H. Cormen et al., Introduction to Algorithms, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022).
<!--ID: 1722342235755-->
END%%
%%ANKI
Basic
What path should be followed to find the maximum of a binary search tree?
Back: The one formed by following all $right$ pointers.
Reference: Thomas H. Cormen et al., Introduction to Algorithms, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022).
<!--ID: 1722342235784-->
END%%
## Bibliography
* Thomas H. Cormen et al., Introduction to Algorithms, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022).

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

View File

@ -145,15 +145,15 @@ END%%
%%ANKI %%ANKI
Basic Basic
How do we write the equivalent existence (not uniqueness) assertion made by $\exists! x, P(x)$? How do we write the existence (not uniqueness) assertion made by $\exists! x, P(x)$?
Back: $\exists x, P(x))$ Back: $\exists x, P(x)$
Reference: Patrick Keef and David Guichard, “An Introduction to Higher Mathematics,” n.d. Reference: Patrick Keef and David Guichard, “An Introduction to Higher Mathematics,” n.d.
<!--ID: 1721824073168--> <!--ID: 1721824073168-->
END%% END%%
%%ANKI %%ANKI
Basic Basic
How do we write the equivalent uniqueness (not existence) assertion made by $\exists! x, P(x)$? How do we write the uniqueness (not existence) assertion made by $\exists! x, P(x)$?
Back: $\forall x, \forall y, (P(x) \land P(y)) \Rightarrow (x = y)$ Back: $\forall x, \forall y, (P(x) \land P(y)) \Rightarrow (x = y)$
Reference: Patrick Keef and David Guichard, “An Introduction to Higher Mathematics,” n.d. Reference: Patrick Keef and David Guichard, “An Introduction to Higher Mathematics,” n.d.
<!--ID: 1721824073172--> <!--ID: 1721824073172-->

View File

@ -84,7 +84,7 @@ END%%
%%ANKI %%ANKI
Basic Basic
How is $\neg{\text{-}}I$ expressed in schematic notation? How is $\neg{\text{-}}I$ expressed in schematic notation?
Back: $$\neg{\text{-}}I{:} \quad \begin{array}{c} \text{from } E_1 \text{ infer } E_2 \land \neg E_2 \\ \hline \neg E_1 \end{array}$$ Back: $$\begin{array}{c} \text{from } E_1 \text{ infer } E_2 \land \neg E_2 \\ \hline \neg E_1 \end{array}$$
Reference: Gries, David. *The Science of Programming*. Texts and Monographs in Computer Science. New York: Springer-Verlag, 1981. Reference: Gries, David. *The Science of Programming*. Texts and Monographs in Computer Science. New York: Springer-Verlag, 1981.
<!--ID: 1721825479330--> <!--ID: 1721825479330-->
END%% END%%
@ -92,7 +92,7 @@ END%%
%%ANKI %%ANKI
Basic Basic
How is $\neg{\text{-}}E$ expressed in schematic notation? How is $\neg{\text{-}}E$ expressed in schematic notation?
Back: $$\neg{\text{-}}E{:} \quad \begin{array}{c} \text{from } \neg E_1 \text{ infer } E_2 \land \neg E_2 \\ \hline E_1 \end{array}$$ Back: $$\begin{array}{c} \text{from } \neg E_1 \text{ infer } E_2 \land \neg E_2 \\ \hline E_1 \end{array}$$
Reference: Gries, David. *The Science of Programming*. Texts and Monographs in Computer Science. New York: Springer-Verlag, 1981. Reference: Gries, David. *The Science of Programming*. Texts and Monographs in Computer Science. New York: Springer-Verlag, 1981.
<!--ID: 1721825479336--> <!--ID: 1721825479336-->
END%% END%%
@ -219,7 +219,7 @@ END%%
%%ANKI %%ANKI
Basic Basic
How is ${\Rightarrow}{\text{-}}I$ expressed in schematic notation? How is ${\Rightarrow}{\text{-}}I$ expressed in schematic notation?
Back: $${\Rightarrow}{\text{-}}I: \quad \begin{array}{c} \text{from } E_1, \cdots, E_n \text{ infer } E \\ \hline (E_1 \land \cdots \land E_n) \Rightarrow E \end{array}$$ Back: $$\begin{array}{c} \text{from } E_1, \cdots, E_n \text{ infer } E \\ \hline (E_1 \land \cdots \land E_n) \Rightarrow E \end{array}$$
Reference: Gries, David. *The Science of Programming*. Texts and Monographs in Computer Science. New York: Springer-Verlag, 1981. Reference: Gries, David. *The Science of Programming*. Texts and Monographs in Computer Science. New York: Springer-Verlag, 1981.
<!--ID: 1721785548092--> <!--ID: 1721785548092-->
END%% END%%

View File

@ -147,7 +147,7 @@ END%%
%%ANKI %%ANKI
Basic Basic
Is the following identity true? $$\lambda x y. x(xy) \equiv_\alpha \lambda u v. u(uv))$$ Is the following identity true? $$\lambda x y. x(xy) \equiv_\alpha \lambda u v. u(uv)$$
Back: Yes. Back: Yes.
Reference: Hindley, J Roger, and Jonathan P Seldin. “Lambda-Calculus and Combinators, an Introduction,” n.d. [https://www.cin.ufpe.br/~djo/files/Lambda-Calculus%20and%20Combinators.pdf](https://www.cin.ufpe.br/~djo/files/Lambda-Calculus%20and%20Combinators.pdf). Reference: Hindley, J Roger, and Jonathan P Seldin. “Lambda-Calculus and Combinators, an Introduction,” n.d. [https://www.cin.ufpe.br/~djo/files/Lambda-Calculus%20and%20Combinators.pdf](https://www.cin.ufpe.br/~djo/files/Lambda-Calculus%20and%20Combinators.pdf).
<!--ID: 1717687744173--> <!--ID: 1717687744173-->
@ -257,7 +257,7 @@ END%%
%%ANKI %%ANKI
Basic Basic
What happens if the antecedent is false in $v \not\in FV(M) \Rightarrow [P/v][v/x]M \equiv_\alpha [P/x]M$? What happens if the antecedent is false in the following? $$v \not\in FV(M) \Rightarrow [P/v][v/x]M \equiv_\alpha [P/x]M$$
Back: The LHS of the identity has more occurrences of $P$ than the right. Back: The LHS of the identity has more occurrences of $P$ than the right.
Reference: Hindley, J Roger, and Jonathan P Seldin. “Lambda-Calculus and Combinators, an Introduction,” n.d. [https://www.cin.ufpe.br/~djo/files/Lambda-Calculus%20and%20Combinators.pdf](https://www.cin.ufpe.br/~djo/files/Lambda-Calculus%20and%20Combinators.pdf). Reference: Hindley, J Roger, and Jonathan P Seldin. “Lambda-Calculus and Combinators, an Introduction,” n.d. [https://www.cin.ufpe.br/~djo/files/Lambda-Calculus%20and%20Combinators.pdf](https://www.cin.ufpe.br/~djo/files/Lambda-Calculus%20and%20Combinators.pdf).
<!--ID: 1717855810781--> <!--ID: 1717855810781-->

View File

@ -11,6 +11,22 @@ tags:
The **Resource Description Framework** (RDF) is the foundational representation language of the Semantic Web. The basic building block of RDF is the **triple** containing a **subject**, **predicate**, and **object**. Global identifiers of resources are represented as [[uri|URIs]] (or, more generally, IRIs). These URIs can be expressed more compactly as [[uri#CURIEs|CURIEs]]. The **Resource Description Framework** (RDF) is the foundational representation language of the Semantic Web. The basic building block of RDF is the **triple** containing a **subject**, **predicate**, and **object**. Global identifiers of resources are represented as [[uri|URIs]] (or, more generally, IRIs). These URIs can be expressed more compactly as [[uri#CURIEs|CURIEs]].
%%ANKI
Basic
Which organization standardized RDF?
Back: W3C
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.
<!--ID: 1722340624977-->
END%%
%%ANKI
Basic
What is W3C an acronym for?
Back: **W**orld **W**ide **W**eb **C**onsortium.
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.
<!--ID: 1722340624982-->
END%%
%%ANKI %%ANKI
Basic Basic
What is RDF an acronym for? What is RDF an acronym for?
@ -113,6 +129,41 @@ Reference: Allemang, Dean, James A. Hendler, and Fabien L. Gandon. _Semantic Web
<!--ID: 1722191359882--> <!--ID: 1722191359882-->
END%% END%%
## Standard Namespaces
W3C have defined a number of standard namespaces for use with Web technologies:
* `xsd`
* Refers to the XML schema definition.
* `xmlns`
* Refers to XML namespaces.
* `rdf`
* Refers to identifiers used in RDF.
%%ANKI
Basic
What is the standard `xsd` namespace an acronym for?
Back: **X**ML **S**chema **D**efinition.
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.
<!--ID: 1722340624986-->
END%%
%%ANKI
Basic
What is the standard `xmlns` namespace an acronym for?
Back: **XML** **N**ame**s**pace.
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.
<!--ID: 1722340624991-->
END%%
%%ANKI
Basic
What is the standard `rdf` namespace an acronym for?
Back: **R**esource **D**escription **F**ramework.
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.
<!--ID: 1722340624996-->
END%%
## Bibliography ## Bibliography
* 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. * 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.

View File

@ -872,6 +872,149 @@ Reference: Gries, David. *The Science of Programming*. Texts and Monographs in
<!--ID: 1721497014085--> <!--ID: 1721497014085-->
END%% END%%
### Alternative
The general form of the **alternative command** is: $$\begin{align*} \textbf{if } & B_1 \rightarrow S_1 \\ \textbf{ | } & B_2 \rightarrow S_2 \\ & \quad\cdots \\ \textbf{ | } & B_n \rightarrow S_n \\ \textbf{fi } & \end{align*}$$
Each $B_i \rightarrow S_i$ is called a **guarded command**. To execute the alternative command, find one true guard and execute the corresponding command. Notice this is nondeterministic. We denote the alternative command as $\text{IF}$ and define $\text{IF}$ in terms of $wp$ as: $$\begin{align*} wp(\text{IF}, R) = \;& (\forall i, 1 \leq i \leq n \Rightarrow domain(B_i)) \;\land \\ & (\exists i, 1 \leq i \leq n \land B_i) \;\land \\ & (\forall i, 1 \leq i \leq n \Rightarrow (B_i \Rightarrow wp(S_i, R))) \end{align*}$$
%%ANKI
Basic
How is the alternative command compactly denoted?
Back: As $\text{IF}$.
Reference: Gries, David. *The Science of Programming*. Texts and Monographs in Computer Science. New York: Springer-Verlag, 1981.
<!--ID: 1722256345848-->
END%%
%%ANKI
Basic
What kind of command is $\text{IF}$ a representation of?
Back: An alternative command.
Reference: Gries, David. *The Science of Programming*. Texts and Monographs in Computer Science. New York: Springer-Verlag, 1981.
<!--ID: 1722256906202-->
END%%
%%ANKI
Basic
What is the general form of the alternative command?
Back: $$\begin{align*} \textbf{if } & B_1 \rightarrow S_1 \\ \textbf{ | } & B_2 \rightarrow S_2 \\ & \quad\cdots \\ \textbf{ | } & B_n \rightarrow S_n \\ \textbf{fi } & \end{align*}$$
Reference: Gries, David. *The Science of Programming*. Texts and Monographs in Computer Science. New York: Springer-Verlag, 1981.
<!--ID: 1722256345855-->
END%%
%%ANKI
Basic
What do "guarded commands" refer to?
Back: Each $B_i \rightarrow S_i$ found in the alternative command.
Reference: Gries, David. *The Science of Programming*. Texts and Monographs in Computer Science. New York: Springer-Verlag, 1981.
<!--ID: 1722256345859-->
END%%
%%ANKI
Basic
*Why* are guarded commands named the way they are?
Back: The execution of the command is "guarded" by the truthiness of the condition.
Reference: Gries, David. *The Science of Programming*. Texts and Monographs in Computer Science. New York: Springer-Verlag, 1981.
<!--ID: 1722256345863-->
END%%
%%ANKI
Basic
How are alternative commands executed?
Back: By finding any true guard and executing the corresponding command.
Reference: Gries, David. *The Science of Programming*. Texts and Monographs in Computer Science. New York: Springer-Verlag, 1981.
<!--ID: 1722256345868-->
END%%
%%ANKI
Cloze
Consider $\text{IF}$ containing $B_i \rightarrow S_i$ for $1 \leq i \leq n$. Then $wp(\text{IF}, R)$ is the conjunction of:
* {$\forall i, 1 \leq i \leq n \Rightarrow domain(B_i)$}
* {$\exists i, 1 \leq i \leq n \land B_i$}
* {$\forall i, 1 \leq i \leq n \Rightarrow (B_i \Rightarrow wp(S_i, R))$}
Reference: Gries, David. *The Science of Programming*. Texts and Monographs in Computer Science. New York: Springer-Verlag, 1981.
<!--ID: 1722256345873-->
END%%
%%ANKI
Basic
What assumption is made when defining $\text{IF}$ as follows? $$\begin{align*} wp(\text{IF}, R) = \;& (\exists i, 1 \leq i \leq n \land B_i) \;\land \\ & (\forall i, 1 \leq i \leq n \Rightarrow (B_i \Rightarrow wp(S_i, R))) \end{align*}$$
Back: $domain(B_i)$ for $1 \leq i \leq n$.
Reference: Gries, David. *The Science of Programming*. Texts and Monographs in Computer Science. New York: Springer-Verlag, 1981.
<!--ID: 1722256906206-->
END%%
%%ANKI
Basic
Under what two conditions does the alternative command abort?
Back: If a condition isn't well-defined or no condition is satisfied.
Reference: Gries, David. *The Science of Programming*. Texts and Monographs in Computer Science. New York: Springer-Verlag, 1981.
<!--ID: 1722256906210-->
END%%
%%ANKI
Basic
In what way is the alternative command's execution different from traditional case statements?
Back: It is nondeterministic.
Reference: Gries, David. *The Science of Programming*. Texts and Monographs in Computer Science. New York: Springer-Verlag, 1981.
<!--ID: 1722256906214-->
END%%
%%ANKI
Basic
When *might* the following alternative command abort? $$\begin{align*} \textbf{if } & x > 0 \rightarrow z \coloneqq x \\ \textbf{ | } & x < 0 \rightarrow z \coloneqq -x \\ \textbf{fi } & \end{align*}$$
Back: When $x = 0$.
Reference: Gries, David. *The Science of Programming*. Texts and Monographs in Computer Science. New York: Springer-Verlag, 1981.
<!--ID: 1722257348944-->
END%%
%%ANKI
Basic
When is the first guarded command of the following executed? $$\begin{align*} \textbf{if } & x \geq 0 \rightarrow z \coloneqq x \\ \textbf{ | } & x \leq 0 \rightarrow z \coloneqq -x \\ \textbf{fi } & \end{align*}$$
Back: When $x \geq 0$.
Reference: Gries, David. *The Science of Programming*. Texts and Monographs in Computer Science. New York: Springer-Verlag, 1981.
<!--ID: 1722257348955-->
END%%
%%ANKI
Basic
When are both of the following guarded commands executed? $$\begin{align*} \textbf{if } & x \geq 0 \rightarrow z \coloneqq x \\ \textbf{ | } & x \leq 0 \rightarrow z \coloneqq -x \\ \textbf{fi } & \end{align*}$$
Back: N/A.
Reference: Gries, David. *The Science of Programming*. Texts and Monographs in Computer Science. New York: Springer-Verlag, 1981.
<!--ID: 1722257348960-->
END%%
%%ANKI
Basic
When are either of the following guarded commands executed? $$\begin{align*} \textbf{if } & x \geq 0 \rightarrow z \coloneqq x \\ \textbf{ | } & x \leq 0 \rightarrow z \coloneqq -x \\ \textbf{fi } & \end{align*}$$
Back: When $x = 0$.
Reference: Gries, David. *The Science of Programming*. Texts and Monographs in Computer Science. New York: Springer-Verlag, 1981.
<!--ID: 1722257348966-->
END%%
%%ANKI
Cloze
Alternative command {$\textbf{if fi}$} is equivalent to command {$abort$}.
Reference: Gries, David. *The Science of Programming*. Texts and Monographs in Computer Science. New York: Springer-Verlag, 1981.
<!--ID: 1722259243605-->
END%%
%%ANKI
Basic
*Why* does command $\textbf{if fi}$ abort?
Back: Because no guarded command is true (vacuously) by time of execution.
Reference: Gries, David. *The Science of Programming*. Texts and Monographs in Computer Science. New York: Springer-Verlag, 1981.
<!--ID: 1722259243633-->
END%%
%%ANKI
Basic
How is command $skip$ wrapped in a no-op alternative command?
Back: As $\textbf{if } T \rightarrow skip \textbf{ fi}$
Reference: Gries, David. *The Science of Programming*. Texts and Monographs in Computer Science. New York: Springer-Verlag, 1981.
<!--ID: 1722259243640-->
END%%
## Bibliography ## Bibliography
* Gries, David. *The Science of Programming*. Texts and Monographs in Computer Science. New York: Springer-Verlag, 1981. * Gries, David. *The Science of Programming*. Texts and Monographs in Computer Science. New York: Springer-Verlag, 1981.

View File

@ -39,7 +39,7 @@ An **indirect proof** works by assuming the denial of the desired conclusion lea
%%ANKI %%ANKI
Basic Basic
What is an indirect proof? What is an indirect proof?
Back: A proof in which the denial of a conclusion is assumed and shown to yield a contradiction. Back: A proof in which the denial of a proposition is assumed and shown to yield a contradiction.
Reference: Patrick Keef and David Guichard, “An Introduction to Higher Mathematics,” n.d. Reference: Patrick Keef and David Guichard, “An Introduction to Higher Mathematics,” n.d.
<!--ID: 1721824073070--> <!--ID: 1721824073070-->
END%% END%%
@ -106,7 +106,7 @@ END%%
%%ANKI %%ANKI
Basic Basic
Which natural deduction rule immediatley depends on the existence of a conditional proof? Which natural deduction rule depends directly on the existence of a conditional proof?
Back: ${\Rightarrow}{\text{-}}I$ Back: ${\Rightarrow}{\text{-}}I$
Reference: Gries, David. *The Science of Programming*. Texts and Monographs in Computer Science. New York: Springer-Verlag, 1981. Reference: Gries, David. *The Science of Programming*. Texts and Monographs in Computer Science. New York: Springer-Verlag, 1981.
<!--ID: 1721825479299--> <!--ID: 1721825479299-->
@ -255,7 +255,15 @@ END%%
%%ANKI %%ANKI
Basic Basic
Is a constructive proof considered direct or indirect? Which of existence proofs or constructive proofs is more general?
Back: Existence proofs.
Reference: “Constructive Proof,” in _Wikipedia_, April 4, 2024, [https://en.wikipedia.org/w/index.php?title=Constructive_proof](https://en.wikipedia.org/w/index.php?title=Constructive_proof&oldid=1217198357).
<!--ID: 1722336217056-->
END%%
%%ANKI
Basic
Is a constructive proof usually direct or indirect?
Back: Usually direct. Back: Usually direct.
Reference: “Constructive Proof,” in _Wikipedia_, April 4, 2024, [https://en.wikipedia.org/w/index.php?title=Constructive_proof](https://en.wikipedia.org/w/index.php?title=Constructive_proof&oldid=1217198357). Reference: “Constructive Proof,” in _Wikipedia_, April 4, 2024, [https://en.wikipedia.org/w/index.php?title=Constructive_proof](https://en.wikipedia.org/w/index.php?title=Constructive_proof&oldid=1217198357).
<!--ID: 1721824073149--> <!--ID: 1721824073149-->
@ -271,7 +279,15 @@ END%%
%%ANKI %%ANKI
Basic Basic
Is a non-constructive proof considered direct or indirect? Which of non-constructive proofs or existence proofs is more general?
Back: Existence proofs.
Reference: “Constructive Proof,” in _Wikipedia_, April 4, 2024, [https://en.wikipedia.org/w/index.php?title=Constructive_proof](https://en.wikipedia.org/w/index.php?title=Constructive_proof&oldid=1217198357).
<!--ID: 1722336217060-->
END%%
%%ANKI
Basic
Is a non-constructive proof usually direct or indirect?
Back: Usually indirect. Back: Usually indirect.
Reference: “Constructive Proof,” in _Wikipedia_, April 4, 2024, [https://en.wikipedia.org/w/index.php?title=Constructive_proof](https://en.wikipedia.org/w/index.php?title=Constructive_proof&oldid=1217198357). Reference: “Constructive Proof,” in _Wikipedia_, April 4, 2024, [https://en.wikipedia.org/w/index.php?title=Constructive_proof](https://en.wikipedia.org/w/index.php?title=Constructive_proof&oldid=1217198357).
<!--ID: 1721824073155--> <!--ID: 1721824073155-->

View File

@ -685,7 +685,7 @@ END%%
%%ANKI %%ANKI
Cloze Cloze
Suppose $xRx$ for all $x \in A$, $R$ is said to be reflexive {on} $A$. If $xRx$ for all $x \in A$, $R$ is said to be reflexive {on} $A$.
Reference: Herbert B. Enderton, *Elements of Set Theory* (New York: Academic Press, 1977). Reference: Herbert B. Enderton, *Elements of Set Theory* (New York: Academic Press, 1977).
<!--ID: 1720967429824--> <!--ID: 1720967429824-->
END%% END%%
@ -760,7 +760,7 @@ END%%
%%ANKI %%ANKI
Cloze Cloze
Suppose $\neg xRx$ for all $x \in A$, $R$ is said to be irreflexive {on} $A$. If $\neg xRx$ for all $x \in A$, $R$ is said to be irreflexive {on} $A$.
Reference: Herbert B. Enderton, *Elements of Set Theory* (New York: Academic Press, 1977). Reference: Herbert B. Enderton, *Elements of Set Theory* (New York: Academic Press, 1977).
<!--ID: 1721870888411--> <!--ID: 1721870888411-->
END%% END%%
@ -1452,13 +1452,6 @@ Reference: “Partition of a Set,” in _Wikipedia_, June 18, 2024, [https://en.
<!--ID: 1721696946377--> <!--ID: 1721696946377-->
END%% END%%
%%ANKI
Cloze
Let $R$ be an equivalence relation. Then {1:cell} $[x]$ of partition $A / R$ is an {2:equivalence class of $A$} (modulo {2:$R$}).
Reference: Herbert B. Enderton, *Elements of Set Theory* (New York: Academic Press, 1977).
<!--ID: 1721696946384-->
END%%
%%ANKI %%ANKI
Basic Basic
Let $R$ be the equivalence relation induced by partition $\Pi$ of $A$. What does $A / R$ equal? Let $R$ be the equivalence relation induced by partition $\Pi$ of $A$. What does $A / R$ equal?