Download presentation

Presentation is loading. Please wait.

1
**Discrete Mathematics and its Applications**

The Islamic University of Gaza Faculty of Engineering Computer Engineering Department ECOM2311-Discrete Mathematics Asst. Prof. Mohammed Alhanjouri In Spring 2003 I spent 7 fifty-minute lecture periods on this material, but two half-lectures were taken up by team selection and a quiz, so it really only took 6 lectures. Slides for a Course Based on the Text Discrete Mathematics & Its Applications (5th Edition) by Kenneth H. Rosen Dr.Eng. Mohammed Alhanjouri (c) , Michael P. Frank

2
**Dr.Eng. Mohammed Alhanjouri**

Course Description: This course discusses concepts of basic logic, sets, combinational theory. Topics include Boolean algebra; set theory; symbolic logic; predicate logic, objective functions, equivalence relations, graphs, basic counting, proof strategies, set partitions, combinations, trees, summations, and recurrences. Dr.Eng. Mohammed Alhanjouri

3
**Dr.Eng. Mohammed Alhanjouri**

Instructor: Asst. Prof. Mohammed Alhanjouri Office: Phone: (Ext.) Teaching Assistants: Eng. Faried Eng. Safa’a Lecture times There are three hours per week that will be distributed as below:- For female: Room L419 9:00 – 10:00 am (Saturday / Monday / Wednesday) For male: Room K416 10:00 – 11:00 am (Saturday / Monday / Wednesday) Dr.Eng. Mohammed Alhanjouri

4
**Dr.Eng. Mohammed Alhanjouri**

Course Objectives After completing this course: Students will express real-life concepts and mathematics using formal logic and vice-versa; manipulate using formal methods of propositional and predicate logic; know set operation analogues. Students will know basic methods of proofs and use certain basic strategies to produce proofs; have a notion of mathematics as an evolving subject. Students will be comfortable with various forms of induction and recursion. Students will understand algorithms and time complexity from a mathematical viewpoint. Students will know a certain amount about: functions, number theory, counting, and equivalence relations. Dr.Eng. Mohammed Alhanjouri

5
**Dr.Eng. Mohammed Alhanjouri**

Course Textbook(s) 1- Kenneth H. Rosen, "Discrete Mathematics and its Applications", McGraw-Hill, Fifth Edition,2003. Other Recommended Resources: 1- William Barnier, Jean B. Chan, "Discrete Mathematics: With Applications", West Publishing Co., 1989. 2- Mike Piff, "Discrete Mathematics, An Introduction for Software Engineers", Cambridge University Press,1992. 3- Todd Feil, Joan Krone, "Essential Discrete Mathematics", Prentice Hall, 2003. Dr.Eng. Mohammed Alhanjouri

6
**Dr.Eng. Mohammed Alhanjouri**

Course Work: Students grades are calculated according to their performance in the following course work: Assignments Quizzes Attendance Midterm Exam Final Exam 10 % 5 % 30 % 50 % Academic Integrity: --- Plagiarism, cheating, and other forms of academic dishonesty are prohibited and may result in grade F for the course. --- An incomplete grade is given only for an exceptional reason and such reason must be documented. Dr.Eng. Mohammed Alhanjouri

7
**Dr.Eng. Mohammed Alhanjouri**

Date Topic Readings Assignments Due 1stw Introduction to Logic Ch 1 (1.1, 1.2) 1st Ass. Posted 2ndw Logic Ch 1 (1.3, 1.4) 1st Due, 2nd Posted 3rdw Proof Ch 1 (1.5) 2nd Due, 3rd Posted 4thw Sets, Functions Ch 1 (1.6, 1.7, 1.8) 3rd Due, 4th Posted 5thw Algorithms Ch 2 (2.1, 2.2, 2.3) 4th Due, 5th Posted 6thw Integers, Matrices Ch 2 (2.4, 2.5, 2.6, 2.7) 5th Due, 6th Posted 7thw Summation, Induction Ch 3 (3.2, 3.3) 6th Due, 7th Posted 8th w Recursion Ch 3 (3.4, 3.5) 7th Due, 8th Posted 9th w Counting + Midterm Ch 4 (4.1 4.3) 10th w Advanced Counting Ch 6 (6.1, 6.2, 6.3) 8th Due, 9th Posted 11th w Ch 6 (6.4, 6.5, 6.6) 9th Due, 10th Posted 12th w Relations Ch 7 10th Due, 11th Posted 13th w Graphs Ch 8 (8.1 8.5) 11th Due, 12th Posted 14th w Trees Ch 9 12th Due, 13th Posted 15th w Revision 13th Due 16th w Final Exam Dr.Eng. Mohammed Alhanjouri

8
**Module #0: Course Overview**

Dr.Eng. Mohammed Alhanjouri

9
**What is Mathematics, really?**

Dr.Eng. Mohammed Alhanjouri

10
**So, what’s this class about?**

Dr.Eng. Mohammed Alhanjouri

11
**Dr.Eng. Mohammed Alhanjouri**

Discrete Structures We’ll Study Dr.Eng. Mohammed Alhanjouri

12
**Dr.Eng. Mohammed Alhanjouri**

Some Notations We’ll Learn Dr.Eng. Mohammed Alhanjouri

13
**Dr.Eng. Mohammed Alhanjouri**

Why Study Discrete Math? Dr.Eng. Mohammed Alhanjouri

14
**Dr.Eng. Mohammed Alhanjouri**

Uses for Discrete Math in Computer Science Dr.Eng. Mohammed Alhanjouri

15
**Dr.Eng. Mohammed Alhanjouri**

A Proof Example • Theorem: (Pythagorean Theorem of Euclidean geometry) For any real numbers a, b, and c, if a and b are the base-length and height of a right triangle, and c is the length of its hypotenuse, then a2 + b2 = c2. • Proof: See next slide. Dr.Eng. Mohammed Alhanjouri

16
**Dr.Eng. Mohammed Alhanjouri**

Proof of Pythagorean Theorem Note: It is easy to show that the exterior and interior quadrilaterals in this construction are indeed squares, and that the side length of the internal square is indeed b−a (where b is defined as the length of the longer of the two perpendicular sides of the triangle). These steps would also need to be included in a more complete proof. Dr.Eng. Mohammed Alhanjouri

17
**Module #1: Foundations of Logic**

Dr.Eng. Mohammed Alhanjouri

18
**Module #1: Foundations of Logic (§§1.1-1.3, ~3 lectures)**

Discrete Mathematics and its Applications Module #1: Foundations of Logic (§§ , ~3 lectures) Mathematical Logic is a tool for working with complicated compound statements. It includes: A language for expressing them. A concise notation for writing them. A methodology for objectively reasoning about their truth or falsity. It is the foundation for expressing formal proofs in all branches of mathematics. Dr.Eng. Mohammed Alhanjouri (c) , Michael P. Frank

19
**Foundations of Logic: Overview**

Propositional logic (§ ): Basic definitions. (§1.1) Equivalence rules & derivations. (§1.2) Predicate logic (§ ) Predicates. Quantified predicate expressions. Equivalences & derivations. Dr.Eng. Mohammed Alhanjouri

20
**Propositional Logic (§1.1)**

