0% found this document useful (0 votes)
51 views26 pages

AI Unit 4

Knowledge representation and reasoning (KRR) is a key aspect of artificial intelligence that enables machines to understand and utilize information about the real world to solve complex problems. It encompasses various types of knowledge, including declarative, procedural, and heuristic knowledge, and employs different approaches for representation such as relational, inheritable, and inferential knowledge. Propositional logic serves as a foundational tool in AI for knowledge representation, automated reasoning, and decision-making, allowing systems to manipulate and derive new knowledge from established facts.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
51 views26 pages

AI Unit 4

Knowledge representation and reasoning (KRR) is a key aspect of artificial intelligence that enables machines to understand and utilize information about the real world to solve complex problems. It encompasses various types of knowledge, including declarative, procedural, and heuristic knowledge, and employs different approaches for representation such as relational, inheritable, and inferential knowledge. Propositional logic serves as a foundational tool in AI for knowledge representation, automated reasoning, and decision-making, allowing systems to manipulate and derive new knowledge from established facts.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 26

AI UNIT 4

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. Hence we can describe Knowledge
representation as following:

o 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.

o 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.

o 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.

What to Represent:

Following are the kind of knowledge which needs to be represented in AI systems:

o Object: All the facts about objects in our world domain. E.g., Guitars contains strings, trumpets are
brass instruments.

o Events: Events are the actions which occur in our world. knowledge

o Performance: It describe behavior which involves knowledge about how to do things.

o Meta-knowledge: It is knowledge about what we know.

o Facts: Facts are the truths about the real world and what we represent.

o Knowledge-Base: The central component of the knowledge-based agents is the 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.
Following are the types of knowledge in artificial intelligence:

Types of knowledge

Following are the various types of knowledge:

1. Declarative Knowledge:

o Declarative knowledge is to know about something.


o It includes concepts, facts, and objects.

o It is also called descriptive knowledge and expressed in declarative sentences.

o It is simpler than procedural language.

2. Procedural Knowledge

o It is also known as imperative knowledge.

o Procedural knowledge is a type of knowledge which is responsible for knowing how to do something.

o It can be directly applied to any task.

o It includes rules, strategies, procedures, agendas, etc.

o Procedural knowledge depends on the task on which it can be applied.

3. Meta-knowledge:

o Knowledge about the other types of knowledge is called Meta-knowledge.

4. Heuristic knowledge:

o Heuristic knowledge is representing knowledge of some experts in a filed or subject.

o Heuristic knowledge is rules of thumb based on previous experiences, awareness of approaches, and
which are good to work but not guaranteed.

5. Structural knowledge:

o Structural knowledge is basic knowledge to problem-solving.

o It describes relationships between various concepts such as kind of, part of, and grouping of something.

o It describes the relationship that exists between concepts or objects.

The relation between knowledge and intelligence:

Knowledge of real-worlds plays a vital role in intelligence and same for creating artificial intelligence.
Knowledge plays an important role in demonstrating intelligent behavior in AI agents. An agent is only able to
accurately act on some input when he has some knowledge or experience about that input.

Let's suppose if you met some person who is speaking in a language which you don't know, then how you will
able to act on that. The same thing applies to the intelligent behavior of the agents.

As we can see in below diagram, there is one decision maker which act by sensing the environment and using
knowledge. But if the knowledge part will not present then, it cannot display intelligent behavior.

AI knowledge cycle:

An Artificial intelligence system has the following components for displaying intelligent behavior:

o Perception
o Learning

o Knowledge Representation and Reasoning

o Planning

o Execution

The above diagram is showing how an AI system can interact with the real world and what components help it
to show intelligence. AI system has Perception component by which it retrieves information from its
environment. It can be visual, audio or another form of sensory input. The learning component is responsible for
learning from data captured by Perception comportment. In the complete cycle, the main components are
knowledge representation and Reasoning. These two components are involved in showing the intelligence in
machine-like humans. These two components are independent with each other but also coupled together. The
planning and execution depend on analysis of Knowledge representation and reasoning.

Approaches to knowledge representation:

There are mainly four approaches to knowledge representation, which are givenbelow:

1. Simple relational knowledge:

o It is the simplest way of storing facts which uses the relational method, and each fact about a set of the
object is set out systematically in columns.

o This approach of knowledge representation is famous in database systems where the relationship
between different entities is represented.

o This approach has little opportunity for inference.

Example: The following is the simple relational knowledge representation.

Player Weight Age

Player1 65 23

Player2 58 18

Player3 75 24

2. Inheritable knowledge:

o In the inheritable knowledge approach, all data must be stored into a hierarchy of classes.

o All classes should be arranged in a generalized form or a hierarchal manner.

o In this approach, we apply inheritance property.


o Elements inherit values from other members of a class.

o This approach contains inheritable knowledge which shows a relation between instance and class, and
it is called instance relation.

o Every individual frame can represent the collection of attributes and its value.

o In this approach, objects and values are represented in Boxed nodes.

o We use Arrows which point from objects to their values.

o Example:

3. Inferential knowledge:

o Inferential knowledge approach represents knowledge in the form of formal logics.

o This approach can be used to derive more facts.

o It guaranteed correctness.

o Example: Let's suppose there are two statements:

a. Marcus is a man

b. All men are mortal


Then it can represent as;

∀x = man (x) ----------> mortal (x)s


man(Marcus)

4. Procedural knowledge:

o Procedural knowledge approach uses small programs and codes which describes how to do specific
things, and how to proceed.

o In this approach, one important rule is used which is If-Then rule.

o In this knowledge, we can use various coding languages such as LISP language and Prolog language.

o We can easily represent heuristic or domain-specific knowledge using this approach.

o But it is not necessary that we can represent all cases in this approach.

Requirements for knowledge Representation system:

A good knowledge representation system must possess the following properties.

