Set Theory and Logic Notation — Mathematical Foundations
Complete guide to set theory and logic notation in technical documentation. Learn sets, operations, logic symbols, quantifiers, and proof notation with KaTeX.
Introduction
Set theory and logic form the foundation of mathematics and computer science. From database queries to type systems, from algorithm correctness proofs to formal verification, these concepts appear throughout technical documentation.
This guide covers the essential notation for sets, set operations, propositional logic, predicate logic, and proof structures. You'll learn how to express these concepts clearly using KaTeX in your technical documentation.
Set Notation Basics
Sets are collections of distinct objects. Understanding set notation is essential for documenting data structures, type systems, and mathematical specifications.
Defining Sets
Set Definition Notation
Different ways to define and describe sets
Roster notation (listing elements):
A={1,2,3,4,5}Set-builder notation (defining by property):
B={x∈Z:x>0}Alternative set-builder with vertical bar:
C={x∣x2<10}Interval notation:
[a,b]={x∈R:a≤x≤b} (a,b)={x∈R:a<x<b}Special Sets
Standard Number Sets
Common mathematical sets with blackboard bold notation
Number sets:
- Natural numbers: N={1,2,3,…}
- Integers: Z={…,−2,−1,0,1,2,…}
- Rationals: Q={qp:p,q∈Z,q=0}
- Real numbers: R
- Complex numbers: C
Special sets:
- Empty set: ∅ or {}
- Universal set: U or U
- Power set: P(A) or 2A
Positive/negative variants:
Z+={1,2,3,…},R−={x∈R:x<0}Set Membership and Relations
Membership and Subset Relations
Expressing element membership and set relationships
Element membership:
- x∈A — x is an element of A
- x∈/A — x is not an element of A
Subset relations:
- A⊂B — A is a proper subset of B
- A⊆B — A is a subset of B (possibly equal)
- A⊃B — A is a proper superset of B
- A⊇B — A is a superset of B
- A⊂B — A is not a subset of B
Set equality:
A=B⟺(A⊆B)∧(B⊆A)Set Operations
Set operations are fundamental to database queries, type systems, and algorithm design. These operations combine or modify sets to create new sets.
Basic Operations
Union, Intersection, and Difference
Core set operations
Union (elements in either set):
A∪B={x:x∈A∨x∈B}Intersection (elements in both sets):
A∩B={x:x∈A∧x∈B}Set difference (elements in A but not B):
A∖B={x:x∈A∧x∈/B}Alternative notation: A−B
Symmetric difference (elements in exactly one set):
A△B=(A∖B)∪(B∖A)Alternative: A⊕B
Complement and Power Set
Complement and Power Set
Complement relative to universal set and power sets
Complement (elements not in A):
Ac=A=U∖A={x∈U:x∈/A}Power set (set of all subsets):
P(A)={S:S⊆A}Example:
P({1,2})={∅,{1},{2},{1,2}}Cardinality of power set:
∣P(A)∣=2∣A∣Cartesian Product
Cartesian Product
Ordered pairs from two sets
Cartesian product:
A×B={(a,b):a∈A∧b∈B}Example:
{1,2}×{a,b}={(1,a),(1,b),(2,a),(2,b)}n-fold Cartesian product:
An=A×A×⋯×A(n times)Cardinality:
∣A×B∣=∣A∣⋅∣B∣Indexed Operations
Indexed Unions and Intersections
Operations over families of sets
Indexed union:
i=1⋃nAi=A1∪A2∪⋯∪An i∈I⋃Ai={x:∃i∈I,x∈Ai}Indexed intersection:
i=1⋂nAi=A1∩A2∩⋯∩An i∈I⋂Ai={x:∀i∈I,x∈Ai}Disjoint union:
i∈I⨆AiPropositional Logic
Propositional logic deals with statements that are either true or false. It's the foundation for boolean algebra, circuit design, and programming conditionals.
Logical Connectives
Basic Logical Operators
Connectives for combining propositions
Negation (NOT):
¬P,¬P,∼P,PConjunction (AND):
P∧Q,P⋅Q,P&QDisjunction (OR):
P∨Q,P+QExclusive OR (XOR):
P⊕Q,P⊻QImplication (IF...THEN):
P⟹Q,P→Q,P⇒QBiconditional (IF AND ONLY IF):
P⟺Q,P↔Q,P⇔QTruth Tables
Truth Table Notation
Documenting logical operations with truth tables
Implication truth table:
| P | Q | P⟹Q |
|---|---|---|
| T | T | T |
| T | F | F |
| F | T | T |
| F | F | T |
De Morgan's Laws:
¬(P∧Q)≡¬P∨¬Q ¬(P∨Q)≡¬P∧¬QLogical Equivalences
Important Logical Equivalences
Common tautologies and equivalences
Contrapositive:
(P⟹Q)≡(¬Q⟹¬P)Material implication:
(P⟹Q)≡(¬P∨Q)Distributive laws:
P∧(Q∨R)≡(P∧Q)∨(P∧R) P∨(Q∧R)≡(P∨Q)∧(P∨R)Double negation:
¬(¬P)≡PAbsorption:
P∨(P∧Q)≡PPredicate Logic
Predicate logic extends propositional logic with quantifiers and predicates, allowing us to make statements about objects and their properties. It's essential for formal specifications and mathematical proofs.
Quantifiers
Universal and Existential Quantifiers
Expressing 'for all' and 'there exists'
Universal quantifier (for all):
∀x∈A,P(x)"For all x in A, property P(x) holds"
Existential quantifier (there exists):
∃x∈A,P(x)"There exists an x in A such that P(x) holds"
Unique existence:
∃!x,P(x)"There exists exactly one x such that P(x)"
Negation of quantifiers:
¬(∀x,P(x))≡∃x,¬P(x) ¬(∃x,P(x))≡∀x,¬P(x)Nested Quantifiers
Multiple Quantifiers
Combining quantifiers for complex statements
Order matters:
"For every x, there exists a y":
∀x,∃y,P(x,y)"There exists a y for every x":
∃y,∀x,P(x,y)Example - Continuity:
∀ϵ>0,∃δ>0,∀x,(∣x−a∣<δ⟹∣f(x)−f(a)∣<ϵ)Example - Limit definition:
x→alimf(x)=L⟺∀ϵ>0,∃δ>0,(0<∣x−a∣<δ⟹∣f(x)−L∣<ϵ)Predicates and Relations
Predicate Notation
Expressing properties and relations
Unary predicate (property):
P(x) — "x has property P"Binary predicate (relation):
R(x,y) — "x is related to y by R"Alternative notation: xRy
Examples:
- Prime(n) — "n is prime"
- x<y — "x is less than y"
- x≡y(modn) — "x is congruent to y modulo n"
Relation properties:
- Reflexive: ∀x,xRx
- Symmetric: ∀x,y,(xRy⟹yRx)
- Transitive: ∀x,y,z,(xRy∧yRz⟹xRz)
Proof Notation
Mathematical proofs require specific notation to express logical structure clearly. This notation is essential for formal verification, algorithm correctness, and mathematical documentation.
Proof Structure Symbols
Proof Notation
Symbols used in mathematical proofs
Therefore / Hence:
∴(therefore)Because / Since:
∵(because)QED / End of proof:
□■Q.E.D.Contradiction:
⊥(contradiction/false)Tautology:
⊤(tautology/true)Turnstile (proves/entails):
⊢(syntactic entailment) ⊨(semantic entailment)Proof by Contradiction
Proof by Contradiction Structure
Documenting indirect proofs
Proof by contradiction:
To prove P:
- Assume ¬P
- Derive a contradiction: Q∧¬Q
- Conclude P must be true
Example - 2 is irrational:
Assume 2=qp where gcd(p,q)=1.
Then 2=q2p2, so p2=2q2.
∴p2 is even, so p is even.
Let p=2k. Then 4k2=2q2, so q2=2k2.
∴q is even. But gcd(p,q)=1. ⊥
∴2 is irrational. □
Mathematical Induction
Induction Proof Structure
Documenting proofs by induction
Principle of Mathematical Induction:
To prove ∀n∈N,P(n):
- Base case: Prove P(1)
- Inductive step: Prove P(k)⟹P(k+1)
Example - Sum formula:
Claim: ∑i=1ni=2n(n+1)
Base case (n=1):
i=1∑1i=1=21⋅2✓Inductive step: Assume true for k. Then:
i=1∑k+1i=i=1∑ki+(k+1)=2k(k+1)+(k+1) =2k(k+1)+2(k+1)=2(k+1)(k+2)✓∴ By induction, the formula holds ∀n∈N. □
Applications in Technical Documentation
Here are practical examples of set theory and logic notation in common technical documentation scenarios.
Type Systems
Type Theory Notation
Set theory in programming type systems
Type as a set:
Int={…,−2,−1,0,1,2,…}Union types:
String∪NumberIntersection types:
Serializable∩ComparableSubtyping:
Integer⊆Number⊆ObjectGeneric types:
List⟨T⟩={[x1,x2,…]:xi∈T}Function types:
f:A→Bmeansf∈BADatabase Queries
Relational Algebra
Set operations in database theory
Selection (filter rows):
σage>21(Users)Projection (select columns):
πname, email(Users)Join:
Users⋈Users.id=Orders.user_idOrdersSet operations on tables:
ActiveUsers∪PremiumUsers AllUsers∖BannedUsersQuery composition:
πname(σstatus=’active’(Users))Algorithm Specifications
Formal Specifications
Logic in algorithm correctness
Precondition:
Pre:∀i∈[0,n),A[i]∈ZPostcondition:
Post:∀i∈[0,n−1),A[i]≤A[i+1]Loop invariant:
Inv:∀j∈[0,i),A[j]≤A[j+1]Termination:
Variant:n−i≥0∧decreasingHoare triple:
{P}S{Q}"If precondition P holds before executing S, then postcondition Q holds after."
Boolean Algebra in Circuits
Digital Logic
Boolean algebra for circuit design
Basic gates:
- AND: Y=A⋅B
- OR: Y=A+B
- NOT: Y=A
- XOR: Y=A⊕B
- NAND: Y=A⋅B
Boolean simplification:
A⋅B+A=A+B+A=1Sum of products:
F=ABC+ABC+ABCProduct of sums:
F=(A+B)(A+C)(B+C)Best Practices
aligned environment to align equals signs and implications for clarity.Common Mistakes
Quick Reference
| Concept | KaTeX Syntax | Result |
|---|---|---|
| Element of | x \in A | $x \in A$ |
| Subset | A \subseteq B | $A \subseteq B$ |
| Union | A \cup B | $A \cup B$ |
| Intersection | A \cap B | $A \cap B$ |
| Empty set | \emptyset | $\emptyset$ |
| For all | \forall x | $\forall x$ |
| There exists | \exists x | $\exists x$ |
| Negation | \neg P | $\neg P$ |
| AND | P \land Q | $P \land Q$ |
| OR | P \lor Q | $P \lor Q$ |
| Implies | P \implies Q | $P \implies Q$ |
| If and only if | P \iff Q | $P \iff Q$ |
| Therefore | \therefore | $\therefore$ |
Related Content
KaTeX Syntax Quick Reference — Math Equations in Markdown
Complete reference for KaTeX mathematical notation including common formulas, symbols, and usage patterns for technical documentation.
Calculus in Technical Documentation — Derivatives and Integrals
Master calculus notation in technical docs with KaTeX. Learn derivatives, integrals, limits, and differential equations for software, physics, and engineering documentation.
Using KaTeX in AutEng
Practical guide to integrating mathematical equations in your documentation
Ready to Start?
Start creating beautiful technical documentation with AutEng.
Get Started with AutEng