Discrete Mathematics and its Applications Topic #1 – Propositional Logic Propositional Logic (§1.1) Propositional Logic is the logic of compound statements built from simpler statements using so-called Boolean connectives. Some applications in computer science: Design of digital electronic circuits. Expressing conditions in programs. Queries to databases & search engines. George Boole ( ) We normally attribute propositional logic to George Boole, who first formalized it. Actually the particular formal notation we will present is not precisely Boole’s; he originally spoke of logic in terms of sets, not propositions, and he also used Boolean algebra notation such as AB, A+B, rather than the A /\ B, A \/ B notation we will use. But, he was the first to mathematically formalize these kinds of concepts in preserved writings. Boole’s formalization of logic was developed further by the philosopher Frege. However, even though logic was not formalized as such until the 1800’s, the basic ideas of it go all the way back to the ancient Greeks. Aristotle (ca B.C.) developed a detailed system of logic (though one that was not quite as convenient and powerful as the modern one), and Chrysippus of Soli (ca B.C.) introduced a logic centered around logic AND, inclusive and exclusive OR, NOT, and implication, similarly to Boole’s. Chrysippus’ logic apparently included all of the key rules that Boole’s logic had. However, his original works were unfortunately lost; we only have fragments quoted by other authors. Chrysippus of Soli (ca. 281 B.C. – 205 B.C.) Dr.Eng. Mohammed Alhanjouri (c) , Michael P. Frank

21
**Definition of a Proposition**

Topic #1 – Propositional Logic Definition of a Proposition A proposition (p, q, r, …) is simply a statement (i.e., a declarative sentence) with a definite meaning, having a truth value that’s either true (T) or false (F) (never both, neither, or somewhere in between). (However, you might not know the actual truth value, and it might be situation-dependent.) [Later we will study probability theory, in which we assign degrees of certainty to propositions. But for now: think True/False only!] Dr.Eng. Mohammed Alhanjouri

22
**Examples of Propositions**

Topic #1 – Propositional Logic Examples of Propositions “It is raining.” (In a given situation.) “Beijing is the capital of China.” • “1 + 2 = 3” But, the following are NOT propositions: “Who’s there?” (interrogative, question) “La la la la la.” (meaningless interjection) “Just do it!” (imperative, command) “Yeah, I sorta dunno, whatever...” (vague) “1 + 2” (expression with a non-true/false value) Dr.Eng. Mohammed Alhanjouri

23
**Operators / Connectives**

Discrete Mathematics and its Applications Topic #1.0 – Propositional Logic: Operators Operators / Connectives An operator or connective combines one or more operand expressions into a larger expression. (E.g., “+” in numeric exprs.) Unary operators take 1 operand (e.g., −3); binary operators take 2 operands (eg 3 4). Propositional or Boolean operators operate on propositions or truth values instead of on numbers. Later in the course, we will see that operators can themselves be defined in terms of functions. This slide doesn’t define them that way because we haven’t defined functions yet. But for your reference, when you come back to study this section after learning about functions, in general, an n-ary operator O on any set S (the domain of the operator) is a function O:S^n->S mapping n-tuples of members of S (the operands) to members of S. “S^n” here denotes S with n as a superscript, that is, the nth Cartesian power of S. All this will be defined later when we talk about set theory. For Boolean operators, the set we are dealing with is B={True,False}. A unary Boolean operator U is a function U:B->B, while a binary Boolean operator T is a function T:(B,B)->B. Binary operators are conventionally written in between their operands, while unary operators are usually written in front of their operands. (One exception is the post-increment and post-decrement operators in C/C++/Java, which are written after their operands.) Dr.Eng. Mohammed Alhanjouri (c) , Michael P. Frank

24
**Some Popular Boolean Operators**

Formal Name Nickname Arity Symbol Negation operator NOT Unary Conjunction operator AND Binary Disjunction operator OR Exclusive-OR operator XOR Implication operator IMPLIES Biconditional operator IFF ↔ Dr.Eng. Mohammed Alhanjouri

25
**Dr.Eng. Mohammed Alhanjouri**

Topic #1.0 – Propositional Logic: Operators The Negation Operator The unary negation operator “¬” (NOT) transforms a prop. into its logical negation. E.g. If p = “I have brown hair.” then ¬p = “I do not have brown hair.” Truth table for NOT: T :≡ True; F :≡ False “:≡” means “is defined as” Operand column Result column Dr.Eng. Mohammed Alhanjouri

26
**The Conjunction Operator**

Topic #1.0 – Propositional Logic: Operators The Conjunction Operator The binary conjunction operator “” (AND) combines two propositions to form their logical conjunction. E.g. If p=“I will have salad for lunch.” and q=“I will have steak for dinner.”, then pq=“I will have salad for lunch and I will have steak for dinner.” ND Remember: “” points up like an “A”, and it means “ND” Dr.Eng. Mohammed Alhanjouri

27
**Conjunction Truth Table**

Discrete Mathematics and its Applications Topic #1.0 – Propositional Logic: Operators Conjunction Truth Table Operand columns Note that a conjunction p1 p2 … pn of n propositions will have 2n rows in its truth table. Also: ¬ and operations together are suffi-cient to express any Boolean truth table! Note that AND is commutative and associative, which means that we can write a long conjunction (like in the first bullet on the left) without parenthesizing it. It also doesn’t matter what order the n propositions are in. The fact that an n-operand operator has 2^n rows in its truth table is an easy consequence of the product rule of combinatorics. Here is a proof. Note that for the table to be complete, we must have 1 row for every possible assignment of truth values to the n operands. Thus, there is 1 row for every function f:V->B, where V is the set of operand columns {p,q,…} and B={T,F}. Here, |V|=n and |B|=2. The number of functions from a set of size n to a set of size m is m^n. This is because of the product rule, as we will see in a moment. In this case, m=2 so we get 2^n such functions. In terms of the product rule: There are 2 possible values for p. For each of these, there are 2 possible values for q, since the choice of q is independent of the choice of p. And so on. So there are 2x2x…(n repetitions)…x2 possible rows, thus 2^n. Of course, we haven’t defined the product rule, set cardinality, or functions yet, so don’t worry if the above argument doesn’t quite make sense to you yet. In the second bullet, we would say, {NOT,AND} is a universal set of Boolean operators, but we haven’t even defined sets yet. If you already know what a set is, a universal set of operators over a given domain is a set of operators such that nested expressions involving those operators are sufficient to express any possible operator over that domain. In this case, the domain is B={T,F}. The proof that {NOT,AND} is universal is as follows: OR can be defined by p OR q = NOT(NOT(p) AND NOT(q)) (easily verified; this is one of DeMorgan’s Laws, which we will get to later). Now, armed with OR, AND, and NOT, we can show how to express any Boolean truth table, with any number of columns, as follows. Look for the cases where the last (result) column is T. For each such row in the truth table, include a corresponding term in a disjunctive expression for the whole truth table. The term should be a conjunction of terms, one for each input operand in that row. Each of these terms should be p if the entry in that position is “T”, and NOT(p) if the entry in that position is “F”. So, the entire expression basically says, “the value of the operator is T if and only if the pattern of truth values of the input operands exactly matches one of the rows in the truth table that ends in a ‘T’ result.” Thus, the expression directly encodes the content of the truth table. Dr.Eng. Mohammed Alhanjouri (c) , Michael P. Frank

28
**The Disjunction Operator**

Discrete Mathematics and its Applications Topic #1.0 – Propositional Logic: Operators The Disjunction Operator The binary disjunction operator “” (OR) combines two propositions to form their logical disjunction. p=“My car has a bad engine.” q=“My car has a bad carburetor.” pq=“Either my car has a bad engine, or my car has a bad carburetor.” OR is also commutative and associative. The animated picture on the right is just a memory device to help you remember that the disjunction operator is symbolized with a downward-pointing wedge, like the blade of an axe, because it “splits” a proposition into two parts, such that you can take either part (or both), if you are trying to decide how to make the whole proposition true. Note that the meaning of disjunction is like the phrase “and/or” which is sometimes used in informal English. “The car has a bad engine and/or a bad carburetor.” After the downward- pointing “axe” of “” splits the wood, you can take 1 piece OR the other, or both. Meaning is like “and/or” in English. Dr.Eng. Mohammed Alhanjouri (c) , Michael P. Frank

