0% found this document useful (0 votes)
43 views35 pages

Presentation 3

This document discusses predicate logic and its applications in artificial intelligence. It begins with an overview of the key components of predicate logic, including predicates, predicate symbols, variables, and quantifiers such as universal and existential quantifiers. It then provides examples of how these components can be used to formalize statements. The document goes on to explain how predicate logic is used in various AI applications such as knowledge representation, rule-based systems, natural language processing, planning and reasoning. It concludes by discussing how proofs are constructed in predicate logic using rules of inference and variable substitution.

Uploaded by

mujtaba
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
43 views35 pages

Presentation 3

This document discusses predicate logic and its applications in artificial intelligence. It begins with an overview of the key components of predicate logic, including predicates, predicate symbols, variables, and quantifiers such as universal and existential quantifiers. It then provides examples of how these components can be used to formalize statements. The document goes on to explain how predicate logic is used in various AI applications such as knowledge representation, rule-based systems, natural language processing, planning and reasoning. It concludes by discussing how proofs are constructed in predicate logic using rules of inference and variable substitution.

Uploaded by

mujtaba
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 35

Predicate Logic and Set Theory

Predicates logic
• Predicate logic, also known as first-order logic, is an extension of
propositional logic that introduces additional elements to represent
relationships and properties involving objects. The key components of
predicate logic are predicates and quantifiers.
• Predicates:
• Predicate Symbols: In predicate logic, propositions can contain
predicate symbols that represent relationships or properties. A
predicate symbol followed by its arguments forms a predicate,
denoting a relation or property.
Predicates logic
• Examples:
• P (x): "x is a person."
• Q (x,y): "x loves y."
• R (x,y,z): "x is the parent of y and z."
• Variables in Predicates: Predicates can include variables, allowing
for generalizations and quantifications over individuals.
Quantifiers

• Universal Quantifier (∀): The universal quantifier asserts that a


