Introduction to Computational Linguistics Eleni Miltsakaki AUTH Fall 2005-Lecture 7
What’s the plan for today? Basic concepts of logic Propositional logic (aka statement logic) Predicate logic (aka first order logic)
Natural language and formal languages Natural languages: acquired as first language in childhood to serve any communicative goal we have Formal languages: designed by people for a clear, particular purpose One of the most important uses linguists make of formal languages is to represent meaning in natural languages.
Logic Logical languages can be used as meta-languages to formalize reasoning from axioms and theorems in a specific domain. Here, we’ll develop the background for applications of logic and formal languages to natural languages
Language of logic Syntax-semantics Syntax: primitives, axioms, well-formedness, rules of inference or rewrite rules, theorems Semantics: relation of syntax to interpretation
Semantics For our purposes: semantics is the study of the relations of formal systems to their interpretations
About propositional and predicate logic Each is a formal language with its own vocabulary, rules of syntax and semantics (or system of interpretation) Both are much simpler than natural languages Only declarative statement (no questions, imperatives) Connectives: and, or, not, if…then, if and only if but no because, while, after, although etc Determiners: some, all, no, every but not most, many, a few, several, one half etc Logic is the study of reasoning (the product, not the process) with the objective of finding correct, or valid, instances and distinguishing them from those that are invalid.
Example All men are mortals Socrates is a man _______________________________________________________ Therefore, Socrates is mortal All cats are mammals All dogs are mammals ________________________________________ Therefore, all cats are dogs A systematic account of what underlies our intuitions about the validity of our inferences
Argument form Systematic replacements All rabbits are rodents Peter is a rabbit _______________________________________ Therefore, Peter is a rodent All X’s are Y’s a is an X Therefore, a is a Y
Propositional logic Vocabulary Syntax Infinite vocabulary of atomic statements, p, q, r, s, etc Syntax Any atomic statement itself is a sentence or well-formed formula (wff) Any wff preceded by ~ is also a wff Any two wffs can be made into another wff by conjunction, disjunction, conditional or biconditional
Propositional logic Semantics Truth values: 1 or 0 Truth tables Negation Conjunction Disjunction Conditional Bi-conditional
Laws of propositional logic Idempotent laws Associative laws Commutative laws Distributive laws Identity laws Complement laws DeMorgan’s laws Conditional laws Bi-conditional laws
Rules of inference Modus Ponens Modus Tollens Hypothetical syllogism Disjunctive syllogism Simplification Conjunction Addition
Some simple exercises Example: If John is at the party, then Mary is too. Translation: (pq) Key: p=John is at the party, q=Mary is at the party Translate the following sentences in propositional logic Either John is in that room or Mary is, or possibly they both are The fire was set by an arsonist, or there was an accidental explosion in the boiler room When it rains, it pours Sam wants a dog but Alice prefers cats
Predicate logic Vocabulary Individual constants: j, m,... Individual variables: x, y, z, … Predicates: P, Q, R, … each with a fixed number of arguments called its arity The five connectives of propositional logic (negation, and, or, if-then, if and only if) Two quantifiers: universal and existential Auxiliary symbols: parentheses and brackets
Syntax of predicate logic See handout
Semantics of predicate logic Truth values: 1, 0 Truth value is determined by the semantic value of the components of a formula Set D of individuals, discourse domain Example H(s) s has as its semantic value some individual chosen from a set D of individuals presumed to be fixed in advance. Say D includes Socrates and Aristotle. The statement H(s) gets the truth value true by the fact that the individual corresponding to s is a member of the set corresponding to H. A two place predicate has as its semantic value a set of ordered pairs of individuals from D and so on and so forth.
Some simple exercises Translate the following English sentences into predicate logic: Everything is black or white A dog is a quadruped Everybody loves somebody Someone is loved by everyone There is someone whom everyone loves No one loves himself unless it’s John If you love a woman, kiss her or lose her People who live in New York love it