29
**Disjunction Truth Table**

Topic #1.0 – Propositional Logic: Operators Disjunction Truth Table Note that pq means that p is true, or q is true, or both are true! So, this operation is also called inclusive or, because it includes the possibility that both p and q are true. “¬” and “” together are also universal. Note difference from AND Dr.Eng. Mohammed Alhanjouri

30
**Nested Propositional Expressions**

Discrete Mathematics and its Applications Topic #1.0 – Propositional Logic: Operators Nested Propositional Expressions Use parentheses to group sub-expressions: “I just saw my old friend, and either he’s grown or I’ve shrunk.” = f (g s) (f g) s would mean something different f g s would be ambiguous By convention, “¬” takes precedence over both “” and “”. ¬s f means (¬s) f , not ¬ (s f) As an exercise, drop the truth tables for f /\ (g \/ s) and (f /\ g) \/ s to see that they’re different, and thus the parentheses are necessary. Precedence conventions such as the one in the second bullet help to reduce the number of parentheses needed in expressions. Note that negation, with its tight binding (high precedence), and with its position to the left of its operand, behaves similarly to a negative sign in arithmetic. There is also a precedence convention that you see sometimes (for example, in the C programming language) that AND takes precedence over OR. However, this convention is not quite universally accepted, not all systems adopt it. Therefore, to be safe, you should always include parentheses whenever you are mixing ANDs and ORs in a single sequence of binary operators. Dr.Eng. Mohammed Alhanjouri (c) , Michael P. Frank

31
**Discrete Mathematics and its Applications**

Topic #1.0 – Propositional Logic: Operators A Simple Exercise Let p=“It rained last night”, q=“The sprinklers came on last night,” r=“The lawn was wet this morning.” Translate each of the following into English: ¬p = r ¬p = ¬ r p q = “It didn’t rain last night.” For slides that have interactive exercises, it may be a good idea to stop the class for a minute to allow the students to discuss the problem with their neighbors, then call on someone to answer. This will help keep the students engaged in the lecture activity. “The lawn was wet this morning, and it didn’t rain last night.” “Either the lawn wasn’t wet this morning, or it rained last night, or the sprinklers came on last night.” Dr.Eng. Mohammed Alhanjouri (c) , Michael P. Frank

32
**The Exclusive Or Operator**

Topic #1.0 – Propositional Logic: Operators The Exclusive Or Operator The binary exclusive-or operator “” (XOR) combines two propositions to form their logical “exclusive or” (exjunction?). p = “I will earn an A in this course,” q = “I will drop this course,” p q = “I will either earn an A for this course, or I will drop it (but not both!)” Dr.Eng. Mohammed Alhanjouri

33
**Exclusive-Or Truth Table**

Discrete Mathematics and its Applications Topic #1.0 – Propositional Logic: Operators Exclusive-Or Truth Table Note that pq means that p is true, or q is true, but not both! This operation is called exclusive or, because it excludes the possibility that both p and q are true. “¬” and “” together are not universal. A good way to remember the symbol for XOR, a plus sign inside an O, is to think of XOR as adding the bit-values of its inputs (mod 2). E.g., 0+0=0, 1+0=0, 1+1=0 (mod 2). Thus XOR is basically an addition, and we put it inside an “O” to remind ourselves that it is a type of “Or”. XOR together with unary operators do not form a universal set of operators over the Booleans. However, it turns out that they are a universal set for quantum logic! However we do not have time to cover quantum computing in this class, interesting though it is. Note difference from OR. Dr.Eng. Mohammed Alhanjouri (c) , Michael P. Frank

34
**Natural Language is Ambiguous**

Topic #1.0 – Propositional Logic: Operators Natural Language is Ambiguous Note that English “or” can be ambiguous regarding the “both” case! “Pat is a singer or Pat is a writer.” - “Pat is a man or Pat is a woman.” - Need context to disambiguate the meaning! For this class, assume “or” means inclusive. Dr.Eng. Mohammed Alhanjouri

35
**The Implication Operator**

Discrete Mathematics and its Applications Topic #1.0 – Propositional Logic: Operators The Implication Operator antecedent consequent The implication p q states that p implies q. I.e., If p is true, then q is true; but if p is not true, then q could be either true or false. E.g., let p = “You study hard.” q = “You will get a good grade.” p q = “If you study hard, then you will get a good grade.” (else, it could go either way) Note that the definition of “p implies q” says: “If p is true, then q is true, and if p is not true, then q is either true or false.” Well, saying that q is either true or false is not saying anything, since any proposition is, by the very definition of a proposition, either true or false. So, the last part of that sentence (covering the case where p is not true) is not really saying anything. So we may as well say the definition is, “If p is true, then q is true.” Dr.Eng. Mohammed Alhanjouri (c) , Michael P. Frank

36
**Implication Truth Table**

Discrete Mathematics and its Applications Topic #1.0 – Propositional Logic: Operators Implication Truth Table p q is false only when p is true but q is not true. p q does not say that p causes q! p q does not require that p or q are ever true! E.g. “(1=0) pigs can fly” is TRUE! The only False case! Let’s consider the rows of the truth table, one at a time. In the first row, p is false and q is false. Now, let’s consider the definition of p->q. It says “If p is true, then q is true, but if p is false, then q is either true or false.” Well, in this case, p is false, and q is either true or false (namely false), so the second part of the statement is true. But, of course that part is true, since it is just a tautology that q is either true or false. In other words, and if is always true when its antecedent is false. Similarly, the second row is True. The third row is false, since p is true but q is false, so it is not the case that if p is true then q is true. Finally, in the fourth row, since p is true and q is true, it is the case that if q is true then q is true. Many students have trouble with the implication operator. When we say, “A implies B”, it is just a shorthand for “either not A, or B”. In other words, it is just the statement that it is NOT the case that A is true and B is false. This often seems wrong to students, because when we say “A implies B” in everyday English, we mean that if somehow A were to become true in some way, somehow, the statement B would automatically be thereby made true, as a result. This does not seem to be the case in general when A and B are just two random false statements (such as the example in the last bullet). (However in this case, we might make a convoluted argument that the antecedent really DOES effectively imply the consequent: Note that if 1=0, then if a given pig flies 0 times in his life, then he also flies 1 time, thus he can fly.) In any case, perhaps a more accurate and satisfying English rendering of the true meaning of the logical claim “A implies B”, might be just, “the possibility that A implies B is not contradicted directly by the truth values of A and B”. In other words, “it is not the case that A is true and B is false.” (Since that combination of truth values would directly contradict the hypothesis that A implies B.) Dr.Eng. Mohammed Alhanjouri (c) , Michael P. Frank

37
**Examples of Implications**

Discrete Mathematics and its Applications Topic #1.0 – Propositional Logic: Operators Examples of Implications “If this lecture ends, then the sun will rise tomorrow.” True or False? “If Tuesday is a day of the week, then I am a penguin.” True or False? “If 1+1=6, then Bush is president.” True or False? “If the moon is made of green cheese, then I am richer than Bill Gates.” True or False? The first one is true because T->T is True. It doesn’t matter that my lecture ending is not the cause of the sun rising tomorrow. The second one is false for me, because although Tuesday is a day of the week, I am most certainly NOT a penguin. (But, if a penguin were to say this statement, then it would be true for him.) The third one is true, because 1+1 is not equal to 6. F->T is True. The last one is true, because the moon is not made of green cheese. F->F is True. In other words, anything that’s false implies anything at all. p->q if p is false. Why? If p is false, then if p is true, then p is both false and true at the same time, and so truth and falsity are the same thing. So if q is false then q is true. Dr.Eng. Mohammed Alhanjouri (c) , Michael P. Frank

