SlideShare une entreprise Scribd logo
1  sur  31
Télécharger pour lire hors ligne
Sindh Madressatul Islam
University, Karachi
Department of Computer Science
Discrete Structure 3rd Semester
Section E
Predicate Logic and Quantifies
in Discrete Structure
Outline
• Introduction
• Terminology:
– Propositional functions; arguments; arity; universe of
discourse
• Quantifiers
– Definition; using, mixing, negating them
• Logic Programming (Prolog)
• Transcribing English to Logic
• More exercises
Introduction
• Consider the statements:
x>3, x=y+4, x+y=z
• The symbols >, +, = denote relations between x and 3, x, y, and
4, and x,y, and z, respectively
• These relations may hold or not hold depending on the values
that x, y, and z may take.
• A predicate is a property that is affirmed or denied about the
subject (in logic, we say ‘variable’ or ‘argument’) of a statement
• Consider the statement : ‘x is greater than 3’
– ‘x’ is the subject
– ‘is greater than 3’ is the predicate
Propositional Functions (1)
• To write in Predicate Logic ‘x is greater than 3’
– We introduce a functional symbol for the predicate and
– Put the subject as an argument (to the functional symbol):
P(x)
• Terminology
– P(x) is a statement
– P is a predicate or propositional function
– x as an argument
Propositional Functions (2)
• Examples:
– Father(x): unary predicate
– Brother(x,y): binary predicate
– Sum(x,y,z): ternary predicate
– P(x,y,z,t): n-ary predicate
Propositional Functions (3)
• Definition: A statement of the form P(x1,x2,…, xn) is
the value of the propositional symbol P.
• Here: (x1,x2,…, xn) is an n-tuple and P is a predicate
• We can think of a propositional function as a
function that
– Evaluates to true or false
– Takes one or more arguments
– Expresses a predicate involving the argument(s)
– Becomes a proposition when values are assigned to the
arguments
Propositional Functions: Example
• Let Q(x,y,z) denote the statement ‘x2+y2=z2’
– What is the truth value of Q(3,4,5)?
– What is the truth value of Q(2,2,3)?
– How many values of (x,y,z) make the predicate
true?
Q(3,4,5) is true
There are infinitely many values that make the proposition true,
how many right triangles are there?
Q(2,2,3) is false
Universe of Discourse
• Consider the statement ‘x>3’, does it make
sense to assign to x the value ‘blue’?
• Intuitively, the universe of discourse is the set
of all things we wish to talk about; that is the
set of all objects that we can sensibly assign to
a variable in a propositional function.
• What would be the universe of discourse for
the propositional function below be:
EnrolledCSE235(x)=‘x is enrolled in CSE235’
Universe of Discourse: Multivariate functions
• Each variable in an n-tuple (i.e., each argument) may
have a different universe of discourse
• Consider an n-ary predicate P:
P(r,g,b,c)= ‘The rgb-values of the color c is (r,g,b)’
• Example, what is the truth value of
– P(255,0,0,red)
– P(0,0,255,green)
• What are the universes of discourse of (r,g,b,c)?
Outline
• Introduction
• Terminology:
– Propositional functions; arguments; arity; universe of
discourse
• Quantifiers
– Definition; using, mixing, negating them
• Logic Programming (Prolog)
• Transcribing English to Logic
• More exercises
Quantifiers: Introduction
• The statement ‘x>3’ is not a proposition
• It becomes a proposition
– When we assign values to the argument: ‘4>3’ is false, ‘2<3’ is true, or
– When we quantify the statement
• Two quantifiers
– Universal quantifier ∀ $forall$
the proposition is true for all possible values in the universe of
discourse
– Existential quantifier∃ $exists$
the proposition is true for some value(s) in the universe of discourse
Universal Quantifier: Definition
• Definition: The universal quantification of a
predicate P(x) is the proposition ‘P(x) is true for all
values of x in the universe of discourse.’ We use the
notation: ∀ x P(x), which is read ‘for all x’.
• If the universe of discourse is finite, say {n1,n2,…,nk},
then the universal quantifier is simply the
conjunction of the propositions over all the elements
∀ x P(x) ⇔ P(n1) ∧ P(n2) ∧ … ∧ P(nk)
Universal Quantifier: Example 1
• Let P(x): ‘x must take a discrete mathematics course’ and Q(x):
‘x is a CS student.’
• The universe of discourse for both P(x) and Q(x) is all UNL
students.
• Express the statements:
– “Every CS student must take a discrete mathematics course.”
– “Everybody must take a discrete mathematics course or be a CS
student.”
– “Everybody must take a discrete mathematics course and be a CS
student.”
∀ x Q(x) → P(x)
∀ x ( P(x) ∨ Q(x) )
∀ x ( P(x) ∧ Q(x) )
Are these statements true or false?
Universal Quantifier: Example 2
• Express the statement: ‘for every x and every
y, x+y>10’
• Answer:
– Let P(x,y) be the statement x+y>10
– Where the universe of discourse for x, y is the set
of integers
– The statement is: ∀x ∀y P(x,y)
• Shorthand: ∀x,y P(x,y)
Existential Quantifier: Definition
• Definition: The existential quantification of a
predicate P(x) is the proposition ‘There exists a value
x in the universe of discourse such that P(x) is true.’
We use the notation: ∃ x P(x), which is read ‘there
exists x’.
• If the universe of discourse is finite, say {n1,n2,…,nk},
then the existential quantifier is simply the
disjunction of the propositions over all the elements
∃ x P(x) ⇔ P(n1) ∨ P(n2) ∨ … ∨ P(nk)
Existential Quantifier: Example 1
• Let P(x,y) denote the statement ‘x+y=5’
• What does the expression ∃x ∃y P(x,y) mean?
• Which universe(s) of discourse make it true?
Existential Quantifier: Example 2
• Express the statement: ‘there exists a real solution to ax2+bx-
c=0’
• Answer:
– Let P(x) be the statement x= (-b±√(b2-4ac))/2a
– Where the universe of discourse for x is the set of real numbers. Note
here that a, b, c are fixed constants.
– The statement can be expressed as ∃x P(x)
• What is the truth value of ∃x P(x)?
– It is false. When b2<4ac, there are no real number x that can satisfy
the predicate
• What can we do so that ∃x P(x)is true?
– Change the universe of discourse to the complex numbers, C
Quantifiers: Truth values
• In general, when are quantified statements
true or false?
Statement True when… False when...
∀x P(x) P(x) is true for every x
There is an x for which
P(x) is false
∃x P(x)
There is an x for which
P(x) is true
P(x) is false for every x
Mixing quantifiers (1)
• Existential and universal quantifiers can be used
together to quantify a propositional predicate. For
example:
∀x ∃y P(x,y)
is perfectly valid
• Alert:
– The quantifiers must be read from left to right
– The order of the quantifiers is important
– ∀x ∃y P(x,y) is not equivalent to ∃y ∀x P(x,y)
Mixing quantifiers (2)
• Consider
– ∀x ∃y Loves (x,y): Everybody loves somebody
– ∃y ∀x Loves(x,y): There is someone loved by everyone
• The two expressions do not mean the same thing
• (∃y ∀x Loves(x,y)) → (∀x ∃y Loves (x,y)) but the
converse does not hold
• However, you can commute similar quantifiers
– ∀x ∀y P(x,y) is equivalent to ∀y ∀x P(x,y) (thus, ∀x,y P(x,y))
– ∃x ∃y P(x,y) is equivalent to ∃y ∃x P(x,y) (thus ∃x,y P(x,y))
Mixing Quantifiers: Truth values
Statement True when... False when...
∀x∀y P(x,y)
P(x,y) is true for every
pair x,y
There is at least one pair
x,y for which P(x,y) is false
∀x∃y P(x,y) For every x, there is a y
for which P(x,y) is true
There is an x for which
P(x,y) is false for every y
∃x∀y P(x,y) There is an x for which
P(x,y) is true for every y
For every x, there is a y for
which P(x,y) is false
∃x∃yP(x,y)
There is at least one pair
x,y for which P(x,y) is true
P(x,y) is false for every pair
x,y
Outline
• Introduction
• Terminology:
– Propositional functions; arguments; arity; universe of
discourse
• Quantifiers
– Definition; using, mixing, biding, negating them
• Logic Programming (Prolog)
• Transcribing English to Logic
• More exercises
Binding Variables
• When a quantifier is used on a variable x, we say that
x is bound
• If no quantifier is used on a variable in a predicate
statement, the variable is called free
• Examples
– In ∃x∀yP(x,y), both x and y are bound
– In ∀xP(x,y), x is bound but y is free
• A statement is called a well-formed formula, when all
variables are properly quantified
Binding Variables: Scope
• The set of all variables bound by a common
quantifier is called the scope of the quantifier
• For example, in the expression ∃x,y∀zP(x,y,z,c)
– What is the scope of existential quantifier?
– What is the scope of universal quantifier?
– What are the bound variables?
– What are the free variables?
– Is the expression a well-formed formula?
Negation
• We can use negation with quantified expressions as
we used them with propositions
• Lemma: Let P(x) be a predicate. Then the followings
hold:
¬(∀x P(x)) ≡ ∃x ¬P(x)
¬ (∃x P(x)) ≡ ∀x ¬P(x)
• This is essentially the quantified version of De
Morgan’s Law (when the universe of discourse is
finite, this is exactly De Morgan’s Law)
Negation: Truth
Truth Values of Negated Quantifiers
Statement True when… False when...
¬∃x P(x) ≡
∀x ¬P(x)
P(x) is false for every x
There is an x for which
P(x) is true
¬∀x P(x) ≡
∃x ¬P(x)
There is an x for which
P(x) is false
P(x) is true for every x
Outline
• Introduction
• Terminology:
– Propositional functions; arguments; arity; universe of
discourse
• Quantifiers
– Definition; using, mixing, negating them
• Logic Programming (Prolog)
• Transcribing English to Logic
• More exercises
Prolog (1)
• Prolog (Programming in Logic) is a
programming language based on (a restricted
form of) Predicate Logic (a.k.a. Predicate
Calculus and FOL)
• It was developed by the logicians of the
Artificial Intelligence community for symbolic
reasoning
Prolog (2)
• Prolog allows the users to express facts and rules
• Facts are propositional functions: student(mia),
enrolled(mia,cse235), instructor(patel,cse235), etc.
• Rules are implications with conjunctions:
teaches(X,Y) :- instructor(X,Z), enrolled(Y,Z)
• Prolog answers queries such as:
?enrolled(mia,cse235)
?enrolled(X,cse476)
?teaches(X,mia)
by binding variables and doing theorem proving (i.e., applying
inference rules) as we will see in Section 1.5
English into Logic
• Logic is more precise than English
• Transcribing English into Logic and vice versa can be tricky
• When writing statements with quantifiers, usually the correct
meaning is conveyed with the following combinations:
Use ∀ with ⇒
∀x Lion(x) ⇒ Fierce(x): Every lion is fierce
∀x Lion(x) ∧ Fierce(x): Everyone is a lion, and everyone is fierce
Use ∃ with ∧
∃ x Lion(x) ∧ Vegan(x): Holds when you have at least one vegan lion
∃ x Lion(x) ⇒ Vegan(x): Holds when you have vegan people in the
universe of discourse (even though there is no vegan lion in the
universe of discourse )

Contenu connexe

Tendances

Unit 1-logic
Unit 1-logicUnit 1-logic
Unit 1-logicraksharao
 
Quantifiers and its Types
Quantifiers and its TypesQuantifiers and its Types
Quantifiers and its TypesHumayunNaseer4
 
Predicates and quantifiers presentation topics
Predicates  and quantifiers  presentation topicsPredicates  and quantifiers  presentation topics
Predicates and quantifiers presentation topicsR.h. Himel
 
Fixed points of contractive and Geraghty contraction mappings under the influ...
Fixed points of contractive and Geraghty contraction mappings under the influ...Fixed points of contractive and Geraghty contraction mappings under the influ...
Fixed points of contractive and Geraghty contraction mappings under the influ...IJERA Editor
 
Fuzzy logic and application in AI
Fuzzy logic and application in AIFuzzy logic and application in AI
Fuzzy logic and application in AIIldar Nurgaliev
 
Potentialist reflection
Potentialist reflectionPotentialist reflection
Potentialist reflectionjamesstudd
 
Introduction to Artificial Intelligence
Introduction to Artificial IntelligenceIntroduction to Artificial Intelligence
Introduction to Artificial IntelligenceManoj Harsule
 
Fuzzy random variables and Kolomogrov’s important results
Fuzzy random variables and Kolomogrov’s important resultsFuzzy random variables and Kolomogrov’s important results
Fuzzy random variables and Kolomogrov’s important resultsinventionjournals
 
