Chapter 2 2 Chapter 2 3 Chapter 2

  • Slides: 35
Download presentation
 • Chapter 2. 2 • Chapter 2. 3 • Chapter 2. 4 All

• Chapter 2. 2 • Chapter 2. 3 • Chapter 2. 4 All images are copyrighted to their respective copyright holders and reproduced here for academic purposes under the condition of “fair using”. • Chapter 2. 1 1

Original author of the slides: Vadim Bulitko University of Alberta http: //www. cs. ualberta.

Original author of the slides: Vadim Bulitko University of Alberta http: //www. cs. ualberta. ca/~bulitko/W 04 Modified by T. Andrew Yang (yang@uhcl. edu) 2

The Plan • Up to date we have considered an informal introduction to predicate

The Plan • Up to date we have considered an informal introduction to predicate logic • We will introduce predicate logic formally today and dwell on subtle moments 3

Predicate Logic (simplified) • Boolean variables – P, Q, R, … – E. g.

Predicate Logic (simplified) • Boolean variables – P, Q, R, … – E. g. , P=“ 5 is a prime number” can be T/F • Connectives: – &, v, , , ~ • Domain variables – A, B, C, … draw values from a domain sets – E. g. , j is a variable over integer numbers • Predicates: – P(X 1, …, XN), … – E. g. , P(j) = “j is a prime number” map from domain inputs to T/F • Quantifiers: – For all , Exists – E. g. , [ j prime(j)] = “any prime number” • Statements/formulae: – Atomic, unit, negated, conjunctive, …, universally/existentially quantified – E. g. , [ j [even(j) & ~equal(j, 2) ~prime(j) ]] = “no even numbers are prime except 2” 4

Def : Well-formed Formulae • A well-formed formula/sentence (wff) is a construction defined recursively:

Def : Well-formed Formulae • A well-formed formula/sentence (wff) is a construction defined recursively: – Any Boolean variable is a wff – Any predicate is a wff – For any wff X, ~(X) is a wff – Two wffs parenthesized and connected by v, &, , form a wff. – For any wff X and a domain variable k: • k (X) is a wff • Here X is within the scope of k (or k) 5

Find wffs… • x [man(X) mortal(x)] • ~[ x [man(x) & lives-forever(x)]] • x

Find wffs… • x [man(X) mortal(x)] • ~[ x [man(x) & lives-forever(x)]] • x [man(x) ~lives-forever(x)] 6

Def : Interpretations • Interpretation for a wff : – Assigns T/F values to

Def : Interpretations • Interpretation for a wff : – Assigns T/F values to all Boolean variables – Defines a domain set for each domain variable – Defines all predicates • Example: consider wff = ( j prime(j)) & P – A possible interpretation: • Boolean variable P=T • Domain variable j runs over integer numbers • Predicate prime(x) holds iff x is a prime number 7

Model / Countermodel • Formula holds given an interpretation I: – is satisfied by

Model / Countermodel • Formula holds given an interpretation I: – is satisfied by I – Then is satisfiable – Then I is a model for • Formula doesn’t hold given I: – is not satisfied (or falsified) by I – Then I is a countermodel for 8

Tautologies & Contradictions • Formula holds under any interpretation I – is valid –

Tautologies & Contradictions • Formula holds under any interpretation I – is valid – is a tautology • Formula doesn’t hold under any I – is a contradiction – is unsatisfiable 9

Example • Define – Predicate P(X) as “person X drinks beer” • Consider –

Example • Define – Predicate P(X) as “person X drinks beer” • Consider – x y [P(x) P(y)] – “There exists a person such that if he/she drinks beer then everyone drinks beer” • True or false? 10

Contingencies • holds under any interpretation tautology • does NOT hold under any interpretation

Contingencies • holds under any interpretation tautology • does NOT hold under any interpretation contradiction • What if holds under some interpretations but not other? • Then is a contingency 11

