chapter1 logic.pptftang/courses/cs130/notes/predicate logic.pdf · &6 ±'lvfuhwh...

40
CS 130 – Discrete Structures Formal Logic: Quantifiers, Predicates, and Validity

Upload: others

Post on 19-Jun-2020

2 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: chapter1 Logic.pptftang/courses/CS130/notes/predicate logic.pdf · &6 ±'LVFUHWH 6WUXFWXUHV 9DULDEOHV DQG 6WDWHPHQWV 9DULDEOHV $ YDULDEOH LV D V\PERO WKDW VWDQGV IRU DQ LQGLYLGXDO

CS 130 – Discrete Structures

Formal Logic: Quantifiers, Predicates, and Validity

Page 2: chapter1 Logic.pptftang/courses/CS130/notes/predicate logic.pdf · &6 ±'LVFUHWH 6WUXFWXUHV 9DULDEOHV DQG 6WDWHPHQWV 9DULDEOHV $ YDULDEOH LV D V\PERO WKDW VWDQGV IRU DQ LQGLYLGXDO

CS 130 – Discrete Structures 55

Variables and Statements

• Variables: A variable is a symbol that stands for an individual in a collection or set. For example, the variable x may stand for one of the days. We may let x = Monday, x = Tuesday, etc.

• We normally use letters at the end of the alphabet as variables, such as x, y, z.

• A collection of objects is called the domain of objects. For the above example, the days in the week is the domain of variable x.

Page 3: chapter1 Logic.pptftang/courses/CS130/notes/predicate logic.pdf · &6 ±'LVFUHWH 6WUXFWXUHV 9DULDEOHV DQG 6WDWHPHQWV 9DULDEOHV $ YDULDEOH LV D V\PERO WKDW VWDQGV IRU DQ LQGLYLGXDO

CS 130 – Discrete Structures 56

Quantifiers

• Propositional wffs have rather limited expressive power. E.g., “For every x, x > 0”.

• Quantifiers: Quantifiers are phrases that refer to given quantities, such as "for some" or "for all" or "for every", indicating how many objects have a certain property.

• Two kinds of quantifiers:– Universal Quantifier: represented by , “for all”, “for

every”, “for each”, or “for any”.– Existential Quantifier: represented by , “for some”,

“there exists”, “there is a”, or “for at least one”.

Page 4: chapter1 Logic.pptftang/courses/CS130/notes/predicate logic.pdf · &6 ±'LVFUHWH 6WUXFWXUHV 9DULDEOHV DQG 6WDWHPHQWV 9DULDEOHV $ YDULDEOH LV D V\PERO WKDW VWDQGV IRU DQ LQGLYLGXDO

CS 130 – Discrete Structures 57

Predicates

• Predicate: It is the verbal statement which describes the property of a variable. Usually represented by the letter P, the notation P(x) is used to represent some unspecified property or predicate that x may have.

– P(x) = x has 30 days. – P(April) = April has 30 days.– What is the truth value of (x)P(x) where x is all the

months and P(x) = x has less than 32 days

• Combining the quantifier and the predicate, we get a complete statement of the form (x)P(x) or (x)P(x)

• The collection of objects is called the domain of interpretation, and it must contain at least one object.

Page 5: chapter1 Logic.pptftang/courses/CS130/notes/predicate logic.pdf · &6 ±'LVFUHWH 6WUXFWXUHV 9DULDEOHV DQG 6WDWHPHQWV 9DULDEOHV $ YDULDEOH LV D V\PERO WKDW VWDQGV IRU DQ LQGLYLGXDO

CS 130 – Discrete Structures 58

Truth Values of the Expressions

• What is the truth value of (x)P(x) in the following interpretations?

– P(x): x is yellow; the domain of interpretation is the collection of all flowers.

– P(x): x is a plant; the domain of interpretation is the collection of all flowers.

– P(x): x is either positive or negative; the domain of interpretation consists of the integers.

• Can you find one interpretation in which both (x)P(x) is true

and (x)P(x) is false?

• Can you find one interpretation in which both (x)P(x) is true

and (x)P(x) is false?

Page 6: chapter1 Logic.pptftang/courses/CS130/notes/predicate logic.pdf · &6 ±'LVFUHWH 6WUXFWXUHV 9DULDEOHV DQG 6WDWHPHQWV 9DULDEOHV $ YDULDEOH LV D V\PERO WKDW VWDQGV IRU DQ LQGLYLGXDO

CS 130 – Discrete Structures 59

