AIML Unit 2 Notes
AIML Unit 2 Notes
AIML Unit 2 Notes
KNOWLEDGE REPRESENTATION
Suppose we wish to write a program to play a simple card game using the standard
deck of 52 playing cards. We will need some way to represent the cards dealt to each player
and a way to express the rules. We can represent cards in different ways.
1. The most straightforward way is to record the suit (clubs, diamonds, hearts, spades)
and face values (ace.' 2,3, ... , IO, jack, queen, king) as a symbolic pair. So the queen
of hearts might be represented as <queen, hearts>.
2. Alternatively, we could assign abbreviated codes (c6 for the 6 of clubs), numeric
values which ignore suit (1, 2, ... , 13), or some other scheme. If the game we wish to
play is bridge, suit as well as value will be important.
3. On the other hand, if the game is black jack, only face values are important and a
simpler program will result if only numeric values are used.
To see how important a good representation is, one only needs to try solving a few simple
problems using different representations. Consider the problem of discovering a pattern in the
sequence of numbers 1 1 2 3 4 7. A change of base in the number from l 0 to 2 transforms the
number to
011011011011011011.
• In order to solve complex problems encountered in artificial intelligence, one needs both
a large amount of knowledge and some mechanism for manipulating that knowledge to
create solutions.
• Knowledge and Representation are two distinct entities. They play central but
distinguishable roles in the intelligent system.
• Explicit knowledge
• Exists outside a human being;
• It is embedded.
• Can be articulated formally.
• Also, Can be shared, copied, processed and stored.
• So, Easy to steal or copy
• Drawn from the artifact of some type as a principle, procedure, process, concepts.
A variety of ways of representing knowledge have been exploited in AI programs.
There are two different kinds of entities, we are dealing with.
1. Facts: Truth in some relevant world. Things we want to represent.
2. Also, Representation of facts in some chosen formalism. Things we will be able to
manipulate.
These entities structured at two levels:
1. The knowledge level, at which facts described.
2. Moreover, the symbol level, at which representation of objects defined in terms of
symbols that can manipulate by programs.
• The computer requires a well-defined problem description to process and provide a well
defined acceptable solution.
• Also, The computer can then use an algorithm to compute an answer. So, This process
illustrated as knowledge representation framework.
Relational Knowledge
• The simplest way to represent declarative facts is a set of relations of the same sort used
in the database system.
• Provides a framework to compare two objects based on equivalent attributes. o Any
instance in which two different objects are compared is a relational type of knowledge.
• The table below shows a simple way to store facts.
• Also, The facts about a set of objects are put systematically in columns.
• This representation provides little opportunity for inference.
• Given the facts, it is not possible to answer a simple question such as: “Who is the
heaviest player?”
• Also, But if a procedure for finding the heaviest player is provided, then these facts will
enable that procedure to compute an answer.
• Moreover, We can ask things like who “bats – left” and “throws – right”.
Inheritable Knowledge
• Here the knowledge elements inherit attributes from their parents.
• The knowledge embodied in the design hierarchies found in the functional, physical and
process domains.
• Within the hierarchy, elements inherit attributes from their parents, but in many cases, not
all attributes of the parent elements prescribed to the child elements.
• Also, The inheritance is a powerful form of inference, but not adequate.
• Moreover, The basic KR (Knowledge Representation) needs to augment with inference
mechanism.
• Property inheritance: The objects or elements of specific classes inherit attributes and
values from more general classes.
• So, The classes organized in a generalized hierarchy.
Inferential Knowledge
• This knowledge generates new information from the given information.
• This new information does not require further data gathering form source but does
require analysis of the given information to generate new knowledge.
• Example: given a set of relations and values, one may infer other values or relations. A
predicate logic (a mathematical deduction) used to infer from a set of attributes.
Moreover, Inference through predicate logic uses a set of logical operations to relate
individual data.
• Represent knowledge as formal logic: All dogs have tails ∀x: dog(x) hastail(x)
• Advantages:
• A set of strict rules.
• Can use to derive more facts.
• Also, Truths of new statements can be verified.
• Guaranteed correctness.
• So, Many inference procedures available to implement standard rules of logic popular in
AI systems. e.g Automated theorem proving.
Procedural Knowledge
• A representation in which the control information, to use the knowledge, embedded in the
knowledge itself. For example, computer programs, directions, and recipes; these indicate
specific use or implementation.
• Moreover, Knowledge encoded in some procedures, small programs that know how to do
specific things, how to proceed.
• Advantages:
• Heuristic or domain-specific knowledge can represent.
• Moreover, Extended logical inferences, such as default reasoning facilitated.
• Also, Side effects of actions may model. Some rules may become false in time.
Keeping track of this in large systems may be tricky.
• Disadvantages:
• Completeness — not all cases may represent.
• Consistency — not all deductions may be correct. e.g If we know that Fred is a
bird we might deduce that Fred can fly. Later we might discover that Fred is an
emu.
• Modularity sacrificed. Changes in knowledge base might have far-reaching effects.
• Cumbersome control information.
All Knowledge representation schemes suffer from problems. We will discuss them here.
• Are any attributes of objects so basic that they occur in almost every problem
domain. If there are, we need to make sure that they are handled appropriately in
each of the mechanisms we propose. If such attributes exist, what are they?
• Are there any important relationships that exists among attributes of objects?
• Given a large amount of knowledge stored in a database, how can relevant parts
be accessed when they are needed?
Important Attributes
There are two attribute that are of very general significance, and we have already seen
.their use. instance and.1sa. These attributes are important because they support property
inheritance. They are called a variety of things in AI systems, but the names do not
matter. What does matter is that they represent class membership and class inclusion
and that class inclusion is transitive.
The attributes that we use to describe objects are themselves entities that we represent.
what properties do they have independent of the specific knowledge they encode? There
are four such properties are listed issues that should be raised when using a knowledge
representation technique:
Inverses
The relationship between the attributes of an object, such as, inverses, existence, techniques
for reasoning about values and single valued attributes. We can consider an example of an
inverse in
This can be treated as John Zorn plays in the band Naked City or John Zorn's band is Naked
City.
The second approach is to use attributes that focus on single entity but to use in them pairs.
One the inverse of the other. The band information is represented with two attributes.
Just as there are classes of objects and specialized subsets of those classes, there are attributes
and specializations of attributes. Consider, for example, the attribute height. It Is actually a
specialization of the more general attribute physical-size which is, in turn, a specialization of
physical-attribute. These generalization-specialization relationships are important for
attributes, for the same reason that they are important for other concepts they support
inheritance. In the case of attributes, they support inheriting, information on about such things
as constraints on the values that the attribute can have and mechanisms for computing those-
values.
Sometimes values of attributes are specified explicitly when a knowledge base is created.
Several kinds of information can play a role in this reasoning, including:
• Information about the type of the value. For example, the value of height must be a number
measured m a unit of length. ·
• Constraints on the value, often stated in terms of related entities. For example, the age of a
person cannot be greater than the age of either of that person's parents.
• Rules for computing the value when it is needed, These rules are called backward rules.
Such rules have also been called if-needed rules.
• Rules that describe actions that should be taken if a value ever becomes known. These rules
are called forward rules, or sometimes if-added rules.
Single-valued attribute
A specific but very useful kind of attribute is one that is guaranteed to take a unique value.
For example, a baseball player can, at any one time, have only a single height and be a
member of only one team. If there is already a value present for one of these attributes and a
different value is asserted, then one of two things has happened. Either a. change has
occurred in the world or there is now a contradiction in the knowledge base that needs to be
resolved. Knowledge-representation systems have taken several different approaches to
providing support for single-valued attributes! including:
• Introduce. an explicit notation for temporal interval. If two different values are ever asserted
for the same temporal interval, signal a contradiction automatically.
• Assume that the only temporal interval that is of interest is now, So if a new value is
asserted, replace the old value.
At what level should the knowledge be represented and what are the primitives. Choosing the
Granularity of Representation Primitives are fundamental concepts such as holding, seeing,
playing and as English is a very rich language with over half a million words it is clear we
will find difficulty in deciding upon which words to choose as our primitives in a series of
situations.
feeds(tom, dog)
There are several arguments against the use of low-level primitives. One is that simple high-
level facts may require a lot of storage when broken down into primitives. Much of that
storage is really wasted since the low-level rendition of a particular high level concept will
appear many times, once for each time the high-level concept is referenced. For example,
suppose that actions are being represented as combinations of a small set of primitive actions.
Then the fact that John punched Mary might be represented as shown in first figure. The
representation says that there was physical contact between John's fist and Mary. The contact
was caused by John propelling his fist toward Mary, and to do that John first went to where
Mary was. But suppose we also know that Mary punched John. Then we must also store the
structure shown in second figure below. If, however, punching were represented simply as
punching, then most of the detail of both structures could be omitted from the structures
themselves. It could instead be stored just once in a common representation of the concept of
punching.
Representing Set of Objects
It is important to be able to represent set of objects for several reasons. One is that there are
some properties that are true of sets that are not true of the individual members of a set. As
examples, consider the assertions that are being made in the sentences.
"There are more sheep than people in Australia" and "English speakers can be found all over
the world.".
The only way to represent the facts described in these sentences is to attach assertions to the
sets representing people, sheep, and English speakers, since, for example, no single English
speaker can be found all over the world. The other reason that it is important to be. able to
represent sets of objects is that if a property is true of all (or even most) elements of a set,
then it is more efficient to associate it once with the set rather than to associate it explicitly
with every element of the set.
Thus if we assert something like large(Elephant), it must be clear whether we are asserting
Some property of the set itself (i.e., that the set of elephants is large) or some property that
holds for individual elements of the set (i.e., that anything that is an elephant is large). There
are three obvious ways in which sets may be represented. The simplest is just by a name.
This is the issue of locating appropriate knowledge structures that have been stored in
memory. For example, suppose we have a script (a description of a class of events in terms of
contexts, participants, and subevents) that describes the typical sequence of events in a .
restaurant. This script would enable us to take a text such as ·
John went to Steak and Ale last night. He ordered a large, rare steak, paid his bill, and left.
And answer yes to the question: Did john eat dinner last night?
Notice that nowhere in the story was John's eating anything mentioned explicitly. But the fact
that when one goes to a restaurant one eats will be contained in the restaurant script. If we
know in advance to use the restaurant script, then we can answer the question easily. But in·
order to be able to reason about a variety of things, a system must have many scripts for
everything from going to work to sailing around the world. How will it select the appropriate
one each time? For example, nowhere in our story was the word "restaurant" mentioned. · · _
In fact in order to have access to the right structure for describing a particular situation, it is
necessary to solve all of the following problems.
There is no good, general-purpose method for solving all these problems. Some knowledge-
representation technique solve some of them. This leads to two questions: how to select an
initial structure to consider and how to find a better structure (or revise it) if that one turns out
not to be a good match.
KNOWLEDGE REPRESENTATION USING PROPOSITIONAL AND PREDICATE
LOGIC
It is raining.
My car is painted silver.
John and Sue have five children.
Snow is white.
People live on the moon.
Compound propositions are formed from atomic formulas using the logical connectives not
and or if . . . then, and if and only if. For example, the following are compound formulas.
We will use capital letters, sometimes followed by digits, to stand for propositions; T and F
are special symbols having the values true and false, respectively.
V for or or disjunction
In addition, left and right parentheses, left and right braces, and the period will be used as
delimiters for punctuation. So, for example, to represent the compound sentence "It is raining
and the wind is blowing" we could write (R & B) where R and B stand for the propositions "It
is raining" and "the wind is blowing," respectively. If we write (R V B) we mean "it is raining
or the wind is blowing or both" that is, V indicates inclusive disjunction.
Syntax
The semantics or meaning of a sentence is just the value true or false; that is, it is an
assignment of a truth value to the sentence. The values true and false should not be confused
with the symbols T and F which can appear within a sentence. An interpretation for a
sentence or group of sentences is an assignment of a truth value to each propositional symbol.
As an example, consider the statement (P & -Q). One interpretation (I1) assigns true to P and
false to Q. A different interpretation (I2) assigns true to P and true to Q. Clearly, there are
four distinct interpretations for this sentence. Some semantic rules are summarized in the
table below.
We can now find the meaning of any statement given an interpretation I for the statement.
For example, let I assign true to P, false to Q and false to R in the statement
Application of rule 2 then gives -Q as true, rule 3 gives (P & -Q) as true, rule 6 gives (P & -
Q) ~ R as false, and rule 5 gives the statement value as false.
Properties of statements
LOGICAL CONSEQUENCES
More generally, it is a logical consequence of other statements if and only if for any
interpretation in which the statements are true, the resulting statement is also true. A valid
statement is satisfiable, and a contradictory statement is invalid, but the converse is not
necessarily true. As examples of the above definitions consider the following statements.
P is satisfiable but not valid since an interpretation that assigns false to P assigns false to the
sentence P.
The notion of logical consequence provides us with a means to perform valid inferencing in
PL. The following are two important theorems which give criteria for a statement to be a
logical consequence of a set of statements.
Theorem 4.1. The sentence s is a logical consequence of s1,……….., sn if and only if s1 & s2
& ... & sn s is valid.
Theorem 4.2. The sentence s is a logical consequence of s1,……….., sn if and only if s1 & s2
& ... &sn &‘s is inconsistent. Table 4.2 lists some of the important laws of PL.
One way to determine the equivalence of two sentences is by using truth table. For example
the conditional elimination and Bi-conditional elimination in the above table can be verified
by the following truth table.
Inference Rules
The inference rules of PL provide the means to perform logical proofs or deductions. The
problem is, given a set of sentences S = {s1,……….., sn} (the premises), prove the truth of s
(the conclusion); that is, show that Sl-s. The use of truth tables to do this is a form of
semantic proof. Other syntactic methods of inference or deduction are also possible. Such
methods do not depend on truth assignments but on syntactic relationships only; that is, it is
possible to derive new sentences which are logical consequences of s1…....... sn using only
syntactic operations. Few inference rules are given here.
SYNTAX AND SEMANTICS FOR PREDICATE LOGIC (FOPL-First Order
Predicate Logic)
expressiveness is one of the requirements for any serious representation scheme. It should be
possible to accurately represent most, if not all concepts which can be verbalized. PL falls
short of this requirement in some important respects. It is too "coarse" to easily describe
properties of objects, and it lacks the structure to express relations that exist among two or
more entitles. Furthermore, PL does not permit us to make generalized statements about
classes of similar objects. These are serious limitations when reasoning about real world
entities. For example, given the following statements, it should be possible to conclude that
John must take the Pascal course.
As stated, it is not possible to conclude in PL that John must take Pascal since the second
statement does not occur as part of the first one. To draw the desired conclusion with a valid
inference rule, it would be necessary to rewrite the sentences.
FOPL was developed by logicians to extend the expressiveness of PL. It is a generalization of
PL that permits reasoning about world objects as relational entities as well as classes or
subclasses of objects. This generalization comes from the introduction of predicates in place
of propositions, the use of functions and the use of variables together with variable
quantifiers.
Syntax of FOPL
The symbols and rules of combination permitted in FOPL are defined as follows.
Semantics for FOPL
When considering specific wffs, we always have in mind some domain D. If not stated
explicitly, D will be understood from the context. D is the set of all elements or objects from
which fixed assignments are made to constants and from which the domain and range of
functions are defined. The arguments of predicates must be terms (constants, variables, or
functions). Therefore, the domain of each n-place predicate is also defined over D.
For example, our domain might be all entities that make up the Computer Science
Department at the University of Texas. In this case, constants would be professors (Bell,
Cooke, Gelfond, and so on), staff (Martha, Pat, Linda, and so on), books, labs, offices, and so
forth. The functions we may choose might be
PROPOSITIONAL LOGIC: RESOLUTION
The following steps should be carried out in sequences to employ it for theorem
proving in propositional using resolution:
Resolution Algorithm:
Given:
A set of clauses, called axioms and a goal.
Aim:
To test whether the goal is derivable from the axioms.
Begin:
1. Construct a set S of axioms plus the negated goal.
2. Represent each element of S into conjunctive normal form (CNF) by the following
steps:
a) Replace ‘if-then’ operator by NEGATION and OR operation by theorem using 10.
(b) Bring each modified clause into the following form and then drop AND operators
connected between each square bracket. The clauses thus obtained are in conjunctive normal
from (CNF). It may be noted that pij may be in negated or non-negated form.
3. Repeat:
(a) Select any two clauses from S, such that one clause contains a negated literal and the other
clause contains its corresponding positive (non-negated) literal.
(b) Resolve these two clauses and call the resulting clause the resolvent. Remove the parent
clauses from S.
Until a null clause is obtained or no further progress can be made.
Example 1:
We are given the axioms given in the first column of table 6.3, and we want to prove R. First
we convert the axioms to clause form, as shown in the second column of the table. Then we
negate R, producing ¬ R which is already in clause form it is added into the given clauses
(data base).
Then we look for pairs of clauses to resolve together. Although many pair of clauses can be
resolved, only those pairs which contain complementary literals will produce a resolvent
which is likely to lead to the goal shown by empty clause (shown as a box). We begin by
resolving R with the clause ¬ R since that is one of the clauses which must be involved in the
contradiction we are trying to find. The sequence of contradiction resolvents of the example
in table 6.3., is shown in Fig. 6.4.
Example 2:
Consider the following knowledge base:
1. If the-humidity-is-high or the-sky-is-cloudy.
2. If the-sky-is-cloudy then it-will-rain.
3. If the-humidity-is-high then it-is-hot.
4. It-is-not-hot.
and the goal: It-will-rain prove by resolution theorem that the goal is derivable from the
knowledge base.
Proof:
Let us first denote the above clauses by the following symbols.
1. p ∨ q
2. ¬ q ∨ r (after applying theorem 10)
3. ¬ p ∨ s (after applying theorem 10)
4. ¬ s
5. ¬ r
and the negated goal = ¬ r. The set of statements; S, thus includes all these 5 clauses in
Normal Form. When all the clauses are connected through connector ∧ they are called in CNF
and conjugated terms for the set S. For example
Now by resolution algorithm, we construct the graph of Fig. 6.5. Since it terminates with a
null clause the goal is proved.
KNOWLEDGE REPRESENTATION USING PREDICATE LOGIC
Propositional logic is useful because it is simple to deal with and a decision procedure for it
exists.
Also, In order to draw conclusions, facts are represented in a more convenient way as,
1. Marcus is a man.
• man(Marcus)
2. Plato is a man.
• man(Plato)
3. All men are mortal.
• mortal(men)
But propositional logic fails to capture the relationship between an individual being a man
and
that individual being a mortal.
• How can these sentences be represented so that we can infer the third sentence from the
first two?
• Also, Propositional logic commits only to the existence of facts that may or may not be
the case in the world being represented.
• Moreover, It has a simple syntax and simple semantics. It suffices to illustrate the process
of inference.
• Propositional logic quickly becomes impractical, even for very small worlds.
Predicate logic
First-order Predicate logic (FOPL) models the world in terms of
• Objects, which are things with individual identities
• Properties of objects that distinguish them from other objects
• Functions, which are a subset of relations where there is only one “value” for any given
“input”
First-order Predicate logic (FOPL) provides
• Constants: a, b, dog33. Name a specific object.
• Variables: X, Y. Refer to an object without naming it.
• Functions: Mapping from objects to objects.
• Terms: Refer to objects
• Atomic Sentences: in(dad-of(X), food6) Can be true or false, Correspond to propositional
symbols P, Q.
A well-formed formula (wff) is a sentence containing no “free” variables. So, That is, all
variables are “bound” by universal or existential quantifiers.
(∀x)P(x, y) has x bound as a universally quantified variable, but y is free.
Quantifiers
Universal quantification
• (∀x)P(x) means that P holds for all values of x in the domain associated with that variable
• E.g., (∀x) dolphin(x) → mammal(x)
Existential quantification
• (∃ x)P(x) means that P holds for some value of x in the domain associated with that
variable
• E.g., (∃ x) mammal(x) ∧ lays-eggs(x)
Also, Consider the following example that shows the use of predicate logic as a way of
representing knowledge.
1. Marcus was a man.
2. Marcus was a Pompeian.
3. All Pompeians were Romans.
4. Caesar was a ruler.
5. Also, All Pompeians were either loyal to Caesar or hated him.
6. Everyone is loyal to someone.
7. People only try to assassinate rulers they are not loyal to.
8. Marcus tried to assassinate Caesar.
The facts described by these sentences can be represented as a set of well-formed formulas
(wffs)
as follows:
1. Marcus was a man.
• man(Marcus)
2. Marcus was a Pompeian.
• Pompeian(Marcus)
3. All Pompeians were Romans.
• ∀x: Pompeian(x) → Roman(x)
4. Caesar was a ruler.
• ruler(Caesar)
5. All Pompeians were either loyal to Caesar or hated him.
• inclusive-or
• ∀x: Roman(x) → loyalto(x, Caesar) ∨ hate(x, Caesar)
• exclusive-or
• ∀x: Roman(x) → (loyalto(x, Caesar) ∧¬ hate(x, Caesar)) ∨
Now suppose if we want to use these statements to answer the question: Was Marcus loyal to
Caesar?
Also, Now let’s try to produce a formal proof, reasoning backward from the desired goal: ¬
Ioyalto(Marcus, Caesar)
In order to prove the goal, we need to use the rules of inference to transform it into another
goal
(or possibly a set of goals) that can, in turn, transformed, and so on, until there are no
unsatisfied goals remaining.
1. Many English sentences are ambiguous (for example, 5, 6, and 7 above). Choosing the
correct interpretation may be difficult.
2. Also, There is often a choice of how to represent the knowledge. Simple representations
are desirable, but they may exclude certain kinds of reasoning.
3. Similalry, Even in very simple situations, a set of sentences is unlikely to contain all the
information necessary to reason about the topic at hand. In order to be able to use a set of
statements effectively. Moreover, It is usually necessary to have access to another set of
statements that represent facts that people consider too obvious to mention.
* Specific attributes instance and isa play an important role particularly in a useful form of
reasoning called property inheritance.
* The predicates instance and isa explicitly captured the relationships they used to express,
namely class membership and class inclusion.
* Figure shows the first five sentences of the last section represented in logic in three
different ways.
* The first part of the figure contains the representations we have already discussed. In
these representations, class membership represented with unary predicates (such as
Roman), each of which corresponds to a class.
* Asserting that P(x) is true is equivalent to asserting that x is an instance (or element) of P.
* The second part of the figure contains representations that use the instance predicate
explicitly.
The following figure shows three ways of representing class membership: isa relationships
• The predicate instance is a binary one, whose first argument is an object and whose second
argument is a class to which the object belongs.
• But these representations do not use an explicit isa predicate.
• Instead, subclass relationships, such as that between Pompeians and Romans, described
as shown in sentence 3.
• The implication rule states that if an object is an instance of the subclass Pompeian then it
is an instance of the superclass Roman.
• Note that this rule is equivalent to the standard set-theoretic definition of the subclass
superclass relationship.
• The third part contains representations that use both the instance and isa predicates
explicitly.
• The use of the isa predicate simplifies the representation of sentence 3, but it requires that
one additional axiom (shown here as number 6) be provided.
• To express simple facts, such as the following greater-than and less-than relationships:
gt(1,O) It(0,1) gt(2,1) It(1,2) gt(3,2) It( 2,3)
• It is often also useful to have computable functions as well as computable predicates.
Thus we might want to be able to evaluate the truth of gt(2 + 3,1)
• To do so requires that we first compute the value of the plus function given the arguments
2 and 3, and then send the arguments 5 and 1 to gt.
Consider the following set of facts, again involving Marcus:
1) Marcus was a man.
man(Marcus)
2) Marcus was a Pompeian.
Pompeian(Marcus)
3) Marcus was born in 40 A.D.
born(Marcus, 40)
4) All men are mortal.
x: man(x) → mortal(x)
5) All Pompeians died when the volcano erupted in 79 A.D.
erupted(volcano, 79) ∧ ∀ x : [Pompeian(x) → died(x, 79)]
6) No mortal lives longer than 150 years.
x: t1: At2: mortal(x) born(x, t1) gt(t2 – t1,150) → died(x, t2)
7) It is now 1991.
now = 1991
So, Above example shows how these ideas of computable functions and predicates can be
useful.
It also makes use of the notion of equality and allows equal objects to be substituted for each
other whenever it appears helpful to do so during a proof.
• So, Now suppose we want to answer the question “Is Marcus alive?”
• The statements suggested here, there may be two ways of deducing an answer.
• Either we can show that Marcus is dead because he was killed by the volcano or we can
show that he must be dead because he would otherwise be more than 150 years old, which we
know is not possible.
• Also, As soon as we attempt to follow either of those paths rigorously, however, we
discover, just as we did in the last example, that we need some additional knowledge. For
example, our statements talk about dying, but they say nothing that relates to being alive,
which is what the question is asking. So we add the following facts:
8) Alive means not dead.
x: t: [alive(x, t) → ¬ dead(x, t)] [¬ dead(x, t) → alive(x, t)]
9) If someone dies, then he is dead at all later times.
x: t1: At2: died(x, t1) gt(t2, t1) → dead(x, t2)
So, Now let’s attempt to answer the question “Is Marcus alive?” by proving: ¬ alive(Marcus,
now)
RESOLUTION
Resolution is used, if there are various statements are given, and we need to prove a
conclusion of those statements. Unification is a key concept in proofs by resolutions.
Resolution is a single inference rule which can efficiently operate on the conjunctive normal
form or clausal form.
Clause: Disjunction of literals (an atomic sentence) is called a clause. It is also known as a
unit clause.
To better understand all the above steps, we will take an example in which we will
apply resolution.
Example:
Step-1: Conversion of Facts into FOL Step-2: Conversion of FOL into CNF
In the first step we will convert all the given Eliminate all implication (→) and rewrite
statements into its first order logic.
1. ∀x ¬ food(x) V likes(John, x)
2. food(Apple)Λ
food(vegetables)
3. ∀x ∀y ¬ [eats(x, y) Λ ¬
killed(x)] V food(y)
4. eats (Anil, Peanuts) Λ
alive(Anil)
5. ∀x ¬ eats(Anil, x) V
eats(Harry, x)
6. ∀x¬ [¬ killed(x) ] V alive(x)
7. ∀x ¬ alive(x) V ¬ killed(x)
8. likes(John, Peanuts).
The inference engine is the component of the intelligent system in artificial intelligence,
which applies logical rules to the knowledge base to infer new information from known facts.
The first inference engine was part of the expert system. Inference engine commonly
proceeds in two modes, which are:
a. Forward chaining
b. Backward chaining
Horn clause and definite clause are the forms of sentences, which enables knowledge base to
use a more restricted and efficient inference algorithm. Logical inference algorithms use
forward and backward chaining approaches, which require KB in the form of the first-order
definite clause.
Definite clause: A clause which is a disjunction of literals with exactly one positive
literal is known as a definite clause or strict horn clause.
Horn clause: A clause which is a disjunction of literals with at most one positive literal is
known as horn clause. Hence all the definite clauses are horn clauses.
It is equivalent to p ∧ q → k.
Forward Chaining
Forward chaining is also known as a forward deduction or forward reasoning method when
using an inference engine. Forward chaining is a form of reasoning which start with atomic
sentences in the knowledge base and applies inference rules (Modus Ponens) in the forward
direction to extract more data until a goal is reached.
The Forward-chaining algorithm starts from known facts, triggers all rules whose premises
are satisfied, and add their conclusion to the known facts. This process repeats until the
problem is solved.
Properties of Forward-Chaining:
Consider the following famous example which we will use in both approaches:
Example:
"As per the law, it is a crime for an American to sell weapons to hostile nations. Country A,
an enemy of America, has some missiles, and all the missiles were sold to it by Robert, who
is an American citizen."
Prove that "Robert is criminal."
To solve the above problem, first, we will convert all the above facts into first-order definite
clauses, and then we will use a forward-chaining algorithm to reach the goal.
Step-1:
In the first step we will start with the known facts and will choose the sentences which do not
have implications, such as: American(Robert), Enemy(A, America), Owns(A, T1), and
Missile(T1). All these facts will be represented as below.
Step-2:
At the second step, we will see those facts which infer from available facts and with satisfied
premises.
Rule-(1) does not satisfy premises, so it will not be added in the first iteration.
Rule-(4) satisfy with the substitution {p/T1}, so Sells (Robert, T1, A) is added, which infers
from the conjunction of Rule (2) and (3).
Rule-(6) is satisfied with the substitution(p/A), so Hostile(A) is added and which infers from
Rule-(7).
Step-3:
At step-3, as we can check Rule-(1) is satisfied with the substitution {p/Robert, q/T1, r/A},
so we can add Criminal(Robert) which infers all the available facts. And hence we reached
our goal statement.
Backward Chaining:
Example:
In backward-chaining, we will use the same above example, and will rewrite all the rules.
Backward-Chaining proof:
In Backward chaining, we will start with our goal predicate, which is Criminal(Robert), and
then infer further rules.
Step-1:
At the first step, we will take the goal fact. And from the goal fact, we will infer other facts,
and at last, we will prove those facts true. So our goal fact is "Robert is Criminal," so
following is the predicate of it.
Step-2:
At the second step, we will infer other facts form goal fact which satisfies the rules. So as we
can see in Rule-1, the goal predicate Criminal (Robert) is present with substitution
{Robert/P}. So we will add all the conjunctive facts below the first level and will replace p
with Robert.
Step-4:
At step-4, we can infer facts Missile(T1) and Owns(A, T1) form Sells(Robert, T1, r) which
satisfies the Rule- 4, with the substitution of A in place of r. So these two statements are
proved here.
Step-5:
At step-5, we can infer the fact Enemy(A, America) from Hostile(A) which satisfies Rule-
6. And hence all the statements are proved true using backward chaining.
SEMANTIC TABLEAU
Since the 1980s another technique for determining the validity of arguments in either PC
(Pedictive Coding) or LPC (Linear Predictive Coding)has gained some popularity, owing
both to its ease of learning and to its straightforward implementation by computer programs.
Originally suggested by the Dutch logician Evert W. Beth, it was more fully developed and
publicized by the American mathematician and logician Raymond M. Smullyan. Resting on
the observation that it is impossible for the premises of a valid argument to be true while
the conclusion is false, this method attempts to interpret (or evaluate) the premises in such a
way that they are all simultaneously satisfied and the negation of the conclusion is also
satisfied. Success in such an effort would show the argument to be invalid, while failure to
find such an interpretation would show it to be valid.
Write:
Only if all the sentences in at least one branch are true is it possible for the original premises
to be true and the conclusion false (equivalently for the negation of the conclusion). By
tracing the line upward in each branch to the top of the tree, one observes that no valuation
of a in the left branch will result in all the sentences in that branch receiving the value true
(because of the presence of a and ∼a). Similarly, in the right branch the presence of b and
∼b makes it impossible for a valuation to result in all the sentences of the branch receiving
the value true. These are all the possible branches; thus, it is impossible to find a situation in
which the premises are true and the conclusion false. The original argument is therefore valid
Furthermore, in LPC, rules for instantiating quantified wffs need to be introduced. Clearly,
any branch containing both (∀x)ϕx and ∼ϕy is one in which not all the sentences in that
branch can be simultaneously. Again, if all the branches fail to be simultaneously satisfiable,
the original argument is valid.
UNIFICATION ALGORITHM
CONVERSION TO DIFFERENT FORMS
DEDUCTION
PROPOSITIONAL THEOREM PROVING
INFERENCING
It applies logical rulesw to the knowledge base to infer new information from known facts.
Inference engine proceeds in two modes:
1. Forward Chaining 2. Backward Chaining
The location of inference engine is shown in the figure here.
In artificial intelligence, we need intelligent computers which can create new logic
from old logic or by evidence, so generating the conclusions from evidence and
facts is termed as Inference.
Inference rules:
Inference rules are the templates for generating valid arguments. Inference rules are applied
to derive proofs in artificial intelligence, and the proof is a sequence of the conclusion that
leads to the desired goal.
In inference rules, the implication among all the connectives plays an important role.
Following are some terminologies related to inference rules:
From the above term some of the compound statements are equivalent to each other, which
we can prove using truth table:
Play Video
Hence from the above truth table, we can prove that P → Q is equivalent to ¬ Q → ¬ P, and
Q→ P is equivalent to ¬ P → ¬ Q.
Types of Inference rules:
1. Modus Ponens:
The Modus Ponens rule is one of the most important rules of inference, and it states that if P
and P → Q is true, then we can infer that Q will be true. It can be represented as:
Example:
2. Modus Tollens:
The Modus Tollens rule state that if P→ Q is true and ¬ Q is true, then ¬ P will also true. It
can be represented as:
3. Hypothetical Syllogism:
The Hypothetical Syllogism rule state that if P→R is true whenever P→Q is true, and Q→R
is true. It can be represented as the following notation:
Example:
Statement-1: If you have my home key then you can unlock my home. P→Q
Statement-2: If you can unlock my home then you can take my money. Q→R
Conclusion: If you have my home key then you can take my money. P→R
4. Disjunctive Syllogism:
The Disjunctive syllogism rule state that if P∨Q is true, and ¬P is true, then Q will be true. It
can be represented as:
Example:
Proof by truth-table:
5. Addition:
The Addition rule is one the common inference rule, and it states that If P is true, then P∨Q
will be true.
Example:
Proof by Truth-Table:
6. Simplification:
The simplification rule state that if P∧ Q is true, then Q or P will also be true. It can be
represented as:
Proof by Truth-Table:
7. Resolution:
The Resolution rule state that if P∨Q and ¬ P∧R is true, then Q∨R will also be true. It can be
represented as
Proof by Truth-Table:
MONOTONIC AND NON-MONOTONIC REASONING
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.
Example:
"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:
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.