statement holds for all elements in the domain.
Example:
∀xP(x) reads as "For all x, x is a person.”
• Existential Quantifier (∃): The existential quantifier asserts that
there exists at least one element in the domain for which the statement
is true.
Example:
∃xQ(x,y) reads as "There exists x such that x loves y."
Quantifiers Cont..
• Scope of Quantifiers: The scope of a quantifier is the part of the
logical expression affected by the quantifier. The scope is typically
defined by parentheses.
• Nested Quantifiers: Quantifiers can be nested, indicating
combinations of universal and existential quantifications.
Example:
∀x∃y Q(x,y) reads as "For all x, there exists y such that x loves y."
Quantifiers Cont..
Examples:
1. Formalization of Statements:
• "All men are mortal" can be formalized as ∀x(Man(x)⇒Mortal(x)).
• "Some students love math" can be formalized as ∃x(Student(x)∧
LovesMath(x)).
2. Negation with Quantifiers:
• The negation of ∀xP(x) is ∃x¬P(x), and the negation of ∃xQ(x) is ∀x¬Q(x).
3. Mixed Quantifiers:
• ∀x∃y Q(x,y) reads as "For all x, there exists a y such that x loves y."
Quantifiers Cont..
• Predicate logic provides a more flexible and expressive framework
than propositional logic, enabling the representation of complex
relationships, properties, and quantifications over a domain of objects.
Predicates logic in Artificial Intelligence
• Predicate logic, also known as first-order logic, plays a crucial role in artificial
intelligence (AI) for knowledge representation and reasoning. It provides a formalism
for representing complex relationships, properties, and quantifications over objects in a
way that is more expressive than propositional logic. Here are some key ways in which
predicate logic is used in AI:
1. Knowledge Representation:
• Entities and Relationships: Predicate logic is used to represent entities (objects or
individuals) and their relationships in a structured manner. For example, in a medical
knowledge base, entities could be patients, and relationships could be "hasSymptom,"
"diagnosedWith," etc.
• Attributes and Properties: It allows the representation of attributes and properties of
entities. For instance, properties like "age," "gender," or "temperature" can be expressed
using predicate logic.
Predicates logic in Artificial Intelligence
Cont..
2. Rule-Based Systems:
• Inference Rules: Predicate logic is employed in rule-based systems where
rules are expressed using logical statements. These rules guide the
system's inference and decision-making processes. For example, an
expert system for diagnosing diseases might use rules like "if a patient
has a fever and cough, then they might have the flu.”
3. Querying and Retrieval:
• Query Languages: Predicate logic provides the foundation for query
languages in AI. Systems can use queries to retrieve information from a
knowledge base. For instance, a query might ask for all patients who are
diagnosed with a specific condition.
Predicates logic in Artificial Intelligence
Cont..
4. Planning and Decision Making:
• Action Representation: Predicate logic is used to represent actions
and their effects. In AI planning systems, actions are often expressed
as logical statements, and the effects of actions are modeled using
predicates.
• Decision Rules: Predicate logic is used to express decision rules in
decision support systems. For instance, a system helping with financial
planning might use rules like "if income > expenses, then save
money."
Predicates logic in Artificial Intelligence
Cont..
5. Natural Language Processing (NLP):
• Semantic Representation: Predicate logic is utilized for representing the semantics of
natural language expressions. It helps bridge the gap between the ambiguity of natural
language and the precision of logical representations.
• Understanding Language Constructs: In NLP tasks, predicate logic is used to
understand and represent relationships, actions, and entities mentioned in text.
6. Expert Systems:
• Knowledge Base: In expert systems, predicate logic is often used to build a
knowledge base that captures the expertise of human experts. The knowledge base
consists of facts and rules expressed in predicate logic.
• Inference Engine: Predicate logic forms the basis for the inference engine in expert
systems, allowing them to draw conclusions based on the available knowledge.
Predicates logic in Artificial Intelligence
Cont..
7. Database Querying:
• Relational Databases: Predicate logic underlies the principles of
relational databases. SQL queries, which are used to retrieve
information from relational databases, have a logical foundation
rooted in predicate logic.
• Predicate logic provides a versatile and powerful framework for
representing and reasoning about knowledge in AI systems. Its ability
to express complex relationships, properties, and quantifications
makes it a fundamental tool for knowledge representation and logical
inference in various AI applications.
Proofs in Predicate Logic
• A proof in predicate logic has much the same form as a proof in
propositional logic.
• We begin with a set of axioms (or hypotheses) A1..An, and using the
rules of inference, we construct a sequence of expressions that follow
from those axioms.
• We can use the rules of inference from propositional logic as inference
rules in predicate logic, including modus ponens, DeMorgan's laws, and
the substitution of equals.
• We require that each hypothesis and line in the proof be a closed
expression (ie, there are no free variables whose scope extends beyond a
line in the proof).
Proofs in Predicate Logic Cont..
• Substitution Rule
• The law of variable substitution is an inference rule for use in proofs in predicate logic.
• Informally, this rule states that having established that a general fact (or expression) is true, we can
assert that a specific instance of that general expression is also true.
• In particular, if we can prove (or assert as an axiom) a logical expression L1 containing free
variables, then if we substitute constants or variables for some of the free variables in L1 to create
expression L2, then the law of substitution states that L1 -> L2 is a tautology, and we can assert L2
in the proof.
• Consider the following assertion about the domain of real numbers:
Lt(x,y) -> (E z) (Lt(x,z) AND Lt(z,y))
• If we substitute x=2 and y=5 in the original expression, then we can assert:
Lt(2,5) -> (E z) (Lt(2,z) AND Lt(z,5))
• In other words, if the original expression holds for all x and y, then it must hold for x=2 and y=5.
• Note that choosing x=5 and y=2 makes Lt(x,y) = false, and the entire expression is still true (since
false->anything is true).
Example Database of Facts and Rules

Facts Rules

1. male(Adam) 1. parent(y,x) AND male(x) -> son(x,y)


