CS 220 Chapters 1-4

Pataasin ang iyong marka sa homework at exams ngayon gamit ang Quizwiz!

Ordered n-tuple

The ordered n-tuple (a1, a2, a3, ..., an) is an ordered collection of objects. Two ordered n-tuples (a1, a2, a3, ..., an) and (b1, b2, b3, ..., bn) are equal iff they contain exactly the same elements in the same order, i.e., ai = bi for 1 ≤ i ≤ n.

Universal Statement Proof

The proof has to show that all x in the domain satisfies P(x). Giving an example is not sufficient. Negation: Giving an example of x where P(x) = false is sufficient.

Range

The range of f : A → B is the set of all images of elements of A.

Example: P = {Linda, Max, Kathy, Peter}, C = {Boston, New York, Hong Kong, Moscow} f(Linda) = Moscow f(Max) = Boston f(Kathy) = Hong Kong f(Peter) = New York

The range of f is c

Power Sets

2A or P(A) - "the power set of A" 2A = {B : B ⊆ A} - (contains all subsets of A) Examples: A = {x, y, z} 2A = {∅, {x}, {y}, {z}, {x, y}, {x, z}, {y, z}, {x, y, z}} A = ∅ 2A = {∅} Note: |A| = 0, |2A|= 1 In general, |2A| = 2|A|

Odd number

2k+1, where k is another integer

Even number

2k, where k is another integer

set-builder notation

A = {x ∈ U : P(x)} - "set of all x such that P(x)" Example: A = {x ∈ ℕ : x > 7} = {8, 9, 10, ...}

Axiom

A basic assumption about mathematical structures that need no proof

Set

A collection of objects/elements.The order of elements is meaningless. It does not matter how often the same element is listed (generally there are no repetitions).

Conjunctive Normal Form (CNF)

A conjunctive normal form (CNF) expression has the form: c1 ∙ c2 ∙ ... ∙ cm where each cj for j {1, ..., m} is a sum of literals. Example: (the complement operator can be applied to individual literals only)

Counterexample

A counterexample to ∀x P(x) is an object c so that P(c) is false. Statements such as ∀x (P(x) → Q(x)) can be disproved by simply providing a counterexample. Statement: "All birds can fly." Disproved by counterexample: Penguin. (This is a way to disprove things).

Disjunctive Normal Form (DNF)

A disjunctive normal form (DNF) expression has the form: c1 + c2 + ... + cm where each cj for j ∈ {1, ..., m} is a product of literals. Example: (the complement operator can be applied to individual literals only)

Bijective Function

A function f : A → B is a one-to-one correspondence, or a bijection, if and only if it is both one-to-one and onto (both injective and surjective). Obviously, if f is a bijection and A and B are finite sets, then |A| = |B|.

Onto/Surjective Functions

A function f : A → B is called onto, or surjective, if and only if for every element b ∈ B there is an element a ∈ A with f(a) = b. In other words, f is onto if and only if its range is its entire codomain.

Strictly Increasing/Decreasing Functions

A function f : A → B with A, B ⊆ R is called strictly increasing, if ∀x,y ∈ A(x < y → f(x) < f(y)) and strictly decreasing, if ∀x,y ∈ A(x < y → f(x) > f(y)) Obviously, a function that is either strictly increasing or strictly decreasing is one-to-one (injective).

Function

A function f from a set A to a set B is an assignment of exactly one element of B to each element of A. Example: f(a) = b

Boolean Function of Degree n

A function from Bn, the set {(x1, x2, ..., xn) | xi ∈ B, 1 ≤ i ≤ n}, to B. Boolean functions can be represented using expressions made up from Boolean variables and Boolean operations.

One-to-One Function, Injection

A function is one-to-one (injective) if and only if it does not map two distinct elements of A onto the same element of B. ∀x,y ∈ A (f(x) = f(y) → x = y)

Partition

A partition of a set S is a collection of disjoint nonempty subsets of S that have S as their union. In other words, a collection of subsets Ai, i ∈ I, forms a partition of S if and only if: 1.Ai ≠ ∅ for i ∈ I (subsets are not empty) 2.Ai ∩ Aj = ∅, if i ≠ j (subsets are disjoint) 3.⋃i∈I Ai = S (S is the union)

