UMBC CMSC 471 01 spring 2019
|
home • about • schedule • hw • exams • notes • code • colab • github • help • resources • demos • news • piazza |
![]() Homework Fourout Wednesday 04/03, due Friday 4/12Assignment repository invitationHere are some simple exercises to help you get comfortable with logic representations. Write out your answers and submit them by the end of the day on Friday, April 12. ALl of the required aima python code is included in the starter repository. Notes: The aima.logic package requires that propositional variables (i.e., those whose values must be True or False) begin with an uppercase letter and logic variables (i.e., those that can take on any value) begin with a lowercase letter. See here for a an example of using logic.py on gl. The Python examples below assume you are using Python 3.X and have done "from logic import *". The aima's logic.py package is well commented, so take a look if you have questions. The answer might be in the comments. 1. Checking ValidityUse the functions in aima's logic.py to see which of the following are valid, i.e., true in every model. You will have to (i) convert these sentences to the appropriate string form that the python code uses (see the comments in the code) and (ii) use the expr() function in logic.py to turn each into an Expr object, and (iii) use the tt_true() function to check for validity. Provide text from a session that shows the result of checking the validity of each. We've done the first one as an example.
2. SatisfiabilityUse the functions in logic.py to see which of the following are are satisfiable. We've done the first one as an example. One way to explore the use of dpll_satisfiable is with the notebook file statisfiability.ipynb in the 471code repository.
3. Propositional ConsequenceFor each of the following entailment relations, say whether or not it is true. The text on the left of the entailment symbol (⊨) represents one or more sentences (separated by commas) that constitute a knowledge base. We've done the first one for you.
4. English to FOLTranslate the following English sentences into first order logic. Feel free to optionally provide a more direct paraphrase of the meaning of your logic expression in English. If you think a sentence is ambiguous, describe the ambiguity and give logical expressions for all interpretations. We've done the first one for you using a notation with simple ASCII characters for logical operators (e.g., A:∀, E:∃, =>:→, <=>:↔, ^:∧, v:v, ~:¬, >:>)
5. Solving a puzzle with SATWhich answer in this list below is the correct answer to this question?
Explain your reasoning by (a) mapping the problem into propositional logic and (b) showing how �the AIMA code can be used to solve this problem. Hint: These puzzles are hard for people because they are self-referencial. Here's a hint. Try associating a propositional variable with each answer, e.g., A1, A2, ...A6. Now write logical sentences that meaning of each answer in terms of the meanings of the other answers. Put these sentences into the form used by AIMA and use the dpll_satisfiable function to see if the result is satisfiable. If you've done things correctly, the sentences will be satisfiable with one of the Ai variables True and the rest False. You can look at the file boxes.ipynb in our repository for an example of how to solve a similar puzzle using dpll_satisfiable. If you download this file to your hw4 directory you can execute it with jupyter. What and how to submitSubmit a single pdf document named myhw4.pdf to your hw4 repositorygithub account. You should use myhw4.doc to create thius file, either using microsoft word or uploading to google docs and editing, and saving the final version as pdf. |