38
**Why does this seem wrong?**

Consider a sentence like, “If I wear a red shirt tomorrow, then the U.S. will attack Iraq the same day.” In logic, we consider the sentence True so long as either I don’t wear a red shirt, or the US attacks. But in normal English conversation, if I were to make this claim, you would think I was lying. Why this discrepancy between logic & language? Dr.Eng. Mohammed Alhanjouri

39
**Resolving the Discrepancy**

Discrete Mathematics and its Applications Resolving the Discrepancy In English, a sentence “if p then q” usually really implicitly means something like, “In all possible situations, if p then q.” That is, “For p to be true and q false is impossible.” Or, “I guarantee that no matter what, if p, then q.” This can be expressed in predicate logic as: “For all situations s, if p is true in situation s, then q is also true in situation s” Formally, we could write: s, P(s) → Q(s) This sentence is logically False in our example, because for me to wear a red shirt and the U.S. not to attack Iraq is a possible (even if not actual) situation. Natural language and logic then agree with each other. Later, we will learn an extension of propositional logic called predicate logic that allows us to express what we really mean by this english sentence. Basically, “if .. then” sentences in English usually carry the connotation that they are always true, or true in all situations. Therefore, they really have a more complex structure than plain logically implication. When we get to the next section, on predicate logic, we will learn that we need to use an additional logical quantifier called FORALL to properly render such a sentence. So, if I make this claim “If I wear a red shirt the US will attack” you automatically assume that what I really mean is “For all possible courses of events that the world could follow tomorrow, if that course of events has me wearing a red shirt, then it will have the US attacking Iraq.” This sentence is False both intuitively and logically, because we surely agree that it is a possible course of events for tomorrow that I do wear a red shirt but the US does not attack Iraq. In predicate logic, if we define the universe of discourse to be all possible versions of tomorrow t, and we define P(t) = “In tomorrow t, I wear a red shirt”, and Q(t) = “In tomorrow t, the U.S. attacks Iraq,” then the sentence would be rendered logically as “FORALL t, P(t) --> Q(t)”, which is False (agreeing with intuition) so long as there is a possible tomorrow t in which I do wear a red shirt and the US doesn’t attack. If I don’t wear a red shirt, we don’t consider the sentence to have been verified, because it doesn’t prove what would have happened if I had worn the red shirt. Even if I wear a red shirt, and the US does attack, we still don’t believe the sentence because it doesn’t prove that it wasn’t a possibility for the US not to attack. It is important that you keep in mind that in pure logic, when we say “if p then q” or “p implies q” we explicitly do NOT mean that in ALL situations p implies q. For that we would say, FORALL s P(s)->Q(s). Rather, we just mean, “p is false or q is true”. So, the example says “I predict that tomorrow, either I will not be wearing a red shirt, or the US will be attacking Iraq.” I can make this prediction true (obviously) just by not wearing a red shirt. Since you believe that I can do this, you believe that sentence. Dr.Eng. Mohammed Alhanjouri (c) , Michael P. Frank

40
**English Phrases Meaning p q**

Topic #1.0 – Propositional Logic: Operators English Phrases Meaning p q “p implies q” “if p, then q” “if p, q” “when p, q” “whenever p, q” “q if p” “q when p” “q whenever p” “p only if q” “p is sufficient for q” “q is necessary for p” “q follows from p” “q is implied by p” We will see some equivalent logic expressions later. Dr.Eng. Mohammed Alhanjouri

41
**Converse, Inverse, Contrapositive**

Discrete Mathematics and its Applications Topic #1.0 – Propositional Logic: Operators Converse, Inverse, Contrapositive Some terminology, for an implication p q: Its converse is: q p. Its inverse is: ¬p ¬q. Its contrapositive: ¬q ¬ p. One of these three has the same meaning (same truth table) as p q. Can you figure out which? Also, note that the converse and inverse of p->q also have the same meaning as each other. Contrapositive Dr.Eng. Mohammed Alhanjouri (c) , Michael P. Frank

42
**Dr.Eng. Mohammed Alhanjouri**

Topic #1.0 – Propositional Logic: Operators How do we know for sure? Proving the equivalence of p q and its contrapositive using truth tables: Dr.Eng. Mohammed Alhanjouri

43
**The biconditional operator**

Discrete Mathematics and its Applications Topic #1.0 – Propositional Logic: Operators The biconditional operator The biconditional p q states that p is true if and only if (IFF) q is true. p = “Obama wins the 2008 election.” q = “Obama will be president for all of 2009.” p q = “If, and only if, Obama wins the 2008 election, Obama will be president for all of 2009.” I’m still here! 2008 Dr.Eng. Mohammed Alhanjouri 2009 (c) , Michael P. Frank

44
**Biconditional Truth Table**

Discrete Mathematics and its Applications Topic #1.0 – Propositional Logic: Operators Biconditional Truth Table p q means that p and q have the same truth value. Note this truth table is the exact opposite of ’s! p q means ¬(p q) p q does not imply p and q are true, or cause each other. Also, p IFF q is equivalent to (p -> q) /\ (q -> p). (“/\” being the AND wedge) Dr.Eng. Mohammed Alhanjouri (c) , Michael P. Frank

45
**Boolean Operations Summary**

Discrete Mathematics and its Applications Topic #1.0 – Propositional Logic: Operators Boolean Operations Summary We have seen 1 unary operator (out of the 4 possible) and 5 binary operators (out of the 16 possible). Their truth tables are below. For fun, try writing down the truth tables for each of the 4 possible unary operators, and each of the 16 possible binary operators. For each one, try to come up with an English description of the operator that conveys its meaning. Also, figure out a way to define it in terms of other operators we already introduced. Dr.Eng. Mohammed Alhanjouri (c) , Michael P. Frank

46
**Some Alternative Notations**

Topic #1.0 – Propositional Logic: Operators Some Alternative Notations Dr.Eng. Mohammed Alhanjouri

47
**Bits and Bit Operations**

Discrete Mathematics and its Applications Topic #2 – Bits Bits and Bit Operations A bit is a binary (base 2) digit: 0 or 1. Bits may be used to represent truth values. By convention: 0 represents “false”; 1 represents “true”. Boolean algebra is like ordinary algebra except that variables stand for bits, + means “or”, and multiplication means “and”. See chapter 10 for more details. John Tukey ( ) Bits can also be defined in terms of sets, if you like, by the convention that the empty set {} represents 0, and the set containing the empty set {{}} represents 1. Or more generally, any two distinct objects can represent the two bit-values or truth-values. Dr.Eng. Mohammed Alhanjouri (c) , Michael P. Frank

48
**Discrete Mathematics and its Applications**

Topic #2 – Bits Bit Strings A Bit string of length n is an ordered series or sequence of n0 bits. More on sequences in §3.2. By convention, bit strings are written left to right: e.g. the first bit of “ ” is 1. When a bit string represents a base-2 number, by convention the first bit is the most significant bit. Ex =8+4+1=13. We will talk about strings more generally later in the module on sequences. Dr.Eng. Mohammed Alhanjouri (c) , Michael P. Frank

49
**Discrete Mathematics and its Applications**