Proof

A sequence of statements that form an argument used to demonstrate that a particular statement is true

Logical Proof

A sequence of steps, each of which consists of a proposition and a justification. Note: if the proposition in a step is a hypothesis, then the justification is just hypothesis

Functional Completeness

A set of operations is functionally complete if any Boolean function can be expressed using only operations from the set. We know that the set {addition, multiplication, complement} is functionally complete because any Boolean function can be expressed in DNF which only uses addition, multiplication, and complement operations.

Lemma

A simple theorum used as an intermediate result in the proof of another theorum

Theorum

A statement that can be proven to be true

Argument

A statement that consists of 1 or more hypotheses and a conclusion. Only valid if the conclusion is true whenever the hypotheses are all true, otherwise it is invalid. However, if any hypothesis is false, even a valid argument can lead to an incorrect conclusion.

Conjecture

A statement whose truth value is unknown

Summations

A summation represents the sum am + am+1 + am+2 + ... + an The variable j is called the index of summation, running from its lower limit m to its upper limit n. We could have used any other letter to denote this index. Double summations are worked on from the inside out. Formula: j = [n(n+1)]/2

Boolean Variable

A variable that assumes values from set B={0, 1}

intersection

A ∩ B = {x : x ∈ A ∧ x ∈ B} Example: A = {a, b} B = {b, c, d} A ∩ B = {b} Two sets are called disjoint if they share no elements: A ∩ B = ∅

Subsets

A ⊆ B ⇔ ∀x (x ∈ A → x ∈ B) A ⊆ B "A is a subset of B" A ⊆ B if and only if every element of A is also an element of B.

Union

A ⋃ B = {x : x ∈ A ∨ x ∈ B} Example: A = {a, b} B = {b, c, d} A ⋃ B = {a, b, c, d}

Predicate Logic

Adds additional symbols and quantifiers that allow us to express more ideas in logic

Symmetric Difference

The symmetric difference between two sets A and B contains elements of A or B, but not both: A ⊕ B = {x : (x ∈ A ∨ x ∈ B) ∧ x∉ A ⋂ B} Example: A = {a, b} B = {b, c, d} A ⊕ B = {a, c, d}

a ∈ A

a is an element of A

a ∉ A

a is not an element of A

Proposition

a statement that is either true or false (not both)

Example: Gary is either intelligent or a good actor. If Gary is intelligent, then he can count from 1 to 10. Gary can only count from 1 to 2. Therefore, Gary is a good actor.

i: Gary is intelligent. a: Gary is a good actor. c: Gary can count from 1 to 10. Logic: i V a, i → c, ¬c | ∴ a Proof: 1. i → c (Hypothesis) 2. ¬c (Hypothesis) 3. ¬i (Modus Tollens, steps 1, 2) 4. i V a (Hypothesis) 5. a (Disjunctive Syllogism, steps 4, 3)

Set Equality

two sets are equal if and only if they have the same elements

Subset Rules

∅ ⊆ A for any A. A ⊆ A for any A.

How to write a proof

●Always indicate the start and the end of the proof. ●Use complete sentences. ●State your assumptions and give a roadmap. ●Introduce each variable when the variable is used for the first time. ●A block of equations should be introduced with English text and each step that does not follow from algebra should be justified.

Boolean Algebra

All the properties of Boolean functions and expressions that we have discovered also apply to other mathematical structures such as propositions and sets and the operations defined on them. If we can show that a particular structure is a Boolean algebra, then we know that all results established about Boolean algebras apply to this structure. Definition: A Boolean algebra is a set B with two binary operations ∧ and ∨, elements 0 and 1, and a unary operation − such that the following properties hold for all x, y, and z in B

Direct Proof

An implication p → q can be proved by showing that if p is true, then q is also true. Example: Give a direct proof of the theorem If n is odd, then n2 is odd Idea: Assume that the hypothesis of this implication is true (n is odd). Then use rules of inference and known theorems to show that q must also be true (n2 is odd).

indirect proof (proof by contradiction)