Unary, Binary,…, N-ary Predicates

• Predicates involving properties of a single variable: unary predicates

• Binary, ternary and n-ary predicates are also possible

• (x) (y)Q(x,y) is a binary predicate. This expression reads as “for every x there exists a y such that Q(x,y)”

• Assume Q(x,y) is the property that x < y, what’re the interpretations?– ( x)( y) Q(x, y), ( y) ( x) Q(x, y), and ( x)( x) Q(x, x)– We cannot collapse separate variables together into one without

changing the nature of the expression

• Constants are also allowed in expressions, such as a, b, c, 0, 1, 2, etc.

Page 7: chapter1 Logic.pptftang/courses/CS130/notes/predicate logic.pdf · &6 ±'LVFUHWH 6WUXFWXUHV 9DULDEOHV DQG 6WDWHPHQWV 9DULDEOHV $ YDULDEOH LV D V\PERO WKDW VWDQGV IRU DQ LQGLYLGXDO

CS 130 – Discrete Structures 60

Interpretation

• Formal definition: An interpretation for an expression involving predicates consists of the following:– A collection of objects, called domain of interpretation, which

must include at least one object.– An assignment of a property of the objects in the domain to each

predicate in the expression.– An assignment of a particular object in the domain to each

constant symbol in the expression.

• Predicate wffs can be built similar to propositional wffs using logical connectives with predicates and quantifiers.

• Must obey the rules of syntax to be considered a wff

• Examples of predicate wffs– (x)[P(x) Q(x)]– (x) ((y)[P(x,y) V Q(x,y)] R(x))– S(x,y) Λ R(x,y)

Page 8: chapter1 Logic.pptftang/courses/CS130/notes/predicate logic.pdf · &6 ±'LVFUHWH 6WUXFWXUHV 9DULDEOHV DQG 6WDWHPHQWV 9DULDEOHV $ YDULDEOH LV D V\PERO WKDW VWDQGV IRU DQ LQGLYLGXDO

CS 130 – Discrete Structures 61

Scope of a Variable in an Expression

• The parentheses or brackets are used wisely to identify the scope of the variable.– (x) ((y)[P(x,y) V Q(x,y)] R(x))

• Scope of (y) is P(x,y) V Q(x,y) while the scope of (x) is the entire expression

– (x)S(x) V (y)R(y) • Scope of (x) is S(x) while the scope of (y) is R(y)

– (x)[P(x,y) (y) Q(x,y)]• Scope of variable y is not defined for P(x,y) hence y is called a free

variable. Such expressions might not have a truth value at all.• P(x): x > 0; P(y)^ P(5), P(y) V P(5).

– What is the truth of the wff (x)(A(x) Λ (y)[B(x,y) C(y)]) , where A(x) is “x > 0” , B(x, y) is “x > y”, C(y) is “y 0”, and x is the domain of positive integers and y is the domain of all integers?

Page 9: chapter1 Logic.pptftang/courses/CS130/notes/predicate logic.pdf · &6 ±'LVFUHWH 6WUXFWXUHV 9DULDEOHV DQG 6WDWHPHQWV 9DULDEOHV $ YDULDEOH LV D V\PERO WKDW VWDQGV IRU DQ LQGLYLGXDO

CS 130 – Discrete Structures 62

Translation of Verbal Statements to Symbolic Form Using Intermediate Statements

• “Every person is nice” can be rephrased as “For any thing, if it is a person, then it is nice”. So, if P(x) is “x is a person” and Q(x) be “x is nice”, the statement can be symbolized as – (x)[P(x) Q(x)]

• Variations: “All persons are nice” or “Each person is nice”. • “There is a nice person” can be rewritten as “There exists something

that is both a person and nice” in symbolic form– (x)[P(x) Λ Q(x)]

• Variations: “Some persons are nice” or “There are nice persons”

• What would the following forms mean for the example above?– (x) [P(x) Λ Q(x)] is too strong– (x)[P(x) Q(x)] will be true if there are no persons in the world but that

is not the case. • So almost always, goes with Λ (conjunction) and goes with

(implication)• Can be confusing, so remember to frame the statement in different

forms as possible

Page 10: chapter1 Logic.pptftang/courses/CS130/notes/predicate logic.pdf · &6 ±'LVFUHWH 6WUXFWXUHV 9DULDEOHV DQG 6WDWHPHQWV 9DULDEOHV $ YDULDEOH LV D V\PERO WKDW VWDQGV IRU DQ LQGLYLGXDO

CS 130 – Discrete Structures 63

