0% found this document useful (0 votes)
155 views

Chapter 4-Knowledge and Reasoning

This document discusses knowledge-based agents and knowledge representation in artificial intelligence. It covers the following key points: - Knowledge-based agents maintain an internal knowledge base that represents knowledge about their environment. They can accept new tasks, learn new knowledge quickly, and adapt to changes by updating their knowledge base. - The central component is the knowledge base, which contains sentences in a knowledge representation language that represent assertions about the world. The knowledge base can be queried and updated with new information. - Propositional logic uses symbolic variables to represent logical statements that are either true or false. Predicate logic builds on this by adding objects, relations, and functions to represent more complex statements. - Quantifiers like

Uploaded by

Seyo Kasaye
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
155 views

Chapter 4-Knowledge and Reasoning

This document discusses knowledge-based agents and knowledge representation in artificial intelligence. It covers the following key points: - Knowledge-based agents maintain an internal knowledge base that represents knowledge about their environment. They can accept new tasks, learn new knowledge quickly, and adapt to changes by updating their knowledge base. - The central component is the knowledge base, which contains sentences in a knowledge representation language that represent assertions about the world. The knowledge base can be queried and updated with new information. - Propositional logic uses symbolic variables to represent logical statements that are either true or false. Predicate logic builds on this by adding objects, relations, and functions to represent more complex statements. - Quantifiers like

Uploaded by

Seyo Kasaye
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 10

Chapter 4 – Knowledge and Reasoning

4.1. Logical Agents


The intelligence of humans is achieved—not by purely reflex mechanisms but by processes of
reasoning that operate on internal representations of knowledge. In AI, this approach to intelligence
is embodied in knowledge-based agents. Knowledge-based agents can accept new tasks in the form
of explicitly described goals; they can achieve competence quickly by being told or learning new
knowledge about the environment; and they can adapt to changes in the environment by updating
the relevant knowledge.

The central component of a knowledge-based agent is its knowledge base, or KB. A knowledge base is
a set of sentences expressed in a language called a knowledge representation language and
represents some assertion about the world. Sometimes we dignify a sentence with the name axiom,
when the sentence is taken as given without being derived from other sentences.

There must be a way to add new sentences to the knowledge base and a way to query what is known.
The standard names for these operations are TELL and ASK, respectively. Both operations may involve
inference—that is, deriving new sentences from old. Inference must obey the requirement that when
one ASKs a question of the knowledge base, the answer should follow from what has been told (or
TELLed) to the knowledge base previously.

Knowledge-based agent program takes a percept as input and returns an action. The agent maintains
a knowledge base, KB, which may initially contain some background knowledge. Each time the agent
program is called, it does three things.
 First, it TELLs the knowledge base what it perceives.
 Second, it ASKs the knowledge base what action it should perform.
 Third, the agent program TELLs the knowledge base which action was chosen, and the agent
executes the action.

The details of the representation language are hidden inside three functions that implement the
interface between the sensors and actuators on one side and the core representation and reasoning
system on the other.
 MAKE-PERCEPT-SENTENCE constructs a sentence asserting that the agent perceived the given
percept at the given time.
 MAKE-ACTION-QUERY constructs a sentence that asks what action should be done at the
current time.
 MAKE-ACTION-SENTENCE constructs a sentence asserting that the chosen action was
executed.

Knowledge base sentences are expressed according to the syntax of the representation language,
which specifies all the sentences that are well formed.

Example: “x + y = 4” is a well-formed sentence, whereas “x4y+ =” is not.

A logic defines the semantics or meaning of sentences. The semantics defines the truth of each
sentence with respect to each possible world. When we need to be precise, we use the term
model in place of “possible world.” For example, the sentence x + y =4 is true when there are four
possible assignments of real numbers to the variables x and y. If a sentence α is true in model m,
we say that m satisfies α or sometimes m is a model of α. We use the notation M(α) to mean the
set of all models of α.

Logical reasoning involves the relation of logical entailment between sentences—the idea that a
sentence follows logically from another sentence. The formal definition of entailment is this: α ⊧ β
if and only if, in every model in which α is true, β is also true. Using the notation just introduced,
we can write α ⊧ β if and only if M(α) ⊆ M(β).
Example: the sentence x = 0 entails the sentence xy = 0.
4.2. Propositional Logic
Propositional logic (PL) is the simplest form of logic where all the statements are made by
propositions. A proposition is a declarative statement which is either true or false. It is a technique of
knowledge representation in logical and mathematical form.

