0% found this document useful (0 votes)
11 views6 pages

ECS533U Week 8 Lab Exercises

Uploaded by

Mehrab Ali
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views6 pages

ECS533U Week 8 Lab Exercises

Uploaded by

Mehrab Ali
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

_______________________________

ECS533U Introduction to AI
Lab Exercises Week 8
_______________________________

Objective: The lab exercises for this class are designed to solidify the concepts we covered
during the lectures. The will range from theoretical questions, problem-solving tasks and
practical implementations. In week 8 we looked at inference in first-order logic: in this lab
you will use forward chaining and resolution to perform inference.

Textbook site: https://aima.cs.berkeley.edu/global-index.html

This lab is eligible for submission for Coursework 2.

Prerequisites (or things to learn along the way)


● Basic knowledge of first-order logic.
● Forward chaining inference
● The binary resolution inference rule

Document Summary
Exercises
Marking Criteria
Submission Details
Change Log
Exercises
This lab can be done individually (individual task) or in a group of 2 (group task). Any
changes to depth or breadth of each task is clearly detailed in the exercise description.
Note: in this lab, all tasks are individual except for the additional group task described in
Exercise 8.3.

Note: you may use text symbols in place of logical notation, e.g. OR, FORALL. You are not
expected to format logical formulae beautifully, but they must be clear and readable.

Exercise 8.1: Forward Chaining (16 Marks)

Time: 30 minutes

Task: Describe how forward chaining works with this knowledge base.

Output: A written description of your answers (PDF or Word).

Suppose a knowledge base contains just the following first-order sentences:

A: 𝐴𝑛𝑐𝑒𝑠𝑡𝑜𝑟(𝑀𝑜𝑡ℎ𝑒𝑟(𝑥), 𝑥)

B: 𝐴𝑛𝑐𝑒𝑠𝑡𝑜𝑟(𝑥, 𝑦) ∧ 𝐴𝑛𝑐𝑒𝑠𝑡𝑜𝑟(𝑦, 𝑧) ⇒ 𝐴𝑛𝑐𝑒𝑠𝑡𝑜𝑟(𝑥, 𝑧)

Consider a forward chaining algorithm that, on the jth iteration, terminates if the KB contains
a sentence that unifies with the query, else adds to the KB every atomic sentence that can
be inferred from the sentences already in the KB after iteration j − 1.

Describe the first two iterations of forward chaining on this knowledge base. Draw a diagram
to show how sentences are related. (You do not have to include the formulae in your
diagram: label your formulae and refer to the labels in the diagram.)

For each of the following queries, say whether the algorithm will:

1. Give an answer (if so, give the answer and the iteration it is found);
2. Terminate with no answer;
3. Never terminate.

Justify your answers.

Query 1: 𝐴𝑛𝑐𝑒𝑠𝑡𝑜𝑟(𝑀𝑜𝑡ℎ𝑒𝑟(𝑦), 𝐽𝑜ℎ𝑛)

Query 2: 𝐴𝑛𝑐𝑒𝑠𝑡𝑜𝑟(𝑀𝑜𝑡ℎ𝑒𝑟(𝐽𝑜ℎ𝑛), 𝑀𝑜𝑡ℎ𝑒𝑟(𝑀𝑜𝑡ℎ𝑒𝑟(𝐽𝑜ℎ𝑛)))

