Knowledge Representation in Artificial Intelligence: Logic, Semantic Networks, Frames and Rules with Worked Examples

Learn how AI stores facts and derives new ones through logic, semantic networks, frames and rules. Two worked traces make the inference steps exam-ready.

KnowledgeGate Team

Exam prep & CS education

Updated 11 Aug 20266 min read

Students preparing Artificial Intelligence papers often memorise semantic networks, frames and first-order logic as separate definitions, then freeze when asked to translate a sentence or complete a resolution proof. These ideas appear in GATE DA, UGC NET Computer Science, teaching recruitment exams and semester papers. Logic, semantic networks, frames and production rules are four answers to one question: how do you store a fact so that a program can derive a new one from it? The translation step and the inference step are what carry the marks.

1. What knowledge representation has to do

Knowledge representation, or KR, is the bridge between facts about the world and a form that a program can reason over. The classical loop is simple:

facts -> representation -> inference -> new facts

A knowledge base stores the represented facts. An inference engine applies valid reasoning steps to derive conclusions. Any KR scheme can be judged through four adequacy properties:

  • Representational adequacy: Can the scheme express the required knowledge?

  • Inferential adequacy: Can it derive new knowledge from what is stored?

  • Inferential efficiency: Can it reach useful conclusions without excessive work?

  • Acquisitional efficiency: Can new facts be added and organised easily?

These names are common one-mark targets. Also separate declarative knowledge, knowing that a queen moves along a rank, file or diagonal, from procedural knowledge, knowing how to execute a queen checkmate.

2. The four main knowledge representation schemes

Scheme

What it stores

How inference works

Strength

Weakness

Logic, propositional and FOL

Facts, predicates and quantified statements

Formal deduction, unification and resolution

Precise and highly expressive

FOL inference can be slow, and full FOL reasoning is semi-decidable

Semantic networks

Concepts and labelled relationships in a graph

Traversal and inheritance

Visual, with fast property inheritance

Weak for complex quantified statements

Frames

Object-centred slots, fillers, defaults and facets

Slot lookup, inheritance and default override

Organises structured objects naturally

Cross-frame exceptions become clumsy

Production rules

IF-THEN rules

Forward or backward chaining

Modular and traceable

Large rule sets can conflict or loop

Ontologies add a formal shared vocabulary to concepts and relations. Scripts organise stereotyped event sequences. Both extend the same KR ideas.

3. First-order logic and a worked resolution proof

Two translation patterns settle many questions:

  • “All doctors are educated” becomes ForAll x (Doctor(x) -> Educated(x)).

  • “Some doctors are rich” becomes Exists x (Doctor(x) AND Rich(x)).

The pairing rule is worth memorising: a universal quantifier pairs with implication, while an existential quantifier pairs with conjunction. For a refresher, use Propositional and Predicate Logic: Truth Tables, Quantifiers and Inference.

Now use resolution refutation to prove Animal(Milo) from this knowledge base:

  1. ForAll x (Cat(x) -> Mammal(x))

  2. ForAll x (Mammal(x) -> Animal(x))

  3. Cat(Milo)

Convert the statements to clause form and add the negated goal:

  • C1 = NOT Cat(x) OR Mammal(x)

  • C2 = NOT Mammal(y) OR Animal(y)

  • C3 = Cat(Milo)

  • C4 = NOT Animal(Milo)

Carry out the refutation step by step:

  1. Resolve C4 with C2 using the substitution {y/Milo}. The complementary Animal(Milo) literals cancel, giving R1 = NOT Mammal(Milo).

  2. Resolve R1 with C1 using the substitution {x/Milo}. The complementary Mammal(Milo) literals cancel, giving R2 = NOT Cat(Milo).

  3. Resolve R2 with C3. NOT Cat(Milo) and Cat(Milo) cancel, producing the empty clause.

The empty clause is a contradiction. Therefore, the knowledge base proves Animal(Milo).

Resolution refutation tree deriving the empty clause to prove Animal(Milo) from Cat(Milo).

4. Semantic networks, inheritance and the penguin problem

