0% found this document useful (0 votes)
42 views46 pages

Ai Notes Unit II

The document discusses knowledge representation and reasoning (KRR) in artificial intelligence, emphasizing its role in enabling machines to understand and solve real-world problems. It covers various types of knowledge, challenges in knowledge representation, applications in AI, and approaches to effectively represent knowledge. Key components include declarative and procedural knowledge, logical representation, and the importance of knowledge in demonstrating intelligent behavior.
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)
42 views46 pages

Ai Notes Unit II

The document discusses knowledge representation and reasoning (KRR) in artificial intelligence, emphasizing its role in enabling machines to understand and solve real-world problems. It covers various types of knowledge, challenges in knowledge representation, applications in AI, and approaches to effectively represent knowledge. Key components include declarative and procedural knowledge, logical representation, and the importance of knowledge in demonstrating intelligent behavior.
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/ 46

Unit – II

UNIT-II
Knowledge representation issues, mapping, frame problem
Predicate logic, facts in logic
Representing instance and Isa relationship
Resolution, procedural and declarative knowledge
Matching, control knowledge
Symbolic reasoning under uncertainty
Non-monotonic reasoning, statistical reasoning.

Topic: Introduction to 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.
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.
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 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. Following are the types of knowledge in artificial intelligence:

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.

This type of knowledge refers to facts or statements that describe the world, often in
the form of “knowing what.” It is static and doesn’t involve actions or procedures.
Example: “Paris is the capital of France” is a piece of declarative knowledge.
o

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.

Procedural knowledge describes “how” to perform tasks or solve problems. It is


dynamic and action-oriented, focusing on processes and methods.
Example: Knowing how to solve a mathematical equation or how to bake a cake are
examples of procedural knowledge.

3. Meta-knowledge:

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


Meta knowledge is knowledge about knowledge. It refers to understanding which
knowledge to use in a particular situation or context.
Example: In a medical diagnostic system, knowing which symptoms to prioritize when
diagnosing a disease is an example of 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.

 Heuristic knowledge consists of experience-based rules of thumb or best practices that help
in making decisions quickly without complete information.
 Example: A heuristic might be “If a website loads slowly, refresh the page” — it’s not
always guaranteed to work, but it’s often useful.
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.
This type of knowledge deals with the relationships between entities or concepts,
organizing knowledge into structures like hierarchies or networks.

Example: Understanding that a dog is a type of animal and a poodle is a type of dog
reflects structural knowledge.

Topic: Challenges in Knowledge Representation


While knowledge representation is fundamental to AI, it comes with several challenges:
1. Complexity: Representing all possible knowledge about a domain can be highly complex,
requiring sophisticated methods to manage and process this information efficiently.

2. Ambiguity and Vagueness: Human language and concepts are often ambiguous or vague,
making it difficult to create precise representations.

3. Scalability: As the amount of knowledge grows, AI systems must scale accordingly, which
can be challenging both in terms of storage and processing power.
4. Knowledge Acquisition: Gathering and encoding knowledge into a machine-readable format
is a significant hurdle, particularly in dynamic or specialized domains.

5. Reasoning and Inference: AI systems must not only store knowledge but also use it to infer
new information, make decisions, and solve problems. This requires sophisticated reasoning
algorithms that can operate efficiently over large knowledge bases.

Topic: Applications of Knowledge Representation in AI


Knowledge representation is applied across various domains in AI, enabling systems to perform
tasks that require human-like understanding and reasoning. Some notable applications include:

1. Expert Systems: These systems use knowledge representation to provide advice or make
decisions in specific domains, such as medical diagnosis or financial planning.

2. Natural Language Processing (NLP): Knowledge representation is used to understand and


generate human language, enabling applications like chatbots, translation systems, and
sentiment analysis.

3. Robotics: Robots use knowledge representation to navigate, interact with environments, and
perform tasks autonomously.

4. Semantic Web: The Semantic Web relies on ontologies and other knowledge representation
techniques to enable machines to understand and process web content meaningfully.