CPSC 125 Ch 1 sec 3
CPSC 125 Ch 1 sec 3CPSC 125 Ch 1 sec 3
CPSC 125 Ch 1 sec 3David Wood
 
Extension principle
Extension principleExtension principle
Extension principleSavo Delić
 

Tendances (20)

Predicate &amp; quantifier
Predicate &amp; quantifierPredicate &amp; quantifier
Predicate &amp; quantifier
 
Unit 1-logic
Unit 1-logicUnit 1-logic
Unit 1-logic
 
Quantifiers and its Types
Quantifiers and its TypesQuantifiers and its Types
Quantifiers and its Types
 
Formal Logic - Lesson 1 - Introduction to Logic
Formal Logic - Lesson 1 - Introduction to LogicFormal Logic - Lesson 1 - Introduction to Logic
Formal Logic - Lesson 1 - Introduction to Logic
 
Predicates and quantifiers presentation topics
Predicates  and quantifiers  presentation topicsPredicates  and quantifiers  presentation topics
Predicates and quantifiers presentation topics
 
Fuzzy logic
Fuzzy logicFuzzy logic
Fuzzy logic
 
Fixed points of contractive and Geraghty contraction mappings under the influ...
Fixed points of contractive and Geraghty contraction mappings under the influ...Fixed points of contractive and Geraghty contraction mappings under the influ...
Fixed points of contractive and Geraghty contraction mappings under the influ...
 
Fuzzy logic and application in AI
Fuzzy logic and application in AIFuzzy logic and application in AI
Fuzzy logic and application in AI
 
Quantum Search and Quantum Learning
Quantum Search and Quantum Learning Quantum Search and Quantum Learning
Quantum Search and Quantum Learning
 
FUZZY COMPLEMENT
FUZZY COMPLEMENTFUZZY COMPLEMENT
FUZZY COMPLEMENT
 
Potentialist reflection
Potentialist reflectionPotentialist reflection
Potentialist reflection
 
Formal Logic - Lesson 8 - Predicates and Quantifiers
Formal Logic - Lesson 8 - Predicates and QuantifiersFormal Logic - Lesson 8 - Predicates and Quantifiers
Formal Logic - Lesson 8 - Predicates and Quantifiers
 
2.2.ppt.SC
2.2.ppt.SC2.2.ppt.SC
2.2.ppt.SC
 
Introduction to Artificial Intelligence
Introduction to Artificial IntelligenceIntroduction to Artificial Intelligence
Introduction to Artificial Intelligence
 
Course notes2summer2012
Course notes2summer2012Course notes2summer2012
Course notes2summer2012
 
FUZZY LOGIC
FUZZY LOGICFUZZY LOGIC
FUZZY LOGIC
 
Fuzzy random variables and Kolomogrov’s important results
Fuzzy random variables and Kolomogrov’s important resultsFuzzy random variables and Kolomogrov’s important results
Fuzzy random variables and Kolomogrov’s important results
 
CPSC 125 Ch 1 sec 3
CPSC 125 Ch 1 sec 3CPSC 125 Ch 1 sec 3
CPSC 125 Ch 1 sec 3
 
Classical Sets & fuzzy sets
Classical Sets & fuzzy setsClassical Sets & fuzzy sets
Classical Sets & fuzzy sets
 
Extension principle
Extension principleExtension principle
Extension principle
 

Similaire à Predicate Logic and Quantifiers in Discrete Structures

Similaire à Predicate Logic and Quantifiers in Discrete Structures (20)

Chapter 01 - p2.pdf
Chapter 01 - p2.pdfChapter 01 - p2.pdf
Chapter 01 - p2.pdf
 
1606751772-ds-lecture-6.ppt
1606751772-ds-lecture-6.ppt1606751772-ds-lecture-6.ppt
1606751772-ds-lecture-6.ppt
 
Discreate structure presentation introduction
Discreate structure presentation introductionDiscreate structure presentation introduction
Discreate structure presentation introduction
 
PredicateLogic (1).ppt
PredicateLogic (1).pptPredicateLogic (1).ppt
PredicateLogic (1).ppt
 
PredicateLogic.pptx
PredicateLogic.pptxPredicateLogic.pptx
PredicateLogic.pptx
 
Module_5_1.pptx
Module_5_1.pptxModule_5_1.pptx
Module_5_1.pptx
 
Predicates and quantifiers
Predicates and quantifiersPredicates and quantifiers
Predicates and quantifiers
 
X02PredCalculus.ppt
X02PredCalculus.pptX02PredCalculus.ppt
X02PredCalculus.ppt
 
Predicates Logic.pptx
Predicates Logic.pptxPredicates Logic.pptx
Predicates Logic.pptx
 
SESSION-11 PPT.pptx
SESSION-11 PPT.pptxSESSION-11 PPT.pptx
SESSION-11 PPT.pptx
 
Per3 logika
Per3 logikaPer3 logika
Per3 logika
 
Use of quantifiers
Use of quantifiersUse of quantifiers
Use of quantifiers
 
Logic
LogicLogic
Logic
 
Discrete Math Lecture 02: First Order Logic
Discrete Math Lecture 02: First Order LogicDiscrete Math Lecture 02: First Order Logic
Discrete Math Lecture 02: First Order Logic
 
