0% found this document useful (0 votes)
41 views31 pages

Predicate Logic

Predicate logic uses predicates, which are expressions containing one or more variables, to make statements about those variables. Predicates can be used to form propositions by assigning values to the variables or quantifying over the variables. Predicate logic differs from propositional logic in that it can represent statements containing variables, allowing for conclusions to be drawn. Quantifiers like "forall" and "exists" are used to represent the extent to which a predicate applies over a domain. Negating quantified statements involves changing a universal quantifier to an existential, or vice versa, and adding "not".

Uploaded by

nayakshobha1408
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)
41 views31 pages

Predicate Logic

Predicate logic uses predicates, which are expressions containing one or more variables, to make statements about those variables. Predicates can be used to form propositions by assigning values to the variables or quantifying over the variables. Predicate logic differs from propositional logic in that it can represent statements containing variables, allowing for conclusions to be drawn. Quantifiers like "forall" and "exists" are used to represent the extent to which a predicate applies over a domain. Negating quantified statements involves changing a universal quantifier to an existential, or vice versa, and adding "not".

Uploaded by

nayakshobha1408
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/ 31

Predicate Logic

Predicate Logic
What Is Predicate Logic:
A predicate is an expression of one or more variables determined on some specific
domain. A predicate with variables can be made a proposition by either authorizing a
value to the variable or by quantifying the variable.
A predicate is a statement or mathematical assertion that contains variables, sometimes
referred to as predicate variables, and may be true or false depending on those
variables’ value or values.
For example, let’s suppose we have an inequality where we are stating that the left hand
side is greater than or equal to the right hand side.
The predicate refers to the property that the subject of the statement can take on.

The predicate refers to the property that the subject of the statement can take on.
Predicate Logic
Predicate Logic Vs Propositional Logic:
we can’t use propositional logic to draw conclusions. Because predicates,
which contain variables, don’t have truth values that can be easily detected,
they are not propositions.

Hence, We can assign values to each variable — thus, creating a true or


false proposition, as seen in the example below.

Question:
P(x):x + y >= 6

Possible Solutions:
Let P(7, 1)
P(7, 1): (7) + (1) >= 6 True Propositional statement

Let P( 3, 2)
P(3, 2): (3) + (2) >= 6 False Propositional Statement

But this isn’t always effective or helpful, as we ultimately want the predicate to be
factual over a range of elements, not just the ones that we’ve hand-selected.
First-Order Logic in Artificial
intelligence

In the topic of Propositional logic, we have seen that how to represent


statements using propositional logic. But unfortunately, in propositional
logic, we can only represent the facts, which are either true or false. PL
is not sufficient to represent the complex sentences or natural language
statements. The propositional logic has very limited expressive power.
Consider the following sentence, which we cannot represent using PL
logic.

"Some humans are intelligent", or


"Sachin likes cricket."
To represent the above statements, PL logic is not sufficient, so we
required some more powerful logic, such as first-order logic.
First-Order Logic in Artificial
intelligence
First-Order logic:

First-order logic is 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.

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.

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:
First-Order Logic in Artificial
intelligence
Objects: A, B, people, numbers, colors, wars, theories, squares, pits, wumpus, ......
Relations: It can be unary relation such as: red, round, is adjacent, or n-any relation such
as: the sister of, brother of, has color, comes between
Function: Father of, best friend, third inning of, end of, ......
As a natural language, first-order logic also has two main parts:

Syntax
Semantics
First-Order Logic in Artificial
intelligence
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.
First-Order Logic in Artificial
intelligence

Basic Elements of First-order logic:

Following are the basic elements of FOL syntax:

Constant 1, 2, A, John, Mumbai, cat,....

Variables x, y, z, a, b,....

Predicates Brother, Father, >,....

Function sqrt, LeftLegOf, ....

Connectives ∧, ∨, ¬, ⇒, ⇔

Equality ==

Quantifier ∀, ∃
First-Order Logic in Artificial
intelligence
Atomic 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).


Chinky is a cat: => cat(Chinky).

Complex Sentences:
Complex sentences are made by combining atomic sentences using connectives.

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.
First-Order Logic in Artificial
intelligence

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.
First-Order Logic in Artificial
intelligence
What Is Quantification?
We use quantifiers to create propositional functions. This process
is called quantification.
Quantifiers express the extent to which a predicate is true over a
range of elements.
Typically, numeric phrases tell us how a statement applies to a
group, affecting how we negate an assertion.
For example, imagine we have the statement: “Every person who
is 21 years of age or older is able to purchase alcohol. Sarah is
21 years old.”
First-Order Logic in Artificial
intelligence
While it would seem logical to conclude that Sarah would
then be able to purchase alcohol legally, propositional logic
alone is ill-equipped with handling quantified variables,
namely, what does “every person” really mean?
As the range of possibilities is too broad, we need to apply
one of two types of quantifiers to help us achieve our goal:
Universal Quantifiers
Existential Quantifier
First-Order Logic in Artificial
intelligence
Universal Quantifier
Universal Quantification is the proposition that a property is true for all the
values of a variable in a particular domain, sometimes called the domain of
discourse or the universe of discourse.

Usually, universal quantification takes on any of the following forms:

P(x) is true for all values of x


For all x, P(x)
For each x, P(x)
For every x, P(x)
Given any x, P(x)
And is symbolically denoted

Ɐx є D, P(x) “for all x, belonging to domain D, p(x) is true”

To determine if it’s a universal quantifier, you want to look for words


