Question: by using prolog program : - Below is a list of the most recent American presidents: Donald Trump 2017- Barack Obama 2009-2017 George W.Bush 2001-2009

by using prolog program :

- Below is a list of the most recent American presidents:

Donald Trump 2017-

Barack Obama 2009-2017

George W.Bush 2001-2009

Bill Clinton 1993-2001

George H.W.Bush 1989-1993

Ronald Reagan 1981-1989

Jimmy Carter 1977-1981

Gerald Ford 1974-1977

Richard Nixon 1969-1974

Lyndon B.Johnson 1963-1969

John F. Kennedy 1961-1963

a) Build a knowledge base using the predicate directlyAfter/2 which encodes one president is directly after another president.

b) Formulate and add a RULE called directlyBefore/2 tells which president is directly before which other president.

c) Define another rule called after/2 that tells us which president is (directly or indirectly) after which other president. For example, the query after(Barak Obama, John F. Kennedy). should evaluate to be true, while after(George H. Bush,Barak Obama). should fail.

d) Test your implementation by asking queries. Write down your query and also the result.

Is Obama directly before Trump?

Is Carter after Johnson?

Who are after Ford?

Who are the presidents in the knowledge base?

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!