1. 1. Representational Accuracy:
KR system should have the ability to represent all kind of required knowledge.
2. 2. Inferential Adequacy:
KR system should have ability to manipulate the representational structures to produce new knowledge
corresponding to existing structure.

3. 3. Inferential Efficiency:
The ability to direct the inferential knowledge mechanism into the most productive directions by
storing appropriate guides.

4. 4. Acquisitional efficiency- The ability to acquire the new knowledge easily using automatic methods.

Propositional Logic in Artificial Intelligence

Propositional logic, also known as propositional calculus or sentential logic, forms the foundation of logical
reasoning in artificial intelligence (AI). It is a branch of logic that deals with propositions, which can either be
true or false. In AI, propositional logic is essential for knowledge representation, reasoning, and decision-
making processes. This article delves into the fundamental concepts of propositional logic and its applications in
AI.

What is Propositional Logic in Artificial Intelligence?

Propositional logic is a kind of logic whereby the expression that takes into consideration is referred to as a
proposition, which is a statement that can be either true or false but cannot be both at the same time. In AI
propositions are those facts, conditions, or any other assertion regarding a particular situation or fact in the
world. Propositional logic uses propositional symbols, connective symbols, and parentheses to build up
propositional logic expressions otherwise referred to as propositions.

Proposition operators like conjunction (∧), disjunction (∨), negation ¬, implication →, and biconditional ↔
enable a proposition to be manipulated and combined in order to represent the underlying logical relations and
rules.

Example of Propositions Logic

In propositional logic, well-formed formulas, also called propositions, are declarative statements that may be
assigned a truth value of either true or false. They are often denoted by letters such as P, Q, and R. Here are
some examples:

 P: In this statement, ‘The sky is blue’ five basic sentence components are used.

 Q: ‘There is only one thing wrong at the moment we are in the middle of a rain.”

 R: ‘Sometimes they were just saying things without realizing: “The ground is wet”’.

All these protasis can be connected by logical operations to create stamata with greater propositional depth. For
instance:

 P∧Q: ”It is clear that the word ‘nice’ for the sentence ‘Saturday is a nice day’ exists as well as the
word ‘good’ for the sentence ‘The weather is good today. ’”

 P∨Q: “It may probably be that the sky is blue or that it is raining. ”

 ¬P: I was not mindful that the old adage “The sky is not blue” deeply describes a geek.

Basic Concepts of Propositional Logic

1. Propositions:

A proposition is a declarative statement that is either true or false. For example:

 “The sky is blue.” (True)

 “It is raining.” (False)

2. Logical Connectives:
Logical connectives are used to form complex propositions from simpler ones. The primary connectives are:

 AND (∧): A conjunction that is true if both propositions are true.

o Example: “It is sunny ∧ It is warm” is true if both propositions are true.

 OR (∨): A disjunction that is true if at least one proposition is true.

o Example: “It is sunny ∨ It is raining” is true if either proposition is true.

 NOT (¬): A negation that inverts the truth value of a proposition.

o Example: “¬It is raining” is true if “It is raining” is false.

 IMPLIES (→): A conditional that is true if the first proposition implies the second.

o Example: “If it rains, then the ground is wet” (It rains → The ground is wet) is true unless it
rains and the ground is not wet.

 IFF (↔): A biconditional that is true if both propositions are either true or false together.

o Example: “It is raining ↔ The ground is wet” is true if both are true or both are false.

3. Truth Tables:

Truth tables are used to determine the truth value of complex propositions based on the truth values of their
components. They exhaustively list all possible truth value combinations for the involved propositions.

4. Tautologies, Contradictions, and Contingencies:

 Tautology: A proposition that is always true, regardless of the truth values of its components.

o Example: “P ∨ ¬P”

 Contradiction: A proposition that is always false.

o Example: “P ∧ ¬P”

 Contingency: A proposition that can be either true or false depending on the truth values of its
components.

o Example: “P ∧ Q”

Facts about Propositional Logic

1. Bivalence: A proposition gives a true and false result, with no in-between because h/p’ cannot be true
and false simultaneously.

2. Compositionality: The general signification of truth value of the proposition depends on the truth
values of the parts that make up the proposition as well as the relations between the different parts.

3. Non-ambiguity: Every purpose is unambiguous, well-defined: Each proposition is a well-defined


purpose, which means that at any given moment there is only one possible interpretation of it.

Syntax of Propositional Logic

Propositional logic and its syntax describes systems of propositions and methods for constructing well-formed
propositions and statements. The main components include:

 Propositions: Denoted by capital letters (For example, P, Q).

 Logical Connectives: Signs that are employed to join give propositions (e.g., ∧, ∨, ¬).

 Parentheses: Conventional operators are employed to identify the sequence of operations and the
hierarchy of various operators existing in the syntax of computer programming languages.
In propositional logic, a well-formed formula or WFF is an expression in symbols for the logic that satisfies the
grammar rules of the logic.

Logical Equivalence

Two statements have the same logical form if the truth of every proposition contained in the first statement has
the same value in all cases as the truth of every proposition contained in the second statement. For instance:

 It is also important to note that S→T is equivalent to ¬S∨T.

 The deep relationship between P↔Q and (P→Q)∧(Q→P) can be easily deduced, and the relationship
between P↔Q and (P→Q)∧(Q→P) cannot be overemphasized.

Logical equivalence can be done using truth tables or logical equivalences where specific attributes are used to
compare the two.

Properties of Operators

The logical operators in propositional logic have several important properties:

1. Commutativity:

 P∧Q≡Q∧P

 P∨Q≡Q∨P

2. Associativity:

 (P ∧ Q) ∧ R ≡ P ∧ (Q ∧ R)

 (P ∨ Q) ∨ R ≡ P ∨ (Q ∨ R)

3. Distributivity:

 P ∧ (Q ∨ R) ≡ (P ∧ Q) ∨ (P ∧ R)

 P ∨ (Q ∧ R) ≡ (P ∨ Q) ∧ (P ∨ R)