An implication p → q is equivalent to its contrapositive ¬ q → ¬ p. Therefore, we can prove p → q by showing that whenever q is false, p is also false. Example: Give an indirect proof of the theorem If 3n + 2 is odd, then n is odd Idea: Assume that the conclusion of this implication is false (n is even). Then use rules of inference and known theorems to show that the hypothesis must also be false (3n + 2 is even).

Corollary

Aproposition that follows directly from a theorum that has been proved

Inversions and Compositions

Bijections can be inverted. The inverse function of the bijection f : A → B is the function f −1 : B → A with f −1(b) = a whenever f(a) = b. Example: Let f : ℝ → ℝ, f(x) = 2x. What is f -1 ?f -1(x) = x/2 Inversion is only possible for bijections

The Satisfiability Problem (SAT)

Can we determine if a Boolean expression has any solution? A solution here means assignment of values to the input variables so that the expression evaluates to 1. If a Boolean expression has a solution, then it is called satisfiable. Otherwise it is unsatisfiable. If there are n variables in a Boolean expression, then there are 2n input value combinations. A brute force search for satisfiability means to check for each 2n possibilities. In a DNF, if there is a term that doesn't contain a literal and its complement at the same time, then it is satisfiable.

Minterm Example: Give a Boolean expression for the Boolean function F(x, y, z) as defined by the following table:

F(x, y, z) = 1 if and only if x = y = z = 0 or x = y = 0, z = 1 or x = 1, y = z = 0 Therefore, F(x, y, z) =

Boolean Expressions

The Boolean expressions in the variables x1, x2, ..., xn are defined recursively as follows: ●0, 1, x1, x2, ..., xn are Boolean expressions. ●If E1 and E2 are Boolean expressions, then (Ē1), (E1 · E2), and (E1 + E2) are Boolean expressions. Each Boolean expression represents a Boolean function. The values of this function are obtained by substituting 0 and 1 for the variables in the expression.

Cartesian Products

The Cartesian product of two sets is defined as: A×B = {(a, b) | a ∈ A ∧ b ∈ B} Example: A = {x,y}, B = {a,b,c} A×B = {(x,a), (x,b), (x,c), (y,a), (y,b), (y,c)}. For non-empty sets A and B: A ≠ B ⇔ A×B ≠ B×A |A×B| = |A|·|B| The Cartesian product of two or more sets is defined as: A1×A2×···×An = {(a1,a2,...,an) | ai ∈ Ai for 1 ≤ i ≤ n} (All the n-tuples using each set).

Complement

The complement of a set A contains exactly those elements under consideration that are not in A: A = U−A Example: U = ℕ B = {250, 251, 252, ...} B = {0, 1, 2, ..., 248, 249}

Complement, Sum and Product

The complement of the Boolean function F is the function F complement, where F(b)(complement) = Whole function gets complement applied. Let F and G be Boolean functions of degree n. The Boolean sum F + G and Boolean product FG are then defined by: (F + G)(b1, b2, ..., bn) = F(b1, b2, ..., bn) + G(b1, b2, ..., bn) (FG)(b1, b2, ..., bn) = F(b1, b2, ..., bn)G(b1, b2, ..., bn)

Compositions

The composition of two functions g : A → B and f : B → C, denoted by f ◦ g, is defined by (f ◦ g)(a) = f(g(a)) Work from inside out: 1.Function g is applied to element a ∈ A, mapping it onto an element of B. 2.then, function f is applied to this element of B, mapping it onto an element of C. Therefore, the composite function maps from A to C. Compositions are associative. (f ◦ g) ◦ h = f ◦ (g ◦ h) The composition of a function and its inverse is the identity function i(x) = x. (f −1 ◦ f)(x) = f −1(f(x)) = x

Difference

The difference between two sets A and B contains exactly those elements of A that are not in B: A−B = {x : x ∈ A ∧ x ∉ B} Example: A = {a, b} B = {b, c, d} A−B = {a}

Exponential Functions

The exponential function expb: ℝ → ℝ+ is defined as expb(x) = bx b: Base of the exponent x: The exponent

Floor and Ceiling Functions

