Sequences and MOV instructions.

c-declarations
Joshua Potter 2024-04-24 15:35:24 -06:00
parent 7871ae52fe
commit 262683515f
16 changed files with 656 additions and 18 deletions

View File

@ -148,7 +148,7 @@
"_journal/2024-02-02.md": "a3b222daee8a50bce4cbac699efc7180", "_journal/2024-02-02.md": "a3b222daee8a50bce4cbac699efc7180",
"_journal/2024-02-01.md": "3aa232387d2dc662384976fd116888eb", "_journal/2024-02-01.md": "3aa232387d2dc662384976fd116888eb",
"_journal/2024-01-31.md": "7c7fbfccabc316f9e676826bf8dfe970", "_journal/2024-01-31.md": "7c7fbfccabc316f9e676826bf8dfe970",
"logic/equiv-trans.md": "4de3b5412f29b080a5f9f3629db38389", "logic/equiv-trans.md": "5d68be4120e7f79e12c35fafeddaf1a1",
"_journal/2024-02-07.md": "8d81cd56a3b33883a7706d32e77b5889", "_journal/2024-02-07.md": "8d81cd56a3b33883a7706d32e77b5889",
"algorithms/loop-invariants.md": "cbefc346842c21a6cce5c5edce451eb2", "algorithms/loop-invariants.md": "cbefc346842c21a6cce5c5edce451eb2",
"algorithms/loop-invariant.md": "3b390e720f3b2a98e611b49a0bb1f5a9", "algorithms/loop-invariant.md": "3b390e720f3b2a98e611b49a0bb1f5a9",
@ -224,7 +224,7 @@
"c17/strings.md": "e4012ee9a18ad44370490e375ae57f09", "c17/strings.md": "e4012ee9a18ad44370490e375ae57f09",
"c17/index.md": "78576ee41d0185df82c59999142f4edb", "c17/index.md": "78576ee41d0185df82c59999142f4edb",
"c17/escape-sequences.md": "a8b99070336878b4e8c11e9e4525a500", "c17/escape-sequences.md": "a8b99070336878b4e8c11e9e4525a500",
"c17/declarations.md": "f55d31e93e67f03577300d9e92129e82", "c17/declarations.md": "7556186be0678419100ee9801e85ff06",
"algorithms/sorting/merge-sort.md": "6506483f7df6507cee0407bd205dbedd", "algorithms/sorting/merge-sort.md": "6506483f7df6507cee0407bd205dbedd",
"_journal/2024-02-24.md": "9bb319d5014caf962a9ce3141076cff4", "_journal/2024-02-24.md": "9bb319d5014caf962a9ce3141076cff4",
"_journal/2024-02/2024-02-23.md": "0aad297148e8cc4058b48b7e45787ca7", "_journal/2024-02/2024-02-23.md": "0aad297148e8cc4058b48b7e45787ca7",
@ -240,13 +240,13 @@
"filesystems/cas.md": "d41c0d2e943adecbadd10a03fd1e4274", "filesystems/cas.md": "d41c0d2e943adecbadd10a03fd1e4274",
"git/objects.md": "c6b7e6a26666386790d25d4ece38175d", "git/objects.md": "c6b7e6a26666386790d25d4ece38175d",
"git/index.md": "83d2d95fc549d9e8436946c7bd058d15", "git/index.md": "83d2d95fc549d9e8436946c7bd058d15",
"encoding/integer.md": "13f5cb33721bc0815d95821ef940321b", "encoding/integer.md": "73c42283ff8c3a1d4efb9f9644a4cf3b",
"_journal/2024-02-29.md": "f610f3caed659c1de3eed5f226cab508", "_journal/2024-02-29.md": "f610f3caed659c1de3eed5f226cab508",
"_journal/2024-02/2024-02-28.md": "7489377c014a2ff3c535d581961b5b82", "_journal/2024-02/2024-02-28.md": "7489377c014a2ff3c535d581961b5b82",
"_journal/2024-03-01.md": "a532486279190b0c12954966cbf8c3fe", "_journal/2024-03-01.md": "a532486279190b0c12954966cbf8c3fe",
"_journal/2024-02/2024-02-29.md": "0e502a2c8baf90c2f12859b03f10b5a1", "_journal/2024-02/2024-02-29.md": "0e502a2c8baf90c2f12859b03f10b5a1",
"algebra/sequences.md": "97c217823aacf8910a1a37bde694ecfe", "algebra/sequences.md": "97c217823aacf8910a1a37bde694ecfe",
"algebra/sequences/index.md": "91ec81d3aa22d1baef2ab4b24736c43c", "algebra/sequences/index.md": "a15b7ce8cd040a08c7bfc8ceb6cd0525",
"_journal/2024-03-02.md": "08c3cae1df0079293b47e1e9556f1ce1", "_journal/2024-03-02.md": "08c3cae1df0079293b47e1e9556f1ce1",
"_journal/2024-03/2024-03-01.md": "70da812300f284df72718dd32fc39322", "_journal/2024-03/2024-03-01.md": "70da812300f284df72718dd32fc39322",
"algebra/sequences/triangular-numbers.md": "39a84ee317d3760a2eda7279c83e921a", "algebra/sequences/triangular-numbers.md": "39a84ee317d3760a2eda7279c83e921a",
@ -258,7 +258,7 @@
"_journal/2024-03-05.md": "e9a911c19bb4c0ff451db793248cb4bb", "_journal/2024-03-05.md": "e9a911c19bb4c0ff451db793248cb4bb",
"_journal/2024-03/2024-03-04.md": "4948d90a08af2cff58c629c9a2e11ee4", "_journal/2024-03/2024-03-04.md": "4948d90a08af2cff58c629c9a2e11ee4",
"algebra/sequences/geometric.md": "57544cab59f0b8c28d4a11f0273a3119", "algebra/sequences/geometric.md": "57544cab59f0b8c28d4a11f0273a3119",
"algebra/sequences/arithmetic.md": "6acb04ca2bbd2e39decd23a6451f2266", "algebra/sequences/arithmetic.md": "861b6368487463a4fd6a608147df2f4f",
"_journal/2024-03-06.md": "ac7a3d764934f49b2be7aa76e402d853", "_journal/2024-03-06.md": "ac7a3d764934f49b2be7aa76e402d853",
"_journal/2024-03/2024-03-05.md": "94b28d0b9bc62cc0bd99d315fb7c6d30", "_journal/2024-03/2024-03-05.md": "94b28d0b9bc62cc0bd99d315fb7c6d30",
"_journal/2024-03-07.md": "7bf68d6d81e89aa00f5ddd7510b69e3e", "_journal/2024-03-07.md": "7bf68d6d81e89aa00f5ddd7510b69e3e",
@ -290,7 +290,7 @@
"_journal/2024-03/2024-03-17.md": "23f9672f5c93a6de52099b1b86834e8b", "_journal/2024-03/2024-03-17.md": "23f9672f5c93a6de52099b1b86834e8b",
"set/directed-graph.md": "b4b8ad1be634a0a808af125fe8577a53", "set/directed-graph.md": "b4b8ad1be634a0a808af125fe8577a53",
"set/index.md": "b82a215fbee3c576186fc1af93c82fcb", "set/index.md": "b82a215fbee3c576186fc1af93c82fcb",
"set/graphs.md": "7e03faf8fce1168db7a8fcebb396b47f", "set/graphs.md": "242195a7af5dc5dfefdc07ccba8b0fa4",
"_journal/2024-03-19.md": "a0807691819725bf44c0262405e97cbb", "_journal/2024-03-19.md": "a0807691819725bf44c0262405e97cbb",
"_journal/2024-03/2024-03-18.md": "63c3c843fc6cfc2cd289ac8b7b108391", "_journal/2024-03/2024-03-18.md": "63c3c843fc6cfc2cd289ac8b7b108391",
"awk/variables.md": "e40a20545358228319f789243d8b9f77", "awk/variables.md": "e40a20545358228319f789243d8b9f77",
@ -308,9 +308,9 @@
"_journal/2024-03-22.md": "8da8cda07d3de74f7130981a05dce254", "_journal/2024-03-22.md": "8da8cda07d3de74f7130981a05dce254",
"_journal/2024-03/2024-03-21.md": "cd465f71800b080afa5c6bdc75bf9cd3", "_journal/2024-03/2024-03-21.md": "cd465f71800b080afa5c6bdc75bf9cd3",
"x86-64/declarations.md": "75bc7857cf2207a40cd7f0ee056af2f2", "x86-64/declarations.md": "75bc7857cf2207a40cd7f0ee056af2f2",
"x86-64/instructions.md": "61a6b774b1c3a34893268897490dc90b", "x86-64/instructions.md": "d783bad8dd77748fb412715541cb844d",
"git/refs.md": "954fc69004aa65b358ec5ce07c1435ce", "git/refs.md": "954fc69004aa65b358ec5ce07c1435ce",
"set/trees.md": "f0e179ee573a344b6eb7624bdf4f0539", "set/trees.md": "4d081c258eb662e2147d1e462193e715",
"_journal/2024-03-24.md": "1974cdb9fc42c3a8bebb8ac76d4b1fd6", "_journal/2024-03-24.md": "1974cdb9fc42c3a8bebb8ac76d4b1fd6",
"_journal/2024-03/2024-03-23.md": "ad4e92cc2bf37f174a0758a0753bf69b", "_journal/2024-03/2024-03-23.md": "ad4e92cc2bf37f174a0758a0753bf69b",
"_journal/2024-03/2024-03-22.md": "a509066c9cd2df692549e89f241d7bd9", "_journal/2024-03/2024-03-22.md": "a509066c9cd2df692549e89f241d7bd9",
@ -349,11 +349,21 @@
"_journal/2024-04-16.md": "0bf6e2f2a3afab73d528cee88c4c1a92", "_journal/2024-04-16.md": "0bf6e2f2a3afab73d528cee88c4c1a92",
"_journal/2024-04/2024-04-15.md": "256253b0633d878ca58060162beb7587", "_journal/2024-04/2024-04-15.md": "256253b0633d878ca58060162beb7587",
"algebra/polynomials.md": "6e20029b44fe0d0c4f35ef8ee4874d82", "algebra/polynomials.md": "6e20029b44fe0d0c4f35ef8ee4874d82",
"algebra/sequences/delta-constant.md": "f51bb01d5475004063e444e2acbcd0a3", "algebra/sequences/delta-constant.md": "8292ae72cd1f36c649f3e224f2c0d853",
"_journal/2024-04-19.md": "a293087860a7f378507a96df0b09dd2b", "_journal/2024-04-19.md": "a293087860a7f378507a96df0b09dd2b",
"_journal/2024-04/2024-04-18.md": "f6e5bee68dbef90a21ca92a846930a88", "_journal/2024-04/2024-04-18.md": "f6e5bee68dbef90a21ca92a846930a88",
"_journal/2024-04/2024-04-17.md": "331423470ea83fc990c1ee1d5bd3b3f1", "_journal/2024-04/2024-04-17.md": "331423470ea83fc990c1ee1d5bd3b3f1",
"_journal/2024-04/2024-04-16.md": "2f47dcbc01dd0995e59ae1759122b416" "_journal/2024-04/2024-04-16.md": "2f47dcbc01dd0995e59ae1759122b416",
"_journal/2024-04-20.md": "043bbf73e6a317152b8fa3af03d1c57b",
"_journal/2024-04/2024-04-19.md": "bbd870d1f8ed84ecbf2c927e504f77d9",
"_journal/2024-04-22.md": "ba428abd846d67feb8d8b0e2faff00de",
"_journal/2024-04-21.md": "48c1d823bcb2c39b7e36da428bb2c1c8",
"_journal/2024-04/2024-04-21.md": "48c1d823bcb2c39b7e36da428bb2c1c8",
"_journal/2024-04/2024-04-20.md": "043bbf73e6a317152b8fa3af03d1c57b",
"_journal/2024-04-23.md": "a138b94e4c986773f30b3f2b375d3216",
"_journal/2024-04/2024-04-22.md": "1737cfe64dca349f7ea3401863555d90",
"_journal/2024-04-24.md": "388aea1c0dc33bccef57c070bf59da4d",
"_journal/2024-04/2024-04-23.md": "010539ad366ed628faa6db384a8e4bd2"
}, },
"fields_dict": { "fields_dict": {
"Basic": [ "Basic": [

View File

@ -0,0 +1,18 @@
---
title: "2024-04-24"
---
- [x] Anki Flashcards
- [x] KoL
- [ ] Sheet Music (10 min.)
- [ ] Go (1 Life & Death Problem)
- [ ] Korean (Read 1 Story)
- [ ] Interview Prep (1 Practice Problem)
- [x] Log Work Hours (Max 3 hours)
* Read chapter 7 "Transactions" of "Designing Data-Intensive Applications".
* Hide-and-seek application.
* Explored how to limit the number of re-renders in the application.
* Played around with Zustand types to get TypeScript and Immer working together (WIP).
* Read chapter 2 "Pastebin" of "Grokking the System Design Interview".
* Read chapter 4 of HP-16C manual.

View File

@ -0,0 +1,14 @@
---
title: "2024-04-20"
---
- [x] Anki Flashcards
- [x] KoL
- [ ] Sheet Music (10 min.)
- [ ] Go (1 Life & Death Problem)
- [ ] Korean (Read 1 Story)
- [ ] Interview Prep (1 Practice Problem)
- [ ] Log Work Hours (Max 3 hours)
* Chapter 2 of the HP-16C manual.
* Create flashcards for x86 MOV instructions. Focusing on cards that encourage better reading of assembly, not writing.

View File

@ -0,0 +1,11 @@
---
title: "2024-04-21"
---
- [x] Anki Flashcards
- [x] KoL
- [ ] Sheet Music (10 min.)
- [ ] Go (1 Life & Death Problem)
- [ ] Korean (Read 1 Story)
- [ ] Interview Prep (1 Practice Problem)
- [ ] Log Work Hours (Max 3 hours)

View File

@ -0,0 +1,16 @@
---
title: "2024-04-22"
---
- [x] Anki Flashcards
- [x] KoL
- [ ] Sheet Music (10 min.)
- [ ] Go (1 Life & Death Problem)
- [ ] Korean (Read 1 Story)
- [ ] Interview Prep (1 Practice Problem)
- [x] Log Work Hours (Max 3 hours)
* Read chapter 5.1 "One-Dimensional Arrays as Functions" in "The Scient of Programming".
* Hide-and-seek application
* Continue the latest refactor. Added back pick/hide phases with permission checking in place.
* Read chapter 2.4 "Solving Recurrence Relations" of "Discrete Mathematics: An Open Introduction". Need to finish re-reading, doing the exercises, and creating flashcards.

View File

@ -0,0 +1,13 @@
---
title: "2024-04-23"
---
- [x] Anki Flashcards
- [x] KoL
- [ ] Sheet Music (10 min.)
- [ ] Go (1 Life & Death Problem)
- [ ] Korean (Read 1 Story)
- [ ] Interview Prep (1 Practice Problem)
- [x] Log Work Hours (Max 3 hours)
* Chapter 3 of HP-16C manual.

View File

@ -153,7 +153,7 @@ END%%
%%ANKI %%ANKI
Basic Basic
Why is a sequence of partial sums named the way it is? Why is a sequence of partial sums named the way it is?
Back: Each term is found by adding a finite number of infinite terms. Back: Each term is found by adding a finite number of terms in an infinite sequence.
Reference: Oscar Levin, *Discrete Mathematics: An Open Introduction*, 3rd ed., n.d., [https://discrete.openmathbooks.org/pdfs/dmoi3-tablet.pdf](https://discrete.openmathbooks.org/pdfs/dmoi3-tablet.pdf). Reference: Oscar Levin, *Discrete Mathematics: An Open Introduction*, 3rd ed., n.d., [https://discrete.openmathbooks.org/pdfs/dmoi3-tablet.pdf](https://discrete.openmathbooks.org/pdfs/dmoi3-tablet.pdf).
<!--ID: 1713580109297--> <!--ID: 1713580109297-->
END%% END%%

View File

@ -126,7 +126,7 @@ END%%
%%ANKI %%ANKI
Basic Basic
How are arithmetic sequences defined in terms of $\Delta^k$ polynomials? How are arithmetic sequences defined in terms of "$\Delta^k$-constant"?
Back: A sequence is arithmetic if and only if it is $\Delta^1$-constant. Back: A sequence is arithmetic if and only if it is $\Delta^1$-constant.
Reference: Oscar Levin, *Discrete Mathematics: An Open Introduction*, 3rd ed., n.d., [https://discrete.openmathbooks.org/pdfs/dmoi3-tablet.pdf](https://discrete.openmathbooks.org/pdfs/dmoi3-tablet.pdf). Reference: Oscar Levin, *Discrete Mathematics: An Open Introduction*, 3rd ed., n.d., [https://discrete.openmathbooks.org/pdfs/dmoi3-tablet.pdf](https://discrete.openmathbooks.org/pdfs/dmoi3-tablet.pdf).
<!--ID: 1713580109244--> <!--ID: 1713580109244-->
@ -134,7 +134,7 @@ END%%
%%ANKI %%ANKI
Basic Basic
How are geometric sequences defined in terms of $\Delta^k$ polynomials? How are geometric sequences defined in terms of "$\Delta^k$-constant"?
Back: N/A Back: N/A
Reference: Oscar Levin, *Discrete Mathematics: An Open Introduction*, 3rd ed., n.d., [https://discrete.openmathbooks.org/pdfs/dmoi3-tablet.pdf](https://discrete.openmathbooks.org/pdfs/dmoi3-tablet.pdf). Reference: Oscar Levin, *Discrete Mathematics: An Open Introduction*, 3rd ed., n.d., [https://discrete.openmathbooks.org/pdfs/dmoi3-tablet.pdf](https://discrete.openmathbooks.org/pdfs/dmoi3-tablet.pdf).
<!--ID: 1713580109250--> <!--ID: 1713580109250-->

View File

@ -169,6 +169,110 @@ Reference: Oscar Levin, *Discrete Mathematics: An Open Introduction*, 3rd ed., n
<!--ID: 1709302343255--> <!--ID: 1709302343255-->
END%% END%%
## Solving Recurrence Relations
%%ANKI
Basic
What is the recurrence relation for the Fibonacci sequence?
Back: $F_n = F_{n-1} + F_{n-2}$
Reference: Oscar Levin, *Discrete Mathematics: An Open Introduction*, 3rd ed., n.d., [https://discrete.openmathbooks.org/pdfs/dmoi3-tablet.pdf](https://discrete.openmathbooks.org/pdfs/dmoi3-tablet.pdf).
<!--ID: 1713810280062-->
END%%
%%ANKI
Basic
What does it mean to solve a recurrence relation?
Back: To find a closed formula satisfying the relation and initial conditions.
Reference: Oscar Levin, *Discrete Mathematics: An Open Introduction*, 3rd ed., n.d., [https://discrete.openmathbooks.org/pdfs/dmoi3-tablet.pdf](https://discrete.openmathbooks.org/pdfs/dmoi3-tablet.pdf).
<!--ID: 1713810280066-->
END%%
%%ANKI
Basic
What does it mean for a sum to be telescoping?
Back: Pairs of consecutive terms in the summation cancel each other out.
Reference: Oscar Levin, *Discrete Mathematics: An Open Introduction*, 3rd ed., n.d., [https://discrete.openmathbooks.org/pdfs/dmoi3-tablet.pdf](https://discrete.openmathbooks.org/pdfs/dmoi3-tablet.pdf).
<!--ID: 1713810280068-->
END%%
%%ANKI
Basic
What imagery is invoked by the term "telescoping" with respect to a sum?
Back: A collapsing telescope.
Reference: Oscar Levin, *Discrete Mathematics: An Open Introduction*, 3rd ed., n.d., [https://discrete.openmathbooks.org/pdfs/dmoi3-tablet.pdf](https://discrete.openmathbooks.org/pdfs/dmoi3-tablet.pdf).
<!--ID: 1713810280071-->
END%%
%%ANKI
Basic
What summands typically remain after evaluating a telescoping sum?
Back: The first and the last.
Reference: Oscar Levin, *Discrete Mathematics: An Open Introduction*, 3rd ed., n.d., [https://discrete.openmathbooks.org/pdfs/dmoi3-tablet.pdf](https://discrete.openmathbooks.org/pdfs/dmoi3-tablet.pdf).
<!--ID: 1713810280074-->
END%%
%%ANKI
Basic
What is the result of the following after observing telescoping? $$(2 - 1) + (3 - 2) + \cdots + (100 - 99) + (101 - 100)$$
Back: $-1 + 101$
Reference: Oscar Levin, *Discrete Mathematics: An Open Introduction*, 3rd ed., n.d., [https://discrete.openmathbooks.org/pdfs/dmoi3-tablet.pdf](https://discrete.openmathbooks.org/pdfs/dmoi3-tablet.pdf).
<!--ID: 1713810280076-->
END%%
%%ANKI
Basic
How is the following rewritten to highlight telescoping? $$(2 - 1) + (3 - 2) + \cdots + (100 - 99) + (101 - 100)$$
Back: $$(-1 + 2) + (-2 + 3) + \cdots + (-99 + 100) + (-100 + 101)$$
Reference: Oscar Levin, *Discrete Mathematics: An Open Introduction*, 3rd ed., n.d., [https://discrete.openmathbooks.org/pdfs/dmoi3-tablet.pdf](https://discrete.openmathbooks.org/pdfs/dmoi3-tablet.pdf).
<!--ID: 1713810280079-->
END%%
%%ANKI
Basic
What is the result of the following? $\sum_{n=1}^N (a_n - a_{n-1})$
Back: $a_N - a_0$
Reference: Oscar Levin, *Discrete Mathematics: An Open Introduction*, 3rd ed., n.d., [https://discrete.openmathbooks.org/pdfs/dmoi3-tablet.pdf](https://discrete.openmathbooks.org/pdfs/dmoi3-tablet.pdf).
<!--ID: 1713810280082-->
END%%
%%ANKI
Basic
What property is used to quickly verify the following identity? $$\sum_{n=1}^N (a_n - a_{n-1}) = a_N - a_0$$
Back: This is a telescoping sum.
Reference: Oscar Levin, *Discrete Mathematics: An Open Introduction*, 3rd ed., n.d., [https://discrete.openmathbooks.org/pdfs/dmoi3-tablet.pdf](https://discrete.openmathbooks.org/pdfs/dmoi3-tablet.pdf).
<!--ID: 1713810280085-->
END%%
%%ANKI
Basic
Schematically show how telescoping can be used to solve $a_n = a_{n-1} + f(n)$.
Back: $$\begin{align*}
a_1 - a_0 & = f(1) \\
& \vdots \\
a_n - a_{n-1} & = f(n) \\
\hline
a_n - a_0 & = \sum_{k=1}^n f(k)
\end{align*}$$
Reference: Oscar Levin, *Discrete Mathematics: An Open Introduction*, 3rd ed., n.d., [https://discrete.openmathbooks.org/pdfs/dmoi3-tablet.pdf](https://discrete.openmathbooks.org/pdfs/dmoi3-tablet.pdf).
<!--ID: 1713810280088-->
END%%
%%ANKI
Basic
What is the closed formula of recurrence $a_n = a_{n-1} + f(n)$?
Back: $a_n = a_0 + \sum_{k=1}^n f(k)$
Reference: Oscar Levin, *Discrete Mathematics: An Open Introduction*, 3rd ed., n.d., [https://discrete.openmathbooks.org/pdfs/dmoi3-tablet.pdf](https://discrete.openmathbooks.org/pdfs/dmoi3-tablet.pdf).
<!--ID: 1713810280091-->
END%%
%%ANKI
Basic
What summation property can be used to derive the closed formula of $a_n = a_{n-1} + f(n)$?
Back: Telescoping.
Reference: Oscar Levin, *Discrete Mathematics: An Open Introduction*, 3rd ed., n.d., [https://discrete.openmathbooks.org/pdfs/dmoi3-tablet.pdf](https://discrete.openmathbooks.org/pdfs/dmoi3-tablet.pdf).
<!--ID: 1713810280094-->
END%%
## Bibliography ## Bibliography
* Oscar Levin, *Discrete Mathematics: An Open Introduction*, 3rd ed., n.d., [https://discrete.openmathbooks.org/pdfs/dmoi3-tablet.pdf](https://discrete.openmathbooks.org/pdfs/dmoi3-tablet.pdf). * Oscar Levin, *Discrete Mathematics: An Open Introduction*, 3rd ed., n.d., [https://discrete.openmathbooks.org/pdfs/dmoi3-tablet.pdf](https://discrete.openmathbooks.org/pdfs/dmoi3-tablet.pdf).

View File

@ -265,8 +265,8 @@ END%%
%%ANKI %%ANKI
Basic Basic
Why avoid negative hexadecimal integer literals? How might C dangerously interpret a negative hexadecimal integer literal?
Back: Depending on value, the resulting type may be `unsigned`. Back: Depending on the value, the resulting type may be `unsigned`.
Reference: Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016. Reference: Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016.
<!--ID: 1708631820833--> <!--ID: 1708631820833-->
END%% END%%

View File

@ -990,7 +990,7 @@ This is more simply expressed as $x +_w^u y = (x + y) \bmod 2^w$.
%%ANKI %%ANKI
Basic Basic
What kind of overflows does unsigned addition potentially exhibit? What kind of overflow does unsigned addition potentially exhibit?
Back: Positive overflow. Back: Positive overflow.
Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016. Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016.
<!--ID: 1708799678739--> <!--ID: 1708799678739-->

View File

@ -887,6 +887,193 @@ Reference: Gries, David. *The Science of Programming*. Texts and Monographs in
<!--ID: 1707939006297--> <!--ID: 1707939006297-->
END%% END%%
### Arrays
An array can be seen as a function from the **domain** of the array to the subscripted values found in the array. We denote array subscript assignment similarly to state identifier assignment: $$(b; i{:}e)[j] = \begin{cases} i = j \rightarrow e \\ i \neq j \rightarrow b[j] \end{cases}$$
%%ANKI
Basic
Let $b$ be an array. What does $b.lower$ denote?
Back: The lower subscript bound of the array.
Reference: Gries, David. *The Science of Programming*. Texts and Monographs in Computer Science. New York: Springer-Verlag, 1981.
<!--ID: 1713793130015-->
END%%
%%ANKI
Basic
Let $b$ be an array. What does $b.upper$ denote?
Back: The upper subscript bound of the array.
Reference: Gries, David. *The Science of Programming*. Texts and Monographs in Computer Science. New York: Springer-Verlag, 1981.
<!--ID: 1713793130019-->
END%%
%%ANKI
Basic
Let $b$ be an array. How is $domain(b)$ defined in set-theoretic notation?
Back: $\{i \mid b.lower \leq i \leq b.upper\}$
Reference: Gries, David. *The Science of Programming*. Texts and Monographs in Computer Science. New York: Springer-Verlag, 1981.
<!--ID: 1713793130022-->
END%%
%%ANKI
Basic
Let $b[0{:}2]$ be an array. What is $b.lower$?
Back: $0$
Reference: Gries, David. *The Science of Programming*. Texts and Monographs in Computer Science. New York: Springer-Verlag, 1981.
<!--ID: 1713793130025-->
END%%
%%ANKI
Basic
Let $b[0{:}2]$ be an array. What is $b.upper$?
Back: $2$
Reference: Gries, David. *The Science of Programming*. Texts and Monographs in Computer Science. New York: Springer-Verlag, 1981.
<!--ID: 1713793130028-->
END%%
%%ANKI
Basic
Execution of `b[i] := e` of array $b$ yields what new value of $b$?
Back: $b = (b; i{:}e)$
Reference: Gries, David. *The Science of Programming*. Texts and Monographs in Computer Science. New York: Springer-Verlag, 1981.
<!--ID: 1713793130031-->
END%%
%%ANKI
Basic
Let $s$ be a state. What *is* $x$ in $(s; x{:}e)$?
Back: An identifier found in $s$.
Reference: Gries, David. *The Science of Programming*. Texts and Monographs in Computer Science. New York: Springer-Verlag, 1981.
<!--ID: 1713793130034-->
END%%
%%ANKI
Basic
Let $s$ be a state. What *is* $e$ in $(s; x{:}e)$?
Back: An expression.
Reference: Gries, David. *The Science of Programming*. Texts and Monographs in Computer Science. New York: Springer-Verlag, 1981.
<!--ID: 1713793130037-->
END%%
%%ANKI
Basic
Let $s$ be a state. What is $e$'s type in $(s; x{:}e)$?
Back: A type matching $x$'s declaration.
Reference: Gries, David. *The Science of Programming*. Texts and Monographs in Computer Science. New York: Springer-Verlag, 1981.
<!--ID: 1713793130041-->
END%%
%%ANKI
Basic
Let $b$ be an array. What *is* $x$ in $(b; x{:}e)$?
Back: An expression that evaluates to a member of $domain(b)$.
Reference: Gries, David. *The Science of Programming*. Texts and Monographs in Computer Science. New York: Springer-Verlag, 1981.
<!--ID: 1713793130045-->
END%%
%%ANKI
Basic
Let $b$ be an array. What is $e$'s type in $(b; x{:}e)$?
Back: A type matching $b$'s member declaration.
Reference: Gries, David. *The Science of Programming*. Texts and Monographs in Computer Science. New York: Springer-Verlag, 1981.
<!--ID: 1713793130050-->
END%%
%%ANKI
Basic
Let $b$ be an array. What case analysis does $(b; i{:}e)[j]$ evaluate to?
Back: $$(b; i{:}e)[j] = \begin{cases} i = j \rightarrow e \\ i \neq j \rightarrow b[j] \end{cases}$$
Reference: Gries, David. *The Science of Programming*. Texts and Monographs in Computer Science. New York: Springer-Verlag, 1981.
<!--ID: 1713793130056-->
END%%
%%ANKI
Basic
Let $b$ be an array. How is $(((b; i{:}e_1); j{:}e_2); k{:}e_3)$ rewritten without nesting?
Back: As $(b; i{:}e_1; j{:}e_2; k{:}e_3)$
Reference: Gries, David. *The Science of Programming*. Texts and Monographs in Computer Science. New York: Springer-Verlag, 1981.
<!--ID: 1713793130062-->
END%%
%%ANKI
Basic
Let $b$ be an array. How is $(b; (i{:}e_1; (j{:}e_2; (k{:}e_3))))$ rewritten without nesting?
Back: N/A. This is invalid syntax.
Reference: Gries, David. *The Science of Programming*. Texts and Monographs in Computer Science. New York: Springer-Verlag, 1981.
<!--ID: 1713793130067-->
END%%
%%ANKI
Basic
Let $b$ be an array. How is $(b; i{:}e_1; j{:}e_2; k{:}e_3)$ rewritten with nesting?
Back: As $(((b; i{:}e_1); j{:}e_2); k{:}e_3)$.
Reference: Gries, David. *The Science of Programming*. Texts and Monographs in Computer Science. New York: Springer-Verlag, 1981.
<!--ID: 1713793130072-->
END%%
%%ANKI
Basic
Let $b$ be an array. What does $(b; i{:}2; i{:}3; i{:}4)[i]$ evaluate to?
Back: $4$
Reference: Gries, David. *The Science of Programming*. Texts and Monographs in Computer Science. New York: Springer-Verlag, 1981.
<!--ID: 1713793130077-->
END%%
%%ANKI
Basic
Let $b$ be an array. How is $(b; 0{:}8; 2{:}9; 0{:}7)[1]$ simplified?
Back: As $b[1]$.
Reference: Gries, David. *The Science of Programming*. Texts and Monographs in Computer Science. New York: Springer-Verlag, 1981.
<!--ID: 1713793130081-->
END%%
%%ANKI
Basic
According to Gries, what is the traditional interpretation of an array?
Back: As a collection of subscripted independent variables (with a common name).
Reference: Gries, David. *The Science of Programming*. Texts and Monographs in Computer Science. New York: Springer-Verlag, 1981.
<!--ID: 1713793130086-->
END%%
%%ANKI
Basic
According to Gries, what is the new interpretation of an array?
Back: As a function.
Reference: Gries, David. *The Science of Programming*. Texts and Monographs in Computer Science. New York: Springer-Verlag, 1981.
<!--ID: 1713793130090-->
END%%
%%ANKI
Basic
What expression results from eliminating $(b; \ldots)$ notation from $(b; i{:}5)[j] = 5$?
Back: $(i = j \land 5 = 5) \lor (i \neq j \land b[j] = 5)$
Reference: Gries, David. *The Science of Programming*. Texts and Monographs in Computer Science. New York: Springer-Verlag, 1981.
<!--ID: 1713793130095-->
END%%
%%ANKI
Basic
What logical axiom is used when eliminating $(b; \ldots)$ notation from e.g. $(b; i{:}5)[j] = 5$?
Back: The Law of the Excluded Middle.
Reference: Gries, David. *The Science of Programming*. Texts and Monographs in Computer Science. New York: Springer-Verlag, 1981.
<!--ID: 1713793130100-->
END%%
%%ANKI
Cloze
For state $s$ and array $b$, {$(s; x{:}s(x))$} is analagous to {$(b; i{:}b[i])$}.
Reference: Gries, David. *The Science of Programming*. Texts and Monographs in Computer Science. New York: Springer-Verlag, 1981.
<!--ID: 1713793130104-->
END%%
%%ANKI
Basic
What is the simplification of $(b; i{:}b[i]; j{:}b[j]; k{:}b[j])$?
Back: $(b; k{:}b[j])$
Reference: Gries, David. *The Science of Programming*. Texts and Monographs in Computer Science. New York: Springer-Verlag, 1981.
<!--ID: 1713793130108-->
END%%
## Bibliography ## Bibliography
* Avigad, Jeremy. Theorem Proving in Lean, n.d. * Avigad, Jeremy. Theorem Proving in Lean, n.d.

View File

@ -990,7 +990,7 @@ END%%
Basic Basic
What are the simple cycles containing vertex $2$? What are the simple cycles containing vertex $2$?
![[undirected-graph-example.png]] ![[undirected-graph-example.png]]
Back: $\langle 1, 2, 5, 1 \rangle$ and $\langle 1, 5, 2, 1 \rangle$ Back: $\langle 2, 5, 1, 2 \rangle$ and $\langle 2, 1, 5, 2 \rangle$
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: 1710807788519--> <!--ID: 1710807788519-->
END%% END%%

View File

@ -904,7 +904,7 @@ END%%
%%ANKI %%ANKI
Basic Basic
What is a $k$-ary tree? What is a $k$-ary tree?
Back: A positional tree in which each node has at most $k$ children. Back: A positional tree in which each node has $k$ labels with a potential child.
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: 1713118128223--> <!--ID: 1713118128223-->
END%% END%%

View File

@ -365,6 +365,271 @@ Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Program
<!--ID: 1713213168894--> <!--ID: 1713213168894-->
END%% END%%
### `MOV`
%%ANKI
Basic
What four variants does `MOV` instructions take on in x86-64?
Back: `movb`, `movw`, `movl`, `movq`
Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016.
<!--ID: 1713625933397-->
END%%
%%ANKI
Basic
How many bytes does a `movb` instruction operate on?
Back: One.
Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016.
<!--ID: 1713625933403-->
END%%
%%ANKI
Basic
How many bytes does a `movw` instruction operate on?
Back: Two.
Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016.
<!--ID: 1713625933406-->
END%%
%%ANKI
Basic
How many bytes does a `movl` instruction operate on?
Back: Four.
Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016.
<!--ID: 1713625933409-->
END%%
%%ANKI
Basic
How many bytes does a `movq` instruction operate on?
Back: Eight.
Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016.
<!--ID: 1713625933413-->
END%%
%%ANKI
Basic
What combination of source and destination types is prohibited in `MOV` instructions?
Back: A source and destination memory address.
Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016.
<!--ID: 1713625933416-->
END%%
%%ANKI
Basic
What is the result of `%rax` after instruction `movl $0x4050,%eax`?
Back: Upper 32-bits is `0` and lower 32-bits is `0x4050`.
Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016.
<!--ID: 1713625933419-->
END%%
%%ANKI
Basic
What is the result of `%rax` after instruction `movq $0x4050,%rax`?
Back: The 64-bit value is `0x4050`.
Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016.
<!--ID: 1713625933423-->
END%%
%%ANKI
Basic
What is the result of `%rax` after instruction `movw $0x4050,%ax`?
Back: The upper 48 bits are unchanged and the lower 16 bits are `0x4050`.
Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016.
<!--ID: 1713625933426-->
END%%
%%ANKI
Basic
What is the result of `%rax` after instruction `movb $0x4050,%al`?
Back: The upper 56 bits are unchanged and the lower 8 bits are `0x50`.
Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016.
<!--ID: 1713625933430-->
END%%
%%ANKI
Basic
What is the result of `%rax` after instruction `movw $0x4050,%al`?
Back: N/A. Invalid operand for instruction.
Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016.
<!--ID: 1713625933433-->
END%%
%%ANKI
Basic
What caveat is applied to the source operand of `movq`?
Back: Immediates are 32-bit two's-complement numbers sign extended to 64-bits.
Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016.
<!--ID: 1713625933437-->
END%%
%%ANKI
Basic
What `mov` instruction is needed when working with 64-bit immediate sources?
Back: `movabsq`
Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016.
<!--ID: 1713625933441-->
END%%
%%ANKI
Basic
What purpose does `movabsq` solve that `movq` does not?
Back: `movabsq` can have an arbitrary 64-bit immediate source.
Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016.
<!--ID: 1713625933448-->
END%%
%%ANKI
Basic
What is the result of `%rax` after the following instructions?
```asm
movabsq $0x0011223344556677, %rax
movb $-1, %al
```
Back: `0x00112233445566FF`
Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016.
<!--ID: 1713625933452-->
END%%
%%ANKI
Basic
What is the result of `%rax` after the following instructions?
```asm
movabsq $0x0011223344556677, %rax
movw $-1, %ax
```
Back: `0x001122334455FFFF`
Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016.
<!--ID: 1713625933455-->
END%%
%%ANKI
Basic
What is the result of `%rax` after the following instructions?
```asm
movabsq $0x0011223344556677, %rax
movl $-1, %eax
```
Back: `0x00000000FFFFFFFF`
Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016.
<!--ID: 1713625933458-->
END%%
%%ANKI
Basic
What is the result of `%rax` after the following instructions?
```asm
movabsq $0x0011223344556677, %rax
movq $-1, %rax
```
Back: `0xFFFFFFFFFFFFFFFF`
Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016.
<!--ID: 1713625933461-->
END%%
%%ANKI
Basic
What is the `MOVZ` instruction class?
Back: `MOV` instructions that zero extend the source to fit into the destination.
Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016.
<!--ID: 1713625933464-->
END%%
%%ANKI
Basic
What is the `MOVS` instruction class?
Back: `MOV` instructions that sign extend the source to fit into the destination.
Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016.
<!--ID: 1713625933466-->
END%%
%%ANKI
Basic
What does the `movzbw` instruction do?
Back: Moves a zero-extended byte to a word.
Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016.
<!--ID: 1713625933469-->
END%%
%%ANKI
Basic
What does the `movslq` instruction do?
Back: Moves a sign-extended double word to a quad word.
Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016.
<!--ID: 1713625933472-->
END%%
%%ANKI
Basic
What does the `movslb` instruction do?
Back: N/A. This instruction does not exist.
Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016.
<!--ID: 1713625933475-->
END%%
%%ANKI
Basic
What combinatorial argument explains the number of `MOVS` instructions?
Back: There exists an instruction for each smaller declaration to larger declaration.
Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016.
<!--ID: 1713625933478-->
END%%
%%ANKI
Basic
What `MOVZ` instruction is "missing"?
Back: `movzlq`
Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016.
<!--ID: 1713625933481-->
END%%
%%ANKI
Basic
Why does there not exist a `movzlq` instruction?
Back: Because `movl` already zeros out the upper bits of a destination register.
Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016.
<!--ID: 1713625933483-->
END%%
%%ANKI
Basic
What is the result of `%rax` after the following instructions?
```asm
movabsq $0x0011223344556677, %rax
movb $0xAA, %dl
movb %dl,%al
```
Back: `0x00112233445566AA`
Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016.
<!--ID: 1713625933486-->
END%%
%%ANKI
Basic
What is the result of `%rax` after the following instructions?
```asm
movabsq $0x0011223344556677, %rax
movb $0xAA, %dl
movsbq %dl,%rax
```
Back: `0xFFFFFFFFFFFFFFAA`
Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016.
<!--ID: 1713625933489-->
END%%
%%ANKI
Basic
What is the result of `%rax` after the following instructions?
```asm
movabsq $0x0011223344556677, %rax
movb $0xAA, %dl
movzbq %dl,%rax
```
Back: `0x00000000000000AA`
Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016.
<!--ID: 1713625933491-->
END%%
## Bibliography ## Bibliography
* Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016. * Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016.