Propositional logic is also called Boolean logic as it works on 0 and 1. In propositional logic, we use
symbolic variables to represent the logic, and we can use any symbol for representing a proposition,
such as A, B, C, P, Q, R, etc. Propositions can be either true or false, but it cannot be both.
Propositional logic consists of an object, relations or function, and logical connectives. These
connectives are also called logical operators. The propositions and connectives are the basic elements
of the propositional logic. Connectives can be said as a logical operator which connects two
sentences.

A proposition formula which is always true is called tautology, and it is also called a valid sentence. A
proposition formula which is always false is called Contradiction. Statements which are questions,
commands, or opinions are not propositions such as "Where is your brother?", "How are you?",
"What is your name?", are not propositions.

There are five connectives in common use:

 NEGATION ¬ (not).
 ∧ (and). A sentence whose main connective is ∧, is called a conjunction;
 ∨ (or). A sentence using ∨ is a disjunction;
 ⇒ (implies). A sentence with ⇒ is called an implication. Implications are also known as rules or
if–then statements.
 ⇔ (if and only if). The sentence with ⇔ is a bi-conditional.
 Operator precedence of propositional logic is: ¬, ∧, ∨,⇒,⇔

The syntax of propositional logic defines the allowable sentences for the knowledge representation.
There are two types of Propositions:

 Atomic Propositions consists of a single proposition symbol. These are the sentences which
must be either true or false.
o Example: 2+2 is 4, is an atomic proposition as it is a true fact.
 Compound propositions are constructed by combining simpler or atomic propositions, using
parenthesis and logical connectives.
o Example: "It is raining today, and street is wet."

Example: Given three propositions P-true, Q-true and R-true, the truth value of P V Q ⇒ ¬R is False.

Two propositions are said to be logically equivalent if and only if the columns in the truth table are
identical to each other. Given two propositions A and B with both true, ¬A V B and A ⇒ B are logically
equivalent.

Properties of Operators:
o Commutativity:
o P∧ Q = Q ∧ P, or

o P ∨ Q = Q ∨ P.
o Associativity:
o (P ∧ Q) ∧ R= P ∧ (Q ∧ R),

o (P ∨ Q) ∨ R= P ∨ (Q ∨ R)
o Identity element:
o P ∧ True = P,

o P ∨ True= True.
o Distributive:
o P∧ (Q ∨ R) = (P ∧ Q) ∨ (P ∧ R).
o P ∨ (Q ∧ R) = (P ∨ Q) ∧ (P ∨ R).
o DE Morgan's Law:
o ¬ (P ∧ Q) = (¬P) ∨ (¬Q)
o ¬ (P ∨ Q) = (¬ P) ∧ (¬Q).
o Double-negation elimination:
o ¬ (¬P) = P.

4.3. Predicate (First-Order) Logic


In propositional logic, we can only represent the facts, which are either true or false. It is not sufficient
to represent the complex sentences or natural language statements and it has very limited expressive
power. We cannot represent the following statements using PL logic.
 "Some humans are intelligent", or
 "Alemu likes football."
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 is a powerful language that develops information about
the objects in a more easy way and can also express the relationship between those objects. 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:
 Objects: A, B, people, numbers, colors, wars, theories, squares, pits, wumpus ...
 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
 Function: Father of, best friend, third inning of, end of ...
As a natural language, first-order logic also has two main parts: Syntax and Semantics.
The following are basic Elements of First-order logic:

Constant 1, 2, A, John, Addis Ababa, cat, car....

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: Abebe and Tola are brothers could be written as Brothers(Abebe, Tola).
Boby is a dog could be written as dog (Boby).
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:


A quantifier is a language element which generates quantification, and quantification specifies the
quantity of specimen in the universe of discourse. These are the symbols that permit to determine or
identify the range and scope of the variable in the logical expression. There are two types of
quantifier:
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 ∀.
If x is a variable, then ∀x is read as: For all x or For each x For every x.
Example: All man drink coffee.

∀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 ∃. When it is used
with a predicate variable then it is called as an existential quantifier.

