Sunteți pe pagina 1din 9

Handout #8 September 21, 2009

CS103 Robert Plummer

Chapter 1 Summary
The following summary of Chapter 1 of the Rosen text was prepared by Dr. Shui F. Lam, California State University, Long Beach. It is from an earlier edition, so the table and page numbers do not match our text exactly, but it will be a great help nevertheless. If you use this in doing your problem set and need to mention a particular section or table , feel free to use the numbering given here.

Chapter 1 -- The Foundations: Logic and Proof, Sets, and Functions 1.1 Logic

A proposition is a statement that is either true or false, but not both. ( p ) Propositional logic is the area of logic that deals with propositions. A truth table displays the relationships between the truth values of propositions. Logical operators: Negation ( p, not p ) Conjunction ( p q, p and q ) Disjunction ( p q, p or q ) Exclusive or ( p q, p or q but not both ) Implication ( p q, if p then q ) Biconditional ( p q, p if and only if q ) Propositions that are related to an implication p q Converse of an implication p q ( q p ) Contrapositive of an implication p q ( q p ) Inverse of an implication p q ( p q ) Compound propositions may be formed using various logical operators. Generally accepted precedence of the logical operators (from highest to lowest): , , , , System specifications are a series of statements that spell out the requirements of the system in question. The specifications are said to be consistent if there is an assignment of truth values to the variables in the expressions that makes all the expressions true. A Boolean variable is one whose value is either true or false. Computer bit operations correspond to logical operations of Boolean variables. Bitwise operations are bit operations extended to bit strings. Exercises in 1.1 1.2 Propositional Equivalences

A compound proposition that is always true is a tautology. A compound proposition that is always false is a contradiction. A compound proposition that is neither a tautology nor a contradiction is a contingency. Compound propositions that always have the same truth value are called logically equivalent (denoted by ).

Some well known logical equivalences (See Table 5 on p. 24 of the textbook) Equivalences pT p pF p pT T pF F pp p pp p ( p) p pq qp pq qp (p q) r p (q r) (p q) r p (q r) p (q r) (p q) (p r) p (q r) (p q) (p r) (p q) p q (p q) p q Name Identity laws Domination laws Idempotent laws Double negation law Commutative laws Associative laws Distributive laws De Morgan's laws

Logical equivalences involving implications (See Table 6 on p. 24 of the textbook) Logical Equivalences Involving Implications p q p q p q q p p q p q p q (p q) (p q) p q (p q) (p r) p (q r) (p r) (q r) (p q) r (p q) (p r) p (q r) (p r) (q r) (p q) r

Logical equivalences involving implications (See Table 7 on p. 24 of the textbook) Logical Equivalences Involving Biconditionals p q (p q) (q p) p q p q p q (p q) (p q) (p q) p q Exercises in 1.2 1.3 Predicates and Quantifiers

Predicates make statements about individual subjects. A predicate P(x) has two parts: the variable x is the subject of the statement, and the propositional function P is the property that the subject can have. The truth value of P(x) can be determined when x is assigned a value (x is said to be bound in this case). Quantifiers can be used to indicate how frequently a predicate P(x) is true: Universal quantifier (for all values of x in a given universe of discourse) Existential quantifier (at least one value of x in a given universe of discourse) Quantifiers may be negated. To show that a statement of the form x P(x) is false, it suffices to find one value of x in the universe of discourse for which P(x) is false. Such a value of x is called a counterexample to the statement x P(x). A variable x in a predicate is bound when a quantifier is used on x or when we assign a value to it; a variable that is not bound is said to be free. The part of a logical expression to which a quantifier is applied is called the scope of this quantifier. A variable is free if it is outside the scope of all quantifiers in the formula that specifies this variable (e.g., y is free in x Q(x, y).) Predicates with multiple variables may involve multiple quantifications. The order of the multiple quantifiers is significant.

Summary of the meaning of quantifiers (Tables 1 & 2 in 1.3) Table 1: Quantifiers Statement x P(x) x P(x) When True? P(x) is true for every x. There is at least one x for which P(x) is true. When False? There is an x for which P(x) is false. P(x) is false for every x.

