Add C declarations and quantification.
parent
c3d266882f
commit
31c4a76589
|
@ -124,7 +124,10 @@
|
|||
"algorithms/index 1.md": "6fada1f3d5d3af64687719eb465a5b97",
|
||||
"binary/hexadecimal.md": "a9633bbc9b53cc8c16ce6e56022f62e0",
|
||||
"binary/index.md": "d41d8cd98f00b204e9800998ecf8427e",
|
||||
"_journal/2024-02-09.md": "60e953482e5d649a669d270a192ef7e5"
|
||||
"_journal/2024-02-09.md": "4a9ecfac710160c2d8d11077a739a97b",
|
||||
"c/types.md": "cf3e66e5aee58a94db3fdf0783908555",
|
||||
"logic/quantification.md": "b7cf646a8c33aa83f48ddc37c733fafb",
|
||||
"c/declarations.md": "381bb6ddbecd369b78012112b3a8e5de"
|
||||
},
|
||||
"fields_dict": {
|
||||
"Basic": [
|
||||
|
|
|
@ -11,3 +11,4 @@ title: "2024-02-09"
|
|||
- [ ] Log Work Hours (Max 3 hours)
|
||||
|
||||
* Logged information about prominent predefined `awk` variables.
|
||||
* Created flashcards for C data type declarations.
|
|
@ -0,0 +1,153 @@
|
|||
---
|
||||
title: Declarations
|
||||
TARGET DECK: Obsidian::STEM
|
||||
FILE TAGS: c
|
||||
tags:
|
||||
- c
|
||||
---
|
||||
|
||||
## Overview
|
||||
|
||||
Signed | Unsigned | 32-bit | 64-bit
|
||||
----------- | -------------- | ------ | ------
|
||||
signed char | unsigned char | 1 | 1
|
||||
short | unsigned short | 2 | 2
|
||||
int | unsigned | 4 | 4
|
||||
long | unsigned long | 4 | 8
|
||||
char * | - | 4 | 8
|
||||
float | - | 4 | 4
|
||||
double | - | 8 | 8
|
||||
|
||||
%%ANKI
|
||||
What two variants does a C integral type declaration have?
|
||||
Back: Signed and unsigned.
|
||||
Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016.
|
||||
END%%
|
||||
|
||||
%%ANKI
|
||||
What does it mean for an integer to be "signed"?
|
||||
Back: It can represent negative, zero, and positive values.
|
||||
Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016.
|
||||
END%%
|
||||
|
||||
%%ANKI
|
||||
What does it mean for an integer to be "unsigned"?
|
||||
Back: It can only represent nonnegative values.
|
||||
Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016.
|
||||
END%%
|
||||
|
||||
%%ANKI
|
||||
Cloze
|
||||
`char` *typically* represents {1} byte(s) on a 64-bit platform.
|
||||
Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016.
|
||||
<!--ID: 1707493017164-->
|
||||
END%%
|
||||
|
||||
%%ANKI
|
||||
Cloze
|
||||
`short` *typically* represents {2} byte(s) on a 64-bit platform.
|
||||
Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016.
|
||||
<!--ID: 1707493017210-->
|
||||
END%%
|
||||
|
||||
%%ANKI
|
||||
Cloze
|
||||
`int` *typically* represents {4} bytes(s) on a 64-bit platform.
|
||||
Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016.
|
||||
<!--ID: 1707493017215-->
|
||||
END%%
|
||||
|
||||
%%ANKI
|
||||
Cloze
|
||||
`unsigned` *typically* represents {4} bytes(s) on a 64-bit platform.
|
||||
Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016.
|
||||
<!--ID: 1707493017219-->
|
||||
END%%
|
||||
|
||||
%%ANKI
|
||||
Cloze
|
||||
`long` *typically* represents {8} bytes(s) on a 64-bit platform.
|
||||
Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016.
|
||||
<!--ID: 1707493017222-->
|
||||
END%%
|
||||
|
||||
%%ANKI
|
||||
Cloze
|
||||
`char *` *typically* represents {8} bytes(s) on a 64-bit platform.
|
||||
Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016.
|
||||
<!--ID: 1707493017224-->
|
||||
END%%
|
||||
|
||||
%%ANKI
|
||||
Cloze
|
||||
`float` *typically* represents {4} bytes(s) on a 64-bit platform.
|
||||
Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016.
|
||||
<!--ID: 1707493017227-->
|
||||
END%%
|
||||
|
||||
%%ANKI
|
||||
Cloze
|
||||
`double` *typically* represents {8} bytes(s) on a 64-bit platform.
|
||||
Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016.
|
||||
<!--ID: 1707493017229-->
|
||||
END%%
|
||||
|
||||
%%ANKI
|
||||
Basic
|
||||
Is declaration `int` signed or unsigned?
|
||||
Back: Signed.
|
||||
Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016.
|
||||
<!--ID: 1707493017232-->
|
||||
END%%
|
||||
|
||||
%%ANKI
|
||||
Basic
|
||||
How is declaration `unsigned` written more precisely?
|
||||
Back: `unsigned int`.
|
||||
Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016.
|
||||
<!--ID: 1707493017234-->
|
||||
END%%
|
||||
|
||||
%%ANKI
|
||||
Basic
|
||||
Is declaration `long` signed or unsigned?
|
||||
Back: Signed.
|
||||
Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016.
|
||||
<!--ID: 1707493017237-->
|
||||
END%%
|
||||
|
||||
%%ANKI
|
||||
Basic
|
||||
Is declaration `char` signed or unsigned?
|
||||
Back: Unknown.
|
||||
Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016.
|
||||
<!--ID: 1707493017239-->
|
||||
END%%
|
||||
|
||||
%%ANKI
|
||||
Cloze
|
||||
{1:`float`} has {2:4} byte precision whereas {2:`double`} has {1:8} byte precision.
|
||||
Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016.
|
||||
<!--ID: 1707493017242-->
|
||||
END%%
|
||||
|
||||
%%ANKI
|
||||
Cloze
|
||||
The C standard sets {1:lower bounds} on data type ranges, but does not set {1:upper bounds} (except with fixed-size types).
|
||||
Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016.
|
||||
<!--ID: 1707493017244-->
|
||||
END%%
|
||||
|
||||
Pointers have the same size as the machine's word size since it should be able to refer to any virtual address.
|
||||
|
||||
%%ANKI
|
||||
Basic
|
||||
*Why* does a pointer's size match the machine's word size?
|
||||
Back: Because it should be able to refer to any virtual address.
|
||||
Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016.
|
||||
<!--ID: 1707493017246-->
|
||||
END%%
|
||||
|
||||
## Reference
|
||||
|
||||
* Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016.
|
|
@ -0,0 +1,137 @@
|
|||
---
|
||||
title: Quantification
|
||||
TARGET DECK: Obsidian::STEM
|
||||
FILE TAGS: logic::quantification
|
||||
tags:
|
||||
- logic
|
||||
- quantification
|
||||
---
|
||||
|
||||
## Overview
|
||||
|
||||
* **Existential quantification** asserts the existence of a member in a set (denoted the **range**) satisfying a property. There may be multiple members that satisfy the property; so long as one does, the existential quantification is considered true.
|
||||
|
||||
%%ANKI
|
||||
Basic
|
||||
What symbol denotes existential quantification?
|
||||
Back: $\exists$
|
||||
Reference: Gries, David. *The Science of Programming*. Texts and Monographs in Computer Science. New York: Springer-Verlag, 1981.
|
||||
<!--ID: 1707494819964-->
|
||||
END%%
|
||||
|
||||
%%ANKI
|
||||
Basic
|
||||
How many members must satisfy a property in existential quantification?
|
||||
Back: At least one.
|
||||
Reference: Gries, David. *The Science of Programming*. Texts and Monographs in Computer Science. New York: Springer-Verlag, 1981.
|
||||
<!--ID: 1707494819967-->
|
||||
END%%
|
||||
|
||||
%%ANKI
|
||||
Basic
|
||||
$\exists x : S, P(x)$ is shorthand for what?
|
||||
Back: $\exists x, x \in S \land P(x)$
|
||||
Reference: Gries, David. *The Science of Programming*. Texts and Monographs in Computer Science. New York: Springer-Verlag, 1981.
|
||||
<!--ID: 1707494819968-->
|
||||
END%%
|
||||
|
||||
%%ANKI
|
||||
Basic
|
||||
What is the identity element of $\lor$?
|
||||
Back: $F$
|
||||
Reference: Gries, David. *The Science of Programming*. Texts and Monographs in Computer Science. New York: Springer-Verlag, 1981.
|
||||
<!--ID: 1707494819970-->
|
||||
END%%
|
||||
|
||||
* **Universal quantification** asserts that every member of a set satisfies a property.
|
||||
|
||||
%%ANKI
|
||||
Basic
|
||||
What symbol denotes universal quantification?
|
||||
Back: $\forall$
|
||||
Reference: Gries, David. *The Science of Programming*. Texts and Monographs in Computer Science. New York: Springer-Verlag, 1981.
|
||||
<!--ID: 1707494819971-->
|
||||
END%%
|
||||
|
||||
%%ANKI
|
||||
Basic
|
||||
How many members must satisfy a property in universal quantification?
|
||||
Back: All of them.
|
||||
Reference: Gries, David. *The Science of Programming*. Texts and Monographs in Computer Science. New York: Springer-Verlag, 1981.
|
||||
<!--ID: 1707494819973-->
|
||||
END%%
|
||||
|
||||
%%ANKI
|
||||
Basic
|
||||
$\forall x : S, P(x)$ is shorthand for what?
|
||||
Back: $\forall x, x \in S \Rightarrow P(x)$
|
||||
Reference: Gries, David. *The Science of Programming*. Texts and Monographs in Computer Science. New York: Springer-Verlag, 1981.
|
||||
<!--ID: 1707494819976-->
|
||||
END%%
|
||||
|
||||
%%ANKI
|
||||
Basic
|
||||
What is the identity element of $\land$?
|
||||
Back: $T$
|
||||
Reference: Gries, David. *The Science of Programming*. Texts and Monographs in Computer Science. New York: Springer-Verlag, 1981.
|
||||
<!--ID: 1707494819978-->
|
||||
END%%
|
||||
|
||||
%%ANKI
|
||||
Cloze
|
||||
{1:$\exists$} is to {2:$\lor$} as {2:$\forall$} is to {1:$\land$}.
|
||||
Reference: Gries, David. *The Science of Programming*. Texts and Monographs in Computer Science. New York: Springer-Verlag, 1981.
|
||||
<!--ID: 1707494819979-->
|
||||
END%%
|
||||
|
||||
%%ANKI
|
||||
Basic
|
||||
How is $\forall x : S, P(x)$ equivalently written in terms of existential quantification?
|
||||
Back: $\neg \exists x : S, \neg P(x)$
|
||||
Reference: Gries, David. *The Science of Programming*. Texts and Monographs in Computer Science. New York: Springer-Verlag, 1981.
|
||||
<!--ID: 1707494819981-->
|
||||
END%%
|
||||
|
||||
%%ANKI
|
||||
How is $\exists x : S, P(x)$ equivalently written in terms of universal quantification?
|
||||
Back: $\neg \forall x : S, \neg P(x)$
|
||||
Reference: Gries, David. *The Science of Programming*. Texts and Monographs in Computer Science. New York: Springer-Verlag, 1981.
|
||||
END%%
|
||||
|
||||
* **Counting quantification** asserts that a number of members of a set satisfy a property.
|
||||
|
||||
%%ANKI
|
||||
Basic
|
||||
What symbol denotes counting quantification (of exactly $k$ members)?
|
||||
Back: $\exists^{=k}$
|
||||
Reference: Gries, David. *The Science of Programming*. Texts and Monographs in Computer Science. New York: Springer-Verlag, 1981.
|
||||
<!--ID: 1707494819983-->
|
||||
END%%
|
||||
|
||||
%%ANKI
|
||||
Basic
|
||||
What symbol denotes counting quantification (of at least $k$ members)?
|
||||
Back: $\exists^{\geq k}$
|
||||
Reference: Gries, David. *The Science of Programming*. Texts and Monographs in Computer Science. New York: Springer-Verlag, 1981.
|
||||
<!--ID: 1707494819985-->
|
||||
END%%
|
||||
|
||||
%%ANKI
|
||||
Basic
|
||||
How is $\exists x : S, P(x)$ written in terms of counting quantification?
|
||||
Back: $\exists^{\geq 1} x : S, P(x)$
|
||||
Reference: Gries, David. *The Science of Programming*. Texts and Monographs in Computer Science. New York: Springer-Verlag, 1981.
|
||||
<!--ID: 1707494832056-->
|
||||
END%%
|
||||
|
||||
%%ANKI
|
||||
Basic
|
||||
How is $\forall x : S, P(x)$ written in terms of counting quantification?
|
||||
Back: Assuming $S$ has $k$ members, $\exists^{= k} x : S, P(x)$
|
||||
Reference: Gries, David. *The Science of Programming*. Texts and Monographs in Computer Science. New York: Springer-Verlag, 1981.
|
||||
<!--ID: 1707494832058-->
|
||||
END%%
|
||||
|
||||
## Reference
|
||||
|
||||
* Gries, David. *The Science of Programming*. Texts and Monographs in Computer Science. New York: Springer-Verlag, 1981.
|
Loading…
Reference in New Issue