Induction and heaps.

c-declarations
Joshua Potter 2024-05-02 07:23:53 -06:00
parent 1ab9be2fd4
commit fc098cdaf2
12 changed files with 559 additions and 31 deletions

View File

@ -249,14 +249,14 @@
"filesystems/index.md": "cbd2b0290a3ba3b32abec4bd8bfefad5",
"filesystems/cas.md": "d41c0d2e943adecbadd10a03fd1e4274",
"git/objects.md": "c6b7e6a26666386790d25d4ece38175d",
"git/index.md": "83d2d95fc549d9e8436946c7bd058d15",
"git/index.md": "a4762d9f897f45ee13a2681828778820",
"encoding/integer.md": "2ab21152b9468f547ebee496e03bc410",
"_journal/2024-02-29.md": "f610f3caed659c1de3eed5f226cab508",
"_journal/2024-02/2024-02-28.md": "7489377c014a2ff3c535d581961b5b82",
"_journal/2024-03-01.md": "a532486279190b0c12954966cbf8c3fe",
"_journal/2024-02/2024-02-29.md": "0e502a2c8baf90c2f12859b03f10b5a1",
"algebra/sequences.md": "97c217823aacf8910a1a37bde694ecfe",
"algebra/sequences/index.md": "06df0fd12c2367995037ec4c26c51a53",
"algebra/sequences/index.md": "50de3bdd4d56af118cf3c8670ccf7fcc",
"_journal/2024-03-02.md": "08c3cae1df0079293b47e1e9556f1ce1",
"_journal/2024-03/2024-03-01.md": "70da812300f284df72718dd32fc39322",
"algebra/sequences/triangular-numbers.md": "39a84ee317d3760a2eda7279c83e921a",
@ -359,7 +359,7 @@
"_journal/2024-04-16.md": "0bf6e2f2a3afab73d528cee88c4c1a92",
"_journal/2024-04/2024-04-15.md": "256253b0633d878ca58060162beb7587",
"algebra/polynomials.md": "6e20029b44fe0d0c4f35ef8ee4874d82",
"algebra/sequences/delta-constant.md": "8292ae72cd1f36c649f3e224f2c0d853",
"algebra/sequences/delta-constant.md": "70ceb29a3ec0ebe2b58af20107a5a2d3",
"_journal/2024-04-19.md": "a293087860a7f378507a96df0b09dd2b",
"_journal/2024-04/2024-04-18.md": "f6e5bee68dbef90a21ca92a846930a88",
"_journal/2024-04/2024-04-17.md": "331423470ea83fc990c1ee1d5bd3b3f1",
@ -376,19 +376,25 @@
"_journal/2024-04/2024-04-23.md": "20514052da91b06b979cacb3da758837",
"_journal/2024-04-25.md": "10c98531cb90a6bc940ea7ae3342f98b",
"_journal/2024-04/2024-04-24.md": "4cb04e0dea56e0b471fc0e428471a390",
"algorithms/heaps.md": "9978cd8abebca41e8f123e0f8ea4c5c8",
"algorithms/heaps.md": "0cba4acb7667dcab80fa4e7778e86cc8",
"_journal/2024-04-26.md": "3ce37236a9e09e74b547a4f7231df5f0",
"_journal/2024-04/2024-04-25.md": "5a81123af29f8ebf0a0d28f820a3a52e",
"_journal/2024-04-28.md": "46726bf76a594b987c63ba8b9b6d13d3",
"_journal/2024-04/2024-04-27.md": "b0f3753821c232bf819b00fb49415bd0",
"_journal/2024-04/2024-04-26.md": "3ce37236a9e09e74b547a4f7231df5f0",
"algorithms/sorting/heapsort.md": "94ac936dac6c841b4d0c9b7df3eba0d3",
"_journal/2024-04-29.md": "f751826099e2c746605a4e562288d480",
"_journal/2024-04-29.md": "7888f4e9497c9d8bd6f4aa759d9abc4d",
"_journal/2024-04/2024-04-28.md": "b34a9fe3bccb1f224b96ca00e78ad061",
"programming/assertions.md": "cf7996590c9f5eefd6f7862c4f92132e",
"programming/text-sub.md": "003b8c32ae2f6767cb0d900f85196e67",
"programming/text-sub.md": "4bf5287353fc6571dd15be8f9f509bee",
"programming/equiv-trans.md": "fbadd593688e364ea92f74f23e54bcfc",
"programming/index.md": "bb082325e269a95236aa6aff9307fe59"
"programming/index.md": "bb082325e269a95236aa6aff9307fe59",
"_journal/2024-04-30.md": "369f98b9d91de89cc1f4f581bc530c0d",
"_journal/2024-04/2024-04-29.md": "b4fa2fd62e1b4fe34c1f71dc1e9f5b0b",
"proofs/induction.md": "ab9e939efe32a4fb7ef2a0808eeb569f",
"proofs/index.md": "51a7bc4e30b7a6cc0d4c5712ad603448",
"_journal/2024-05-01.md": "959ff67fe3db585ba6a7b121d853bbac",
"_journal/2024-05-02.md": "962e63ca2f80179253aaf52e6b2aeaad"
},
"fields_dict": {
"Basic": [

View File

@ -0,0 +1,15 @@
---
title: "2024-04-30"
---
- [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)
* Notes and exercises for chapter 2.4 "Solving Recurrence Relations" of "Discrete Mathematics: An Open Introduction".
* Primarily focused on the [[algebra/sequences/index#Characteristic Roots|characteristic root technique]].
* Read through chapter 2.5 "Induction" but want to create additional notes.

View File

@ -0,0 +1,13 @@
---
title: "2024-05-01"
---
- [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)
* Finished induction chapter of "Discrete Mathematics: An Open Introduction". Skimmed through chapter 3 "Symbolic Logic and Proofs".

View File

@ -0,0 +1,11 @@
---
title: "2024-05-02"
---
- [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

@ -44,14 +44,6 @@ Reference: Oscar Levin, *Discrete Mathematics: An Open Introduction*, 3rd ed., n
<!--ID: 1713580109125-->
END%%
%%ANKI
Basic
What is the base case of the recursive definition of the $k$th differences of $(a_n)$?
Back: $k = 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: 1713580109133-->
END%%
%%ANKI
Basic
What is the recurrence of the recursive definition of the $(k + 1)$st differences of $(a_n)$?
@ -92,6 +84,14 @@ Tags: calculus
<!--ID: 1713580109197-->
END%%
%%ANKI
Cloze
{Derivatives} are to continuous whereas {differences} are to discrete.
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).
Tags: calculus
<!--ID: 1714554400146-->
END%%
%%ANKI
Basic
What kind of mathematical expression do $\Delta^k$-constant sequences relate to?

View File

@ -169,13 +169,9 @@ Reference: Oscar Levin, *Discrete Mathematics: An Open Introduction*, 3rd ed., n
<!--ID: 1709302343255-->
END%%
## Solving Recurrence Relations
## Recurrence Relations
We use three different strategies for solving recurrences:
* Telescoping
* Iteration
* Characteristic Polynomials
To solve a recurrence relation means to find a closed form for the relation (with respect to initial conditions).
%%ANKI
Basic
@ -193,6 +189,10 @@ Reference: Oscar Levin, *Discrete Mathematics: An Open Introduction*, 3rd ed., n
<!--ID: 1713810280066-->
END%%
### Telescoping
Telescoping refers to the property of summations in which consecutive terms cancel out. We can use telescoping to solve recurrences of form $a_n = a_{n-1} + f(n)$ by noticing that: $$\begin{align*} a_1 - a_0 & = f(1) \\ a_2 - a_1 & = f(2) \\ \vdots \\ a_n - a_{n-1} & = f(n) \\ \hline a_n - a_0 & = \sum_{k=1}^n f(n) \end{align*}$$
%%ANKI
Basic
What does it mean for a sum to be telescoping?
@ -278,6 +278,10 @@ Reference: Oscar Levin, *Discrete Mathematics: An Open Introduction*, 3rd ed., n
<!--ID: 1713810280094-->
END%%
### Iteration
Iteration refers to the expansion of terms, starting at the initial conditions, in the hope of discovering a pattern. It is more general than [[#Telescoping]] is. Consider $a_n = a_{n-1} + f(n)$ again. We solve with iteration like so: $$\begin{align*} a_1 & = a_0 + f(1) \\ a_2 & = (a_0 + f(1)) + f(2) \\ \vdots \\ a_n & = (\cdots(a_0 + f(1)) + f(2)) + \cdots) + f(n) \\ \hline a_n & = a_0 + \sum_{k=1}^n f(n) \end{align*}$$
%%ANKI
Basic
What does it mean to solve a recurrence relation using iteration?
@ -343,6 +347,219 @@ Reference: Oscar Levin, *Discrete Mathematics: An Open Introduction*, 3rd ed., n
<!--ID: 1713998536738-->
END%%
### Characteristic Roots
When encountering **linear homogeneous recurrence relations with constant coefficients**, we can use the characteristic root technique to solve. We demonstrate with a quadratic **characteristic polynomial**, though this technique generalizes to higher-order polynomials as well.
Given recurrence relation $a_n + \alpha a_{n-1} + \beta a_{n-2} = 0$, the characteristic polynomial is $r^2 + \alpha r + \beta$. If $r_1$ and $r_2$ are distinct roots of the characteristic polynomial, then the solution to the recurrence relation is $$a_n = ar_1^n + br_2^n$$
where $a$ and $b$ are determined by the initial conditions. If the characteristic polynomial only has one root $r$, the solution is instead $$a_n = ar^n + bnr^n$$
%%ANKI
Basic
The characteristic root technique only works when solving what kind of recurrence relation?
Back: Linear homogeneous recurrence relations with constant coefficients.
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).
Tags: algebra::polynomial
<!--ID: 1714487050009-->
END%%
%%ANKI
Basic
What does "linear" refer to in "linear homogeneous recurrence relations with constant coefficients"?
Back: The recurrence relation is a *linear* combination of previous terms.
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).
Tags: algebra::polynomial
<!--ID: 1714487050016-->
END%%
%%ANKI
Basic
What does "homogeneous" refer to in "linear homogeneous recurrence relations with constant coefficients"?
Back: *Every* term in the relation is a multiple of previous terms.
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).
Tags: algebra::polynomial
<!--ID: 1714487050019-->
END%%
%%ANKI
Basic
Why isn't $a_n = 2a_{n-1} + 3a_{n-2}$ a linear homogeneous recurrence relation with constant coefficients?
Back: It is.
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).
Tags: algebra::polynomial
<!--ID: 1714487050023-->
END%%
%%ANKI
Basic
Why isn't $a_n = 2a_{n-1} \cdot 3a_{n-2}$ a linear homogeneous recurrence relation with constant coefficients?
Back: It is non-linear.
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).
Tags: algebra::polynomial
<!--ID: 1714487050026-->
END%%
%%ANKI
Basic
Why isn't $a_n = 2a_{n-1} + 3$ a linear homogeneous recurrence relation with constant coefficients?
Back: It is non-homogeneous.
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).
Tags: algebra::polynomial
<!--ID: 1714487050029-->
END%%
%%ANKI
Basic
Why isn't $a_n = 2a_{n-1} + na_{n-2}$ a linear homogeneous recurrence relation with constant coefficients?
Back: It has a nonconstant coefficient.
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).
Tags: algebra::polynomial
<!--ID: 1714487050032-->
END%%
%%ANKI
Basic
What is the most famous linear homoegeneous recurrence relation with constant coefficients?
Back: The Fibonacci sequence's recurrence relation.
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).
Tags: algebra::polynomial
<!--ID: 1714487050036-->
END%%
%%ANKI
Basic
Why might we guess the solution to e.g. $a_n = a_{n-1} + 6a_{n-2}$ is geometric?
Back: Every step of iteration multiplies a previous iteration by $6$.
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).
Tags: algebra::polynomial
<!--ID: 1714487050041-->
END%%
%%ANKI
Basic
How is $a_n = a_{n-1} + 6a_{n-2}$ factored to yield its characteristic polynomial?
Back: $r^{n-2}(r^2 - r - 6) = 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).
Tags: algebra::polynomial
<!--ID: 1714487050046-->
END%%
%%ANKI
Basic
What is the characteristic *equation* of $a_n = a_{n-1} + 6a_{n-2}$?
Back: $r^2 - r - 6 = 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).
Tags: algebra::polynomial
<!--ID: 1714487050051-->
END%%
%%ANKI
Basic
What is the characteristic *polynomial* of $a_n = a_{n-1} + 6a_{n-2}$?
Back: $r^2 - r - 6$
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).
Tags: algebra::polynomial
<!--ID: 1714487050055-->
END%%
%%ANKI
Basic
What is the characteristic *polynomial* of $a_n + \alpha a_{n-1} + \beta a_{n-2} = 0$?
Back: $r^2 + \alpha r + \beta$
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).
Tags: algebra::polynomial
<!--ID: 1714487050059-->
END%%
%%ANKI
Basic
What is the characteristic *equation* of $a_n + \alpha a_{n-1} + \beta a_{n-2} = 0$?
Back: $r^2 + \alpha r + \beta = 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).
Tags: algebra::polynomial
<!--ID: 1714487050063-->
END%%
%%ANKI
Basic
What is the characteristic *equation* of $a_n = \alpha a_{n-1} + \beta a_{n-2}$?
Back: $r^2 - \alpha r - \beta = 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).
Tags: algebra::polynomial
<!--ID: 1714487050067-->
END%%
%%ANKI
Basic
Given recurrence $a_n = \alpha a_{n-1} + \beta a_{n-2}$, what guess is used to derive the concept of a characteristic polynomial?
Back: The guessing of a geometric solution, e.g. $r^n$.
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).
Tags: algebra::polynomial
<!--ID: 1714487050071-->
END%%
%%ANKI
Basic
What distinguishes the characteristic polynomial from the characteristic equation of a recurrence relation?
Back: The latter sets the characteristic polynomial equal to $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).
Tags: algebra::polynomial
<!--ID: 1714487050075-->
END%%
%%ANKI
Basic
Using the characteristic root technique, what determines the form of the closed solution?
Back: The number of distinct roots of the characteristic polynomial.
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).
Tags: algebra::polynomial
<!--ID: 1714487050079-->
END%%
%%ANKI
Basic
Using the characteristic root technique, what determines the form of the closed solution?
Back: The number of distinct roots of the characteristic polynomial.
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).
Tags: algebra::polynomial
END%%
%%ANKI
Basic
Suppose the characteristic polynomial of $a_n = \alpha a_{n-1} + \beta a_{n-2}$ has distinct roots $r_1$ and $r_2$. What is its solution?
Back: $a_n = ar_1^n + br_2^n$ where $a$ and $b$ are determined by 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).
Tags: algebra::polynomial
<!--ID: 1714487050083-->
END%%
%%ANKI
Basic
Suppose the characteristic polynomial of $a_n = \alpha a_{n-1} + \beta a_{n-2}$ has single root $r$. What is its solution?
Back: $a_n = ar^n + bnr^n$ where $a$ and $b$ are determined by 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).
Tags: algebra::polynomial
<!--ID: 1714487050087-->
END%%
%%ANKI
Basic
If $a_n = \alpha a_{n-1} + \beta a_{n-2}$ has solution $a_n = ar^n + bnr^n$, how many roots does its characteristic polynomial have?
Back: One.
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).
Tags: algebra::polynomial
<!--ID: 1714487050090-->
END%%
%%ANKI
Basic
If $a_n = \alpha a_{n-1} + \beta a_{n-2}$ has solution $a_n = ar_1^n + br_2^n$, how many roots does its characteristic polynomial have?
Back: Two.
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).
Tags: algebra::polynomial
<!--ID: 1714487050095-->
END%%
## 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).

