Knowledge Representation Using Rules
Knowledge Representation Using Rules
Knowledge Representation Using Rules
08/12/21 1
Artificial Intelligence
08/12/21 2
Artificial Intelligence
08/12/21 3
Artificial Intelligence
08/12/21 4
Artificial Intelligence
Logic Programming
Logic programming is a programming language paradigm in which
logical assertions are viewed as programs, e.g : PROLOG
A PROLOG program is described as a series of logical assertions, each
of which is a Horn Clause.
A Horn Clause is a clause that has at most one positive literal.
Eg p, ¬ p V q etc are also Horn Clauses.
Fig 6.1
The fact that PROLOG programs are composed only of Horn Clauses
and not of arbitrary logical expressions has two important consequences.
Because of uniform representation a simple & effective interpreter
can be written.
The logic of Horn Clause systems is decidable.
08/12/21 6
Artificial Intelligence
Logic Programming
Even PROLOG works on backward reasoning.
The program is read top to bottom, left to right and search is performed
depth-first with backtracking.
There are some syntactic difference between the logic and the PROLOG
representations as mentioned in Fig 6.1
The key difference between the logic & PROLOG representation is that
PROLOG interpreter has a fixed control strategy, so assertions in the
PROLOG program define a particular search path to answer any question.
Where as Logical assertions define set of answers that they justify,
there can be more than one answers, it can be forward or backward
tracking .
08/12/21 7
Artificial Intelligence
Logic Programming
Control Strategy for PROLOG states that we begin with a problem
statement, which is viewed as a goal to be proved.
Look for the assertions that can prove the goal.
To decide whether a fact or a rule can be applied to the current problem,
invoke a standard unification procedure.
Reason backward from that goal until a path is found that terminates
with assertions in the program.
Consider paths using a depth-first search strategy and use backtracking.
Propagate to the answer by satisfying the conditions.
08/12/21 8
Artificial Intelligence
08/12/21 10
Artificial Intelligence
08/12/21 12
Artificial Intelligence
08/12/21 14
Artificial Intelligence
Matching
Till now we have used search to solve the problems as the application
of appropriate rules.
We applied them to individual problem states to generate new states to
which the rules can then be applied, until a solution is found.
We suggest that a clever search involves choosing from among the rules
that can be applied at a particular point, but we do not talk about how to
extract from the entire collection of rules those that can be applied at a
given point.
To do this we need matching.
08/12/21 15
Artificial Intelligence
Indexing
Do a simple search through all the rules, comparing each one’s
precondition to the current state and extracting all the ones that match.
But this has two problems
In order to solve very interesting problems , it will be necessary to
use a large number of rules, scanning through all of them at every
step of the search would be hopelessly inefficient.
It is not always immediately obvious whether a rule’s preconditions
are satisfied by a particular state.
To solve the first problem, use simple indexing. Eg. In Chess ,combine
all moves at a particular board state together.
08/12/21 16
Artificial Intelligence
08/12/21 17
Artificial Intelligence
08/12/21 18
Artificial Intelligence
Conflict Resolution
The result of the matching process is a list of rules whose antecedents
have matched the current state description along with whatever variable
binding were generated by the matching process.
It is the job of the search method to decide on the order in which the
rules will be applied. But sometimes it is useful to incorporate some of the
decision making into the matching process. This phase is called conflict
resolution.
There are three basic approaches to the problem of conflict resolution in
the production system
Assign a preference based on the rule that matched.
Assign a preference based on the objects that matched.
Assign a preference based on the action that the matched rule
would perform.
08/12/21 19