Knowledge Representation
and Reasoning
Module 2
Module 2
Propositions
Propositions, in artificial intelligence, are sentences
that are considered to state facts, situations, or
claims about the world to enable the logical
reasoning of the machines.
Translate the English
sentences to propositional
logic and construct a truth
table
Translate the English sentences to propositional
logic and construct a truth table
Translate the English sentences to propositional
logic and construct a truth table
Let,
Patient has Fever F
Patient has Cough C
Patient has Flu L
Propositional Logic:
(F^C)→L
Translate the English sentences to propositional
logic and construct a truth table
(F∧C)→L
F C L F∧C (F ∧ C) → L
T T T T T
T T F T F
T F T F T
T F F F T
F T T F T
F T F F T
F F T F T
F F F F T
Translate the English sentences to propositional
logic and construct a truth table
English Sentence
The patient has a fever
The patient does not have a fever
The patient has fever and cough
The patient has fever or cough
If the patient has fever, then they have an
infection
The patient has fever if and only if they have
an infection
Translate the English sentences to propositional
logic and construct a truth table
Propositional
English Sentence
Logic
The patient has a fever F
The patient does not have a fever ¬F
The patient has fever and cough F∧C
The patient has fever or cough F∨C
If the patient has fever, then they have an
F→I
infection
The patient has fever if and only if they have
F I
an infection
Predicate Logic
First Order Logic
Translate the sentence
into First Order Logic
Sam is tall
John like cricket
Socrates is human
Universal quantifiers
All humans are mortal
All boys like cricket
All girls love jewelry
All doctors have medical degree
Every student in the class submitted the assignment
Every nurse on duty Wears a mask
Every person who buys a policy is smart
Every doctor who treats patient and work in the hospital is experienced
Existential Quantifiers
Some girls hate football
some boys like football
Some student passed the exam
There exist a student who studies maths, attend class and Summit assignment
Some integers are even and some are odd
Some people love coffee and some people love tea
There is a student who does not submit assignment and does not attend class
Not all patient do not follow instruction and do not take medicine
Not all students like both maths and Science
Inference Rules
Inference
Inference is the process in artificial intelligence through which intelligent systems
derive new knowledge or make decisions based on the information that exists. It
enables artificial intelligence agents to reason, solve problems, and learn.
Example : In a spam detection system, inference means analyzing an email and
deciding, whether it is spam or not, according to the patterns of learning.
Key Concepts of Inference in AI
Inference Rules
Modus Ponen
Example
Notation
Solution
Modul Tollens
Example
Notation
Solution
Hypothetical Syllogism
Example
Notation
Solution
And Elimination
Example
Notation
Solution
Conjunction (And Introduction)
Example
Notation
Solution
Or Introduction
Example
Notation
Solution
Double Negation - Elimination
Example
Notation
Solution
Double Negation - Introduction
Example
Notation
Solution
Unit Resolution
Example
Notation
Solution
Rule Based System
Rule-Based System in AI
Rule-based systems, a foundational technology in artificial
intelligence (AI), have long been instrumental in decision-making
and problem-solving across various domains. These systems
operate on a set of predefined rules and logic to make decisions,
perform tasks, or derive conclusions
Example of a Rule-Based System in Action
Consider a simplified example of a rule-based system used in
a customer service chatbot:
Rule 1: If the customer asks about their account balance,
then retrieve and display the current balance.
Rule 2: If the customer asks about recent transactions, then
retrieve and display the last five transactions.
Rule 3: If the customer asks to speak to a human agent,
then transfer the chat to a human operator.
When a customer interacts with the chatbot, the inference
engine matches their query with the appropriate rule and
executes the corresponding action.
Components of a Rule-Based System
Rules: The core of the system, these are conditional statements that
define the system's behavior. A rule generally follows the format "IF
condition THEN action." For example, in an expert system for medical
diagnosis, a rule might be "IF patient has fever AND cough THEN consider
flu."
Knowledge Base: This is the repository where all the rules and facts are
stored. The knowledge base is built from domain-specific knowledge and
can be manually curated or derived from expert input.
Inference Engine: The inference engine is the component that applies the
rules to the knowledge base to derive conclusions or make decisions. It
interprets the rules, processes them against the current facts or data, and
determines the appropriate actions or outputs.
Working Memory: This is a dynamic component that holds the current facts
or data being processed by the system. It is updated as the inference
engine applies rules and new information becomes available.
User Interface: In many rule-based systems, the user interface allows users
to interact with the system, input data, and receive outputs or
recommendations.
How Rule-Based Systems Work?
Data Input: The system receives input data from the user or another source.
This data can range from simple numerical values to complex information
like patient symptoms or transaction records.
Rule Matching: The inference engine examines the input data against the
rules stored in the knowledge base. It looks for rules whose conditions match
the input data.
Rule Execution: Once a rule is matched, the inference engine executes the
corresponding action. This might involve updating the working memory,
deriving new facts, or generating an output.
Conflict Resolution: In cases where multiple rules are triggered
simultaneously, the inference engine uses conflict resolution strategies to
determine which rule to apply first. Common strategies include prioritizing
rules based on specificity or order of entry.
Output Generation: The system generates an output based on the executed
rules. This output can be a decision, recommendation, or another form of
response. For example, in a medical diagnosis system, the output might be a
suggested treatment plan.
Example
Step Medical Diagnosis System Banking Fraud Detection System
User enters symptoms: – Transaction details received: –
Data Input Fever: Yes – Cough: Yes Amount: $5000
Fatigue: Yes Location: Foreign country
Rules matched: –
Rules matched: –
IF large transaction AND overseas
Rule IF fever AND cough → possible flu –
location → possible fraud –
Matching IF fever AND fatigue → possible
IF transaction outside normal pattern
mono
→ possible fraud
Both rules add possible diagnoses
Rule Flag transaction as suspicious Update
(flu, mono) to working memory
Execution account risk status
May ask follow-up questions
Prioritize flu (common condition)
Conflict Combine risk scores or prioritize rule
or based on more specific
Resolution with higher risk factor
symptom (cough)
Suggested diagnosis: Flu
Output Alert: Suspicious transaction detected
Recommendation: Rest, fluids, see
Generation Action: Freeze account, notify user
doctor if worse
Semantic Network
Types of Semantic Networks
Types of Semantic Networks
Types of Semantic Networks
Frames in AI
Frames in AI
Frames are data structures used in AI to represent stereotypical situations or
scenarios.
They encapsulate information about objects, events, and their interrelationships
within a particular context.
Each frame consists of a set of attributes and values, forming a template for
understanding specific situations.
Key Components of Frames
Key Components of Frames
Forward and Backward Chaining
Properties: