CMSI 2820: Discrete Mathematics Cheat Sheet
Quick reference guide for course material. Sections unlock when homework is assigned.
Useful Terminal Commands
Git Commands
| Command | Description | Example | ||
|---|---|---|---|---|
| git add [file/directory/path] | Add a file/directory to the staging area. Use "." to add all changes currently in the working directory. | git add . | git add farm.py | git add src/ |
| git commit -m "[commit message]" | Commit changes to the repository. The -m flag is used to add a commit message to the commit and avoid the custom terminal interface. | git commit -m "Completed HW1! 🎉" | git commit -m "Fixed bug in farm.py" | |
| git push | Push changes to the remote repository. This will update GitHub's cloud copy of the repository with the changes you have made locally. | git push | ||
| git pull | Pull changes from the remote repository. This will update your local copy of the repository with the changes that have been made to the cloud repository. | git pull |
Python Commands
| Command | Description | Example | |
|---|---|---|---|
| python -m pytest | Run the unit tests for the current project. | python -m pytest | |
| python [file.py] | Run the file.py file. On MacOS, you may need to use `python3` instead of `python`. | python proceedings.py | python3 test_farm.py |
| python -m pip install [package] | Install a package using Python's Package Manager. | python -m pip install pytest | python -m pip install numpy |
Logic
Logical Operators
| Operator | Symbol | Meaning | Example |
|---|---|---|---|
| Negation | ¬p or ~p | NOT p | If p is true, ¬p is false |
| Conjunction | p ∧ q | p AND q | True only if both are true |
| Disjunction | p ∨ q | p OR q | True if at least one is true |
| Implication | p → q | If p then q | False only if p is true and q is false |
| Biconditional | p ↔ q | p if and only if q | True if both have same truth value |
Key Logical Equivalences
- ¬(¬p) ≡ p (Double Negation)
- p ∧ q ≡ q ∧ p (Commutative)
- ¬(p ∧ q) ≡ ¬p ∨ ¬q (De Morgan's Laws)
- p → q ≡ ¬p ∨ q (Implication)