Build this network:

  • Penguin --is-a--> Bird --is-a--> Animal

  • Bird --can--> Fly (default) and Bird --has--> Wings

  • Penguin --can--> Swim and Penguin --cannot--> Fly (exception)

  • Tweety --instance-of--> Penguin

Query one: does Tweety have wings? Yes. Follow Tweety -> Penguin -> Bird, then inherit the Wings property from Bird.

Query two: can Tweety fly? No. Bird supplies a default that birds fly, but Penguin supplies the more specific exception that penguins cannot fly. The most specific information wins.

This is default reasoning and non-monotonicity. Knowing only that Tweety is a bird permits a tentative flying conclusion. Learning that Tweety is a penguin retracts it. Plain monotonic FOL cannot do that.

Semantic network where Penguin inherits Wings from Bird but overrides the default Fly, so Tweety cannot fly.

5. Frames and production rules

A student-record frame

A frame groups knowledge object-wise. Consider:

STUDENT-RECORD

  • name = (filler)

  • target-exam = GATE-CS

  • weekly-study-hours = default 20

  • test-series-enrolled = yes/no

A slot is an attribute such as target-exam; its filler is the value. A default applies when no value is supplied. A facet describes a slot, such as its allowed type. Frames are semantic networks reorganised around objects.

A two-rule production trace

Use exactly two rules:

  • R1: IF fever = yes AND rash = yes THEN condition = measles-suspect

  • R2: IF condition = measles-suspect THEN action = refer-to-doctor

Working memory begins as {fever = yes, rash = yes}. In cycle 1, R1 matches and adds condition = measles-suspect. In cycle 2, R2 matches and adds action = refer-to-doctor. No unused rule matches, so the system halts.

The three components are the rule base, working memory, and inference or control engine. This is forward chaining because it starts from facts. Backward chaining starts from a goal such as refer-to-doctor and works back to supporting facts.

6. Knowledge representation traps that cost marks

  1. Using implication with an existential. Exists x (Doctor(x) -> Rich(x)) can be satisfied by any non-doctor, so it does not express that a rich doctor exists. Use Exists x (Doctor(x) AND Rich(x)).

  2. Reversing “all” and “only”. “All birds fly” is ForAll x (Bird(x) -> Fly(x)). “Only birds fly” is ForAll x (Fly(x) -> Bird(x)). In “only A do B”, B goes in the antecedent.

  3. Ignoring quantifier order. ForAll x Exists y Loves(x,y) allows each person a different loved object. Exists y ForAll x Loves(x,y) requires one object loved by everyone. Read from the outer quantifier inward.

  4. Expecting plain FOL to solve the penguin exception. Monotonic logic does not retract Fly(Tweety) after deriving it. The intended idea is default or non-monotonic reasoning.

  5. Forgetting to negate the goal in resolution. Refutation begins by adding the negated goal. Without it, the derivation is not set up to close with the empty clause.

7. How exams test KR, and the short version

The official GATE syllabus published by the organising institute places logic and reasoning within the Data Science and Artificial Intelligence paper, while the classic GATE CS paper tests propositional and first-order logic through Discrete Mathematics. The official NTA UGC NET portal points candidates to the Computer Science and Applications syllabus, where Artificial Intelligence is an explicit unit. Confirm the current official syllabus before deciding depth for any exam. For a broader revision map, use UGC NET Computer Science high-yield topics, and use the GATE category when planning the rest of your preparation.

Expect questions on the four adequacies, English-to-FOL translations, short resolution refutations and inheritance queries. Interviews ask when frames beat rules, why defaults matter, and why systems need non-monotonic reasoning.

The short version

Five lines to carry into the exam hall:

  • Four adequacies: representation, inference, inference efficiency and acquisition.

  • Universal pairs with implication; existential pairs with conjunction.

  • Resolution refutation negates the goal and derives the empty clause.

  • In inheritance, the most specific information wins.

  • Forward chaining starts from facts; backward chaining starts from a goal.

For structured coverage across the syllabus, follow GATE Guidance by Sanchit Sir. Then test whether you can perform these steps under time pressure with the GATE Test Series. Do not stop at recognising the terms. Rebuild the resolution proof and the Tweety inheritance trace from a blank page.