0% found this document useful (0 votes)
4 views

Module4_AI

The document discusses First Order Logic (FOL), highlighting its syntax, semantics, and the limitations of propositional logic. It explains the components of FOL, including predicates, quantifiers, and the processes of inference such as forward and backward chaining. Additionally, it provides examples of how FOL can represent complex statements and relationships in a structured manner.
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)
4 views

Module4_AI

The document discusses First Order Logic (FOL), highlighting its syntax, semantics, and the limitations of propositional logic. It explains the components of FOL, including predicates, quantifiers, and the processes of inference such as forward and backward chaining. Additionally, it provides examples of how FOL can represent complex statements and relationships in a structured manner.
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/ 62

Unit 4

First Order Logic: Representation Revisited, Syntax and Semantics of


First Order logic, Using First Order logic. Inference in First Order
Logic :Propositional Versus First Order Inference, Unification, Forward
Chaining, Backward Chaining, Resolution
Limitations of Propositional logic:
• We cannot represent relations like ALL, some,
or none with propositional logic. Example:
• All the girls are intelligent.
• Some apples are sweet.
• Propositional logic has limited expressive
power.
• In propositional logic, we cannot describe
statements in terms of their properties or
logical relationships
Limitations of Prepositional Logic
First Order Predicate Logic
• Propositional Logic is not sufficient to represent the complex sentences or
natural language statements.
• Some humans are intelligent", or
• "Sachin likes cricket."
• Propositional logic is insufficient to represent these sentences…we need to have
predicate logic..
• First-order logic is also known as Predicate logic or First-order
predicate logic.
• First-order logic is a powerful language that develops information
about the objects in a more easy way and can also express the
relationship between those objects.

• Eg:
First-Order Logic(FOL)

• Another way of knowledge representation in artificial intelligence. It is an


extension to propositional logic.
• FOL is sufficiently expressive to represent the natural language statements in a
concise way and Also known as Predicate logic or First-order predicate logic.
• First-order logic is a powerful language that develops information about the objects
in a more easy way and can also express the relationship between those objects.
• First-order logic (like natural language) does not only assume that the world
contains facts like propositional logic but also assumes the following things in the
world:
• Objects
• Relations
• Function
• As a natural language, first-order logic also has two main parts:
• Syntax
• Semantics
Syntax of First-Order logic

• The syntax of FOL determines which collection of symbols is a logical


expression in first-order logic. The basic syntactic elements of first-order
logic are symbols. We write statements in short-hand notation in FOL.
Basic Elements of First-order logic:
Following are the basic elements of FOL syntax:
• Constant 1, 2, A, John, Mumbai, cat,.... An individual
constant represents a specific object and is notated a, b, c,….
• Variables .... An individual variable represents any object and
notated x, y, z,….
• Predicates Brother, Father, .... A predicate symbol represents a
predicate for objects and is notated P(x, y), Q(z),
…, where P and Q are predicate symbols.
Eg: Loves(John, Mary) [a fact]
• Function sqrt, .... A functional symbol represents a relation
between or among objects and is notated f(x, y), g(z, w),…. Here the
functional symbol g shows the relationship between z and w
Eg: FatherOf(John) [ returns an object]
You can use it inside a predicate: IsMale(FatherOf(John))
Reads: “The father of John is male.”
• Connectives ∧, ∨, ¬, ⇒, ⇔A logical symbol represents an
operation on predicate symbols and is notated ↔, ~,→,∨, or ∧
• Equality ==
• Quantifier ∀, ∃
Predicate sentences

• Atomic sentences
• Complex Sentences
Atomic sentences are the most basic sentences of first-order logic. These
sentences are formed from a predicate symbol followed by a parenthesis with a
sequence of terms.
• We can represent atomic sentences as Predicate (term1, term2, ......, term n).
• Example:
Ravi and Ajay are brothers: => Brothers(Ravi, Ajay).
Chiku is a cat => cat (Chiku).

Complex Sentences:
• Complex sentences are made by combining atomic sentences using connectives.
Example:
First-order logic statements can be divided into two parts:

• Subject: Subject is the main part of the statement.


• Predicate: A predicate can be defined as a relation, which binds
two atoms together in a statement.
• Consider the statement: "x is an integer.", it consists of two parts,
the first part x is the subject of the statement and second part "is
an integer," is known as a predicate.
QUANTIFIERS IN FOPL
• A quantifier is a language element which generates quantification, and quantification
specifies the quantity of specimen in the universe of discourse.
• These are the symbols that permit to determine or identify the range and scope of the
variable in the logical expression.
• There are two types of quantifier:
• Universal Quantifier, (for all, everyone, everything) (∀)
• Existential quantifier, (for some, at least one) (∃)
Universal Quantifier:

• Universal quantifier is a symbol of logical representation, which


