FoundationsDiscrete Mathematics
Logic & Set Theory
Summary of basic logic and set theory
Logic & Sets (Quick Summary)
1. Propositional Logic
Logic is reasoning to find truth (True/False). Heavily used in if-else conditions.
- Proposition: A sentence that can be definitively stated as true or false (e.g., "1+1=2" is true, but "x+1=2" is not a proposition because x is unknown).
- Operators:
AND (∧): True when both are trueOR (∨): True when at least one is trueNOT (¬): Inverts truth valueXOR (⊕): True when values differImplies (→): "If...then..." False only when "Premise is true, Conclusion is false" (T → F = F)
2. Set Theory
The foundation of data grouping, and the basis of Relational Databases (SQL).
- Set: A collection of unique data (e.g.,
A = {1, 2, 3}) - Operations:
Union (A ∪ B): Combines all elements of A and BIntersection (A ∩ B): Takes only elements common to A and B (Same principle asINNER JOIN)Difference (A \ B): Elements in A but not in BSubset (A ⊆ B): All elements in A must be in B