# INTRODUCTION TO ARTIFICIAL INTELLIGENCE Massimo Poesio LECTURE 3: Logic: predicate calculus, psychological evidence.

## Presentation on theme: "INTRODUCTION TO ARTIFICIAL INTELLIGENCE Massimo Poesio LECTURE 3: Logic: predicate calculus, psychological evidence."— Presentation transcript:

INTRODUCTION TO ARTIFICIAL INTELLIGENCE Massimo Poesio LECTURE 3: Logic: predicate calculus, psychological evidence

PREDICATE CALCULUS The propositional calculus is only concerned with connectives – statements not containing connectives are left unanalyzed Massimo is happy: p In predicate calculus, or predicate logic, atomic statements are decomposed into TERMS and PREDICATES – Massimo is happy: HAPPY(m) – Students like AI: LIKE(students,AI) In this way it is possible to state general properties about predicates: for instance, every professor at the University of Trento is happy, etc.

FIRST-ORDER LOGIC Predicate calculus becomes FIRST ORDER LOGIC when we add QUANTIFIERS – logical symbols that make it possible to make universal and existential statements (i.e., to translate statements A, E, I and O of syllogisms)

THE EXISTENTIAL QUANTIFIER Used to traduce statements like – Some birds are swallows Notation: – ∃ (backwards E, for Exist – Peano, 1890) – ‘Some birds are swallows’  – There exists an x, such that x is a bird, and x is a swallow – ( ∃ x) (BIRD(x) & SWALLOW(x))

THE UNIVERSAL QUANTIFIER To represent – All men are mortal – But also: Swallows are birds Notation: – ∀ for inverted A (alle) Conversion of universal statements requires conditional: – For every x, is x is a man, then x is mortal – ( ∀ x) (MAN(x) → MORTAL(x))

THE SYNTAX OF FOL: VOCABULARY TERMS – Constants – Variables PREDICATES: 1 argument ( HAPPY), two arguments (LIKES), etc CONNECTIVES (from the propositional calculus): ~, &, ∨, →, ↔ QUANTIFIERS: ∀ ∃

THE SYNTAX OF FOL: PHRASES If P is an n-ary predicate and t 1, … t n are terms, then P(t 1,…,t n ) is a formula. If φ and ϕ are formulas, then ~φ, φ & ϕ, φ ∨ ϕ, φ →ϕ and φ ↔ ϕ are formulas If ϕ is a formula and x is a variable, then ( ∀ x) ϕ and ( ∃ x) ϕ are formulas.

SCOPE AND BINDING Let x be a variable and ϕ a formula, and let ( ∀ x) ϕ and ( ∃ x) ϕ be formulas. then ϕ is the SCOPE of x in these formulas. An occurrence of x is BOUND if it occurs in the scope of ( ∀ x) or ( ∃ x) Examples (PMW p. 141)

THE SEMANTICS OF FOL As in the case of propositional calculus, statements (formulas) can be either true or false But the other phrases of the language have set-theoretic meanings: – Terms denote set elements – Unary predicates denote sets – N-ary predicates denote n-ary relations – Quantifiers denote relations between sets

SET THEORY RECAP HAPPY PEOPLE John Matilda Fred Lucy HAPPY(m) = T HAPPY(f) = F Massimo

SET THEORY RECAP: RELATIONS PEOPLE John Matilda Fred LIKES(j,AI) = T LIKES(m,Maths) = F Massimo SUBJECTS AI Logic Maths

SET THEORY RECAP: QUANTIFIERS SWALLOWS Tweety Lou Roger Loreto Swallows are birds BIRDS Airplane1 AIRPLANES FLYING THINGS Birds fly

THE SEMANTICS OF FOL If t is a term and P a unary predicate, then [P(t)] = TRUE iff [t] ∈ [P] If φ and ϕ are formulas, then – [~φ] = TRUE iff [φ] = FALSE – [φ & ϕ] = TRUE iff [φ] = TRUE and [ϕ] = TRUE [( ∀ x) ϕ] = TRUE iff for every value a for x in model M, [ϕ(a/x)] = TRUE [( ∃ x) ϕ] = TRUE iff there is at least one object a in model M such that [ϕ(a/x)] = TRUE

SOME TAUTOLOGIES OF FOL Laws of Quantifier Distribution: – ( ∀ x) (φ(x) & ϕ(x)) ≡ ( ∀ x) φ(x) & ( ∀ x) ϕ(x) – “Every object is formed of elementary particles and has a spin” iff “Every object is formed of elementary particles” and “Every object has a spin” Law of Quantifier Negation: – ~ ( ∀ x) (φ(x)) ≡ ( ∃ y) (~ φ(y)) – “It is not the case that every object is made of cheese” iff “there is an object which is not made of cheese”