5. Cognitive Computing: Systems like IBM's Watson use knowledge representation to process
vast amounts of information, reason about it, and provide insights in fields like healthcare
and research.

Topic: 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 given
below:

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;

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

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.
Topic: Requirements for knowledge Representation system:

A good knowledge representation system must possess the following properties.

1.RepresentationalAccuracy:
KR system should have the ability to represent all kind of required
knowledge.
2.InferentialAdequacy:
KR system should have ability to manipulate the representational structures to
produce new knowledge corresponding to existing structure.
3.InferentialEfficiency:
The ability to direct the inferential knowledge mechanism into the most
productive directions by storing appropriate guides.
4. Acquisitional efficiency- The ability to acquire the new knowledge easily
using automatic methods.

Topic: Types of Knowledge Representation

There are mainly four ways of knowledge representation which are given as follows:

1. Logical Representation
2. Semantic Network Representation
3. Frame Representation
4. Production Rules
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.

Syntax:

o Syntaxes are the rules which decide how we can construct legal sentences in the logic.
o It determines which symbol we can use in knowledge representation.
o How to write those symbols.

Semantics:

o Semantics are the rules by which we can interpret the sentence in the logic.
o Semantic also involves assigning a meaning to each sentence.

Logical representation can be categorised into mainly two logics:

 Propositional Logic
 Predicate logics

Predicate logic
What is Predicate Logic in Artificial Intelligence?
Predicate logic, also known as first-order logic (FOL), is an extension of propositional logic that allows us
to express relationships between objects and their properties. In AI, predicate logic is widely used to
represent knowledge and perform reasoning in more complex scenarios where relationships matter.
Unlike propositional logic, which deals with simple true/false statements, predicate logic
introduces predicates, variables, constants, and quantifiers. These elements help in modelling real-world
problems that involve multiple objects and their interactions.
Role of Predicate Logic in AI
 Knowledge Representation: It provides a structure for representing complex facts about objects and their
relationships in a system.
 Reasoning: AI systems use predicate logic to infer new information from existing facts, making it suitable
for decision-making tasks.
Example:
 “John is the father of Mary” can be represented as: Father(John,Mary)Father(John, Mary)Father(John,Mary)
This expression tells us that there is a relationship (Father) between two objects (John and Mary). Predicate
logic enables us to model and reason about such relationships effectively.
Components of Predicate Logic:
Predicate logic involves several key components that allow it to represent relationships and properties of
objects in a structured way.
1. Predicates:
A predicate is a function that returns either true or false based on the relationship between its arguments.
Example: IsHungry(John)IsHungry(John)IsHungry(John) This predicate represents whether John is hungry,
returning true if he is and false if not.
2. Variables:
Variables are placeholders for objects within a domain. They allow us to represent general statements that apply to
multiple objects.
Example: In IsHungry(x), the variable x can represent any person.
3.Constants:
Constants represent specific objects or entities in the domain.
Example: John is a constant in the predicate IsHungry(John).

4.Structure of Predicates
Predicate consists of two key elements: the predicate symbol and arguments. Predicates are enhanced
with quantifiers to specify the scope of variables involved.
1. Predicate Symbol
The predicate symbol defines the property or relationship being described.
Example:
IsHungry(x) represents whether a person (x) is hungry.
Married(x, y) denotes that person x is married to person y.
Predicates are named based on the relationship or property they represent. The symbol is followed
by arguments enclosed in parentheses.
2. Arguments and Arity
Arguments refer to the specific objects that the predicate is applied to.
The arity of a predicate refers to the number of arguments it takes.
Examples:
IsHungry(x): A predicate with 1 argument (arity = 1).
Married(x, y): A predicate with 2 arguments (arity = 2).
X(a, b, c): A predicate with 3 arguments (arity = 3), representing something like “a + b + c = 0.”
3. Quantifiers in Predicate Logic
Quantifiers allow us to specify the scope of variables. There are two main types:
1. Existential Quantifier ( ∃ )
 Meaning: There exists at least one object that satisfies the given condition.
 Example: ∃x IsHungry(x)