dma_ppt.pdf
dma_ppt.pdfdma_ppt.pdf
dma_ppt.pdf
 
3 fol examples v2
3 fol examples v23 fol examples v2
3 fol examples v2
 
Math
MathMath
Math
 
continuity of module 2.pptx
continuity of module 2.pptxcontinuity of module 2.pptx
continuity of module 2.pptx
 
Universal Quantification DM
Universal Quantification DMUniversal Quantification DM
Universal Quantification DM
 
Predicate logic_2(Artificial Intelligence)
Predicate logic_2(Artificial Intelligence)Predicate logic_2(Artificial Intelligence)
Predicate logic_2(Artificial Intelligence)
 

Plus de MuhammadUmerIhtisham

Lect 13, 14 (final)AVL Tree and Rotations.pdf
Lect 13, 14 (final)AVL Tree and Rotations.pdfLect 13, 14 (final)AVL Tree and Rotations.pdf
Lect 13, 14 (final)AVL Tree and Rotations.pdfMuhammadUmerIhtisham
 
LEC 7-DS ALGO(expression and huffman).pdf
LEC 7-DS  ALGO(expression and huffman).pdfLEC 7-DS  ALGO(expression and huffman).pdf
LEC 7-DS ALGO(expression and huffman).pdfMuhammadUmerIhtisham
 
SMIU Discrete Structure Lecture 3 Section 3E.pdf
SMIU Discrete Structure Lecture 3 Section 3E.pdfSMIU Discrete Structure Lecture 3 Section 3E.pdf
SMIU Discrete Structure Lecture 3 Section 3E.pdfMuhammadUmerIhtisham
 
Discrete Structure Lecture #7 & 8.pdf
Discrete Structure Lecture #7 & 8.pdfDiscrete Structure Lecture #7 & 8.pdf
Discrete Structure Lecture #7 & 8.pdfMuhammadUmerIhtisham
 
SMIU Lecture #1 & 2 Introduction to Discrete Structure and Truth Table.pdf
SMIU Lecture #1 & 2 Introduction to Discrete Structure and Truth Table.pdfSMIU Lecture #1 & 2 Introduction to Discrete Structure and Truth Table.pdf
SMIU Lecture #1 & 2 Introduction to Discrete Structure and Truth Table.pdfMuhammadUmerIhtisham
 

Plus de MuhammadUmerIhtisham (14)

LECT 10, 11-DSALGO(Hashing).pdf
LECT 10, 11-DSALGO(Hashing).pdfLECT 10, 11-DSALGO(Hashing).pdf
LECT 10, 11-DSALGO(Hashing).pdf
 
LEC 12-DSALGO-GRAPHS(final12).pdf
LEC 12-DSALGO-GRAPHS(final12).pdfLEC 12-DSALGO-GRAPHS(final12).pdf
LEC 12-DSALGO-GRAPHS(final12).pdf
 
Lect 13, 14 (final)AVL Tree and Rotations.pdf
Lect 13, 14 (final)AVL Tree and Rotations.pdfLect 13, 14 (final)AVL Tree and Rotations.pdf
Lect 13, 14 (final)AVL Tree and Rotations.pdf
 
LEC4-DS ALGO.pdf
LEC4-DS  ALGO.pdfLEC4-DS  ALGO.pdf
LEC4-DS ALGO.pdf
 
LEC3-DS ALGO(updated).pdf
LEC3-DS  ALGO(updated).pdfLEC3-DS  ALGO(updated).pdf
LEC3-DS ALGO(updated).pdf
 
LEC 7-DS ALGO(expression and huffman).pdf
LEC 7-DS  ALGO(expression and huffman).pdfLEC 7-DS  ALGO(expression and huffman).pdf
LEC 7-DS ALGO(expression and huffman).pdf
 
LEC 8-DS ALGO(heaps).pdf
LEC 8-DS  ALGO(heaps).pdfLEC 8-DS  ALGO(heaps).pdf
LEC 8-DS ALGO(heaps).pdf
 
LEC 5-DS ALGO(updated).pdf
LEC 5-DS  ALGO(updated).pdfLEC 5-DS  ALGO(updated).pdf
LEC 5-DS ALGO(updated).pdf
 
LEC 6-DS ALGO(updated).pdf
LEC 6-DS  ALGO(updated).pdfLEC 6-DS  ALGO(updated).pdf
LEC 6-DS ALGO(updated).pdf
 
lect 1-ds algo(final)_2.pdf
lect 1-ds  algo(final)_2.pdflect 1-ds  algo(final)_2.pdf
lect 1-ds algo(final)_2.pdf
 