Classify… • • • P&Q P & ~P P v ~P x P(x) x

Classify… • • • P&Q P & ~P P v ~P x P(x) x ((P(x) Q(x)) & P(x)) Q(x) x (P(x) v ~P(x)) (P(x) & ~P(x)) 12

Implicit Quantifiers • If x > 2 then x 2 > 4 • Textbook:

Implicit Quantifiers • If x > 2 then x 2 > 4 • Textbook: p. 84 – real numbers x, if x>2 then x 2 > 4 • More formally: Implicit quantifiers – x [x>2 y square(x, y) & y>4] – where predicates square(a, b) and c>d are defined over the set of real numbers 13

Domain Functions • Consider the last statement again: • real numbers x, if x>2

Domain Functions • Consider the last statement again: • real numbers x, if x>2 then x 2 > 4 • Is it a wff? No! Why? – Well x 2 is not a predicate and is not a variable – It is a domain function (square)! • We have not formally introduced domain functions • But we will use them anyway for the sake of: – Simplicity – Consistency with the text book 14

Evaluating Formulae • Boolean variables – Interpretation directly • Predicate with variables : Likes(x)

Evaluating Formulae • Boolean variables – Interpretation directly • Predicate with variables : Likes(x) – Use the assignment of x and the semantics of Likes() • Universally quantified formula : x P(x) – Evaluates to true iff P(x) holds on all possible values of x • Existentially quantified formulae : x P(x) – Evaluates to true iff P(x) holds on at least one possible value of x 15

Examples • Consider formula S: x (x 2 > x) • Assume the standard

Examples • Consider formula S: x (x 2 > x) • Assume the standard algebraic interpretation • Suppose the domain set for variable x is {2, 3, 4} • Does S hold or not? – Yes : 4>2, 9>3, 16>4 • Suppose the domain set for variable x is the set of real numbers • Does S hold or not? – No : ~(0 > 0) 16

Examples • Consider formula S: x (x 2 > x) • Assume the standard

Examples • Consider formula S: x (x 2 > x) • Assume the standard algebraic interpretation • Suppose the domain set for variable x is {2, 3, 4} • Does S hold or not? – Yes : 4>2 • Suppose the domain set for variable x is the set of real numbers • Does S hold or not? • Suppose the domain set for variable x is the segment [0, 1] • Does S hold or not? – No : all numbers between 0 and 1 have their squares not greater than the number itself 17

Summary • GIVEN a particular interpretation • To show that a -quantified formula holds:

Summary • GIVEN a particular interpretation • To show that a -quantified formula holds: – Exhaust all possibilities – show that all examples satisfy the formula • To show that a -quantified formula does NOT hold: – Find a falsifying example • To show that a -quantified formula holds: – Find a satisfying example • To show that a -quantified formula does NOT hold: – Exhaust all possibilities and show that all examples falsify the formula 18

Summary • How about classifying a formula: – Tautology / Contradiction / Contingency •

Summary • How about classifying a formula: – Tautology / Contradiction / Contingency • Contingencies are, perhaps, the easiest: – Need to find a model and a counter-model • Tautologies / contradictions: – Need to show that all possible interpretations satisfy/falsify the formula – More difficult 19

Special cases : finite domains • Suppose you have a formula over a single

Special cases : finite domains • Suppose you have a formula over a single variable x • If the domain of variable x is finite: {x 1, …, x. N} • Then x P(x) is equivalent to: P(x 1) & … & P(x. N) • And x P(x) is equivalent to: P(x 1) v … v P(x. N) 20

Satisfying / statements • To show that x P(x) we need to: – Prove

Satisfying / statements • To show that x P(x) we need to: – Prove that every x satisfies P(x) • To show that x P(x) we need to: – Prove that there exists at least one x that satisfies P(x) 21

De Morgan again… • To show that ~( x P(x)) we need to: –