Query 3: 𝐴𝑛𝑐𝑒𝑠𝑡𝑜𝑟(𝑀𝑜𝑡ℎ𝑒𝑟(𝑀𝑜𝑡ℎ𝑒𝑟(𝑦), 𝐽𝑜ℎ𝑛)

Query 4: 𝐴𝑛𝑐𝑒𝑠𝑡𝑜𝑟(𝑀𝑜𝑡ℎ𝑒𝑟(𝑀𝑜𝑡ℎ𝑒𝑟(𝑀𝑜𝑡ℎ𝑒𝑟(𝑦))), 𝑀𝑜𝑡ℎ𝑒𝑟(𝑦))


Exercise 8.2: Resolution (24 Marks)

Time: 30-60 minutes

Task: Use resolution to prove a theorem by hand.

Output: A written description of the knowledge base and attempted proof (PDF or Word).

Translate the sentences A and B into a first order knowledge base.

A: “Horses are animals.”

B: “The head of a horse is the head of an animal.”

Use three predicates: HeadOf (h, x) (meaning “h is the head of x”), Horse (x), and Animal
(x).

Use resolution to prove that B follows from A.

Draw a diagram to illustrate your proof. (Again, you do not have to include the formulae in
your diagram: label your formulae and refer to the labels in the diagram.)

Exercise 8.3: Family Knowledge Base (60 Marks)

Time: 60-90 minutes

Task: Design a first-order logic knowledge base about family relationships. Attempt to prove
some simple theorems about the knowledge base.

Output: A written description of the knowledge base and attempted proofs (PDF or Word).

Choose a well-known family or make up your own fictional family. Design a first-order logic
knowledge base that represents these people and their family relationships.

Use ground facts to describe:

● The people in the family (use a predicate person/1).


● Describe parent-child relationships.

Give single sentences which describe the following relationship:

● Grandparents
● Siblings.
● Either uncles or aunts.

You may use equality axioms (see Russell & Norvig section 9.5.5 for a description of equality
axioms).
State and prove three theorems using either forward chaining or resolution:

1. A ground theorem (i.e. sentences without variables) about a grandparent


relationship.
2. A ground theorem about an uncle or aunt relationship.
3. “Someone's sibling's aunt is their aunt” (or the same theorem about uncles).

Briefly discuss whether forward chaining or resolution could be used in each case, and why.

Group Task: Complete the individual tasks described above, and additionally add the concept of
cousin to the knowledge base. State a non-ground theorem about cousins and prove it using
resolution.

Marking Criteria
Total marks available: 100

Task 8.1
Criteria Marks Description

Describe Iterations 50% Full marks for correctly describing two iterations of forward
chaining, with a correct diagram. Correct syntax and unifiers.

Correct Results 25% Give correct results for each query.

Justify Results 25% Explain why the queries have those results..

Total marks available for task 8.1: 16 marks.

Tasks 8.2
Criteria Marks Description

Translation 20% Full marks for correct translation of A and B into first order logic.
Deduct marks for syntax errors or inadequacies in translation.

Proof 60% Full marks for a correct proof. Marks awarded for correct proof
steps. Deduct marks for incorrect steps and syntax errors.

Presentation 20% Full marks for a clear presentation and diagram.

Total marks available for task 8.2: 24 marks

Task 8.3
Criteria Marks Description

Facts 10% Appropriate representation of knowledge about people and


parent-child relationships. Deduct marks for inadequately
represent knowledge or syntax errors.

Concepts 20% Correct definitions of three concepts (grandparent, sibling,


uncles or aunts). Deduct marks for incorrectly representing
these relationships or syntax errors.

State theorems 30% Full marks for stating appropriate theorems. Deduct marks if
they are not theorems, are not representing what is requested,
or have syntax errors.

Proof 30% Full marks for a correct proof of each theorem. Marks awarded
for correct proof steps. Deduct marks for incorrect steps and
syntax errors.

Discussion 10% Discussion of forward chaining vs resolution is informed by .

Total marks available for task 8.3: 60 marks

Submission Details
Submit answer to the exercises in a single document (PDF or Word)
At the top of all submissions pieces you should have the following information:

Lab Title:
Student Name:
Submission Type: Group/Individual (delete as appropriate)
Group members:

When to submit: All labs may form part of your coursework submissions. This lab is eligible
to be submitted as part of your selection in the Week 12 submission (Coursework 2).

Change Log
13 November 2024 JG: initial version published.
13 November 2024 JG: added clarification on individual vs group tasks.
13 November 2024 JG: added marking criteria.

You might also like