lect 2-DS ALGO(online).pdf
lect 2-DS  ALGO(online).pdflect 2-DS  ALGO(online).pdf
lect 2-DS ALGO(online).pdf
 
SMIU Discrete Structure Lecture 3 Section 3E.pdf
SMIU Discrete Structure Lecture 3 Section 3E.pdfSMIU Discrete Structure Lecture 3 Section 3E.pdf
SMIU Discrete Structure Lecture 3 Section 3E.pdf
 
Discrete Structure Lecture #7 & 8.pdf
Discrete Structure Lecture #7 & 8.pdfDiscrete Structure Lecture #7 & 8.pdf
Discrete Structure Lecture #7 & 8.pdf
 
SMIU Lecture #1 & 2 Introduction to Discrete Structure and Truth Table.pdf
SMIU Lecture #1 & 2 Introduction to Discrete Structure and Truth Table.pdfSMIU Lecture #1 & 2 Introduction to Discrete Structure and Truth Table.pdf
SMIU Lecture #1 & 2 Introduction to Discrete Structure and Truth Table.pdf
 

Dernier

Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfJayanti Pande
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Krashi Coaching
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104misteraugie
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphThiyagu K
 
9548086042 for call girls in Indira Nagar with room service
9548086042  for call girls in Indira Nagar  with room service9548086042  for call girls in Indira Nagar  with room service
9548086042 for call girls in Indira Nagar with room servicediscovermytutordmt
 
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationnomboosow
 
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...Sapna Thakur
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdfQucHHunhnh
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityGeoBlogs
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactdawncurless
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introductionMaksud Ahmed
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxGaneshChakor2
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxSayali Powar
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfsanyamsingh5019
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingTechSoup
 
Disha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdfDisha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdfchloefrazer622
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13Steve Thomason
 
Separation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesSeparation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesFatimaKhan178732
 
Arihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfArihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfchloefrazer622
 
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...fonyou31
 

Dernier (20)

Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdf
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot Graph
 
9548086042 for call girls in Indira Nagar with room service
9548086042  for call girls in Indira Nagar  with room service9548086042  for call girls in Indira Nagar  with room service
9548086042 for call girls in Indira Nagar with room service
 
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communication
 
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activity
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impact
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introduction
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptx
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdf
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy Consulting
 
Disha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdfDisha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdf
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13
 
Separation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesSeparation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and Actinides
 
Arihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfArihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdf
 
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
 

