Topic 2: Knowledge Base Structure

Building the Foundation of Intelligent Reasoning

Back to Lecture 7 Overview

Knowledge Base Components

A knowledge base is more than just a storage system—it's a structured collection of sentences, axioms, and inference rules that enable intelligent reasoning.

Knowledge Base Architecture
Sentences
+
Axioms
+
Inference Rules



Intelligent Reasoning

Sentences: Facts & Rules

Sentences are the basic building blocks of a knowledge base. They represent facts about the world and rules that govern relationships between facts.

Facts (Atomic Sentences):
  • Basic statements about the world
  • Can be true or false
  • Represent specific instances
  • Examples: "It is raining", "John is tall"
Rules (Complex Sentences):
  • If-then relationships
  • General principles
  • Enable inference
  • Examples: "If it rains, then the ground is wet"
Example Sentences:
// Facts
is_bird(tweety)
has_wings(tweety)
is_red(apple1)
is_sweet(apple1)

// Rules
can_fly(X) :- is_bird(X), has_wings(X)
is_fruit(X) :- is_red(X), is_sweet(X)
if can_fly(X) then is_animal(X)

Axioms: Assumed Truths

Axioms are fundamental truths that are assumed to be true without proof. They form the foundation upon which all other knowledge is built.

Logical Axioms:
  • Basic logical principles
  • Always true by definition
  • Example: A ∨ ¬A (law of excluded middle)
Domain Axioms:
  • Specific to the problem domain
  • Assumed to be true
  • Example: "All birds have wings"
Common Sense Axioms:
  • General world knowledge
  • Widely accepted truths
  • Example: "Objects fall when dropped"
Example Axioms:
// Logical Axioms
∀x (P(x) ∨ ¬P(x))                    // Law of excluded middle
∀x (P(x) → P(x))                     // Reflexivity
∀x,y (P(x) ∧ P(y) → P(x) ∧ P(y))    // Conjunction

// Domain Axioms
∀x (bird(x) → has_wings(x))          // All birds have wings
∀x (mammal(x) → warm_blooded(x))     // All mammals are warm-blooded
∀x (fish(x) → lives_in_water(x))     // All fish live in water

Inference Rules: Deriving New Facts

Inference rules specify how to derive new sentences from existing ones. They are the "engine" that powers logical reasoning.

Common Inference Rules:
  • Modus Ponens: P → Q, P ⊢ Q
  • Modus Tollens: P → Q, ¬Q ⊢ ¬P
  • Resolution: P ∨ Q, ¬P ∨ R ⊢ Q ∨ R
  • Conjunction: P, Q ⊢ P ∧ Q
Properties:
  • Soundness: Only derive true conclusions
  • Completeness: Can derive all true conclusions
  • Efficiency: Fast execution
  • Clarity: Easy to understand and verify
Example Inference:
// Given knowledge base:
1. bird(tweety)                    // Fact
2. ∀x (bird(x) → can_fly(x))      // Rule
3. ∀x (can_fly(x) → is_animal(x)) // Rule

// Using Modus Ponens:
4. can_fly(tweety)                 // From 1, 2
5. is_animal(tweety)               // From 4, 3

Syntax and Semantics

Understanding the difference between syntax (structure) and semantics (meaning) is crucial for knowledge representation.

Syntax:

How sentences are formed

  • Symbols and their arrangement
  • Grammar rules
  • Well-formed formulas (WFFs)
  • Mechanical, formal rules
// Syntax: P ∧ Q is well-formed
// Syntax: P ∧ is not well-formed
Semantics:

What sentences mean

  • Truth conditions
  • Interpretation in the world
  • Models and satisfaction
  • Meaning and reference
// Semantics: P ∧ Q is true when
// both P and Q are true
Key Distinction:

Syntax tells us whether a sentence is grammatically correct, while semantics tells us whether it's true or false in a given situation.

Knowledge Level vs Implementation Level

This distinction helps us understand the difference between what we know and how we represent it.

Aspect Knowledge Level Implementation Level
Focus What the agent knows How knowledge is stored
Language Natural language, logic Programming languages, data structures
Concerns Correctness, completeness Efficiency, storage, algorithms
Abstraction High-level concepts Low-level details
Example "All birds can fly" Array of rules, hash table lookup
Changes Add/remove facts Modify data structures
Why This Distinction Matters:
  • Modularity: Can change implementation without changing knowledge
  • Portability: Same knowledge can work on different systems
  • Maintainability: Easier to update and debug
  • Clarity: Separates concerns clearly

Complete Knowledge Base Example

Here's a complete example showing how all components work together:

Animal Classification KB:
// AXIOMS (Fundamental truths)
∀x (bird(x) → has_wings(x))
∀x (mammal(x) → warm_blooded(x))
∀x (fish(x) → lives_in_water(x))

// FACTS (Specific instances)
bird(tweety)
bird(robin)
mammal(whale)
fish(shark)
has_wings(tweety)
warm_blooded(whale)
lives_in_water(shark)

// RULES (Inference patterns)
∀x (bird(x) → can_fly(x))
∀x (can_fly(x) → is_animal(x))
∀x (mammal(x) → is_animal(x))
∀x (fish(x) → is_animal(x))

// INFERENCE RULES
// Modus Ponens: P → Q, P ⊢ Q
// Resolution: P ∨ Q, ¬P ∨ R ⊢ Q ∨ R
Inference Process:
  1. Given: bird(tweety)
  2. Apply axiom: bird(tweety) → has_wings(tweety)
  3. Derive: has_wings(tweety)
  4. Apply rule: bird(tweety) → can_fly(tweety)
  5. Derive: can_fly(tweety)
  6. Apply rule: can_fly(tweety) → is_animal(tweety)
  7. Final result: is_animal(tweety)

Key Takeaways

Knowledge Base Components:
  • Sentences: Facts and rules
  • Axioms: Fundamental truths
  • Inference Rules: Derivation mechanisms
Design Principles:
  • Syntax: Structure and grammar
  • Semantics: Meaning and truth
  • Levels: Knowledge vs implementation
Next Steps:

Now that we understand how knowledge is structured, we'll explore how to derive new information from existing knowledge in Topic 3: Entailment and Inference.

Previous: Knowledge-Based Agents Next: Entailment and Inference