View File

@ -249,7 +249,7 @@ END%%
%%ANKI
Basic
When is `Min_HEAPIFY_DOWN` a no-op?
When is `MIN_HEAPIFY_DOWN` a no-op?
Back: When the current node is already smaller than both its children.
Reference: Thomas H. Cormen et al., Introduction to Algorithms, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022).
<!--ID: 1714399155448-->
@ -297,7 +297,7 @@ END%%
%%ANKI
Basic
What is the height of a binary heap?
What is the height of a binary heap defined?
Back: The height of the heap's root when viewed as a complete binary tree.
Reference: Thomas H. Cormen et al., Introduction to Algorithms, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022).
<!--ID: 1714403425300-->
@ -425,7 +425,7 @@ END%%
%%ANKI
Basic
Why does `BUILD_MIN_HEAP` "ignore" the external nodes of a heap?
Back: Because they are already max-heaps of size $1$.
Back: Because they are already min-heaps of size $1$.
Reference: Thomas H. Cormen et al., Introduction to Algorithms, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022).
<!--ID: 1714403425367-->
END%%

View File

@ -1,3 +1,128 @@
---
title: Git
TARGET DECK: Obsidian::STEM
FILE TAGS: git
tags:
- git
---
## Overview
Files in the working directory are in one of two states:
* **Tracked** - files that were in the last snapshot or newly staged.
* **Untracked** - files in the working directory that aren't tracked.
Tracked files may be unmodified, modified, or staged.
%%ANKI
Basic
Files in the working directory are in one of what two states?
Back: Tracked and untracked.
Reference: Scott Chacon, *Pro Git*, Second edition, The Experts Voice in Software Development (New York, NY: Apress, 2014).
<!--ID: 1714478450631-->
END%%
%%ANKI
Basic
What is a tracked file?
Back: A file that is staged or exists in the latest snapshot.
Reference: Scott Chacon, *Pro Git*, Second edition, The Experts Voice in Software Development (New York, NY: Apress, 2014).
<!--ID: 1714478450637-->
END%%
%%ANKI
Basic
What is an untracked file?
Back: A file that is neither staged nor exists in the latest snapshot.
Reference: Scott Chacon, *Pro Git*, Second edition, The Experts Voice in Software Development (New York, NY: Apress, 2014).
<!--ID: 1714478450640-->
END%%
%%ANKI
Basic
What three statuses can a tracked file be in?
Back: Unmodified, modified, and staged.
Reference: Scott Chacon, *Pro Git*, Second edition, The Experts Voice in Software Development (New York, NY: Apress, 2014).
<!--ID: 1714478450644-->
END%%
%%ANKI
Basic
What does it mean for a tracked file to be unmodified?
Back: The version in the working directory is the same as in the last snapshot.
Reference: Scott Chacon, *Pro Git*, Second edition, The Experts Voice in Software Development (New York, NY: Apress, 2014).
<!--ID: 1714478450647-->
END%%
%%ANKI
Basic
What does it mean for a tracked file to be modified?
Back: The version in the working directory is different from that in the last snapshot.
Reference: Scott Chacon, *Pro Git*, Second edition, The Experts Voice in Software Development (New York, NY: Apress, 2014).
<!--ID: 1714478450650-->
END%%
%%ANKI
Basic
What does it mean for a tracked file to be staged?
Back: The version in the working directory has been added to the index.
Reference: Scott Chacon, *Pro Git*, Second edition, The Experts Voice in Software Development (New York, NY: Apress, 2014).
<!--ID: 1714478450653-->
END%%
%%ANKI
Basic
How do you convert an untracked file to a tracked file?
Back: Stage the file.
Reference: Scott Chacon, *Pro Git*, Second edition, The Experts Voice in Software Development (New York, NY: Apress, 2014).
<!--ID: 1714478450657-->
END%%
%%ANKI
Basic
What operation converts an unmodified file to a modified file?
Back: Editing the file.
Reference: Scott Chacon, *Pro Git*, Second edition, The Experts Voice in Software Development (New York, NY: Apress, 2014).
<!--ID: 1714478450660-->
END%%
%%ANKI
Basic
You can convert an untracked file to a tracked file with what status?
Back: Staged.
Reference: Scott Chacon, *Pro Git*, Second edition, The Experts Voice in Software Development (New York, NY: Apress, 2014).
<!--ID: 1714478450664-->
END%%
%%ANKI
Cloze
An {1:unmodified} tracked file becomes a {2:modified} tracked file after {2:editing} the file.
Reference: Scott Chacon, *Pro Git*, Second edition, The Experts Voice in Software Development (New York, NY: Apress, 2014).
<!--ID: 1714478450668-->
END%%
%%ANKI
Cloze
A {1:modified} tracked file becomes a {2:staged} tracked file after {2:staging} the file.
Reference: Scott Chacon, *Pro Git*, Second edition, The Experts Voice in Software Development (New York, NY: Apress, 2014).
<!--ID: 1714478450673-->
END%%
%%ANKI
Cloze
A {1:staged} tracked file becomes an {2:unmodified} tracked file after {2:committing}.
Reference: Scott Chacon, *Pro Git*, Second edition, The Experts Voice in Software Development (New York, NY: Apress, 2014).
<!--ID: 1714478450678-->
END%%
%%ANKI
Cloze
An untracked file becomes a {1:staged} tracked file after {1:adding} the file.
Reference: Scott Chacon, *Pro Git*, Second edition, The Experts Voice in Software Development (New York, NY: Apress, 2014).
<!--ID: 1714478450683-->
END%%
## Bibliography
* Scott Chacon, *Pro Git*, Second edition, The Experts Voice in Software Development (New York, NY: Apress, 2014).

