1.7k likes | 1.98k Views
Discrete Mathematics CS 2610. Propositional Logic: Precedence. By convention…. Examples: p q r is equivalent to (( p) q) r p q r s is equivalent to p (q (r s)). . x. y. . . x. x. y. x. y. x. y. . 0. 0. 1. 0. 0. 0. 0. 1. 1. 0. 1.
E N D
Propositional Logic: Precedence By convention… Examples: p q r is equivalent to (( p) q) r p q r s is equivalent to p (q (r s))
x y x x y x y x y 0 0 1 0 0 0 0 1 1 0 1 1 1 0 0 0 1 1 1 1 0 1 1 0 Logic and Bit Operations • A bit is a binary digit: 0 or 1. • Bits are usually used to represent truth values. • By convention: 0 represents “false”; 1 represents “true”. • Bit operations correspond to logical operators, replacing false by 0 and true by 1
p Øp p Ø p p p Øp Øp p Øp p Øp T T T F F T T F T F F T F T F T F F Propositional Equivalences • A tautologyis a proposition that is always true. • Ex.: p Øp • A contradictionis a proposition that is always false. • Ex.: p Ø p • A contingency is a proposition that is neither a tautology nor a contradiction. • Ex.: p¬p
Propositional Logic: Logical Equivalence • If p and q are propositions, then p is logically equivalent toq if their truth tables are the same. • “p is equivalent to q.” is denoted by p q • p, q are logically equivalent if their biconditional p q is a tautology.
Propositional Logic: Logical Equivalences • Identity p T p p F p • Domination p T T p F F • Idempotence pp p pp p • Double negation p p
Propositional Logic: Logical Equivalences • Commutativity: p q q p p q q p • Associativity: (p q) r p ( q r ) (p q) r p ( q r )
Propositional Logic: Logical Equivalences • Distributive: p (q r) (p q) (p r) p (q r) (p q) (p r) • De Morgan’s: (p q) p q (De Morgan’s I) (p q) p q (De Morgan’s II)
Propositional Logic: Logical Equivalences • Excluded Middle: p pT • Uniqueness: p pF • A useful LE involving : p q p q
Propositional Logic • Use known logical equivalences to prove that two propositions are logically equivalent Example: (pq) p q We will use the LE, p p Double negation (p q) p q(De Morgan’s II)
Predicate Logic Define: UGA(x) = “x is a UGA student.” Universe of Discourse – all people x is a variable that represents an arbitrary individual in the Universe of Discourse A predicate P, or propositional function, is a function that maps objects of the universe of discourse to propositions • UGA(Daniel Boone) is a proposition. • UGA(x) is not a proposition. UGA(x) is like an English predicate template • __________ is a UGA student
Predicate Logic: Universal Quantifier Suppose that P(x) is a predicate on some universe of discourse. The universal quantification of P(x) (x P(x) ) is the proposition: “P(x) is true for all x in the universe of discourse.” x P(x) reads “for all x, P(x) is True” • x P(x) is TRUE means P(x) is true for all x in UD(x). • x P(x) is FALSE means there is an x in UD(x) for which P(x) is false.
Predicate Logic: Existential Quantifier Suppose P(x) is a predicate on some universe of discourse. The existential quantification of P(x) is the proposition: “There exists at least one x in the universe of discourse such that P(x) is true.” x P(x) reads “for some x, P(x)” or “There exists x, P(x) is True” x P(x) is TRUE means there is an x in UD(x) for which P(x) is true. x P(x) is FALSE means : for all x in UD(x) is P(x) false
Predicates - Quantifier negation x P(x) means “P(x) is true for every x.” What about x P(x) ? It is not the case that [“P(x) is true for every x.”] “There exists an x for which P(x) is not true.” x P(x) Universal negation: x P(x) x P(x).
Proofs • A theorem is a statement that can be proved to be true. • A proof is a sequence of statements that form an argument.
p p q q Proofs: Modus Ponens • I have a total score over 96. • If I have a total score over 96, then I get an A for the class. I get an A for this class Tautology: (p (p q)) q
q p q p Proofs: Modus Tollens • If the power supply fails then the lights go out. • The lights are on. The power supply has not failed. Tautology: (q (p q)) p
p p q Proofs: Addition • I am a student. I am a student or I am a visitor. Tautology: p (p q)
p q p Proofs: Simplification • I am a student and I am a soccer player. I am a student. Tautology: (p q) p
p q p q Proofs: Conjunction • I am a student. • I am a soccer player. I am a student and I am a soccer player. Tautology: ((p) (q)) p q
p q q p Proofs: Disjunctive Syllogism I am a student or I am a soccer player. I am a not soccer player. I am a student. Tautology: ((p q) q) p
p q q r p r Proofs: Hypothetical Syllogism If I get a total score over 96, I will get an A in the course. If I get an A in the course, I will have a 4.0 semester average. • If I get a total score over 96 then • I will have a 4.0 semester average. Tautology: ((p q) (q r)) (p r)
p q p r q r Proofs: Resolution I am taking CS1301 or I am taking CS2610. I am not taking CS1301 or I am taking CS 1302. I am taking CS2610 or I am taking CS 1302. Tautology: ((p q ) ( p r)) (q r)
p q p r q r r Proofs: Proof by Cases I have taken CS2610 or I have taken CS1301. If I have taken CS2610 then I can register for CS2720 If I have taken CS1301 then I can register for CS2720 I can register for CS2720 Tautology: ((p q ) (p r) (q r)) r
q p q p Fallacy of Affirming the Conclusion • If you have the flu then you’ll have a sore throat. • You have a sore throat. You must have the flu. Fallacy: (q (p q)) p Abductive reasoning
p p q q Fallacy of Denying the Hypothesis • If you have the flu then you’ll have a sore throat. • You do not have the flu. You do not have a sore throat. Fallacy: (p (p q)) q
Inference Rules for Quantified Statements Universal Instantiation (for an arbitrary object c from UoD) xP(x)P(c) Universal Generalization (for any arbitrary element c from UoD) P(c)___ xP(x) xP(x)P(c) Existential Instantiation (for some specific object c from UoD) Existential Generalization (for some object c from UoD) P(c)__ xP(x)
Proof: Valid argument • An argument is valid if whenever all the premises are true then the conclusion is true. p1,…,pn: premises or hypotheses of the problem q: conclusion An argument is valid if p1 p2 … pn q is true when p1,…,pn are true. What happens if a premise is false?
Proofs Step 1: Translate the sentences into logical expressions Step 2: Use rules of inferences to build a proof
Direct proofs • Start with premises and deduce the conclusion: • Assume that the premises are true • Apply rules of inferences and theorems
Vacuous Proofs p q is vacuously true if p is false In this case, p q is a vacuous proof Ex. p: 0 > 1 q: Mars is an asteroid What can we say about p q ?
Trivial Proofs p q is trivially true if q is true, In this case, we have a trivial proof Example: x>1 1=1
Indirect Proofs To prove p q, we prove its contrapositive, q p Example: if n2 is even then n is even is equivalent to … if n is odd then n2 is odd We can prove “If n2 is even then n is even” by proving “If n is odd then n2 is odd”
Proof By Contradiction: Reductio ad Absurdum • To prove p, we assume p and derive a contradiction. Based on the tautology ( p F ) p “if the negation of p implies a contradiction then p must be true” Example: “If I win $1,000,000, I will buy a sailboat.” “If I buy a sailboat, I will go sailing every summer.” “This summer, I will take one vacation. “I plan to go biking this summer.” Prove that I have not yet won $1,000,000.
Overview of last class A predicate P, or propositional function, is a function that maps objects in the universe of discourse to propositions • Predicates can be quantified using the universal quantifier (“for all”) or the existential quantifier (“there exists”) • Quantified predicates can be negated as follows • x P(x) x P(x) • x P(x) x P(x) • Quantified variables are called “bound” • Variables that are not quantified are called “free”
Proof Techniques-Quantifiers: For all Proofs x P(x) : provide a proof, not just examples. Ex. “The product of any two odd integers is odd” Proof:
Proof Techniques Disproving x P(x) • Find an counterexample for x P(x) • a value k in the Universe of Discourse such that P(k) Example: For every n positive number, 2n2 + 1 is prime. Find a counterexample:
Proof Techniques-Quantifiers: Existence Proofs Two ways of proving x P(x). Existence Constructive Proof: Find a k in the UoD such that P(k) holds. Existence Non-Constructive Proof Prove that x P(x) is true without finding a k in the UoD such that P(k) holds
Proof Techniques-Quantifiers: Existence Proofs x P(x) :Existence Constructive Proof: Find a k in the UoD such that P(k) holds. Example: There is a rational number that lies strictly between 19 100 - 1 and 19 100 Proof:
Existential Proof: Non-Constructive Prove that nN, p such that p is prime, and p > n. Proof: (BWOC) Assume the opposite is true. Then n, p such that p is prime, p n. Let p1, p2, …, pk be all the prime numbers between 2 and n. Consider the value r = p1 × p2 × … × pn + 1. Then r is not divisible by any prime number p n. Thus, either r is prime or r has prime factors greater than n!
Sets A set is an unordered collection of objects. Examples: • { 1, 6, 7, 2, 9 } • { a, d, e, 1, 2, 3} Order and repetition don’t matter = {6, 7, 1, 2, 9} = {a, a, d, d, e, e, 1, 2, 3} The empty set, or the set containing no elements. = {} Note: {} Singleton is a set S that contains exactly one element
Universal Set • Universal Set is the set containing all the objects under consideration. • It is denoted by U
Set Builder Notation • Set Builder – characterize the elements in a set by stating the properties that the elements must have to belong to the set. { x | P (x) } • reads x that satisfy P(x), x such that P(x) • x belongs to a universal set U. • concise definition of a set Examples: P = { x | x is prime number} U : Z+ M = { x | x is a mammal} U: All animals Q+ = { x R | x = p/q, for some positive integers p, q }
Elements of sets x S means “x is an element of set S” x S means “x is not an element of set S Example: 3 S reads: “3 is an element of the set S ”. Which of the following is true: • 3 R • -3 N
Subsets A B means “A is a subset of B” or, “B contains A” “every element of A is also in B” or, x ((x A) (x B)) A B means “A is a subset of B” B A means “B is a superset of A”
Subsets A B means “A is a subset of B” For Every Set S, i) S, the empty set is a subset of every set ii) S S, every set is a subset of itself
Power Sets The power set of S is the set of all subsets of S. P(S) = { x | x S } If S = {a}, P(S) = ? {, {a}} If S = {a,b}, P(S) = ? {, {a}, {b}, {a, b}} If S = , P(S)= ? {} Fact: if S is finite, |P(S)| = 2|S|.
n-Tuples • An ordered n-tuple, n Z+, is an ordered list (a1, a2, …, an). • Its first element is a1. • Its second element is a2, etc. • Enclosed between parentheses (list not set). • Order and length matters: (1, 2) (2, 1) (2, 1, 1).
Cartesian Product The Cartesian Product of two sets A and B is: A x B = { (a, b) | a A b B} Example: A= {a, b}, B= {1, 2} A B = {(a,1), (a,2), (b,1), (b,2)} B A = {(1,a), (1,b), (2,a), (2,b)} Not commutative! In general, A1 x A2 x … x An = {(a1, a2,…, an) | a1 A1, a2 A2, …, an An} |A1 x A2 x … x An| = |A1| x |A2| x … x |An|
Union Operator The union of two sets A and B is: A B = { x | x A v x B } Example: A = {1,2,3}, B = {1,6} A B = {1,2,3,6}