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 true
    • OR (∨): True when at least one is true
    • NOT (¬): Inverts truth value
    • XOR (⊕): True when values differ
    • Implies (→): "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 B
    • Intersection (A ∩ B): Takes only elements common to A and B (Same principle as INNER JOIN)
    • Difference (A \ B): Elements in A but not in B
    • Subset (A ⊆ B): All elements in A must be in B

AI Knowledge Assistant

สวัสดีครับ! ผมคือ AI Assistant ประจำเว็บไซต์

คุณสามารถสอบถามข้อมูลด้าน Computer Science, Business, หรือ Finance ได้เลยครับ