Search topics and sections

Knowledge representation and reasoning (KRR) is the part of artificial intelligence that studies how to write down knowledge about the world in a form a computer can use, and how the computer can then draw new conclusions from it. A representation is a set of symbols that stand for beliefs, such as "every penguin is a bird" and "Tweety is a penguin." Reasoning works on those symbols to produce new ones, such as "Tweety is a bird."[1]

KRR is a core part of symbolic artificial intelligence.[2] Products of the field include:

The field grew from an idea John McCarthy put forward in 1958. He proposed that a program could act sensibly if people told it facts in a formal language and it worked out the consequences for itself.[2][6]

Some KRR structures, such as frames and scripts, were also put forward as accounts of human memory and understanding. That makes them a subject of cognitive science as well.[7][8]

Core ideas

Knowledge, representation, and reasoning

KRR uses three basic terms.[1]

  • Knowledge: propositions (statements that can be true or false) that some agent, a person or system that holds beliefs, believes.
  • Representation: a symbolic encoding of those propositions.
  • Reasoning: working with those symbols to produce representations of new propositions.

Knowledge bases

A knowledge base (KB) is the set of sentences a system explicitly believes. The system's implicit knowledge is larger, since it includes every sentence that follows from the KB.[1] For example:

  • Explicit: "Every penguin is a bird." "Tweety is a penguin."
  • Implicit: "Tweety is a bird."

Reasoning is the work of turning implicit knowledge into explicit answers.

Keeping knowledge apart from the program

The key design choice in KRR is to store knowledge as data that a general program reads, rather than burying it in program code. McCarthy's proposed advice taker was meant to improve its behavior "merely by making statements to it," with little if any knowledge of the program.[6] A system built this way is called a knowledge-based system.[1]

A typical knowledge-based system has a knowledge base and an inference engine, the general program that reasons over it. The medical system MYCIN, for example, had three parts:[9]

  1. A consultation program that asked a physician about a patient and gave diagnoses and therapy advice.
  2. An explanation program that justified the system's conclusions.
  3. A knowledge-acquisition program that experts used to update the knowledge base.
Architecture of a knowledge-based system Domain expert User Knowledge base facts rules Inference engine knowledge acquisition reads question / case data answer + explanation knowledge-based system
A knowledge-based system keeps domain knowledge, written as facts and rules, in a knowledge base, separate from the general inference engine that reasons over it. A domain expert supplies the knowledge, and a user poses questions and receives answers with explanations.

What a representation does

Randall Davis, Howard Shrobe, and Peter Szolovits argued in 1993 that a knowledge representation plays five different roles. Each role puts different, sometimes conflicting, demands on a representation.[10]

Role Meaning
Surrogate A stand-in for the world, so an agent can find consequences by thinking instead of acting
Set of ontological commitments An answer to "In what terms should I think about the world?"
Fragmentary (partial) theory of intelligent reasoning A view of what reasoning is, which inferences are allowed, and which are recommended
Medium for efficient computation A way of organizing information so the recommended inferences can be computed
Medium of human expression A language in which people say things about the world

Davis and his coauthors note that a representation often starts from an insight into how people reason intelligently, or from a belief about what it means to reason intelligently at all.[10]

Ways to represent knowledge

Researchers have built many representation languages, called formalisms. Each makes some kinds of knowledge easy to state and some kinds of reasoning easy to run.

Logic

First-order logic (FOL) is the standard reference language of KRR. It states facts with predicates (properties and relations), constants (names of things), and quantifiers.[11] Quantifiers say how many things a statement applies to; for example, "for all" applies it to every thing in a group.

The penguin example becomes:

∀x (Penguin(x)→Bird(x))\forall x\,\big(\mathit{Penguin}(x) \rightarrow \mathit{Bird}(x)\big)
Penguin(tweety)\mathit{Penguin}(\mathit{tweety})

Here ∀x\forall x means "for every xx," →\rightarrow means "implies," and tweety\mathit{tweety} names one individual.

McCarthy held that a logical account of a reasoning problem helps in understanding it, even if a program does not prove theorems. That view is disputed, and many AI researchers see no need for logic in their work.[12]

Semantic networks

A semantic network is a graph that represents knowledge as nodes (concepts) joined by labeled links (relations).[13]

The first published use of the term "semantic net" was by Richard Richens in 1956, in work on machine translation.[13]

One common kind, the definitional network, centers on the "is-a" link. This link joins a more specific kind (a subtype) to a broader kind (its supertype). It supports inheritance, the rule that copies properties of a supertype to all its subtypes.[13]