More On Translation

• The word “only” can be tricky depending on its presence in the statement:– X loves only Y If X loves anything, then that thing is Y– Only X loves Y If anything loves Y, then it is X– X only loves Y If X does anything to Y, then it is love

• Example for forming symbolic forms from predicate symbols:– D(x) is “x is dog”– R(x) is “x is a rabbit”– C(x,y) is “x chases y”

• All dogs chase all rabbits – For anything, if it is a dog, then for any other thing, if it is a rabbit, then the

dog chases it (x)[D(x) (y)(R(y) C(x,y))]• Some dogs chase all rabbits

– There is something that is a dog and for any other thing, if that thing is a rabbit, then the dog chases it (x)[D(x) Λ (y)(R(y) C(x,y))]

• Only dogs chase rabbits – For anything, if it is a rabbit then, if anything chases it, that thing is a dog

(y) [R(y) (x) (C(x, y) D(x))]– Or, for any two things, if one is a rabbit and the other chases it, then the

other is a dog (y) (x)[R(y) Λ C(x,y) D(x)]

Page 11: chapter1 Logic.pptftang/courses/CS130/notes/predicate logic.pdf · &6 ±'LVFUHWH 6WUXFWXUHV 9DULDEOHV DQG 6WDWHPHQWV 9DULDEOHV $ YDULDEOH LV D V\PERO WKDW VWDQGV IRU DQ LQGLYLGXDO

CS 130 – Discrete Structures 64

Negation of Statements

• A(x): Everything is beautiful– Negation will be “it is false that everything is beautiful”, i.e.

“something is not beautiful” – In symbolic form, [(x)A(x)]’ (x)[A(x)]’– Similarly, negation of “Something is beautiful” is “Nothing is

beautiful” or “Nothing is beautiful”– Hence, [(x)A(x)]’ (x)[A(x)]’

• What is the negation of “Everybody loves somebody sometime”– Everybody hates somebody sometime– Somebody loves everybody all the time– Everybody hates everybody all the time– Somebody hates everybody all the time

Page 12: chapter1 Logic.pptftang/courses/CS130/notes/predicate logic.pdf · &6 ±'LVFUHWH 6WUXFWXUHV 9DULDEOHV DQG 6WDWHPHQWV 9DULDEOHV $ YDULDEOH LV D V\PERO WKDW VWDQGV IRU DQ LQGLYLGXDO

CS 130 – Discrete Structures 65

More Examples on Negation

• What is the negation of the following statements?– Some pictures are old and faded.

• Every picture is not old or not faded.

– All people are tall and thin.• Someone is short or fat.

– Some students eat only pizza.• Every student eats something which is not a pizza

– Only students eat pizza.• There is a non-student who eats pizza.

Page 13: chapter1 Logic.pptftang/courses/CS130/notes/predicate logic.pdf · &6 ±'LVFUHWH 6WUXFWXUHV 9DULDEOHV DQG 6WDWHPHQWV 9DULDEOHV $ YDULDEOH LV D V\PERO WKDW VWDQGV IRU DQ LQGLYLGXDO

CS 130 – Discrete Structures 66

Class Exercises

• S(x): x is a student• I(x): x is intelligent• M(x): x likes music

• Write wffs than express the following statements:– All students are

intelligent.– Some intelligent

students like music.– Everyone who likes

music is a stupid student.

– Only intelligent students like music.

For anything, if it is a student, then it is intelligent (x)[S(x) I (x)]

There is something that is intelligent and it is a student and it likes music (x)[I(x) Λ S(x) Λ M(x)]

For anything, if that thing likes music, then it is a student and it is not intelligent

(x)(M(x) S(x) Λ [I (x)]´)

For any thing, if it likes music, then it is a student and it is intelligent

(x)(M(x) S(x) Λ I(x))

Page 14: chapter1 Logic.pptftang/courses/CS130/notes/predicate logic.pdf · &6 ±'LVFUHWH 6WUXFWXUHV 9DULDEOHV DQG 6WDWHPHQWV 9DULDEOHV $ YDULDEOH LV D V\PERO WKDW VWDQGV IRU DQ LQGLYLGXDO

CS 130 – Discrete Structures 67

Validity

• Analogous to a tautology of propositional logic• Truth of a predicate wff depends on the interpretation• A predicate wff is valid if it is true in all possible interpretations just

like a propositional wff is true if it is true for all rows of the truth table• A valid predicate wff is intrinsically true

Propositional Wffs Predicate Wffs

