[SOLVED] CSE3ALR Artificial Intelligence: Logic & Reasoning

$25

File Name: CSE3ALR_Artificial_Intelligence:_Logic_&_Reasoning.zip
File Size: 471 KB

5/5 - (1 vote)

1 Objectives

CSE3ALR Artificial Intelligence: Logic & Reasoning

2015 Assignment Statement

To understand the principles of automated reasoning by implementing an Inference Engine.

2 Due Date

The due date of the assignment is 9:30am, Wednesday 27 May 2015.

3 Submission Details

Submit your assignment via the Online Assignment Submission system at http://students.cs.latrobe.edu.au/student-tools/online-assign-submit/ .

If your assignment contains multiple files, please DO NOT zip them. You are allowed to submit as many files as you need. Please ensure that your name and student ID are on each file.

Submission after the deadline will incur a penalty of 5% of the assignments total mark per day delayed. If you have encountered difficulties that lead to late submission or no submission, you should contact ASK La Trobe to apply for special consideration. No assignment is accepted 4 days after the due date.

4 Plagiarism

This is an individual assignment.

Plagiarism: Plagiarism is the submission of another persons work in a manner that gives the impression that the work is your own. La Trobe University treats plagiarism seriously. When detected, penalties are strictly imposed. Further information can be found at http://www.latrobe.edu.au/plagiarism/plagiarism.html

5 Assignment Assistance

Any questions related to the assignment can be directed to the lecturer during her normal consultation time. Special consultation sessions will also be organised two weeks before the due date. Time and venue will be announced.

6 Marking Scheme and Execution Test

Marking scheme of the assignment is as follows

(1) Implementation (Execution of code) 90% (Do all parts of the program execute correctly? Is the required functionality achieved? Does the program satisfy all requirements specified in the assignment specification? Note your program must compile and run on latcs6)

CSE3ALR Assignment Page 1 of 5

(2) Code Design, Structure and Layout 10% (Quality of the program design, code optimization and coding style)

An execution test will be conducted in the lab, in which a teaching staff will sit with you to go through the execution of your program while marking your assignment. The test will be conducted from the assignment submission area, not from student accounts.

7 Return of Assignments

Marked assignments will be returned within 3 weeks of the execution test.

8 Problem Description

8.1 Description

PROLOG is an inference engine based on First Order Logic. One can load a logic program (based on First Order Logic) into PROLOG, and conduct reasoning. The task of this assignment is to build an Inference Engine based on Propositional Logic (IEPL).

The functionality of your IEPL includes

(1) Loading a logic program This function is the same as

consult/1
in swi-prolog. If a user intents to load a logic program (myProgram.pl) into swi-prolog, the user types the command

consult(myProgram.pl).

In exactly the same way, to load a logic program (myProgram.iepl) into IEPL, one uses the command

consult(myProgram.iepl).

Note that the difference between propositional logic and first order logic is that predicates in first order logic take parameters where propositions in propositional logic do not.

The two examples (Example 1 and Example 2) below demonstrate this. Example 1 is a logic program based on first order logic.

Example 1

/* example1.pl */
parent(a, b).
parent(a, c).
parent(c, d).
grandParent(X, Y) :- parent(X, Z), parent(Z, Y).

If we save the logic program as example1.pl, and load it into swi-prolog, then reasoning on the program can be

1 ?- consult(example1.pl).

% example1.pl compiled 0.00 sec, 884 bytes True.

2 ?- grandParent(U, W).

U= a

CSE3ALR Assignment

Page 2 of 5

W =d ; False.

Example 2 is a logic program based on propositional logic.

Example 2

rain.
goOut.
bringUmbrella :- rain, goOut.
drive :- bringUmbrella. applySunScreen :- sunShine, goOut.

If we save the program as example2.iepl, and load it into IEPL, reasoning on the program can be 1 ?- consult(example2.iepl).

True.

2 ?- drive.

True.