Ross Quillian's 1966 work added spreading activation, a way of searching the network by passing markers along links.[13]

Semantic network of birds Animal Bird Canary Penguin Tweety skin wings fly sing fly has has can can cannot exception is-a is-a is-a instance-of inherited
A semantic network in which concepts (ovals) are joined by is-a and instance-of links, and properties (boxes) are attached by has, can, and cannot links. Canary inherits wings from Bird. Penguin overrides the inherited ability to fly with an exception.

Frames and scripts

Marvin Minsky proposed frames in 1974. He described a frame as a data structure for representing a typical situation, such as being in a certain kind of living room or going to a child's birthday party.[7]

  • The top levels of a frame hold things that are always true of the situation.
  • Lower levels have slots that must be filled with specific data, and each slot can set conditions on what fills it.
  • Slots normally start with default values, which hold until better information arrives.[7]

Scripts, from Roger Schank and Robert Abelson in 1977, apply a similar idea to events. A script is a typical sequence of actions, set in advance, that defines a well-known situation, such as eating at a restaurant.[8] See script theory.

Frame for a child's birthday party Frame: child's birthday party Fixed (always true) occasion: birthday guests: children Slots Slot Default value host (to be filled) birthday child (to be filled) food cake activity games guests bring presents Slot values are illustrative Frame: cake candles flavor Defaults hold until better information arrives
A frame for Minsky's 1974 example of a child's birthday party. Fixed facts always hold, and slots carry default values that stay in place until better information arrives. The food slot is filled by a cake sub-frame with its own slots, and the slot values are illustrative.

Production rules

A production system stores knowledge as IF-THEN rules. MYCIN, a system for advising on infections, encoded the judgment of medical experts this way, drawing the conclusion in a rule's action part whenever its condition (called the premise) is true.[9] A typical MYCIN rule reads:[9]

IF   1) the gram stain of the organism is gramneg, and
     2) the morphology of the organism is rod, and
     3) the aerobicity of the organism is anaerobic
THEN there is suggestive evidence (.6) that the identity
     of the organism is bacteroides

The number .6 is a certainty factor, which marks how strongly the evidence supports the conclusion. When a condition is known with less than full certainty, MYCIN weakens the conclusion to match.[9] See rule-based system.

Description logics and ontologies

Description logics (DLs) are a family of representation languages used to build ontologies, which define the concepts of a domain and how they relate.[4]

Most DLs are decidable fragments of first-order logic, meaning a program can always settle whether a statement follows.[4]

DLs descend from an approach by William Woods and the KL-ONE system that Ronald Brachman built in 1979.[13]

A DL knowledge base splits its statements, called axioms, into groups. ABox axioms describe named individuals, and TBox axioms relate concepts.[4] For example:

Mother(julia)Mother⊑Parent\mathit{Mother}(\mathit{julia}) \qquad \mathit{Mother} \sqsubseteq \mathit{Parent}

The first says Julia is a mother. The second says every mother is a parent (⊑\sqsubseteq reads "is subsumed by," meaning every instance of the left concept is also an instance of the right). Together they imply Parent(julia)\mathit{Parent}(\mathit{julia}).[4]

Two standard reasoning tasks are:[4]

  • Subsumption checking: asking whether one concept is always contained in another.
  • Instance checking: asking whether an individual belongs to a concept.

DLs are the core of the representation language of the Semantic Web.[2] The World Wide Web Consortium made the Web Ontology Language (OWL) a standard in 2004, and OWL 2 followed in 2009.[4]

Triples and knowledge graphs

The Resource Description Framework (RDF) breaks knowledge into triples. Each triple has a subject, a predicate, and an object, such as "Bob knows Alice." A set of triples forms a graph, with subjects and objects as nodes and predicates as links between them.[14]

RDF Schema adds classes, subclasses, and limits on what a property can connect. OWL builds on RDF for richer modeling.[14]

Large graphs of this kind are called knowledge graphs. Google's Knowledge Graph, launched in 2012, held more than 500 million objects and more than 3.5 billion facts about them.[15]

RDF triples forming a knowledge graph Bob Alice knows Subject Predicate Object Resource Literal Bob Alice Person "1990-07-04" knows type type birth date Class
In RDF, each triple links a subject to an object through a predicate. Subjects and objects become nodes and predicates become arrows between them; resources (ovals) are things named in the graph, and literals (rectangles) are data values such as text or dates.

Uncertain knowledge

Much real knowledge is uncertain, and KRR has several ways to handle it. In the 1970s, the two main approaches were:[16]

  • MYCIN's certainty factors
  • The inference networks of the PROSPECTOR system

