1.1 CompSci 102© Michael Frank Today’s topics Boolean algebra previewBoolean algebra preview Propositional equivalencesPropositional equivalences Predicate.

Slides:



Advertisements
Similar presentations
CS 285- Discrete Mathematics
Advertisements

Basic Structures: Sets, Functions, Sequences, Sums, and Matrices
© by Kenneth H. Rosen, Discrete Mathematics & its Applications, Sixth Edition, Mc Graw-Hill, 2007 Chapter 1: (Part 2): The Foundations: Logic and Proofs.
Basic Structures: Sets, Functions, Sequences, Sums, and Matrices
L41 Lecture 2: Predicates and Quantifiers.. L42 Agenda Predicates and Quantifiers –Existential Quantifier  –Universal Quantifier 
2009/91 Predicates and Quantifiers (§1.3) In the sentence “x is greater than 3”: The phrase “x” denotes the subject - the object or entity that the sentence.
1 Predicate Logic Rosen 6 th ed., § Predicate Logic Predicate logic is an extension of propositional logic that permits concisely reasoning.
Logic and Set Theory.
From Chapter 4 Formal Specification using Z David Lightfoot
Copyright © Cengage Learning. All rights reserved.
First Order Logic. This Lecture Last time we talked about propositional logic, a logic on simple statements. This time we will talk about first order.
Section 1.3: Predicates and Quantifiers
Discrete Mathematics and its Applications
Module #1 - Logic 8/28/2015Michael Frank / Kees van Deemter1 Remember: I. Construct a model where 1 and 4 are true, while 2 and 3 are false Let the u.d.
Discrete Mathematics Goals of a Discrete Mathematics Learn how to think mathematically 1. Mathematical Reasoning Foundation for discussions of methods.
CSci 2011 Discrete Mathematics Lecture 3 CSci 2011.
The Foundations: Logic and Proofs
Logical Equivalence & Predicate Logic
Module #1 - Logic Based on Rosen, Discrete Mathematics & Its Applications, 5e Prepared by (c) Michael P. Frank Modified by (c) Haluk.
資訊科學數學 6 : Predicates, Quantifiers & Mathematical Induction 陳光琦助理教授 (Kuang-Chi Chen)
2009/9 1 Logic and Proofs §1.1 Introduction §1.2 Propositional Equivalences §1.3 Predicates and Quantifiers §1.4 Nested Quantifiers §1.5~7 Methods of Proofs.
Mathematical Structures A collection of objects with operations defined on them and the accompanying properties form a mathematical structure or system.
1 Propositional Logic Rosen 5 th ed., § Foundations of Logic: Overview Propositional logic:Propositional logic: –Basic definitions. –Equivalence.
1 Logic Logic is a discipline that studies the principles and methods used in correct reasoning It includes: A formal language for expressing statements.
A Brief Summary for Exam 1 Subject Topics Propositional Logic (sections 1.1, 1.2) –Propositions Statement, Truth value, Proposition, Propositional symbol,
1.1 CompSci 102© Michael Frank Today’s topics Propositional equivalencesPropositional equivalences Predicate logicPredicate logic Reading: Sections Reading:
Module #1 - Logic Module #1: The Fundamentals of Logic Rosen, §§
Review I Rosen , 3.1 Know your definitions!
Based on Rosen, Discrete Mathematics & Its Applications, 5e Prepared by (c) Michael P. Frank Modified by (c) Haluk Bingöl 1/92 Module.
First Order Logic Lecture 2: Sep 9. This Lecture Last time we talked about propositional logic, a logic on simple statements. This time we will talk about.
Chapter 1, Part II: Predicate Logic With Question/Answer Animations.
1 CMSC 250 Discrete Structures CMSC 250 Lecture 1.
Fundamentals of Logic 1. What is a valid argument or proof? 2. Study system of logic 3. In proving theorems or solving problems, creativity and insight.
Hazırlayan DISCRETE COMPUTATIONAL STRUCTURES Propositional Logic PROF. DR. YUSUF OYSAL.
CompSci 102 Discrete Math for Computer Science
(CSC 102) Lecture 8 Discrete Structures. Previous Lectures Summary Predicates Set Notation Universal and Existential Statement Translating between formal.
1 Introduction to Abstract Mathematics Chapter 2: The Logic of Quantified Statements. Predicate Calculus Instructor: Hayk Melikya 2.3.
Chapter 2 Logic 2.1 Statements 2.2 The Negation of a Statement 2.3 The Disjunction and Conjunction of Statements 2.4 The Implication 2.5 More on Implications.
1 Introduction to Abstract Mathematics Predicate Logic Instructor: Hayk Melikya Purpose of Section: To introduce predicate logic (or.
CS 285- Discrete Mathematics Lecture 4. Section 1.3 Predicate logic Predicate logic is an extension of propositional logic that permits concisely reasoning.
First Order Logic Lecture 3: Sep 13 (chapter 2 of the book)
Chapter 2 Fundamentals of Logic 1. What is a valid argument or proof?
CSci 2011 Discrete Mathematics Lecture 4 CSci 2011.
CS104:Discrete Structures Chapter 2: Proof Techniques.
Week 4 - Friday.  What did we talk about last time?  Floor and ceiling  Proof by contradiction.
Mathematics for Comter I Lecture 3: Logic (2) Propositional Equivalences Predicates and Quantifiers.
1 Georgia Tech, IIC, GVU, 2006 MAGIC Lab Rossignac Lecture 01: Boolean Logic Sections 1.1 and 1.2 Jarek Rossignac.
Foundations of Discrete Mathematics Chapter 1 By Dr. Dalia M. Gil, Ph.D.
Discrete Mathematical Structures: Theory and Applications 1 Logic: Learning Objectives  Learn about statements (propositions)  Learn how to use logical.
1 Section 7.1 First-Order Predicate Calculus Predicate calculus studies the internal structure of sentences where subjects are applied to predicates existentially.
Propositional Logic. Assignment Write any five rules each from two games which you like by using propositional logic notations.
Chapter 2 1. Chapter Summary Sets (This Slide) The Language of Sets - Sec 2.1 – Lecture 8 Set Operations and Set Identities - Sec 2.2 – Lecture 9 Functions.
Chapter 1 Logic and proofs
Module #1 - Logic 2016/7/91 Module #1: Logic (Textbook: §1.1~1.4) Dr. Chih-Wei Yi Department of Computer Science National Chiao Tung University.
Logic I 권태경 To do so, it should include a language to express statements, a notation to simplify expressions. Logic Mathematical Logic.
Discrete Math - Module #1 - Logic
COT 3100, Spring 2001 Applications of Discrete Structures
Methods of proof Section 1.6 & 1.7 Wednesday, June 20, 2018
6/20/2018 Arab Open University Faculty of Computer Studies M131 - Discrete Mathematics 6/20/2018.
COT 3100, Spr Applications of Discrete Structures
Information Technology Department
Propositional Equivalence (§1.2)
CSI 2101 / Predicate logic (§ ):
Discrete Math - Module #1 - Logic
Discrete Mathematics and its Applications
Predicate Logic (§1.3) Predicate logic is an extension of propositional logic that permits concisely reasoning about whole classes of entities. Propositional.
Cs Discrete Mathematics
Predicates and Quantifiers
Foundations of Discrete Mathematics
Logic Logic is a discipline that studies the principles and methods used to construct valid arguments. An argument is a related sequence of statements.
Presentation transcript:

1.1 CompSci 102© Michael Frank Today’s topics Boolean algebra previewBoolean algebra preview Propositional equivalencesPropositional equivalences Predicate logicPredicate logic Reading: Sections Reading: Sections

1.2 CompSci 102© Michael Frank Bits and Bit Operations A bit is a binary (base 2) digit: 0 or 1.A bit is a binary (base 2) digit: 0 or 1. Bits may be used to represent truth values.Bits may be used to represent truth values. By convention: 0 represents “false”; 1 represents “true”.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”.Boolean algebra is like ordinary algebra except that variables stand for bits, + means “or”, and multiplication means “and”. –See module 23 (chapter 10) for more details. Topic #2 – Bits John Tukey ( )

1.3 CompSci 102© Michael Frank Bit Strings A Bit string of length n is an ordered sequence (series, tuple) of n  0 bits.A Bit string of length n is an ordered sequence (series, tuple) of n  0 bits. –More on sequences in §3.2. By convention, bit strings are (sometimes) written left to right:By convention, bit strings are (sometimes) written left to right: –e.g. the “first” bit of the bit string “ ” is 1. –Watch out! Another common convention is that the rightmost bit is bit #0, the 2 nd -rightmost is bit #1, etc. When a bit string represents a base-2 number, by convention, the first (leftmost) bit is the most significant bit. Ex =8+4+1=13.When a bit string represents a base-2 number, by convention, the first (leftmost) bit is the most significant bit. Ex =8+4+1=13. Topic #2 – Bits

1.4 CompSci 102© Michael Frank Counting in Binary Did you know that you can count to 1,023 just using two hands?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.Each finger (up/down) represents 1 bit. To increment: Flip the rightmost (low-order) 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.If that bit changes 1→0, then flip the next one, etc , , , … …, , , , , , … …, , , Topic #2 – Bits

1.5 CompSci 102© Michael Frank Bitwise Operations Boolean operations can be extended to operate on bit strings as well as single bits.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 XORE.g.: Bit-wise OR Bit-wise AND Bit-wise XOR Topic #2 – Bits

1.6 CompSci 102© Michael Frank End of §1.1 You have learned about: Propositions: What they are.Propositions: What they are. Propositional logic operators’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.

1.7 CompSci 102© Michael Frank 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.Various equivalence rules or laws. How to prove equivalences using symbolic derivations.How to prove equivalences using symbolic derivations. Topic #1.1 – Propositional Logic: Equivalences

1.8 CompSci 102© Michael Frank 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. Topic #1.1 – Propositional Logic: Equivalences

1.9 CompSci 102© Michael Frank Logical Equivalence Compound proposition p is logically equivalent to compound proposition q, written p  q, IFF the compound proposition p  q 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. Topic #1.1 – Propositional Logic: Equivalences

1.10 CompSci 102© Michael Frank Ex. Prove that p  q   (  p   q). Proving Equivalence via Truth Tables F T T T T T T T T T F F F F F F F F T T Topic #1.1 – Propositional Logic: Equivalences

1.11 CompSci 102© Michael Frank Equivalence Laws These are similar to the arithmetic identities you may have learned in algebra, but for propositional equivalences instead.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.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. Topic #1.1 – Propositional Logic: Equivalences

1.12 CompSci 102© Michael Frank Equivalence Laws - Examples Identity: p  T  p p  F  pIdentity: p  T  p p  F  p Domination: p  T  T p  F  FDomination: p  T  T p  F  F Idempotent: p  p  p p  p  pIdempotent: p  p  p p  p  p Double negation:  p  pDouble negation:  p  p Commutative: p  q  q  p p  q  q  pCommutative: p  q  q  p p  q  q  p Associative: (p  q)  r  p  (q  r) (p  q)  r  p  (q  r)Associative: (p  q)  r  p  (q  r) (p  q)  r  p  (q  r) Topic #1.1 – Propositional Logic: Equivalences

1.13 CompSci 102© Michael Frank More Equivalence Laws Distributive: p  (q  r)  (p  q)  (p  r) p  (q  r)  (p  q)  (p  r)Distributive: p  (q  r)  (p  q)  (p  r) p  (q  r)  (p  q)  (p  r) De Morgan’s:  (p  q)   p   q  (p  q)   p   qDe Morgan’s:  (p  q)   p   q  (p  q)   p   q Trivial tautology/contradiction: p   p  T p   p  FTrivial tautology/contradiction: p   p  T p   p  F Topic #1.1 – Propositional Logic: Equivalences Augustus De Morgan ( )

1.14 CompSci 102© Michael Frank Defining Operators via Equivalences Using equivalences, we can define operators in terms of other operators. Exclusive or: p  q  (p  q)  (p  q) p  q  (p  q)  (q  p)Exclusive or: p  q  (p  q)  (p  q) p  q  (p  q)  (q  p) Implies: p  q   p  qImplies: p  q   p  q Biconditional: p  q  (p  q)  (q  p) p  q   (p  q)Biconditional: p  q  (p  q)  (q  p) p  q   (p  q) Topic #1.1 – Propositional Logic: Equivalences

1.15 CompSci 102© Michael Frank An Example Problem Check using a symbolic derivation whether (p   q)  (p  r)   p  q   r.Check using a symbolic derivation whether (p   q)  (p  r)   p  q   r. (p   q)  (p  r) [Expand definition of  ]   (p   q)  (p  r)[Expand defn. of  ]   (p   q)  (p  r)[Expand defn. of  ]   (p   q)  ((p  r)   (p  r)) [DeMorgan’s Law] [DeMorgan’s Law]  (  p  q)  ((p  r)   (p  r)) cont. cont. Topic #1.1 – Propositional Logic: Equivalences

1.16 CompSci 102© Michael Frank 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. Topic #1.1 – Propositional Logic: Equivalences

1.17 CompSci 102© Michael Frank 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) or  Topic #1.1 – Propositional Logic: Equivalences

1.18 CompSci 102© Michael Frank Review: Propositional Logic (§§ ) Atomic propositions: p, q, r, …Atomic propositions: p, q, r, … Boolean operators:      Boolean operators:         q)  rCompound propositions: s :  (p   q)  r Equivalences:p  q   (p  q)Equivalences: p  q   (p  q) Proving equivalences using:Proving equivalences using: –Truth tables. –Symbolic derivations. p  q  r … Topic #1 – Propositional Logic

1.19 CompSci 102© Michael Frank Predicate Logic (§1.3) Predicate logic is an extension of propositional logic that permits concisely reasoning about whole classes of entities.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.Propositional logic (recall) treats simple propositions (sentences) as atomic entities. In contrast, predicate logic distinguishes the subject of a sentence from its predicate.In contrast, predicate logic distinguishes the subject of a sentence from its predicate. –Remember these English grammar terms? Topic #3 – Predicate Logic

1.20 CompSci 102© Michael Frank 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 module 2) 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! Topic #3 – Predicate Logic

1.21 CompSci 102© Michael Frank 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: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 always remain some true statements that will never be proven by that procedure. I.e., we can’t discover all mathematical truths, unless we sometimes resort to making guesses.I.e., we can’t discover all mathematical truths, unless we sometimes resort to making guesses. Topic #3 – Predicate Logic Kurt Gödel

1.22 CompSci 102© Michael Frank Practical Applications of Predicate Logic It is the basis for clearly expressed formal specifications for any complex system.It is the basis for clearly expressed formal specifications for any complex system. It is basis for automatic theorem provers and many other Artificial Intelligence systems.It is basis for automatic theorem provers and many other Artificial Intelligence systems. –E.g. automatic program verification systems. Predicate-logic like statements are supported by some of the more sophisticated database query engines and container class librariesPredicate-logic like statements are supported by some of the more sophisticated database query engines and container class libraries –these are types of programming tools. Topic #3 – Predicate Logic

1.23 CompSci 102© Michael Frank Subjects and Predicates In the sentence “The dog is sleeping”: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.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). Topic #3 – Predicate Logic

1.24 CompSci 102© Michael Frank More About Predicates Convention: Lowercase variables x, y, z... denote objects/entities; uppercase variables P, Q, R… denote propositional functions (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).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.” Topic #3 – Predicate Logic

1.25 CompSci 102© Michael Frank 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.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.” Topic #3 – Predicate Logic

1.26 CompSci 102© Michael Frank 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.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) ...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.The collection of values that a variable x can take is called x’s universe of discourse. Topic #3 – Predicate Logic

1.27 CompSci 102© Michael Frank Quantifier Expressions Quantifiers provide a notation that allows us to quantify (count) how many objects in the univ. of disc. satisfy a given predicate.Quantifiers provide a notation that allows us to quantify (count) how many objects in the univ. of disc. satisfy a given predicate. “  ” is the FOR  LL or universal quantifier.  x P(x) means for all x in the u.d., P holds.“  ” is the FOR  LL 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.“  ” 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. Topic #3 – Predicate Logic