This statement means that at least one person is hungry.
 Negation: The negation of the existential quantifier means that no such object exists.
¬∃x IsHungry(x)
This means that no one is hungry.
2. Universal Quantifier ( ∀ )
 Meaning: The given condition holds for all objects in the domain.
 Example: ∀x (IsHuman(x)→IsMortal(x))
This means that all humans are mortal.
 Negation: The negation of the universal quantifier means there is at least one exception.
¬∀x IsHuman(x)→IsMortal(x)
This implies that at least one human is not mortal.

Examples of Predicate Logic


1. Simple Predicate Example:
 Predicate: IsHungry(John)
 Meaning: This predicate represents the state of whether John is hungry. It takes one argument (John)
and returns true if John is hungry, otherwise false.
 Application in AI:
 In NLP-based chatbots, predicates like this could help infer the user’s intent. For example, if a
chatbot detects that the user is hungry, it could suggest nearby restaurants.
2. Equality Predicate Example:
 Predicate: E(x,y)≡(x=y)
 Meaning: This predicate denotes that x is equal to y. It returns true if the two objects are identical.
 Application in AI:
 AI-based reasoning systems use equality predicates to match objects. For example, in a robot
warehouse, a robot may use this predicate to determine if an object picked matches the one requested
(e.g., E(Package1, RequestedItem)).
3. Mathematical Predicate Example:
 Predicate: X(a,b,c)≡(a+b+c=0)
 Meaning: This predicate checks whether the sum of a, b, and c equals zero. It returns true if the
equation holds, otherwise false.
 Application in AI:
 In optimization problems, AI models might use mathematical predicates to check if constraints are
satisfied. For example, in scheduling systems, such predicates can validate if certain conditions are
met (e.g., X(shiftA, shiftB, totalTime) checks if the total shift hours are balanced).
4. Relationship Predicate Example:
 Predicate: M(x,y)≡x is married to y
 Meaning: This predicate expresses a relationship between two objects, indicating that x is married
to y.
 Application in AI:
 In family tree AI systems, relationship predicates are used to infer relationships among family
members. For instance, if M(John, Mary) is true, the system can infer that John is Mary’s spouse.
5. Universal Quantification Example:
 Expression: ∀x (IsHuman(x)→IsMortal(x))
 Meaning: This statement reads as “For all x, if x is human, then x is mortal.” It applies to every
object in the domain of humans. If an object is found to be human, it must also be mortal for the
statement to hold true.
 Application in AI:
 Knowledge-based systems use such rules to infer properties about objects. For example, in medical
diagnosis systems, rules like “All viruses can spread infections” (∀x IsVirus(x) →
CanSpreadInfection(x)) help the system reason about diseases.
6. Existential Quantification Example:
 Expression: ∃x IsHungry(x)
 Meaning: This reads as “There exists at least one x such that x is hungry.” It indicates that at least
one object in the domain satisfies the condition of being hungry.
 Application in AI:
 In robot planning, a robot could use existential quantifiers to plan actions. For example, “There
exists a task that requires charging” (∃x TaskRequires(x, Charging)) might guide the robot to
prioritize charging tasks.
7. Compound Example with Multiple Quantifiers:
 Expression: ∀x∃y (Parent(x,y))
 Meaning: This statement means “For every person x, there exists a person y such that x is the parent
of y.” It shows how multiple quantifiers can be used together to represent complex relationships.
 Application in AI:
 This logic is often used in social network AI models to analyze relationships. In a family tree
system, the model could use such logic to infer relationships between family members.
Propositions with Multiple Quantifiers
In predicate logic, multiple quantifiers can be used within a single proposition to express more complex
ideas. The order of quantifiers is crucial, as it can change the meaning of the statement.
Example 1: Order of Quantifiers Matters
∀x∃y (Parent(x,y))
 Meaning: For every person x, there exists at least one person y such that x is the parent of y.
 Example in AI: In a family tree system, this could represent the rule that every parent must have at least one
