Oct 27, 1993

DEEPAK BAPNA

ID # 010-74-9317

15-381 -> Task2
--------------------------------------------------------------------------

TRUTH MAINTENANCE SYSTEMS
-------------------------------------------------

1. The reason is stored as it can help in a sort of back-tracking. If
some new assertions are made or old ones retracted, and  it gets
the same query, it simply have to go through those dependencies and
check if they still hold to make a decision.

2. As a closed word assumption the tms has to assume that the pedigree is
not royal if it is not mentioned otherwise. So in a way we have a new
assertion that the Clyde's pedigree is not royal and then it checks it
with any defaults. Also it has to check pedigree to make sure that the
color is not white.

3. The answer to the query --> "tms-istrue(color(clyde,X),Y,R)" even
after the assertion about the clyde pedigree is made, is Grey.

This is because it no more goes through the other defaults once it
finds that one is true and it thinks it has a answer.

4. The heuristics of selecting the default rule with the longest term
will not always work.

Let's take an example:

In the nixons example, the result to the first (and the third)  querry
is "inconsistent". This is because, two defaults rules that apply have
the same length(2) and they are inconsistent. Now what if we had one
more preconditions on one of them- say the nationality. The changed
defaults look like:

tms-default([military(X,passifist),religion(X,quaker),nationality(X,american)]).

and assert that:

tms-assert(nationality(nixon,american),yes).

What will happen in this case? The length for the corresponding
default will increase to three and the result will be passifist, even
though it should be inconsistent. (The modified prolog file
nixon1.prolog and output are submitted).

SO THE HEURISTIC FAILS !!!

BACKWARD VERSUS FORWARD CHAINING
-----------------------------------------------------

1. For the water-jug problem the search should proceed forward. There
are two main reasons for that:

	a) # of goal states > # of initial-states
           
           If the state is represented by (A,B) where A is the amount

	   of water in 4-gallon jug and B, the amount of water in the 
	   3-gallon jug then:
          
           Initial state: (0,0)
	   Goal state: (2,0), (2,1), (2,2), (2,3)

	   Rule 1 says that proceed from smaller to large no. of
	   states. 

	b) The branching factor is almost same in two cases, so there
	   is no special advantage of backward chaining.

2. Same number of paths are search for 8-puzzle irrespective of
forward or backward chaining: 
	
	a) Both initial-state and goal states are unique.

	b) The branching factor is same in both the directions- same
	   set of operators define both the forward and backward
	   searching.     
	   	 

ABDUCTION AND MINIMAL REASONING
----------------------------------------------------

1. The abductive inference alone cannot be used to derive any
conclusions. The abductive inference says that

"Given two wff's (A -> B) and (B), for any expressions A and B, if it
is convenient to assume A, do so."

Well, but we should atleast know B. In the given database:

CHICKEN-POX(X) --> FEVER(X) ^ SPOTS (X)
POISON-IVY(X) --> ~FEVER(X) ^ SPOTS(X)
SPOTS(John)

