Professional Documents
Culture Documents
Remove (E, L, RL) - RL Is The List L With Some Member E Removed
Remove (E, L, RL) - RL Is The List L With Some Member E Removed
1. Change the difference list grammar rules given on slide 14 of the Language
Processing lecture so that they will check that the singular/plural case of the noun
phrases matches that of the verb of the verb phrase. Model the change on the rules
on slide 10.
2. Add extra rules to those you have given in answer to Q1 to handle preceding
adjectives using the difference list representation. The rules using append/3 are on
slide 7.
Example uses:
?-remove(4,[1,3,4,6],RL).
RL=[1,3,6].
?-remove(4,[1,2,3]).
No.
4. Assume that a Prolog database has facts for the relations:
sellsFor(‘Peter Jones’,swan123,25).
inStock(‘Peter Jones’,swan123).
locatedIn(‘Peter Jones’,london).
typeOfItem(swan123,electricKettle).
equivalentItems(swan123,electrolux214).
Using forall, findall, Prolog’s negation operator \+, if appropriate, and any
arithmetic primitives you may need, give Prolog clauses defining the following
relations: