today s lecture
play

Todays Lecture Chapter 1 Sections 1.3 & 1.4 ICS 6B Predicates - PDF document

Todays Lecture Chapter 1 Sections 1.3 & 1.4 ICS 6B Predicates & Quantifiers 1.3 Boolean Algebra & Logic Nested Quantifiers1.4 Lecture Notes for Summer Quarter, 2008 Michele Rousseau Set 2 Ch.


  1. Today’s Lecture � Chapter 1 �Sections 1.3 & 1.4� ICS 6B ● Predicates & Quantifiers �1.3� Boolean Algebra & Logic ● Nested Quantifiers�1.4� Lecture Notes for Summer Quarter, 2008 Michele Rousseau Set 2 – Ch. 1.3, 1.4 2 Lecture Set 2 - Chpts 1.3, 1.4 Predicates � Not everything can be expressed as T/F… so we use Predicate Logic Chapter 1: Section 1.3 � The term predicate is used similarly in grammar ● Subject: What we make an assertion about ● Subject: What we make an assertion about ● Predicate: What we assert about the subject Predicates & Quantifiers 4 Propositions For Example “X is less than 20” “Socrates is Mortal” Variable: x Predicate: less than 20 What is the Subject? Socrates So we say, What is the Predicate? being mortal Let P�x� denote the statement “x � 20” or P�x�: :�x � 20 or P�x�: : x � 20 “X is less than 20” “X i l h 20” P�x� has no truth value until the variable x is bound What is the Subject? X For example: What is the Predicate? less than 20 P�3� Set x�3 so P�3� : 3�20 � True P �25� is False Predicates become propositions once we P�‐32� is True add variables which we then can quantify. Lecture Set 2 - Chpts 1.3, 1.4 5 Lecture Set 2 - Chpts 1.3, 1.4 6 1

  2. Another Example Multiple Variables � “The security alarm is beeping in DBH” � You can also have multi‐variable predicates � Let A�x� denote the statement � For example “The security alarm is beeping in building x” ● Let R be the 3‐variable predicate R�x,y,z�::� x�y�z ● Find the truth value of So what would the truth value of A�DBH� be? ◘ R�2,‐1,5� How about A�ELH�? • x�1, y�‐1, z�5 • R�2,‐1,5� is ‐2�1�5 which is false ● Now try ◘ R�3,4,7� True ◘ R�x,4,y� x, y not bound 7 8 Lecture Set 2 - Chpts 1.3, 1.4 Lecture Set 2 - Chpts 1.3, 1.4 Quantifiers Universal Quantifier The Universal Quantification of P(x) is the statement. � Tell us the range of elements that the “P(x) for all values of x in the domain” proposition is true over � Notation : ∀ xP�x� � In other words… over how many objects ● ∀ is the universal quantifier the predicate is asserted. � In English � In English ● “for all x P�x� holds” ● “for every x P�x� holds” ● “for each x P�x� holds � A counterexample of ∀ xP�x� is an element for which P�x� is false Lecture Set 2 - Chpts 1.3, 1.4 9 Lecture Set 2 - Chpts 1.3, 1.4 10 The Universe For Example: � Propositions in predicate logic are statements on objects of a universe. � “All cars have wheels” � The universe is thus the domain of the ∀ xP�x� �individual� variables. U��All cars� � � � It can be It b P�x� denotes x has wheels ● the set of real numbers ● the set of integers ● the set of all cars on a parking lot ● the set of all students in a classroom ● etc… Lecture Set 2 - Chpts 1.3, 1.4 11 Lecture Set 2 - Chpts 1.3, 1.4 12 2

  3. Truth value of Universal Universal Quantifier & Conjunction Quantification If you can list all of the elements in the � What is the truth value of ∀ xP�x� universe of discourse U��1,2,3,4� Then ∀ xP�x� is equivalent to the conjunction P�x� �x * 25� 100 P�x 1 � � P�x 2 � � P�x 3 � �… � P�x n � FALSE – Why? y 4*25 is not � 100 If there were only 4 cars �c 1, c 2, c 3, c 4 � in our previous example � What is the truth value of ∀ xP�x� U��c 1, c 2, c 3, c 4 � U��1,2,3� P�x� �x 2 � 10 The we could translate the statement ∀ xP�x� to P�c 1 � � P�c 2 � � P�c 3 � �P�c 4 � TRUE 13 14 Lecture Set 2 - Chpts 1.3, 1.4 Lecture Set 2 - Chpts 1.3, 1.4 Existential Quantification Existential Quantifier � ∃ x means at least 1 object in the universe The Existential Quantification of P(x) is the statement. “There exists an element x in the domain such that P(x)” .. followed by P�x� means that P�x� is true for at least 1 object in the universe. � Notation: ∃ xP�x� ● ∃ is the existential quantifier � For example: � For example: � In English: “Somebody loves you” ● “There exists an x such that P�x�” ∃ xP�x� ● “There is an x such that P�x�” P�x� is the predicate meaning: “ x loves you” ● “There is at least one x such that P�x� holds” U��all living creatures� ● “For some x P�x�” ● “I can find an x such that P�x�” Lecture Set 2 - Chpts 1.3, 1.4 15 Lecture Set 2 - Chpts 1.3, 1.4 16 Existential Quantifier & Disjunction Truth value of Existential Quant. If you can list all of the elements in the universe of discourse � What is the truth value of ∃ xP�x� Then ∃ xP�x� is equivalent to the Disjunction U��1,2,3� P�x 1 � � P�x 2 � � P�x 3 � � … � P�x n � P�x� �x * 25� 100 True If there were only 5 living creatures �me bear If there were only 5 living creatures �me, bear, 4*25 is not � 100 cat, steve, pete� in our previous example � What is the truth value of ∃ xP�x� U��me, bear, U��1,8,20� cat, steve, pete� P�x� �x 2 � 10 Then we could translate ∃ xP�x� to True – Why? P�me� � P�bear� � P�girl� � P�steve� � P�pete� Lecture Set 2 - Chpts 1.3, 1.4 17 Lecture Set 2 - Chpts 1.3, 1.4 18 3

  4. Truth value of Uniqueness Quant. Uniqueness Quantifier � What is the truth value of ∃ ! xP�x� The Uniqueness Quantifier of P(x) is the statement. “There exists a unique x in the domain such that P(x)” U��1,2,3� � AKA Unique Existential Quantifier P�x� �x * 25� 100 � Notation: ∃ ! xP�x� or ∃ 1 xP�x� False � In English: 4*25 is not � 100 ● “There is a unique x such that P�x�” � What is the truth value of ∃ ! xP�x� ● “There is one and only one x such that P�x�” U��1,8,20� ● “One can find only one x such that P�x�.” P�x� �x 2 � 10 True 19 20 Lecture Set 2 - Chpts 1.3, 1.4 Lecture Set 2 - Chpts 1.3, 1.4 Some terms Reading Quantified Formulas � Bound – if a specific value is assigned to it � Read Left to right or if it is quantified Example � Free –if a variable is not bound. let U�� the set of airplanes� � Scope ‐ the part of the logical expression let F�x, y� denote "x flies faster than y". � , y� y to which the quantifier is applied ∀ x ∀ y F�x, y� can be translated initially as: Examples Bound Free "For every airplane x the following holds: x ∃ xP�x,y� is faster than every �any� airplane y". Bound Bound Free ∀ x� ∃ yP�x,y� �Q�x,y�� Bound Lecture Set 2 - Chpts 1.3, 1.4 21 Lecture Set 2 - Chpts 1.3, 1.4 22 More Examples More Examples Translate: ∀ x ∃ y F�x, y� U�R �all the real numbers� “For every airplane x the following holds: P�x,y�: x,* y�0 for some airplane y, x is faster than y". ∀ x ∀ y P�x, y� Note: These are or "Every airplane is faster than some airplane". not equivalen5 Which of these are True? Translate: ∃ x ∀ y F�x, y� ∀ x ∀ y P�x, y� ∀ x ∀ y P�x, y� False False "There exist an airplane x which satisfies the following: ∀ x ∃ y P�x, y� True �or such that� for every airplane y, x is faster than y". ∃ x ∀ y P�x, y� True or "There is an airplane which is faster than every airplane“ ∃ x ∃ y P�x, y� True or "Some airplane is faster than every airplane". Translate: ∃ x ∃ y F�x, y� For some airplane x there exists an airplane y such that x is faster than y" or “Some airplane is faster than some airplane". 23 24 4

  5. Negation of Quantifiers Negation of Quantifiers � ∀ x P�x� � ∃ x � P�x� � ∀ x P�x� � ∃ x � P�x� and and � ∃ x P�x� � ∀ x � P�x� � ∃ x P�x� � ∀ x � P�x� For Example For Example P�x� reprsents “x is happy” P�x� reprsents “x is happy” U��people� U��people� "There does not exist a person who is happy" "There does not exist a person who is happy" is equivalent to is equivalent to "Everyone is not happy". "Everyone is not happy". 25 26 Lecture Set 2 - Chpts 1.3, 1.4 Lecture Set 2 - Chpts 1.3, 1.4 English to Logical Expressions DeMorgan’s Laws F�x�: x is a fleegle S�x�: x is a snurd T�x�: x is a thingamabob U��fleegles, snurds, thingamabobs� “ Everything is a fleegle” ∀ x F�x� � � ∃ x � F�x� � � � � “ Nothing is snurd” ∀ x � S�x� � � ∃ x S�x� “ All fleegles are snurds” ∀ x� F�x� �S�x�� � ∀ x�� F�x� � S�x�� � ∀ x �� F�x� � � S�x�� � � ∃ x�F�x� � � S�x�� Lecture Set 2 - Chpts 1.3, 1.4 27 28 More English Translations HOMEWORK for SECTION 1.3 “ Some fleegles are thingamabobs” � 1,3,5,7,19,23 ∃ x �F�x� �T�x�� � � ∀ x �� F�x� � �T�x� “ No snurd is a thingamabob” ∀ x �S�x� � � T�x��� � ∃ x �S�x� �T�x�� � � � � �� � � � � � �� “If any fleegle is a snurd then it's also a thingamabob” ∀ x� �F�x� � S�x���T�x�� � � ∃ x�F�x� �S�x� � � T�x�� Lecture Set 2 - Chpts 1.3, 1.4 29 Lecture Set 2 - Chpts 1.3, 1.4 30 5

Recommend


More recommend