Introduction to Artificial Intelligence

Chapter 5
Knowledge Representation and Symbolic AI

Bachelors Program in AI & ML
Introduction to Artificial Intelligence   •   Bachelor

Knowledge Representation and Symbolic AI

Introduction and Context

Artificial intelligence systems require more than algorithms for learning patterns. They also need ways to represent facts, concepts, relationships, constraints, goals, and explanations. Knowledge representation (KR) is the study and engineering of formal structures that allow a computer to store, retrieve, reason with, and communicate knowledge.

A representation is useful when it captures relevant aspects of a domain while supporting efficient inference. For example, a medical system may represent that a patient has a fever, that fever can be a symptom of infection, and that certain medications are contraindicated for a particular condition. The representation should enable the system to derive useful conclusions, explain them, and update them when new evidence arrives.

Symbolic AI treats knowledge as explicit symbols and structures manipulated according to formal rules. It includes logic-based reasoning, production rules, semantic networks, frames, ontologies, and knowledge graphs. Although modern AI makes extensive use of neural networks, symbolic methods remain important in domains requiring interpretability, explicit constraints, traceability, and reliable reasoning.

Learning Objectives

By the end of this chapter, a student should be able to:

1. Explain the purpose, assumptions, and limitations of knowledge representation.

2. Represent simple knowledge using propositional and first-order logic.

3. Distinguish syntax, semantics, entailment, satisfiability, and inference.

4. Construct and evaluate rule-based systems, semantic networks, and frames.

5. Explain ontologies and knowledge graphs and identify their applications.

6. Describe the architecture and operation of expert systems.

7. Analyse the strengths and limitations of symbolic AI.

8. Explain how symbolic and neural methods can be integrated responsibly.

1. What Knowledge Representation Involves

Knowledge representation is concerned with four related questions:

  • What objects and events exist in the domain?
  • What properties and relationships do they have?
  • What follows from the information already known?
  • How can knowledge be acquired, maintained, queried, and explained?

A KR system normally contains:

  • a representation language, such as logic or a graph notation;
  • a knowledge base, containing statements about a domain;
  • an inference mechanism, which derives conclusions;
  • a query or interaction interface; and
  • often, an explanation or provenance mechanism.

A good representation balances several competing requirements:

  • Representational adequacy: it can express the required knowledge.
  • Inferential adequacy: it supports deriving useful conclusions.
  • Inferential efficiency: reasoning can be performed within acceptable time and memory limits.
  • Acquisitional efficiency: knowledge can be added and updated without excessive effort.
  • Clarity and maintainability: domain experts can inspect and revise it.

No representation is universally best. A propositional representation may be simple but unable to express general relationships. First-order logic is more expressive but can be computationally difficult. A knowledge graph is convenient for connected data, but graph links alone may not capture all constraints or uncertainty.

Declarative and Procedural Knowledge

Declarative knowledge states what is true, such as “The server is located in Building A.” Procedural knowledge describes how to perform a task, such as the sequence for diagnosing a network failure. Rules can combine both aspects: a rule may declare a relationship while also guiding a decision process.

Open-World and Closed-World Assumptions

Under the closed-world assumption, a statement not present in the knowledge base is treated as false. This is common in many database applications. Under the open-world assumption, absence of a statement does not imply its negation. Ontology languages and knowledge graphs commonly use an open-world perspective. If a graph contains no fact that a person owns a car, it does not automatically follow that the person owns no car.

This distinction is operationally important. In a fraud-detection database, missing information may be treated as a data-quality problem rather than evidence of innocence or guilt.

2. Propositional Logic

Propositional logic represents knowledge using propositions that are either true or false. A proposition is a complete declarative statement, such as:

  • P: “The alarm is active.”
  • Q: “The building is occupied.”

The principal logical connectives are:

  • Negation: ¬P, meaning “not P”
  • Conjunction: P ∧ Q, meaning “P and Q”
  • Disjunction: P ∨ Q, meaning “P or Q,” usually inclusive
  • Implication: P → Q, meaning “if P, then Q”
  • Biconditional: P ↔ Q, meaning “P if and only if Q”

