A.D.A. PROLOG

                        Top of memory < 513638

                  Workspace Available:   327 Kbytes

                  Workspace Permitted:   327 Kbytes

                  type PD (PUBLIC DOMAIN VERSION)

                      Version 1.95D - 6/27/87

     Copyright Robert Morein and Automata Design Associates 1985

                  Dresher, Pa. (215) - 646-4894

 

 

?-consult 'ex1.pro'.

Compiling ex1.pro.

Yes.

?-p(a).

Yes.

?-p(b).

No.

?-p(c).

Yes.

?- trace.

 

Built_in function "trace" not implemented.

No.

?-

 

 

 

                           A.D.A. PROLOG

                        Top of memory < 503366

                  Workspace Available:   308 Kbytes

                  Workspace Permitted:   308 Kbytes

                   type ED (EDUCATIONAL VERSION)

                      Version 1.95D - 6/27/87

     Copyright Robert Morein and Automata Design Associates 1985

                  Dresher, Pa. (215) - 646-4894

 

?-consult ex1.

 

Compiling ex1.

 

Yes.

?-trace.

 

E: trace

 

Yes.

?-p(a).

 

C: p(a)

C: q(a)

E: q(a)

C: not r(a)

C: r(a)

C: w(a)

E: w(a)

C: not s(a)

C: s(a)

E: s(a)

F: not s(a)

R: w(a)

F: w(a)

F: r(a)

Yes.

?-p(b).

 

C: p(b)

C: q(b)

E: q(b)

C: not r(b)

C: r(b)

C: w(b)

E: w(b)

C: not s(b)

C: s(b)

F: s(b)

E: not s(b)

E: r(b)

F: not r(b)

R: q(b)

F: q(b)

F: p(b)

No.

?-p(c).

 

C: p(c)

C: q(c)

E: q(c)

C: not r(c)

C: r(c)

C: w(c)

F: w(c)

F: r(c)

Yes.

?-notrace.

 

C: notrace

 

Yes.

?-

 

 

?-dir.

 

   a (0)

   b (0)

   c (0)

S: ex1

   p (1)

   q (3)

   r (1)

   s (2)

   w (2)

 

Yes.

?-dir p.

 

   p (1)

   q (3)

   r (1)

   s (2)

   w (2)

 

 

?-consult ex2.

 

Compiling ex2.

 

Yes.

?-dir.

 

   a (0)

   b (0)

   bachelor (1)

   c (0)

S: ex1

S: ex2

   henry (0)

   male (2)

   married (1)

   p (1)

   q (3)

   r (1)

   s (2)

   tom (0)

   w (2)

 

Yes.

?-dir p.

 

   bachelor (1)

   male (2)

   married (1)

   p (1)

   q (3)

   r (1)

   s (2)

   w (2)

 

Yes.

?-consult ex3.

 

Compiling ex3.

 

Yes.

?-dir p.

 

   bachelor (1)

   distance (1)

   male (2)

   married (1)

   p (1)

   q (3)

   r (1)

   s (2)

   speed (4)

   time (4)

   w (2)

 

Yes.

?-dir.

 

   a (0)

   b (0)

   bachelor (1)

   c (0)

   chevy (0)

   dodge (0)

   distance (1)

S: ex1

S: ex2

S: ex3

   ford (0)

   henry (0)

   male (2)

   married (1)

   p (1)

   q (3)

   r (1)

   s (2)

   speed (4)

   tom (0)

   time (4)

   volvo (0)

   w (2)

 

Yes.

?-consult ex4.

 

Compiling ex4.

 

Yes.

?-dir p.

 

   bachelor (1)

   distance (1)

   likes (4)

   male (2)

   married (1)

   p (1)

   q (3)

   r (1)

   s (2)

   speed (4)

   time (4)

   w (2)

 

Yes.

?-dir.

 

   a (0)

   apricots (0)

   b (0)

   bachelor (1)

   c (0)

   chevy (0)

   chocolate (0)

   dodge (0)

   distance (1)

   darcie (0)

S: ex1

S: ex2

S: ex3

S: ex4

   ford (0)

   henry (0)

   jake (0)

   likes (4)

   licorice (0)

   male (2)

   married (1)

   p (1)

   q (3)

   r (1)

   s (2)

   speed (4)

   tom (0)

   time (4)

   volvo (0)

   w (2)

 

Yes.

?-trace.

 

E: trace

 

Yes.

?-likes(jake,What),likes(marcie,What).

 

C: likes(jake,What_0)

E: likes(jake,chocolate)

C: likes(marcie,chocolate)

F: likes(marcie,chocolate)

R: likes(jake,What_0)

E: likes(jake,apricots)

C: likes(marcie,apricots)

F: likes(marcie,apricots)

R: likes(jake,What_0)

F: likes(jake,What_0)

 

?-listing.

 

bachelor(P) :-

(male(P) , not married(P) ).

distance(X,Y) :-

(speed(X,Speed) , (time(X,Time) , (Y is (Speed * Time)))).

likes(jake,chocolate).

likes(jake,apricots).

likes(darcie,licorice).

likes(darcie,apricots).

male(henry).

male(tom).

married(tom).

p(X) :-

(q(X) , not r(X) ).

q(a).

q(b).

q(c).

r(X) :-

(w(X) , not s(X) ).

s(a).

s(a).

speed(ford,100).

speed(chevy,105).

speed(dodge,95).

speed(volvo,80).

time(ford,20).

time(chevy,21).

time(dodge,24).

time(volvo,24).

w(a).

w(b).

 

Yes.

?-forget ex1.

 

 

Yes.

?-dir p.

 

   bachelor (1)

   distance (1)

   likes (4)

   male (2)

   married (1)

   speed (4)

   time (4)

 

Yes.

?-retract (time (volvo,24)).

 

 

Yes.

More? (Y/N):n

?-listing.

 

bachelor(P) :-

(male(P) , not married(P) ).

distance(X,Y) :-

(speed(X,Speed) , (time(X,Time) , (Y is (Speed * Time))))

likes(jake,chocolate).

likes(jake,apricots).

likes(darcie,licorice).

likes(darcie,apricots).

male(henry).

male(tom).

married(tom).

speed(ford,100).

speed(chevy,105).

speed(dodge,95).

speed(volvo,80).

time(ford,20).

time(chevy,21).

time(dodge,24).

 

Yes.

?-consult ex5.

 

Compiling ex5.

 

Yes.

?-rarebird(condor).

 

No.

?-rarebird(What).

 

 

What = [condor,whooping_crane,dusky_seaside_sparrow]

?-consult ex6.

 

Compiling ex6.

 

Yes.

?-listing.

 

noteworthy(Bird) :-

rarebird([Bird, _ , _ ]).

noteworthy(Bird) :-

rarebird([ _ ,Bird, _ ]).

noteworthy(Bird) :-

rarebird([ _ , _ ,Bird]).

rarebird([condor,whooping_crane,dusky_seaside_sparrow]).

 

Yes.

?-rarebird(Who).

 

Who = [condor,whooping_crane,dusky_seaside_sparrow]

?-noteworthy(condor).

 

Yes.

More? (Y/N):n

?-noteworthy(Who).

 

Who = condor

More? (Y/N):y

 

Who = whooping_crane

More? (Y/N):y

 

 

 

Who = dusky_seaside_sparrow

?-