If x is a variable, then existential quantifier will be ∃x or ∃(x). And it will be read as: There exists 'x.' or
For some 'x.' or For at least one 'x.'.

Example: Some boys are intelligent.

∃x boy(x) ∧ intelligent(x)

Examples:
 All birds fly. ∀x bird(x) →fly(x).
 Every man respects his parent. ∀x man(x) → respects (x, parent).
 Some boys play cricket. ∃x boy(x) ∧ plays(x, cricket).
4.4. Inference in First-Order Logic
Inference in First-Order Logic is used to deduce new facts or sentences from existing sentences.
Before understanding the FOL inference rule, let's understand some basic terminologies used in FOL.

Substitution:
Substitution is a fundamental operation performed on terms and formulas. It occurs in all inference
systems in first-order logic. The substitution is complex in the presence of quantifiers in FOL. If we
write F[a/x], so it refers to substitute a constant "a" in place of variable "x".

Equality:
First-Order logic does not only use predicate and terms for making atomic sentences but also uses
another way, which is equality in FOL. For this, we can use equality symbols which specify that the
two terms refer to the same object.

Example: Brother (John) = Smith.

As in the above example, the object referred by the Brother (John) is similar to the object referred
by Smith. The equality symbol can also be used with negation to represent that two terms are not the
same objects.

Example: ¬(x=y) which is equivalent to x ≠y.

FOL inference rules for quantifier:


As propositional logic we also have inference rules in first-order logic, so following are some basic
inference rules in FOL:
 Universal Generalization
Universal generalization is a valid inference rule which states that if premise P(c) is true for any
arbitrary element c in the universe of discourse, then we can have a conclusion as ∀ x P(x).

It can be represented as:


This rule can be used if we want to show that every element has a similar property.
In this rule, x must not appear as a free variable.
Example: Let's represent, P(c): "A byte contains 8 bits", so for ∀ x P(x) "All bytes contain 8 bits.”
it will also be true.
 Universal Instantiation
Universal instantiation is also called as universal elimination or UI is a valid inference rule. It
can be applied multiple times to add new sentences. The new KB is logically equivalent to the
previous KB. As per UI, we can infer any sentence obtained by substituting a ground term for
the variable. The UI rule state that we can infer any sentence P(c) by substituting a ground
term c (a constant within domain x) from ∀ x P(x) for any object in the universe of discourse.

It can be represented as

Example:
o IF "Every person like ice-cream"=> ∀x P(x) so we can infer that "John likes ice-cream" =>
P(c)
o "All kings who are greedy are Evil." So let our knowledge base contains this detail as in the
form of FOL:
 ∀x king(x) ∧ greedy (x) → Evil (x),

So from this information, we can infer any of the following statements using Universal
Instantiation: King(John) ∧ Greedy (John) → Evil (John)

 Existential Instantiation
Existential instantiation is also called as Existential Elimination, which is a valid inference rule
in first-order logic. It can be applied only once to replace the existential sentence. The new KB
is not logically equivalent to old KB, but it will be satisfiable if old KB was satisfiable.

This rule states that one can infer P(c) from the formula given in the form of ∃x P(x) for a new
constant symbol c. The restriction with this rule is that c used in the rule must be a new term
for which P(c ) is true.

It can be represented as
Example:
From the given sentence: ∃x Crown(x) ∧ OnHead(x, John)
 Existential introduction
An existential introduction is also known as an existential generalization, which is a valid
inference rule in first-order logic. This rule states that if there is some element c in the
universe of discourse which has a property P, then we can infer that there exists something in
the universe which has the property P.

It can be represented as

o Example: Let's say that,


"Priyanka got good marks in English."
"Therefore, someone got good marks in English."

4.5. Knowledge based system


A knowledge-based system (KBS) is a computer program that reasons and uses a knowledge base to
solve complex problems. The one common theme that unites all knowledge based systems is an
attempt to represent knowledge explicitly and a reasoning system that allows it to derive new
knowledge. Thus, a knowledge-based system has two distinguishing features: a knowledge base and
an inference engine.

The first part, the knowledge base, represents facts about the world. The second part, the inference
engine, allows new knowledge to be inferred. 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. 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 Knowledge base is a group of the Sentences.

You might also like