like all, each, every, any.
First-Order Logic in Artificial
intelligence
Existential Quantifier
Existential quantification is the proposition that a property is true for some
value in a particular domain.
Customarily, existential quantification takes on one of the following forms:
There exists an x such that P(x)
There exists an element x in the domain such that P(x)
For some x, P(x)
There is some x such that P(x)
And is symbolically denoted
ⱻ x є D, P(x) “there exists x, belonging to domain D, such that p(x) is
true”
First-Order Logic in Artificial
intelligence
Examples Of Quantifiers In Use

Suppose we have two predicate variables x and y, where the domain for
x is F = {foxes} and y has the domain S = {snails}, where P(x,y) is
“Foxes are faster than Snails.”
Now we wish to write the following statement using logical symbolism
and quantifiers.
Translate Universal Quantifiers — Example
First-Order Logic in Artificial
intelligence

Universal Vs Existential Quantifier — Example


First-Order Logic in Artificial
intelligence
the truth values of quantified statements can be summarized as follows:
First-Order Logic in Artificial
intelligence
Quantifier Negation
Okay, so now let’s learn how we negate a statement with quantifiers.
Remember that negation must have the complete opposite truth value from the
original statement. For example, if we had the statement, “3 is a prime number,”
which is true, the negation would be “3 is not a prime number,” which is false.
Examples Of Negations
So now, let’s look at quantified statements.

Circle Shading Unshading — Example


First-Order Logic in Artificial
intelligence
Using the five circles, as seen above, we make the following statement:
“Some circles are shaded.”
What would the negation of this statement be?
“Some circles are not shaded.”
Nope! Because this statement is also true!
Remember, a negation must have the opposite truth value.
The trick is to change from a universal quantifier to an existential quantifier or
vice versa, adding a “not” to say, “All circles are not shaded.”
Therefore, the negation of quantification has the following properties:
First-Order Logic in Artificial
intelligence

Negation Of Quantifiers
First-Order Logic in Artificial
intelligence
Let’s negate the following statements with P(x) being “like homework.”

Negation Of Universal Quantifier


First-Order Logic in Artificial
intelligence

Negation Of Existential Quantifier


First-Order Logic in Artificial
intelligence
Negation of Quantified Propositions:
When we negate a quantified proposition, i.e., when a universally quantified proposition
is negated, we obtain an existentially quantified proposition,and when an existentially
quantified proposition is negated, we obtain a universally quantified proposition.
The two rules for negation of quantified proposition are as follows. These are also called
DeMorgan's Law.
Example: Negate each of the following propositions:
1.∀x p(x)∧ ∃ y q(y)
Sol:~.∀xp(x)∧∃yq(y))

~∀xp(x)∨∼∃yq(y) (∴
∼(p∧q)=∼p∨∼q)
≅∃ x ~p(x)∨ ∀ y∼q(y)
2. (∃x∈U) (x+6=25)
First-Order Logic in Artificial
intelligence
Atomic Formulas
Before we jump into the video lesson, I want to mention that predicate logic, also
called predicate calculus, will consider the notion of atoms or atomic formulas in
some textbooks. So, let’s briefly discuss this idea.
A predicate name, followed by a list of variables such as P(x, y), where P is the
predicate name, and x and y are variables or terms, is referred to as an atomic
formula or atom.
Example Of Atom
For example, suppose M is the predicate representing “man is mortal” and let x be a
variable. Then M(x) is an atomic formula meaning “x is mortal.”
So, as we know, a predicate is an expression of one or more variables defined on
some domain, and an atom is the most straightforward well-formed formula in logic.
A well-formed formula, sometimes abbreviated to (wff), is obtained by composing
atoms with logical connectives and quantifiers. Therefore, a well-formed formula is a
predicate with the following properties:
First-Order Logic in Artificial
intelligence
First-Order Logic in Artificial
intelligence
Free and Bound Variables:

Free and Bound Variables:


The quantifiers interact with variables which appear in a suitable way. There are two types
of variables in First-order logic which are given below:

Free Variable: A variable is said to be a free variable in a formula if it occurs outside the
scope of the quantifier.

Example: ∀x ∃(y)[P (x, y, z)], where z is a free variable.

Bound Variable: A variable is said to be a bound variable in a formula if it occurs within the
scope of the quantifier.

Example: ∀x [A (x) B( y)], here x and y are the bound variables.


First-Order Logic in Artificial
intelligence

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.
In Existential quantifier, ∃ x∃ y is similar to ∃ y ∃ x.
∃ x∀ y is not similar to ∀ y∃ x.
First-Order Logic in Artificial
intelligence
Some Examples of FOL using quantifier:
1. All birds fly.
In this question the predicate is "fly(bird)."
And since there are all birds who fly so it will be represented as follows.
∀x bird(x) →fly(x).
2. Every man respects his parent.
In this question, the predicate is "respect(x, y)," where x=man, and y= parent.
Since there is every man so will use ∀, and it will be represented as follows:
∀x man(x) → respects (x, parent).
3. Some boys play cricket.
In this question, the predicate is "play(x, y)," where x= boys, and y= game. Since
there are some boys so we will use ∃, and it will be represented as:
∃x boys(x) → play(x, cricket).
First-Order Logic in Artificial
intelligence
Examples:
4. Not all students like both Mathematics and Science.
In this question, the predicate is "like(x, y)," where x= student, and y= subject.
Since there are not all students, so we will use ∀ with negation, so following
representation for this:
¬∀ (x) [ student(x) → like(x, Mathematics) ∧ like(x, Science)].
5. Only one student failed in Mathematics.
In this question, the predicate is "failed(x, y)," where x= student, and y=
subject.
Since there is only one student who failed in Mathematics, so we will use
following representation for this:
∃(x) [ student(x) → failed (x, Mathematics) ∧∀ (y) [¬(x==y) ∧
student(y) → ¬failed (x, Mathematics)].

You might also like