This document discusses knowledge representation in artificial intelligence. It covers various techniques for knowledge representation including logical representation using propositional logic and first-order predicate logic, semantic network representation, frame representation, and production rules. It also discusses issues in knowledge representation such as representing important attributes, relationships, and granularity of knowledge. Propositional logic is introduced as the simplest form of logic where statements are represented by propositions that can be either true or false. The syntax and semantics of propositional logic are also covered.
Uncertain Knowledge and Reasoning in Artificial IntelligenceExperfy
Learn how to take informed decisions based on probabilities and expert knowledge
Understand and explore one of the most exciting advances in AI in the last decades.
Many hands-on examples, including Python code.
Check it out: https://www.experfy.com/training/courses/uncertain-knowledge-and-reasoning-in-artificial-intelligence
We consider knowledge as a refined kind of information, more general than that found in convention databases. But it may be incomplete or fuzzy as well. We may think of knowledge as a collection of related facts, procedures, models and heuristics that can be used in problem solving or inference systems.[
Artificial Intelligence (AI) | Prepositional logic (PL)and first order predic...Ashish Duggal
The following are the topics in this presentation Prepositional Logic (PL) and First-order Predicate Logic (FOPL) is used for knowledge representation in artificial intelligence (AI).
There are also sub-topics in this presentation like logical connective, atomic sentence, complex sentence, and quantifiers.
This PPT is very helpful for Computer science and Computer Engineer
(B.C.A., M.C.A., B.TECH. , M.TECH.)
Knowledge representation and Predicate logicAmey Kerkar
This presentation is specifically designed for the in depth coverage of predicate logic and the inference mechanism :resolution algorithm.
feel free to write to me at : amecop47@gmail.com
Knowledge representation In Artificial IntelligenceRamla Sheikh
facts, information, and skills acquired through experience or education; the theoretical or practical understanding of a subject.
Knowledge = information + rules
EXAMPLE
Doctors, managers.
The Foundations of Artificial Intelligence, The History of
Artificial Intelligence, and the State of the Art. Intelligent Agents: Introduction, How Agents
should Act, Structure of Intelligent Agents, Environments. Solving Problems by Searching:
problem-solving Agents, Formulating problems, Example problems, and searching for Solutions,
Search Strategies, Avoiding Repeated States, and Constraint Satisfaction Search. Informed
Search Methods: Best-First Search, Heuristic Functions, Memory Bounded Search, and Iterative
Improvement Algorithms.
Uncertain Knowledge and Reasoning in Artificial IntelligenceExperfy
Learn how to take informed decisions based on probabilities and expert knowledge
Understand and explore one of the most exciting advances in AI in the last decades.
Many hands-on examples, including Python code.
Check it out: https://www.experfy.com/training/courses/uncertain-knowledge-and-reasoning-in-artificial-intelligence
We consider knowledge as a refined kind of information, more general than that found in convention databases. But it may be incomplete or fuzzy as well. We may think of knowledge as a collection of related facts, procedures, models and heuristics that can be used in problem solving or inference systems.[
Artificial Intelligence (AI) | Prepositional logic (PL)and first order predic...Ashish Duggal
The following are the topics in this presentation Prepositional Logic (PL) and First-order Predicate Logic (FOPL) is used for knowledge representation in artificial intelligence (AI).
There are also sub-topics in this presentation like logical connective, atomic sentence, complex sentence, and quantifiers.
This PPT is very helpful for Computer science and Computer Engineer
(B.C.A., M.C.A., B.TECH. , M.TECH.)
Knowledge representation and Predicate logicAmey Kerkar
This presentation is specifically designed for the in depth coverage of predicate logic and the inference mechanism :resolution algorithm.
feel free to write to me at : amecop47@gmail.com
Knowledge representation In Artificial IntelligenceRamla Sheikh
facts, information, and skills acquired through experience or education; the theoretical or practical understanding of a subject.
Knowledge = information + rules
EXAMPLE
Doctors, managers.
The Foundations of Artificial Intelligence, The History of
Artificial Intelligence, and the State of the Art. Intelligent Agents: Introduction, How Agents
should Act, Structure of Intelligent Agents, Environments. Solving Problems by Searching:
problem-solving Agents, Formulating problems, Example problems, and searching for Solutions,
Search Strategies, Avoiding Repeated States, and Constraint Satisfaction Search. Informed
Search Methods: Best-First Search, Heuristic Functions, Memory Bounded Search, and Iterative
Improvement Algorithms.
1.0 Introduction
1.1 Objectives
1.2 Some Simple Definition of A.I.
1.3 Definition by Eliane Rich
1.4 Definition by Buchanin and Shortliffe
1.5 Another Definition by Elaine Rich
1.6 Definition by Barr and Feigenbaum
1.7 Definition by Shalkoff
1.8 Summary
1.9 Further Readings/References
6. kr paper journal nov 11, 2017 (edit a)IAESIJEECS
Knowledge Representation (KR) is a fascinating field across several areas of cognitive science and computer science. It is very hard to identify the requirement of a combination of many techniques and inference mechanism to achieve the accuracy for the problem domain. This research attempted to examine those techniques, and to apply them to implement a Cognitive Hybrid Sentence Modeling and Analyzer. The purpose of developing this system is to facilitate people who face the problem of using English language in daily life.
Knowledge Based Reasoning: Agents, Facets of Knowledge. Logic and Inferences: Formal Logic,
Propositional and First Order Logic, Resolution in Propositional and First Order Logic, Deductive
Retrieval, Backward Chaining, Second order Logic. Knowledge Representation: Conceptual
Dependency, Frames, Semantic nets.
Knowledge Based Reasoning: Agents, Facets of Knowledge. Logic and Inferences: Formal Logic,
Propositional and First Order Logic, Resolution in Propositional and First Order Logic, Deductive
Retrieval, Backward Chaining, Second order Logic. Knowledge Representation: Conceptual
Dependency, Frames, Semantic nets.
Chap.3 Knowledge Representation Issues Chap.4 Inference in First Order LogicKhushali Kathiriya
Knowledge–based agents,
The Wumpus world Logic,
Propositional logic,
Propositional theorem proving
Effective propositional model checking,
Agents based on propositional logic,
First Order Logic,
Forward Chaining/ Resolution,
Backward Chaining/ Resolution,
Unification Algorithm, Resolution,
Clausal Normal Form (CNF)
Segmentation
Active Contours
Split and Merge
Watershed
Region Splitting and Merging
Graph-based Segmentation
Mean shift and Model finding
Normalized Cut
Features Detection
Edge Detection
Corner Detection
Line and Curve Detection
Active Contours
SIFT and HOG Descriptors
Shape Context Descriptors
Morphological Operations
Pixel transforms,
Color transforms,
Histogram processing & equalization ,
Filtering,
Convolution,
Fourier transformation and its applications in sharpening,
Blurring and noise removal
Saudi Arabia stands as a titan in the global energy landscape, renowned for its abundant oil and gas resources. It's the largest exporter of petroleum and holds some of the world's most significant reserves. Let's delve into the top 10 oil and gas projects shaping Saudi Arabia's energy future in 2024.
Welcome to WIPAC Monthly the magazine brought to you by the LinkedIn Group Water Industry Process Automation & Control.
In this month's edition, along with this month's industry news to celebrate the 13 years since the group was created we have articles including
A case study of the used of Advanced Process Control at the Wastewater Treatment works at Lleida in Spain
A look back on an article on smart wastewater networks in order to see how the industry has measured up in the interim around the adoption of Digital Transformation in the Water Industry.
About
Indigenized remote control interface card suitable for MAFI system CCR equipment. Compatible for IDM8000 CCR. Backplane mounted serial and TCP/Ethernet communication module for CCR remote access. IDM 8000 CCR remote control on serial and TCP protocol.
• Remote control: Parallel or serial interface.
• Compatible with MAFI CCR system.
• Compatible with IDM8000 CCR.
• Compatible with Backplane mount serial communication.
• Compatible with commercial and Defence aviation CCR system.
• Remote control system for accessing CCR and allied system over serial or TCP.
• Indigenized local Support/presence in India.
• Easy in configuration using DIP switches.
Technical Specifications
Indigenized remote control interface card suitable for MAFI system CCR equipment. Compatible for IDM8000 CCR. Backplane mounted serial and TCP/Ethernet communication module for CCR remote access. IDM 8000 CCR remote control on serial and TCP protocol.
Key Features
Indigenized remote control interface card suitable for MAFI system CCR equipment. Compatible for IDM8000 CCR. Backplane mounted serial and TCP/Ethernet communication module for CCR remote access. IDM 8000 CCR remote control on serial and TCP protocol.
• Remote control: Parallel or serial interface
• Compatible with MAFI CCR system
• Copatiable with IDM8000 CCR
• Compatible with Backplane mount serial communication.
• Compatible with commercial and Defence aviation CCR system.
• Remote control system for accessing CCR and allied system over serial or TCP.
• Indigenized local Support/presence in India.
Application
• Remote control: Parallel or serial interface.
• Compatible with MAFI CCR system.
• Compatible with IDM8000 CCR.
• Compatible with Backplane mount serial communication.
• Compatible with commercial and Defence aviation CCR system.
• Remote control system for accessing CCR and allied system over serial or TCP.
• Indigenized local Support/presence in India.
• Easy in configuration using DIP switches.
Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)MdTanvirMahtab2
This presentation is about the working procedure of Shahjalal Fertilizer Company Limited (SFCL). A Govt. owned Company of Bangladesh Chemical Industries Corporation under Ministry of Industries.
Cosmetic shop management system project report.pdfKamal Acharya
Buying new cosmetic products is difficult. It can even be scary for those who have sensitive skin and are prone to skin trouble. The information needed to alleviate this problem is on the back of each product, but it's thought to interpret those ingredient lists unless you have a background in chemistry.
Instead of buying and hoping for the best, we can use data science to help us predict which products may be good fits for us. It includes various function programs to do the above mentioned tasks.
Data file handling has been effectively used in the program.
The automated cosmetic shop management system should deal with the automation of general workflow and administration process of the shop. The main processes of the system focus on customer's request where the system is able to search the most appropriate products and deliver it to the customers. It should help the employees to quickly identify the list of cosmetic product that have reached the minimum quantity and also keep a track of expired date for each cosmetic product. It should help the employees to find the rack number in which the product is placed.It is also Faster and more efficient way.
Explore the innovative world of trenchless pipe repair with our comprehensive guide, "The Benefits and Techniques of Trenchless Pipe Repair." This document delves into the modern methods of repairing underground pipes without the need for extensive excavation, highlighting the numerous advantages and the latest techniques used in the industry.
Learn about the cost savings, reduced environmental impact, and minimal disruption associated with trenchless technology. Discover detailed explanations of popular techniques such as pipe bursting, cured-in-place pipe (CIPP) lining, and directional drilling. Understand how these methods can be applied to various types of infrastructure, from residential plumbing to large-scale municipal systems.
Ideal for homeowners, contractors, engineers, and anyone interested in modern plumbing solutions, this guide provides valuable insights into why trenchless pipe repair is becoming the preferred choice for pipe rehabilitation. Stay informed about the latest advancements and best practices in the field.
Student information management system project report ii.pdfKamal Acharya
Our project explains about the student management. This project mainly explains the various actions related to student details. This project shows some ease in adding, editing and deleting the student details. It also provides a less time consuming process for viewing, adding, editing and deleting the marks of the students.
4. Outline for 6th semester
Logical Agents:
Knowledge–based agents
The Wumpus world
Logic
Propositional logic
Propositional theorem proving
Effective propositional model checking
Agents based on propositional logic
First Order Logic:
Representation Revisited
Syntax and Semantics of First Order logic
Using First Order logic
Prepared by: Prof. Khushali B Kathiriya
4
5. What is Knowledge?
Knowledge is a general term. Knowledge is a progression that starts with
data which is of limited utility.
By organizing or analyzing the data, we understand what the data means
and this becomes information.
The interpretation or evaluation of information yield knowledge.
An understanding of the principles embodied within the knowledge is
wisdom.
Prepared by: Prof. Khushali B Kathiriya
5
7. What is Knowledge representation ?
Humans are best at understanding, reasoning, and interpreting knowledge.
Human knows things, which is knowledge and as per their knowledge they
perform various actions in the real world. But how machines do all these
things comes under knowledge representation and reasoning.
Prepared by: Prof. Khushali B Kathiriya
7
8. What is Knowledge representation ?
(Cont.)
Hence we can describe Knowledge representation as following:
1. Knowledge representation and reasoning (KR, KRR) is the part of Artificial
intelligence which concerned with AI agents thinking and how thinking
contributes to intelligent behavior of agents.
2. It is responsible for representing information about the real world so that a
computer can understand and can utilize this knowledge to solve the complex
real world problems such as diagnosis a medical condition or communicating
with humans in natural language.
3. It is also a way which describes how we can represent knowledge in artificial
intelligence. Knowledge representation is not just storing data into some
database, but it also enables an intelligent machine to learn from that
knowledge and experiences so that it can behave intelligently like a human.
Prepared by: Prof. Khushali B Kathiriya
8
9. What to represent?
Object: All the facts about objects in our world domain. E.g., Guitars
contains strings, trumpets are brass instruments.
Events: Events are the actions which occur in our world.
Performance: It describe behavior which involves knowledge about how to
do things.
Meta-knowledge: It is knowledge about what we know.
Facts: Facts are the truths about the real world and what we represent.
Knowledge-Base: The central component of the knowledge-based agents
is the knowledge base. It is represented as KB. The Knowledgebase is a
group of the Sentences (Here, sentences are used as a technical term and
not identical with the English language).
Knowledge: Knowledge is awareness or familiarity gained by experiences
of facts, data, and situations.
Prepared by: Prof. Khushali B Kathiriya
9
12. Knowledge-Based Agent in AI
An intelligent agent needs knowledge about the real world for
taking decisions and reasoning to act efficiently.
Knowledge-based agents are those agents who have the
capability of maintaining an internal state of knowledge, reason
over that knowledge, update their knowledge after observations
and take actions. These agents can represent the world with some
formal representation and act intelligently.
Knowledge-based agents are composed of two main parts:
1. Knowledge-base and
2. Inference system.
Prepared by: Prof. Khushali B Kathiriya
12
13. The architecture of knowledge-based
agent
Prepared by: Prof. Khushali B Kathiriya
13
14. The architecture of knowledge-based
agent (Cont.)
The diagram is representing a generalized architecture for a knowledge-
based agent. The knowledge-based agent (KBA) take input from the
environment by perceiving the environment. The input is taken by the
inference engine of the agent and which also communicate with KB to
decide as per the knowledge store in KB. The learning element of KBA
regularly updates the KB by learning new knowledge.
Prepared by: Prof. Khushali B Kathiriya
14
15. Why use knowledge base?
Knowledge base: Knowledge-base is a central component of a
knowledge-based agent, it is also known as KB. It is a collection of
sentences (here 'sentence' is a technical term and it is not identical to
sentence in English). These sentences are expressed in a language which is
called a knowledge representation language. The Knowledge-base of KBA
stores fact about the world.
Knowledge-base is required for updating knowledge for an agent to learn
with experiences and take action as per the knowledge.
Prepared by: Prof. Khushali B Kathiriya
15
16. Inference System
Inference means deriving new sentences from old. Inference system
allows us to add a new sentence to the knowledge base. A
sentence is a proposition about the world. Inference system applies
logical rules to the KB to deduce new information.
Inference system generates new facts so that an agent can update
the KB. An inference system works mainly in two rules which are
given as:
1. Forward chaining
2. Backward chaining
Prepared by: Prof. Khushali B Kathiriya
16
18. Techniques/ Approaches of Knowledge
Representation
Knowledge can be represented using the following
approaches/techniques:
Prepared by: Prof. Khushali B Kathiriya
18
20. 1. Logical Representation
Logical representation is a language with some concrete rules which
deals with propositions and has no ambiguity in representation. Logical
representation means drawing a conclusion based on various
conditions.
This representation lays down some important communication rules. It
consists of precisely defined syntax and semantics which supports the
sound inference. Each sentence can be translated into logics using
syntax and semantics.
Logical representation can be categorized into:
1. Propositional Logic
2. First Order Predicate Logic
3. Higher order Predicate Logic
4. Fuzzy Logic
Prepared by: Prof. Khushali B Kathiriya
20
21. 1. Logical Representation (Cont.)
1. Propositional Logics:
All propositions either true/false (1/0).
We can not identify relation between 2 sentences.
For example…..
Prepared by: Prof. Khushali B Kathiriya
21
Sentences Truth value Proposition value
Sky is blue True True
Roses are red True True
2+2=5 False True
22. 1. Logical Representation (Cont.)
2. First Order Predicated Logic:
These are much more expressive and make use of variables, constants,
predicates, functions and quantifiers along with the connective explained
already in previous section.
Prepared by: Prof. Khushali B Kathiriya
22
23. 1. Logical Representation (Cont.)
Advantages of logical representation Disadvantages of logical representation
Logical representation enables us to
do logical reasoning.
Logical representations have some
restrictions and are challenging to work
with.
Logical representation is the basis for
the programming languages.
Logical representation technique may
not be very natural, and inference may
not be so efficient.
Prepared by: Prof. Khushali B Kathiriya
23
25. 2. Semantic net representation
Semantic networks are alternative of predicate logic for knowledge
representation. In Semantic networks, we can represent our knowledge in
the form of graphical networks. This network consists of nodes representing
objects and arcs which describe the relationship between those objects.
Semantic networks can categorize the object in different forms and can
also link those objects. Semantic networks are easy to understand and can
be easily extended.
Prepared by: Prof. Khushali B Kathiriya
25
26. 2. Semantic net representation (Cont.)
Following are some statements which we need to represent in the form of
nodes and arcs.
1. Jerry is a cat.
2. Jerry is a mammal
3. Jerry is owned by Priya.
4. Jerry is brown colored.
5. All Mammals are animal.
Prepared by: Prof. Khushali B Kathiriya
26
27. 2. Semantic net representation (Cont.)
Drawbacks in Semantic representation:
1. Semantic networks take more computational time at runtime as we need to
traverse the complete network tree to answer some questions. It might be
possible in the worst case scenario that after traversing the entire tree, we
find that the solution does not exist in this network.
2. Semantic networks try to model human-like memory (Which has 1015
neurons and links) to store the information, but in practice, it is not possible
to build such a vast semantic network.
3. These types of representations are inadequate as they do not have any
equivalent quantifier, e.g., for all, for some, none, etc.
4. Semantic networks do not have any standard definition for the link names.
5. These networks are not intelligent and depend on the creator of the system.
Prepared by: Prof. Khushali B Kathiriya
27
28. 2. Semantic net representation (Cont.)
Advantages of Semantic network:
1. Semantic networks are a natural representation of knowledge.
2. Semantic networks convey meaning in a transparent manner.
3. These networks are simple and easily understandable.
Prepared by: Prof. Khushali B Kathiriya
28
29. 2. Semantic net representation (Cont.)
Represent following sentences using semantic networks.
Isa(person, mammal)
Instance(Mike-Hall, person)
Team(Mike-Hall, Cardiff)
Prepared by: Prof. Khushali B Kathiriya
29
30. 2. Semantic net representation (Cont.)
Prepared by: Prof. Khushali B Kathiriya
30
32. 3. Frame Representation
This concept was introduced by Marvin Minsky in 1975. they are mostly used
when the task becomes quite complex and needs more structured
representation.
More structured the system becomes more would be the requirement of
using frames which would prove beneficial. Generally frames are record
like structures that consists of a collection of slots or attributes and the
corresponding slot values.
Slots can be of any size and type. The slots have names and values called
as facts. Facets can have names or numbers too. A simple frame is shown
in fig for person ram.
Prepared by: Prof. Khushali B Kathiriya
32
33. 3. Frame Representation (Cont.)
Prepared by: Prof. Khushali B Kathiriya
33
Ram Brothers Laxman Cat
Bharat
Grey
Color
34. 3. Frame Representation (Cont.)
Sr. No. Slot Value
1 Ram -
2 Profession Professor
3 Age 50
4 Wife Sita
5 Children Luv Kush
6 Address 4C gb Road
7 City Banaras
8 State UP
9 Zip 400615
Prepared by: Prof. Khushali B Kathiriya
34
35. 3. Frame Representation (Cont.)
Advantages of frame representation:
1. The frame knowledge representation makes the programming easier by
grouping the related data.
2. The frame representation is comparably flexible and used by many
applications in AI.
3. It is very easy to add slots for new attribute and relations.
4. It is easy to include default data and to search for missing values.
5. Frame representation is easy to understand and visualize.
Prepared by: Prof. Khushali B Kathiriya
35
36. 3. Frame Representation (Cont.)
Disadvantages of frame representation:
1. In frame system inference mechanism is not be easily processed.
2. Inference mechanism cannot be smoothly proceeded by frame
representation.
3. Frame representation has a much generalized approach.
Prepared by: Prof. Khushali B Kathiriya
36
37. 4. Production Rules
Production rules system consist of (condition, action) pairs which
mean, "If condition then action". It has mainly three parts:
The set of production rules
Working Memory
The recognize-act-cycle
Prepared by: Prof. Khushali B Kathiriya
37
38. 4. Production Rules (Cont.)
Example:
IF (at bus stop AND bus arrives) THEN action (get into the bus)
IF (on the bus AND paid AND empty seat) THEN action (sit down).
IF (on bus AND unpaid) THEN action (pay charges).
IF (bus arrives at destination) THEN action (get down from the bus).
Prepared by: Prof. Khushali B Kathiriya
38
39. 4. Production Rules (Cont.)
Advantages of Production rule:
1. The production rules are expressed in natural language.
2. The production rules are highly modular, so we can easily remove, add
or modify an individual rule.
Disadvantages of Production rule:
1. Production rule system does not exhibit any learning capabilities, as it
does not store the result of the problem for the future uses.
2. During the execution of the program, many rules may be active hence
rule-based production systems are inefficient.
Prepared by: Prof. Khushali B Kathiriya
39
41. Issues in Knowledge Representation
Important Attributes:
There can be attributes that occur in many different types of problem with
different names.
For example, instance and isa and each is important because each supports
property inheritance.
Relationships:
The relationships, such as, inverses, existence; among various attributes of an
object need to be represented without any ambiguity.
For example, band(John, NewYork City)
Prepared by: Prof. Khushali B Kathiriya
41
42. Issues in Knowledge Representation
(Cont.)
Granularity:
This represents at what level should the knowledge be represented and what are
primitives. Choosing the granularity of representation primitives are fundamental
concepts such as holding, seeing, playing and as English is a very rich language
with over half a million words to choose as our primitives in a series of situations.
For example, if Tom feeds a dog then it could become: feeds(tom,dog)
If tom gives the dog a bone like: gives(tom,dog,bone) are these the same?
Prepared by: Prof. Khushali B Kathiriya
42
44. Propositional Logic
Propositional logic (PL) is the simplest form of logic where all the
statements are made by propositions. A proposition is a declarative
statement which is either true or false. It is a technique of
knowledge representation in logical and mathematical form.
Example:
It is Sunday. T
The Sun rises from West . F
3+3= 7. F
Some students are intelligent. T/F both
Prepared by: Prof. Khushali B Kathiriya
44
PL
Semantic
Syntax
45. Propositional Logic (Cont.)
Following are some basic facts about propositional logic:
Propositional logic is also called Boolean logic as it works on 0 and 1.
In propositional logic, we use symbolic variables to represent the logic,
and we can use any symbol for a representing a proposition, such A, B,
C, P, Q, R, etc.
Propositions can be either true or false, but it cannot be both.
Propositional logic consists of an object, relations or function,
and logical connectives.
These connectives are also called logical operators.
Prepared by: Prof. Khushali B Kathiriya
45
PL
Complex
Atomic
46. Syntax in Propositional Logic (Cont.)
Rules for conjunction: NEGATIVE operator
A sentence such as ¬ P is called negation of P. A literal can be
either Positive literal or negative literal.
Example,
P= Today is Sunday.
1 is represent as a true
0 is represent as a false
Prepared by: Prof. Khushali B Kathiriya
47
P ¬ P
1 0
0 1
47. Syntax in Propositional Logic (Cont.)
Rules for conjunction: AND operator
A sentence which has ∧ connective such as, P ∧ Q is called a
conjunction.
Example: Rohan is intelligent and hardworking.
It can be written as,
P= Rohan is intelligent.
Q= Rohan is hardworking.
So we can write it as P ∧ Q.
Prepared by: Prof. Khushali B Kathiriya
48
P Q P ^ Q
1 1 1
1 0 0
0 1 0
0 0 0
48. Syntax in Propositional Logic (Cont.)
Rules for Disjunction: OR operator
A sentence which has ∨ connective, such as P ∨ Q. is called
disjunction, where P and Q are the propositions.
Example: "Ritika is a doctor or Engineer",
It can be written as,
P= Ritika is Doctor.
Q= Ritika is Engineer,
So we can write it as P ∨ Q.
Prepared by: Prof. Khushali B Kathiriya
49
P Q P v Q
1 1 1
1 0 1
0 1 1
0 0 0
49. Syntax in Propositional Logic (Cont.)
Rules for conjunction: CONDITIONAL
A sentence such as P → Q, is called an implication. Implications
are also known as if-then rules.
Example: If it is raining, then the street is wet.
Let P= It is raining,
Q= Street is wet,
so it is represented as P → Q
Prepared by: Prof. Khushali B Kathiriya
50
P Q P → Q
1 1 1
1 0 0
0 1 1
0 0 1
50. Syntax in Propositional Logic (Cont.)
Rules for conjunction: BICONDITIONAL
A sentence such as P⇔ Q is a BiConditional sentence,
Example: If I am breathing, then I am alive
P= I am breathing
Q= I am alive
It can be represented as P ⇔ Q.
Prepared by: Prof. Khushali B Kathiriya
51
P Q P ⇔ Q
1 1 1
1 0 0
0 1 0
0 0 1
53. Properties of Operators
Commutatively
P∧ Q= Q ∧ P, or
P ∨ Q = Q ∨ P.
Associativity
(P ∧ Q) ∧ R= P ∧ (Q ∧ R),
(P ∨ Q) ∨ R= P ∨ (Q ∨ R)
Identity element
P ∧ True = P,
P ∨ True= True.
Prepared by: Prof. Khushali B Kathiriya
54
Distributive
P∧ (Q ∨ R) = (P ∧ Q) ∨ (P ∧ R).
P ∨ (Q ∧ R) = (P ∨ Q) ∧ (P ∨ R).
DE Morgan's Law
¬ (P ∧ Q) = (¬P) ∨ (¬Q)
¬ (P ∨ Q) = (¬ P) ∧ (¬Q).
Double-negation elimination
¬ (¬P) = P.
54. What is Propositional Logic?
A ^ B and B ^ A should have same meaning but in natural language words
and sentences may have different meaning
Example,
1. Radha started feeling feverish and Radha went to the doctor.
2. Radha went to doctor and Radha stared feeling feverish.
Here, sentence 1 and sentence 2 have different meaning
In AI propositional logic is a relation between the truth value of one
statement to that of the truth table of other statement.
Prepared by: Prof. Khushali B Kathiriya
55
55. Example of Propositional Logic
1. ¬(P ^ Q) , P → ¬Q
Prepared by: Prof. Khushali B Kathiriya
56
P Q ¬Q (P ^ Q) ¬(P ^ Q) P → ¬Q
1 1 0 1 0 0
1 0 1 0 1 1
0 1 0 0 1 1
0 0 1 0 1 1
P Q IF P → Q
1 1 1
1 0 0
0 1 1
0 0 1
P Q IF P ^ Q
1 1 1
1 0 0
0 1 0
0 0 0
P Q IF P v Q
1 1 1
1 0 1
0 1 1
0 0 0
56. Example of Propositional Logic (Cont.)
2. ¬P v ¬Q v R , Q v R, P→R
Prepared by: Prof. Khushali B Kathiriya
57
P Q R ¬P ¬Q ¬P v ¬Q v R (Q v R) P → R
0 0 0 1 1 1 0 1
0 0 1 1 1 1 1 1
0 1 0 1 0 1 1 1
0 1 1 1 0 1 1 1
1 0 0 0 1 1 0 0
1 0 1 0 1 1 1 1
1 1 0 0 0 0 1 0
1 1 1 0 0 1 1 1
57. Example of Propositional Logic (Cont.)
3. (P v Q) v ~(P v (Q ^ R))=1
Prepared by: Prof. Khushali B Kathiriya
58
P Q R P v Q Q ^ R P v (Q ^ R) ~(P v (Q ^ R)) (P v Q) v ~(P v (Q ^ R))
0 0 0 0 0 0 1 1
0 0 1 0 0 0 1 1
0 1 0 1 0 0 1 1
0 1 1 1 1 1 0 1
1 0 0 1 0 1 0 1
1 0 1 1 0 1 0 1
1 1 0 1 0 1 0 1
1 1 1 1 1 1 0 1
60. Example of Propositional Logic (Cont.)
Try out your self:
1. (P ⇔ (Q→ R)) ⇔ ((P ⇔ Q)→ R)
2. ((P ⇔ Q) ^ (~ Q → R)) ⇔ (~ (P ⇔ R) → Q)
Prepared by: Prof. Khushali B Kathiriya
61
61. Limitation of Propositional Logic
We cannot represent relations like ALL, some, or none with
propositional logic.
Example:
All the girls are cute.
Some apples are sweet.
Few students are intelligent.
Propositional logic has limited expressive power.
In propositional logic, we cannot describe statements in terms of
their properties or logical relationships.
Prepared by: Prof. Khushali B Kathiriya
62
63. Inference Rules
Inference:
In artificial intelligence, we need intelligent computers which can
create new logic from old logic or by evidence, so generating the
conclusions from evidence and facts is termed as Inference.
Inference Rule:
Inference rules are the templates for generating valid arguments.
Inference rules are applied to derive proofs in artificial intelligence, and
the proof is a sequence of the conclusion that leads to the desired
goal.
In inference rules, the implication among all the connectives plays an
important role.
Prepared by: Prof. Khushali B Kathiriya
64
64. Inference Rules (Cont.)
1. Modus Ponens
2. Modus Tollens
3. Hypothetical Syllogism
4. Disjunctive Syllogism
Prepared by: Prof. Khushali B Kathiriya
65
65. Inference Rules (Cont.)
1. Modus Ponens
The Modus Ponens rule is one of the most important rules of inference,
and it states that if P and P → Q is true, then we can infer that Q will be
true. It can be represented as:
66
Prepared by: Prof. Khushali B Kathiriya
66. Inference Rules (Cont.)
1. Modus Ponens
Example:
Statement-1: "If I am sleepy then I go to bed" ==> P → Q
Statement-2: "I am sleepy" ==> P
Conclusion: "I go to bed." ==> Q
Hence, we can say that, if P→ Q is true and P is true then Q will be true.
67
Prepared by: Prof. Khushali B Kathiriya
67. Inference Rules (Cont.)
2. Modus Tollens
The Modus Tollens rule state that if P→ Q is true and ¬ Q is true, then
¬ P will also true. It can be represented as:
Prepared by: Prof. Khushali B Kathiriya
68
68. Inference Rules (Cont.)
2. Modus Tollens
Statement-1: "If I am sleepy then I go to bed" ==> P→ Q
Statement-2: "I do not go to the bed."==> ~Q
Statement-3: Which infers that "I am not sleepy" => ~P
Prepared by: Prof. Khushali B Kathiriya
69
69. Inference Rules (Cont.)
3. Hypothetical Syllogism
The Hypothetical Syllogism rule state that if P→R is true whenever P→Q
is true, and Q→R is true. It can be represented as the following
notation:
Notation is : P → Q, Q → R
P → R
Prepared by: Prof. Khushali B Kathiriya
70
70. Inference Rules (Cont.)
3. Hypothetical Syllogism
Statement-1: If you have my password, then you can log on to
my face book.
Statement-2: If you can log onto my face book account then you
can delete my face book account.
Statement-3: If you have my password then you can delete my
face book account.
71
Prepared by: Prof. Khushali B Kathiriya
71. Inference Rules (Cont.)
4. Disjunctive Syllogism
The Disjunctive syllogism rule state that if P∨Q is true, and ¬P is true,
then Q will be true. It can be represented as:
Prepared by: Prof. Khushali B Kathiriya
72
72. Inference Rules (Cont.)
4. Disjunctive Syllogism
Statement-1: Today is Sunday or Monday. ==>P∨Q
Statement-2: Today is not Sunday. ==> ¬P
Conclusion: Today is Monday. ==> Q
Prepared by: Prof. Khushali B Kathiriya
73
73. Inference Rules (Cont.)
In short inference rule says that new sentence can be create by logically
following the set of sentences of knowledge base.
Prepared by: Prof. Khushali B Kathiriya
74
Sr. No. Inference Rules Premises (KB) Conclusion
1 Modus Ponens X, X → Y Y
2 Substitution X → Y & Y → Z X = Y
3 Chain Rule X → Y, Y → Z X → Z
4 AND introduction X, Y X ^ Y
5 Transposition X →Y ~X → ~Y
75. Horn Clause
A Horn clause is a clause (a disjunction of literals) with at most one positive
literal.
~A1 V ~A2 V ~A3 V . . . . . V ~An V B
Lets take one example,
(A1 ^ A2 ^ A3 ^ . . . . . ^ An) → B
Apply DE Morgan's Law on given equation,
~(A1 ^ A2 ^ A3 ^ . . . . . ^ An) V B
Apply Distributive Law,
~A1 V ~A2 V ~A3 V . . . . . V ~An V B
Prepared by: Prof. Khushali B Kathiriya
76
Horn clause
76. Properties of Operators
Commutatively
P∧ Q= Q ∧ P, or
P ∨ Q = Q ∨ P.
Associativity
(P ∧ Q) ∧ R= P ∧ (Q ∧ R),
(P ∨ Q) ∨ R= P ∨ (Q ∨ R)
Identity element
P ∧ True = P,
P ∨ True= True.
Prepared by: Prof. Khushali B Kathiriya
77
Distributive
P∧ (Q ∨ R) = (P ∧ Q) ∨ (P ∧ R).
P ∨ (Q ∧ R) = (P ∨ Q) ∧ (P ∨ R).
DE Morgan's Law
¬ (P ∧ Q) = (¬P) ∨ (¬Q)
¬ (P ∨ Q) = (¬ P) ∧ (¬Q).
Double-negation elimination
¬ (¬P) = P.
77. Horn Clause (Cont.)
1. (A ^ B ) → C
= (A ^ B) → C
Apply DE Morgan's Law
= ~ (A ^ B) V C
Apply Distributive Law
= ~A V ~B V C
Prepared by: Prof. Khushali B Kathiriya
78
Horn clause
78. Horn Clause (Cont.)
2. (A V B) → C
= (A V B ) → C
Apply DE Morgan's Law
= ~(A V B ) V C
Apply Distributive Law
= (~A ^ ~B) V C
= (~A V C) ^ (~A V ~B)
= (~A V C) , (~B V C)
Prepared by: Prof. Khushali B Kathiriya
79
79. Horn Clause (Cont.)
3. ( A ^ ~B ) → C
= ( A ^ ~B ) → C
Apply DE Morgan's Law
= ~(A ^ ~B) V C
Apply Distributive Law
= (~A V B) V C
= ~A V B V C
Prepared by: Prof. Khushali B Kathiriya
80
Not Possible
81. Wampus World
The Wumpus world is a cave which has 4/4 rooms connected with
passageways. So there are total 16 rooms which are connected with each
other. We have a knowledge-based agent who will go forward in this
world. The cave has a room with a beast which is called Wumpus, who eats
anyone who enters the room. The Wumpus can be shot by the agent, but
the agent has a single arrow.
In the Wumpus world, there are some Pits rooms which are bottomless, and
if agent falls in Pits, then he will be stuck there forever. The exciting thing
with this cave is that in one room there is a possibility of finding a heap of
gold. So the agent goal is to find the gold and climb out the cave without
fallen into Pits or eaten by Wumpus. The agent will get a reward if he comes
out with gold, and he will get a penalty if eaten by Wumpus or falls in the
pit.
Prepared by: Prof. Khushali B Kathiriya
82
82. Wampus World (Cont.)
Following is a sample diagram for representing the Wumpus world. It is
showing some rooms with Pits, one room with Wumpus and one agent at
(1,1) square location of the world.
Prepared by: Prof. Khushali B Kathiriya
83
83. Wampus World (Cont.)
There are also some components which can help the agent to navigate
the cave. These components are given as follows:
1. The rooms adjacent to the Wumpus room are smelly, so that it would have some
stench.
2. The room adjacent to PITs has a breeze, so if the agent reaches near to PIT, then
he will perceive the breeze.
3. There will be glitter in the room if and only if the room has gold.
4. The Wumpus can be killed by the agent if the agent is facing to it, and Wumpus
will emit a horrible scream which can be heard anywhere in the cave.
Prepared by: Prof. Khushali B Kathiriya
84
84. Wampus World (Cont.)
PEAS description of Wumpus world
To explain the Wumpus world we have given PEAS description as
below:
Performance measure
Environment
Actuators
Sensors
The Wumpus world Properties
Exploring the Wumpus world
Prepared by: Prof. Khushali B Kathiriya
85
85. Wampus World (Cont.)
Performance measure:
+1000 reward points if the agent comes out of the cave with the gold.
-1000 points penalty for being eaten by the Wumpus or falling into the
pit.
-1 for each action, and -10 for using an arrow.
The game ends if either agent dies or came out of the cave.
Prepared by: Prof. Khushali B Kathiriya
86
86. Wampus World (Cont.)
Environment:
A 4*4 grid of rooms.
The agent initially in room square [1, 1], facing toward the right.
Location of Wumpus and gold are chosen randomly except the first
square [1,1].
Each square of the cave can be a pit with probability 0.2 except the
first square.
Prepared by: Prof. Khushali B Kathiriya
87
87. Wampus World (Cont.)
Actuators:
Left turn,
Right turn
Move forward
Grab
Release
Shoot
Prepared by: Prof. Khushali B Kathiriya
88
88. Wampus World (Cont.)
Sensors:
The agent will perceive the stench if he is in the room adjacent to the
Wumpus. (Not diagonally).
The agent will perceive breeze if he is in the room directly adjacent to
the Pit.
The agent will perceive the glitter in the room where the gold is present.
The agent will perceive the bump if he walks into a wall.
When the Wumpus is shot, it emits a horrible scream which can be
perceived anywhere in the cave.
These percepts can be represented as five element list, in which we will
have different indicators for each sensor.
Example if agent perceives stench, breeze, but no glitter, no bump, and
no scream then it can be represented as:
[Stench, Breeze, None, None, None].
Prepared by: Prof. Khushali B Kathiriya
89
89. Wampus World (Cont.)
The Wumpus world Properties:
Partially observable: The Wumpus world is partially observable because
the agent can only perceive the close environment such as an
adjacent room.
Deterministic: It is deterministic, as the result and outcome of the world
are already known.
Sequential: The order is important, so it is sequential.
Static: It is static as Wumpus and Pits are not moving.
Discrete: The environment is discrete.
One agent: The environment is a single agent as we have one agent
only and Wumpus is not considered as an agent.
Prepared by: Prof. Khushali B Kathiriya
90
90. Wampus World (Cont.)
Exploring the Wumpus world:
Agent's First step:
Initially, the agent is in the first room or on
the square [1,1], and we already know
that this room is safe for the agent, so to
represent on the below diagram (a) that
room is safe we will add symbol OK.
Symbol A is used to represent agent,
symbol B for the breeze, G for Glitter or
gold, V for the visited room, P for pits, W
for Wumpus.
At Room [1,1] agent does not feel any
breeze or any Stench which means the
adjacent squares are also OK.
Prepared by: Prof. Khushali B Kathiriya
91
92. Wampus World (Cont.)
Agent's second Step:
Now agent needs to move forward, so it will either move to [1, 2], or
[2,1]. Let's suppose agent moves to the room [2, 1], at this room agent
perceives some breeze which means Pit is around this room. The pit can
be in [3, 1], or [2,2], so we will add symbol P? to say that, is this Pit room?
Now agent will stop and think and will not make any harmful move. The
agent will go back to the [1, 1] room. The room [1,1], and [2,1] are
visited by the agent, so we will use symbol V to represent the visited
squares.
Prepared by: Prof. Khushali B Kathiriya
93
93. Wampus World (Cont.)
Agent's third step:
At the third step, now agent will move to the room [1,2] which is OK. In
the room [1,2] agent perceives a stench which means there must be a
Wumpus nearby. But Wumpus cannot be in the room [1,1] as by rules of
the game, and also not in [2,2] (Agent had not detected any stench
when he was at [2,1]). Therefore agent infers that Wumpus is in the room
[1,3], and in current state, there is no breeze which means in [2,2] there
is no Pit and no Wumpus. So it is safe, and we will mark it OK, and the
agent moves further in [2,2].
Prepared by: Prof. Khushali B Kathiriya
94
95. Wampus World (Cont.)
Agent's fourth step:
At room [2,2], here no stench and no breezes present so let's suppose
agent decides to move to [2,3]. At room [2,3] agent perceives glitter, so
it should grab the gold and climb out of the cave.
Prepared by: Prof. Khushali B Kathiriya
96
97. First Order Predicate Logic
In the topic of Propositional logic, we have seen that how to represent
statements using propositional logic. But unfortunately, in propositional
logic, we can only represent the facts, which are either true or false.
PL is not sufficient to represent the complex sentences or natural language
statements. The propositional logic has very limited expressive power.
Consider the following sentence, which we cannot represent using PL logic.
"Some humans are intelligent“.
"Sachin likes cricket."
To represent the above statements, PL logic is not sufficient, so we required
some more powerful logic, such as first-order logic (FOL).
Prepared by: Prof. Khushali B Kathiriya
98
98. First Order Predicate Logic (Cont.)
First-order logic is another way of knowledge representation in artificial
intelligence. It is an extension to propositional logic.
FOL is sufficiently expressive to represent the natural language statements in
a concise way.
First-order logic is also known as Predicate logic or First-order predicate
logic. First-order logic is a powerful language that develops information
about the objects in a more easy way and can also express the relationship
between those objects.
Prepared by: Prof. Khushali B Kathiriya
99
99. First Order Predicate Logic (Cont.)
First-order logic (like natural language) does not only assume that the world
contains facts like propositional logic but also assumes the following things in the
world:
1. Constant term: A, B, people, numbers, colors, wars, theories, squares, pits,
Wumpus, etc.
2. Variable term : It can be unary relation such as: red, round, is adjacent, or
n-any relation such as: the sister of, brother of, has color, comes between
3. Function: Father of, best friend, third inning of, end of, etc.
As a natural language, first-order logic also has two main parts:
1. Syntax
2. Semantics
Prepared by: Prof. Khushali B Kathiriya
100
100. Atomic Sentences
Atomic sentences are the most basic sentences of first-order logic. These
sentences are formed from a predicate symbol followed by a parenthesis
with a sequence of terms.
We can represent atomic sentences as Predicate (term1, term2, temp3,
......, term n).
Example:
Ravi and Ajay are brothers: => Brothers(Ravi, Ajay).
Chinky is a cat: => cat (Chinky).
Prepared by: Prof. Khushali B Kathiriya
101
101. Complex Sentences
Complex sentences are made by combining atomic sentences using
connectives.
First-order logic statements can be divided into two parts:
Subject: Subject is the main part of the statement.
Predicate: A predicate can be defined as a relation, which binds two
atoms together in a statement.
Example:
"x is an integer."
Prepared by: Prof. Khushali B Kathiriya
102
102. Quantifiers in First-Order Logic
A quantifier is a language element which generates quantification, and
quantification specifies the quantity of specimen in the universe of
discourse.
These are the symbols that permit to determine or identify the range and
scope of the variable in the logical expression. There are two types of
quantifier:
1. Universal Quantifier, (for all, everyone, everything)
2. Existential quantifier, (for some, at least one).
Prepared by: Prof. Khushali B Kathiriya
103
103. Universal Quantifier
Universal quantifier is a symbol of logical representation, which specifies
that the statement within its range is true for everything or every instance of
a particular thing.
The Universal quantifier is represented by a symbol ∀, which resembles an
inverted A.
If x is a variable, then ∀x is read as:
• For all x
• For each x
• For every x.
Prepared by: Prof. Khushali B Kathiriya
104
105. Existential Quantifier
Existential quantifiers are the type of quantifiers, which express that the
statement within its scope is true for at least one instance of something.
It is denoted by the logical operator ∃, which resembles as inverted E.
When it is used with a predicate variable then it is called as an existential
quantifier.
If x is a variable, then existential quantifier will be ∃x or ∃(x). And it will be
read as:
• There exists a 'x.'
• For some 'x.'
• For at least one 'x.'
Prepared by: Prof. Khushali B Kathiriya
106
107. Properties of Quantifiers
In Universal quantifier, ∀x∀y is similar to ∀y∀x.
In Existential quantifier, ∃x∃y is similar to ∃y∃x.
∃x∀y is not similar to ∀y∃x.
Prepared by: Prof. Khushali B Kathiriya
108
109. Example of FOL
1. All birds fly.
In this question the predicate is "fly(bird).
And since there are all birds who fly so it will be represented as follows.
∀x bird(x) →fly(x).
Prepared by: Prof. Khushali B Kathiriya
110
110. Example of FOL
2. Every man respects his parent.
In this question, the predicate is "respect(x, y)," where x=man, and y=
parent.
Since there is every man so will use ∀, and it will be represented as
follows:
∀x man(x) → respects (x, parent).
Prepared by: Prof. Khushali B Kathiriya
111
111. Example of FOL (Cont.)
3. Some boys play cricket.
In this question, the predicate is "play(x, y)," where x= boys, and y=
game.
Since there are some boys so we will use ∃, and it will be represented as:
∃x boys(x) ^ play(x, cricket).
Prepared by: Prof. Khushali B Kathiriya
112
112. Example of FOL (Cont.)
4. Not all students like both Mathematics and Science.
In this question, the predicate is "like(x, y)," where x= student, and y=
subject.
Since there are not all students, so we will use ∀ with negation,
so following representation for this:
¬∀ (x) [ student(x) → like(x, Mathematics) ∧ like(x, Science)].
Prepared by: Prof. Khushali B Kathiriya
113
113. Example of FOL (Cont.)
5. Only one student failed in Mathematics.
In this question, the predicate is "failed(x, y)," where x= student, and y=
subject.
Since there is only one student who failed in Mathematics, so we will use
following representation for this:
∃(x) [ student(x) → failed (x, Mathematics) ∧∀ (y) [¬(x==y) ∧ student(y)
→ ¬failed (x, Mathematics)].
Prepared by: Prof. Khushali B Kathiriya
114
115. Representation Simple Facts in logic
1. All students are smart.
∀x (Student(x) ⇒ Smart(x))
2. There exists a student.
∃x Student(x)
3. There exists a smart student.
∃x (Student(x) ∧ Smart(x))
Prepared by: Prof. Khushali B Kathiriya
117
116. Representation Simple Facts in logic
(Cont.)
4. Every student loves some student.
∀x (Student(x) ⇒ ∃y (Student(y) ∧ Loves(x,y)))
5. Every student loves some other student.
∀x (Student(x) ⇒ ∃y (Student(y) ∧¬(x=y) ∧ Loves(x,y)))
6. There is a student who is loved by every other student.
∃x (Student(x) ∧∀y (Student(y) ∧¬(x=y) ⇒Loves(y,x)))
Prepared by: Prof. Khushali B Kathiriya
118
117. Representation Simple Facts in logic
(Cont.)
1. Bill is a student.
Student(Bill)
2. Bill takes either Analysis or Geometry (but not both).
Takes(Bill,Analysis) ⇔ ¬Takes(Bill,Geometry)
3. Bill takes Analysis or Geometry (or both).
Takes(Bill,Analysis) ∨ Takes(Bill,Geometry)
4. Bill takes Analysis and Geometry.
Takes(Bill,Analysis) ∧ Takes(Bill,Geometry)
5. Bill does not take Analysis.
¬Takes(Bill,Analysis)
Prepared by: Prof. Khushali B Kathiriya
119
118. Representation Simple Facts in logic
(Cont.)
6. No student loves Bill.
¬∃x (Student(x) ∧ Loves(x,Bill)
7. Bill has at least one sister.
∃x SisterOf(x,Bill)
8. Bill has no sister.
¬∃x SisterOf(x,Bill)
9. Bill has at most one sister.
∀x,y (SisterOf(x,Bill) ∧ SisterOf(y,Bill) ⇒x=y))
10.Bill has exactly one sister.
∃x (SisterOf(x,Bill) ∧∀y (SisterOf(y,Bill) ⇒x=y))
11.Bill has at least two sisters.
∃x,y (SisterOf(x,Bill) ∧ SisterOf(y,Bill) ∧¬(x=y))
Prepared by: Prof. Khushali B Kathiriya
120
119. Representation Simple Facts in logic
(Cont.)
1. Anyone whom Mary loves is a football star.
2. Any student who does not pass does not play.
3. John is a student.
4. Any student who does not study does not pass.
5. Anyone who does not play is not a football star.
6. If John does not study, then Mary does not love John.
Prepared by: Prof. Khushali B Kathiriya
121
120. Representation Simple Facts in logic
(Cont.)
1. Anyone whom Mary loves is a football star.
∀ x (LOVES(Mary,x) → STAR(x))
2. Any student who does not pass does not play.
∀ x (STUDENT(x) ∧ ¬ PASS(x) → ¬ PLAY(x))
3. John is a student.
STUDENT(John)
4. Any student who does not study does not pass.
∀ x (STUDENT(x) ∧ ¬ STUDY(x) → ¬ PASS(x))
5. Anyone who does not play is not a football star.
∀ x (¬ PLAY(x) → ¬ STAR(x))
6. If John does not study, then Mary does not love John.
¬ STUDY(John) → ¬ LOVES(Mary,John)
Prepared by: Prof. Khushali B Kathiriya
122
121. Representation Simple Facts in logic
(Cont.)
1. Every child loves Santa.
2. Everyone who loves Santa loves any reindeer.
3. Rudolph is a reindeer, and Rudolph has a red nose.
4. Anything which has a red nose is weird or is a clown.
5. No reindeer is a clown.
6. Scrooge does not love anything which is weird.
7. Scrooge is not a child.
Prepared by: Prof. Khushali B Kathiriya
123
122. Representation Simple Facts in logic
(Cont.)
1. Every child loves Santa.
∀ x (CHILD(x) → LOVES(x, Santa))
2. Everyone who loves Santa loves any reindeer.
∀ x (LOVES(x, Santa) → ∀ y (REINDEER(y) → LOVES(x, y)))
3. Rudolph is a reindeer, and Rudolph has a red nose.
REINDEER(Rudolph) ∧ REDNOSE(Rudolph)
4. Anything which has a red nose is weird or is a clown.
∀ x (REDNOSE(x) → WEIRD(x) ∨ CLOWN(x))
Prepared by: Prof. Khushali B Kathiriya
124
123. Representation Simple Facts in logic
(Cont.)
5. No reindeer is a clown.
¬ ∃ x (REINDEER(x) ∧ CLOWN(x))
6. Scrooge does not love anything which is weird.
∀ x (WEIRD(x) → ¬ LOVES(Scrooge, x))
7. Scrooge is not a child.
¬ CHILD(Scrooge)
Prepared by: Prof. Khushali B Kathiriya
125
124. Representation Simple Facts in logic
(Cont.)
1. Anyone who buys carrots by the bushel owns either a rabbit or a grocery
store.
2. Every dog chases some rabbit.
3. Mary buys carrots by the bushel.
4. Anyone who owns a rabbit hates anything that chases any rabbit.
5. John owns a dog.
6. Someone who hates something owned by another person will not date
that person.
7. If Mary does not own a grocery store, she will not date John.
Prepared by: Prof. Khushali B Kathiriya
126
125. Representation Simple Facts in logic
(Cont.)
1. Anyone who buys carrots by the bushel owns either a rabbit or a grocery
store.
∀ x (BUY(x) → ∃ y (OWNS(x,y) ∧ (RABBIT(y) ∨ GROCERY(y))))
2. Every dog chases some rabbit.
∀ x (DOG(x) → ∃ y (RABBIT(y) ∧ CHASE(x,y)))
3. Mary buys carrots by the bushel.
BUY(Mary)
4. Anyone who owns a rabbit hates anything that chases any rabbit.
∀ x ∀ y (OWNS(x,y) ∧ RABBIT(y) → ∀ z ∀ w (RABBIT(w) ∧ CHASE(z,w) → HATES(x,z)))
Prepared by: Prof. Khushali B Kathiriya
127
126. Representation Simple Facts in logic
(Cont.)
5. John owns a dog.
∃ x (DOG(x) ∧ OWNS(John,x))
6. Someone who hates something owned by another person will not date
that person.
∀ x ∀ y ∀ z (OWNS(y,z) ∧ HATES(x,z) → ¬ DATE(x,y))
7. (Conclusion) If Mary does not own a grocery store, she will not date John.
(( ¬ ∃ x (GROCERY(x) ∧ OWN(Mary,x))) → ¬ DATE(Mary,John))
Prepared by: Prof. Khushali B Kathiriya
128
129. Comparison between Propositional
Logic and First Order Logic (Cont.)
Propositional Logic (PL) First Order Logic (FOL)
PL can not represent small worlds like
vacuum cleaner world.
FOL can very well represent small
world’s problems.
PL is a weak knowledge
representation language.
FOL is a strong way of representing
language.
PL uses propositions in which the
complete sentence is denoted by a
symbol.
FOL uses predicated which involve
constants, variables, functions,
relations.
PL can not directly represent
properties of individual entities or
relation between entities.
i.e., Hiral is short.
FOL can directly represent properties
of individual entities or relation
between entities.
i.e., Hiral is short.
Ans is: short (Hiral)
Prepared by: Prof. Khushali B Kathiriya
131
130. Comparison between Propositional
Logic and First Order Logic
Propositional Logic (PL) First Order Logic (FOL)
PL can not express specialization,
generalization, or patterns, etc.
i.e., all rectangle have 4 sides
FOL can express specialization,
generalization, or patterns, etc.
i.e., all rectangle have 4 sides
Ans. is: no of size(rectangle,4)
Foundation level language Higher level language
PL is not sufficiently expressive to
represent complex statements.
FOL is represent complex statements.
In PL meaning of the facts is context-
independent unlike natural language.
In FOL meaning of the sentences is
context dependent like natural
language.
Declarative in nature Derivative in nature
Prepared by: Prof. Khushali B Kathiriya
132
132. Inference in First Order Logic
The inference engine is the component of the intelligent system in artificial
intelligence, which applies logical rules to the knowledge base to infer new
information from known facts. The first inference engine was part of the
expert system. Inference engine commonly proceeds in two modes, which
are:
1. Forward chaining
2. Backward chaining
Prepared by: Prof. Khushali B Kathiriya
134
134. 1. Forward Chaining
Forward chaining is also known as a forward deduction or forward
reasoning method when using an inference engine. Forward chaining is a
form of reasoning which start with atomic sentences in the knowledge base
and applies inference rules (Modus Ponens) in the forward direction to
extract more data until a goal is reached.
The Forward-chaining algorithm starts from known facts, triggers all rules
whose premises are satisfied, and add their conclusion to the known facts.
This process repeats until the problem is solved.
Forward chaining is called as a data driven inference technique.
Prepared by: Prof. Khushali B Kathiriya
136
135. 1. Forward Chaining (Cont.)
Properties of Forward-Chaining:
It is a down-up approach, as it moves from bottom to top.
It is a process of making a conclusion based on known facts or data, by
starting from the initial state and reaches the goal state.
Forward-chaining approach is also called as data-driven as we reach
to the goal using available data.
Forward -chaining approach is commonly used in the expert system,
such as CLIPS, business, and production rule systems.
Prepared by: Prof. Khushali B Kathiriya
137
136. 1. Forward Chaining / Resolution
(Cont.)
Example:
If it is raining then, we will take umbrella.
Data: It is raining
Decision: we will take umbrella
That’s means we already known that it’s raining that’s why it decided to
take umbrella.
Prepared by: Prof. Khushali B Kathiriya
138
Data
Decision
137. 1. Forward Chaining / Resolution
(Cont.)
Facts:
1. It is a crime for an American to sell weapons to enemy of America.
2. Country Nono is an enemy of America.
3. Nono has a some missiles.
4. All of the missiles were sold to Nono by colonel west.
5. Missiles are weapons.
6. Colonel west is American.
We have prove that west is a criminal.
Prepared by: Prof. Khushali B Kathiriya
139
145. 2. Backward Chaining/ Resolution
Backward-chaining is also known as a backward deduction or backward
reasoning method when using an inference engine. A backward chaining
algorithm is a form of reasoning, which starts with the goal and works
backward, chaining through rules to find known facts that support the goal.
Prepared by: Prof. Khushali B Kathiriya
147
Decision
Data
146. 2. Backward Chaining/ Resolution
(Cont.)
Properties of backward chaining:
It is known as a top-down approach.
Backward-chaining is based on modus ponens inference rule.
In backward chaining, the goal is broken into sub-goal or sub-goals to
prove the facts true.
It is called a goal-driven approach, as a list of goals decides which rules
are selected and used.
Backward -chaining algorithm is used in game theory, automated
theorem proving tools, inference engines, proof assistants, and various
AI applications.
The backward-chaining method mostly used a depth-first
search strategy for proof.
Prepared by: Prof. Khushali B Kathiriya
148
147. 2. Backward Chaining/ Resolution
(Cont.)
Facts:
1. It is a crime for an American to sell weapons to enemy of America.
2. Country Nono is an enemy of America.
3. Nono has a some missiles.
4. All of the missiles were sold to Nono by colonel west.
5. Missiles are weapons.
6. Colonel west is American.
We have know that west is a criminal.
Prepared by: Prof. Khushali B Kathiriya
149
154. Unification Algorithm
Algorithm Unify(L1,L2):
1. If L1 and L2 is a variable or constant then,
a. If L1 and L2 are identical return NIL,
b. Else if L1 is a variable, then if L1 occurs in L2 then return fail, else return { (L1/L2) }
c. Else if L2 is a variable, then if L2 occurs in L1 then return fail, else return { (L2/L1) }
d. Else return fail
2. If the initial predicate symbols in L1 and L2 are identical, then return Fail
3. If L1 and L2 have different number of arguments, then fails
a. i.e., P(L1,L2) and P(L1,L2,L3)
4. Set SUBST to nil.
5. Loop (apply for all variable/constant)
6. Return SUBST.
Prepared by: Prof. Khushali B Kathiriya
156
155. Unification Example
Unification is all about making the expressions look identical. So, for the
given expressions to make them look identical we need to do substitution.
(x, y)=(2,3)
So we can say like,
x=2, {2 for X}
y=3 {3 for y}
P(x, F(y)) = P (a, F(g(z))
In our case, P(x, F(y)) and P (a, F(g(z))
x=a (a for x)
y=g(z) (g(z) for y)
[a/x , g(z)/y]
Prepared by: Prof. Khushali B Kathiriya
157
156. Unification Example(Cont.)
Food (Peanuts) and Food (x)
So here we can say like this,
Peanuts for X
{X / Peanuts}
Like (Ravi, P) and like (Ravi, Apple)
So here we can say like this,
Apple for P
{P / Apple)
Prepared by: Prof. Khushali B Kathiriya
158
158. Resolution
Resolution is used, if there are various statements are given, and we need
to prove a conclusion of those statements. Unification is a key concept in
proofs by resolutions. Resolution is a single inference rule which can
efficiently operate on the conjunctive normal form or clausal form.
Prepared by: Prof. Khushali B Kathiriya
160
159. Conversion from FOL Clausal Normal
Form (CNF)
Steps for Resolution :
1. Conversion of facts into FOL.
2. Convert FOL to CNF
A. Elimination of implication
Eliminate all ”→” sign
Replace P → Q with ~P V Q
B. Distribute negations
Replace ~~P with P
Replace ~(P V Q) with ~P ^ ~Q (pVQ) → R
Prepared by: Prof. Khushali B Kathiriya
161
160. Conversion from FOL Clausal Normal
Form (CNF) (Cont.)
2. Convert FOL to CNF. (Cont.)
C. Eliminate existential quantifiers by replacing with skolem constants or
skolem function
∀X ∃Y ((P1(X,Y) v (P2(X,Y))) ≡ ∀X ((P1(X,F(Y)) v (P2(X,F(Y)))
D. Rename variables/ use standard variable to avoid duplicate
quantifiers.
E. Drop all universal quantifiers.
(P1(X,F(Y)) v (P2(X,F(Y))
Prepared by: Prof. Khushali B Kathiriya
162
161. Conversion from FOL Clausal Normal
Form (CNF) (Cont.)
3. Negate the statement which needs to prove (proof by
contradiction)
In this statement, we will apply negation to the conclusion statements,
which will be written as
¬ likes(John, Peanuts)
4. Draw Resolution graph
Now in this step, we will solve the problem by resolution tree using
substitution.
Prepared by: Prof. Khushali B Kathiriya
163
162. Conversion from FOL Clausal Normal
Form (CNF) (Cont.)
Facts:
1. It is a crime for an American to sell weapons to enemy of America.
2. Country Nono is an enemy of America.
3. Nono has a some missiles.
4. All of the missiles were sold to Nono by colonel west.
5. Missiles are weapons.
6. Colonel west is American.
Prove: We have know that west is a criminal.
Prepared by: Prof. Khushali B Kathiriya
164
163. Conversion from FOL Clausal Normal
Form (CNF) (Cont.)
Step 1: Convert English to FOL
1. American (X) ∧ weapon(Y) ∧ sells (X,Y,Z) ∧ enemy(Z, America) →
Criminal(X)
2. Enemy (Nono, America)
3. Owns ( Nono, X), Missile (X)
4. Missile (X) ^ owns (Nono, X)→ Sell (West, X, Nono)
5. Missile (X) → Weapon (x)
6. American (West)
Prepared by: Prof. Khushali B Kathiriya
165
164. Conversion from FOL Clausal Normal
Form (CNF) (Cont.)
Step 2: Remove → sign from the FOL
1. American (X) ∧ weapon(Y) ∧ sells (X,Y,Z) ∧ enemy(Z, America) → Criminal(X)
~(American (X) ∧ weapon(Y) ∧ sells (X,Y,Z) ∧ enemy(Z, America)) V Criminal(X)
Apply ~ sign in whole sentence ,
~American (X) V ~weapon(Y) V ~sells (X,Y,Z) V ~enemy(Z, America) V Criminal(X)
2. Enemy (Nono, America)
3. Owns ( Nono, X), Missile (X)
Owns ( Nono, X)
Missile (X)
Prepared by: Prof. Khushali B Kathiriya
166
165. Conversion from FOL Clausal Normal
Form (CNF) (Cont.)
Step 2: Remove ‘→’ sign from the FOL
4. Missile (X) ^ owns (Nono, X) → Sell (West, X, Nono)
~(Missile (X) ^ owns (Nono, X)) V Sell (West, X, Nono)
Apply ~ sign in whole sentence ,
~Missile (X) V ~owns (Nono, X) V Sell (West, X, Nono)
5. Missile (X) → Weapon (x)
~Missile (X) V Weapon (x)
6. American (West)
7. Criminal (West)
Prepared by: Prof. Khushali B Kathiriya
167
167. Example for Conversion from FOL
Clausal Normal Form (CNF)
Step 1: Convert English to FOL
Prepared by: Prof. Khushali B Kathiriya
169
168. Example for Conversion from FOL
Clausal Normal Form (CNF) (Cont.)
Step 2: Eliminate all implication (→) and rewrite
Prepared by: Prof. Khushali B Kathiriya
170
169. Example for Conversion from FOL
Clausal Normal Form (CNF) (Cont.)
Step 3: Move negation (¬)inwards and rewrite
Prepared by: Prof. Khushali B Kathiriya
171
170. Example for Conversion from FOL
Clausal Normal Form (CNF) (Cont.)
Step 4: Rename variables or standardize variables
Prepared by: Prof. Khushali B Kathiriya
172
171. Example for Conversion from FOL
Clausal Normal Form (CNF) (Cont.)
Step 5: Eliminate existential instantiation quantifier by elimination.
In this step, we will eliminate existential quantifier ∃, and this process is
known as Skolemization. But in this example problem since there is no
existential quantifier so all the statements will remain same in this step.
Prepared by: Prof. Khushali B Kathiriya
173
172. Example for Conversion from FOL
Clausal Normal Form (CNF) (Cont.)
Step 6: Drop Universal quantifiers
Prepared by: Prof. Khushali B Kathiriya
174
173. 175
Prepared by: Prof. Khushali B Kathiriya
¬ likes(John, Peanuts) ¬ food(x) V likes(John, x)
¬ food(Peanuts)
{Peanuts/x}
¬ eats(y, z) V killed(y) V food(z)
{Peanuts/z}
¬ eats(y, z) V killed(y) eats (Anil, Peanuts)
{Anil/y}
killed(Anil) ¬ alive(k) V ¬ killed(k)
¬ alive(Anil)
{Anil/k}
alive(Anil)
{ }
Step
7:
Draw
Resolution
graph