A valuation assigns truth values to propositions. The truth of a compound expression is determined by its connective definitions. For example, P → Q is false only when P is true and Q is false. This does not necessarily mean that P causes Q; implication is a truth-functional relationship in the formal language.

Knowledge Bases and Entailment

A propositional knowledge base is a set of sentences. If the knowledge base contains P and P → Q, a valid inference is Q. This is the familiar rule of modus ponens:

P, P → Q ⊢ Q

The symbol ⊢ indicates derivability using a proof system. The semantic concept of entailment, written KB ⊨ Q, means that Q is true in every interpretation in which KB is true.

A sentence is satisfiable if at least one interpretation makes it true. It is valid if every interpretation makes it true. A contradiction is false under every interpretation.

Worked Example: Propositional Inference

Suppose:

1. R: The roadway is wet.

2. W → S: If the roadway is wet, then the braking distance is increased.

3. R → W: If it is raining, the roadway is wet.

4. Raining is true.

To avoid ambiguity, let T mean “It is raining,” W mean “The roadway is wet,” and S mean “Braking distance is increased.” The knowledge base is:

T, T → W, W → S

By modus ponens, T and T → W yield W. Then W and W → S yield S. Therefore the system entails that braking distance is increased.

This reasoning is valid only because the rules are explicitly present and their conditions are satisfied. Real-world reasoning may require exceptions, uncertainty, time, and causal distinctions that basic propositional logic does not provide.

Limitations

Propositional logic treats each proposition as indivisible. It cannot naturally express that several people own different vehicles, that every sensor has a location, or that a relationship holds for an arbitrary number of objects. For this reason, it becomes unwieldy when many entities share common properties.

3. First-Order Logic

First-order logic (FOL) extends propositional logic by representing objects, properties, relations, and quantified statements. Its basic components include:

  • Constants, such as `Aisha` or `Sensor17`;
  • Variables, such as x and y;
  • Predicates, such as `Student(x)` or `LocatedIn(x,y)`;
  • Functions, which map objects to objects, when required; and
  • Quantifiers, especially universal (∀) and existential (∃) quantifiers.

Examples include:

  • `Student(Aisha)` — Aisha is a student.
  • `Reads(Aisha, Book1)` — Aisha reads Book1.
  • ∀x Student(x) → HasID(x) — Every student has an identification record.
  • ∃x Device(x) ∧ Faulty(x) — At least one device is faulty.

The variables in a formula must be properly scoped. In ∀x Student(x) → HasID(x), x is universally quantified. In ∃x Device(x) ∧ Faulty(x), x is existentially quantified.

Generalisation and Relations

FOL allows a single rule to apply to many individuals. Consider:

∀x,y (Parent(x,y) → OlderThan(x,y))

This says that every parent is older than their child in the represented domain. It does not assert that every older person is a parent. Reversing an implication without justification is a common reasoning error.

A statement such as:

∀x (Bird(x) → CanFly(x))

may be syntactically correct but domain-inaccurate because some birds, such as penguins, do not fly. This illustrates that formal validity and empirical correctness are different matters. A valid inference from a false premise may still produce an unsound conclusion about the real world.

Substitution and Unification

Unification finds substitutions that make logical expressions identical. For example, `Likes(x, Tea)` and `Likes(Aisha, y)` unify with substitution x = Aisha and y = Tea. Unification is fundamental to automated theorem proving and logic programming.

A substitution must respect variable structure. `Likes(Aisha, Tea)` cannot unify with `WorksIn(Aisha, Tea)` because their predicate symbols differ.

Inference in First-Order Logic

Common inference methods include:

  • Forward chaining: start with known facts and repeatedly apply rules to derive new facts.
  • Backward chaining: start with a query and work backward to identify rules and facts that could establish it.
  • Resolution: derive contradiction by combining clauses, often after converting formulas to a suitable clause form.

FOL is expressive, but unrestricted first-order theorem proving is not generally guaranteed to terminate for every query. Practical systems therefore use restrictions, indexing, heuristics, or domain-specific reasoning procedures.

4. Rule-Based Representation

