ASSIGNMENT - CSA5006: Logic, Representation and Inference
1. Administrative Issues
This assignment is worth 25% of the the marks for the study unit. This means that you should be prepared to allocate two days to carry it out.
Deliverables: (i) One folder containing all .pl
files, (ii) One powerpoint slide for 4.2 (iii) One document containing any
comments, justifications etc. Please submit by email to me and to Francelle.
Submission Deadline is Friday 28th May
2. Using Prolog
- Download a copy of SWI Prolog (already installed in Unix Lab).
- Create a single working directory in which this assignment will be carried out.
- You will be needing a text editor. Make sure that it writes files with a ".pl" extension. This can be achieved with notepad using save as "filename.pl" (i.e. use double quotes).
- The most flexible way to work is with two windows as follows:
- one has a text editor open on the source file.
- The other has Prolog into which you load the source file(s).
- To load file.pl,
- First time, select the file; right click and select the prolog option
- Second time type [file]. at Prolog prompt
- Third time - use up arrow to recall command line
- Use help(<predicate name>) to get online help.
3. Before Starting
- Read Blackburn and Bos Chapter 2 Lambda Calculus (already distributed).
qasimple.ppt which explains how to build a very simple QA interpreter in Prolog
Download prolog.zip and expand it into your working directory. You will end up with a directory containing several .pl files including the file "assignment.pl".
Inspect this file with a text editor: you will notice that it simply loads files from the same directory.
Also inspect experiment3.pl. This is the starting grammar.
Note that betaConvert(X,Y) carries out β reduction on X to yield Y.
4. Questions Part I - Augmenting the Grammar
- Show how to formulate a query which yields the semantic representation for the sentence "vincent loves mia".
- By hand, draw the parse tree for this sentence and show the semantic forms associated with each node of the tree.
Please submit as a powerpoint slide.
- Augment the grammar to handle sentences involving adjectives within the copula construction e.g. "Vincent is tall".
Augment the grammar to handle ditransitive verbs e.g. "Mia offers Vincent a drink" or "Mia offers a drink to Vincent".
Suggest a semantic representation for "Mia and Vincent rob a customer".
Incorporate a rule for "and" that handles coordinated noun phrases such as "Mia and Vincent".
- Modify the grammar so that when these sentences are read, the appropriate assertions are made in the database. This is achieved by calling the built-in predicate assert/1 so that
causes the clause man(mike) to be added to the database.
5. Part II: Handling Simple Queries
- Modify grammar/lexicon to handle questions corresponding to the above kinds of assertion, e.g
- Does Mia walk?
- Does Mia like Vincent?
- Is Mia nice?
- Fix intepreter (main.pl) to handle simple yes/no questions concerning all the above sentence types.
6. Part III: Further Queries
- Devise a semantic representation to handle simple wh-questions e.g. "Who does Mia like"
Fix interpreter to handle dialogues of the following type:
- Who does Mia like?
I don't know
- Mia likes Vincent
- Who does Mia like?