Truth Values True or false – depends on the truth value of statement letters

True, false or neither(if the wff has a free variable)

Intrinsic truth Tautology- true for all truth values of its statements

Valid wff- true for all interpretations

Methodology Truth table to determine if it is a tautology

No algorithm to determine validity

Page 15: chapter1 Logic.pptftang/courses/CS130/notes/predicate logic.pdf · &6 ±'LVFUHWH 6WUXFWXUHV 9DULDEOHV DQG 6WDWHPHQWV 9DULDEOHV $ YDULDEOH LV D V\PERO WKDW VWDQGV IRU DQ LQGLYLGXDO

CS 130 – Discrete Structures 68

Validity Examples

• (x)P(x) (x)P(x)– This is valid because if every object of the domain has a certain

property, then there exists an object of the domain that has the same property. Therefore, whenever the antecedent is true, so is the consequent, and the implication is therefore true.

• (x)P(x) P(a)– Valid – quite obvious since a is a member of the domain of X.

• (x)P(x) (x)P(x)– Not valid since the property cannot be valid for all objects in the

domain if it is valid for some objects of than domain. Can use a mathematical context to check as well. Say P(x) = “x is even”, then there exists an integer that is even but not every integer is even.

• How about (x)[P(x) V Q(x)] (x)P(x) V (x)Q(x)– Invalid, can prove by mathematical context by taking P(x) = x is

even, Q(x) = x is odd. In that case, the hypothesis is true but not the conclusion is false because it is not the case that every integer is even or that every integer is odd.

Page 16: chapter1 Logic.pptftang/courses/CS130/notes/predicate logic.pdf · &6 ±'LVFUHWH 6WUXFWXUHV 9DULDEOHV DQG 6WDWHPHQWV 9DULDEOHV $ YDULDEOH LV D V\PERO WKDW VWDQGV IRU DQ LQGLYLGXDO

CS 130 – Discrete Structures 69

More Examples

• What’s the validity?– (x)[P(x) ^ Q(x)] (x)P(x) ^ (x)Q(x)– P(x)[Q(x)P(x)]

Page 17: chapter1 Logic.pptftang/courses/CS130/notes/predicate logic.pdf · &6 ±'LVFUHWH 6WUXFWXUHV 9DULDEOHV DQG 6WDWHPHQWV 9DULDEOHV $ YDULDEOH LV D V\PERO WKDW VWDQGV IRU DQ LQGLYLGXDO

CS 130 – Discrete Structures 70

Class Exercises

• What is the truth of the following wffs where the domain consists of integers:– (x)[L(x) O(x)] where O(x) is “x is odd” and L(x) is “x < 10”– (y)(x)(x + y = 0)– (y)(x)(x2 = y)– (x)[x < 0 (y)(y > 0 Λ x + y = 0)]

• Using predicate symbols and appropriate quantifiers, write the symbolic form of the following English statement:– D(x) is “x is a day”; M is “Monday”; T is “Tuesday”.– S(x) is “x is sunny”; R(x) is “x is rainy”.– Some days are sunny and rainy– It is always a sunny day only if it is a rainy day– It rained both Monday and Tuesday– Every day that is rainy is not sunny

Page 18: chapter1 Logic.pptftang/courses/CS130/notes/predicate logic.pdf · &6 ±'LVFUHWH 6WUXFWXUHV 9DULDEOHV DQG 6WDWHPHQWV 9DULDEOHV $ YDULDEOH LV D V\PERO WKDW VWDQGV IRU DQ LQGLYLGXDO

CS 130 – Discrete Structures 71

Answers

• D(x) is “x is a day”; M is “Monday”; T is “Tuesday”.• S(x) is “x is sunny”; R(x) is “x is rainy”.

• Some days are sunny and rainy– (x) S(x) Λ R(x) Λ D(x)

• It is always a sunny day only if it is a rainy day– (x) [S(x) Λ D(x) R(x) Λ D(x)]

• It rained both Monday and Tuesday– R(M) Λ R(T)

• Every day that is rainy is not sunny– (x) [R(X) Λ D(x) S’(x)]

Page 19: chapter1 Logic.pptftang/courses/CS130/notes/predicate logic.pdf · &6 ±'LVFUHWH 6WUXFWXUHV 9DULDEOHV DQG 6WDWHPHQWV 9DULDEOHV $ YDULDEOH LV D V\PERO WKDW VWDQGV IRU DQ LQGLYLGXDO

CS 130 – Discrete Structures

Formal Logic --Predicate Logic