specifies that the statement within its range is true for everything or
every instance of a particular thing.
• The Universal quantifier is represented by a symbol ∀, which resembles
an inverted A.
• Note: In universal quantifier we use implication "→".
• If x is a variable, then ∀x is read as:
For all x The main connective for universal quantifier ∀ is implication →
For each x
For every x.
Ex1. All boys are intelligent
∀ x: boys(x)  intelligent(x)
Ex. All cats are white color
∀x: cats(x) white(x,color)
• All man drink coffee.

• ∀x: man(x) → drink (x, coffee).


Existential quantifier
• Existential quantifiers are the type of quantifiers, which express that the statement
within its scope is true for at least one instance of something.
• It is denoted by the logical operator ∃, which resembles as inverted E. When it is
used with a predicate variable then it is called as an existential quantifier.
• If x is a variable, then ∃ x is read as:
•The main connective for existential quantifier ∃ is and ∧.
For some x
For one x
Ex1. Some boys are intelligent
∃x: boys(x) ∧ intelligent(x)
Ex2. Some cats are white color
∃ x: cats(x)^ white(x,color)
• Some boys are intelligent

• ∃x: boys(x) ∧ intelligent(x)


Examples
• Points to remember:
• The main connective for universal quantifier ∀ is implication →.
• The main connective for existential quantifier ∃ is and ∧.
Properties of Quantifiers:
• In universal quantifier, ∀x∀y is similar to ∀y∀x.
• All girls are intelligence or all intelligence are girls
• In Existential quantifier, ∃x∃y is similar to ∃y∃x.
• Some boys are intelligence or some intelligence are boys
• ∃x∀y is not similar to ∀y∃x.
• Someone is loyal to everyone ( not equal) everyone loyal to
someone
Try the examples for FOPL
• All birds fly.
• ∀x: bird(x) →fly(x).
• Every man respects his parent.
• ∀x: man(x) → respects (x, parent).
• Some boys play cricket.
• ∃x: boys(x) ∧ play(x, cricket).
• Not all students like both Mathematics and Science.
¬∀ (x): [ student(x) → like(x, Mathematics) ∧ like(x, Science)].
Inference in FOPL
• Inference in First-Order Logic is used to deduce new
facts or sentences from existing sentences. Before
understanding the FOL inference rule, let's understand
some basic terminologies used in FOL.
Eg: 2
Propositional Versus First Order
Inference
Unification
Forward Chaining
• Forward chaining is a data-driven approach. It starts with the available data and
applies inference rules to extract more data until a goal is reached. This method is
often used in systems where the goal is to derive new information from a given set
of facts.
• How it works:
1.Start with initial facts: Begin with a set of known facts and the rules of the system.
2.Apply rules: Look for rules where the antecedent (if part) matches the current
known facts.
3.Derive new facts: When a rule is found, apply it to generate new facts (the
consequent or then part).
4.Repeat: Add the new facts to the pool of known facts and repeat the process until
no more rules can be applied or a specific goal is achieved.
• Example:
• Facts: "The sky is cloudy", "It is humid".
• Rules:
• If "The sky is cloudy" and "It is humid", then "It will rain".
• If "It will rain", then "The ground will be wet".
• Process: From the facts "The sky is cloudy" and "It is humid", we can
infer "It will rain" using the first rule. Using the second rule with the
inferred fact "It will rain", we can further infer "The ground will be
wet".
• Applications:
• Expert systems for diagnostics (e.g., medical diagnosis).
• Automated control systems.
• Real-time decision-making systems.
Backward Chaining
• Backward chaining is a goal-driven approach. It starts with a goal and works
backwards to determine which facts must be true to achieve that goal. This
method is often used in systems where the goal is to prove a hypothesis.
• How it works:
1.Start with a goal: Begin with the desired outcome or hypothesis.
2.Find rules that support the goal: Look for rules that have the goal in the
consequent (then part).
3.Establish sub-goals: For each rule, establish sub-goals based on the
antecedent (if part) that must be satisfied for the rule to apply.
4.Repeat: Recursively apply the process to each sub-goal until reaching known
facts or concluding that the goal cannot be achieved.
• Example:
• Goal: Prove "The ground will be wet".
• Rules:
• If "It will rain", then "The ground will be wet".
• If "The sky is cloudy" and "It is humid", then "It will rain".
• Process: To prove "The ground will be wet", we need to prove "It will
rain" using the first rule. To prove "It will rain", we need to prove "The
sky is cloudy" and "It is humid" using the second rule. If both these
sub-goals are facts, then the original goal is proven.
• Applications:
• Automated theorem proving.
• Diagnostic systems where the hypothesis needs validation (e.g., fault
diagnosis).
• Planning systems where specific end states need to be achieved.

You might also like