Predicate Logic
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.
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
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:
Variables x, y, z, a, b,....
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).
Complex Sentences:
Complex sentences are made by combining atomic sentences using connectives.
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
Negation Of Quantifiers
First-Order Logic in Artificial
intelligence
Let’s negate the following statements with P(x) being “like homework.”
Free Variable: A variable is said to be a free variable in a formula if it occurs outside the
scope of the quantifier.
Bound Variable: A variable is said to be a bound variable in a formula if it occurs within the
scope of the quantifier.
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)].