Page 20: chapter1 Logic.pptftang/courses/CS130/notes/predicate logic.pdf · &6 ±'LVFUHWH 6WUXFWXUHV 9DULDEOHV DQG 6WDWHPHQWV 9DULDEOHV $ YDULDEOH LV D V\PERO WKDW VWDQGV IRU DQ LQGLYLGXDO

CS 130 – Discrete Structures 73

Valid Argument

• (P1 Λ P2 Λ ... Λ Pn) Q– where the wffs are built from predicates and quantifiers as

well as logical connectives and grouping symbols– no equivalent of the truth table exists to prove validity– the meaning and the structure of the quantifiers and

predicates determines the interpretation and the validity of the arguments

– Predicate logic: 4 more new derivation rules to build a proof sequence leading from the hypothesis to the conclusion

– The equivalence rules and inference rules still applies• Why predicate logic? More rules?

– A valid argument for predicate logic need not be a tautology to be valid

– Example: (x)P(x) (x)P(x)– Hence: we need to learn 4 new rules

Page 21: chapter1 Logic.pptftang/courses/CS130/notes/predicate logic.pdf · &6 ±'LVFUHWH 6WUXFWXUHV 9DULDEOHV DQG 6WDWHPHQWV 9DULDEOHV $ YDULDEOH LV D V\PERO WKDW VWDQGV IRU DQ LQGLYLGXDO

CS 130 – Discrete Structures 74

Steps To Prove the Validity

• Basic approach to prove arguments:• Strip off quantifiers• Manipulate the unquantified wffs• Reinsert the quantifiers• Four new inference rules

Two rules to strip the quantifiers Two rules to reinsert the quantifiers

Page 22: chapter1 Logic.pptftang/courses/CS130/notes/predicate logic.pdf · &6 ±'LVFUHWH 6WUXFWXUHV 9DULDEOHV DQG 6WDWHPHQWV 9DULDEOHV $ YDULDEOH LV D V\PERO WKDW VWDQGV IRU DQ LQGLYLGXDO

CS 130 – Discrete Structures 75

Inference Rules in Predicate Logic

From Can Derive Name / Abbreviation

Restrictions on Use

(x)P(x) P(t) where t is a variable or constant

symbol

Universal Instantiation- ui

If t is a variable, it must not fall within the scope of a

quantifier for t

(x)P(x) P(t) where t is a variable or constant

symbol not previously used in a

proof sequence

Existential Instantiation- ei

Must be the first rule used that introduces t

P(x) (x)P(x) Universal Generalization- ug

P(x) has not been deduced from any hypotheses in

which x is a free variable nor has P(x) been deduced by ei from any wff in which

x is a free variable

P(x) or P(a)

(x)P(x) Existential Generalization- eg

To go from P(a) to (x)P(x), x must not appear in P(a)

Page 23: chapter1 Logic.pptftang/courses/CS130/notes/predicate logic.pdf · &6 ±'LVFUHWH 6WUXFWXUHV 9DULDEOHV DQG 6WDWHPHQWV 9DULDEOHV $ YDULDEOH LV D V\PERO WKDW VWDQGV IRU DQ LQGLYLGXDO

CS 130 – Discrete Structures 76

Universal Instantiation (1)

• This rule says if P is true for every element of the domain, we can name such an element by an arbitrary variable name like x, y, or z, or we can specify a particular constant in the domain, and P is still true for all these things.

• Example:– All flowers are plants. Sunflower is a flower. Therefore, sunflower

is a plant.– P(x) is “ x is a plant”– a is a constant symbol (Sunflower)– F(x) is “x is a flower”– The argument is (x)[F(x) P(x)] Λ F(a) P(a)

• The proof sequence is as follows:1. (x)[F(x) P(x)] hyp2. F(a) hyp3. F(a) P(a) 1, ui4. P(a) 2, 3, mp

Page 24: chapter1 Logic.pptftang/courses/CS130/notes/predicate logic.pdf · &6 ±'LVFUHWH 6WUXFWXUHV 9DULDEOHV DQG 6WDWHPHQWV 9DULDEOHV $ YDULDEOH LV D V\PERO WKDW VWDQGV IRU DQ LQGLYLGXDO

CS 130 – Discrete Structures 77

Universal Instantiation (2)

• Restriction: (x)P(x) derives P(t), t must not fall within the scope of a quantifier for t

• Without this restriction:– a hypothesis of the form (x) (y) P(x, y) could lead

