Semantics and Inference Part I Johan Bos Overview of this lecture • Inferences on the sentence level – Entailment – Paraphrase – Contradiction • Using logic to understand semantics – Introduction to propositional logic – Syntax and Semantics – Different kinds of logics Making inferences • Meaning relations between expressions in a language – Entailments – Paraphrases – Contradictions Entailment, definition • A sentence expressing a proposition X entails a sentence expressing a proposition Y if – it is not possible to think of a situation where X is true and Y is false – Or, put alternatively: the truth of Y follows necessarily from the truth of X Entailments, examples Sentences 2, 3, and 4 are entailed by sentence 1: 1) Dylan stroked the cat and hugged the dog. 2) Dylan hugged the dog. 3) Someone stroked the cat. 4) Dylan hugged an animal. Paraphrases, definition • Two sentences are paraphrases of each other if they entail each other • Put differently: whenever one is true, the other must also be true Paraphrases, examples The following sentences are paraphrases of each other: 1) Dylan stroked the cat and hugged the dog. 2) Dylan hugged the dog and stroked the cat. 3) The cat was stroked by Dylan and the dog was hugged by Dylan. Contradiction, definition • Two sentences are contradictory if it is impossible to think of a situation where both sentences can be true Contradiction, examples Sentence 1 and 2 are contradictions, and so are sentence 1 and 3: 1) Dylan stroked the cat and hugged the dog. 2) The dog wasn’t hugged. 3) Nobody stroked anything. Side remark • Usually references and contexts are kept constant in natural language inferences! • Example: – Dylan likes Groucho. – Dylan hates Groucho. • Contradiction or not? Side remark • Usually references and contexts are kept constant in natural language inferences! • Example: – Dylan likes Groucho. – Dylan hates Groucho. • Contradiction or not? – “Of course the sentences are contradictory. You can’t hate and like someone at the same time.” – “The sentences are not contradictory. I meant Dylan Dog in the first sentence, and Bob Dylan in the second…” Formal Semantics • Study of meaning with the help of (mathematical) logic • Has been controversial for some time, but now widely accepted "Aren`t human languages imperfect and illogical anyway?" "Human languages have their own internal logic!" Human vs. logical languages • Languages such as Italian, English and Dutch are human languages (natural or ordinary languages) • Logical systems are also referred to as languages by logicians; these are of course artificial languages; to avoid confusion they are sometimes called calculi Basic idea of formal semantics • Provide a mapping from ordinary language to logic Human Language Logical Language (ambiguous) (unambiguous) • But what are logical languages or calculi ? Logical languages propositional logic modal logic description logic first-order logic (predicate logic) second-order logic higher-order logic expressive power • • • • • • This lecture • In this lecture we will try to map English to Propositional Logic • Propositional logic is suitable to model the basics of sentence semantics • As we will see it is not very useful for modelling sub-sentential semantics, for which usually more expressive logics are used Why is this a useful exercise? • Description of some aspects of meaning in language • Detect ambiguities or imprecisions • Most of the literature in formal semantics presuppose familiarity with propositional and first-order logic Propositions • What is a proposition? – Something that is expressed by a declarative sentence making a statement – Something that has a truth-value • Propositions can be true or false – There are only two possible truth-values – True, T or 1 – False, F or 0 Propositional logic • Propositional logic is a language • So we will look at its ingredients • We will define the syntax, or in other words, the grammar • We will define the semantics Ingredients of propositional logic • Propositional variables – Usually: p, q, r, … • Connectives – The symbols: , ,, , – Often called logical constants • Punctuation symbols – The round brackets ( ) Propositional variables • Variables are used to stand for propositions • Usually, the letters p, q, r are used for propositional variables • Example p “It is raining outside." q “Eva Kant is reading a newspaper.“ • Note: – the internal structure of propositions is not of our concern in this lecture Syntax of propositional logic • All propositional variables are propositional formulas • If is a propositional formula, then so is • If and are propositional formulas, then so are (), (), () and () • Nothing else is a propositional formula Which of these are propositional formulas? 1) 2) 3) 4) 5) 6) 7) 8) 9) (pp) p q ((pq)(q)) ((pq)qr) (p(p(pp))) (rq) (((pq)q)) (pp)) Which of these are propositional formulas? 1) 2) 3) 4) 5) 6) 7) 8) 9) (pp) p q ((pq)(q)) ((pq)qr) (p(p(pp))) (rq) (((pq)q)) (pp)) • • • • • • • • • Yes Yes Yes No No Yes No No No Logicians are only human • Even though logicians and mathematicians are usually very precise in their formulations, they sometimes drop punctuation symbols if this does not give rise to confusion • Often outermost brackets are dropped; also other brackets if no confusion arises Logicians are only human • Even though logicians and mathematicians are usually very precise in their formulations, they sometimes drop punctuation symbols if this does not give rise to confusion • Often outermost brackets are dropped; also other brackets if no confusion arises • Examples: pq instead of (p q) p (q r) instead of (p (q r)) (p q r) instead of (p (q r)) Negation • Symbol: • Pronounced as: “not” • is called the negation of • Truth-table: True False False True Negation: examples • p “It is raining." p “It is not raining.” • p “Eva said something." p “Eva didn’t say anything.” • p “Diabolik sometimes lies." p “Diabolik never lies.” Conjunction • Symbol: • Pronounced as: “and” • () is called the conjunction of the conjuncts and • Truth table: True True False False True False True False () True False False False Conjunction: examples • p “The plan is simple.” q “The plan is effective." (pq) “The plan is simple and effective." • p “Diabolik was in trouble.” q “Diabolik managed to escape." (pq) “Although he was in trouble, Diabolik managed to escape." Disjunction • Symbol: • Pronounced as: “or” • () is called the disjunction of the disjuncts and • Truth table: True True False False True False True False () True True True False Disjunction: examples • p “Eva has a gun." q “Eva has a knife." (pq) “Eva has a gun or a knife (or both)." • p “He is a fool." q “He is a liar." (pq) “He is a fool or a liar (or both)." (Material) Implication • Symbol: • Pronounced as: “implies” or “arrow” • Truth table: True True False True False True () True False True False False True Implication: examples • p “Ginko shot Diabolik." q “Diabolik is wounded." (pq) “If Ginko shot Diabolik then Diabolik is wounded." • p “The paper will turn red." q “The solution is acid." (pq) “If the paper turns red, then the solution is acid." Equivalence (biconditional) • Symbol: • Pronounced as: “if and only if” • Truth table: () True True False True False True True False False False False True Equivalence: examples • p “The number is even." q “The number is divisible by two." (pq) “The number is even precisely if it is divisible by two." • p “The company has to be registered." q “The annual turnover of the company is above Euro 5,000." (pq) “The company has to be registered just if its annual turnover is above Euro 5,000." Problematic cases “Eva wants a black and white cat.” “Eva wants a black cat” “Eva wants a white cat” “Geller can read your mind or he can bend spoons” “Geller can read your mind” v “Geller can bend spoons” “If you want to wash your hands, the bathroom is first on the left” “You want to wash your hands” “the bathroom is first on the left” Problematic cases “Eva wants a black and white cat.” “Eva wants a black cat” “Eva wants a white cat” “Geller can read your mind or he can bend spoons” “Geller can read your mind” v “Geller can bend spoons” “If you want to wash your hands, the bathroom is first on the left” “You want to wash your hands” “the bathroom is first on the left” Problematic cases “Eva wants a black and white cat.” “Eva wants a black cat” “Eva wants a white cat” “Geller can read your mind or he can bend spoons” “Geller can read your mind” v “Geller can bend spoons” “If you want to wash your hands, the bathroom is first on the left” “You want to wash your hands” “the bathroom is first on the left” Problematic cases “Eva wants a black and white cat.” “Eva wants a black cat” “Eva wants a white cat” “Geller can read your mind or he can bend spoons” “Geller can read your mind” v “Geller can bend spoons” “If you want to wash your hands, the bathroom is first on the left” “You want to wash your hands” “the bathroom is first on the left” Translate these in logic a) Neither I nor my wife speak Russian. b) If I am not Italian then I am not allowed to play for the Italian football team. c) You will get a room provided you have no pets. d) Diabolik will not fail to find the diamonds. Semantic relations Relation between sentences Relation between pair of words entailment … paraphrase … contradiction … Fill in the dots: hyponymy, synonymy, antonymy Semantic relations Relation between sentences Relation between pair of words entailment hyponymy paraphrase synonymy contradiction antonymy Different Logics propositional logic modal logic description logic first-order logic (predicate logic) second-order logic higher-order logic expressive power • • • • • • Logics and how they relate v propositional Logics and how they relate v propositional [] <> modal Logics and how they relate v propositional [] <> x x modal first-order Logics and how they relate v propositional [] <> x x x modal first-order higher-order Why different logics? • Why don’t we take the most expressive logic and use that to analyse semantics? • Answer: different logics have different computational properties – There is an algorithm to decide whether a formula is a validity (a theorem) for propositional and modal logic – But there is no such algorithm for first-order logic (or higher-order logic) A note on notation… • • • • • Negation: Conjunction: Implication: Equivalence: Brackets: or or & or or (…) or […] Further reading • Cann (1993): Formal Semantics; An introduction, Chapter 7 • Hodges (1977): Logic. An introduction to elementary logic. • Hurford & Heasley (1983): Semantics. A coursebook, Unit 10 • Lyons (1977): Semantics, Volume 1, Chapter 6