Topic #2 – Bits Counting in Binary Did you know that you can count to 1,023 just using two hands? How? Count in binary! Each finger (up/down) represents 1 bit. To increment: Flip the rightmost (low-order) bit. If it changes 1→0, then also flip the next bit to the left, If that bit changes 1→0, then flip the next one, etc. , , , … …, , , This is just a fun exercise to practice with the binary number system. We’ll have more to say about binary (and base-n numbers in general) later in the course. If you demonstrate this technique, you should probably apologize to your audience when you get to 4. The sequence in the last bullet is (in decimal): 0, 1, 2, … (skip a bunch) …, 1021, 1022, The next number, 1024 (or 1K) is 2^10. You would need 11 fingers to show it! Dr.Eng. Mohammed Alhanjouri (c) , Michael P. Frank

50
**Discrete Mathematics and its Applications**

Topic #2 – Bits Bitwise Operations Boolean operations can be extended to operate on bit strings as well as single bits. E.g.: Bit-wise OR Bit-wise AND Bit-wise XOR The answers are present, but hidden, as white text on a white background. The slide can be done in class as an exercise, with the instructor typing in the students’ answers in the space provided. Then the correct answers can be revealed by selecting the bottom 3 rows and changing their font color unconditionally to black. Dr.Eng. Mohammed Alhanjouri (c) , Michael P. Frank

51
**Dr.Eng. Mohammed Alhanjouri**

End of §1.1 You have learned about: Propositions: What they are. Propositional logic operators’ Symbolic notations. English equivalents. Logical meaning. Truth tables. Atomic vs. compound propositions. Alternative notations. Bits and bit-strings. Next section: §1.2 Propositional equivalences. How to prove them. Dr.Eng. Mohammed Alhanjouri

52
**Propositional Equivalence (§1.2)**

Topic #1.1 – Propositional Logic: Equivalences Propositional Equivalence (§1.2) Two syntactically (i.e., textually) different compound propositions may be the semantically identical (i.e., have the same meaning). We call them equivalent. Learn: Various equivalence rules or laws. How to prove equivalences using symbolic derivations. Dr.Eng. Mohammed Alhanjouri

53
**Tautologies and Contradictions**

Topic #1.1 – Propositional Logic: Equivalences Tautologies and Contradictions A tautology is a compound proposition that is true no matter what the truth values of its atomic propositions are! Ex. p p [What is its truth table?] A contradiction is a compound proposition that is false no matter what! Ex. p p [Truth table?] Other compound props. are contingencies. Dr.Eng. Mohammed Alhanjouri

54
**Dr.Eng. Mohammed Alhanjouri**

Topic #1.1 – Propositional Logic: Equivalences Logical Equivalence Compound proposition p is logically equivalent to compound proposition q, written pq, IFF the compound proposition pq is a tautology. Compound propositions p and q are logically equivalent to each other IFF p and q contain the same truth values as each other in all rows of their truth tables. Dr.Eng. Mohammed Alhanjouri

55
**Proving Equivalence via Truth Tables**

Topic #1.1 – Propositional Logic: Equivalences Proving Equivalence via Truth Tables Ex. Prove that pq (p q). F T T T F T T F F T T F T F T T F F F T Dr.Eng. Mohammed Alhanjouri

56
**Dr.Eng. Mohammed Alhanjouri**

Topic #1.1 – Propositional Logic: Equivalences Equivalence Laws These are similar to the arithmetic identities you may have learned in algebra, but for propositional equivalences instead. They provide a pattern or template that can be used to match all or part of a much more complicated proposition and to find an equivalence for it. Dr.Eng. Mohammed Alhanjouri

57
**Equivalence Laws - Examples**

Topic #1.1 – Propositional Logic: Equivalences Equivalence Laws - Examples Identity: pT p pF p Domination: pT T pF F Idempotent: pp p pp p Double negation: p p Commutative: pq qp pq qp Associative: (pq)r p(qr) (pq)r p(qr) Dr.Eng. Mohammed Alhanjouri

58
**Dr.Eng. Mohammed Alhanjouri**

Topic #1.1 – Propositional Logic: Equivalences More Equivalence Laws Distributive: p(qr) (pq)(pr) p(qr) (pq)(pr) De Morgan’s: (pq) p q (pq) p q Trivial tautology/contradiction: p p T p p F Augustus De Morgan ( ) Dr.Eng. Mohammed Alhanjouri

59
**Defining Operators via Equivalences**

Topic #1.1 – Propositional Logic: Equivalences Defining Operators via Equivalences Using equivalences, we can define operators in terms of other operators. Exclusive or: pq (pq)(pq) pq (pq)(qp) Implies: pq p q Biconditional: pq (pq) (qp) pq (pq) Dr.Eng. Mohammed Alhanjouri

60
**Dr.Eng. Mohammed Alhanjouri**

Topic #1.1 – Propositional Logic: Equivalences An Example Problem Check using a symbolic derivation whether (p q) (p r) p q r. (p q) (p r) [Expand definition of ] (p q) (p r) [Defn. of ] (p q) ((p r) (p r)) [DeMorgan’s Law] (p q) ((p r) (p r)) [associative law] cont. Dr.Eng. Mohammed Alhanjouri

61
**Dr.Eng. Mohammed Alhanjouri**

Topic #1.1 – Propositional Logic: Equivalences Example Continued... (p q) ((p r) (p r)) [ commutes] (q p) ((p r) (p r)) [ associative] q (p ((p r) (p r))) [distrib. over ] q (((p (p r)) (p (p r))) [assoc.] q (((p p) r) (p (p r))) [trivail taut.] q ((T r) (p (p r))) [domination] q (T (p (p r))) [identity] q (p (p r)) cont. Dr.Eng. Mohammed Alhanjouri

62
**Dr.Eng. Mohammed Alhanjouri**

Topic #1.1 – Propositional Logic: Equivalences End of Long Example q (p (p r)) [DeMorgan’s] q (p (p r)) [Assoc.] q ((p p) r) [Idempotent] q (p r) [Assoc.] (q p) r [Commut.] p q r Q.E.D. (quod erat demonstrandum) (Which was to be shown.) Dr.Eng. Mohammed Alhanjouri

63
**Review: Propositional Logic (§§1.1-1.2)**

Topic #1 – Propositional Logic Review: Propositional Logic (§§ ) Atomic propositions: p, q, r, … Boolean operators: Compound propositions: s : (p q) r Equivalences: pq (p q) Proving equivalences using: Truth tables. Symbolic derivations. p q r … Dr.Eng. Mohammed Alhanjouri

64
**Dr.Eng. Mohammed Alhanjouri**

Topic #3 – Predicate Logic Predicate Logic (§1.3) Predicate logic is an extension of propositional logic that permits concisely reasoning about whole classes of entities. Propositional logic (recall) treats simple propositions (sentences) as atomic entities. In contrast, predicate logic distinguishes the subject of a sentence from its predicate. Remember these English grammar terms? Dr.Eng. Mohammed Alhanjouri

65
**Applications of Predicate Logic**

Topic #3 – Predicate Logic Applications of Predicate Logic It is the formal notation for writing perfectly clear, concise, and unambiguous mathematical definitions, axioms, and theorems (more on these in chapter 3) for any branch of mathematics. Predicate logic with function symbols, the “=” operator, and a few proof-building rules is sufficient for defining any conceivable mathematical system, and for proving anything that can be proved within that system! Dr.Eng. Mohammed Alhanjouri

66
**Discrete Mathematics and its Applications**