2. male(Barney) 2. parent(y,x) AND female(x) -> daughter(x,y)
3. male(Bob) 3. male(x) AND (E z)(parent(z,x) AND parent(z,y)) -> brother(x,y)
4. male(Carl) 4. female(x) AND (E z)(parent(z,x) AND parent(z,y)) -> sister(x,y)
5. Female(Ann) 5. male(x) AND (E y)(parent(x,y) AND parent(y,z)) -> grandfather(x,z)
6. female(Beth) 6. female(x) AND (E y)(parent(x,y) AND parent(y,z)) -> grandmother(x,z)
7. female(Barb)
8. female(Carol)
9. parent(Adam,Barney)
10. parent(Ann,Barney)
11. parent(Adam,Beth)
12. parent(Ann,Beth)
13. parent(Adam,Bob)
14. parent(Ann,Bob)
15. parent(Adam,Barb)
16. parent(Barney,Carl)
17. parent(Carol,Carl)
Example Proof using Substitution
Prove son(Barney,Adam)
1. male(Adam Fact 1
2. male(Barney) Fact 2
3. parent(Adam,Barney) Fact 9
4. parent(y,x) AND male(x) -> son(x,y) Rule 1
5. parent(Adam,Barney) AND male(Barney) L2,L3
6. parent(Adam,Barney) AND male(Barney) -> son(Barney,Adam) L5, L4, sub
7. son(Barney,Adam) L5, L6, m.p.

Note that we selected the facts and the rule that would help us prove son(Barney,Adam).

•There's only one rule that allows us to infer the son relationship, so we included that rule.
•We need facts about the parent relationship that include reference to Adam and Barney.
•We need facts about the male relationship that include (possibly) Adam and Barney.
Example Proof with Quantifiers

Prove brother(Barney,Beth):
1. male(Barney). Fact 2
2. parent(Adam,Barney) Fact 9
3. parent(Adam,Beth) Fact 11
4. male(x) AND (E z)(parent(z,x) AND parent(z,y)) -> brother(x,y) Rule 3
5. male(Barney) AND (E z)(parent(z,Barney) AND parent(z,Beth)) -> brother(Barney,Beth) L4, sub
6. male(Barney) AND parent(Adam,Barney) AND parent(Adam,Beth) L1, L2, L3
7. brother(Barney,Beth) L5, L6, m.p.
Predicate logic better than propositional logic?
• Whether predicate logic is "better" than propositional logic depends on
the context and the specific requirements of a given logical task. Both
predicate logic and propositional logic serve different purposes and have
their own strengths and weaknesses.
• Propositional Logic:
• Simplicity: Propositional logic is simpler and more straightforward. It
deals with propositions and their combinations using logical connectives
(AND, OR, NOT).
• Limited Expressiveness: Propositional logic lacks the ability to
represent relationships between objects, quantify over individuals, or
express the internal structure of propositions.
Predicate logic better than propositional logic?
Cont…
• Predicate Logic:
• Expressiveness: Predicate logic is more expressive and allows for the
representation of relationships, properties, and quantifications over
objects. It can express complex statements involving variables,
predicates, and quantifiers.
• Increased Complexity: With increased expressiveness comes
increased complexity. Predicate logic is more intricate than
propositional logic and may require a deeper understanding of logic.
Predicate logic better than propositional logic?
Cont…
• Use Cases:
• Propositional Logic:
• Suitable for tasks where only truth values matter, and relationships between
objects are not a concern.
• Used in simple logical reasoning tasks and some areas of computer science
and artificial intelligence.
• Predicate Logic:
• Essential for representing relationships and properties of objects in a more
detailed and nuanced way.
• Widely used in knowledge representation, database query languages, natural
language processing, and more complex areas of AI and computer science.
Predicate logic better than propositional logic?
Cont…
• Considerations:
• Task Complexity: For simple tasks with no need for complex
relationships or quantification, propositional logic might be sufficient.
• Expressiveness Requirements: If the task involves intricate
relationships, properties, or quantification over individuals, predicate
logic is often necessary.
• Computational Complexity: Predicate logic may be computationally
more intensive than propositional logic due to its increased
expressiveness.
Predicate logic better than propositional logic?
Cont…
• Example:
• Consider the statement:
P: "It is raining."
Q: "John likes pizza."
• In propositional logic, we can say P∧Q to represent "It is raining, and John likes
pizza." However, if we want to express more complex statements involving
relationships or quantifications (e.g., "For all people, if they like pizza, then they
enjoy eating out."), predicate logic becomes necessary.
• In summary, whether predicate logic is better than propositional logic depends on
the nature of the logical task and the level of expressiveness and complexity
required for representation. Both logics have their applications, and the choice
depends on the specific needs of the problem at hand.
The notation of set theory
• Set theory is a branch of mathematical logic that studies sets, which are
collections of objects. The notation of set theory includes symbols and
conventions to represent various operations, relationships, and concepts related
to sets. Here are some commonly used symbols and notations in set theory:
• Basic Notations:
1.Set Notation:
1. A set is typically denoted by curly braces: A={1,2,3}.
2. The empty set is represented by ∅ or {}.
2.Element Relation:
1. a ∈ A: "a is an element of A."
2. b ∉ A:: "b is not an element of A."
The notation of set theory Cont..
• Set Operations:
1. Union:
• A∪B: Union of sets A and B (elements in either A or B or both).
2. Intersection:
• A∩B: Intersection of sets A and B (elements common to both A and B).
3. Complement:
• ′A′ or ‾A: Complement of set A (elements not in A).
4. Difference:
• A−B or A\B: Set difference (elements in A but not in B).
5. Cartesian Product:
• A×B: Cartesian product of sets A and B (set of ordered pairs).
The notation of set theory Cont..
• Set Relations:
1. Subset:
• A⊆B or A⊂B: A is a subset of B.
2. Proper Subset:
• A⊊B: A is a proper subset of B (A is a subset of B, but not equal to B).
3. Power Set:
• P(A): Power set of A (set of all subsets of A).
The notation of set theory Cont..
• Quantifiers:
1. Universal Quantifier:
• ∀: "For all" or "for every."
2. Existential Quantifier:
• ∃: "There exists" or "there is."
The notation of set theory Cont..
Special Sets:
1. Natural Numbers:
• N: Set of natural numbers.
2. Integers:
• Z: Set of integers.
3. Rational Numbers:
• Q: Set of rational numbers.
4. Real Numbers:
• R: Set of real numbers.
5. Complex Numbers:
• C: Set of complex numbers.
The notation of set theory Cont..
Set Builder Notation:

• {x ∣ condition on x}: Set of elements x that satisfy a given condition.


• These notations provide a concise and standardized way to express
various concepts and operations within set theory. They are widely
used in mathematics and related fields for precise communication and
representation of mathematical structures.
Set operations of union
• The union of sets is a fundamental operation in set theory. It combines the
elements of two or more sets to create a new set containing all distinct
elements from the original sets. The union operation is denoted by the symbol
∪. The union of sets A and B is represented as A∪B. Here's how the union
operation works:
Union Operation:
• Given two sets, A and B, their union A∪B is the set containing all elements
that are in A, or in B, or in both. A ∪ B={x ∣ x ∈ A or x ∈ B}
• Example:
Let's consider two sets: A={1,2,3} B={3,4,5}
• The union of A and B, denoted as A∪B={1,2,3,4,5}
Set operations of Intersection

• Intersection (A∩B ) :
• The intersection of sets A and B, denoted by A∩B, is the set of all
elements that are common to both sets A and B.
A∩B={x ∣ x ∈ A and x ∈ B}

Example:
Let's consider two sets: A={1,2,3,4} B={3,4,5,6}
• The intersection of A and B, denoted as A∩B, is: = A∩B={3,4}
• In this case, the common elements between sets A and B are 3 and 4.
Set operations of complementation
Complementation ( ′A′ or ‾A ) :
• The complement of a set A, denoted by ′A′ or ‾A, is the set of all elements in a universal set U
that are not in A.
A′={x ∣ x ∈ / A}
• The complement is taken with respect to some universal set U, which contains all the
elements under consideration.
Example:
• Let's consider a universal set U={1,2,3,4,5} and a set A={2,4}. The complement of A,
denoted as ′A′, is:
A′={1,3,5}

• These are the elements in the universal set U that are not in A.
Set operations of Difference
• Difference ( A−B or A\B ) :
• The difference of sets A and B, denoted by A−B or A\B, is the set of all elements that are in A
but not in B.
A−B={x ∣ x ∈ A and x ∈ / B}
Example:
Let's consider two sets:
A={1,2,3,4} B={3,4,5,6}
• The difference of A and B, denoted as A−B or A\B, is:
A−B={1,2}
• In this case, the result contains all elements from set A that are not in set B.
Set operations of Cartesian product
Cartesian Product ( A×B )
• The Cartesian product of sets A and B, denoted by A×B, is the set of all ordered
pairs where the first element is from set A and the second element is from set B.
A×B={(a,b) ∣ a ∈ A and b ∈ B}
Example:
Let's consider two sets:
A={1,2} B={x,y}
• The Cartesian product of A and B, denoted as A×B, is:
A×B={(1,x),(1,y),(2,x),(2,y)}
• In this case, each ordered pair represents an element of the Cartesian product.
Venn diagrams
• Venn diagrams are visual representations used to illustrate the relationships
between sets. They are named after John Venn, who introduced them in the late
19th century. Venn diagrams use circles or other shapes to depict sets and their
intersections. Here are some key components and conventions of Venn diagrams:
• Basic Components:
1.Sets:
• Each set is represented by a circle or a closed curve. The region enclosed by the curve
represents the elements of the set.
2.Intersections:
• Overlapping regions between sets represent the elements common to those sets.
3.Regions:
• Non-overlapping regions represent elements unique to a particular set.
Venn diagrams Cont..
• Common Notations:
1. Union ( A∪B ):
• The union of sets A and B is represented by the entire area enclosed by both circles.
2. Intersection (A∩B ):
• The overlapping region between sets A and B represents the intersection of the sets.
3. Complementation ( ′A′ or ‾A ):
• The complement of set A is the region outside the circle representing A but inside
the universal set.
4. Difference (A−B ):
• The region in set A but not in set B represents the difference A−B.

You might also like