- Translate the following sentences into propositional logic and verify that they parse with LogicParser. Include the sample run in your answer. Provide a key which shows how the propositional variables in your translation correspond to expressions of English.
- It is not the case that if Kim sings, Sam will leave
- Kim is either clever or lucky
- If Kim doesn't come, Sam will be sad
- If Sam or Leslie comes, then Sam will be happy
- Translate the following sentences into predicate-argument formulae of first order logic. Include sample runs using LogicParser.
- Kim likes Sam but Sam doesn't like Kim
- Kim likes herself and so does Sam
- Kim is a Swedish woman
- Kim and Sam admire each other
- Translate the following sentences into quantified formulas of first order logic. Include sample runs using LogicParser.
- A woman who likes Sam also likes Kim
- Everybody likes Sam
- Nobody likes everybody
- Exactly one person knows everything
- Translate the following verb phrases using λ abstracts. quantified formulas of first order logic. Include sample runs using LogicParser.
- be liked by no-one
- know Sam and like her
- read a book or watch a film
- show nobody a book
- In the following examples some code has been deleted and replaced with <????>. What has been deleted? Verify that your answer is correct and show a sample run of the program.
- lp = nltk.LogicParser()
- e1 = ????
- e2 = lp.parse('kim')
- e3 = nltk.sem.ApplicationExpression(e1,e2)
- print e3.simplify()
- with result
- run(kim)
- e1 = ????
- e2 = lp.parse('\ x.smoke(x)')
- e3 = nltk.sem.ApplicationExpression(e1,e2)
- print e3.simplify()
- with result
- smoke(kim)
- e1 = ????
- e2 = lp.parse('\ x.run(x)')
- e3 = nltk.sem.ApplicationExpression(e1,e2)
- print e3.simplify()
- with result
- exists x.(woman(x) & run(x))
- e1 = ????
- e2 = lp.parse('\ P.all x. (dog(x) -> P(x))')
- e3 = nltk.sem.ApplicationExpression(e1,e2)
- print e3.simplify()
- with result
- \x.all z2.(dog(z2) -> like(x,z2))