Topic #3 – Predicate Logic Other Applications Predicate logic is the foundation of the field of mathematical logic, which culminated in Gödel’s incompleteness theorem, which revealed the ultimate limits of mathematical thought: Given any finitely describable, consistent proof procedure, there will still be some true statements that can never be proven by that procedure. I.e., we can’t discover all mathematical truths, unless we sometimes resort to making guesses. Kurt Gödel A note on pronunciation: The guy’s name is Austrian. The o with the double dot over it is called an “o umlaut.” It is also sometimes written “oe” in languages without umlauts, thus, “Goedel” is also a correct way to write his name in English. An o umlaut is pronounced something between “uh” and “ur”. So, “Goedel” is pronounced something like “girdle.” One way of saying Godel’s theorem is that there are infinitely many finite mathematical statements that are true, but that are not provable from earlier statements by any finite argument following a fixed set of logical inference rules. Thus, the only way to really expand the scope of mathematics is to make guesses (through intuition or inspiration) about additional statements being true (or equivalently, additional inference rules being valid). When one makes such guesses, since they have not been proven, one should always keep in mind the possibility that they may be false (inconsistent with earlier statements), and thus may eventually be disproven. Thus, in general, we can never really know whether a given mathematical system we are using is really logically self-consistent. (Except for some very simple systems of limited power can be proven to be consistent.) Later, we will see that the mathematical world was badly shaken up when it was discovered that the simple form of set theory that everyone had been using was actually inconsistent! To restore consistency, the theory had to be modified, and the new set theory is consistent, as far as anyone knows. Goedel was also a close colleague and friend of Albert Einstein, and he discovered (among other things) that Einstein’s theory of General Relativity (the modern theory of gravity) had some theoretical solutions in which time travel into the past was possible! Dr.Eng. Mohammed Alhanjouri (c) , Michael P. Frank

67
**Practical Applications**

Topic #3 – Predicate Logic Practical Applications Basis for clearly expressed formal specifications for any complex system. Basis for automatic theorem provers and many other Artificial Intelligence systems. Supported by some of the more sophisticated database query engines and container class libraries (these are types of programming tools). Dr.Eng. Mohammed Alhanjouri

68
**Subjects and Predicates**

Topic #3 – Predicate Logic Subjects and Predicates In the sentence “The dog is sleeping”: The phrase “the dog” denotes the subject - the object or entity that the sentence is about. The phrase “is sleeping” denotes the predicate- a property that is true of the subject. In predicate logic, a predicate is modeled as a function P(·) from objects to propositions. P(x) = “x is sleeping” (where x is any object). Dr.Eng. Mohammed Alhanjouri

69
**Dr.Eng. Mohammed Alhanjouri**

Topic #3 – Predicate Logic More About Predicates Convention: Lowercase variables x, y, z... denote objects/entities; uppercase variables P, Q, R… denote propositional functions (predicates). Keep in mind that the result of applying a predicate P to an object x is the proposition P(x). But the predicate P itself (e.g. P=“is sleeping”) is not a proposition (not a complete sentence). E.g. if P(x) = “x is a prime number”, P(3) is the proposition “3 is a prime number.” Dr.Eng. Mohammed Alhanjouri

70
**Propositional Functions**

Topic #3 – Predicate Logic Propositional Functions Predicate logic generalizes the grammatical notion of a predicate to also include propositional functions of any number of arguments, each of which may take any grammatical role that a noun can take. E.g. let P(x,y,z) = “x gave y the grade z”, then if x=“Mike”, y=“Mary”, z=“A”, then P(x,y,z) = “Mike gave Mary the grade A.” Dr.Eng. Mohammed Alhanjouri

71
**Universes of Discourse (U.D.s)**

Topic #3 – Predicate Logic Universes of Discourse (U.D.s) The power of distinguishing objects from predicates is that it lets you state things about many objects at once. E.g., let P(x)=“x+1>x”. We can then say, “For any number x, P(x) is true” instead of (0+1>0) (1+1>1) (2+1>2) ... The collection of values that a variable x can take is called x’s universe of discourse. Dr.Eng. Mohammed Alhanjouri

72
**Quantifier Expressions**

Topic #3 – Predicate Logic Quantifier Expressions Quantifiers provide a notation that allows us to quantify (count) how many objects in the univ. of disc. satisfy a given predicate. “” is the FORLL or universal quantifier. x P(x) means for all x in the u.d., P holds. “” is the XISTS or existential quantifier. x P(x) means there exists an x in the u.d. (that is, 1 or more) such that P(x) is true. Dr.Eng. Mohammed Alhanjouri

73
**The Universal Quantifier **

Discrete Mathematics and its Applications Topic #3 – Predicate Logic The Universal Quantifier Example: Let the u.d. of x be parking spaces at UF. Let P(x) be the predicate “x is full.” Then the universal quantification of P(x), x P(x), is the proposition: “All parking spaces at UF are full.” i.e., “Every parking space at UF is full.” i.e., “For each parking space at UF, that space is full.” Instructors: You can substitute your favorite overly-crowded destination in place of the University of Florida in this example. Dr.Eng. Mohammed Alhanjouri (c) , Michael P. Frank

74
**The Existential Quantifier **

Topic #3 – Predicate Logic The Existential Quantifier Example: Let the u.d. of x be parking spaces at UF. Let P(x) be the predicate “x is full.” Then the existential quantification of P(x), x P(x), is the proposition: “Some parking space at UF is full.” “There is a parking space at UF that is full.” “At least one parking space at UF is full.” Dr.Eng. Mohammed Alhanjouri

75
**Free and Bound Variables**

Topic #3 – Predicate Logic Free and Bound Variables An expression like P(x) is said to have a free variable x (meaning, x is undefined). A quantifier (either or ) operates on an expression having one or more free variables, and binds one or more of those variables, to produce an expression having one or more bound variables. Dr.Eng. Mohammed Alhanjouri

76
**Dr.Eng. Mohammed Alhanjouri**

Topic #3 – Predicate Logic Example of Binding P(x,y) has 2 free variables, x and y. x P(x,y) has 1 free variable, and one bound variable. [Which is which?] “P(x), where x=3” is another way to bind x. An expression with zero free variables is a bona-fide (actual) proposition. An expression with one or more free variables is still only a predicate: x P(x,y) y x Dr.Eng. Mohammed Alhanjouri

77
**Nesting of Quantifiers**

Topic #3 – Predicate Logic Nesting of Quantifiers Example: Let the u.d. of x & y be people. Let L(x,y)=“x likes y” (a predicate w. 2 f.v.’s) Then y L(x,y) = “There is someone whom x likes.” (A predicate w. 1 free variable, x) Then x (y L(x,y)) = “Everyone has someone whom they like.” (A __________ with ___ free variables.) Proposition Dr.Eng. Mohammed Alhanjouri

78
**Review: Propositional Logic (§§1.1-1.2)**

Atomic propositions: p, q, r, … Boolean operators: Compound propositions: s (p q) r Equivalences: pq (p q) Proving equivalences using: Truth tables. Symbolic derivations. p q r … Dr.Eng. Mohammed Alhanjouri

79
**Review: Predicate Logic (§1.3)**

Objects x, y, z, … Predicates P, Q, R, … are functions mapping objects x to propositions P(x). Multi-argument predicates P(x, y). Quantifiers: [x P(x)] :≡ “For all x’s, P(x).” [x P(x)] :≡ “There is an x such that P(x).” Universes of discourse, bound & free vars. Dr.Eng. Mohammed Alhanjouri

80
**Dr.Eng. Mohammed Alhanjouri**

Topic #3 – Predicate Logic Quantifier Exercise If R(x,y)=“x relies upon y,” express the following in unambiguous English: x(y R(x,y))= y(x R(x,y))= x(y R(x,y))= y(x R(x,y))= x(y R(x,y))= Everyone has someone to rely on. There’s a poor overburdened soul whom everyone relies upon (including himself)! There’s some needy person who relies upon everybody (including himself). Everyone has someone who relies upon them. Everyone relies upon everybody, (including themselves)! Dr.Eng. Mohammed Alhanjouri

