Unit III
Unit III
Consider the following example that shows the use of predicate logic as a way of representing Now let’s try to produce a formal proof, reasoning backward from the desired goal:
knowledge. ¬Ioyalto(Marcus, Caesar)
1. Marcus was a man. In order to prove the goal, we need to use the rules of inference to transform it into another goal
7. People only try to assassinate rulers they are not loyal to.
The facts described by these sentences can be represented as a set of well-formed formulas (wffs)
as follows:
man(Marcus)
Pompeian(Marcus)
∀x: Pompeian(x) → Roman(x) The problem is that, although we know that Marcus was a man, we do not have any way to conclude
from that that Marcus was a person. Also, We need to add the representation of another fact to our
4. Caesar was a ruler. system, namely:
ruler(Caesar) ∀ man(x) → person(x)
5. All Pompeians were either loyal to Caesar or hated him. From this simple example, we see that three important issues must be addressed in the process of
inclusive-or converting English sentences into logical statements and then using those statements to deduce new
ones:
∀x: Roman(x) → loyalto(x, Caesar) ∨ hate(x, Caesar)
1. Many English sentences are ambiguous . Choosing the correct interpretation may be
exclusive-or difficult.
2. There is often a choice of how to represent the knowledge. Simple representations are
∀x: Roman(x) → (loyalto(x, Caesar) ∧¬ hate(x, Caesar)) ∨(¬loyalto(x, Caesar) ∧ hate(x, Caesar))
desirable, but they may exclude certain kinds of reasoning.
Everyone is loyal to someone. 3. Even in very simple situations, a set of sentences is unlikely to contain all the information
necessary to reason about the topic at hand
∀x: ∃y: loyalto(x, y)
Representing Instance and ISA Relationships:
7. People only try to assassinate rulers they are not loyal to.
◦ Specific attributes instance and isa play an important role particularly in a useful form of
∀x: ∀y: person(x) ∧ ruler(y) ∧ tryassassinate(x, y) →¬loyalto(x, y)
reasoning called property inheritance
8. Marcus tried to assassinate Caesar.
◦ The predicates instance and isa explicitly captured the relationships they used to express,
namely class membership and class inclusion.
Consider 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 predicate instance is a binary one, whose first argument is an object and
whose second argument is a class to which the object belongs.
◦ . The implication rule states that if an object is an instance of the subclass Pompeian then it
is an instance of the superclass Roman.
◦ 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. This additional
axiom describes how an instance and iss relation an be combined to derive a new instance
relation.
There are usually different ways of representing a given fact with in a particular
framework. The choice depends on which deductions need to be supported most efficiently .
The important factor in knowledge base is consistency.
Declarative Knowledge
◦ A statement in which knowledge specified, but the use to which that knowledge is to be put
is not given.
◦ For example, laws, people’s name; these are the facts which can stand alone, not dependent
on other knowledge;
◦ For example, a set of logical assertions can combine with a resolution theorem prover to
give a complete program for solving problems but in some cases, the logical assertions can
view as a program rather than data to a program.
◦ Hence the implication statements define the legitimate reasoning paths and automatic
assertions provide the starting points of those paths.
◦ These paths define the execution paths which is similar to the ‘if then else “in traditional
programming. So logical assertions can view as a procedural representation of knowledge.
Procedural Knowledge
◦ A representation in which the control information that is necessary to use the knowledge is
embedded in the knowledge itself for e.g. computer programs, directions, and recipes; these
indicate specific use or implementation;
◦ The real difference between declarative and procedural views of knowledge lies in where
control information reside.
◦ Man (Marcus)
◦ Man (Caesar)
◦ Person (Cleopatra)
◦ Y=Marcus The facts are represented on Horn Clause for two reasons.
◦ Y=Caesar 1. Because of a uniform representation, a simple and efficient interpreter can write.
◦ We get more than one value that satisfies the predicate. If only one value needed, then the There are certain differences between the logic and PROLOG
answer to the question will depend on the order in which the assertions examined during
1. In logic variables are explicitly quantified. In PROLOG quantification is provided implicitly by
the search for a response.
the wat variables are interpreted. In PROLOG all variables begin with uppercase letters and
If the assertions declarative then they do not themselves say anything about how they will be all constants begin with lower case letters
examined. In case of procedural representation, they say how they will examine
2. In logic there are explicit symbols for and(^) and or (V) . In PROLOG there is an explicit
Logic Programming – Representing Knowledge Using Rules: symbol for and(,) disjunction is represented as a list of alternative statements.
◦ Logic programming is a programming paradigm in which logical assertions viewed as 3. In logic implications of the form “ p implies q” are written as pq. In PROLOG the
programs. implication is written backward as q: -p
◦ These are several logic programming systems, PROLOG is one of them. Also, The first two differences are the fact that PROLOG programs are actually sets of Horn clause
that have been transformed as follows:-
◦ A PROLOG program consists of several logical assertions where each is a horn clause i.e. a
clause with at most one positive literal. 1. If the Horn Clause contains no negative literal then leave it as it is.
◦ Ex : P, P V Q, P → Q 2. Also, Otherwise rewrite the Horn clauses as an implication, combining all of the negative literals
into the antecedent of the implications and the single positive literal into the consequent
This procedure causes a clause which originally consisted of a disjunction of literals (one of them was
positive) to be transformed into a single implication whose antecedent is a conjunction universally
quantified. But when we apply this transformation, any variables that occurred in negative literals
and so now occur in the antecedent become existentially quantified, while the variables in the
consequent are still universally quantified.
For example the PROLOG clause P(x): – Q(x, y) is equal to logical expression ∀x: ∃y: Q (x, y) → P(x)
The difference between the logic and PROLOG representation is that the PROLOG interpretation has
a fixed control strategy. And so, the assertions in the PROLOG program define a particular search
path to answer any question. But, the logical assertions define only the set of answers but not about
how to choose among those answers if there is more than one.
The basic PROLOG Control strategy is very simple. Begin with a problem statement which is viewed
as goal to be proved. Look for assertions that can prove the goal. Consider the facts which prove the
goal directly and also consider any rule whole head matches the goal.
1. Logical representation
poodle (fluffy)
2. Prolog representation
poodle (fluffy)