child.
Now, let’s reverse the quantifiers:
∃y∀x (Parent(x,y))
 Meaning: There exists a person y such that every person x is the parent of y.
 Interpretation: This is logically impossible under normal circumstances, as a single person cannot have all
people as parents.
Example 2: Nested Quantifiers in AI
∀x∃y (RobotCanPerform(x,y))
 Meaning: For every task x, there exists a robot y that can perform the task.
 AI Application: This could represent a rule in a robot planning system, where every task must have at least
one robot capable of completing it.
Now, consider the reversed version:
∃y∀x (RobotCanPerform(x,y))
 Meaning: There exists a robot y that can perform every task x.
 AI Application: This would imply that a single robot can perform all tasks, which may not always be
practical.
Impact of Quantifier Order on Meaning
As seen in the examples above, changing the order of quantifiers can completely change the meaning of a
proposition. In AI systems, it’s essential to use the correct order of quantifiers to ensure that logical
statements align with the desired behavior or knowledge representation.
Knowledge Representation using Predicate Logic in AI
Knowledge representation is a critical part of AI, enabling systems to store, reason, and derive new
facts from existing information. Predicate logic offers a structured way to represent complex
relationships, facts, and rules in a logical and understandable format.
How Predicate Logic Helps in Knowledge Representation
1. Representing Relationships Between Objects:
 Example: Married(John,Mary)
 This expression indicates that John is married to Mary. Predicate logic captures such binary
relationships between objects, helping AI systems understand connections.
2. Storing Rules in Knowledge Bases:
 Rules can be defined using predicates and quantifiers.
 Example: ∀x (IsHuman(x)→IsMortal(x)) This rule states that all humans are mortal. AI systems
can store these rules and apply them during reasoning.
3. Handling Multiple Entities and Properties:
 AI systems can store complex information by using predicates with multiple arguments.
 Example: Parent(John,Mary)∧Sibling(Mary,Kate) This expresses that John is Mary’s parent and
Mary is Kate’s sibling.
4. Reasoning and Inference:
 AI systems can use inference rules to derive new facts from stored knowledge.
 Example: If the system knows that: ∀x (Parent(John,x)→Loves(John,x)) It can infer that John loves
all his children.
Examples of AI Applications Using Predicate Logic
 Natural Language Processing (NLP): NLP systems use predicate logic to understand relationships in text
and answer complex queries. For example, in a chatbot, predicate logic helps infer the user’s intent.
 Robot Planning Systems: In a warehouse, robots use predicate logic to plan tasks based on conditions like:

∃x TaskRequires(x,Charging)

This ensures robots prioritize tasks that require charging.


 Expert Systems:
Predicate logic is used in expert systems (like medical diagnosis tools) to store if-then rules and infer new
facts about diseases based on symptoms.
Example:
Consider the following statements:

1. All doctors who specialize in Cardiology are knowledgeable.


2. Some knowledgeable people also write medical research papers.
3. Dr. Smith is a doctor who specializes in Cardiology.
Represent these statements using predicate logic and answer the following:
1. Prove that Dr. Smith is knowledgeable.
2. Is it necessarily true that Dr. Smith writes medical research papers? Justify your
answer using predicate logic.

Solution:
Let's convert the given statements into predicate logic:
Propositional Logics

What is Propositional Logic in Artificial Intelligence?


Propositional Logic (PL) is a branch of logic that focuses on statements (propositions) that can be either
true or false. It is also known as Boolean logic since the truth values are binary—either True
(1) or False (0).
In AI, propositional logic forms the foundation for logical reasoning, allowing systems to
represent facts and rules about a problem domain. These rules help the system infer new information or
make decisions based on the given inputs.
Propositional logic simplifies knowledge representation by breaking down reasoning into atomic
statements or propositions. For example, an AI system used in home automation might have
propositions such as:
 P: “The light is on.”
 Q: “The window is open.”