1.28 CompSci 102© Michael Frank The Universal Quantifier  Example: Let the u.d. of x be parking spaces at Duke. Let P(x) be the predicate “x is full.” Then the universal quantification of P(x),  x P(x), is the proposition:Example: Let the u.d. of x be parking spaces at Duke. 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 Duke are full.” –i.e., “Every parking space at Duke is full.” –i.e., “For each parking space at Duke, that space is full.” Topic #3 – Predicate Logic

1.29 CompSci 102© Michael Frank The Existential Quantifier  Example: Let the u.d. of x be parking spaces at Duke. Let P(x) be the predicate “x is full.” Then the existential quantification of P(x),  x P(x), is the proposition:Example: Let the u.d. of x be parking spaces at Duke. 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 Duke is full.” –“There is a parking space at Duke that is full.” –“At least one parking space at Duke is full.” Topic #3 – Predicate Logic

1.30 CompSci 102© Michael Frank Free and Bound Variables An expression like P(x) is said to have a free variable x (meaning, x is undefined).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.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. Topic #3 – Predicate Logic

1.31 CompSci 102© Michael Frank Example of Binding P(x,y) has 2 free variables, x and y.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?]  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.“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 zero free variables is a bona-fide (actual) proposition. An expression with one or more free variables is still only a predicate: e.g. let Q(y) =  x P(x,y)An expression with one or more free variables is still only a predicate: e.g. let Q(y) =  x P(x,y) Topic #3 – Predicate Logic

