Mathematical Notation and Logic
Mathematics uses a concise symbolic language to express complex ideas. Understanding this notation is essential for reading and writing formal proofs.
Logical Operators
The building blocks of mathematical logic are propositions and operators:
- Negation (): “Not “.
- Conjunction (): ” and “.
- Disjunction (): ” or “.
- Implication (): “If , then “.
- Equivalence (): ” if and only if “.
python
1def logical_implication(p, q):
2 # P => Q is equivalent to (not P) or Q
3 return (not p) or q
4
5print("Truth Table for P => Q")
6print("P | Q | P => Q")
7for p in [True, False]:
8 for q in [True, False]:
9 print(f"{p} | {q} | {logical_implication(p, q)}")
Quantifiers
Quantifiers allow us to make statements about sets of elements:
- Universal Quantifier (): “For all”.
- Existential Quantifier (): “There exists”.
python
1numbers = [1, 2, 3, 4, 5]
2
3# For all x in numbers, x > 0
4all_positive = all(x > 0 for x in numbers)
5print(f"Universal (forall x > 0): {all_positive}")
6
7# There exists x in numbers such that x is even
8exists_even = any(x % 2 == 0 for x in numbers)
9print(f"Existential (exists x even): {exists_even}")
What is the negation of 'For all x, P(x) is true'?
Set Notation
- : ” is an element of “.
- : ” is a subset of “.
- : Intersection.
- : Union.