0% found this document useful (0 votes)
553 views3 pages

Formula Sheet: Based On Dave Tompkins's Awesome CPSC 121 Handout

The document provides information on logic, sets, functions, and other mathematical concepts. It includes: 1) A truth table for logical operators such as AND, OR, XOR, and their definitions. 2) Laws of logical equivalence like identity, universal bound, and DeMorgan's laws. 3) Concepts of quantifiers, predicates, sets, functions, and their definitions. 4) Rules of inference for deductive reasoning including modus ponens, modus tollens, and generalization.

Uploaded by

JIANG YUHUAN
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
553 views3 pages

Formula Sheet: Based On Dave Tompkins's Awesome CPSC 121 Handout

The document provides information on logic, sets, functions, and other mathematical concepts. It includes: 1) A truth table for logical operators such as AND, OR, XOR, and their definitions. 2) Laws of logical equivalence like identity, universal bound, and DeMorgan's laws. 3) Concepts of quantifiers, predicates, sets, functions, and their definitions. 4) Rules of inference for deductive reasoning including modus ponens, modus tollens, and generalization.

Uploaded by

JIANG YUHUAN
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

Formula Sheet1

not p p and q p or q p xor q p nand q p nor q


p q ∼p p∧q p∨q p⊕q ∼(p ∧ q) ∼(p ∨ q)
F F T F F F T T
F T T F T T T F
T F T F T T T F
T T T T T F F F

Logical Equivalence (≡) Laws


Identity (I) p∧T ≡p p∨F ≡p
Universal Bound (UB) p∧F ≡F p∨T ≡T
Idempotent (ID) p∧p≡p p∨p≡p
Commutative (COM) p∧q ≡q∧p p∨q ≡q∨p
Associative (ASS) p ∧ (q ∧ r) ≡ (p ∧ q) ∧ r p ∨ (q ∨ r) ≡ (p ∨ q) ∨ r
Distributive (DIST) p ∨ (q ∧ r) ≡ (p ∨ q) ∧ (p ∨ r) p ∧ (q ∨ r) ≡ (p ∧ q) ∨ (p ∧ r)
Absorption (ABS) p ∨ (p ∧ q) ≡ p p ∧ (p ∨ q) ≡ p
Negation (NEG) p ∧ (∼ p) ≡ F p ∨ (∼ p) ≡ T
Double Negation (DNEG) ∼(∼ p) ≡ p
DeMorgan’s (DM) ∼(p ∧ q) ≡ (∼ p) ∨ (∼ q) ∼(p ∨ q) ≡ (∼ p) ∧ (∼ q)
Definition of Exclusive OR (XOR) p ⊕ q ≡ (p ∨ q)∧ ∼ (p ∧ q) p ⊕ q ≡ (p ∧ ∼ q) ∨ (∼ p ∧ q)
Definition of Implication (IMP) p→q ≡ ∼p ∨ q
Contrapositive (CONT) p→q ≡ ∼q→∼p
Definition of Biconditional (BIC) p ↔ q ≡ (p → q) ∧ (q → p) p ↔ q ≡ ∼(p ⊕ q)

Implication p → q if p then q p only if q p implies q q if p p q p→q p↔q


Biconditional p ↔ q p if, and only if, q p iff q F F T T
Contrapositive ∼q→∼p ≡ p→q F T T F
Converse q → p 6≡ p → q T F F F
Inverse ∼ p → ∼ q 6≡ p → q T T T T

Prove P ≡ Q
p→q p is sufficient for q q is necessary for p P ≡ ... (LAW)
p↔q p is sufficient and necessary for q ≡ ... (LAW)
MUX s is a when c is false, b when c is true s ≡ (a ∧ ∼ c) ∨ (b ∧ c) ≡Q

1
based on Dave Tompkins’s Awesome CPSC 121 Handout
Powers of 2
20 21 22 23 24 25 26 27 28 29 210 211 212 213 214 215 216
1 2 4 8 16 32 64 128 256 512 1,024 2,048 4,096 8,192 16,384 32,768 65,536