The floor and ceiling functions map the real numbers onto the integers (ℝ → ℤ). The floor function assigns to r ∈ ℝ the largest z ∈ ℤ with z ≤ r, denoted by ⌊r⌋. Examples: ⌊2.3⌋ = 2, ⌊2⌋ = 2, ⌊0.5⌋ = 0, ⌊−3.5⌋ = −4 The ceiling function assigns to r ∈ ℝ the smallest z ∈ ℤ with z ≥ r, denoted by ⌈r⌉. Examples: ⌈2.3⌉ = 3, ⌈2⌉ = 2, ⌈0.5⌉ = 1, ⌈−3.5⌉ = −3

Graphs

The graph of a function f : A → B is the set of ordered pairs {(a, b) | a ∈ A and f(a) = b}. The graph is a subset of A×B that can be used to visualize f in a two-dimensional coordinate system.

Logarithm Function

The logarithm function is the inverse of exponential function. logb: ℝ+ → ℝ is defined as bx = y ⇔ logb(y) = x. b > 0 and b ≠ 1. b: Base of the logarithm

Example: S(x): x is a UMB student. G(x): x is a genius. What does ∀x(S(x)→G(x)) mean?

"If x is a UMB student, then x is a genius." or "All UMB students are geniuses."

Example: P(x): x is a UMB professor. G(x): x is a genius. What does ∃x (P(x) ∧ G(x)) mean?

"There is an x such that x is a UMB professor and x is a genius." or "At least one UMB professor is a genius."

Negation (DeMorgan's Law for Quantifiers)

1) ¬ (∀x P(x)) is logically equivalent to ∃x (¬ P(x)). 2) ¬ (∃x P(x)) is logically equivalent to ∀x (¬ P(x)).

Propositional Logic

Consists of propositions and compound propositions using any of these connectives: {V, ∧, ¬, →, ↔}. Also includes all of the rules of inference and laws of propositional logic. However, propositional logic lacks the expressiveness to convey certain kinds of knowledge.

Equivalent Boolean Functions

Definition: The Boolean functions F and G of n variables are equal if and only if F(b1, b2, ..., bn) = G(b1, b2, ..., bn) whenever b1, b2, ..., bn belong to B. Two different Boolean expressions that represent the same function are called equivalent. For example, the Boolean expressions ●xy ●xy + 0 are all equivalent. ●xy · 1

Boolean Sum

Denoted by + or by OR, has the following values: 1 + 1 = 1, 1 + 0 = 1, 0 + 1 = 1, 0 + 0 = 0

Boolean Product

Denoted by · or by AND, has the following values: 1 · 1 = 1, 1 · 0 = 0, 0 · 1 = 0, 0 · 0 = 0

Existential Quantification ∃x

Existentially quantified sentence: There exists an x in the universe of discourse for which P(x) is true. Using the existential quantifier ∃: ∃x P(x): "There is an x such that P(x)." or "There is at least one x such that P(x)." Note: ∃xP(x) is either true or false, so it is a proposition, not a propositional function

Strings

Finite sequences are also called strings, denoted by a1a2a3...an. The length of a string S is the number of terms that it consists of. The empty string contains no terms at all. It has length zero.

Existential Statement Proof

Giving an example of x that satisfies P(x) is sufficient. Negation: The proof has to show that for all x in the domain, P(x) = false. Giving an example is not sufficient.

Cardinality of Sets

If a set S contains n distinct elements, n ∈ ℕ, we call S a finite set with cardinality n. Example: A = {Mercedes, BMW, Porsche} |A| = 3

Domain

If f : A → B, then A is the domain of f

Codomain

If f : A → B, then B is the codomain of f

Universal Quantifier ∀x

Let P(x) be a propositional function. Universally quantified sentence: "For all x in the universe of discourse P(x) is true." Using the universal quantifier ∀x: ∀xP(x) "for all x P(x)" or "for every x P(X)" Note: ∀xP(x) is either true or false, so it is a proposition, not a propositional function

Sums and Products of Functions

Let f1 and f2 be functions from A to ℝ. Then the sum and the product of f1 and f2 are also functions from A to ℝ defined by: (f1 + f2)(x) = f1(x) + f2(x) (f1f2)(x) = f1(x)f2(x)

Mathematical Reasoning

Needed to determine whether a mathematical argument is valid or invalid, and to construct mathematical arguments. The steps that connect the statements in such a sequence are the rules of inference. Cases of incorrect reasoning are fallacies.