A rule-based system represents knowledge as facts and conditional rules, often in the form:

IF condition(s) THEN conclusion.

For example:

  • IF `HighTemperature(x)` AND `LowPressure(x)` THEN `PossibleLeak(x)`.
  • IF `PossibleLeak(x)` THEN `InspectValve(x)`.

The working memory stores current facts. The rule engine matches conditions against those facts and adds conclusions or recommends actions.

Forward and Backward Chaining

In forward chaining, the system is data-driven. New sensor readings may activate rules automatically. In backward chaining, the system is goal-driven. To determine whether `Eligible(Aisha)` is true, the engine searches for rules that conclude eligibility and then attempts to prove their premises.

If multiple rules can fire, a conflict-resolution strategy is required. Common strategies include rule priority, specificity, recency of facts, and fixed ordering. The chosen strategy can affect system behaviour and must be documented.

Monotonic and Non-Monotonic Reasoning

Reasoning is monotonic when adding facts does not invalidate previous conclusions. Classical logic is generally monotonic. Everyday reasoning is often non-monotonic: a system may conclude that a bird flies, then withdraw that conclusion when it learns that the bird is a penguin.

Non-monotonic mechanisms include default rules, defeasible logic, belief revision, and truth-maintenance systems. They are important where exceptions, changing information, or conflicting sources occur.

5. Semantic Networks and Frames

A semantic network represents concepts as nodes and relationships as labelled links. A simplified network might contain:

`Canary —is-a→ Bird`

`Bird —has-part→ Wing`

`Canary —located-in→ Aviary1`

The `is-a` relation often supports inheritance. If canaries are birds and birds have wings, a system may infer that a canary has wings. However, inheritance must be carefully designed. Properties such as “can fly” may have exceptions and should not be inherited blindly.

Frames

A frame is a structured record for representing a stereotyped object, situation, or event. A frame may contain:

  • a name or class;
  • slots, such as colour, owner, or location;
  • slot values or default values;
  • constraints on allowable values; and
  • links to parent frames.

For example, a `Vehicle` frame may have slots `manufacturer`, `registrationNumber`, and `fuelType`. A `Car` frame may inherit from `Vehicle` and add `numberOfDoors`.

Frames are useful because they combine declarative information with expectations about a class. They are less suited to situations in which all properties are independent, rapidly changing, or heavily uncertain unless additional mechanisms are supplied.

6. Ontologies

An ontology is a formal, explicit specification of a shared conceptualisation of a domain. It identifies classes, properties, constraints, and sometimes axioms that support machine-interpretable reasoning.

An ontology may define:

  • classes, such as `Patient`, `Medication`, and `Condition`;
  • subclasses, such as `Antibiotic` being a subclass of `Medication`;
  • object properties, such as `prescribedFor`;
  • data properties, such as `hasDosage`;
  • domain and range constraints; and
  • disjointness or equivalence relationships.

Ontologies differ from simple taxonomies. A taxonomy mainly organises concepts hierarchically, while an ontology may define richer relationships and logical constraints.

Ontology Engineering Process

A practical ontology-development process includes:

1. Define scope and intended uses.

2. Identify important terms and candidate concepts.

3. Organise concepts into classes and subclasses.

4. Define relationships and attributes.

5. Specify constraints and axioms.

6. Populate or link the ontology to data.

7. Test consistency and competency questions.

8. Obtain domain-expert review.

9. Establish versioning and governance.

A competency question is a question the ontology should support, such as “Which medications are contraindicated for patients with condition X?” It provides a practical test of whether the ontology meets its purpose.

Ontology design requires care with identity, granularity, time, and ambiguity. For example, “hospital” might refer to an organisation, a physical facility, or an episode of care. These should not be merged merely because they share a word.

7. Knowledge Graphs

A knowledge graph represents entities and relationships as interconnected, machine-readable data. A simple triple has the form:

`Subject — Predicate — Object`

For example:

`DrugA — treats — ConditionB`

The object may be another entity or a literal value, such as a number or date. Knowledge graphs commonly combine data from multiple sources and attach identifiers, provenance, timestamps, and confidence information.

