First Order Logic in Artificial intelligence
In this page we will learn about What is First Order Logic in Artificial intelligence?, First Order Logic in Artificial intelligence, First-Order logic, Syntax of First-Order logic, Universal Quantifier, Existential Quantifier, Properties of Quantifiers, Free and Bound Variables.
What is First Order Logic in Artificial intelligence?
We have seen how to represent statements using propositional logic in the topic of propositional logic. Unfortunately, we can only represent facts that are either true or untrue in propositional logic. To represent complicated phrases or natural language statements, PL is insufficient. The expressive power of propositional logic is quite restricted. Take a look at the following sentence, which cannot be represented using PL logic.
1."Some humans are intelligent", or
2."Sachin likes cricket."
PL logic is insufficient to represent the above statements, so we required some more powerful logic, such as first-order logic.
First-Order logic:
- In artificial intelligence, first-order logic is another method of knowledge representation. It's a variant of propositional logic.
- FOL has enough expressiveness to convey natural language statements succinctly.
- Predicate logic or First-order predicate logic are other names for first-order logic. First-order logic is a sophisticated language that makes it easier to build information about objects and to articulate relationships between them.
- Like propositional logic, first-order logic (like natural language) implies that the world contains facts, but it also assumes the following things in the world.
- Objects: A, B, people, numbers, colors, squares, pits, wars, theories, 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, ......
- First-order logic also has two main parts as a natural language:
a)Syntax
b)Semantics
Syntax of First-Order logic:
In first-order logic, the syntax of FOL determines which set of symbols represents a logical expression. Symbols are the core syntactic constituents of first-order logic. In FOL, we use short-hand notation to write statements.
Basic Elements of First-order logic:
The basic elements of FOL syntax are as follows:
Constant | 1, 2, A, John, Mumbai, cat,.... |
---|---|
Variables | x, y, z, a, b,.... |
Predicates | Brother, Father, >,.... |
Functions | sqrt, LeftLegOf, .... |
Connectives | ∧, v, ¬, ⇒, ⇔ |
Equality | == |
Quantifier | ∀, ∃ |
Atomic sentences:
- Atomic sentences are the most fundamental first-order logic sentences. These sentences are made up of a predicate symbol, a parenthesis, and a series of terms.
- Predicate can be used to represent atomic sentences (term1, term2, ......, term n).
- Predicate logic or First-order predicate logic are other names for first-order logic. First-order logic is a sophisticated language that makes it easier to build information about objects and to articulate relationships between them.
Example: Ravi and Ajay are brothers: => Brothers(Ravi, Ajay).
Chinky is a cat: => cat (Chinky).
Complex Sentences:
- Connectives are used to join atomic sentences to form complex sentences.
The following are two types of first-order logic statements:
- Subject: The major component of the sentence is the subject.
- Predicate: A predicate is a relationship that ties two atoms together in a sentence.
Consider the following statement: "x is an integer." It has two parts: the first component, x, is the statement's subject, and the second half, "is an integer," is a predicate.
Quantifiers in First-order logic:
- Quantification describes the quantity of specimen in the universe of discourse, and a quantifier is a linguistic element that generates quantification.
- These are the symbols that allow you to determine or identify the variable's range and scope in a logical expression. There are two different kinds of quantifiers:
Universal Quantifier, (for all, everyone, everything)
Existential quantifier, (for some, at least one).
Universal Quantifier:
A universal quantifier is a logical symbol that indicates that a statement inside its range is true for everything or every instance of a specific thing.
A symbol that resembles an inverted A is used to represent the Universal quantifier.
Note: the implication of universal quantifier is "→".
If x is a variable, then ∀x is read as:
- For all x
- For each x
- For every x.
Example:
All man drink coffee.
Let a variable x which refers to a cat so all x can be represented in UOD as below:
∀x man(x) → drink (x, coffee).
It will be read as: There are all x where x is a man who drink coffee.
Existential Quantifier:
Existential quantifiers are a sort of quantifier that expresses that a statement is true for at least one instance of something within its scope.
The logical operator resembles an inverted E and is used to represent it. It is referred to be an existential quantifier when it is employed with a predicate variable
Note: we always use the AND or Conjunction symbol (∧) in Existential quantifiers.
If x is a variable, the existential quantifier is either x or (x). And it will be written like follows:
- There exists a 'x.'
- For some 'x.'
- For at least one 'x.'
Example:
Some boys are intelligent.
It will be read as: There are some x where x is a boy who is intelligent.
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.
Some Examples of FOL using quantifier:
- All birds fly.
The predicate in this question is "fly(bird)."
Because all birds are able to fly, it will be portrayed as follows.
∀x bird(x) →fly(x). - Every man respects his parent.
The predicate in this question is "respect(x, y)," where x=man, and y= parent.
Because there is every man so will use ∀, and it will be portrayed as follows:
∀x man(x) → respects (x, parent). - Some boys play cricket.
In this question, the predicate is "play(x, y), " where x= boys, and y= game. Because there are some boys so we will use ∃, and it will be portrayed as:
∃x boys(x) → play(x, cricket). - Not all students like both Mathematics and Science.
The predicate in this question is "like(x, y)," where x= student, and y= subject. Because there are not all students, so we will use ∀ with negation, so following portray for this:
¬∀ (x) [ student(x) → like(x, Mathematics) ∧ like(x, Science)]. - Only one student failed in Mathematics.
The predicate in this question is "failed(x, y)," where x= student, and y= subject. Because there is only one student who failed in Mathematics, so we will use following portray for this:
∃(x) [ student(x) → failed (x, Mathematics) ∧∀ (y) [¬(x==y) ∧ student(y) → ¬failed (x, Mathematics)].
Free and Bound Variables:
The quantifiers interact with variables that exist in the right order. First-order logic has two sorts of variables, which are listed below:
Free Variable: In a formula, a variable is said to be a free variable if it exists outside of the quantifier's scope.
Example: ∀x ∃(y)[P (x, y, z)], where z is a free variable.
Bound Variable: In a formula, a variable is considered to be a bound variable if it exists within the quantifier's scope.
Example: ∀x [A (x) B( y)], here x and y are the bound variables.