Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Fundamentals Of Database Systems

Authors: Sham Navathe,Ramez Elmasri

5th Edition

B01FGJTE0Q, 978-0805317558

More Books

Students also viewed these Databases questions

Question

To solve by the graphical methods 2x +3y = 9 9x - 8y = 10

Answered: 1 week ago

Question

Why does sin 2x + cos2x =1 ?

Answered: 1 week ago

Question

What are DNA and RNA and what is the difference between them?

Answered: 1 week ago

Question

Why do living creatures die? Can it be proved that they are reborn?

Answered: 1 week ago