4. Identity:

 P ∧ true ≡ P

 P ∨ false ≡ P

5. Domination:

 P ∨ true ≡ true

 P ∧ false ≡ false

6. Double Negation:

 ¬ (¬P) ≡ P

7. Idempotence:

 P∧P≡P

 P∨P≡P

Applications of Propositional Logic in AI

1. Knowledge Representation:
Propositional logic is used to represent knowledge in a structured and unambiguous way. It allows AI systems to
store and manipulate facts about the world. For instance, in expert systems, knowledge is encoded as a set of
propositions and logical rules.

2. Automated Reasoning:

AI systems use propositional logic to perform automated reasoning. Logical inference rules, such as Modus
Ponens and Modus Tollens, enable systems to derive new knowledge from existing facts. For example:

 Modus Ponens: If “P → Q” and “P” are true, then “Q” must be true.

 Modus Tollens: If “P → Q” and “¬Q” are true, then “¬P” must be true.

3. Problem Solving and Planning:

Propositional logic is fundamental in solving problems and planning actions. AI planners use logical
representations of actions, states, and goals to generate sequences of actions that achieve desired outcomes. For
example, the STRIPS planning system employs propositional logic to represent preconditions and effects of
actions.

4. Decision Making:

In decision-making processes, propositional logic helps AI systems evaluate various options and determine the
best course of action. Logical rules can encode decision criteria, and truth tables can be used to assess the
outcomes of different choices.

5. Natural Language Processing (NLP):

Propositional logic is applied in NLP for tasks like semantic parsing, where natural language sentences are
converted into logical representations. This helps in understanding and reasoning about the meaning of
sentences.

6. Game Theory and Multi-Agent Systems:

In game theory and multi-agent systems, propositional logic is used to model the beliefs and actions of agents.
Logical frameworks help in predicting the behavior of agents and designing strategies for interaction.

Limitations of Propositional Logic

While propositional logic is powerful, it has several limitations:

1. Lack of Expressiveness: s does not allow for the representation of how one proposition relates to
another or to use variables to refer to objects in the world (e. g. , “All human beings are mortal”).

2. Scalability: What has been a defining problem of propositional logic is that the size of the resultant
truth tables increases exponentially with the number of propositions, which makes practical problems
infeasible.

3. Limited Inference: It can only take on ‘true or false’ solutions, not probabilities or multidimensional
security levels of truth.

quantifiers such as “for all” (denoted by ∀) or “there exists” (denoted by ∃), both of which are
4. Absence of Quantifiers: Unlike predicate logic, propositional logic does not allow the use of

powerful expressions.

First-Order Logic in Artificial intelligence

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.

o "Some humans are intelligent", or


o "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.

First-Order logic:

o First-order logic is another way of knowledge representation in artificial intelligence. It is an extension


to propositional logic.

o FOL is sufficiently expressive to represent the natural language statements in a concise way.

o 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.

o 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:

o Objects: A, B, people, numbers, colors, wars, theories, squares, pits, wumpus, ......

o Relations: 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

o Function: Father of, best friend, third inning of, end of, ......

o As a natural language, first-order logic also has two main parts:

a. Syntax

b. Semantics

Syntax of First-Order logic:

The syntax of FOL determines which collection of symbols is a logical expression in first-order logic. The basic
syntactic elements of first-order logic are symbols. We write statements in short-hand notation in FOL.

Basic Elements of First-order logic:

Following are the basic elements of FOL syntax:

Constant 1, 2, A, John, Mumbai, cat,....

Variables x, y, z, a, b,....

Predicates Brother, Father, >,....

Function sqrt, LeftLegOf, ....

Connectives ∧, ∨, ¬, ⇒, ⇔

Equality ==

Quantifier ∀, ∃

Atomic sentences:
o 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.

o We can represent atomic sentences as Predicate (term1, term2, ......, term n).

Example: Ravi and Ajay are brothers: => Brothers(Ravi, Ajay).


Chinky is a cat: => cat (Chinky).

Complex Sentences:

o Complex sentences are made by combining atomic sentences using connectives.

First-order logic statements can be divided into two parts:

o Subject: Subject is the main part of the statement.

o Predicate: A predicate can be defined as a relation, which binds two atoms together in a statement.

Consider the statement: "x is an integer.", it consists of two parts, the first part x is the subject of the
statement and second part "is an integer," is known as a predicate.

Quantifiers in First-order logic:

o A quantifier is a language element which generates quantification, and quantification specifies the
quantity of specimen in the universe of discourse.

o 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:

a. Universal Quantifier, (for all, everyone, everything)

b. Existential quantifier, (for some, at least one).

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.

Note: In universal quantifier we use implication "→".

If x is a variable, then ∀x is read as:

o For all x

o For each x

o For every x.

Example:

All man drink coffee.

Let a variable x which refers to a cat so all x can be represented in UOD as below:
∀x man(x) → drink (x, coffee).

It will be read as: There are all x where x is a man who drink coffee.

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.

Note: In Existential quantifier we always use AND or Conjunction symbol (∧).

If x is a variable, then existential quantifier will be ∃x or ∃(x). And it will be read as:

o There exists a 'x.'

o For some 'x.'

o For at least one 'x.'

Example:

Some boys are intelligent.

∃x: boys(x) ∧ intelligent(x)

It will be read as: There are some x where x is a boy who is intelligent.

Points to remember:

o The main connective for universal quantifier ∀ is implication →.

o The main connective for existential quantifier ∃ is and ∧.

Properties of Quantifiers:
o In universal quantifier, ∀x∀y is similar to ∀y∀x.

o In Existential quantifier, ∃x∃y is similar to ∃y∃x.

o ∃x∀y is not similar to ∀y∃x.

Some Examples of FOL using quantifier:

1. All birds fly.


In this question the predicate is "fly(bird)."