MYCIN's designers also studied Dempster-Shafer theory, a theory of evidence.[3]

Judea Pearl is credited with inventing Bayesian networks, along with the main algorithms for reasoning in them.[16]

A Bayesian network defines a probability model with a directed graph, a graph whose links point one way.[16] Its nodes are random variables, quantities whose values are uncertain.[17] Its links show the direct influences among them.[2]

Pearl's 1988 book Probabilistic Reasoning in Intelligent Systems led many AI researchers to adopt a probabilistic approach.[16]

Comparing the formalisms

Formalism Basic unit Example Typical reasoning
First-order logic Sentence with predicates and quantifiers Penguin(tweety)\mathit{Penguin}(\mathit{tweety}) Logical proof
Semantic network Nodes and labeled links Penguin is-a Bird Inheritance along links
Frame Structure with slots and defaults Birthday-party frame Filling slots, using defaults
Production rule IF-THEN rule MYCIN rule 035 Applying rules from known facts or from a goal
Description logic Concepts, roles, individuals Mother⊑Parent\mathit{Mother} \sqsubseteq \mathit{Parent} Subsumption and instance checking
RDF Subject-predicate-object triple Bob knows Alice Merging and querying graphs
Bayesian network Random variables (uncertain quantities) in a directed graph Disease and symptom Updating probabilities

How reasoning works

Entailment

The central relation in logical KRR is entailment, also called logical consequence:[1]

KB⊨α\mathrm{KB} \models \alpha

This reads "KB entails α\alpha." It means that in any world where all sentences of the KB are true, the sentence α\alpha is also true.[1] Inference is the process of computing entailments, and it is judged by two properties:[1]

  • Sound: every sentence it produces is entailed by the KB.
  • Complete: every sentence the KB entails can be produced.

Forward and backward chaining

Rule-based systems usually reason in one of two directions.

  • Forward chaining starts from known facts, applies rules whose conditions hold, and adds each new conclusion to the known facts.[1]
  • Backward chaining starts from a goal and works back to the facts that would support it.[1]

MYCIN used goal-directed backward chaining. When a rule needed a fact it did not yet know, it set up a subgoal to find that fact, and asked the user only when its rules could not deduce it.[9]

Prolog, the best-known logic programming language, runs depth-first, left-to-right backward chaining over Horn clauses.[1] Depth-first means it fully works on one subgoal, including that subgoal's own subgoals, before it moves on to the next. Left-to-right means it tries the goals in the order they are written.[1]

Forward and backward chaining on the same rules R1: IF penguin THEN bird R2: IF bird THEN has feathers Known fact: Tweety is a penguin Forward chaining (data-driven) Backward chaining (goal-driven) penguin(Tweety) bird(Tweety) has feathers(Tweety) R1 R2 fact derived derived has feathers(Tweety)? bird(Tweety)? penguin(Tweety)? penguin(Tweety) R2: subgoal R1: subgoal check fact known fact, goal proved
Forward and backward chaining applied to the same two rules and one fact. Forward chaining starts from the fact penguin(Tweety)\text{penguin}(\text{Tweety}) and applies R1 and R2 to derive new facts. Backward chaining starts from the goal has feathers(Tweety)?\text{has feathers}(\text{Tweety})? and reduces it to subgoals until one matches a known fact.

Expressiveness and tractability

The tradeoff

Tractability means that reasoning can be done with a practical amount of computation. Hector Levesque and Brachman showed in 1987 that the difficulty of correct reasoning grows greatly as a language's expressive power grows, which creates a tradeoff between expressiveness and computational tractability.[11] They argued that any system that reasons automatically and correctly is either limited in what knowledge it can represent or unlimited in the reasoning effort it might need.[11]

Many formalisms trade some expressive power for reasoning that always ends. Levesque and Brachman used this tradeoff to explain the differences among logic, databases, semantic networks, and frames.[11]

Decidability in different formalisms

First-order logic sits at the expressive end, and no procedure can always decide whether a set of its sentences is consistent. Resolution, a standard proof method, will find a contradiction when one exists, but its search may never end when none exists.[1] See decidability.

Most description logics are decidable, and entailment in the expressive DL behind OWL 2 is decidable under its structural limits.[4] Interpreting all of OWL's features with RDF's own rules of meaning makes reasoning undecidable.[4] OWL 2 therefore has two alternative ways to give its statements meaning:[18]

  • Direct Semantics: matches the description logic SROIQ and applies only to ontologies that meet certain structural limits, called OWL 2 DL ontologies.
  • RDF-Based Semantics: extends the meaning rules of RDF and applies to any OWL 2 ontology, a use called OWL 2 Full.