1.32 CompSci 102© Michael Frank 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.) Topic #3 – Predicate Logic

1.33 CompSci 102© Michael Frank Review: Predicate Logic (§1.3) Objects x, y, z, …Objects x, y, z, … Predicates P, Q, R, … are functions mapping objects x to propositions P(x).Predicates P, Q, R, … are functions mapping objects x to propositions P(x). Multi-argument predicates P(x, y).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).”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.Universes of discourse, bound & free vars.

1.34 CompSci 102© Michael Frank 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)! Topic #3 – Predicate Logic

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

1.36 CompSci 102© Michael Frank Game Theoretic Semantics Thinking in terms of a competitive game can help you tell whether a proposition with nested quantifiers is true.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: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”: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 verifier can always win, then the proposition is true. If the falsifier can always win, then it is false.If the falsifier can always win, then it is false. Topic #3 – Predicate Logic

1.37 CompSci 102© Michael Frank 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) Your turn, as falsifier: You pick any x → (so-and-so)  y B(so-and-so,y) My turn, as verifier: I pick any y → (such-and-such) B(so-and-so,such-and-such) 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? Topic #3 – Predicate Logic

1.38 CompSci 102© Michael Frank Still More Conventions Sometimes the universe of discourse is restricted within the quantification, e.g.,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) ) Topic #3 – Predicate Logic

1.39 CompSci 102© Michael Frank 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  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 complete proposition!(  x P(x) )  Q(x) - The variable x is outside of the scope of the  x quantifier, and is therefore free. Not a complete proposition! (  x P(x) )  (  x Q(x) ) – This is legal, because there are 2 different x’s!(  x P(x) )  (  x Q(x) ) – This is legal, because there are 2 different x’s! Topic #3 – Predicate Logic

1.40 CompSci 102© Michael Frank 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)  …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)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?Which propositional equivalence laws can be used to prove this? Topic #3 – Predicate Logic

1.41 CompSci 102© Michael Frank More Equivalence Laws  x  y P(x,y)   y  x P(x,y)  x  y P(x,y)   y  x P(x,y)  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))  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.Exercise: See if you can prove these yourself. –What propositional equivalences did you use? Topic #3 – Predicate Logic

