Predicate Logic Course Section: Backward Chaining and Resolution on “Food” and “Liking”

Predicate Logic Course Section: Backward Chaining and Resolution on “Food” and “Liking”

Verified Sources
Nov 4, 2026

We model the sentences using first-order logic with the following keyword predicates:

  • Likes(x, y)
  • Food(x)
  • Eats(x, y)
  • KilledBy(y, x) (optional; we will avoid this by using the phrase “isn't killed by it” directly)

And we use individuals such as: John, Sue, Bill, Apples, Chicken, Peanuts, etc.

Because the original text asks “Prove that John likes peanuts,” we also assume the standard additional fact used in such problems: Peanuts are food, i.e., Food(Peanuts).
We will derive this from the given sentence “Anything anyone eats and isn't killed by it, is food.” if we also have a premise that peanuts are eaten and not killed. In many standard exercises, the missing bridge is taken as: John likes peanuts goal is provable because peanuts is food; or peanuts is eaten by someone and not killed by it. To keep the workflow faithful to the prompt, we will include the minimal auxiliary assumption typically used in these logic homework patterns:

  • Eats(Bill, Peanuts) and ¬KilledBy(Peanuts, Bill)
    so that the “food rule” yields Food(Peanuts).

Key logical ideas used later

  • Backward Chaining starts at the query and resolves it against rule heads.
  • Resolution operates on clause form.
  • Clausification includes prenex form, Skolemization, and dropping universal quantifiers.

Resolution in First-Order Logic (Overview)

Part (i): Translate to predicate logic and prove John likes peanuts using backward chaining

  1. 1
    Step 1

    Use Likes(x,y), Food(x), Eats(x,y), and a killing predicate KilledBy(y,x). Add the minimal premises: Eats(Bill,Peanuts) and ¬KilledBy(Peanuts,Bill) so the food rule can infer Food(Peanuts).

  2. 2
    Step 2

    Formalize each English sentence as a first-order axiom (see next block).

  3. 3
    Step 3

    Goal: Likes(John, Peanuts).

  4. 4
    Step 4

    Match the goal with an axiom/law that has Likes(John, ?) in its head. This yields a subgoal Food(Peanuts) if the 'John likes all food' axiom is encoded as Likes(John,x) ← Food(x).

  5. 5
    Step 5

    Use the rule: Food(y) ← (∃z [Eats(z,y) ∧ ¬KilledBy(y,z)]). Then subgoals become Eats(z,Peanuts) and ¬KilledBy(Peanuts,z) for some z; choose z = Bill using the added premises.

  6. 6
    Step 6

    From Eats(Bill,Peanuts) and ¬KilledBy(Peanuts,Bill), infer Food(Peanuts). Then infer Likes(John,Peanuts).

(i-a) Predicate logic translation

Let:

  • Universe: people and items.
  • Predicates: Likes(x,y), Food(x), Eats(x,y), KilledBy(y,x).
  • Constants: John, Sue, Bill, Peanuts, Apples, Chicken.

Translate each sentence:

  1. “John likes all kinds of food.”
    [ \forall x,(Food(x)\rightarrow Likes(John,x)) ] (Equivalently, a rule: Food(x)⇒Likes(John,x)Food(x) \Rightarrow Likes(John,x).)

  2. “Apples are food.”
    [ Food(Apples) ]

  3. “Chicken is food.”
    [ Food(Chicken) ]

  4. “Anything anyone eats and isn't killed by it, is food.”
    If someone xx eats item yy, and xx is not killed by yy, then yy is food: [ \forall x,\forall y,\big((Eats(x,y)\wedge \neg KilledBy(y,x))\rightarrow Food(y)\big) ]

  5. “Sue eats everything Bill eats.”
    [ \forall y,(Eats(Bill,y)\rightarrow Eats(Sue,y)) ]

Minimal additional premises (so the target is actually derivable)

To prove John likes peanuts, we need Food(Peanuts). Using axiom (4), it suffices to assume: [ Eats(Bill,Peanuts)\quad\text{and}\quad \neg KilledBy(Peanuts,Bill) ]


(i-b) Backward chaining proof of Likes(John,Peanuts)Likes(John,Peanuts)

We write the “likes all food” axiom as a backward-chaining rule:

  • Rule R1: Likes(John,x)⇐Food(x)Likes(John,x) \Leftarrow Food(x)

Goal:

  • Likes(John,Peanuts)Likes(John,Peanuts)

Match with R1:

  • It suffices to prove Food(Peanuts)Food(Peanuts).

Now use food-from-eaten-and-not-killed axiom (4). From [ (Eats(z,Peanuts)\wedge \neg KilledBy(Peanuts,z))\rightarrow Food(Peanuts) ] we can backward chain:

  • Subgoals:
    1. Eats(z,Peanuts)Eats(z,Peanuts)
    2. ¬KilledBy(Peanuts,z)\neg KilledBy(Peanuts,z)

Choose z=Billz = Bill using the added premises:

  • Eats(Bill,Peanuts)Eats(Bill,Peanuts) (given)
  • ¬KilledBy(Peanuts,Bill)\neg KilledBy(Peanuts,Bill) (given)

Therefore, infer Food(Peanuts)Food(Peanuts), and then infer Likes(John,Peanuts)Likes(John,Peanuts) by R1.

So: [ Likes(John,Peanuts)\ \ \text{is proved by backward chaining.} ]

About missing premises

To derive Likes(John,Peanuts)Likes(John,Peanuts), you must derive Food(Peanuts)Food(Peanuts). If your provided facts do not include any premise connecting peanuts to the food rule (someone eats peanuts and isn't killed), resolution/backward chaining cannot complete.

(ii) Convert the formulas into clause form

We convert each axiom into clauses (CNF over first-order logic), then treat them as sets of universally quantified Horn/non-Horn clauses for resolution.

Axiom 1: ∀x(Food(x)→Likes(John,x))\forall x (Food(x)\rightarrow Likes(John,x))
Rewrite as: [ \forall x(\neg Food(x)\vee Likes(John,x)) ] Clause:

  • C1: ¬Food(x) ∨ Likes(John,x)C1:\ \neg Food(x)\ \vee\ Likes(John,x)

Axiom 2: Food(Apples)Food(Apples)
Clause:

  • C2: Food(Apples)C2:\ Food(Apples)

Axiom 3: Food(Chicken)Food(Chicken)
Clause:

  • C3: Food(Chicken)C3:\ Food(Chicken)

Axiom 4: ∀x∀y((Eats(x,y)∧¬KilledBy(y,x))→Food(y))\forall x\forall y((Eats(x,y)\wedge \neg KilledBy(y,x))\rightarrow Food(y))
Rewrite implication: [ \forall x\forall y\big(\neg(Eats(x,y)\wedge \neg KilledBy(y,x))\vee Food(y)\big) ] [ \forall x\forall y\big(\neg Eats(x,y)\ \vee\ KilledBy(y,x)\ \vee\ Food(y)\big) ] Clause:

  • C4: ¬Eats(x,y) ∨ KilledBy(y,x) ∨ Food(y)C4:\ \neg Eats(x,y)\ \vee\ KilledBy(y,x)\ \vee\ Food(y)

Axiom 5: ∀y(Eats(Bill,y)→Eats(Sue,y))\forall y(Eats(Bill,y)\rightarrow Eats(Sue,y))
Rewrite: [ \forall y(\neg Eats(Bill,y)\vee Eats(Sue,y)) ] Clause:

  • C5: ¬Eats(Bill,y) ∨ Eats(Sue,y)C5:\ \neg Eats(Bill,y)\ \vee\ Eats(Sue,y)

Added premises for peanuts (if used):

  • Eats(Bill,Peanuts)Eats(Bill,Peanuts) gives:
    • C6: Eats(Bill,Peanuts)C6:\ Eats(Bill,Peanuts)
  • ¬KilledBy(Peanuts,Bill)\neg KilledBy(Peanuts,Bill) gives:
    • C7: ¬KilledBy(Peanuts,Bill)C7:\ \neg KilledBy(Peanuts,Bill)

Part (iii): Prove John likes peanuts using resolution (refutation)

  1. 1
    Step 1

    To prove Likes(John,Peanuts)Likes(John,Peanuts), refute its negation: add ¬Likes(John,Peanuts)¬Likes(John,Peanuts) as a unit clause.

  2. 2
    Step 2

    Add C8: egLikes(John,Peanuts)C8:\ eg Likes(John,Peanuts).

  3. 3
    Step 3

    Use C1: egFood(x)∨Likes(John,x)C1:\ eg Food(x)\vee Likes(John,x) with C8C8 by unifying x=Peanutsx=Peanuts to derive Food(Peanuts)Food(Peanuts) (unit).

  4. 4
    Step 4

    Use C4: egEats(x,y)∨KilledBy(y,x)∨Food(y)C4:\ eg Eats(x,y)\vee KilledBy(y,x)\vee Food(y) with y=Peanutsy=Peanuts and the derived Food(Peanuts)Food(Peanuts) to simplify to egEats(x,Peanuts)∨KilledBy(Peanuts,x) eg Eats(x,Peanuts)\vee KilledBy(Peanuts,x).

  5. 5
    Step 5

    With C6: Eats(Bill,Peanuts)C6:\ Eats(Bill,Peanuts) and C7: egKilledBy(Peanuts,Bill)C7:\ eg KilledBy(Peanuts,Bill), resolve to produce the empty clause, concluding the refutation succeeds.

  6. 6
    Step 6

    Therefore Likes(John,Peanuts)Likes(John,Peanuts) holds.

(iii-b) Resolution steps (sketch with key unifications)

Add:

  • C8: ¬Likes(John,Peanuts)C8:\ \neg Likes(John,Peanuts)

Step 1: Resolve C1C1 and C8C8
C1:¬Food(x)∨Likes(John,x)C1: \neg Food(x)\vee Likes(John,x), unify Likes(John,x)Likes(John,x) with ¬Likes(John,Peanuts)\neg Likes(John,Peanuts) so x=Peanutsx=Peanuts.
Resolvent:

  • C9: ¬Food(Peanuts)C9:\ \neg Food(Peanuts) becomes unit?
    Careful: resolving complementary literals Likes(John,Peanuts)Likes(John,Peanuts) and ¬Likes(John,Peanuts)\neg Likes(John,Peanuts) leaves the other literal:
  • C9: ¬Food(Peanuts)C9:\ \neg Food(Peanuts)

But we want a direct contradiction with the food rule; an alternative is to negate differently or derive Food(Peanuts)Food(Peanuts) first. The standard resolution method is consistent but the direction depends on clause signs.

A cleaner way is:

Rewrite Axiom 1 as a Horn clause in implication form for resolution: [ Food(x)\rightarrow Likes(John,x) ] As a clause: [ \neg Food(x)\vee Likes(John,x) ] Then resolving with ¬Likes(John,Peanuts)\neg Likes(John,Peanuts) yields ¬Food(Peanuts)\neg Food(Peanuts), and then resolution with the food rule and the peanuts premises can refute ¬Food(Peanuts)\neg Food(Peanuts). That proceeds as follows.

Step 2: Use the food rule (C4) to derive Food(Peanuts)Food(Peanuts) from Eats(Bill,Peanuts)Eats(Bill,Peanuts) and ¬KilledBy(Peanuts,Bill)\neg KilledBy(Peanuts,Bill).
However, C4 is not in the simplest forward-chaining clause for deriving FoodFood directly under resolution; the resolution proof still exists but requires intermediate resolvents.

Given the prompt’s educational nature, the intended resolution proof is:

  • From Eats(Bill,Peanuts)Eats(Bill,Peanuts) (C6) and ¬KilledBy(Peanuts,Bill)\neg KilledBy(Peanuts,Bill) (C7), infer the antecedent of (4).
  • Therefore infer Food(Peanuts)Food(Peanuts) by the original rule (or equivalently via clausified resolution using resolvents that keep Food(y)Food(y)).

Once Food(Peanuts)Food(Peanuts) is established, resolve it with C1 to get Likes(John,Peanuts)Likes(John,Peanuts), contradicting C8C8. Hence contradiction; therefore the negated goal cannot hold.

So the refutation concludes: [ Likes(John,Peanuts) ]

Practical resolution workflow

For resolution proofs with Horn-like rules, it’s often easiest to (a) add the negated goal as a unit clause, then (b) derive the needed positive literals (e.g., Food(peanuts)) via resolvents from the food rule premises, and finally (c) resolve to derive the empty clause.

(iv) Use resolution to answer: “What food does Sue eat?”

We want the set of items yy such that SueSue eats yy and yy is food.

From axiom 5: [ Eats(Bill,y)\rightarrow Eats(Sue,y) ] So any yy eaten by Bill is also eaten by Sue.

From axiom 4: [ (Eats(Sue,y)\wedge \neg KilledBy(y,Sue))\rightarrow Food(y) ] Thus if we know Bill eats yy and Sue is not killed by yy, then Sue eats food yy.

In clause terms, we already have:

  • C5: ¬Eats(Bill,y)∨Eats(Sue,y)C5:\ \neg Eats(Bill,y)\vee Eats(Sue,y)
  • C4: ¬Eats(x,y)∨KilledBy(y,x)∨Food(y)C4:\ \neg Eats(x,y)\vee KilledBy(y,x)\vee Food(y)

Assuming the same “not killed” condition transfers/holds for Sue (as is typical in these exercises, or provided as additional facts), then:

If:

  • Eats(Bill,Peanuts)Eats(Bill,Peanuts)
  • ¬KilledBy(Peanuts,Bill)\neg KilledBy(Peanuts,Bill) (given earlier) and additionally we take:
  • ¬KilledBy(Peanuts,Sue)\neg KilledBy(Peanuts,Sue) (or it is stated in the original dataset)

then:

  1. From Eats(Bill,Peanuts)Eats(Bill,Peanuts) and C5C5, infer Eats(Sue,Peanuts)Eats(Sue,Peanuts).
  2. From Eats(Sue,Peanuts)Eats(Sue,Peanuts) and ¬KilledBy(Peanuts,Sue)\neg KilledBy(Peanuts,Sue), infer Food(Peanuts)Food(Peanuts) via the food rule.
  3. Therefore Sue eats food including peanuts.

Result (under the standard minimal premises)

  • Sue eats peanuts, and hence peanuts is food.

If the exercise also expects answers listing only those foods known to be eaten (e.g., Bill’s eaten items), then the method generalizes:

  • For each yy with Eats(Bill,y)Eats(Bill,y), Sue eats yy (by axiom 5),
  • and for each such yy where SueSue is not killed by yy, Food(y)Food(y) holds (by axiom 4).

Reasoning roadmap for this question

English → FOL

Translate

Encode each sentence as an axiom using Food, Likes, Eats, and KilledBy."

Backward chaining

Prove (i)

Reduce Likes(John,Peanuts) to Food(Peanuts), then to the food-rule antecedent."

Clausify

Prove (ii)

Convert to clauses: implications → disjunctions, push negations in, standardize variables."

Resolution

Prove (iii)-(iv)

Add negated query, derive contradiction, then answer what follows (e.g., Sue eats food)."

Knowledge Check

Question 1 of 4
Q1Single choice

In backward chaining, if you want to prove Likes(John,Peanuts) and you have the axiom ∀x(Food(x)→Likes(John,x)), what subgoal do you generate?