View File

@ -436,7 +436,7 @@ END%%
%%ANKI
Basic
Given valid expression $(b; [i]{\circ}s{:}e))$, what can be said about $i$?
Given valid expression $(b; [i]{\circ}s{:}e)$, what can be said about $i$?
Back: $i$ is in the domain of $b$.
Reference: Gries, David. *The Science of Programming*. Texts and Monographs in Computer Science. New York: Springer-Verlag, 1981.
<!--ID: 1714395640893-->
@ -444,7 +444,7 @@ END%%
%%ANKI
Basic
Given valid expression $(b; [i]{\circ}s{:}e))$, what is the type of $b$?
Given valid expression $(b; [i]{\circ}s{:}e)$, what is the type of $b$?
Back: A function.
Reference: Gries, David. *The Science of Programming*. Texts and Monographs in Computer Science. New York: Springer-Verlag, 1981.
<!--ID: 1714395640896-->
@ -452,7 +452,7 @@ END%%
%%ANKI
Basic
Given valid expression $(b; \epsilon{\circ}s{:}e))$, what is the type of $b$?
Given valid expression $(b; \epsilon{\circ}s{:}e)$, what is the type of $b$?
Back: A scalar or function.
Reference: Gries, David. *The Science of Programming*. Texts and Monographs in Computer Science. New York: Springer-Verlag, 1981.
<!--ID: 1714395640898-->
@ -461,7 +461,7 @@ END%%
%%ANKI
Basic
What is the base case of selector update syntax?
Back: Updates involving the null selector.
Back: $(b; \epsilon{:}g) = g$
Reference: Gries, David. *The Science of Programming*. Texts and Monographs in Computer Science. New York: Springer-Verlag, 1981.
<!--ID: 1714395640901-->
END%%
@ -476,7 +476,7 @@ END%%
%%ANKI
Basic
The nuil selector is the identity element of what operation?
The null selector is the identity element of what operation?
Back: Concatenation of sequences of subscripts.
Reference: Gries, David. *The Science of Programming*. Texts and Monographs in Computer Science. New York: Springer-Verlag, 1981.
<!--ID: 1714395640907-->
@ -525,7 +525,7 @@ END%%
%%ANKI
Basic
Let $b$ be an array. How is $b[i][j] := e$ rewritten using selector update syntax?
Back: $(b; [i][j]{:}e)$
Back: $b := (b; [i][j]{:}e)$
Reference: Gries, David. *The Science of Programming*. Texts and Monographs in Computer Science. New York: Springer-Verlag, 1981.
<!--ID: 1714395640930-->
END%%
@ -556,7 +556,7 @@ END%%
%%ANKI
Basic
Maintaining selector update syntax, how is $(c; 1{:}3)[1]$ rewritten with a selector?
Maintaining selector update syntax, how is $(c; 1{:}3)[1]$ more explicitly written with a selector?
Back: $(c; [1]{:}3)[1]$
Reference: Gries, David. *The Science of Programming*. Texts and Monographs in Computer Science. New York: Springer-Verlag, 1981.
<!--ID: 1714395640948-->