1.42 CompSci 102© Michael Frank Review: Predicate Logic (§1.3) Objects x, y, z, …Objects x, y, z, … Predicates P, Q, R, … are functions mapping objects x to propositions P(x).Predicates P, Q, R, … are functions mapping objects x to propositions P(x). Multi-argument predicates P(x, y).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).”Quantifiers: (  x P(x)) =“For all x’s, P(x).” (  x P(x))=“There is an x such that P(x).” Topic #3 – Predicate Logic

1.43 CompSci 102© Michael Frank More Notational Conventions Quantifiers bind as loosely as needed: parenthesize  x P(x)  Q(x)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)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  x 1  x 2  x 3  x 4 … P(x 1, x 2, x 3, x 4, …)All quantified expressions can be reduced to the canonical alternating form  x 1  x 2  x 3  x 4 … P(x 1, x 2, x 3, x 4, …) ( ) Topic #3 – Predicate Logic

1.44 CompSci 102© Michael Frank 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.” Topic #3 – Predicate Logic

1.45 CompSci 102© Michael Frank Some Number Theory Examples Let u.d. = the natural numbers 0, 1, 2, …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 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 any two non-unity numbers.”  x ( P(x)  (x>1   yz x=yz  y  1  z  1 ) )“A number is prime, P(x), iff it’s greater than 1 and it isn’t the product of any two non-unity numbers.”  x ( P(x)  (x>1   yz x=yz  y  1  z  1 ) ) Topic #3 – Predicate Logic

1.46 CompSci 102© Michael Frank 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)] →  x [x>2  E(x)] →  p  q P(p)  P(q)  p+q = x.  p  q P(p)  P(q)  p+q = x. “Every even number greater than 2 is the sum of two primes.” Topic #3 – Predicate Logic

1.47 CompSci 102© Michael Frank Calculus Example One way of precisely defining the calculus concept of a limit, using quantifiers:One way of precisely defining the calculus concept of a limit, using quantifiers: Topic #3 – Predicate Logic

1.48 CompSci 102© Michael Frank Deduction Example Definitions: s :≡ Socrates (ancient Greek philosopher) ; H(x) :≡ “x is human”; M(x) :≡ “x is mortal”.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 h umans are mortal.Premises: H(s) Socrates is human.  x H(x)  M(x) All h umans are mortal. Topic #3 – Predicate Logic

1.49 CompSci 102© Michael Frank 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. Topic #3 – Predicate Logic

1.50 CompSci 102© Michael Frank Another Example Definitions: H(x) :≡ “x is human”; M(x) :≡ “x is mortal”; G(x) :≡ “x is a god”Definitions: H(x) :≡ “x is human”; M(x) :≡ “x is mortal”; G(x) :≡ “x is a god” Premises: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.”)Show that  x (H(x)  G(x)) (“No human is a god.”) Topic #3 – Predicate Logic

1.51 CompSci 102© Michael Frank The Derivation  x H(x)  M(x) and  x G(x)  M(x).  x H(x)  M(x) and  x G(x)  M(x).  x  M(x)  H(x) [Contrapositive.]  x  M(x)  H(x) [Contrapositive.]  x [G(x)  M(x)]  [  M(x)  H(x)]  x [G(x)  M(x)]  [  M(x)  H(x)]  x G(x)  H(x) [Transitivity of .]  x G(x)  H(x) [Transitivity of .]  x  G(x)   H(x) [Definition of .]  x  G(x)   H(x) [Definition of .]  x  (G(x)  H(x)) [DeMorgan’s law.]  x  (G(x)  H(x)) [DeMorgan’s law.]  x G(x)  H(x) [An equivalence law.]  x G(x)  H(x) [An equivalence law.] Topic #3 – Predicate Logic

1.52 CompSci 102© Michael Frank End of § , Predicate Logic From these sections you should have learned: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:Upcoming topics: –Introduction to proof-writing. –Then: Set theory – a language for talking about collections of objects.a language for talking about collections of objects. Topic #3 – Predicate Logic