to the wff (y) P(y, y)– this is invalid– considering when P(x, y) means “y > x”

Page 25: chapter1 Logic.pptftang/courses/CS130/notes/predicate logic.pdf · &6 ±'LVFUHWH 6WUXFWXUHV 9DULDEOHV DQG 6WDWHPHQWV 9DULDEOHV $ YDULDEOH LV D V\PERO WKDW VWDQGV IRU DQ LQGLYLGXDO

CS 130 – Discrete Structures 78

Example

• Prove the argument:– (x)[P(x) Q(x)] Λ [Q(y)]’ [P(y)]’

• Proof sequence:1. (x)[P(x) Q(x)] hyp2. [Q(y)]’ hyp3. P(y) Q(y) 1, ui4. [P(y)]’ 2, 3, mt

Page 26: chapter1 Logic.pptftang/courses/CS130/notes/predicate logic.pdf · &6 ±'LVFUHWH 6WUXFWXUHV 9DULDEOHV DQG 6WDWHPHQWV 9DULDEOHV $ YDULDEOH LV D V\PERO WKDW VWDQGV IRU DQ LQGLYLGXDO

CS 130 – Discrete Structures 79

Existential Instantiation

• It says that from (x)P(x) we can derive P(a), P(b) or P(c), provided that these are new constant symbols.

• The following proof sequence is legitimate:1. (x)[P(x) -> Q(x)] hyp2. (y)P(y) hyp3. P(a) 2, ei4. P(a)->Q(a) 1, ui5. Q(a) 3, 4, mp

– However, step 3 and 4 cannot be reversed– So, look at your hypotheses, if you plan to use ei on

any of them, do it first.

Page 27: chapter1 Logic.pptftang/courses/CS130/notes/predicate logic.pdf · &6 ±'LVFUHWH 6WUXFWXUHV 9DULDEOHV DQG 6WDWHPHQWV 9DULDEOHV $ YDULDEOH LV D V\PERO WKDW VWDQGV IRU DQ LQGLYLGXDO

CS 130 – Discrete Structures 80

Universal Generalization

• P(x) derives (x)P(x) when x is absolutely arbitrary

• Example: (x)[P(x) Q(x)] Λ (x)P(x) (x)Q(x)

• Proof sequence:1. (x)[P(x) Q(x)] hyp2. (x)P(x) hyp3. P(x) Q(x) 1, ui4. P(x) 2, ui : no restriction on UI about reusing a name

5. Q(x) 3, 4, mp6. (x)Q(x) 5, ug

• Note: step 6 is legitimate since x is not a free variable in any hypothesis nor was ei used before

Page 28: chapter1 Logic.pptftang/courses/CS130/notes/predicate logic.pdf · &6 ±'LVFUHWH 6WUXFWXUHV 9DULDEOHV DQG 6WDWHPHQWV 9DULDEOHV $ YDULDEOH LV D V\PERO WKDW VWDQGV IRU DQ LQGLYLGXDO

CS 130 – Discrete Structures 81

Two Restrictions on UG

• Free variable in hypothesis– P(x) hyp– (x)P(x) 1, incorrect ug; x is free in the hypothesis

• Deduced from ei, and free variable– (x)(y)Q(x, y) hyp– (y)Q(x, y) 1, ui– Q(x, a) 2, ei– (x)Q(x, a) 3, incorrect ug; Q(x, a) is

deduced by ei from the wff in step 2, in which x is free

– Example: Q(x, y): x + y = 0

Page 29: chapter1 Logic.pptftang/courses/CS130/notes/predicate logic.pdf · &6 ±'LVFUHWH 6WUXFWXUHV 9DULDEOHV DQG 6WDWHPHQWV 9DULDEOHV $ YDULDEOH LV D V\PERO WKDW VWDQGV IRU DQ LQGLYLGXDO

CS 130 – Discrete Structures 82

Example

• Prove the argument – (x)[P(x) Λ Q(x)] (x)P(x) Λ (x)Q(x)

• Proof sequence:1. (x)[P(x) Λ Q(x)] hyp2. P(x) Λ Q(x) 1, ui3. P(x) 2, sim4. Q(x) 2, sim5. (x)P(x) 3, ug6. (x)Q(x) 4, ug7. (x)P(x) Λ (x)Q(x) 5, 6, con

Page 30: chapter1 Logic.pptftang/courses/CS130/notes/predicate logic.pdf · &6 ±'LVFUHWH 6WUXFWXUHV 9DULDEOHV DQG 6WDWHPHQWV 9DULDEOHV $ YDULDEOH LV D V\PERO WKDW VWDQGV IRU DQ LQGLYLGXDO