Using logical connectives, the system can combine these propositions to represent more complex
statements like:
“If the light is on and the window is open, turn off the light.”
By using propositional logic, AI systems can reason effectively and perform tasks like automated
decision-making, knowledge representation, and game playing.
Basic Facts About Propositional Logic
1. Propositions are Declarative Statements:
 In propositional logic, each statement, known as a proposition, is either True or False.
Example:
 P: “It is raining.” (True or False)
 Q: “The heater is on.” (True or False)
2. Atomic Propositions:
 These are simple, indivisible statements that cannot be broken down further. Each atomic proposition
represents a basic fact or condition.
Example: “The door is closed.”
3. Compound Propositions:
 Multiple atomic propositions can be combined using logical connectives (like AND, OR, NOT) to
create compound propositions.
Example: “The door is closed AND the heater is on.”
4. Binary Truth Values:
 Every proposition has a binary truth value: it can only be True (1) or False (0). There are no intermediate
states. This simplicity makes propositional logic ideal for clear-cut decisions.
5. Logical Connectives Combine Propositions:
 Logical connectives such as AND, OR, NOT, IF-THEN, and IF AND ONLY IF allow us to create more
complex propositions from simple ones.
Syntax of Propositional Logic
The syntax of propositional logic defines the rules for creating valid propositions. In propositional logic,
we combine atomic propositions using logical connectives to form more complex statements, known
as compound propositions.
Building Blocks of Propositional Logic Syntax
1. Atomic Propositions:
 These are basic statements that represent individual facts or conditions.
Example:
 P: “It is raining.”
 Q: “The heater is on.”
2. Logical Connectives:
 Connectives are used to combine atomic propositions to form compound propositions.
 AND ( ∧ ): True if both propositions are true.
 OR ( ∨ ): True if at least one proposition is true.
 NOT ( ¬ ): Negates the truth value of a proposition.
 IF-THEN ( → ): True unless the first proposition is true and the second is false.
 IF AND ONLY IF ( ↔ ): True if both propositions have the same truth value.
3. Compound Propositions:
 These are more complex statements formed by connecting atomic propositions using logical
connectives.
Example:
 “If it is raining and the heater is on, then the room will be warm.”
This can be written in propositional logic syntax as: (P∧Q)→R
Where:
 P: “It is raining.”
 Q: “The heater is on.”
 R: “The room is warm.”
Example of Propositional Logic
Let’s explore a real-world scenario where propositional logic is applied in AI. Consider a home
automation system that needs to decide whether to turn on the air conditioner based on the weather
conditions and indoor temperature.
Scenario:
 P: “It is hot outside.”
 Q: “The windows are open.”
 R: “Turn on the air conditioner.”
Using propositional logic, we can represent the system’s decision-making with the following compound
proposition:

(P∧¬Q)→R
This logic reads as:
“If it is hot outside AND the windows are not open, then turn on the air conditioner.”
Explanation of the Logic:
 AND ( ∧ ) ensures that both conditions must be true (hot outside and windows closed) for the air
conditioner to turn on.
 NOT ( ¬ ) negates the condition, meaning the windows must be closed.
 IF-THEN ( → ) states that if the first part is true, the second part (turning on the AC) will follow.
Logical Connectives in Propositional Logic
Connective Symbo Meaning Example
l
AND ∧ True if both propositions (P ∧ Q): “It is raining
are true. AND cold.”
OR ∨ True if at least one (P ∨ Q): “It is raining
proposition is true. OR cold.”
NOT ¬ Negates the truth value of ¬P: “It is not raining.”
a proposition.
IF-THEN → True unless the first is (P → Q): “If it rains,
true and second is then it will flood.”
false.
IF AND ↔ True if both propositions (P ↔ Q): “It rains if
ONLY are either true or and only if it is
IF false. cloudy.”
Logical connectives are essential operators that combine atomic propositions to form compound
propositions. These connectives allow AI systems to build more complex rules and perform logical
reasoning. Below are the most common connectives used in propositional logic:
Common Logical Connectives
These connectives allow us to create logical rules that AI systems can use to make decisions. Let’s take a
quick look at how each works:
1. AND ( ∧ ):
 The result is True only if both propositions are true.
