KRR Unit1
KRR Unit1
2024-25
KNOWLEDGE REPRESENTATION AND
REASONING
( R22A6604)
LECTURE NOTES
Department of CSE (Artificial Intelligence and
Machine Learning)
Vision
Mission
• Refers to the information and facts about the world that a system needs to
perform tasks effectively.
• This includes data, rules, concepts, relationships, and general understanding
of the domain or problem.
• Example: Knowing that "water boils at 100°C" or "a car has four wheels."
Representation:
Reasoning:
Components of KR&R:
What is Knowledge?
• Knowledge is when someone (like John) understands and is sure about a fact
or idea (like "Mary will come to the party").
Propositions:
• A proposition is a statement that can be either true or false, like "The sky is
blue" or "Water boils at 100°C."
Propositional Attitudes:
• Verbs like "knows," "hopes," or "doubts" show how someone feels about or
relates to an idea or fact. For example:
o "John knows that Mary will come to the party" means John is sure.
o "John hopes that Mary will come to the party" means John wants it to
happen but isn't sure.
What is Representation?
• Symbols (like words, numbers, or drawings) are used to stand for ideas,
objects, or facts.
• Propositions are the ideas or facts that symbols represent.
o Example: The sentence "The sky is blue" is a proposition because it
represents the idea or fact that the sky has a blue color.
Knowledge Representation:
Definition of Reasoning:
• Understanding Behavior
• Knowledge helps describe the behavior of complex systems (human or
machine) using beliefs, desires, goals, and intentions.
• Intentional Stance
• Describing a system’s behavior in terms of beliefs and intentions is often
more useful than technical details (like algorithms).
• Helps us reason about the system’s actions intuitively rather than focusing
on low-level operations.
Knowledge-Based Systems
Knowledge-Based Systems
• A knowledge-based system uses a Knowledge Base (KB) containing
symbolic structures to represent beliefs and facts.
• Unlike procedural systems, it separates knowledge representation from
execution.
• In the second PROLOG example, the system uses rules and facts (e.g.,
color(snow, white)) to reason and determine outputs.
• Key distinction: A knowledge-based system reasoning relies on stored
knowledge, not just procedures.
• Adaptability: Useful for open-ended tasks where the system can't know all
tasks in advance.
• Easy Extension: Adding new information automatically extends system
behavior and dependencies.
• Error Debugging: Faults can be traced back to incorrect beliefs in the KB,
simplifying troubleshooting.
• Explainability: System behavior is justifiable by linking actions to
represented knowledge (e.g., grass is green because vegetation is green).
• Allows assimilation of new knowledge, like reading facts about geography,
which can be reused across different tasks.
Why Reasoning?
4. Historical Background
Terminology.
Syllogism
SCHOLASTIC LOGIC
Boolean Algebra
• Definition:
A branch of algebra that deals with binary variables and logical operations.
Developed by George Boole in the mid-19th century.
• Basic Operations:
o AND (⋀ or ∧): Intersection/Conjunction.
o OR (⋁ or ∨): Union/Disjunction.
o NOT (¬): Negation.
o XOR: Exclusive OR.
o NOR, NAND, etc.: Combinations of NOT with OR/AND
Frege's Begriffsschrift
Algebraic Notation
• Definition:
A concise method of expressing mathematical expressions, equations, or
logical structures using symbols and variables.
• Types:
o Classical Algebraic Notation: Using x,y,zx, y, zx,y,z, and operators
like +,−,∗,/+, -, *, /+,−,∗,/.
o Logic Algebraic Notation: Boolean operations, predicate logic
(P(x)→Q(x)P(x) → Q(x)P(x)→Q(x)).
o Abstract Algebra Notation: Groups, rings, fields with operations like
(a∗b)−1(a * b)^{-1}(a∗b)−1.
5. Representing Knowledge in Logic
Key Takeaways
1. Propositional Logic: Simplifies complex sentences but loses details.
2. Predicate Logic: Adds details with subjects, predicates, and quantifiers.
3. Ontology: Organizes concepts and relationships specific to a domain.
4. Special Notations: Logic complements, not replaces, domain-specific tools
like music notation.
5. Expressiveness: Logic can represent everything computable but has
limitations when it comes to vague or unquantifiable knowledge.
7. Varieties of logic
Variations in Logic:
Logic systems differ in six key areas:
1. Syntax:
o Syntax refers to the way logic is written.
o Example: Different symbols like "∃" or "exists" may be used, but the meaning
remains the same.
2. Subsets:
o Some logics simplify FOL by limiting features for efficiency.
o Example: Prolog uses a restricted subset of FOL to enhance speed.
3. Proof Theory:
o Variations allow or restrict how proofs are constructed.
o Example: Linear logic ensures every piece of information is used exactly once.
4. Model Theory:
o Adjusts truth values assigned to statements.
o Example: Classical FOL uses "true" or "false," while fuzzy logic uses a range
from 0 (false) to 1 (true).
5. Ontology:
o Adds predefined concepts to logic for specific domains.
o Example: Temporal logics include built-in rules for time.
6. Metalanguage:
o Logic used to describe or modify other languages.
o Example: Context-free grammar is a subset of FOL used to define programming
languages.
Typed Logic:
Typed logic simplifies FOL by labeling variables with types.
(∀x)(trailerTruck(x)⇒eighteenWheeler(x))
Typed logic becomes even more useful with multiple quantifiers, making expressions clearer and
less error-prone.
(∀x:TrailerTruck)(∃s:Set)(s@18∧(∀w∈s)(wheel(w)∧part(x,w)))
This means: "For every trailer truck, there exists a set of 18 wheels, where each wheel is part of
the truck."
the fundamentals of lambda calculus, conceptual graphs, modal logic, and higher-order
logic, illustrating their roles in formal logic and computational systems. Here's a summary of the
key points:
Lambda Calculus
• Purpose: A formal system introduced by Alonzo Church to define and evaluate functions
and relations.
• Key Features:
o Lambda calculus uses λ\lambdaλ to define functions and operations.
o Scenario: You want to define a function that adds 2 to any number.
o Lambda Expression:
o λx.(x+2)
o This means: "A function that takes an input xxx and returns x+2x
o Usage: To add 2 to 3, you apply the function to 3:
o (λx.(x+2))3=3+2=5
o Church-Rosser Theorem: Ensures consistent results regardless of the order of
expansion or contraction of lambda expressions.
• Purpose: Extends first-order logic (FOL) by allowing quantifiers to range over predicates
and relations.
• Applications:
o Representation of meta-properties like the induction axiom in arithmetic.
o Example of second-order logic:
∀P:Predicate(P(0)∧(∀n:Integer)(P(n)⇒P(n+1))⇒∀n:IntegerP(n)).
Comparison of Representations
also
• Lambda calculus and conceptual graphs bridge formal logic and natural language.
• Modal logic handles nuances like necessity, possibility, and temporal reasoning.
• Higher-order logic expands the scope of logical representation by quantifying over
predicates and relations.
• Each formalism is tailored for specific tasks: CGs for human readability, KIF for machine
interchange, and lambda calculus for precise functional representation.
When logic is applied to mathematics, the constants represent numerals, which act as names of
numbers. But in real-world applications, a broader range of data is needed, such as:
Errors often occur in knowledge representation because names, types, and measures are
confused with the things themselves.
Key Concepts
1. Names
Core Idea: Names directly refer to an individual, while types refer to a group or category of
entities.
2. Types
3. Measures
In databases and programming, such distinctions avoid incorrect assumptions about how data is
stored and retrieved.
1. Syllogism Fallacy:
• Syllogism Example:
o Premise 1: Clyde is an elephant (individual)
o Premise 2: "Elephant" is a species (type)
o Incorrect Inference: Therefore, Clyde is a species.
This mistake arises because "Clyde" (a name) and "Elephant" (a type) are mixed up.
2. Database Errors:
Example:
Conclusion
The passage explains how different types of logic have been developed over time. Even with
various notations and approaches, any good logic system must meet four core features. Let's
break down these features with simple terms and examples.
A logic system needs a collection of symbols to represent things. These symbols can be:
• Characters/Words (like A, B, X)
• Icons/Diagrams
• Sounds
• These symbols are divided into four groups:
Simple Example:
If you follow the syntax, you have well-formed, understandable logical sentences.
Example:
4. Rules of Inference ◻
Inference means drawing logical conclusions based on existing information. A good logic
system must have:
1. Sound Inference ◻
2. Non-monotonic Inference ◻◻
• Used in plausible or approximate reasoning but doesn't always preserve strict truth.
Example of Inference:
Sentence Example:
Feature Purpose
Vocabulary For symbols representing entities and actions.
Syntax Grammar to combine symbols into sentences.
Semantics Determines meaning and truthfulness.
Inference Rules for logical reasoning and conclusions.
◻ Applications in Technology
◻ Conclusion
Understanding these foundational features helps computer scientists, AI experts, and logicians
select the right logic system for any application, balancing expressive power, efficiency, and
readability.