L1Reviewed 2026-07-19

Knowledge representation and logic

Storing facts as symbols and rules—powerful for clarity, brittle for messy reality.

What you'll learn

  • Explain propositional and first-order logic as ways to state facts and rules.
  • Describe inference: deriving new statements from a knowledge base.
  • Compare symbolic KBs with neural retrieval and embeddings (/learn/rag-retrieval-augmented-generation).

Plain English

One classic AI approach writes knowledge as symbols: Rain(wetGround), Parent(x,y) → Ancestor(x,y). If the rules are correct and complete, a machine can answer questions by logical deduction—no training photos required.

This shines in regulated domains where you want auditable reasoning: tax rules, hardware specs, medical eligibility checklists. It struggles when the world is fuzzy, incomplete, or described in everyday language—exactly where modern language models excel.

Today's hybrid systems often store facts in databases or vector indexes (/learn/embeddings) and let an LLM translate questions into queries or cite retrieved passages instead of pure theorem proving.

How it works

A knowledge base (KB) holds sentences in a formal language. Propositional logic uses variables and connectives (AND, OR, NOT, IMPLIES). First-order logic adds quantifiers (∀, ∃) and relations over objects.

Inference algorithms—forward chaining (fire rules until no new facts), backward chaining (goal-driven), resolution—derive entailed sentences. A query is answered if the KB entails it (KB ⊨ q) or if refutation proves ¬q impossible.

Ontologies (structured vocabularies) and semantic web formats (RDF, OWL) standardize concepts across systems. Planning layers in CS188 connect logic to action: what preconditions must hold before an operator applies?

  • Syntax: legal sentences; semantics: what they mean about the world.
  • Entailment: every model satisfying KB also satisfies q.
  • CSPs can be viewed as constraint networks—a bridge to /learn/search-and-planning.
  • Non-monotonic reasoning: defaults and exceptions (birds fly, except penguins).

Going deeper

Pure logic assumes crisp truth. Real sensors and language need probability (/learn/uncertainty-and-bayesian-thinking) or learned representations (/learn/neural-networks). Neuro-symbolic research tries to combine differentiable learning with explicit rules.

For practitioners, RAG (/learn/rag-retrieval-augmented-generation) is the pragmatic cousin: unstructured text in, citations out—less proof, more evidence. History of these swings appears in /learn/history-of-ai.

Common misconceptions

If we encode enough rules, we get human-level AI.
Common-sense coverage, ambiguity, and changing environments break brittle rule sets. Learning fills gaps logic alone cannot.
LLMs replace knowledge bases entirely.
LLMs improvise; KBs and databases anchor facts. Production systems mix both.

Key facts

  • Knowledge representation uses formal languages to store facts and rules.
  • Inference derives entailed conclusions or refutes queries.
  • First-order logic expresses relations and quantified statements.
  • Symbolic systems are interpretable but costly to maintain at scale.
  • Hybrid pipelines pair retrieval or logic with neural language interfaces.

Sources used

These free resources informed this page. ANN writes original explainers; we do not copy course text behind paywalls.

Further learning

Also explore AI companies, Live Feed, and Weekly Brief.