Knowing what quantifiers and predicates mean is only the first step. The harder question is how an AI system takes First Order Logic sentences and derives a new sentence without guessing. Propositional and predicate logic provide the foundation for these inference methods. A single small knowledge base supports proofs by generalized modus ponens, forward chaining, backward chaining and resolution, with unification connecting the methods.
First Order Logic inference begins with sentences and substitutions
A knowledge base (KB) is a set of FOL sentences; a query is the sentence to establish. An inference rule licenses a conclusion. A substitution acts consistently: theta = {x/Asha} replaces every free x with constant Asha.
Constants Asha and AI name objects; variables x and y range over them. Predicates Student, Studies and Passes express properties or relations. The function AdviserOf(x) denotes an object from its argument.
An interpretation assigns objects to constants and tuples of objects to predicates. Knowledge Representation in Artificial Intelligence: Logic, Semantic Networks, Frames and Rules with Worked Examples places FOL beside semantic networks, frames and production rules. The Asha knowledge base below instead applies unification, forward chaining, backward chaining and resolution to one query.
KB entails alpha means every KB model satisfies alpha; KB proves alpha means a selected procedure derived it. Soundness says derived conclusions are entailed. Completeness says every entailed conclusion in the stated fragment can in principle be derived. Neither guarantees termination over arbitrary FOL.
Inference rules: instantiation and generalized modus ponens
Three rules make general sentences usable.
Mechanism | Input | Permitted conclusion | Condition |
|---|---|---|---|
Universal instantiation |
|
| Replace |
Existential instantiation |
|
|
|
Generalized modus ponens |
|
|
|
The existential witness must be fresh because the KB names no particular researcher. Universal instantiation may be repeated with different constants because the statement covers every object.
Propositional modus ponens matches a premise exactly. Generalized modus ponens first makes every antecedent match known facts with one substitution. For broader related study, explore AI & ML for Placements.
Unification finds a substitution that makes predicates agree
A unifier makes two expressions identical. A most general unifier, or MGU, adds no unnecessary bindings.
Unify Mentors(x, Logic) with Mentors(Meera, y) step by step:
Predicate name
Mentorsand arity two match.The first arguments bind
x/Meera.The second arguments bind
y/Logic.The MGU is
theta = {x/Meera, y/Logic}.Applying theta makes both expressions
Mentors(Meera, Logic).
Mentors(x, x) cannot unify with Mentors(AI, Logic): one argument requires x = AI, the other x = Logic. Unifying x with AdviserOf(x) fails the occurs check because the replacement contains x.
Check predicate symbol and arity first, compare argument pairs left to right, compose substitutions into earlier terms, then run the occurs check. Do not call a one-way match an MGU unless both substituted expressions are identical.
Forward and backward chaining on one Horn-clause knowledge base
Use this fixed knowledge base:
R1: forall x ((Student(x) and Studies(x, AI)) -> Passes(x, AI))F1: Student(Asha)F2: Studies(Asha, AI)Q: Passes(Asha, AI)
R1 is a Horn rule: two premises, one positive conclusion.
For forward chaining, start with agenda [Student(Asha), Studies(Asha, AI)]. Both antecedents match under theta = {x/Asha}. Derive Passes(Asha, AI), add it once to known facts, and stop because it equals Q.
For backward chaining, match goal Passes(Asha, AI) with the head of R1 under the same theta. Replace it with subgoals Student(Asha) and Studies(Asha, AI). Both are facts, so return success.
Forward chaining is data-driven and may derive irrelevant facts. Backward chaining is goal-driven and may revisit goals without memoisation or loop checks. Both establish this Horn-clause query, but arbitrary FOL search need not terminate.

Resolution proves the query by contradiction
Remove the implication in R1 and suppress its universal quantifier:
C1: not Student(x) or not Studies(x, AI) or Passes(x, AI)C2: Student(Asha)C3: Studies(Asha, AI)C4: not Passes(Asha, AI), the negated query
Resolution seeks a contradiction in KB and not Q. Resolve C1 with C2 using theta = {x/Asha}; remove the complementary Student literals to get C5: not Studies(Asha, AI) or Passes(Asha, AI). Resolve C5 with C3 to get C6: Passes(Asha, AI). Resolve C6 with C4 to get the empty clause [].
The empty clause makes KB and not Q unsatisfiable, so the KB entails Passes(Asha, AI). Resolution with unification is a refutation procedure. Correct derivations are sound, and resolution is refutation-complete for FOL, but search may not terminate when no proof is found. This does not make FOL decidable.

First Order Logic inference traps that change the answer
Small notation errors change the proof.
Trap | Why it fails | Correct move |
|---|---|---|
Treating | It chooses an unjustified witness | Use a fresh symbol |
Applying | It breaks consistency | Apply it everywhere |
Dropping | It changes the rule | Use |
Resolving literals that are not complementary | No valid cancellation is available | Resolve a positive literal with its unifiable negation |
Forgetting to negate the query | There is no opposite claim to contradict | Add |
Reusing variables across clauses | Separate variables may be conflated | Standardise them apart |
For example, standardise P(x) or Q(x) and not P(x) or R(x) as P(x) or Q(x) and not P(y) or R(y) before unification.
Under the open-world view, failing to derive Passes(Ravi, AI) does not prove not Passes(Ravi, AI). The KB lacks a proof either way unless a closed-world assumption is added.
How exams test inference mechanisms in First Order Logic
Entrance and recruitment exams often use short derivation or error-checking questions. Marks, dates, weightage and syllabus inclusion depend on the relevant official notification.
Practice prompt | Answer | Check that removes the distractor |
|---|---|---|
Find the MGU of |
| Both become |
Choose the next forward-chaining fact from F1, F2 and R1 |
| Both antecedents match with the same |
Choose the backward-chaining subgoals |
| They are the instantiated premises of R1 |
Resolve C6 with C4 |
|
|
Common distractors are a partial substitution, non-fresh witness, retained complementary literals or unnegated query. Check expression identity, freshness, literal removal and not Q.
Use GATE CS Exam Preparation for broader study, then practise each mechanism separately.
Inference mechanisms in First Order Logic: the short version and next step
Instantiation creates usable quantified instances.
Unification finds a consistent MGU, such as
theta = {x/Asha}.Generalized modus ponens fires a matched rule.
Chaining searches from facts or backward from the goal.
Resolution refutes the negated query, reaching
Passes(Asha, AI)and then[].
Rebuild both chaining proofs, then reconstruct C1 through C6 and []. If stuck, revisit the unification checklist.
For broader, structured preparation, continue with GATE Guidance by Sanchit Sir.