81
**Natural language is ambiguous!**

Topic #3 – Predicate Logic Natural language is ambiguous! “Everybody likes somebody.” For everybody, there is somebody they like, x y Likes(x,y) or, there is somebody (a popular person) whom everyone likes? y x Likes(x,y) “Somebody likes everybody.” Same problem: Depends on context, emphasis. [Probably more likely.] Dr.Eng. Mohammed Alhanjouri

82
**Game Theoretic Semantics**

Discrete Mathematics and its Applications Topic #3 – Predicate Logic Game Theoretic Semantics Thinking in terms of a competitive game can help you tell whether a proposition with nested quantifiers is true. The game has two players, both with the same knowledge: Verifier: Wants to demonstrate that the proposition is true. Falsifier: Wants to demonstrate that the proposition is false. The Rules of the Game “Verify or Falsify”: Read the quantifiers from left to right, picking values of variables. When you see “”, the falsifier gets to select the value. When you see “”, the verifier gets to select the value. If the verifier can always win, then the proposition is true. If the falsifier can always win, then it is false. Here is a way of understanding what we mean by nested quantifiers. First, “game theory” is a branch of mathematics dealing with ideal strategies for playing competitive games. It has practical applications in economics, business, international politics, as well as in many areas of computer science such as computer security. The recent movie “A Beautiful Mind”, John Nash’s work is related to game theory. a semantics for a language is the specification how that language is understood; it gives you the meaning of the language, as opposed to just giving you its grammar. So far, I have given you one way of understanding the semantics of nested quantifiers in predicate logic, through translation to the English phrases “for all…” and “there exists…such that…”. However, if you are still fuzzy on the concept, here is another way to understand it. Think of determining the truth value of a nested quantifier expression as being like playing a game following certain rules. In this game, there are two players, the “verifier” who wants to argue the case that the proposition is true, and the “falsifier” who wants to argue the case that the proposition is false. To play the game, read the nested-quantifier expression from left to right. Every time you read “FORALL x”, the falsifier gets to take a turn, and he gets to pick any value of x in the universe of discourse that he wants to use to demonstrate his case. Every time you read “EXISTS x”, the verifier gets to take a turn, and he gets to pick any value of x in the u.d. that he wants to use to demonstrate his case. Now, we can say, if there is a winning strategy for the verifier (if he can plan a way to play the game that guarantees him a win), then the proposition is true. On the other hand, if there is a winning strategy for the falsifier, then the proposition is false. Dr.Eng. Mohammed Alhanjouri (c) , Michael P. Frank

83
**Let’s Play, “Verify or Falsify!”**

Discrete Mathematics and its Applications Topic #3 – Predicate Logic Let’s Play, “Verify or Falsify!” Let B(x,y) :≡ “x’s birthday is followed within 7 days by y’s birthday.” Suppose I claim that among you: x y B(x,y) Let’s play it in class. Who wins this game? What if I switched the quantifiers, and I claimed that y x B(x,y)? Who wins in that case? Your turn, as falsifier: You pick any x → (so-and-so) y B(so-and-so,y) As an example, let “B(x,y)” be the proposition, “y’s birthday falls within 1 week after x’s birthday.” Then suppose I assert, for the universe of discourse consisting of students in this class, that the predicate FORALL x EXISTS y B(x,y) is true. Now, let’s play the game. I will be the verifier, and you all can play the falsifier. (This example works well in my class because it’s so large; for smaller classes you should change the time interval to 1 month instead.) The first quantifier is the FORALL quantifier. Since I am claiming the part after the FORALL is true for all values of x, I shouldn’t care what value of x is chosen. I’m saying it’s true no matter what value is picked. So, the falsifier gets to pick x, and try his best to prove me wrong. So, who in class wants to offer up their birthday as the value of x here, to see if they can prove me wrong? Just suggest someone, anyone… You? OK, good. What’s your name? OK, (so-and-so). What’s your birth date? (Since we’re supposed to have the same knowledge, you have to tell me.) Now x is picked as so-and-so, and it’s my job to show that the rest of the sentence, EXISTS y B(so-and-so, y) is true. It’s my turn to play since the next quantifier is an EXISTS. EXISTS only claims there is 1 member of the universe of discourse who satisfies the predicate, so I get to pick it. Now, since in this game we’re both supposed to have the same knowledge, but I don’t actually know all your birthdays, you’re going to have to have to help me out here. Who has a birthday within the next 7 days after so-and-so? You? When’s your birthday? OK, I pick you then. Now, all the variables are chosen, and we look at the truth value of the rest of the sentence. Notice it is true. So I win. This does not yet establish that the sentence is true; for that we’d have to tabulate everyone’s birthdays, and show that no matter who you pick for x, I can pick someone for y to make the sentence true. In a class this large, the sentence may actually be true; there may be no 1-week periods that have no birthdays in them. (In a much smaller class, it would most likely be false.) Now, to show that the order of quantifiers matters, let’s switch the quantifiers. Now, I (the verifier) have to go first. In this game, making the first move turns out to be a disadvantage rather than an advantage. Now, no matter who I pick for y, let’s say you – what’s your birthday? You guys can easily pick someone for x to make the sentence false. Thus, the sentence is false. My turn, as verifier: I pick any y → (such-and-such) B(so-and-so,such-and-such) Dr.Eng. Mohammed Alhanjouri (c) , Michael P. Frank

84
**Still More Conventions**

Topic #3 – Predicate Logic Still More Conventions Sometimes the universe of discourse is restricted within the quantification, e.g., x>0 P(x) is shorthand for “For all x that are greater than zero, P(x).” =x (x>0 P(x)) x>0 P(x) is shorthand for “There is an x greater than zero such that P(x).” =x (x>0 P(x)) Dr.Eng. Mohammed Alhanjouri

85
**More to Know About Binding**

Topic #3 – Predicate Logic More to Know About Binding x x P(x) - x is not a free variable in x P(x), therefore the x binding isn’t used. (x P(x)) Q(x) - The variable x is outside of the scope of the x quantifier, and is therefore free. Not a proposition! (x P(x)) (x Q(x)) – This is legal, because there are 2 different x’s! Dr.Eng. Mohammed Alhanjouri

86
**Quantifier Equivalence Laws**

Discrete Mathematics and its Applications Topic #3 – Predicate Logic Quantifier Equivalence Laws Definitions of quantifiers: If u.d.=a,b,c,… x P(x) P(a) P(b) P(c) … x P(x) P(a) P(b) P(c) … From those, we can prove the laws: x P(x) x P(x) x P(x) x P(x) Which propositional equivalence laws can be used to prove this? (Chalkboard.) Another way to see why the order of quantifiers matters is to expand out the definitions of FORALL and EXISTS in terms of AND and OR. For example, suppose the universe of discourse just consists of two objects a and b. Now, consider some predicate P(x,y). Then, FORALL x EXISTS y P(x,y) (EXISTS y P(a,y)) /\ (EXISTS y P(b,y)) (P(a,a) \/ P(a,b)) /\ P(b,a) \/ P(b,b)). In contrast, EXISTS y FORALL x P(x,y) (FORALL x P(x,a)) \/ (FORALL x P(x,b)) (P(a,a) /\ P(b,a)) \/ (P(a,b) /\ P(b,b)). To see that these two are inequivalent, suppose only P(a,a) and P(b,b) are true. Then, the first proposition (with the FORALL first) is true, but, the second proposition (with the EXISTS first) is true. Students can come up with this counterexample in-class as an exercise. DeMorgan's Dr.Eng. Mohammed Alhanjouri (c) , Michael P. Frank

