CSE261 WHOLE SHABANG
Euclid's algorithm for GCD
gcd(a, b) = gcd((a mod b), b)
Fallacy of affirming the conclusion
"p→q is true, and q is true, so p must be true." (No, because F→T is true.) a.k.a ((p→q)∧q)→p
Translate the statement ∀x(C(x)∨ ∃y(C(y)∧F(x, y))) where C(x) is "x has a computer," and F(x,y) is "x and y are friends," and the domain for both x and y consists of all students in your school.
Every student in your school has a computer or has a friend who has a computer.
Propositional Satisfiability
A compound proposition is satisfiable if there is an assignment of truth values to its variables that makes it true. When no such assignments exist, the compound proposition is unsatisfiable -A compound proposition is unsatisfiable if and only if its negation is a tautology.
Consistent System Specifications
A list of propositions is consistent if it is possible to assign truth values to the proposition variables so that each proposition is true.
Product Rule
A procedure can be broken down into a sequence of two tasks. There are n1 ways to do the first task and n2 ways to do the second task. Then there are n1·n2 ways to do the procedure. *Example*: How many different license plates can be made if each plate contains a sequence of three uppercase English letters followed by three digits? *Solution*: By the product rule, there are 26*26*26*10*10*10 = 17,576,000 different possible license plates.
Pairwise relatively prime
A set of integers {a1,a2,...} is (pairwise) relatively prime if all pairs (ai, aj), for i≠j, are relatively prime
modulo inverse
An integer ā such that āa ≡ 1( mod m) is said to be an inverse of a modulo m. ex. 5 is an inverse of 3 modulo 7 since 5*3 = 15 ≡ 1(mod 7)
Divides
Def. *a|b* ⇔ "a divides b" ⇔ (∃c∈Z b=ac) If a and b are integers with a ≠ 0, we say that a divides b if there is an integer c such that b = ac, or equivalently, if b/a is an integer. e.g. 3 | -12 is true
If R(x,y)= "x relies upon y" translate ∀x(∃y R(x,y))= ∃y(∀x R(x,y))= ∃x(∀y R(x,y))= ∀y(∃x R(x,y))=
Everyone has someone to rely on. There is a person whom everyone relies on including him/herself There is a person who relies on everyone Everyone relies upon everybody (including themselves)
Fallacy of denying the hypothesis
"p→q is true, and p is false, so q must be false." (No, because F→T is true.) a.k.a ((p→q)∧¬p) →¬q
Number of rows in a truth table with n propositional variables
2^n
linear congruence
A congruence of the form ax ≡ b(mod m), where m is a positive integer, a and b are integers, and x is a variable, is called a linear congruence. The solutions to a linear congruence ax≡ b( mod m) are all integers x that satisfy the congruence.
The division algorithm
For any integer dividend *a* and divisor *d*≠0, there is a unique integer quotient *q* and remainder *r*∈N such that *a = dq + r* and *0 ≤ r < |d|* We can find q and r by: q =⎣a/d⎦ r = a−qd. q = a div d r = a mod d
Converse
The proposition q → p is called the converse of p → q.
Modular Congruence
a is congruent to b modulo m, written "a≡b (mod m)" iff m | a−b it's also equivalent to: (a−b) mod m = 0 a ≡ b (mod m) if and only if *a mod m* = *b mod m*
The Generalized Pigeonhole Principle
If N objects are placed into k boxes, then there is at least one box containing at least ⌈N/k⌉ objects. Example: Among 100 people there are at least ⌈100/12⌉ = 9 who were born in the same month.
does the modulo inverse exist?
If a and m are relatively prime integers and m >1, then an inverse of a modulo m exists.
Sum Rule
If a task can be done either in one of n1 ways or in one of n2, where none of the set of n1 ways is the same as any of the n2 ways, then there are n1 + n2 ways to do the task. *Example*: The mathematics department must choose either a student or a faculty member as a representative for a university committee. How many choices are there for this representative if there are 37 members of the mathematics faculty and 83 mathematics majors and no one is both a faculty member and a student. *Solution*: By the sum rule it follows that there are 37 + 83 = 120 possible ways to pick a representative.
Pigenhole principle
If k is a positive integer and k + 1 objects are placed into k boxes, then at least one box contains two or more objects. Corollary 1: A function f from a set with k + 1 elements to a set with k elements is not one-to-one.
Relative Primality
Integers a and b are called relatively prime or coprime iff their gcd = 1. - Example: Neither 21 nor 10 is prime, but they are coprime. 21=3·7 and 10=2·5, so they have no common factors > 1, so their gcd = 1.
Algebraic Manipulation of Congruences
NOTE: *Dividing* a congruence by an integer does not always produce a valid congruence.
Subtraction rule
Subtraction Rule: If a task can be done either in one of n1 ways or in one of n2 ways, then the total number of ways to do the task is n1 + n2 minus the number of ways to do the task that are common to the two different ways. Also known as, the principle of inclusion-exclusion
Negating Quantified Expressions ∀x (De Morgan's Laws for Quantifiers)
Symbolically ¬∀x J(x) and ∃x ¬J(x) are equivalent "Every student in your class has taken a course in Java." Negating the original statement gives "It is not the case that every student in your class has taken Java." This implies that "There is a student in your class who has not taken Java."
Negating Quantified Expressions ∃x (De Morgan's Laws for Quantifiers)
Symbolically ¬∃ x J(x) and ∀ x ¬J(x) are equivalent "There is a student in this class who has taken a course in Java." Negating the original statement gives "It is not the case that there is a student in this class who has taken Java." This implies that "Every student in this class has not taken Java"
Biconditional
The biconditional statement p ↔ q is the proposition "p if and only if q." The biconditional statement p ↔ q is true when p and q have the same truth values, and is false otherwise. Biconditional statements are also called bi-implications.
Greatest Common Divisor
The greatest common divisor gcd(a,b) of integers a,b (not both 0) is the largest (most positive) integer d that is a divisor both of a and of b.
Inverse
The proposition ¬p → ¬q is called the inverse of p → q
The divides relation
Theorem: ∀a,b,c ∈ Z: 1. a|0 2. (a|b ∧ a|c) → a | (b + c) 3. a|b → a|bc 4. (a|b ∧ b|c) → a|c
Logically equivalent (p≡q)
Two compound propositions p and q are logically equivalent if p↔q is a tautology.
Contradiction
a proposition which is always false. Example: p ∧¬p
Arguments in Propositional Logic
an argument is a sequence of propositions, all but the final proposition are called premises; the last statement is the conclusion. the argument is valid if the premises imply the conclusion
argument form
an argument that is valid no matter what propositions are substituted into its propositional variables. In an argument form, if the premises are p1,p2,...,pn and the conclusion is q then (p1 ∧p2 ∧ ...∧pn ) → q is a tautology.
Contrapositive
contrapositive of p → q is the proposition ¬q → ¬p
simple graph
each edge connects two different vertices and no two edges connect the same pair of vertices
Proof by contraposition (indirect proof)
ex. proving p → q by assuming ¬q and show ¬p is true also. If we give a direct proof of ¬q → ¬p then we have a proof of p →q
Vacuous proof
if we know p is false then, p → q is true
trivial proof p → q
if we know q is true, then p → q is true as well
Conditional statements are true if the conclusion is true, regardless of the hypothesis
"If Juan has a smartphone, then 2 + 3 = 5" is true from the definition of a conditional statement, because its conclusion is true. (The truth value of the hypothesis does not matter then.)
Terminology used to express p ↔ q
"p is necessary and sufficient for q" "if p then q, and conversely" "p iff q."
Logic and bit operators
1 = true 0 = false
Implication
The conditional statement p → q is the proposition "if p, then q." The conditional statement p → q is false when p is true and q is false, and true otherwise.
Least Common Multiple
lcm(a,b) of positive integers a, b, is the smallest positive integer that is a multiple both of a and of b.
Multigraphs
may have multiple edges connecting the same two vertices. When m different edges connect the vertices u and v, we say that {u,v} is an edge of multiplicity m
Conditional statements and their contrapositive always have the same truth value (the inverse and converse are also equivalent)
p → q and ¬q → ¬p are equivalent
Uniqueness Quantifier
∃!x P(x) means that P(x) is true for one and only one x in the universe of discourse (i.e. domain) "There is a unique x such that P(x)." "There is one and only one x such that P(x)"
"If a user is active, at least one network link will be available." Let A(u) represent "User u is active." Let S(n, x) represent "Network link n is in state x."
∃u A(u) →∃nS(n, available)
tautology
Proposition which is always true. Example: p ∨¬p
loop
edge that connects a vertex to itself
Mod
We can compute (a mod d) by: a − d *⎣a/d⎦