Trade-off between expressiveness and tractability Databases Description logics most are decidable First-order logic consistency is undecidable more expressive language harder reasoning Correct automatic reasoners are either limited in what they can say or unlimited in the effort they may need (Levesque and Brachman 1987).
Knowledge representation languages range from databases through description logics to first-order logic. A language that can express more makes automatic reasoning harder, and consistency becomes undecidable in first-order logic.

Reasoning with defaults and exceptions

Monotonic and nonmonotonic logic

Classical logic is monotonic. Adding a sentence never removes a conclusion:[12]

if T⊨B then T∪{A}⊨B\text{if } T \models B \text{ then } T \cup \{A\} \models B

Here TT is a set of sentences, and AA and BB are sentences. A nonmonotonic logic lacks this property, so new information can cancel an earlier conclusion.[12]

Everyday reasoning works this way. A plan to get to the airport ignores earthquakes and meteor strikes, and that risk is accepted.[12]

Default rules

A default rule states what normally holds and allows exceptions. A logic program can say that something flies if it is a bird and cannot be shown to be a penguin:[19]

flies←bird, not penguin\mathit{flies} \leftarrow \mathit{bird},\ \mathit{not}\ \mathit{penguin}

Here "not" is default negation. If penguin\mathit{penguin} cannot be proved, "not penguin" is taken to hold.[19] If the system later learns Tweety is a penguin, the conclusion that Tweety flies is withdrawn.

Nonmonotonic reasoning with Tweety the bird Knowledge base Knowledge base bird(Tweety) flies ← bird, not penguin bird(Tweety) flies ← bird, not penguin penguin(Tweety) not-flies ← penguin New information Tweety flies Tweety does not fly Tweety flies Withdrawn Knowledge grows, but a conclusion is lost
Nonmonotonic reasoning: from bird(Tweety)\text{bird}(\text{Tweety}) and the default rule flies←bird,not penguin\text{flies} \leftarrow \text{bird}, \text{not penguin}, the reasoner concludes that Tweety flies. Adding the fact penguin(Tweety)\text{penguin}(\text{Tweety}) makes it withdraw that conclusion and conclude that Tweety does not fly, so the knowledge base grows while a conclusion is lost.

Raymond Reiter's default logic writes a default as

γ:θτ\frac{\gamma : \theta}{\tau}

It means: if γ\gamma is believed and θ\theta is consistent with what is believed (does not contradict it), conclude τ\tau. A set of conclusions drawn consistently from the defaults is called an extension.[19] Answer set programming also handles default rules and exceptions.[2]

The closed-world assumption

The closed-world assumption treats anything not listed in a database as false. A travel agent who finds no direct flight between two cities in a flight database concludes there is none. That conclusion assumes the database is complete.[19]

The frame problem

The frame problem asks how to state, without listing everything, that an action leaves most things unchanged.[12]

McCarthy and Patrick Hayes named and introduced it in 1969.[12] It arose in the situation calculus, which treats a situation as "a complete state of the universe at an instance of time."[2]

Two kinds of solution exist:[12]

  • Monotonic: write explicit axioms for what does not change.
  • Nonmonotonic: assume things stay the same by default. These solutions have been studied widely.

Origins

Three influential papers on nonmonotonic logic appeared in 1980. They were by Drew McDermott and Jon Doyle, by Reiter, and by McCarthy, who introduced circumscription.[12]

Minsky's 1974 frames paper had argued that logical reasoning is not flexible enough to serve as a basis for thinking.[7] McDermott and Doyle, and McCarthy, read that criticism as a challenge to build logics without monotonicity.[12]

Related work on belief revision studies how to change a set of beliefs when new information conflicts with it.[12]

Knowledge level and symbol level

Allen Newell proposed in 1981 that systems can be described at two levels, one for knowledge and one for the data structures that carry it.[20]

The knowledge level

At the knowledge level, above the level of data structures, a system is an agent with goals, actions, and knowledge. Its behavior follows a principle of rationality: it picks actions that reach its goals, given what it knows.[20]

Levesque and Brachman framed their tradeoff at the knowledge level, looking at what a language can say rather than how it is stored.[11]

The symbol level

Representations live one level down, at the symbol level. They are data structures and processes that carry out a body of knowledge.[20]

Newell saw logics as one class of representation among many, but uniquely suited to analyzing knowledge.[20]

History

