DM Midterm Fall-23 Notes
DM Midterm Fall-23 Notes
Key Terms
Logic is used for mathematical reasoning and verification.
Propositional Logic: The area of logic that deals with propositions is called propositional
logic.
Proposition is a declarative sentence that is either true or false, but not both.
Declarative sentence is a sentence that declares a fact
Not propositions
Questions
Commands
Logical operators
Precedence Operator Symbol Usage
1 Negation ¬ NOT
2 Conjunction ∧ AND
3 Disjunction ∨ OR
4 Exclusive OR ⊕ XOR
5 Conditional → if, then
6 Biconditional ↔ iff (XNOR)
Conditional Statements
Characteristics
Conditional connective
Hypothesis Conclusion
Equivalent expressions of p → q
p implies q
if p, then q
if p, q
p only if q
q if p
q when p
q whenever p
"Carol gets seasick whenever she is on a boat"
whenever p, q
q unless ¬ p
p is a sufficient condition for q
a sufficient condition for q is p
"A Sufficient condition for the warranty to be good is that you bought the
computer less than a year ago."
q is a necessary condition for p
"It is necessary to wash the boss's car to get promoted"
a necessary condition for p is q
Inverse ¬p → ¬q
Converse q → p
Contrapositive ¬q → ¬p
Biconditional
Let p and q be propositions. The biconditional statement p ↔ q is the proposition p if and
only if q
p ↔ q is only true when p and q have the same truth values (T, T or F, F)
p if and only if q
p is necessary and sufficient for q
Info
p ∨ ¬p
Contradiction
Contradiction is a compound proposition that is always false.
p ∧ ¬p
Contingency
Contingency is a compound proposition whose truth value is not constant.
p → ¬p
Logical Equivalences
Compound propositions that have the same truth values in all possible cases are called
logically equivalent
Notations
p ≡ q or p ⇔ q
Note
Once a value has been assigned to the variable x, the statement P(x) becomes a
proposition and has a truth value.
For example If P(x): x>3, then P(2): 4>3 , which is statement or proposition.
Example 1
Multivariable Predicates
Quantifiers
Domain
Universal Quantification
Denoted as ∀x P (x)
Reads for all P(x)
It is basically the conjunction of P(x) for all the domain
Example
Existential quantification
There is one or more elements in the domain for which a predicate is true.
Denoted as ∃x P (x)
Reads There is an x such that P(x)
It is basically the disjunction of P(x) for all the domain
Example
Truth values
Precedence
The quantifiers ∀ and ∃ have higher precedence that all logical operators from proposition
calculus.
Negating quantifiers
Synonyms
Terminology
A is the domain of f
B is the codomain of f
If f (a) = b
a is called the preimage of b
b is called the image of a
Domain: Set of values a function is allowed to take as input.
Codomain: Set of values a function is allowed to map to.
Range: Set of values a function actually maps (subset of the codomain).
OR set of all images of elements of A
Preimage: Subset of the domain.
Image: Subset of the range.
A function is one-to-one if all the elements in the domain have distinct images.
∀a ∀b (f (a) → a = b)
∀a ∀b (a ≠ b → f (a) ≠ f (b))
Example
Example
One-to-One correspondence (Bijection)
Example
9_Integer_Modular
Integers and Division
a divides b
b dividend
a|b = =
a divisor
multiple factor
a does not divides b
a ∤ b
a, b, c is all integers
Congruence
OR m divides a − b
a, b are integers
m is a positive integer
Ceaser Cipher
f (p) = (p + 3) mod 26
−1
f (p) = (p − 3) mod 26
Shift Cipher
f (p) = (p + k) mod 26
−1
f (p) = (p − k) mod 26
10_Prime_GCD_LCM
Fundamental Theorem of Arithmetic
Integer or Prime?