Knowledge graphs support:

  • semantic search;
  • recommendation;
  • entity linking and disambiguation;
  • fraud and network analysis;
  • question answering; and
  • data integration across organisational systems.

A graph is not automatically a complete or correct model of the world. Its quality depends on source reliability, identity resolution, schema design, update processes, and treatment of missing or conflicting facts.

Ontologies and Graphs Together

An ontology supplies conceptual meaning and constraints; a knowledge graph supplies instances and relationships. For example, an ontology may define `Researcher` and `Institution`, while the graph records that a specific researcher is affiliated with a specific institution. In practice, the boundary is not absolute: many knowledge graphs contain both schema-level and instance-level information.

8. Expert Systems

An expert system is a knowledge-based system designed to perform tasks associated with specialist human expertise. A typical architecture contains:

  • a knowledge base of facts and rules;
  • an inference engine;
  • working memory for case-specific facts;
  • a user interface;
  • an explanation facility; and
  • knowledge-acquisition and maintenance tools.

The system may explain its result by showing which facts and rules supported it. This is particularly valuable in regulated or safety-sensitive settings.

Historically, expert systems achieved success in areas such as medical diagnosis, equipment troubleshooting, and mineral exploration. Their main difficulty was the knowledge-acquisition bottleneck: extracting tacit, exception-filled expertise from specialists and maintaining it as the domain changes.

Other limitations include brittleness outside the encoded domain, difficulty handling uncertain or contradictory evidence, and possible bias in the rules. An expert system should therefore be evaluated not only for accuracy but also for coverage, calibration where probabilities are used, explanation quality, safety, and maintainability.

9. Worked Application: Equipment Troubleshooting

Consider an illustrative manufacturing system for diagnosing a conveyor motor. The knowledge base includes:

  • `MotorDoesNotStart(M1)`
  • `PowerIndicatorOff(M1)`
  • `FuseBlown(M1)`
  • IF `PowerIndicatorOff(x)` AND `FuseBlown(x)` THEN `PowerSupplyFault(x)`
  • IF `PowerSupplyFault(x)` THEN `InspectFuse(x)`
  • IF `InspectFuse(x)` AND `FuseBlown(x)` THEN `ReplaceFuse(x)`

The inference engine first derives `PowerSupplyFault(M1)` from the first two relevant facts. It then recommends `InspectFuse(M1)`. Since the system has a fact that the fuse is blown, it recommends `ReplaceFuse(M1)`.

Analysis

The chain is transparent and auditable. A technician can inspect whether the premises were correctly recorded and whether the rule is appropriate. However, the system does not establish that replacing the fuse is safe or sufficient. A blown fuse may be a symptom of a short circuit, overload, or unsafe wiring condition. Additional rules, sensor readings, and human verification are necessary.

Outcome and Learning Points

The example demonstrates the strengths of explicit symbolic reasoning: traceability, repeatability, and domain-specific control. It also demonstrates its dependence on knowledge quality. A system that lacks a rule for repeated fuse failure may provide an incomplete or unsafe recommendation.

10. Symbolic and Neural AI Integration

Neural systems learn distributed representations from data and are effective for perception, language, and pattern recognition. Symbolic systems represent explicit structures and are effective for compositional reasoning, constraints, and explanation. Their integration is often called neuro-symbolic AI.

Important integration patterns include:

1. Neural perception with symbolic reasoning: a vision model identifies objects, and a logic engine reasons about spatial constraints.

2. Symbolic constraints during learning: rules or safety conditions restrict permissible predictions.

3. Knowledge-enhanced neural models: an ontology or graph supplies entities and relationships to a language or recommendation model.

4. Neural proposal with symbolic verification: a neural model proposes an answer, while a theorem prover or rule engine checks consistency.

5. Differentiable reasoning: selected symbolic operations are approximated in forms that can be trained with gradient methods.

Integration introduces challenges. Neural outputs may be uncertain, while symbolic reasoning often assumes precise premises. A mistaken entity link can lead to a logically valid but substantively wrong conclusion. Systems should preserve confidence, provenance, and the distinction between observed facts, inferred facts, and model-generated hypotheses.