Table 2: Negating Quantifiers Negation x P(x) x P(x) Equivalent When Is Negation True? Statement x P(x) For every x, P(x) is false. x P(x) There is an x for which P(x) is false. When False? There is an x for which P(x) is true. P(x) is true for every x.

Prolog is a programming language designed to enable programming by using predicate logic. A prolog program consists of two types of statements: Prolog facts define predicates by specifying the elements that satisfy these predicates, and Prolog rules define new predicates using those already defined by Prolog facts. Exercises in 1.3 1.4 Nested Quantifiers

Complicated expressions involving quantifiers arise often. These expressions may require quantifiers within the scope of other quantifiers, resulting in expressions called nested quantifiers. Translation of expressions with nested quantifiers into English should be done as follows: first write out what the quantifiers and predicates in the expression means, then convert this meaning into a simpler sentence without using any of the variables. Statements involving nested quantifiers can be negated by successively applying the rules for negating statements involving a single quantifier (Table 2 in 1.3). The order of the quantifiers in statements involving multiple quantifications is important unless all the quantifiers are of the same kind (universal or existential). A helpful way in working with quantifications involving multiple variables is to think in terms of nested loops. For example, to evaluate xy P(x, y) we loop through all the values of x, and for each x we loop through all the values of y.

Summary of the meaning of two-variable quantifications (Table 1) Table 1: Quantifications of Two Variables Statement xy P(x, y) yx P(x, y) xy P(x, y) xy P(x, y) xy P(x, y) yx P(x, y) Exercises in 1.4 1.5 Methods of Proof When True? P(x, y) is true for every pair x, y. For every x there is a y for which P(x, y) is true. There is an x for which P(x, y) is true for all y. There is a pair x, y for which P(x, y) is true. When False? There is a pair x, y for which P(x, y) is false. There is an x such that P(x, y) is false for all y. For every x there is a y for which P(x, y) is false. P(x, y) is false for every pair x, y.

It is important to identify if a mathematical argument is correct. A theorem is a statement that can be shown to be true. A proof is a sequence of statements that form an argument showing that a theorem is true. Essential elements in a proof include axioms or postulates (the underlying assumptions), and the rules of inference. A lemma is a simple theorem used in the proof of other theorems. A corollary is a proposition that can be established directly from a theorem that has been proved. Some basic rules of inference are shown on the next page.

Table 1: Rules of Inference Rule of Inference p . pq pq p p q . pq p pq q q pq p pq qr pr pq p. q pq pr qr Tautology p ( p q) (p q) p (( p ) ( q )) ( p q ) [p(pq)]q [q(pq)]p [( p q ) ( q r )] ( p r) [( p q) p ] q [( p q ) ( p r)] ( q r ) Name Addition Simplification Conjunction

Modus ponens

Modus tollens

Hypothetical syllogism

Disjunctive syllogism

Resolution

Some basic rules of inference for quantified statements Table 2: Rules of Inference for Quantified Statements Rule of Inference x P(x) P(c) P(c) for an arbitrary c x P(x) x P(x) P(c) for some element c P(c) for some element c x P(x) Name Universal instantiation Universal generalization Existential instantiation Existential generalization

A fallacy is a form of incorrect reasoning. Some common fallacies, usually from inference based on contingencies rather than tautologies: Fallacy of affirming the conclusion : reasoning based on [(pq) q] p Fallacy of denying the hypothesis : reasoning based on [(pq) p] q Fallacy of circular reasoning (also called fallacy of begging the question): reasoning based on the truth of the statement being proved. Proof methods Direct proof : Assume p is true and use rules of inference and theorems already proved to show that q must also be true. Indirect proof : Since p q is logically equivalent to its contrapositive q p, we can prove the theorem p q by a direct proof of its contrapositive. Vacuous proof : Since p q is true when p is false, we can prove a theorem p q by showing that p is false. Trivial proof : Since p q is true when q is true, we can prove a theorem p q by showing that q is true. Proof by contradiction : We can prove a proposition p to be true by showing that p ( r r ) or some other contradiction. Proof by cases : Break down the original implication into a disjunction of propositions p1, . . ., pn, and prove each pi individually. Existence proof for proposition of the form x P(x) : Constructive proof : Actually find an element a such that P(a) is true. Nonconstructive proof : Establish the existence of an a such that P(a) without actually finding it. Counterexample method for proving that proposition of the form x P(x) is false : Find one element a for which P(a) is false. Mathematical induction for proposition of the form nn0 P(n), where n N. Exercises in 1.5