∀x bird(x) →fly(x).
And since there are all birds who fly so it will be represented as follows.

2. Every man respects his parent.

Since there is every man so will use ∀, and it will be represented as follows:
In this question, the predicate is "respect(x, y)," where x=man, and y= parent.

∀x man(x) → respects (x, parent).

3. Some boys play cricket.

will use ∃, and it will be represented as:


In this question, the predicate is "play(x, y)," where x= boys, and y= game. Since there are some boys so we

∃x boys(x) → play(x, cricket).

4. Not all students like both Mathematics and Science.

Since there are not all students, so we will use ∀ with negation, so following representation for this:
In this question, the predicate is "like(x, y)," where x= student, and y= subject.

¬∀ (x) [ student(x) → like(x, Mathematics) ∧ like(x, Science)].

5. Only one student failed in Mathematics.


In this question, the predicate is "failed(x, y)," where x= student, and y= subject.

∃(x) [ student(x) → failed (x, Mathematics) ∧∀ (y) [¬(x==y) ∧ student(y) → ¬failed (x,
Since there is only one student who failed in Mathematics, so we will use following representation for this:

Mathematics)].

Free and Bound Variables:

The quantifiers interact with variables which appear in a suitable way. There are two types of variables in First-
order logic which are given below:

Free Variable: A variable is said to be a free variable in a formula if it occurs outside the scope of the
quantifier.

Example: ∀x ∃(y)[P (x, y, z)], where z is a free variable.

Bound Variable: A variable is said to be a bound variable in a formula if it occurs within the scope of the
quantifier.

Example: ∀x [A (x) B( y)], here x and y are the bound variables.

What is situation calculus?

Situation calculus, in the realm of AI and formal logic, serves as a foundational framework for representing and
reasoning about dynamic domains. It provides a formalism for expressing actions, change, and the passage of
time, enabling effective modeling of complex, evolving systems. The key components and constructs of
situation calculus include fluents, actions, and situations, which allow for a structured representation of the state
of the world and the effects of actions.

Background and history of situation calculus

The concept of situation calculus traces its origins to the pioneering work of John McCarthy in the late 1960s.
McCarthy, a renowned computer scientist and one of the founding fathers of AI, introduced situation calculus as
a means of formalizing action and change within logical frameworks. Over time, situation calculus has evolved,
incorporating advancements in symbolic reasoning, AI planning, and knowledge representation, thus becoming
an indispensable tool in AI research and application development.

Significance of situation calculus

Situation calculus holds immense significance in the AI field, primarily due to its ability to effectively model
dynamic environments and reason about action sequences. Its applications range from robotics and natural
language processing to smart environments, where the dynamic nature of the systems necessitates a formalism
that can accommodate change and potential actions.

How situation calculus works

At the core of situation calculus lie predicates, fluents, and actions, which collectively enable the representation
of knowledge and reasoning about change. Predicates capture the state of the world, fluents represent properties
that can change over time, and actions denote the transitions between different states. Through the formalized
constructs of situation calculus, it becomes possible to reason about the dynamic evolution of a system and
predict the effects of actions within it.

Real-world examples and applications

Example 1: autonomous robotics

In the domain of autonomous robotics, situation calculus serves as a powerful tool for path planning and
decision-making in dynamic environments. By modeling the changing conditions through fluents and actions,
robots can navigate complex terrains, adapt to unforeseen obstacles, and execute tasks based on evolving
situational contexts.

Example 2: natural language processing

In the context of natural language processing, situation calculus plays a pivotal role in understanding and
interpreting dynamic contextual information. By representing the evolving states of conversations or linguistic
contexts as situations, NLP systems can more effectively process and respond to human communication in a
dynamic and changing environment.

Example 3: smart environments

Within smart environments, such as automated homes or intelligent factories, situation calculus finds application
in dynamic resource allocation and scheduling. By reasoning about the changing states of the environment and
the potential actions of users or automated systems, it becomes feasible to optimize resource usage, energy
consumption, and scheduling operations.

Pros & cons of situation calculus

Advantages of Situation Calculus in AI

 Flexibility in Modeling Dynamic Environments: Situation calculus enables a high degree of


flexibility in representing dynamic domains, allowing for adaptable and nuanced modeling of real-
world scenarios.

 Efficient Representation of Change and Action: The formalism of situation calculus provides an
efficient means of representing changes and reasoning about the effects of actions within a system.

Drawbacks and Challenges

 Complexity in Modeling Certain Scenarios: In highly complex and non-deterministic environments,


the modeling and reasoning processes within situation calculus can become intricate and challenging to
manage.

 Scalability and Computational Costs: As the size and complexity of the modeled domain increase,
situation calculus may face scalability challenges and incur higher computational costs.
Related terms

 Temporal Logic: A branch of logic that deals with the representation and reasoning about time and
temporal properties.

 First-Order Logic: The standard formalism for expressing logical statements, including quantifiers
and predicates.

 Transition Systems: Mathematical structures used to model the dynamic behavior of systems over
time.

Conclusion

In conclusion, situation calculus stands as a foundational concept within the realm of AI, providing a formal and
rigorous framework for reasoning about the dynamic nature of complex, evolving systems. Its applications
encompass a wide array of domains, from robotics and NLP to smart environments, making it a versatile and
vital tool for AI researchers and developers. Despite certain challenges, the benefits of situation calculus in
effectively modeling and reasoning about change and action make it an indispensable asset in the advancement
of AI technologies.

What is the Role of Planning in Artificial Intelligence?

Artificial Intelligence is a critical technology in the future. Whether it is intelligent robots or self-driving cars or
smart cities, they will all use different aspects of Artificial Intelligence!!! But to create any such AI
project, Planning is very important. So much so that Planning is a critical part of Artificial Intelligence which
deals with the actions and domains of a particular problem. Planning is considered as the reasoning side of
acting.

Everything we humans do is with a certain goal in mind and all our actions are oriented towards achieving our
goal. In a similar fashion, planning is also done for Artificial Intelligence. For example, reaching a particular
destination requires planning. Finding the best route is not the only requirement in planning, but the actions to
be done at a particular time and why they are done is also very important. That is why planning is considered as
the reasoning side of acting. In other words, planning is all about deciding the actions to be performed by the
Artificial Intelligence system and the functioning of the system on its own in domain-independent situations.

What is a Plan?

For any planning system, we need the domain description, action specification, and goal description. A plan
is assumed to be a sequence of actions and each action has its own set of preconditions to be satisfied before
performing the action and also some effects which can be positive or negative.

So, we have Forward State Space Planning (FSSP) and Backward State Space Planning (BSSP) at the basic
level.

1. Forward State Space Planning (FSSP)


FSSP behaves in a similar fashion like forward state space search. It says that given a start state S in any
domain, we perform certain actions required and acquire a new state S’ (which includes some new conditions as
well) which is called progress and this proceeds until we reach the goal state. The actions have to be applicable
in this case.

 Disadvantage: Large branching factor

 Advantage: Algorithm is Sound

2. Backward State Space Planning (BSSP)


BSSP behaves in a similar fashion like backward state space search. In this, we move from the goal state g
towards sub-goal g’ that is finding the previous action to be done to achieve that respective goal. This process is
called regression (moving back to the previous goal or sub-goal). These sub-goals have to be checked for
consistency as well. The actions have to be relevant in this case.

 Disadvantage: Not a sound algorithm (sometimes inconsistency can be found)


 Advantage: Small branching factor (very small compared to FSSP)

Hence for an efficient planning system, we need to combine the features of FSSP and BSSP which gives rise to
Goal Stack planning which will be discussed in the next article.

partial order planning(Will do in the copy)

Representing Knowledge in an Uncertain Domain in AI

Artificial Intelligence (AI) systems often operate in environments where uncertainty is a fundamental
aspect. Representing and reasoning about knowledge in such uncertain domains is crucial for building
robust and intelligent systems.

This article explores the various methods and techniques used in AI to represent knowledge in uncertain
domains.

What is an Uncertain Domain in AI?

An uncertain domain in artificial intelligence (AI) refers to a field or environment where the information
available is incomplete, ambiguous, noisy, or inherently unpredictable. Unlike deterministic domains
where outcomes can be predicted with certainty given the inputs, uncertain domains require AI systems
to handle and reason about uncertainty in a structured manner.

Characteristics of Uncertain Domains

1. Incomplete Information: The system does not have access to all the data required to make a fully
informed decision.

2. Ambiguity: Information might be unclear or open to multiple interpretations.

3. Noise: Data might be corrupted or imprecise due to measurement errors or external factors.

4. Stochastic Processes: The environment might involve random processes or events.

Importance of Handling Uncertainty

In many real-world applications, AI systems must operate effectively despite uncertainty. Accurately
representing and reasoning about uncertain information is crucial for making reliable predictions and
decisions. Handling uncertainty enables AI systems to:

 Make informed decisions based on probabilistic reasoning.

 Adapt to new information and changing environments.

 Provide robust and reliable performance in complex scenarios.

Representing Knowledge in an Uncertain Domain

In real-world applications, AI systems frequently encounter incomplete, ambiguous, or noisy information.


Traditional deterministic approaches fall short in such scenarios, necessitating the use of probabilistic and
fuzzy methods to handle uncertainty effectively. These methods enable AI systems to make informed
decisions, predict outcomes, and adapt to changing environments.

1. Probabilistic Reasoning

Probabilistic reasoning involves representing knowledge using probability theory to manage uncertainty.
This approach is widely used in AI for tasks such as diagnosis, prediction, and decision-making under
uncertainty.

Bayesian Networks
Bayesian networks (BNs) are graphical models that represent the probabilistic relationships among a set
of variables. Each node in a BN represents a variable, and the edges represent conditional dependencies.
BNs allow for efficient computation of posterior probabilities given observed evidence.

Example: A Bayesian network for a medical diagnosis system might include nodes for symptoms (fever,
cough) and diseases (flu, pneumonia), with edges indicating the probabilistic dependencies between them.

2. Hidden Markov Models

Hidden Markov Models (HMMs) are used to model time series data where the system being modeled is
assumed to be a Markov process with hidden states. HMMs are widely used in speech recognition,
bioinformatics, and other sequential data applications.

Example: In speech recognition, the observed sound waves are modeled as emissions from hidden phonetic
states, allowing the system to decode spoken language.

3. Markov Decision Processes

Markov Decision Processes (MDPs) provide a framework for modeling decision-making in environments
with stochastic dynamics. MDPs consist of states, actions, transition probabilities, and rewards, enabling
the computation of optimal policies for decision-making.

Example: An autonomous robot navigating a grid world can use an MDP to determine the optimal path to its
destination while accounting for uncertain movements and rewards.

4. Fuzzy Logic

Fuzzy logic is an approach to reasoning that deals with approximate rather than fixed and exact values.
Unlike traditional binary logic, fuzzy logic variables can have a truth value that ranges between 0 and 1,
representing the degree of truth.

Fuzzy Sets and Membership Functions

Fuzzy sets allow for the representation of concepts with vague boundaries. Each element in a fuzzy set has
a membership value indicating its degree of belonging to the set.

Example: In a temperature control system, the concept of “warm” can be represented as a fuzzy set with a
membership function assigning values between 0 (not warm) and 1 (completely warm) to different
temperatures.

Fuzzy Rules and Inference

Fuzzy rules define the relationships between fuzzy variables using if-then statements. Fuzzy inference
systems apply these rules to input data to derive conclusions.

Example: A fuzzy rule for a temperature control system might be: “If the temperature is high, then reduce
the heater power.”

5. Dempster-Shafer Theory

The Dempster-Shafer theory, also known as evidence theory, is a mathematical framework for modeling
uncertainty without the need for precise probabilities. It allows for the combination of evidence from
different sources to calculate the degree of belief (or plausibility) for various hypotheses.

Example: In an expert system for fault diagnosis, evidence from different sensors can be combined using
Dempster-Shafer theory to assess the likelihood of different fault conditions.

6. Belief Networks

Belief networks extend Bayesian networks by allowing for the representation of uncertainty in the
strength of the dependencies between variables. They provide a way to handle imprecise and incomplete
knowledge.
Example: A belief network for an intelligent tutoring system might include nodes for student knowledge,
engagement, and performance, with edges representing uncertain dependencies between these factors.

7. Case-Based Reasoning

Case-based reasoning (CBR) is an approach where past cases (experiences) are used to solve new
problems. In uncertain domains, CBR can be combined with probabilistic methods to estimate the
likelihood of various outcomes based on similar past cases.

Example: A customer support system can use CBR to suggest solutions based on previous similar customer
queries, adjusting recommendations based on the uncertainty of the current context.

Applications of Uncertain Knowledge Representation

1. Medical Diagnosis: Probabilistic models like Bayesian networks are used to diagnose diseases
based on symptoms and medical history.

2. Autonomous Vehicles: Fuzzy logic and MDPs help autonomous vehicles navigate and make
decisions in dynamic environments.

3. Natural Language Processing: HMMs and probabilistic context-free grammars are used for tasks
like speech recognition and language modeling.

4. Robotics: Robots use probabilistic reasoning to handle sensor noise and uncertain environments
for navigation and manipulation tasks.

5. Finance: Probabilistic models are employed for risk assessment, fraud detection, and market
prediction.

Conclusion

Representing knowledge in uncertain domains is a fundamental challenge in AI. Techniques such as


probabilistic reasoning, fuzzy logic, Dempster-Shafer theory, belief networks, and case-based reasoning
provide powerful tools to handle uncertainty. These methods enable AI systems to make informed
decisions, adapt to new information, and perform effectively in complex, real-world environments. By
leveraging these techniques, AI can better manage the inherent uncertainty present in many applications,
leading to more robust and reliable systems.

Reasoning in Artificial intelligence

In previous topics, we have learned various ways of knowledge representation in artificial intelligence.
Now we will learn the various ways to reason on this knowledge using different logical schemes.

Reasoning:

The reasoning is the mental process of deriving logical conclusion and making predictions from available
knowledge, facts, and beliefs. Or we can say, "Reasoning is a way to infer facts from existing data." It is a
general process of thinking rationally, to find valid conclusions.

In artificial intelligence, the reasoning is essential so that the machine can also think rationally as a
human brain, and can perform like a human.

Types of Reasoning

In artificial intelligence, reasoning can be divided into the following categories:

o Deductive reasoning

o Inductive reasoning

o Abductive reasoning

o Common Sense Reasoning


o Monotonic Reasoning

o Non-monotonic Reasoning

Note: Inductive and deductive reasoning are the forms of propositional logic.

1. Deductive reasoning:

Deductive reasoning is deducing new information from logically related known information. It is the form
of valid reasoning, which means the argument's conclusion must be true when the premises are true.

Deductive reasoning is a type of propositional logic in AI, and it requires various rules and facts. It is
sometimes referred to as top-down reasoning, and contradictory to inductive reasoning.

In deductive reasoning, the truth of the premises guarantees the truth of the conclusion.

Deductive reasoning mostly starts from the general premises to the specific conclusion, which can be
explained as below example.

Example:

Premise-1: All the human eats veggies

Premise-2: Suresh is human.

Conclusion: Suresh eats veggies.

The general process of deductive reasoning is given below:

2. Inductive Reasoning:

Inductive reasoning is a form of reasoning to arrive at a conclusion using limited sets of facts by the
process of generalization. It starts with the series of specific facts or data and reaches to a general
statement or conclusion.

Inductive reasoning is a type of propositional logic, which is also known as cause-effect reasoning or
bottom-up reasoning.

In inductive reasoning, we use historical data or various premises to generate a generic rule, for which
premises support the conclusion.

In inductive reasoning, premises provide probable supports to the conclusion, so the truth of premises
does not guarantee the truth of the conclusion.

Example:

Premise: All of the pigeons we have seen in the zoo are white.

Conclusion: Therefore, we can expect all the pigeons to be white.

3. Abductive reasoning:

Abductive reasoning is a form of logical reasoning which starts with single or multiple observations then
seeks to find the most likely explanation or conclusion for the observation.
Abductive reasoning is an extension of deductive reasoning, but in abductive reasoning, the premises do
not guarantee the conclusion.

Example:

Implication: Cricket ground is wet if it is raining

Axiom: Cricket ground is wet.

Conclusion It is raining.

4. Common Sense Reasoning

Common sense reasoning is an informal form of reasoning, which can be gained through experiences.

Common Sense reasoning simulates the human ability to make presumptions about events which occurs
on every day.

It relies on good judgment rather than exact logic and operates on heuristic knowledge and heuristic
rules.

Example:

1. One person can be at one place at a time.

2. If I put my hand in a fire, then it will burn.

The above two statements are the examples of common sense reasoning which a human mind can easily
understand and assume.

5. Monotonic Reasoning:

In monotonic reasoning, once the conclusion is taken, then it will remain the same even if we add some
other information to existing information in our knowledge base. In monotonic reasoning, adding
knowledge does not decrease the set of prepositions that can be derived.

To solve monotonic problems, we can derive the valid conclusion from the available facts only, and it will
not be affected by new facts.

Monotonic reasoning is not useful for the real-time systems, as in real time, facts get changed, so we
cannot use monotonic reasoning.

Monotonic reasoning is used in conventional reasoning systems, and a logic-based system is monotonic.

Any theorem proving is an example of monotonic reasoning.

Example:

o Earth revolves around the Sun.

It is a true fact, and it cannot be changed even if we add another sentence in knowledge base like, "The
moon revolves around the earth" Or "Earth is not round," etc.

Advantages of Monotonic Reasoning:

o In monotonic reasoning, each old proof will always remain valid.

o If we deduce some facts from available facts, then it will remain valid for always.

Disadvantages of Monotonic Reasoning:

o We cannot represent the real world scenarios using Monotonic reasoning.

o Hypothesis knowledge cannot be expressed with monotonic reasoning, which means facts should
be true.
o Since we can only derive conclusions from the old proofs, so new knowledge from the real world
cannot be added.

6. Non-monotonic Reasoning

In Non-monotonic reasoning, some conclusions may be invalidated if we add some more information to
our knowledge base.

Logic will be said as non-monotonic if some conclusions can be invalidated by adding more knowledge
into our knowledge base.

Non-monotonic reasoning deals with incomplete and uncertain models.

"Human perceptions for various things in daily life, "is a general example of non-monotonic reasoning.

Example: Let suppose the knowledge base contains the following knowledge:

o Birds can fly

o Penguins cannot fly

o Pitty is a bird

So from the above sentences, we can conclude that Pitty can fly.

However, if we add one another sentence into knowledge base "Pitty is a penguin", which concludes
"Pitty cannot fly", so it invalidates the above conclusion.

Advantages of Non-monotonic reasoning:

o For real-world systems such as Robot navigation, we can use non-monotonic reasoning.

o In Non-monotonic reasoning, we can choose probabilistic facts or can make assumptions.

Disadvantages of Non-monotonic Reasoning:

o In non-monotonic reasoning, the old facts may be invalidated by adding new sentences.

o It cannot be used for theorem proving.

Probabilistic reasoning in Artificial intelligence

Uncertainty:

Till now, we have learned knowledge representation using first-order logic and propositional logic with
certainty, which means we were sure about the predicates. With this knowledge representation, we might write
A→B, which means if A is true then B is true, but consider a situation where we are not sure about whether A is
true or not then we cannot express this statement, this situation is called uncertainty.

So to represent uncertain knowledge, where we are not sure about the predicates, we need uncertain reasoning or
probabilistic reasoning.

Causes of uncertainty:

Following are some leading causes of uncertainty to occur in the real world.

1. Information occurred from unreliable sources.

2. Experimental Errors

3. Equipment fault

4. Temperature variation

5. Climate change.
Probabilistic reasoning:

Probabilistic reasoning is a way of knowledge representation where we apply the concept of probability to
indicate the uncertainty in knowledge. In probabilistic reasoning, we combine probability theory with logic to
handle the uncertainty.

We use probability in probabilistic reasoning because it provides a way to handle the uncertainty that is the
result of someone's laziness and ignorance.

In the real world, there are lots of scenarios, where the certainty of something is not confirmed, such as "It will
rain today," "behavior of someone for some situations," "A match between two teams or two players." These are
probable sentences for which we can assume that it will happen but not sure about it, so here we use
probabilistic reasoning.

Need of probabilistic reasoning in AI:

o When there are unpredictable outcomes.

o When specifications or possibilities of predicates becomes too large to handle.

o When an unknown error occurs during an experiment.

In probabilistic reasoning, there are two ways to solve problems with uncertain knowledge:

o Bayes' rule

o Bayesian Statistics

Note: We will learn the above two rules in later chapters.

As probabilistic reasoning uses probability and related terms, so before understanding probabilistic reasoning,
let's understand some common terms:

Probability: Probability can be defined as a chance that an uncertain event will occur. It is the numerical
measure of the likelihood that an event will occur. The value of probability always remains between 0 and 1 that
represent ideal uncertainties.

1. 0 ≤ P(A) ≤ 1, where P(A) is the probability of an event A.

1. P(A) = 0, indicates total uncertainty in an event A.

1. P(A) =1, indicates total certainty in an event A.

We can find the probability of an uncertain event by using the below formula.

o P(¬A) = probability of a not happening event.

o P(¬A) + P(A) = 1.

Event: Each possible outcome of a variable is called an event.

Sample space: The collection of all possible events is called sample space.

Random variables: Random variables are used to represent the events and objects in the real world.

Prior probability: The prior probability of an event is probability computed before observing new information.

Posterior Probability: The probability that is calculated after all evidence or information has taken into
account. It is a combination of prior probability and new information.

Conditional probability:
Conditional probability is a probability of occurring an event when another event has already happened.

Let's suppose, we want to calculate the event A when event B has already occurred, "the probability of A under
the conditions of B", it can be written as:

Where P(A⋀B)= Joint probability of a and B

P(B)= Marginal probability of B.

If the probability of A is given and we need to find the probability of B, then it will be given as:

It can be explained by using the below Venn diagram, where B is occurred event, so sample space will be
reduced to set B, and now we can only calculate event A when event B is already occurred by dividing the
probability of P(A⋀B) by P( B ).

Example:

In a class, there are 70% of the students who like English and 40% of the students who likes English and
mathematics, and then what is the percent of students those who like English also like mathematics?

Solution:

Let, A is an event that a student likes Mathematics

B is an event that a student likes English.

Hence, 57% are the students who like English also like Mathematics.

Bayesian Belief Network in artificial intelligence

Bayesian belief network is key computer technology for dealing with probabilistic events and to solve a problem
which has uncertainty. We can define a Bayesian network as:

"A Bayesian network is a probabilistic graphical model which represents a set of variables and their conditional
dependencies using a directed acyclic graph."

It is also called a Bayes network, belief network, decision network, or Bayesian model.

Bayesian networks are probabilistic, because these networks are built from a probability distribution, and also
use probability theory for prediction and anomaly detection.
Real world applications are probabilistic in nature, and to represent the relationship between multiple events, we
need a Bayesian network. It can also be used in various tasks including prediction, anomaly detection,
diagnostics, automated insight, reasoning, time series prediction, and decision making under uncertainty.

Bayesian Network can be used for building models from data and experts opinions, and it consists of two parts:

o Directed Acyclic Graph

o Table of conditional probabilities.

The generalized form of Bayesian network that represents and solve decision problems under uncertain
knowledge is known as an Influence diagram.

A Bayesian network graph is made up of nodes and Arcs (directed links), where:

o Each node corresponds to the random variables, and a variable can be continuous or discrete.

o Arc or directed arrows represent the causal relationship or conditional probabilities between random
variables. These directed links or arrows connect the pair of nodes in the graph.
These links represent that one node directly influence the other node, and if there is no directed link
that means that nodes are independent with each other

o In the above diagram, A, B, C, and D are random variables represented by the nodes of
the network graph.

o If we are considering node B, which is connected with node A by a directed arrow, then
node A is called the parent of Node B.

o Node C is independent of node A.

Note: The Bayesian network graph does not contain any cyclic graph. Hence, it is known as a directed acyclic
graph or DAG.

The Bayesian network has mainly two components:

o Causal Component

o Actual numbers

Each node in the Bayesian network has condition probability distribution P(Xi |Parent(Xi) ), which determines
the effect of the parent on that node.

Bayesian network is based on Joint probability distribution and conditional probability. So let's first understand
the joint probability distribution:

Joint probability distribution:

If we have variables x1, x2, x3,....., xn, then the probabilities of a different combination of x1, x2, x3.. xn, are
known as Joint probability distribution.
P[x1, x2, x3,....., xn], it can be written as the following way in terms of the joint probability distribution.

= P[x1| x2, x3,....., xn]P[x2, x3,....., xn]

= P[x1| x2, x3,....., xn]P[x2|x3,....., xn]....P[xn-1|xn]P[xn].

In general for each variable Xi, we can write the equation as:

P(Xi|Xi-1,........., X1) = P(Xi |Parents(Xi ))

Explanation of Bayesian network:

Let's understand the Bayesian network through an example by creating a directed acyclic graph:

Example: Harry installed a new burglar alarm at his home to detect burglary. The alarm reliably responds at
detecting a burglary but also responds for minor earthquakes. Harry has two neighbors David and Sophia, who
have taken a responsibility to inform Harry at work when they hear the alarm. David always calls Harry when
he hears the alarm, but sometimes he got confused with the phone ringing and calls at that time too. On the other
hand, Sophia likes to listen to high music, so sometimes she misses to hear the alarm. Here we would like to
compute the probability of Burglary Alarm.

Problem:

Calculate the probability that alarm has sounded, but there is neither a burglary, nor an earthquake
occurred, and David and Sophia both called the Harry.

Solution:

o The Bayesian network for the above problem is given below. The network structure is showing that
burglary and earthquake is the parent node of the alarm and directly affecting the probability of alarm's
going off, but David and Sophia's calls depend on alarm probability.

o The network is representing that our assumptions do not directly perceive the burglary and also do not
notice the minor earthquake, and they also not confer before calling.

o The conditional distributions for each node are given as conditional probabilities table or CPT.

o Each row in the CPT must be sum to 1 because all the entries in the table represent an exhaustive set of
cases for the variable.

o In CPT, a boolean variable with k boolean parents contains 2K probabilities. Hence, if there are two
parents, then CPT will contain 4 probability values

List of all events occurring in this network:

o Burglary (B)

o Earthquake(E)

o Alarm(A)

o David Calls(D)

o Sophia calls(S)

We can write the events of problem statement in the form of probability: P[D, S, A, B, E], can rewrite the above
probability statement using joint probability distribution:

P[D, S, A, B, E]= P[D | S, A, B, E]. P[S, A, B, E]

=P[D | S, A, B, E]. P[S | A, B, E]. P[A, B, E]

= P [D| A]. P [ S| A, B, E]. P[ A, B, E]


= P[D | A]. P[ S | A]. P[A| B, E]. P[B, E]

= P[D | A ]. P[S | A]. P[A| B, E]. P[B |E]. P[E]

Let's take the observed probability for the Burglary and earthquake component:

P(B= True) = 0.002, which is the probability of burglary.

P(B= False)= 0.998, which is the probability of no burglary.

P(E= True)= 0.001, which is the probability of a minor earthquake

P(E= False)= 0.999, Which is the probability that an earthquake not occurred.

We can provide the conditional probabilities as per the below tables:

Conditional probability table for Alarm A:

The Conditional probability of Alarm A depends on Burglar and earthquake:

B E P(A= True) P(A= False)

True True 0.94 0.06

True False 0.95 0.04

False True 0.31 0.69

False False 0.001 0.999

Conditional probability table for David Calls:

The Conditional probability of David that he will call depends on the probability of Alarm.

A P(D= True) P(D= False)

True 0.91 0.09

False 0.05 0.95

Conditional probability table for Sophia Calls:

The Conditional probability of Sophia that she calls is depending on its Parent Node "Alarm."
A P(S= True) P(S= False)

True 0.75 0.25

False 0.02 0.98

From the formula of joint distribution, we can write the problem statement in the form of probability
distribution:

P(S, D, A, ¬B, ¬E) = P (S|A) *P (D|A)*P (A|¬B ^ ¬E) *P (¬B) *P (¬E).

= 0.75* 0.91* 0.001* 0.998*0.999

= 0.00068045.

Hence, a Bayesian network can answer any query about the domain by using Joint distribution.

The semantics of Bayesian Network:

There are two ways to understand the semantics of the Bayesian network, which is given below:

1. To understand the network as the representation of the Joint probability distribution.

It is helpful to understand how to construct the network.

2. To understand the network as an encoding of a collection of conditional independence statements.

It is helpful in designing inference procedure.

You might also like