程序代写代做代考 prolog Microsoft Word – assignment.doc

Microsoft Word – assignment.doc

An Exercise on the Use of Prolog as
a logic programming tool

Learning Objective: To reinforce the understanding on the use of Prolog as a tool of

logic programming and the specification of declarative knowledge
– semantic information.

Learning Outcome: a) Understand the separation of Knowledge from the

inference mechanism in Knowledge-Based System (KBS).
b) Understand that the proof procedure is based on the

refutational proof using resolution on Horn Clauses.
c) Appreciate the ordering of the clauses of the same class

affects the proof sequence.

Tools: SWI-Prolog – http://www.swi-prolog.org/

Deliverables: This assignment consists of two problems to be specified as a

declarative knowledge in Prolog. The prolog knowledge base and
traces of queries need to be submitted to the Software Project Lab
(N4-B1b-11) within one week after your lab session for this
assignment.

Exercise 1: The Smart Phone Rivalry

SumSum, a competitor of Appy, developed some nice smart phone technology called
Galactica-S3, all of which was stolen by Stevey, who is a Boss. It is unethical for a Boss
to steal business from rival companies. A competitor of Appy is a rival. Smart phone
technology is a business.

1. Translate the natural language statements above describing the dealing within

the Smart Phone industry in to First Order Logic, (FOL).

2. Write these FOL statements as Prolog clauses.

3. Using the prolog search engine, prove that Stevey is unethical. Show a trace

of your proof.

http://www.swi-prolog.org/

Exercise 2: The Royal Family

The old Royal succession rule states that the throne is passed down along the male line
according to the order of birth before the consideration along the female line – similarly
according to the order of birth. Queen Elizabeth, the monarch of United Kingdom, has
four offsprings; namely:- Prince Charles, Princess Ann, Prince Andrew and Prince
Edward – listed in the order of birth.

1. Define their relations and rules in a prolog rule base. Hence, define the old Royal

succession rule. Using this old succession rule determine the line of succession
based on the information given. Do a trace to show your results.

2. Recently, the Royal succession rule has been modified. The throne is now passed

down according to the order of birth irrespective of gender. Modify your rules and
prolog knowledge base to handle the new succession rule. Explain the necessary
changes to the knowledge needed to represent the new information. Use this new
succession rule to determine the new line of succession based on the same
knowledge given. Show your results using a trace.