The material on sets and functions is not in Chapter 1 of the 6th of Rosen. Since the definitions below match what we will use in class, we are leaving these here for reference.

1.6 & 1.7

Sets

An unordered collection of objects forms a set. The objects in a set are called the elements, or members, of the set. Two sets are equal iff they have the same elements. One can describe a set by listing all its members, i.e., enumeration (e.g., {a, e, i, o, u}), use a set builder notation (e.g., { x x is a vowel in the English alphabet}), or graphically using Venn diagrams The cardinality of a finite set S is the number of distinct elements in S, and is denoted by S. A set is said to be infinite if it is not finite. A set that contains all the objects under consideration is called the universal set, denoted by U. A set with no elements is an empty set, denoted by . The set S is a subset of T iff every element of S is also an element of T, denoted by S T. S is a proper subset of T, denoted by S T, iff S T and S T. The power set of a set S is the set of all subsets of S, denoted by P(S). The Cartesian product of two sets A and B, denoted by A B, is defined as { (a,b) a A b B}. Set operations: Union A B = {x x A x B} Intersection A B = {x x A x B} Difference A B = {x x A x B} Complement = {x x A} Two sets are called disjoint if their intersection is an empty set. Set identities show equivalent expressions that involve sets. Three methods for proving set identities: Prove the given two sets have the same elements by showing that each set is a subset of the other. Use set builder notation and logical equivalences. Use membership tables. Some well known set identities: (see Table 1 on p. 89 of the textbook) Computer representation of sets, when the universal set is finite, i.e., U = n, a positive integer a bit string of length n

1.8 Functions A function from set A to set B, denoted by f : A B, is the assignment of exactly one element of B to each element of A. Given f : A B, and if f(a) = b where a A and b B, then A is the domain of f, B is the codomain of f b is the image of a, and a is a pre-image of b The set of all images of elements of A is the range of f The graph of f is the set of ordered pairs {(a,b) | a A and f(a) = b} f : A B is one-to-one iff x,y A [ (f(x) = f(y)} (x = y) ] f : A B is called onto iff b B a A [ f(a) = b ] A function that is one-to-one & onto is a one-to-one correspondence f is invertible if f is a one-to-one correspondence. The inverse function, denoted by f-1, is defined as f-1(B) = {a | f(a) = b where a A and b B }. Given g : A B and f : B C, f g is called the composition of f and g, and is defined by (f g)(a)=f(g(a)). Some special functions: Strictly increasing function -- x,y A [x < y f(x) < f(y)], where A R B R. Strictly decreasing function -- x,y A [x < y f(x) > f(y)], where A R B R. A function that is either strictly increasing or strictly decreasing must be 1-1. Floor function -- f : R Z, and x R [f(x) = x = n where n<=x<n+1] Ceiling function -- f : R Z, and x R [f(x) = x = n where n-1<x<=n] Exponential function to base b -- fb(x) = bx x R. Logarithmic function to base b -- fb(x) = logbx, where x is a real number & x > 0. Factorial function f(n) = n! = n (n-1) for n > 0, and f(0) = 0! = 1. Useful properties of the floor and ceiling functions (Table 1 on p. 107 of the text) Table 1: Useful Properties of the Floor and Ceiling Functions (x R and n N) (1a) x = n if and only if n x < n + 1 (1b) x = n if and only if n 1 < x n (1c) x = n if and only if x 1 < n x (1d) x = n if and only if x n < x + 1 (2) x 1 < x x x < x + 1 (3a) x = x (3b) x = x (4a) x + n = x + n (4b) x + n = x + n Exercises in 1.8

S-ar putea să vă placă și