Year Event
1956 Richard Richens makes the first published use of the term "semantic net"[13]
1958 McCarthy proposes the advice taker, published as "Programs with Common Sense"[2][6]
1966 Quillian combines semantic networks with spreading activation[13]
1969 McCarthy and Hayes introduce the frame problem[12]
1974 Minsky proposes frames[7]
1970s MYCIN encodes medical knowledge as rules with certainty factors[16][9]
1977 Schank and Abelson describe scripts[8]
1979 Brachman builds KL-ONE[13]
1980 Three founding papers on nonmonotonic logic appear[12]
1981 Newell proposes the knowledge level[20]
1984 Work on the Cyc commonsense knowledge base begins[21]
1987 Levesque and Brachman publish the expressiveness and tractability tradeoff[11]
1988 Pearl's book on probabilistic reasoning appears[16]
1989 The first Knowledge Representation conference is held[12]
2004 OWL becomes a W3C standard, followed by OWL 2 in 2009[4]
2012 Google launches its Knowledge Graph[15]

Cyc shows the scale of hand-built knowledge. By 1995, about a person-century of effort had gone into it, giving a schema of roughly 10510^5 general concepts.[21]

Cyc aims at commonsense reasoning, the goal McCarthy set in 1958.[2]

Research areas and current directions

The Handbook of Knowledge Representation (2008) groups progress into three fronts:[2]

  • General methods that apply across domains, such as description logics and nonmonotonic reasoning.
  • Specialized methods for core domains, such as time, space, causation, and action.
  • Applications, such as query answering, planning, and the Semantic Web.

A current question is how KRR relates to machine learning. Learned models usually bear no clear relation to logic, and there is no obvious way to read them at a declarative level, in terms of the facts and rules they stand for.[12]

Large language models store knowledge implicitly and often fail to capture or access facts reliably. Knowledge graphs store facts explicitly but are hard to build and keep current.[22]

One 2023 roadmap proposes three ways to combine the two:[22]

  • Knowledge graphs that improve language models.
  • Language models that help build and complete knowledge graphs.
  • Systems in which both reason together.

Such hybrids are part of neuro-symbolic AI.

References

  1. Knowledge Representation and Reasoning (lecture slides), Hector Levesque, University of Toronto.
  2. Handbook of Knowledge Representation, F. van Harmelen, V. Lifschitz, and B. Porter (eds.), Elsevier, 2008.
  3. Rule-Based Expert Systems: The MYCIN Experiments of the Stanford Heuristic Programming Project, B. G. Buchanan and E. H. Shortliffe (eds.), Addison-Wesley, 1984.
  4. A Description Logic Primer, M. Krötzsch, F. Simančík, and I. Horrocks, arXiv, 2012.
  5. LLM-empowered knowledge graph construction: A survey, arXiv, 2025.
  6. Programs with Common Sense, John McCarthy, Proceedings of the Teddington Conference on the Mechanization of Thought Processes, 1959.
  7. A Framework for Representing Knowledge, Marvin Minsky, MIT Artificial Intelligence Laboratory, 1974.
  8. Representation of Real-World Event Schemas during Narrative Perception, Journal of Neuroscience, 2018.
  9. The Structure of the MYCIN System, William van Melle, in Rule-Based Expert Systems, Addison-Wesley, 1984.
  10. What Is a Knowledge Representation?, R. Davis, H. Shrobe, and P. Szolovits, AI Magazine 14(1), 1993.
  11. Expressiveness and tractability in knowledge representation and reasoning, H. J. Levesque and R. J. Brachman, Computational Intelligence 3, 1987.
  12. Logic-Based Artificial Intelligence, Stanford Encyclopedia of Philosophy.
  13. Semantic Networks, John F. Sowa.
  14. RDF 1.1 Primer, W3C, 2014.
  15. Introducing the Knowledge Graph: things, not strings, Google, 2012.
  16. Judea Pearl, A.M. Turing Award Laureate, Association for Computing Machinery.
  17. Artificial Intelligence: Bayesian Nets, Stanford Encyclopedia of Philosophy.
  18. OWL 2 Web Ontology Language Document Overview (Second Edition), W3C, 2012.
  19. Non-monotonic Logic, Stanford Encyclopedia of Philosophy.
  20. The Knowledge Level, Allen Newell, AI Magazine 2(2), 1981.
  21. CYC: a large-scale investment in knowledge infrastructure, Douglas B. Lenat, Communications of the ACM 38(11), 1995.
  22. Unifying Large Language Models and Knowledge Graphs: A Roadmap, S. Pan et al., arXiv, 2023.

Figure