3 ?- applySunScreen.

False.

(2) Answering a query
After loading the logic program, IEPL should be able to answer a query. A query can be a single proposition, a variable or the conjunction of multiple propositions. For example,

bringUmbrella.
Z.
bringUmbrella, applySunScreen.

are all valid queries. If the query contains a variable only, it requires IEPL to display all facts and all that can be derived from the program.

(3) The inference engine and its syntax
During the derivation, IEPL follows the same principles as PROLOG. That are

(a) back-tracking.
(b) pattern-matching.
(c) depth-first search.
(d) selecting clauses according to their order in the program. (e) selecting sub-goals from left to right.

IEPL is confirmative with the syntax of PROLOG. That is

  1. (a) a proposition is represented as a string of chars and digits. It starts with a lower case char.

    The maximum length of the string is 20.

  2. (b) a variable is represented as a string of chars and digits. It starts with a capital letter. The

    maximum length of the string is 20.

  3. (c) logical conjunction (and) is represented as ,
  4. (d) logical implication is represented as :-
  5. (e) the end of a clause is marked by .
  6. (f) there should be only one clause per line in the program.
  7. (g) a standard clause is

    consequent :- antecedent1, antecedent2, , antecedentK. consequent is the head of the clause.
    antecedent1, antecedent2, , antecedentK is the body of the clause.

CSE3ALR Assignment

Page 3 of 5

If the body is empty, then the clause is a fact; otherwise it is a rule.

(4) Exit
Like PROLOG, halt/0 is defined to exit IEPL. When the command

halt.

is entered, the execution of IEPL is terminated.

8.2 Requirements

  1. (1) Your IEPL should be implemented in JAVA programming language.
  2. (2) Your IEPL is NOT required to conduct syntax checking (ie. you can assume that all programs loaded into IEPL are syntax error free).
  3. (3) The implementation of disjunction is not required in this assignment (ie. you can assume that no clause loaded into your IEPL contains disjunction).
  4. (4) When multiple logic programs are loaded into IEPL, clauses from all programs should be available in IEPL for derivations. Clauses should be stored in such an order if program A is loaded before program B, then all clauses of program A are in front of clauses of program B.

    For example, if the logic program example3.iepl is as follows walkToUni :- sunShine.

    takeBusUni :- bringUmbralle.

    then commands

    1 ?- consult(example2.pl). True.

    2 ?- consult(example3.pl). True.

    will create a database in IEPL as follows

    rain.
    goOut.
    bringUmbrella :- rain, goOut.
    drive :- bringUmbrella. applySunScreen :- sunShine,goOut. walkToUni :- sunShine. takeBusToUni :- bringUmbrella.

    And consequently,

    3 ?- takeBusToUni. True.

CSE3ALR Assignment

Page 4 of 5

9 Samples of Program Execution

Assume the logic program example4.iepl is as below.

person.
studying.
writingMajorThesis.
fullTimeWorking.
student :- person, studying.
researchStudent :- student, writingMajorThesis. partTimeStudent :- student, fullTimeWorking. partTimeResearchStudent :- partTimeStudent, researchStudent. partTimeFullFeeStudent :- partTimeStudent, payingFullFee.

The execution of IEPL can be as follows.

java IEPL
1 ?- consult(example4.iepl). True.

2 ?- person. True.

3 ?- student. True.

4 ?- partTimeResearchStudent. True.

5 ?- partTimeFullFeeStudent. False.

6 ?- student, person. True.

7 ?- student, applySunScreen. False.

8 ?- X.
X = [person; studying; writingMajorThesis; fullTimeWorking; student; researchStudent;

partTimeStudent; partTimeResearchStudent] 9 ?- halt.

CSE3ALR Assignment Page 5 of 5

Reviews

There are no reviews yet.

Only logged in customers who have purchased this product may leave a review.

Shopping Cart
[SOLVED] CSE3ALR Artificial Intelligence: Logic & Reasoning
$25