×

Inference in First-order Logic

Inference in First-order Logic

While defining inference, we mean to define effective procedures for answering questions in FOPL.

FOPL offers the following inference rules:

  • Inference rules for quantifiers
  • Universal Instantiation (UI): In this, we can infer any sentence by substituting a ground term (a term without variables) for the variables. In short, when we create the FOPL of the given statement, we can easily infer any other statement using that FOPL

Notation: Let, SUBST( ? , ? ) be the result of the given sentence ? , and its substitute is ?.

       where v is the variable and g is the ground term.

       For example: Every man is mortal.

        It is represented as ? x: man(x)  ?   mortal(x).

In UI, we can infer different sentences as:

man(John) ?   mortal(John)

man(Aakash) ?  mortal(Aakash), etc.

  • Existential Instantiation(EI): In EI, the variable is substituted by a single new constant symbol.

Notation: Let, the variable be v which is replaced by a constant symbol k for any sentence ?  The value of k is unique as it does not appear for any other sentence in the knowledge base. Such type of constant symbols are known as Skolem constant. As a result, EI is a special case of Skolemization process.

Note: UI can be applied several times to produce many sentences, whereas EI can be applied once, and then the existentially quantified sentences can be discarded.

      For example: ?x:steal(x, Money).

 We can infer from this: steal(Thief, Money)

  • Generalized Modus Ponen: It is a lifted version of Modus Ponen as it uplifts the Modus Ponens from ground propositions to FOPL. Generalized Modus Ponen is more generalized than Modus Ponen. It is because, in generailzed, the known facts and the premise of the implication are matched only upto a substitution, instead of its exact match.

Notation: For atomic sentences like pi.pi’ and q where we have a substitute
? that SUBST( ?, pi)  for each i.

Generalized Modus Ponen

For example: p1’ is Thief(Charlie)                                p1 is Thief(x)

                                    p2’ is Silent(y)                                         p2 is Silent(y)

                                    ? will be {x/Charlie, y/Charlie}               q is evil(x)

                                     SUBST(?,q ) is evil(Charlie).

  • Unification: It is the key component of First-order inference algorithms. Unification is the process used by the lifted inference rules to find substituents that could give identical but different logical expressions. It means the meaning of the sentence should not be changed, but it should be expressed in multiple ways. The UNIFY algorithm in unification takes two sentences as input and then returns a unifier if one exists:

              UNIFY(p,q)= ? where SUBST( ? , p) = SUBST( ?, q).

              Let see how UNIFY works with the help of the below example:

              Given: Knows(Ram,x). The question is- Whom does Ram knows?

 The UNIFY algorithm will search all the related sentences in the knowledge base, which could unify with Knows(Ram,x).

UNIFY (Knows(Ram, x), Knows(Ram, Shyam))?{x/Shyam}

UNIFY (Knows{Ram,x}, Knows{y, Aakash})?{x/Aakash, y/Ram}

UNIFY (Knows{Ram,x}, Knows{x, Raman})?fails.

The last one failed because we have used the same variable for two persons at the same time.

Unification Algorithm

Earlier, we have studied TELL and ASK functions which are used to inform and interrogate a knowledge base. These are the primitive functions of STORE and FETCH functions. STORE function is used to store a sentence s into the knowledge base and FETCH function is used  to return all the unifiers with some sentences.

function UNIFY(a , b, ?) returns a substitution to make a, b identical
 inputs: a , a variable, constant, list, or compound expression
 a, a variable, constant, list, or compound expression
 ?, the substitution built up earlier (optional, defaults to empty)
 if ? = failure then return failure
 else if a = b then return ?
 else if VARIABLE?(a ) then return UNIFY-VAR(a , b, ?) 
 else if VARIABLE?(b) then return UNIFY-VAR(a, b, ?)
 else if COMPOUND?(a ) and COMPOUND?(b) then
 return UNIFY(a.ARGS, b.ARGS, UNIFY(a.OP, b.OP, ?))
 else if LIST?(a) and LIST?(b) then
 return UNIFY(a .REST, b.REST, UNIFY(a .FIRST, b.FIRST, ?)) 
 else return failure
 function UNIFY-VAR(var, a , ?) returns a substitution
 if {var/val} ? ?then return UNIFY(val , a , ?)
 else if {a/val} ? ? then return UNIFY(var, val , ?)
 else if OCCUR-CHECK?(var, a ) then return failure
 else return add {var/a } to ? 

Note: In the above example: Knows(Ram, x) ?  It is an instance of FETCH function.

  • Forward Chaining:  In forward chaining, we start with the atomic sentences in the knowledge base and apply Modus Ponen in forward direction. Also adding new sentences until any inference is not made.

Note: We will understand Forward Chaining in detail in Forward Chaining section.

  • Backward Chaining: This algorithm is opposite of forward chaining algorithm. It works in backward direction. It starts from the goal, chain through the rules to search the known facts and infer sentences from the given facts in backward direction.