Example: If P is “It is hot” and Q is “The fan is on”, then (P ∧ Q) means both conditions are
satisfied.
2. OR ( ∨ ):
 The result is True if at least one of the propositions is true.
Example: (P ∨ Q) will be true if either it is hot or the fan is on.
3. NOT ( ¬ ):
 This inverts the truth value of the proposition.
Example: If P is true, ¬P will be false.
4. IF-THEN ( → ):
 This implies that if the first proposition is true, the second must also be true for the compound
statement to be true.
Example: “If it rains, then the ground will be wet” (P → Q).
5. IF AND ONLY IF (↔ ):
 This is true only when both propositions have the same truth value (either both true or both false).
Example: “It is cloudy if and only if it will rain” (P ↔ Q).
Truth Table
A truth table is a useful tool for determining the truth value of a compound proposition based on the truth
values of its atomic propositions. It systematically lists all possible combinations of truth values and the
corresponding output for a given logical expression.
How Truth Tables Work
Let’s consider two propositions:
 P: “It is raining.”
 Q: “The ground is wet.”
We can build a truth table to evaluate the compound proposition P ∧ Q (It is raining AND the ground is
wet).

P Q P∧Q
TRUE TRUE TRUE
TRUE FALSE FALSE
FALSE TRUE FALSE
FALSE FALSE FALSE

 The result of P ∧ Q is True only when both P and Q are True.


Truth Table with Three Propositions
Let’s extend the concept to three propositions:
 P: “It is hot.”
 Q: “The air conditioner is on.”
 R: “The windows are closed.”
We can create a truth table for the compound proposition (P ∨ Q) ∧ R (It is hot OR the air conditioner is
on, AND the windows are closed).
P Q R (P ∨ Q) ∧ R
TRUE TRUE TRUE TRUE
TRUE TRUE FALSE FALSE
TRUE FALSE TRUE TRUE
TRUE FALSE FALSE FALSE
FALSE TRUE TRUE TRUE
FALSE TRUE FALSE FALSE
FALSE FALSE TRUE FALSE
FALSE FALSE FALSE FALSE
Purpose of Truth Tables
 Truth tables help in evaluating the outcomes of complex logical expressions.
 They ensure correct reasoning by listing all possibilities, making them a vital tool for AI systems that rely
on logical reasoning.
Precedence of Connectives in Propositional Logic
When evaluating compound propositions with multiple logical connectives, it’s important to follow a
specific order of precedence to ensure accurate results. Similar to arithmetic operations, logical
operators are evaluated in a defined sequence, from highest to lowest precedence.
Order of Precedence
1. NOT ( ¬ ) – Negation has the highest precedence and is evaluated first.
2. AND ( ∧ ) – Conjunction is evaluated next, after negations are resolved.
3. OR ( ∨ ) – Disjunction comes after AND operations.
4. IF-THEN ( → ) – Implication is evaluated after OR.
5. IF AND ONLY IF ( ↔ ) – Biconditional has the lowest precedence.
Example: Precedence in Action
Consider the following logical expression:
¬P∨(Q∧R)
 Step 1: Evaluate ¬P (Negation).
 Step 2: Evaluate Q ∧ R (AND).
 Step 3: Evaluate ¬P ∨ (Q ∧ R) (OR).