87
**Dr.Eng. Mohammed Alhanjouri**

Topic #3 – Predicate Logic More Equivalence Laws x y P(x,y) y x P(x,y) x y P(x,y) y x P(x,y) x (P(x) Q(x)) (x P(x)) (x Q(x)) x (P(x) Q(x)) (x P(x)) (x Q(x)) Exercise: See if you can prove these yourself. What propositional equivalences did you use? Dr.Eng. Mohammed Alhanjouri

88
**Review: Predicate Logic (§1.3)**

Discrete Mathematics and its Applications Topic #3 – Predicate Logic Review: Predicate Logic (§1.3) Objects x, y, z, … Predicates P, Q, R, … are functions mapping objects x to propositions P(x). Multi-argument predicates P(x, y). Quantifiers: (x P(x)) =“For all x’s, P(x).” (x P(x))=“There is an x such that P(x).” These “Review” slides I insert at the point where I am at the beginning of a lecture, just to quickly review what we’ve been covering recently. Instructors should feel free to move these slides around to wherever they are convenient. Dr.Eng. Mohammed Alhanjouri (c) , Michael P. Frank

89
**More Notational Conventions**

Topic #3 – Predicate Logic More Notational Conventions Quantifiers bind as loosely as needed: parenthesize x P(x) Q(x) Consecutive quantifiers of the same type can be combined: x y z P(x,y,z) x,y,z P(x,y,z) or even xyz P(x,y,z) All quantified expressions can be reduced to the canonical alternating form x1x2x3x4… P(x1, x2, x3, x4, …) ( ) Dr.Eng. Mohammed Alhanjouri

90
**Defining New Quantifiers**

Topic #3 – Predicate Logic Defining New Quantifiers As per their name, quantifiers can be used to express that a predicate is true of any given quantity (number) of objects. Define !x P(x) to mean “P(x) is true of exactly one x in the universe of discourse.” !x P(x) x (P(x) y (P(y) y x)) “There is an x such that P(x), where there is no y such that P(y) and y is other than x.” Dr.Eng. Mohammed Alhanjouri

91
**Some Number Theory Examples**

Discrete Mathematics and its Applications Topic #3 – Predicate Logic Some Number Theory Examples Let u.d. = the natural numbers 0, 1, 2, … “A number x is even, E(x), if and only if it is equal to 2 times some other number.” x (E(x) (y x=2y)) “A number is prime, P(x), iff it’s greater than 1 and it isn’t the product of two non-unity numbers.” x (P(x) (x>1 yz x=yz y1 z1)) Note we can even use quantifier expressions to define concepts like even-ness and prime-ness. Dr.Eng. Mohammed Alhanjouri (c) , Michael P. Frank

92
**Goldbach’s Conjecture (unproven)**

Discrete Mathematics and its Applications Goldbach’s Conjecture (unproven) Using E(x) and P(x) from previous slide, E(x>2): P(p),P(q): p+q = x or, with more explicit notation: x [x>2 E(x)] → p q P(p) P(q) p+q = x. “Every even number greater than 2 is the sum of two primes.” The notation in the top part may look confusing at first but it is actually unambiguous. After FORALL we must have the name of a variable. The following term has 1 free variable x, so we assume that variable comes after the FORALL. Then, the expression E(x>2) becomes a predicate that restricts the universe of discourse. E() is only a predicate if it contains a free variable; the only free variable within it is x so we translate E(x>2) as E(x) /\ x>2. This then is the predicate that must be true of an item in the universe of discourse in order for the rest of the expression to apply to it. Similarly, P(p) and P(q) translate to both free variables p and q after the EXISTS and to conjoined propositions about p and q. Alternatively, the whole expression could also be written FORALL E(x)>2 EXISTS p+q=x, P(p), P(q). Or of course in many other equivalent forms. Due to Goedel’s theorem, as far as we know right now, it is entirely possible that Goldbach’s conjecture could be perfectly true for the universe of all natural numbers from 0 to infinity, yet, there might be absolutely NO finite-length proof of this conjecture from the basic axioms of number theory. On the other hand, it might have a proof that is finite but extremely long, or even possibly a relatively short one that we just haven’t been lucky enough to discover yet. Dr.Eng. Mohammed Alhanjouri (c) , Michael P. Frank

93
**Dr.Eng. Mohammed Alhanjouri**

Topic #3 – Predicate Logic Calculus Example One way of precisely defining the calculus concept of a limit, using quantifiers: Dr.Eng. Mohammed Alhanjouri

94
**Dr.Eng. Mohammed Alhanjouri**

Topic #3 – Predicate Logic Deduction Example Definitions: s :≡ Socrates (ancient Greek philosopher); H(x) :≡ “x is human”; M(x) :≡ “x is mortal”. Premises: H(s) Socrates is human. x H(x)M(x) All humans are mortal. Dr.Eng. Mohammed Alhanjouri

95
**Deduction Example Continued**

Topic #3 – Predicate Logic Deduction Example Continued Some valid conclusions you can draw: H(s)M(s) [Instantiate universal.] If Socrates is human then he is mortal. H(s) M(s) Socrates is inhuman or mortal. H(s) (H(s) M(s)) Socrates is human, and also either inhuman or mortal. (H(s) H(s)) (H(s) M(s)) [Apply distributive law.] F (H(s) M(s)) [Trivial contradiction.] H(s) M(s) [Use identity law.] M(s) Socrates is mortal. Dr.Eng. Mohammed Alhanjouri

96
**Dr.Eng. Mohammed Alhanjouri**

Topic #3 – Predicate Logic Another Example Definitions: H(x) :≡ “x is human”; M(x) :≡ “x is mortal”; G(x) :≡ “x is a god” Premises: x H(x) M(x) (“Humans are mortal”) and x G(x) M(x) (“Gods are immortal”). Show that x (H(x) G(x)) (“No human is a god.”) Dr.Eng. Mohammed Alhanjouri

97
**Dr.Eng. Mohammed Alhanjouri**

Topic #3 – Predicate Logic The Derivation x H(x)M(x) and x G(x)M(x). x M(x)H(x) [Contrapositive.] x [G(x)M(x)] [M(x)H(x)] x G(x)H(x) [Transitivity of .] x G(x) H(x) [Definition of .] x (G(x) H(x)) [DeMorgan’s law.] x G(x) H(x) [An equivalence law.] Dr.Eng. Mohammed Alhanjouri

98
**End of §1.3-1.4, Predicate Logic**

Topic #3 – Predicate Logic End of § , Predicate Logic From these sections you should have learned: Predicate logic notation & conventions Conversions: predicate logic clear English Meaning of quantifiers, equivalences Simple reasoning with quantifiers Upcoming topics: Introduction to proof-writing. Then: Set theory – a language for talking about collections of objects. Dr.Eng. Mohammed Alhanjouri

Similar presentations

OK

© by Kenneth H. Rosen, Discrete Mathematics & its Applications, Sixth Edition, Mc Graw-Hill, 2007 Ch.1 (Part 1): The Foundations: Logic and Proofs Introduction.

© by Kenneth H. Rosen, Discrete Mathematics & its Applications, Sixth Edition, Mc Graw-Hill, 2007 Ch.1 (Part 1): The Foundations: Logic and Proofs Introduction.

© 2018 SlidePlayer.com Inc.

All rights reserved.

To make this website work, we log user data and share it with processors. To use this website, you must agree to our Privacy Policy, including cookie policy.

Ads by Google