De Morgan again… • To show that ~( x P(x)) we need to: – Prove that not every x satisfies P(x) – In other words, we need to find at least one x that does not satisfy P(X) – But that is the same as proving that x ~P(x) • Therefore: ~( x P(x)) x (~P(x)) • are logically equivalent • De Morgan’s law for quantifiers 22

And again… • To show that ~( x P(x)) we need to: – Prove

And again… • To show that ~( x P(x)) we need to: – Prove that there does not exists a single x satisfies P(x) – In other words, we need to show that all x do not satisfy P(X) – But that is the same as proving that x ~P(x) • Therefore: ~( x P(x)) x (~P(x)) • are logically equivalent • De Morgan’s law for quantifiers 23

Examples • Statement: – “Everyone snoozes in this class” • Negation: – “Not every

Examples • Statement: – “Everyone snoozes in this class” • Negation: – “Not every one snoozes in this class” – “There is someone who doesn’t snooze in this class” • A common mistake: – “Everyone does NOT snooze in this class” 24

Examples • Statement: – “Professors don’t make much money” • Negation: – “There is

Examples • Statement: – “Professors don’t make much money” • Negation: – “There is a professor who makes much money” • A common mistake: – “Professors make much money” 25

Examples • Statement: – There is a secret agent who appeals to all women

Examples • Statement: – There is a secret agent who appeals to all women • Negation: – For every secret agent there is a woman that the agent doesn’t appeal to • A common mistake: – There is a secret agent who doesn’t appeal to all women 26

In the nutshell… • When negating a quantified formula: – Quantifier 1 x 1…

In the nutshell… • When negating a quantified formula: – Quantifier 1 x 1… Quantifier. N x. N P(x 1, . . , x. N) • Do this: – Change all to – Negate the innermost formula P(…) 27

Vacuous Truth of UQS • Suppose I say: “Presently, all men on the moon

Vacuous Truth of UQS • Suppose I say: “Presently, all men on the moon are happy” • Is it true or false? • Think of it this way: – x [On. The. Moon(x) Happy(x)] • So, is it true or false? – The internal implication is always vacuously true for there is presently no man on the Moon – Thus, the entire statement holds for any x • The entire statement holds 28

Logical Implication • In propositional logic formula A logically implies formula B iff: –

Logical Implication • In propositional logic formula A logically implies formula B iff: – Every interpretation that satisfies A also satisfies B • In predicate logic? – The same! 29

Validity of Arguments • Hence validity of arguments is defined in the same way

Validity of Arguments • Hence validity of arguments is defined in the same way • The difference is: – in predicate logic it is not always possible to go through all interpretations to prove that A logically implies B • Why? – The number of interpretations can be infinite 30

Inference Rules • Thus, proving arguments with inference rules becomes the method of choice

Inference Rules • Thus, proving arguments with inference rules becomes the method of choice • We can also derive new inference rules for our toolbox 31

Universal Instantiation • Consider a universally quantified statement: – x D [P(x)] • Suppose

Universal Instantiation • Consider a universally quantified statement: – x D [P(x)] • Suppose you have a particular x 0 D • What can you say about P(x 0)? – It holds! • Why? – Because predicate P(…) holds for all members of set D – Example: “mortal Socrates” argument 32

Universal Modus Ponens • Propositional modus ponens P Q P Thus, Q • Universal

Universal Modus Ponens • Propositional modus ponens P Q P Thus, Q • Universal modus ponens x [P(x) Q(x)] P(a) Thus, Q(a) 33

Diagrams for Validity (p. 104) mortal • Diagrams can sometimes be used to: human

Diagrams for Validity (p. 104) mortal • Diagrams can sometimes be used to: human – support a validity of an argument – or, show that an argument is invalid • Diagrams. Socrates are not a formal proof! • Use them to illustrate your reasoning ONLY • Examples: Modus Ponens 34

Questions? 35

Questions? 35