11. Challenges, Ethics, and Governance

Incompleteness and inconsistency

Real knowledge bases are incomplete and may contain contradictory sources. Systems should record provenance and support conflict detection rather than silently selecting one source.

Uncertainty

Classical logic is not designed to express degrees of belief. Probabilistic logic, fuzzy logic, certainty factors, and probabilistic graphical models can be used when uncertainty is central. These approaches have different semantics and should not be mixed casually.

Bias and fairness

Rules and ontologies reflect choices made by designers and institutions. A rule that appears neutral may produce unequal outcomes if it encodes historically biased criteria. Audits should examine coverage, affected groups, exception handling, and appeal mechanisms.

Privacy and security

Knowledge graphs can expose sensitive relationships even when individual data items appear harmless. Access controls, minimisation, encryption, provenance, retention policies, and purpose limitation are essential. Inference attacks may reveal sensitive facts that were never explicitly stored.

Accountability and safety

In high-impact domains, systems should provide human oversight, versioned knowledge bases, test cases, change approval, monitoring, and rollback procedures. Explanations should be meaningful to the intended user, not merely a technical dump of internal identifiers.

12. Contemporary Developments and Best Practices

Large language models have increased interest in combining natural-language interaction with structured knowledge. A common architecture retrieves documents or graph facts, asks a model to formulate an answer, and applies validation or citation checks. This can reduce unsupported generation, but retrieval does not guarantee correctness.

Best practices include:

  • define the domain and intended decisions before choosing a formalism;
  • distinguish facts, rules, defaults, observations, and hypotheses;
  • use stable identifiers and explicit semantics;
  • record provenance, time, source, and confidence;
  • test both ordinary cases and exceptions;
  • involve domain experts and affected stakeholders;
  • version and govern ontology and rule changes;
  • measure inference performance and operational outcomes;
  • provide explanations and mechanisms for correction; and
  • use neural components where they add value, without allowing them to bypass safety constraints.

Chapter Summary

Knowledge representation provides formal structures for storing and reasoning about domain knowledge. Propositional logic represents whole statements, while first-order logic adds objects, predicates, relations, and quantifiers. Entailment concerns what must be true given a knowledge base; inference procedures such as forward chaining, backward chaining, unification, and resolution operationalise reasoning.

Rules provide practical condition-conclusion mechanisms. Semantic networks organise concepts and relationships, while frames represent structured objects with slots, inheritance, and defaults. Ontologies specify shared conceptualisations and constraints, and knowledge graphs connect real entities and relationships using graph structures and provenance.

Expert systems combine knowledge bases, inference engines, working memory, interfaces, and explanations. Their advantages include transparency and domain control, but they face knowledge-acquisition, maintenance, uncertainty, incompleteness, and bias challenges. Neuro-symbolic AI combines learned perception or language capabilities with explicit reasoning and constraints. Responsible systems require provenance, validation, privacy protection, fairness analysis, human oversight, and lifecycle governance.

Key Terms

Knowledge representation: The formal modelling of information so that a computer can store and reason with it.

Symbolic AI: AI based on explicit symbols, structures, and rule-governed manipulation.

Proposition: A declarative statement that can be assigned a truth value.

Predicate: A logical expression representing a property or relation.

Quantifier: An operator indicating scope over objects, especially universal or existential scope.

Entailment: A relationship in which a conclusion is true in every model of a knowledge base.

Satisfiability: The property of being true in at least one interpretation.

Unification: Finding substitutions that make logical expressions identical.

Rule-based system: A system that uses facts and condition-conclusion rules.

Forward chaining: Data-driven reasoning that repeatedly applies rules to known facts.

Backward chaining: Goal-driven reasoning that searches backward from a query.

Semantic network: A graph of concepts connected by labelled semantic relations.

Frame: A structured representation containing slots, values, defaults, and constraints.

Ontology: A formal specification of concepts, relationships, and constraints in a domain.

Knowledge graph: An interconnected representation of entities and relationships, often expressed as triples.

Expert system: A knowledge-based system intended to perform specialist reasoning tasks.