3
notes/proofs/index.md Normal file
View File

@ -0,0 +1,3 @@
---
title: Proofs
---

138
notes/proofs/induction.md Normal file
View File

@ -0,0 +1,138 @@
---
title: Induction
TARGET DECK: Obsidian::STEM
FILE TAGS: algebra::sequence proof
tags:
- proof
- sequence
---
## Overview
%%ANKI
Cloze
The {base case} is to induction whereas {initial conditions} are to recursive definitions.
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: 1714530152689-->
END%%
%%ANKI
Cloze
The {inductive case} is to induction whereas {recurrence relations} are to recursive definitions.
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: 1714530152697-->
END%%
%%ANKI
Basic
What standard names are given to the cases in an induction proof?
Back: The base case and inductive case.
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: 1714530152701-->
END%%
%%ANKI
Basic
Let $(a_n)_{n \geq 0} = P(n)$ and $P(n) \Leftrightarrow n \geq 2$. How is $(a_n)$ written with terms expanded?
Back: $F$, $F$, $F$, $T$, $T$, $\ldots$
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: 1714530152705-->
END%%
%%ANKI
Basic
If proving $P(n)$ by weak induction, what are the first five terms of the underlying sequence?
Back: $P(0)$, $P(1)$, $P(2)$, $P(3)$, $P(4)$, $\ldots$
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: 1714530152709-->
END%%
%%ANKI
Basic
What proposition is typically proven in the base case of an inductive proof?
Back: $P(n_0)$ for some $n_0 \geq 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: 1714530152713-->
END%%
%%ANKI
Basic
What proposition is typically proven in the inductive case of an inductive proof?
Back: $P(k) \Rightarrow P(k + 1)$ for all $k \geq n_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: 1714530152718-->
END%%
%%ANKI
Basic
In weak induction, what special name is given to the antecedent of $P(k) \Rightarrow P(k + 1)$?
Back: The inductive hypothesis.
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: 1714530152722-->
END%%
%%ANKI
Cloze
{Closed forms} are to recursive definitions as {direct} is to proofs.
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: 1714532476735-->
END%%
%%ANKI
Cloze
{Recurrence relations} are to recursive definitions as {induction} is to proofs.
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: 1714532476742-->
END%%
%%ANKI
Basic
What proof strategy is most directly tied to recursion?
Back: Induction.
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: 1714574131911-->
END%%
%%ANKI
Basic
Using typical identifiers, what is the inductive hypothesis of $P(n)$ using weak induction?
Back: Assume $P(k)$ for some $k \geq n_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: 1714574131942-->
END%%
%%ANKI
Basic
Using typical identifiers, what is the inductive hypothesis of $P(n)$ using strong induction?
Back: Assume $P(k)$ for all $k < n$.
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: 1714574131949-->
END%%
%%ANKI
Basic
Why is strong induction considered stronger than weak induction?
Back: It can be used to solve at least the same set of problems weak induction can.
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: 1714574131955-->
END%%
%%ANKI
Basic
What contradiction is introduced to explain why the strong induction assumption is valid?
Back: If $P(n)$ is not true for all $n$, there exists a *first* $n_0$ for which $\neg P(n_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: 1714574131963-->
END%%
%%ANKI
Basic
What distinguishes the base case of weak and strong induction proofs?
Back: The latter may have more than one base case.
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: 1714574131969-->
END%%
## 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).