CS 130 – Discrete Structures 83

Existential Generalization

• It allows insertion of an . From P(x) or P(a) we can derive (x)P(x). Restriction: x must not appear in P(a).

• Prove the argument (x)P(x) (x)P(x) • Proof sequence:

1. (x)P(x) hyp2. P(x) 1, ui3. (x)P(x) 2, eg

• Without the restriction: • from P(a, y) one could derive (y) P(y, y)• incorrect: since y already appeared in the wff in which eg

was applied• why? P(x, y): “y>x”

Page 31: chapter1 Logic.pptftang/courses/CS130/notes/predicate logic.pdf · &6 ±'LVFUHWH 6WUXFWXUHV 9DULDEOHV DQG 6WDWHPHQWV 9DULDEOHV $ YDULDEOH LV D V\PERO WKDW VWDQGV IRU DQ LQGLYLGXDO

CS 130 – Discrete Structures 84

More Examples

• Are the following proof sequence legitimate?– 1. (x)P(x) V (x)Q(x) hyp– 2. P(a) V Q(a) 1, ei

– 1. (x)(y)Q(x, y) hyp– 2. (x)Q(x, a) 1, ei

Page 32: chapter1 Logic.pptftang/courses/CS130/notes/predicate logic.pdf · &6 ±'LVFUHWH 6WUXFWXUHV 9DULDEOHV DQG 6WDWHPHQWV 9DULDEOHV $ YDULDEOH LV D V\PERO WKDW VWDQGV IRU DQ LQGLYLGXDO

CS 130 – Discrete Structures 85

More Examples

• Prove the argument – (y)[P(x) Q(x,y)] [P(x) (y)Q(x,y)]

• Using the deduction method, we can derive– (y)[P(x) Q(x,y)] Λ P(x) (y)Q(x,y)

• Proof sequence:1.(y)[P(x) Q(x,y)] hyp2.P(x) hyp3.P(x) Q(x,y) 1, ui4.Q(x,y) 2, 3, mp5.(y)Q(x,y) 4, ug

Page 33: chapter1 Logic.pptftang/courses/CS130/notes/predicate logic.pdf · &6 ±'LVFUHWH 6WUXFWXUHV 9DULDEOHV DQG 6WDWHPHQWV 9DULDEOHV $ YDULDEOH LV D V\PERO WKDW VWDQGV IRU DQ LQGLYLGXDO

CS 130 – Discrete Structures 86

Temporary Hypotheses

• An extension to the deduction method:– we can insert a “temporary” hypothesis into a proof– If some wff T is introduced into the proof of

sequence as a temporary hypothesis, and eventually a wff W is deduced from T and other hypotheses, then the wff T -> W has been deduced from the other hypotheses and can be inserted in the proof sequence

Page 34: chapter1 Logic.pptftang/courses/CS130/notes/predicate logic.pdf · &6 ±'LVFUHWH 6WUXFWXUHV 9DULDEOHV DQG 6WDWHPHQWV 9DULDEOHV $ YDULDEOH LV D V\PERO WKDW VWDQGV IRU DQ LQGLYLGXDO

CS 130 – Discrete Structures 87

Example of Temporary Hypothesis

• Prove the argument – [P(x) (y)Q(x,y)] (y)[P(x) Q(x,y)]

• Proof sequence:1. P(x) (y)Q(x,y) hyp.2. P(x) temporary hypothesis (T)3. (y)Q(x,y) 1, 2, mp4. Q(x,y) 3, ui (W)5. P(x) Q(x,y) temp. hyp discharged (T->W)6. (y)[P(x) Q(x,y)] 5, ug

• Universal quantifier can “slide over” subwffs that do not contain the quantified variable

• Same for existential quantifier

Page 35: chapter1 Logic.pptftang/courses/CS130/notes/predicate logic.pdf · &6 ±'LVFUHWH 6WUXFWXUHV 9DULDEOHV DQG 6WDWHPHQWV 9DULDEOHV $ YDULDEOH LV D V\PERO WKDW VWDQGV IRU DQ LQGLYLGXDO

CS 130 – Discrete Structures 88

More Example

• Prove the argument– (x)[(B(x) V C(x)) A(x)] (x)[B(x) A(x)]