B means (FEVER(X) ^ SPOTS (X)) or (~FEVER(X0 ^ SPOTS(X)). So to infer
anything using abductive reasoning we should know this or in other
words we should have some idea about John's fever.

2. Now if we make CWA assumption, that means that unless it is
specifically mentioned that John has a fever, we assume that he
hasn't. So we assume ~FEVER(John) and hence using the
abductive-inference POISON-IVY(John).

3. The resulting data base becomes:

CHICKEN-POX(X) --> ~NORMAL-TEMP(X) ^ SPOTS (X)
POISON-IVY(X)  --> NORMAL-TEMP(X) ^ SPOTS(X)
SPOTS(John)

The CWA lets us assume that ~NORMAL-TEMP(John) and hence the abductive
inference gives CHICKEN-POX(John)


-----------------------------------------------------------------------------

The modified code for Proble 4 folllows:


/* File: dict.prolog to load the tms and run the Nixon example. */

/* Load the tms code */
?- consult('tms.prolog').

/* Put the default rules into the tms.
 * Each rule has the form :
 * tms-default([<attribute>(<item>,<value>),... conditions...]).
 * <attribute> - the attribute the rule is used to infer.
 * <item> - the object the attribute value is being calculated for.
 * <value> - the value of the attribute for the item.
 * conditions - a list of predicates that calculate the value.
 * Note : words starting with an uppercase letter are variables.
 *        words starting with lower case letters are constants.
 *        lists are enclosed in "[]" and items are seperated by ","
 */

/* quakers are passifists. */
/* republicans are warhawks. */
tms-default([military(X,passifist),religion(X,quaker),nationality(X,american)]).
tms-default([military(X,warhawk),party(X,republican)]).

/* assert that Nixon is a quaker. */
?- tms-assert(religion(nixon,quaker),yes).

/* assert that Nixon is a republican. */
?- tms-assert(party(nixon,republican),yes).

/* query to find Nixon's military attitude. */
?- tms-istrue(military(nixon,X),Y,R).

/* assert that Nixon is an American */
?- tms-assert(nationality(nixon,american),yes).

/* query to find Nixon's military attitude. */
?- tms-istrue(military(nixon,X),Y,R).

/* retract that Nixon is a republican. */
?- tms-retract(party(nixon,republican),yes).

/* query to find Nixon's military attitude. */
?- tms-istrue(military(nixon,X),Y,R).

/* query to find Nixon's military attitude. */
?- tms-istrue(military(nixon,X),Y,R).

/* reassert that Nixon is a republican. */
?- tms-assert(party(nixon,republican),yes).


/* query to find Nixon's military attitude. */
?- tms-istrue(military(nixon,X),Y,R).

/* retract that Nixon is a quaker. */
?- tms-retract(religion(nixon,quaker),yes).

/* query to find Nixon's military attitude. */
?- tms-istrue(military(nixon,X),Y,R).

--------------------------------------------------------------------

The output of this modified code is:
% cprolog
C-Prolog version 1.5+
| ?- ['nixon1.prolog'].
tms.prolog consulted 6256 bytes 0.1 sec.

yes

yes

yes

X = warhawk
Y = yes
R = [[default,military(nixon,warhawk),[defaults,longest,[[default,military(nixon
,passifist),no,[religion(nixon,quaker),nationality(nixon,american)]],[default,mi
litary(nixon,warhawk),yes,[[given,party(nixon,republican),[]]]]]]]]

yes

yes

X = passifist
Y = yes
R = [[default,military(nixon,passifist),[defaults,longest,[[default,military(nix
on,passifist),yes,[[given,religion(nixon,quaker),[]],[given,nationality(nixon,am
erican),[]]]],[default,military(nixon,warhawk),yes,[[given,party(nixon,republica
n),[]]]]]]]]

yes

yes

X = passifist
Y = yes
R = [[default,military(nixon,passifist),[defaults,longest,[[default,military(nix
on,passifist),yes,[[given,religion(nixon,quaker),[]],[given,nationality(nixon,am
erican),[]]]],[default,military(nixon,warhawk),no,[failure,party(nixon,republica
n)]]]]]]

yes

yes

X = passifist
Y = yes
R = [[default,military(nixon,passifist),[defaults,longest,[[default,military(nix
on,passifist),yes,[[given,religion(nixon,quaker),[]],[given,nationality(nixon,am
erican),[]]]],[default,military(nixon,warhawk),yes,[[given,party(nixon,republica
n),[]]]]]]]]

yes

yes

X = warhawk
Y = yes
R = [[default,military(nixon,warhawk),[defaults,longest,[[default,military(nixon
,passifist),no,[failure,religion(nixon,quaker)]],[default,military(nixon,warhawk
),yes,[[given,party(nixon,republican),[]]]]]]]]

yes
nixon1.prolog consulted 7396 bytes 0.466666 sec.

yes
| ?- halt.
-------------------------------------------------------------------------