The final result depends on the proper evaluation order, ensuring the correct outcome.
Using Parentheses for Clarity
To avoid ambiguity, it’s good practice to use parentheses in complex expressions. For example:
(P∨Q)→R
In this case, (P ∨ Q) is evaluated first, followed by the implication →
Logical Equivalence in Propositional Logic
Logical equivalence occurs when two or more logical expressions produce the same truth values for all
possible combinations of their propositions. In other words, two statements are logically equivalent if
they always have the same result, regardless of the truth values of the individual propositions.
Definition of Logical Equivalence
Two propositions P and Q are logically equivalent if:
P≡Q
This means that both P and Q yield identical truth values for all possible cases. Logical equivalence allows
AI systems to simplify complex expressions without changing their meaning.
Example of Logical Equivalence
1. De Morgan’s Laws:
 These laws show how negations of conjunctions and disjunctions behave:
¬(P∧Q) ≡(¬P∨¬Q)
¬(P∨Q) ≡(¬P∧¬Q)
2. Double Negation:
 Negating a negation gives the original proposition:
¬(¬P) ≡P
3. Implication and Disjunction:
 An implication can be rewritten as:
P→Q≡¬P∨Q
Tautologies and Contradictions
 Tautology:A tautology is a statement that is always true, no matter the truth values of its individual
propositions.
 Example: P∨¬P≡True
 Contradiction: A contradiction is a statement that is always false.
 Example: P∧¬P≡False
Properties of Operators in Propositional Logic
In propositional logic, logical operators follow specific properties that allow us to manipulate and
simplify logical expressions. Understanding these properties is essential for building efficient AI
systems that rely on logical reasoning.
1. De Morgan’s Laws
These laws describe how negations distribute over AND ( ∧ ) and OR ( ∨ ) operations:
 First Law:
 ¬(P∧Q)≡(¬P∨¬Q)
This means that the negation of a conjunction is equivalent to the disjunction of the negated propositions.
 Second Law:
 ¬(P∨Q)≡(¬P∧¬Q)
This means that the negation of a disjunction is equivalent to the conjunction of the negated propositions.
2. Commutative Property
This property states that the order of the propositions does not affect the result of AND ( ∧ ) and OR (
∨ ) operations:
 AND:
 P∧Q≡Q∧P
 OR:
 P∨Q≡Q∨P
3. Associative Property
This property allows us to group propositions in any order when using AND or OR operations:
 AND:
 (P∧Q)∧R≡P∧(Q∧R)
 OR:
 (P∨Q)∨R≡P∨(Q∨R)
4. Distributive Property
This property states that AND distributes over OR, and vice versa:
 AND over OR:
 P∧(Q∨R)≡(P∧Q)∨(P∧R)P
 OR over AND:
 P∨(Q∧R)≡(P∨Q)∧(P∨R)

Applications of Propositional Logic in AI


1. Knowledge Representation in Expert Systems:
 Represents rules and facts to solve domain-specific problems (e.g., medical diagnosis systems).
2. Reasoning and Decision-Making:
 AI agents use logical rules to make decisions (e.g., robot vacuum cleaners deciding when to start cleaning).
3. Natural Language Processing (NLP):
 Helps analyze text and respond logically (e.g., chatbots understanding weather-related queries).
4. Game-Playing AI:
 Uses logic to make strategic moves (e.g., deciding checkmate in chess).
Limitations of Propositional Logic
1. Inability to Handle Complex Relationships
 Propositional logic cannot represent relationships between multiple objects or deal with hierarchies of
information.
2. No Handling of Uncertainty
 It works only with true or false values and cannot deal with probabilities or uncertain outcomes, limiting
its use in real-world applications involving incomplete data.
3. Limited Expressiveness
 It cannot represent time-based sequences or dynamic events, which are crucial in some AI systems like
speech recognition and robotics.
4. Scalability Issues
 As the number of propositions grows, the complexity of expressions increases, making reasoning slower
and harder to manage.
Advantages of logical representation:
1. Logical representation enables us to do logical reasoning.
2. Logical representation is the basis for the programming languages.

Disadvantages of logical Representation:

1. Logical representations have some restrictions and are challenging to work with.
2. Logical representation technique may not be very natural, and inference may
not be so efficient.

2. Semantic Network 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.

This representation consist of mainly two types of relations:

a. IS-A relation

(Inheritance) b.Kind-of-

relation