Rules of Inference

Provide the justification of steps used in a proof. The general form of a rule of inference is: p1, p2, ..., pn | ∴ q

Number of Possible Functions

Question: How many different Boolean functions of degree n are there? Solution: There are 2^n different n-tuples of 0s and 1s. A Boolean function is an assignment of 0 or 1 to each of these 2^n different n-tuples. Therefore, the total number of different Boolean functions is 2^2^n.

Sequences

Sequences represent ordered lists of elements. A sequence is defined as a function from a subset of ℕ to a set S. We use the notation an to denote the image of the integer n. We call an a term of the sequence.

Proving by Cases - Without loss of generality

Sometimes when cases are very similar, we don't need to prove each of them separately. We write without loss of generality or w.l.o.g while giving a proof of one of the cases. The other case(s) is similar so the proof applies them as well. Example: Theorem: For any two integers x and y, if x is even or y is even, then xy is even. Proof: Without loss of generality, assume that x is even. Then x = 2k for some integer k. Plugging in the expression 2k for x in xy gives xy = 2ky = 2(ky). Since k and y are integers, ky is also an integer. Since xy is equal to two times an integer, xy is even. ■

Proving by Cases

Theorem: For every positive integer n, n(n + 1) is even. Idea: Let us first show that the product of an even number m and an odd number n is always even: m = 2k where k is an integer n = 2p + 1 where p is an integer mn = 2k (2p + 1) mn = 2 (2kp + k) Since k and p are integers, (2kp + k) is an integer as well, and we have shown that mn is even. The remainder of the proof becomes easy if we separately consider each of the two main situations that can occur: Case I: n is even. Then n(n + 1) means that we multiply an even number with an odd one. As shown above, the result must be even. Case II: n is odd. Then n(n + 1) means that we multiply an odd number with an even one. As shown above, the result must be even. Since there are no other cases, we have proven that n(n + 1) is always even. QED

Minterms

There is a simple method for deriving a Boolean expression for a function that is defined by a table. This method is based on minterms. Definition: A literal is a Boolean variable or its complement. A minterm of the Boolean variables x1, x2, ..., xn is a Boolean product y1y2...yn, where yi = xi or yi = . Hence, a minterm is a product of n literals, with one literal for each variable.

Example: If 101 is divisible by 3, then 101^2 is divisible by 9. 101 is divisible by 3. Consequently, 101^2 is divisible by 9.

This argument is false because both of the hypotheses used are incorrect, leading to an incorrect conclusion. This is however a valid argument.

How are 2 functions equal?

Two functions f and g are equal if and only if their domain and range are the same, and for every x in the domain, f(x) = g(x).

Image of a Subset

We already know that the range of a function f : A → B is the set of all images of elements a ∈ A. If we only regard a subset S ⊆ A, the set of all images of elements s ∈ S is called the image of S. We denote the image of S by f(S) : f(S) = {f(s) : s ∈ S}

Proof by Exhaustion

When the domain of a universal statement is small, we can simply check each possibility. Example: For all positive integers smaller than 3, their square is strictly less than their multiplication with 3. ∀x[( x ∈ ℤ+ ∧ x < 3) → (x2 < 3x)] Proof: There are only two possible values of x: 1 and 2. Plugging in these values gives us 12 < 3×1 and 22 < 3×2 , therefore we showed that x2 < 3x for all possible values of x. QED

(Dis)Proving a Function is One-to-One

Whenever you want to prove something, first take a look at the relevant definition(s): ∀x,y ∈ A (f(x) = f(y) → x = y) Example: f : ℝ → ℝ, f(x) = x2 Disproof by counter-example: f(3) = f(−3), but 3 ≠ −3, so f is not one-to-one.


Kaugnay na mga set ng pag-aaral

Earth's Atmosphere: Air Pressure and Winds

View Set

ACCT Chapter 7 Internal Control and Cash

View Set

20-21 FallSem ap chem final exam

View Set

Chapter 24: Asepsis and Infection Control

View Set

CCNA routing and switching chapter 8 and 9

View Set

Chapter 2 Validity, Reliability, and Objectivity

View Set