• Proof sequence: 1. (x)[(B(x) V C(x)) A(x)] hyp2. (B(x) V C(x)) A(x) 1, ui3. B(x) temp. hyp.4. B(x) V C(x) 3, add5. A(x) 2, 4, mp6. B(x) A(x) temp. hyp. Discharged7. (x)[B(x) A(x)] 6, ug

Page 36: chapter1 Logic.pptftang/courses/CS130/notes/predicate logic.pdf · &6 ±'LVFUHWH 6WUXFWXUHV 9DULDEOHV DQG 6WDWHPHQWV 9DULDEOHV $ YDULDEOH LV D V\PERO WKDW VWDQGV IRU DQ LQGLYLGXDO

CS 130 – Discrete Structures 89

More: [(x)A(x)]’ (x)[A(x)]’

• [(x)A(x)]’ (x)[A(x)]’• Proof sequence:1. [(x)A(x)]’ hyp.2. A(x) temp. hyp.3. (x)A(x) 2, eg4. A(x) (x)A(x)

temp. hyp. discharged5. [A(x)]’ 1, 4, mt6. (x)[A(x)]’ 5, ug

• (x)[A(x)]’ [(x)A(x)]’• Proof sequence:1. (x)[A(x)]’ hyp.2. (x)A(x) temp. hyp.3. A(a) 2, ei4. [A(a)]’ 1, ui5. [(x)[A(x)]’]’ 3, 4, inc6. (x)A(x) [(x)[A(x)]’]’

temp. hyp. discharged7. [((x)[A(x)]’)’]’ 1, dn8. [(x)A(x)]’ 6, 7, mt

inc: inconsistency in exercise 27 in section 1.2

Page 37: chapter1 Logic.pptftang/courses/CS130/notes/predicate logic.pdf · &6 ±'LVFUHWH 6WUXFWXUHV 9DULDEOHV DQG 6WDWHPHQWV 9DULDEOHV $ YDULDEOH LV D V\PERO WKDW VWDQGV IRU DQ LQGLYLGXDO

CS 130 – Discrete Structures 90

More Examples

• Is the following wff a valid argument? Prove or disprove.– (x)[P(x) v Q(x)] (x)P(x) v (x)Q(x)– (x)P(x) Λ (x)Q(x) (x)[P(x) Λ Q(x)]– (x)P(x) Λ [(x)(P(x) Λ Q(x))]’ (x)[Q(x)]’

• First, consider whether the wff seems valid– if yes, try to find a proof sequence for it– otherwise, try to find an interpretation in which it is

not true

Page 38: chapter1 Logic.pptftang/courses/CS130/notes/predicate logic.pdf · &6 ±'LVFUHWH 6WUXFWXUHV 9DULDEOHV DQG 6WDWHPHQWV 9DULDEOHV $ YDULDEOH LV D V\PERO WKDW VWDQGV IRU DQ LQGLYLGXDO

CS 130 – Discrete Structures 91

Verbal Arguments

• Every crocodile is bigger than every alligator. Sam is a crocodile. But there is a snake, and Sam isn’t bigger than that snake. Therefore, something is not an alligator.

• Use C(x), A(x), B(x,y), s, S(x)

(x) (y)[C(x) Λ A(y) B(x,y)] Λ C(s) Λ (x)(S(x) Λ [B(s,x)]´) (x)[A(x)]´

Page 39: chapter1 Logic.pptftang/courses/CS130/notes/predicate logic.pdf · &6 ±'LVFUHWH 6WUXFWXUHV 9DULDEOHV DQG 6WDWHPHQWV 9DULDEOHV $ YDULDEOH LV D V\PERO WKDW VWDQGV IRU DQ LQGLYLGXDO

CS 130 – Discrete Structures 92

Practice

• All rock music is loud music. Some rock music exists; therefore some loud music exists.

• Use R(x) and L(x).

Page 40: chapter1 Logic.pptftang/courses/CS130/notes/predicate logic.pdf · &6 ±'LVFUHWH 6WUXFWXUHV 9DULDEOHV DQG 6WDWHPHQWV 9DULDEOHV $ YDULDEOH LV D V\PERO WKDW VWDQGV IRU DQ LQGLYLGXDO

CS 130 – Discrete Structures 93

Review of Chapter 1

• Be able to:– construct truth tables for compound wffs– recognize tautologies and contradictions– translate compound statements into symbolic notations– negate a statement– apply derivation rules for propositional logic– use propositional logic to prove the validity of a verbal

argument– determine the truth value of a predicate wff in a given

interpretation– translate statements into predicate wffs– apply derivation rules for predicate logic– use predicate logic to prove the validity of a verbal

argument