Professional Documents
Culture Documents
Answer:: Convert The Following To Clausal Form
Answer:: Convert The Following To Clausal Form
x [ Roman(x) know(x,Marcus)] [hate(x,Caesar) (y(z
hate(y,z)) thinkcrazy(x,y))]
Answer: "All Romans who know Marcus either hate Caesar or think that anyone who
hates anyone is crazy."
There are 9 simple steps to convert from Predicate logic to clause form.
Facts are held in the working memory (ie., contains the current state of the world). Rules represent the
action to be taken when specified facts occur in the working memory. The actions involve adding or
deleting facts from the working memory.
Algorithm: Forward chaining
i) Collect the rules whose conditions match facts in working memory.
ii) If more than one rule matches then
(a) Use conflict resolution strategy to select the rules.
iii) Do the actions indicated by the rules. ie add facts to working memory or delete facts from working
memory.
iv) Repeat these steps until the goal is reached or no condition match found.\
Example
Rule R1: IF hot and smoky THEN fire
Rule R2: IF alarm_beeps THEN smoky
Inference
Rule R1: IF hot and smoky THEN fire
Rule R2: IF alarm_beeps THEN smoky
Suppose that we know the facts A, B, C, D, E and the rules shown in the knowledge base to the left
What facts can we infer from this?
After inferring facts X, L, Y and Z there are no more rules that can be fired.
3.BACKWARD CHAINING
This is also called goal driven approach. A desired goal is placed in working memory, inference
cycle attempts to find evidence to prove it.
The knowledge base (rule base) is searched for rules that might lead to goal. If condition of such rule
matches fact in working memory then rule is fired and goal is proved.
Backward chaining means reasoning from goals to facts. Rules and facts are processed using
backward chaining interpreter.
Algorithm: Backward Chaining
i) Prove goal G.
ii) if G is the initial fact, it is proven.
iii) Otherwise, find a rule which can be used to conclude G, and try to prove each of the rules conditions.
Example 1
Rule R1: IF hot and smoky THEN fire
Rule R2: IF alarm_beeps THEN smoky
Suppose that we know the facts A, B, C, D, E and the rules shown in the knowledge base to the
left. Can we infer the fact Z?
Backward chaining inferred Z from the facts and rules that were available.
Advantages
Most efficient to infer one particular fact.
User may be asked to input additional facts
4.Convert Clausal Form Problem
1. All people who are graduating are happy.
2. All happy people smile.
3. Someone is graduating.
4. Conclusion: Is someone smiling?
. graduating(name1) graduating(x)
5.RESOLUTION
Resolution is a procedure used in proving that arguments which are expressible in predicate logic are
correct. Resolution is a procedure that produces proofs by refutation or contradiction. Resolution leads to
refute a theorem-proving technique for sentences in propositional logic and first order logic. Resolution is
a rule of inference. Resolution is a computerized theorem prover
Algorithm: Propositional Resolution
Let F be a set of axioms and P the theorem to prove.
1. Convert all the propositions of F to clause form.
2. Negate P and convert the result to clause form. Add it to the set of clauses obtained in step 1.
3. Repeat until either a contradiction is found or no progress can be made
(a) Select two clauses. Call these the parent clauses.
(b) Resolve them together. The resulting clause called the resolvent, will be the disjunction of all
of the literals of both of the parent clauses with the following exception: If there are any pair of
literals L and L such that one of the parent clauses contains L and the other contains L, then
select one such pair and eliminate both L and L from the resolvent.
(c) If the resolvent is the empty clause, then a contradiction has been found. If it is not, then
add it to the set of clauses available to the procedure.
Example 1
Converting a compound proposition to the clausal form
Consider the sentence
(AB) (CA)
1. Eliminate implication sign
(AB) (CA)
2. Eliminate the double negation and reduce scope of “not sign” (De-Morgans Law) (A B)
(CA)
3. Convert to conjunctive normal form by using distributive and associative laws
(AC A) (BCA)
4. Get the set clauses (AC) (BCA)
6.UNIFICATION ALGORITHM
When attempting to match 2 literals, all substitutions must be made to the entire literal. There
may be many substitutions that unify 2 literals, the most general unifier is always desired
Algorithm :Unify(L1,L2)
1. If L1 or L2 are both variables or constants, then:
(a) If L1 and L2 are identical, then return NIL.
(b) Else if L1 is a variable, then if L1 occurs in L2 the return {FAIL}, else return (L2/L1).
(c) Else if L2 is a variable, then if L2 occurs in L1 the return {FAIL}, else return (L1/L2).
(d) Else return {FAIL}
2. If the initial predicate symbols in L1 and L2 are not identical, the return {FAIL}.
3. If L1 and L2 have a different number of arguments, then return {FAIL}.
4. Set SUBST to NIL.
5. For i1 to number of arguments in L1:
(a) Call Unify with the ith argument of L1 and the ith argument of L2, putting
result in S. (b)If s contains FAIL then return {FAIL}
(c) If S is not equal to NIL then:
(i) Apply S to the remainder of both L1 and L2
(ii) SUBST=APPEND(S,SUBST).
6. Return SUBST.
Example
P(x) and P(y) :substitution = (x/y)
• P(x,x) and P(y,z) : (z/y)(y/x)
• P(x,f(y)) and P(Joe,z) : (Joe/x, f(y)/z)
• P(f(x)) and P(x) : can’t do it!
• P(x) Ú Q(Jane) and P(Bill) Q(y): (Bill/x, Jane/y)