Professional Documents
Culture Documents
[2]
car(a1).
car(a2).
car(a3).
part(motorA).
part(motorB).
part(gearbox1).
part(gearbox2).
supplier_part(motorA, dealerD).
supplier_part(gearbox1, thirdpartyE).
combination(gearbox1, a1).
combination(motorA, a2).
combination(motorB, a2).
guaranteed_part(X) IF part(X) AND supplier_part(X, dealerD).
[3]
[1]
[2]
[1]
combination(gearbox2, a3)
[1]
supplier_part(motorB, dealerD)
[1]
[1]
[Total: 6]
continent(asia).
continent(north_america).
continent(australasia).
country(india, asia).
country(china, asia).
country(usa, north_america).
country(australia, australasia).
state(queensland, australia).
state(tasmania, australia).
state(texas, usa).
state(alaska, usa).
Explanation
There is a continent named asia
The country india is in asia
There is a state in australia named tasmania
[2]
(b) Using variable ThisState, the clause:
state(ThisState, usa)
would return the result: ThisState = texas, alaska
Write the result returned by the clause:
country(ThisCountry, asia)
ThisCountry =
[1]
(c) Complete the rule below to determine if two countries are in the same continent.
in_same_continent(Country1, Country2)
IF
[3]
(a)
(i) continent(south_america)
[2]
country(peru, south_america)
[1]
Mark as follows:
country clause used twice
AND operator between two country clauses
variables Country1 and Country2
Use of a common new variable e.g. X
(must be caps)
(must be caps)
[1]
[1]
[1]
[1]
[MAX 3]
[Total: 6]
have a licence; there is a minimum age at which a person can be issued with a licence
and it is different for cars and motorbikes
pass a theory test; it is the same test for cars and motorbikes
pass a driving test for that vehicle (car or motorbike)
minimum_age(car, 18).
minimum_age(motorbike, 16).
age(yu, 16).
age(kong, 16).
age(ho, 15).
age(zhen, 21).
age(tain, 21).
age(shen, 21).
has_licence(yu).
has_licence(kong).
has_licence(ho).
has_licence(zhen).
has_licence(tain).
has_licence(shen).
able_to_drive(X, V) IF has_licence(X) AND minimum_age(V, L)
AND age(X, A) AND A >= L.
passed_theory_test(kong).
passed_theory_test(yin).
passed_theory_test(zhen).
passed_theory_test(yu).
passed_driving_test(zhen, car).
passed_driving_test(yu, motorbike).
passed_driving_test(kong, car).
passed_driving_test(kong, motorbike).
passed_driving_test(shen, motorbike).
qualified_driver(X, V) IF able_to_drive(X, V) AND
passed_theory_test(X) AND passed_driving_test(X, V).
Explanation
The minimum age for a car licence is 18
Shen is aged 21
Tain has a licence
Person X is able to drive vehicle V if person X has a
licence, and the age A of person X is greater than
or equal to the minimum age L to drive vehicle V
(a) List the clause numbers for the rules in this knowledge base.
[1]
[1]
(ii) able_to_drive(ho, motorbike).
[1]
(iii) NOT(has_licence(shen)).
[1]
[2]
(ii) all drivers who have passed the theory test but not a driving test.
[3]
(d) To produce the output from a clause, the inference engine uses a process called
backtracking.
Consider the clause:
able_to_drive(ho, motorbike).
List the order in which clauses are used to produce the output.
For each clause, describe the result that it returns.
[3]
[1]
[1]
(ii) false
[1]
(iii) false
[1]
[3]
[1]
MAX 3
(ii)
[1]
[1]
[1]
[1]
[1]
MAX 3
[Total: 12]