Binary Representation
x3 x2 x1 x0 HEX unsigned signed x3 x 2 x1 x0 HEX unsigned signed
0 0 0 0 0 0 0 1 0 0 0 8 8 -8
0 0 0 1 1 1 1 1 0 0 1 9 9 -7
0 0 1 0 2 2 2 1 0 1 0 A 10 -6
0 0 1 1 3 3 3 1 0 1 1 B 11 -5
0 1 0 0 4 4 4 1 1 0 0 C 12 -4
0 1 0 1 5 5 5 1 1 0 1 D 13 -3
0 1 1 0 6 6 6 1 1 1 0 E 14 -2
0 1 1 1 7 7 7 1 1 1 1 F 15 -1

Rules of Inference
Modus Ponens: [M.PON] p→q Modus Tollens: [M.TOL] p→q
p ∼q
∴q ∴ ∼p
Generalization: [GEN] p Specialization: [SPEC] p∧q
∴p∧q ∴p
Conjunction: [CONJ] p Elimination: [ELIM] p∨q
q ∼q
∴p∧q ∴p
Transitivity: [TRANS] p→q Proof by cases: [CASE] p→r
q→r q→r
∴ p→r ∴ (p ∨ q) → r
Resolution: [RES] p∨q Contradiction: [CONT] p→F
∼p ∨ r ∴p
∴ (q ∨ r)

Argumets Validity
Premises: w
x (w ∧ x ∧ y) → z
y is a tautology
Conclusion: ∴z


Domains
Z Integers {· · · , −3, −2, −1, 0, 1, 2, 3, · · ·}
Z+ Positive Integers {x ∈ Z, x > 0}
Z∗ Non-zero Integers {x ∈ Z, x 6= 0}
Q Rational Numbers { ab | a ∈ Z, b ∈ Z∗ }
Q̄ Irrational Numbers {x ∈ R, x 6∈ Q}√
R Real Numbers {· · · , − 20
6
, 0, 1, 2, π, 100
3
, · · ·}
N0 Natural Numbers {0, 1, 2, 3, · · ·}
N1 {1, 2, 3, · · ·}
Quantifiers
∀x ∈ U, P (x) ⇒ P(x) is true for all (every) x in U
∃x ∈ U, P (x) ⇒ P(x) is true for at least one x in U
∼ ∀x ∈ D, P (x) ≡ ∃x ∈ D, ∼ P (x)
∼ ∃x ∈ D, P (x) ≡ ∀x ∈ D, ∼ P (x)
∀x ∈ D, Q(x) ≡ ∀x ∈ U, P (x) → Q(x)
∃x ∈ D, Q(x) ≡ ∃x ∈ U, P (x) ∧ Q(x)

Handy Predicates
Even(x) ⇔ ∃k ∈ Z, x = 2k
Odd(x) ⇔ ∃k ∈ Z, x = 2k + 1
P rime(x) ⇔ ∀k, m ∈ Z, (x = km) →((m = x) ∨ (m = 1))

Sets
A ⊆ B ⇔ ∀x ∈ U, (x ∈ A) →(x ∈ B) A = B ⇔ (A ⊆ B) ∧ (B ⊆ A)
A ∪ B = {x ∈ U | (x ∈ A) ∨ (x ∈ B)} A ∩ B = {x ∈ U | (x ∈ A) ∧ (x ∈ B)}
A − B = {x ∈ U | (x ∈ A) ∧ (x 6∈ B)} AC = {x ∈ U | (x 6∈ A)}
P(A) = {X ∈ U | X ⊆ A} A × B = {(a, b)|(a ∈ A) ∧ (b ∈ B)}

Function f : X → Y
X is the domain of f
Y is the co-domain of f
range or image of f = {y ∈ Y |∃x ∈ X, f (x) = y}
f is one-to-one (injective) ⇔ ∀x1 , x2 ∈ X, (f (x1 ) = f (x2 )) →(x1 = x2 )
f is onto (surjective) ⇔ ∀y ∈ Y, ∃x ∈ X, f (x) = y
f is a one-to-one correspondence (bijection) ⇔ (f is one-to-one) ∧ (f is onto)

Regular Expressions
. Matches any character
[xy] Matches one character from those listed
[x − z] Matches one character from the range of characters listed
[ˆxy] Matches one character from those not listed
| Matches one element from those separated by pipes
∗ Matches the previous element 0 or more times
+ Matches the previous element 1 or more times
? Matches the previous element 0 or 1 time
{m, n} Matches the preceding element from m to n times
\s Matches a whitespace character
\d Matches a digit, same as [0-9]
\w Matches an alphanumeric character, including “ ”

You might also like