Mathematical Foundations of Computing
- Generalized pigeonhole principle
- For p pigeons and h holes,
- some hole will have at least ⌈hp⌉ pigeons in it
- some hole will have at most ⌊hp⌋ pigeons in it
- The "composition of f and g" is g∘f
- Translating first-order logic to English in a proof:
- Functions
- domain - function defined for every element of domain
- codomain - output is always in codomain. Not all els in codomain must have an associated output of the f tho
- f:A→B means f has domain A and codomain B
- Involution: a function f is an involution if ∀a∈A.f(f(a))=a
- Layman: apply twice gives same thing back. f is an involution if f(f(x))=x
- Surjective: ∀b∈B.∃a∈A.(f(a)=b)
- Layman: all outputs have an input that points to it
- Injective: ∀a1∈A.∀a2∈A.(a1=a2→f(a1)=f(a2))
- Equivalently ∀a1∈A.∀a2∈A.(f(a1)=f(a2)→a1=a2)
- Layman: one-to-one function. No no output maps to two inputs. Every output maps to 1 or 0 inputs.
- one-to-one function (not every codomain element needs to be used)
- horizontal line test in y=f(x) tells you if a function is injective
- bijective - injective and surjective, one-to-one correspondence (ever codomain element used)
- Function needs to be:
- ∀a∈A.∃b∈B.(f(a)=b) - total
- Defined on every element in domain, as opposed to partial, which means that f(a) is undefined for some a in the domain
- Partial - ∃a∈A.f(a) is undefined
- ∀a1∈A.∀a2∈A.(a1=a2→f(a1)=f(a2)) - deterministic (same input always produces same output)
- Proof explains why theorem is true
Disproof explains why claim is false (such as through a counterexample)
- Transformations
- ¬∀x.A
∃x.¬A
- ¬∃x.A
∀x.¬A
- ¬(A∧B)−2 ways
¬A∨¬B (De Morgan's Law)
A→¬B
- ¬(A∨B)
¬A∧¬B (De Morgan's Law)
- ¬(A→B)
A∧¬B
- ¬(A↔B)
¬A↔B
A↔¬B
- Mnemonics
- "Pushing" ¬ inward and flipping between operators (or vice versa):
- ∧ to →
- ∀ to ∃
- De Morgan's Law is like distributing the ¬ and flipping the operator (from ∧ to ∨ or vice versa)
- When applying ¬ to the biconditional (↔) negate either side and keep the operator same
- Others
- p→b→r same as p∧q→r
- The Aristotelian Forms
- All As are Bs: ∀x.(A(x)→B(x))
- No As are Bs: ∀x.(A(x)→¬B(x))
- Some As are Bs: ∃x.(A(x)∧B(x))
- Some As aren't Bs: ∃x.(A(x)∧¬B(x))
- First-order logic
- Terms
- Functions - object → object
Predicate - object → bool
- Connective - bool(s) → bool
- conjunction - ∧ (binary)
- disjunction - ∨
- implication - →
- biconditional - ↔
- negation - ¬ (unary)
- truth - ⊤ (nullary)
- falsity - ⊥
- Quantifier - bool → bool
- Examples
- = operates on objects, ↔ operates on predicates
- Some P is a Q translates to ∃x.(P(x)∧Q(x))
- All Ps are Qs translates to ∀x.(P(x)→Q(x))
- Try to pair ∃ with ∧ and ∀ with →
- Precedence (highest to lowest)
- ¬
- ∀ and ∃
- ∧ (and before or)
- ∨
- →
- → is right-associative so a→b→c is a→(b→c). Most operators like ∧ are left-associative.
- ↔
- Propositional logic
- Propositional variable
- Propositional connectives
- p→q is the same as ¬(p∧¬q)
- only false when p is true and q is false
- Universal statement - for all x, some [property] holds for x (mn works on x universally)
- Existential statement - there is some x where [property] holds for x (mn some x exists for it to work)
- Proof types
- Implication: If antecedent, then consequent.
- Assume step: assume the antecedent is true
- Want-to-show steps
- demonstrate that the consequent is true
- Reiterate what you wanted to show□
Derivations
