From 9529d00b38f86633b41f39a8c0a384d048abb530 Mon Sep 17 00:00:00 2001 From: Joshua Potter Date: Mon, 12 Feb 2024 14:42:11 -0700 Subject: [PATCH] Preliminary notes on Boolean algebra. --- .../plugins/obsidian-to-anki-plugin/data.json | 7 +- notes/_journal/2024-02-12.md | 3 +- notes/logic/boolean-algebra.md | 164 ++++++++++++++++++ notes/logic/equiv-trans.md | 10 +- 4 files changed, 175 insertions(+), 9 deletions(-) create mode 100644 notes/logic/boolean-algebra.md diff --git a/notes/.obsidian/plugins/obsidian-to-anki-plugin/data.json b/notes/.obsidian/plugins/obsidian-to-anki-plugin/data.json index 3021710..1c5623b 100644 --- a/notes/.obsidian/plugins/obsidian-to-anki-plugin/data.json +++ b/notes/.obsidian/plugins/obsidian-to-anki-plugin/data.json @@ -114,7 +114,7 @@ "_journal/2024-02-02.md": "a3b222daee8a50bce4cbac699efc7180", "_journal/2024-02-01.md": "3aa232387d2dc662384976fd116888eb", "_journal/2024-01-31.md": "7c7fbfccabc316f9e676826bf8dfe970", - "logic/equiv-trans.md": "76f2416d78d6f44e5a7d88b806da6be9", + "logic/equiv-trans.md": "ba87bed095b095540393db90ad350da0", "_journal/2024-02-07.md": "8d81cd56a3b33883a7706d32e77b5889", "algorithms/loop-invariants.md": "cbefc346842c21a6cce5c5edce451eb2", "algorithms/loop-invariant.md": "d883dfc997ee28a7a1e24b995377792b", @@ -145,13 +145,14 @@ "_journal/2024-02-11.md": "afee9f502b61e17de231cf2f824fbb32", "binary/endianness.md": "29c0aea671aa25aead580e9431aba8cc", "logic/normal-form.md": "f8fd5ea205dfb7e331356b0574f0fe14", - "_journal/2024-02-12.md": "808cff0e8c1d9992ed65fed613afc98d", + "_journal/2024-02-12.md": "240d17f356305de9c0c00282b2931acd", "_journal/2024-02/2024-02-11.md": "afee9f502b61e17de231cf2f824fbb32", "encoding/ascii.md": "c01e50f96d0493d94dc4d520c0b6bb71", "encoding/index.md": "071cfa6a5152efeda127b684f420d438", "c/strings.md": "38f9cf9e2325565589f62e191221a83a", "logic/truth-tables.md": "7892ceaa416c9a65acc79ca1e6ff778f", - "logic/short-circuit.md": "26d300f407f14883022d0ef8dc4f7300" + "logic/short-circuit.md": "26d300f407f14883022d0ef8dc4f7300", + "logic/boolean-algebra.md": "c5d699d407e03d280aa1f201bc3e8b02" }, "fields_dict": { "Basic": [ diff --git a/notes/_journal/2024-02-12.md b/notes/_journal/2024-02-12.md index badf37c..65de11c 100644 --- a/notes/_journal/2024-02-12.md +++ b/notes/_journal/2024-02-12.md @@ -11,4 +11,5 @@ title: "2024-02-12" - [ ] Log Work Hours (Max 3 hours) * Read 삼 년 고개 (Three-Years Hill). -* Notes on ASCII and C-style strings. \ No newline at end of file +* Notes on ASCII and C-style strings. +* Elaborated on each of the submodules in Gus and my "Soft Skills Workshop". \ No newline at end of file diff --git a/notes/logic/boolean-algebra.md b/notes/logic/boolean-algebra.md new file mode 100644 index 0000000..4a283e4 --- /dev/null +++ b/notes/logic/boolean-algebra.md @@ -0,0 +1,164 @@ +--- +title: Boolean Algebra +TARGET DECK: Obsidian::STEM +FILE TAGS: logic::boolean +tags: + - logic + - boolean +--- + +## Overview + +**Boolean algebra** refers to an algebraic system characterised by a set of axioms. This is something I'll explore further, probably after reading more on abstract algebra. The basic operations of Boolean algebra are negation ($\neg$), conjunction ($\land$), and disjunction ($\lor$). + +%%ANKI +Basic +What C bit-level operator corresponds to $\neg$? +Back: `~` +Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016. +Tags: binary c + +END%% + +%%ANKI +Basic +What C bit-level operator corresponds to $\land$? +Back: `&` +Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016. +Tags: binary c + +END%% + +%%ANKI +Basic +What C bit-level operator corresponds to $\lor$? +Back: `|` +Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016. +Tags: binary c + +END%% + +%%ANKI +Basic +What C bit-level operator corresponds to $\oplus$? +Back: `^` +Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016. +Tags: binary c + +END%% + +%%ANKI +Basic +What is the value of `~0b00001111`? +Back: `0b11110000` +Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016. +Tags: binary c + +END%% + +%%ANKI +Basic +What is the value of `0b00001111 & 0b11111111`? +Back: `0b00001111` +Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016. +Tags: binary c + +END%% + +%%ANKI +Basic +What is the value of `0b00001111 | 0b11111111? +Back: `0b11111111` +Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016. +Tags: binary c + +END%% + +%%ANKI +Basic +What is the value of `0b00001111 ^ 0b11111111`? +Back: `0b11110000` +Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016. +Tags: binary c + +END%% + +%%ANKI +Basic +How do bit vectors represent finite sets? +Back: A `1` bit-value indicates membership at the given index. +Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016. +Tags: binary + +END%% + +%%ANKI +Basic +What C bit-level operator corresponds to set complement? +Back: `~` +Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016. +Tags: binary c set + +END%% + +%%ANKI +Basic +What C bit-level operator corresponds to $\cup$? +Back: `|` +Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016. +Tags: binary c set + +END%% + +%%ANKI +Basic +What C bit-level operator corresponds to $\cap$? +Back: `&` +Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016. +Tags: binary c set + +END%% + +%%ANKI +Basic +What is a bit mask? +Back: A bit pattern that selects certain bits of a data type. +Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016. + +END%% + +%%ANKI +Basic +What hexadecimal bit mask returns the least significant byte of a word? +Back: `0xFF` +Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016. + +END%% + +%%ANKI +Basic +What portable expression yields a mask of all ones, regardless of data type? +Back: `~0` +Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016. + +END%% + +%%ANKI +Basic +Why might you prefer `~0` over e.g. `0xFFFFFFFF`? +Back: The former is independent of data type. +Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016. + +END%% + +%%ANKI +Basic +Given `int32_t x = 0x89ABCDEF`, what is the value of `x & 0xFF`? +Back: `0x000000EF` +Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016. + +END%% + +## References + +* Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016. \ No newline at end of file diff --git a/notes/logic/equiv-trans.md b/notes/logic/equiv-trans.md index ab41bbd..edf8fbd 100644 --- a/notes/logic/equiv-trans.md +++ b/notes/logic/equiv-trans.md @@ -122,7 +122,7 @@ END%% %%ANKI Basic -What C operator corresponds to $\neg$? +What C logical operator corresponds to $\neg$? Back: `!` Reference: Gries, David. *The Science of Programming*. Texts and Monographs in Computer Science. New York: Springer-Verlag, 1981. Tags: c @@ -131,7 +131,7 @@ END%% %%ANKI Basic -What C operator corresponds to $\land$? +What C logical operator corresponds to $\land$? Back: There isn't one. Reference: Gries, David. *The Science of Programming*. Texts and Monographs in Computer Science. New York: Springer-Verlag, 1981. Tags: c @@ -140,7 +140,7 @@ END%% %%ANKI Basic -What C operator corresponds to $\lor$? +What C logical operator corresponds to $\lor$? Back: There isn't one. Reference: Gries, David. *The Science of Programming*. Texts and Monographs in Computer Science. New York: Springer-Verlag, 1981. Tags: c @@ -149,7 +149,7 @@ END%% %%ANKI Basic -What C operator corresponds to $\Rightarrow$? +What C logical operator corresponds to $\Rightarrow$? Back: There isn't one. Reference: Gries, David. *The Science of Programming*. Texts and Monographs in Computer Science. New York: Springer-Verlag, 1981. Tags: c @@ -158,7 +158,7 @@ END%% %%ANKI Basic -What C operator corresponds to $\Leftrightarrow$? +What C logical operator corresponds to $\Leftrightarrow$? Back: `==` Reference: Gries, David. *The Science of Programming*. Texts and Monographs in Computer Science. New York: Springer-Verlag, 1981. Tags: c