Example: Following are some statements which we need to represent in the


form of nodes and arcs.

Statements:

a. Jerry is a cat.
b. Jerry is a mammal

c. Jerry is owned by Priya.

d. Jerry is white colored.

e. All Mammals are animal.


In the above diagram, we have represented the different type of knowledge
in the form of nodes and arcs. Each object is connected with another object
by some relation.

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.

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.

3. Frame Representation
A frame is a record like structure which consists of a collection of attributes
and its values to describe an entity in the world. Frames are the AI data
structure which divides knowledge into substructures by representing
stereotypes situations. It consists of a collection of slots and slot values.
These slots may be of any type and sizes. Slots have names and values
which are called facets.

Facets: The various aspects of a slot is known as Facets. Facets are


features of frames which enable us to put constraints on the frames.
Example: IF-NEEDED facts are called when data of any particular slot is
needed. A frame may consist of any number of slots, and a slot may include
any number of facets and facets may have any number of values. A frame is
also known as slot-filter knowledge representation in artificial
intelligence.
Frames are derived from semantic networks and later evolved into our
modern-day classes and objects. A single frame is not much useful. Frames
system consist of a collection of frames which are connected. In the frame,
knowledge about an object or event can be stored together in the knowledge
base. The frame is a type of technology which is widely used in various
applications including Natural language processing and machine visions.

Example: 1
Let's take an example of a frame for a book

Slots Filters

Title Artificial Intelligence

Genre Computer Science

Author Peter Norvig

Edition Third Edition

Year 1996

Page 1152
Example 2:
Let's suppose we are taking an entity, Peter. Peter is a doctor as a
profession, and his age is 25, he lives in city London, and the country is
England. So following is the frame representation for this:

Slots Filter

Name Peter

Profession Doctor

Age 25

Marital status Single

Weight 78
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.
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.
4. Production Rules
Production rules system consist of (condition, action) pairs which mean, "If
condition then action". It has mainly three parts:

o The set of production rules


o Working Memory
o The recognize-act-cycle

In production rules agent checks for the condition and if the condition exists then production rule fires and
corresponding action is carried out. The condition part of the rule determines which rule may be applied
to a problem. And the action part carries out the associated problem-solving steps. This complete
process is called a recognize-act cycle.

The working memory contains the description of the current state of problems-
solving and rule can write knowledge to the working memory. This
knowledge match and may fire other rules.

If there is a new situation (state) generates, then multiple production rules will
be fired together, this is called conflict set. In this situation, the agent needs
to select a rule from these sets, and it is called a conflict resolution.

Example:

o IF (at bus stop AND bus arrives) THEN action (get into the bus)
o IF (on the bus AND paid AND empty seat) THEN action (sit down).
o IF (on bus AND unpaid) THEN action (pay charges).
o IF (bus arrives at destination) THEN action (get down from the bus).

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.

Resolution in First Order Logic


Example 2
Monotonic Reasoning
Monotonic Reasoning is the process that does not change its direction or can say
that it moves in the one direction.
 Monotonic Reasoning will move in the same direction continuously means it will either
move in increasing order or decrease.
 But since Monotonic Reasoning depends on knowledge and facts, It will only increase and
will never decrease in this reasoning.
 Example:
o Sun rises in the East and sets in the West.
Non-monotonic Reasoning

Non-monotonic Reasoning is the process that changes its direction or values as the
knowledge base increases.
 It is also known as NMR in Artificial Intelligence.
 Non-monotonic Reasoning will increase or decrease based on the condition.
 Since that Non-monotonic Reasoning depends on assumptions, It will change itself with
improving knowledge or facts.
 Example:
o Consider a bowl of water, If we put it on the stove and turn the flame on it will
obviously boil hot and as we will turn off the flame it will cool down gradually.

Statistical reasoning in AI is a critical component that underpins the ability of


algorithms to learn from data. It involves the application of statistical principles to
interpret and analyze data, enabling AI systems to make informed decisions based on
patterns and trends.

You might also like