FROM SYLLOGISMS TO FOL Four types of syllogism: – Universal affirmative: All Ps are Qs – Universal negative: All Ps are not Qs (No P is a Q) – Particular affirmative: Some P is a Q – Particular negative: Some P is not a Q

THE SQUARE OF OPPOSITION

FROM SYLLOGISMS TO FOL Syllogism in FOL: – Universal affirmative: ( ∀ x) (P(x) → Q(x)) – Universal negative: ( ∀ y) (P(y) → ~ Q(y)) – Particular affirmative: ( ∃ z) (P(z) & Q(z)) – Particular negative: ( ∃ w) (P(w) & ~ Q(w))

FROM SYLLOGYSM TO FOL A Birds fly A Swallows are birds A Swallows fly An example of BARBARA:

BARBARA IN PREDICATE CALCULUS ( ∀ x) (BIRD(x) → FLY(x)) ( ∀ y) ( SWALLOW(y) → BIRD(y)) ( ∀ z) ( SWALLOW(z) → FLY(z))

SET THEORETIC DEMONSTRATIONS OF VALIDITY OF SYLLOGISMS A: All Ps are Qs P Q Q R A: All Qs are Rs R A: All Ps are Rs P (A more general method exists)

REPRESENTING KNOWLEDGE IN LOGIC, 2 Modern logics make it possibile to represent every type of knowledge Different types of knowledge have different EXPRESSIVE POWER

REPRESENTING KNOWLEDGE IN LOGIC, 2 “Tutte le biciclette hanno due ruote” Propositional calculus: p Predicate logic + quantifiers: – ( ∀ x) (BICYCLE(x) → HAS_TWO_WHEELS(x)) – Can be used to represent DARII Explicit representation of the number 2: – ( ∀ x) (BICYCLE(x) → HAS_WHEELS(x,2)) Set of wheels:

DEDUCTION IN FOL The system of inference rules for FOL includes all the inference rules from the propositional calculus, together with four new rules for quantifier introduction and elimination The tableaus system has also been extended

NATURAL DEDUCTION FOR FOL, 1 ( ∀ y) P(y) ∴ P(c) (for any constant c) UNIVERSAL INSTANTIATION ∴ ( ∀ y) P(y) P(c) (for any constant c) UNIVERSAL GENERALIZATION

UI AND UG EXAMPLES ( ∀ y) MADE-OF-ATOMS(y) ∴ MADE-OF-ATOMS(c) (for any c) UNIVERSAL INSTANTIATION

NATURAL DEDUCTION FOR FOL, 2 ( ∃ y) P(y) ∴ P(k) (for a new k) EXISTENTIAL INSTANTIATION ∴ ( ∃ y) P(y) P(c) (for a constant c) EXISTENTIAL GENERALIZATION

BEYOND FIRST ORDER LOGIC Artificial Intelligence research moved beyond first order logic in several directions: – Beyond using logic as a formalization of valid inference only, developing logics for non-valid (or NONMONOTONIC / UNCERTAIN) reasoning – Developing simpler logics in which inference can be done more efficiently (description logics, discussed in later lectures)

PSYCHOLOGICAL EVIDENCE ON REASONING First order logic and the propositional calculus are good formalizations of ‘sound’ reasoning, and are therefore the basis for work on proving mathematical truths But are they a good formalization of the way people reason? Evidence suggests that this is not the case – The WASON SELECTION TASK perhaps the best known example of this evidence

THE WASON SELECTION TASK Subjects are asked to verify the truth of a statement (typically, a conditional statement) by turning over cards

WASON TEST: EXAMPLE If A CARD SHOWS AN EVEN NUMBER ON ONE SIDE, then THE OPPOSITE FACE IS RED Answer: the second and fourth card

READINGS Basics: B. Partee, A. ter Meulen, R. Wall, Mathematical Methods in Linguistics, Springer, ch. 5, 6, 7 (in Italian): D. Palladino, Corso di Logica, Carocci To know more: History of logic: P. Odifreddi, Le menzogne di Ulisse, Tea, ch. 1-7 Inference: P. Blackburn, J. Bos, Representation and Inference for Natural Language, CSLI K. Stenning and M. van Lambalgen, Human Reasoning and Cognitive Science, MIT Press Logic on the Web: – http://www.thelogiccourse.com/ http://www.thelogiccourse.com/ – Do the Wason selection task: http://coglab.wadsworth.com/experiments/WasonSelection.shtml

Download ppt "INTRODUCTION TO ARTIFICIAL INTELLIGENCE Massimo Poesio LECTURE 3: Logic: predicate calculus, psychological evidence."

Similar presentations