Open-world assumption: The principle that absence of a statement does not imply its negation.

Non-monotonic reasoning: Reasoning in which new information can withdraw a previous conclusion.

Neuro-symbolic AI: The integration of neural learning with symbolic representation and reasoning.

Provenance: Information about the source, time, or derivation of a knowledge item.

Review Questions

Short Answer Questions

1. What is the purpose of a knowledge representation language?

2. Distinguish propositional logic from first-order logic.

3. What is the difference between forward chaining and backward chaining?

4. How does an ontology differ from a simple taxonomy?

5. Why is provenance important in a knowledge graph?

Long Answer Questions

1. Explain syntax, semantics, satisfiability, validity, and entailment in propositional logic.

2. Describe the components and operation of an expert system, including its explanation facility.

3. Compare semantic networks, frames, ontologies, and knowledge graphs.

4. Discuss the knowledge-acquisition bottleneck and other limitations of rule-based expert systems.

5. Explain major approaches to integrating symbolic and neural AI, including their benefits and risks.

Analytical / Application Questions

1. Design a small rule-based troubleshooting system for a network printer. State at least five facts or rules and explain one complete inference chain.

2. A hospital knowledge graph contains a medication, a patient, and a diagnosis but no statement that the medication is safe for that patient. Explain how open-world reasoning affects the decision and propose a safe system response.

3. A neural language model recommends a treatment based on an extracted medical relationship. Design a neuro-symbolic validation process that addresses uncertainty, provenance, contraindications, and human oversight.

Multiple Choice Questions with Answers

Question 1

Which statement best describes entailment in logic?

A. A conclusion is true in every interpretation that makes the knowledge base true.

B. A conclusion is true in at least one interpretation.

C. A conclusion has been observed by a sensor.

D. A conclusion is generated by a neural network.

Correct Answer: A. A conclusion is true in every interpretation that makes the knowledge base true.

Question 2

What does first-order logic add to propositional logic?

A. Only numerical probability values

B. Objects, predicates, relations, and quantifiers

C. A requirement that all statements be true

D. A graphical user interface

Correct Answer: B. Objects, predicates, relations, and quantifiers

Question 3

Which reasoning strategy begins with known facts and applies matching rules to derive new facts?

A. Backward chaining

B. Abductive search only

C. Forward chaining

D. Ontology alignment

Correct Answer: C. Forward chaining

Question 4

Under the open-world assumption, the absence of a fact generally means that the fact is:

A. False

B. True

C. Automatically contradictory

D. Unknown or not established

Correct Answer: D. Unknown or not established

Question 5

Which structure primarily represents a subject-predicate-object relationship?

A. Knowledge graph triple

B. Truth table row only

C. Frame default only

D. Neural weight matrix

Correct Answer: A. Knowledge graph triple

Question 6

What is the main purpose of unification?

A. To assign probabilities to rules

B. To find substitutions that make logical expressions match

C. To remove all predicates from a formula

D. To convert a graph into an image

Correct Answer: B. To find substitutions that make logical expressions match

Question 7

Which component of an expert system stores case-specific facts during reasoning?

A. Working memory

B. Compiler

C. Training epoch

D. Activation function

Correct Answer: A. Working memory

Question 8

Why can the rule 'All birds fly' be problematic in a real domain?

A. It contains no symbols

B. It may fail for exceptions such as penguins

C. It cannot be written in any formal language

D. It is always probabilistic

Correct Answer: B. It may fail for exceptions such as penguins

Question 9

Which is an example of neuro-symbolic AI?

A. Using only a manually written taxonomy with no inference

B. Using a neural vision model followed by symbolic spatial reasoning

C. Replacing every rule with random values

D. Storing images without labels

Correct Answer: B. Using a neural vision model followed by symbolic spatial reasoning

Question 10

Which practice most directly supports accountability in a knowledge-based system?

A. Removing source information after inference

B. Keeping provenance and versioning knowledge changes

C. Treating missing facts as always false

D. Allowing rules to change without review

Correct Answer: B. Keeping provenance and versioning knowledge changes

Introduction to Artificial Intelligence
Chapter 5 of 15