Predicate Logic and Quantifiers in Discrete Structures

  • 1. Sindh Madressatul Islam University, Karachi Department of Computer Science Discrete Structure 3rd Semester Section E
  • 2. Predicate Logic and Quantifies in Discrete Structure
  • 3. Outline • Introduction • Terminology: – Propositional functions; arguments; arity; universe of discourse • Quantifiers – Definition; using, mixing, negating them • Logic Programming (Prolog) • Transcribing English to Logic • More exercises
  • 4. Introduction • Consider the statements: x>3, x=y+4, x+y=z • The symbols >, +, = denote relations between x and 3, x, y, and 4, and x,y, and z, respectively • These relations may hold or not hold depending on the values that x, y, and z may take. • A predicate is a property that is affirmed or denied about the subject (in logic, we say ‘variable’ or ‘argument’) of a statement • Consider the statement : ‘x is greater than 3’ – ‘x’ is the subject – ‘is greater than 3’ is the predicate
  • 5. Propositional Functions (1) • To write in Predicate Logic ‘x is greater than 3’ – We introduce a functional symbol for the predicate and – Put the subject as an argument (to the functional symbol): P(x) • Terminology – P(x) is a statement – P is a predicate or propositional function – x as an argument
  • 6. Propositional Functions (2) • Examples: – Father(x): unary predicate – Brother(x,y): binary predicate – Sum(x,y,z): ternary predicate – P(x,y,z,t): n-ary predicate
  • 7. Propositional Functions (3) • Definition: A statement of the form P(x1,x2,…, xn) is the value of the propositional symbol P. • Here: (x1,x2,…, xn) is an n-tuple and P is a predicate • We can think of a propositional function as a function that – Evaluates to true or false – Takes one or more arguments – Expresses a predicate involving the argument(s) – Becomes a proposition when values are assigned to the arguments
  • 8. Propositional Functions: Example • Let Q(x,y,z) denote the statement ‘x2+y2=z2’ – What is the truth value of Q(3,4,5)? – What is the truth value of Q(2,2,3)? – How many values of (x,y,z) make the predicate true? Q(3,4,5) is true There are infinitely many values that make the proposition true, how many right triangles are there? Q(2,2,3) is false
  • 9. Universe of Discourse • Consider the statement ‘x>3’, does it make sense to assign to x the value ‘blue’? • Intuitively, the universe of discourse is the set of all things we wish to talk about; that is the set of all objects that we can sensibly assign to a variable in a propositional function. • What would be the universe of discourse for the propositional function below be: EnrolledCSE235(x)=‘x is enrolled in CSE235’
  • 10. Universe of Discourse: Multivariate functions • Each variable in an n-tuple (i.e., each argument) may have a different universe of discourse • Consider an n-ary predicate P: P(r,g,b,c)= ‘The rgb-values of the color c is (r,g,b)’ • Example, what is the truth value of – P(255,0,0,red) – P(0,0,255,green) • What are the universes of discourse of (r,g,b,c)?
  • 11. Outline • Introduction • Terminology: – Propositional functions; arguments; arity; universe of discourse • Quantifiers – Definition; using, mixing, negating them • Logic Programming (Prolog) • Transcribing English to Logic • More exercises
  • 12. Quantifiers: Introduction • The statement ‘x>3’ is not a proposition • It becomes a proposition – When we assign values to the argument: ‘4>3’ is false, ‘2<3’ is true, or – When we quantify the statement • Two quantifiers – Universal quantifier ∀ $forall$ the proposition is true for all possible values in the universe of discourse – Existential quantifier∃ $exists$ the proposition is true for some value(s) in the universe of discourse
  • 13. Universal Quantifier: Definition • Definition: The universal quantification of a predicate P(x) is the proposition ‘P(x) is true for all values of x in the universe of discourse.’ We use the notation: ∀ x P(x), which is read ‘for all x’. • If the universe of discourse is finite, say {n1,n2,…,nk}, then the universal quantifier is simply the conjunction of the propositions over all the elements ∀ x P(x) ⇔ P(n1) ∧ P(n2) ∧ … ∧ P(nk)
  • 14. Universal Quantifier: Example 1 • Let P(x): ‘x must take a discrete mathematics course’ and Q(x): ‘x is a CS student.’ • The universe of discourse for both P(x) and Q(x) is all UNL students. • Express the statements: – “Every CS student must take a discrete mathematics course.” – “Everybody must take a discrete mathematics course or be a CS student.” – “Everybody must take a discrete mathematics course and be a CS student.” ∀ x Q(x) → P(x) ∀ x ( P(x) ∨ Q(x) ) ∀ x ( P(x) ∧ Q(x) ) Are these statements true or false?
  • 15. Universal Quantifier: Example 2 • Express the statement: ‘for every x and every y, x+y>10’ • Answer: – Let P(x,y) be the statement x+y>10 – Where the universe of discourse for x, y is the set of integers – The statement is: ∀x ∀y P(x,y) • Shorthand: ∀x,y P(x,y)
  • 16. Existential Quantifier: Definition • Definition: The existential quantification of a predicate P(x) is the proposition ‘There exists a value x in the universe of discourse such that P(x) is true.’ We use the notation: ∃ x P(x), which is read ‘there exists x’. • If the universe of discourse is finite, say {n1,n2,…,nk}, then the existential quantifier is simply the disjunction of the propositions over all the elements ∃ x P(x) ⇔ P(n1) ∨ P(n2) ∨ … ∨ P(nk)
  • 17. Existential Quantifier: Example 1 • Let P(x,y) denote the statement ‘x+y=5’ • What does the expression ∃x ∃y P(x,y) mean? • Which universe(s) of discourse make it true?
  • 18. Existential Quantifier: Example 2 • Express the statement: ‘there exists a real solution to ax2+bx- c=0’ • Answer: – Let P(x) be the statement x= (-b±√(b2-4ac))/2a – Where the universe of discourse for x is the set of real numbers. Note here that a, b, c are fixed constants. – The statement can be expressed as ∃x P(x) • What is the truth value of ∃x P(x)? – It is false. When b2<4ac, there are no real number x that can satisfy the predicate • What can we do so that ∃x P(x)is true? – Change the universe of discourse to the complex numbers, C
  • 19. Quantifiers: Truth values • In general, when are quantified statements true or false? Statement True when… False when... ∀x P(x) P(x) is true for every x There is an x for which P(x) is false ∃x P(x) There is an x for which P(x) is true P(x) is false for every x
  • 20. Mixing quantifiers (1) • Existential and universal quantifiers can be used together to quantify a propositional predicate. For example: ∀x ∃y P(x,y) is perfectly valid • Alert: – The quantifiers must be read from left to right – The order of the quantifiers is important – ∀x ∃y P(x,y) is not equivalent to ∃y ∀x P(x,y)
  • 21. Mixing quantifiers (2) • Consider – ∀x ∃y Loves (x,y): Everybody loves somebody – ∃y ∀x Loves(x,y): There is someone loved by everyone • The two expressions do not mean the same thing • (∃y ∀x Loves(x,y)) → (∀x ∃y Loves (x,y)) but the converse does not hold • However, you can commute similar quantifiers – ∀x ∀y P(x,y) is equivalent to ∀y ∀x P(x,y) (thus, ∀x,y P(x,y)) – ∃x ∃y P(x,y) is equivalent to ∃y ∃x P(x,y) (thus ∃x,y P(x,y))
  • 22. Mixing Quantifiers: Truth values Statement True when... False when... ∀x∀y P(x,y) P(x,y) is true for every pair x,y There is at least one pair x,y for which P(x,y) is false ∀x∃y P(x,y) For every x, there is a y for which P(x,y) is true There is an x for which P(x,y) is false for every y ∃x∀y P(x,y) There is an x for which P(x,y) is true for every y For every x, there is a y for which P(x,y) is false ∃x∃yP(x,y) There is at least one pair x,y for which P(x,y) is true P(x,y) is false for every pair x,y
  • 23. Outline • Introduction • Terminology: – Propositional functions; arguments; arity; universe of discourse • Quantifiers – Definition; using, mixing, biding, negating them • Logic Programming (Prolog) • Transcribing English to Logic • More exercises
  • 24. Binding Variables • When a quantifier is used on a variable x, we say that x is bound • If no quantifier is used on a variable in a predicate statement, the variable is called free • Examples – In ∃x∀yP(x,y), both x and y are bound – In ∀xP(x,y), x is bound but y is free • A statement is called a well-formed formula, when all variables are properly quantified
  • 25. Binding Variables: Scope • The set of all variables bound by a common quantifier is called the scope of the quantifier • For example, in the expression ∃x,y∀zP(x,y,z,c) – What is the scope of existential quantifier? – What is the scope of universal quantifier? – What are the bound variables? – What are the free variables? – Is the expression a well-formed formula?
  • 26. Negation • We can use negation with quantified expressions as we used them with propositions • Lemma: Let P(x) be a predicate. Then the followings hold: ¬(∀x P(x)) ≡ ∃x ¬P(x) ¬ (∃x P(x)) ≡ ∀x ¬P(x) • This is essentially the quantified version of De Morgan’s Law (when the universe of discourse is finite, this is exactly De Morgan’s Law)
  • 27. Negation: Truth Truth Values of Negated Quantifiers Statement True when… False when... ¬∃x P(x) ≡ ∀x ¬P(x) P(x) is false for every x There is an x for which P(x) is true ¬∀x P(x) ≡ ∃x ¬P(x) There is an x for which P(x) is false P(x) is true for every x
  • 28. Outline • Introduction • Terminology: – Propositional functions; arguments; arity; universe of discourse • Quantifiers – Definition; using, mixing, negating them • Logic Programming (Prolog) • Transcribing English to Logic • More exercises
  • 29. Prolog (1) • Prolog (Programming in Logic) is a programming language based on (a restricted form of) Predicate Logic (a.k.a. Predicate Calculus and FOL) • It was developed by the logicians of the Artificial Intelligence community for symbolic reasoning
  • 30. Prolog (2) • Prolog allows the users to express facts and rules • Facts are propositional functions: student(mia), enrolled(mia,cse235), instructor(patel,cse235), etc. • Rules are implications with conjunctions: teaches(X,Y) :- instructor(X,Z), enrolled(Y,Z) • Prolog answers queries such as: ?enrolled(mia,cse235) ?enrolled(X,cse476) ?teaches(X,mia) by binding variables and doing theorem proving (i.e., applying inference rules) as we will see in Section 1.5
  • 31. English into Logic • Logic is more precise than English • Transcribing English into Logic and vice versa can be tricky • When writing statements with quantifiers, usually the correct meaning is conveyed with the following combinations: Use ∀ with ⇒ ∀x Lion(x) ⇒ Fierce(x): Every lion is fierce ∀x Lion(x) ∧ Fierce(x): Everyone is a lion, and everyone is fierce Use ∃ with ∧ ∃ x Lion(x) ∧ Vegan(x): Holds when you have at least one vegan lion ∃ x Lion(x) ⇒ Vegan(x): Holds when you have vegan people in the universe of discourse (even though there is no vegan lion in the universe of discourse )