Note: We will understand Backward Chaining in detail in Backward Chaining section.

  • Resolution Method: Unification, Backward Chaining as well as Forward Chaining, all are based on the resolution method. The resolution method is a decision-making rule where a machine decides what to do and what not to do. It can be understood as:

Firstly, we convert the given statement into FOPL.

Secondly, we infer some related sentences from it.

Then, realizing our goal, we need to prove it.

Here, we make use of the resolution method to decide the best possible FOPL from various.

Note: We will understand resolution method for both Propositional  logic and Predicate logic in our next section.


Related Topics

Artificial Intelligence Tutorial | AI Tutorial

Today, Artificial Intelligence (AI) has become the norm of how humans communicate with and understand technology. Even though you've been hearing this buzzword now and then, do you know what...

6 minutes read.

5 algorithms that demonstrate artificial intelligence bias

Unfortunately, in the machine learning algorithm, AI bias is the output due to the prejudiced assumption made due to the algorithm development process. AI systems have biases due to the...

3 minutes read.

Utility Functions in Artificial Intelligence

The agents use the utility theory for making decisions. It is the mapping from lotteries to the real numbers. An agent is supposed to have various preferences and can choose the one...

3 minutes read.

Adversarial Search in Artificial Intelligence

AI Adversarial search: Adversarial search is a game-playing technique where the agents are surrounded by a competitive environment. A conflicting goal is given to the agents (multiagent). These agents compete...

3 minutes read.

Unsupervised Learning in AI

Unsupervised Learning in AI Unsupervised LearningIntroductionClusteringComparison between Supervised, Unsupervised, and Reinforcement Learning. Unsupervised Learning This is the third major category of Machine Learning. Unsupervised learning happens when we have data without additional feedback,...

2 minutes read.

Intelligent Agents | Agents in AI

What is an Agent? An agent can be viewed as anything that perceives its environment through sensors and acts upon that environment through actuators. For example, human being perceives their surroundings through...

8 minutes read.

Natural Language Processing

Natural Language Processing in AI Topics Covered in Language Module Natural Language ProcessingSyntax and SemanticsContext-Free GrammarNLTKN-gramsTokenizationBag of WordsNaïve Bayes In language, we will cover how Artificial Intelligence is used to process human language...

13 minutes read.

Quantifying Uncertainty

The concept of quantifying uncertainty relies on how an agent can keep away uncertainty with a degree of belief. The term uncertainty refers to that situation or information which is either unknown or...

5 minutes read.

Top 10 Artificial Intelligence Technologies in 2024

Artificial Intelligence Technologies in 2020 1. Augmented Reality This is one of the most fascinating technology nowadays. Augmented Reality is the use of text, graphics, audio, etc. in real time. In Simple...

4 minutes read.

Propositional Logic

It is a branch of logic which is also known as statement logic, sentential logic, zeroth-order logic, and many more. It works with the propositions and its logical connectivities. It deals with the...

5 minutes read.

Inference Rules in Proposition Logic

Inference rules are those rules which are used to describe certain conclusions. The inferred conclusions lead to the desired goal state. In propositional logic, there are various inference rules which can be applied to...

3 minutes read.

Neural Networks

Neural Networks are one of the most popular techniques and tools in Machine learning. Neural Networks were inspired by the human brain as early as in the 1940s. Researchers studied the...

5 minutes read.

Informed Search/ Heuristic Search in AI

An informed search is more efficient than an uninformed search because in informed search, along with the current state information,  some additional information is also present, which make it easy to reach the...

6 minutes read.

The Wumpus World

The Wumpus world is a game playing which provides an environment to the knowledge-based agent to showcase its stored knowledge. It was developed by Gregory Yob in 1973. About the game:  It...

3 minutes read.

Local Search Algorithms and Optimization Problem

The informed and uninformed search expands the nodes systematically in two ways: keeping different paths in the memory and selecting the best suitable path, Which leads to a solution state required to reach the goal...

2 minutes read.

Uninformed Search Strategies - Artificial Intelligence

Breadth-first search (BFS) It is a simple search strategy where the root node is expanded first, then covering all other successors of the root node, further move to expand the next...

8 minutes read.

Probabilistic Reasoning

Probabilistic Reasoning Probabilistic Reasoning is the study of building network models which can reason under uncertainty, following the principles of probability theory. Bayesian Networks Bayesian network is a data structure which is used to represent the dependencies among variables....

7 minutes read.

Inference in First-order Logic

Inference in First-order Logic While defining inference, we mean to define effective procedures for answering questions in FOPL. FOPL offers the following inference rules: Inference rules for quantifiersUniversal Instantiation (UI): In this, we can infer any sentence by...

5 minutes read.

Top 7 Artificial Intelligence and Machine Learning trends for 2024

Artificial Intelligence is the ability of machines to perform the same function as human beings, like problem-solving, learning, reasoning and recognizing. Machine Learning is another branch of Computer Science and...

6 minutes read.

Knowledge Based Agents in AI

Knowledge is the basic element for a human brain to know and understand the things logically. When a person becomes knowledgeable about something, he is able to do that thing in a better...

4 minutes read.