Logics (cont.) Nguyen An Khuong et. al. Chapter 2 Logics (cont.) Contents Predicate Logic Discrete Structures for Computer Science (CO1007) on Ngày 5 tháng 1 năm 2023 Proof Methods Some problems for discussion Nguyen An Khuong et. al. Faculty of Computer Science and Engineering University of Technology, VNU-HCM 2.1 Contents Logics (cont.) Nguyen An Khuong et. al. Contents Predicate Logic 1 Predicate Logic Proof Methods Some problems for discussion 2 Proof Methods 3 Some problems for discussion 2.2 Limitations of Propositional Logic Logics (cont.) Nguyen An Khuong et. al. Contents Predicate Logic Proof Methods • x > 3: Some problems for discussion 2.3 Limitations of Propositional Logic Logics (cont.) Nguyen An Khuong et. al. Contents Predicate Logic Proof Methods • x > 3: Some problems for discussion 2.3 Limitations of Propositional Logic Logics (cont.) Nguyen An Khuong et. al. Contents Predicate Logic Proof Methods • x > 3: not a proposition. Some problems for discussion 2.3 Limitations of Propositional Logic Logics (cont.) Nguyen An Khuong et. al. Contents Predicate Logic Proof Methods • x > 3: not a proposition. • All square numbers are not prime numbers. 100 is a square number. Therefore 100 is not a prime number: Some problems for discussion 2.3 Limitations of Propositional Logic Logics (cont.) Nguyen An Khuong et. al. Contents Predicate Logic Proof Methods • x > 3: not a proposition. • All square numbers are not prime numbers. 100 is a square number. Therefore 100 is not a prime number: Some problems for discussion 2.3 Limitations of Propositional Logic Logics (cont.) Nguyen An Khuong et. al. Contents Predicate Logic Proof Methods • x > 3: not a proposition. • All square numbers are not prime numbers. 100 is a square number. Therefore 100 is not a prime number: not able to infer in propositional logic. Some problems for discussion 2.3 Predicates Definition Logics (cont.) Nguyen An Khuong et. al. • A predicate (vị từ) is a statement containing one or more variables. Contents Predicate Logic Proof Methods Some problems for discussion 2.4 Predicates Definition • A predicate (vị từ) is a statement containing one or more variables. • If values are assigned to all the variables in a predicate, the resulting statement is a proposition (mệnh đề ). Logics (cont.) Nguyen An Khuong et. al. Contents Predicate Logic Proof Methods Some problems for discussion 2.4 Predicates Definition • A predicate (vị từ) is a statement containing one or more variables. • If values are assigned to all the variables in a predicate, the resulting statement is a proposition (mệnh đề ). Logics (cont.) Nguyen An Khuong et. al. Contents Predicate Logic Proof Methods Some problems for discussion 2.4 Predicates Definition • A predicate (vị từ) is a statement containing one or more variables. • If values are assigned to all the variables in a predicate, the resulting statement is a proposition (mệnh đề ). Examples: • x > 3 (predicate) Logics (cont.) Nguyen An Khuong et. al. Contents Predicate Logic Proof Methods Some problems for discussion 2.4 Predicates Definition • A predicate (vị từ) is a statement containing one or more variables. • If values are assigned to all the variables in a predicate, the resulting statement is a proposition (mệnh đề ). Examples: • x > 3 (predicate) • 5 > 3 (proposition) Logics (cont.) Nguyen An Khuong et. al. Contents Predicate Logic Proof Methods Some problems for discussion 2.4 Predicates Definition • A predicate (vị từ) is a statement containing one or more variables. • If values are assigned to all the variables in a predicate, the resulting statement is a proposition (mệnh đề ). Examples: • x > 3 (predicate) • 5 > 3 (proposition) • 2 > 3 (proposition) Logics (cont.) Nguyen An Khuong et. al. Contents Predicate Logic Proof Methods Some problems for discussion 2.4 Predicates Definition • A predicate (vị từ) is a statement containing one or more variables. • If values are assigned to all the variables in a predicate, the resulting statement is a proposition (mệnh đề ). Examples: • x > 3 (predicate) • 5 > 3 (proposition) • 2 > 3 (proposition) Logics (cont.) Nguyen An Khuong et. al. Contents Predicate Logic Proof Methods Some problems for discussion 2.4 Predicates Definition • A predicate (vị từ) is a statement containing one or more variables. • If values are assigned to all the variables in a predicate, the resulting statement is a proposition (mệnh đề ). Examples: • x > 3 (predicate) • 5 > 3 (proposition) • 2 > 3 (proposition) Etymology: predicate (n.) from Latin praedicatum “that which is said of the subject.” Logics (cont.) Nguyen An Khuong et. al. Contents Predicate Logic Proof Methods Some problems for discussion 2.4 Predicates Definition • A predicate (vị từ) is a statement containing one or more variables. • If values are assigned to all the variables in a predicate, the resulting statement is a proposition (mệnh đề ). Examples: • x > 3 (predicate) • 5 > 3 (proposition) • 2 > 3 (proposition) Etymology: predicate (n.) from Latin praedicatum “that which is said of the subject.” Contexts: properties, relations, characteristics, features,... Logics (cont.) Nguyen An Khuong et. al. Contents Predicate Logic Proof Methods Some problems for discussion 2.4 Predicates Definition • A predicate (vị từ) is a statement containing one or more variables. • If values are assigned to all the variables in a predicate, the resulting statement is a proposition (mệnh đề ). Examples: • x > 3 (predicate) • 5 > 3 (proposition) • 2 > 3 (proposition) Etymology: predicate (n.) from Latin praedicatum “that which is said of the subject.” Contexts: properties, relations, characteristics, features,... Notations: • x > 3 → P (x) Logics (cont.) Nguyen An Khuong et. al. Contents Predicate Logic Proof Methods Some problems for discussion 2.4 Predicates Definition • A predicate (vị từ) is a statement containing one or more variables. • If values are assigned to all the variables in a predicate, the resulting statement is a proposition (mệnh đề ). Examples: • x > 3 (predicate) • 5 > 3 (proposition) • 2 > 3 (proposition) Etymology: predicate (n.) from Latin praedicatum “that which is said of the subject.” Contexts: properties, relations, characteristics, features,... Notations: • x > 3 → P (x) • 5 > 3 → P (5) Logics (cont.) Nguyen An Khuong et. al. Contents Predicate Logic Proof Methods Some problems for discussion 2.4 Predicates Definition • A predicate (vị từ) is a statement containing one or more variables. • If values are assigned to all the variables in a predicate, the resulting statement is a proposition (mệnh đề ). Examples: • x > 3 (predicate) • 5 > 3 (proposition) • 2 > 3 (proposition) Etymology: predicate (n.) from Latin praedicatum “that which is said of the subject.” Contexts: properties, relations, characteristics, features,... Notations: • x > 3 → P (x) • 5 > 3 → P (5) • 2 > 3 → P (2) Logics (cont.) Nguyen An Khuong et. al. Contents Predicate Logic Proof Methods Some problems for discussion 2.4 Predicates Definition • A predicate (vị từ) is a statement containing one or more variables. • If values are assigned to all the variables in a predicate, the resulting statement is a proposition (mệnh đề ). Examples: • x > 3 (predicate) • 5 > 3 (proposition) • 2 > 3 (proposition) Etymology: predicate (n.) from Latin praedicatum “that which is said of the subject.” Contexts: properties, relations, characteristics, features,... Notations: • x > 3 → P (x) • 5 > 3 → P (5) • 2 > 3 → P (2) • A predicate with n variables P (x1 , x2 , ..., xn ) Logics (cont.) Nguyen An Khuong et. al. Contents Predicate Logic Proof Methods Some problems for discussion 2.4 Truth value and Quantifiers Logics (cont.) Nguyen An Khuong et. al. • x > 3 is true or false? Contents Predicate Logic Proof Methods Some problems for discussion 2.5 Truth value and Quantifiers Logics (cont.) Nguyen An Khuong et. al. • x > 3 is true or false? • 5>3 Contents Predicate Logic Proof Methods Some problems for discussion 2.5 Truth value and Quantifiers Logics (cont.) Nguyen An Khuong et. al. • x > 3 is true or false? • 5>3 • For every number x, x > 3 holds Contents Predicate Logic Proof Methods Some problems for discussion 2.5 Truth value and Quantifiers Logics (cont.) Nguyen An Khuong et. al. • x > 3 is true or false? • 5>3 • For every number x, x > 3 holds • There is a number x such that x > 3 Contents Predicate Logic Proof Methods Some problems for discussion 2.5 Truth value and Quantifiers Logics (cont.) Nguyen An Khuong et. al. • x > 3 is true or false? • 5>3 • For every number x, x > 3 holds • There is a number x such that x > 3 Contents Predicate Logic Proof Methods Some problems for discussion 2.5 Truth value and Quantifiers Logics (cont.) Nguyen An Khuong et. al. • x > 3 is true or false? • 5>3 • For every number x, x > 3 holds • There is a number x such that x > 3 Contents Predicate Logic Proof Methods Some problems for discussion Quantifiers: • ∀: Universal – Với mọi 2.5 Truth value and Quantifiers Logics (cont.) Nguyen An Khuong et. al. • x > 3 is true or false? • 5>3 • For every number x, x > 3 holds • There is a number x such that x > 3 Contents Predicate Logic Proof Methods Some problems for discussion Quantifiers: • ∀: Universal – Với mọi • ∀xP (x) = P (x) is T for all x 2.5 Truth value and Quantifiers Logics (cont.) Nguyen An Khuong et. al. • x > 3 is true or false? • 5>3 • For every number x, x > 3 holds • There is a number x such that x > 3 Contents Predicate Logic Proof Methods Some problems for discussion Quantifiers: • ∀: Universal – Với mọi • ∀xP (x) = P (x) is T for all x • ∃: Existential – Tồn tại 2.5 Truth value and Quantifiers Logics (cont.) Nguyen An Khuong et. al. • x > 3 is true or false? • 5>3 • For every number x, x > 3 holds • There is a number x such that x > 3 Contents Predicate Logic Proof Methods Some problems for discussion Quantifiers: • ∀: Universal – Với mọi • ∀xP (x) = P (x) is T for all x • ∃: Existential – Tồn tại • ∃xP (x) = There exists an element x such that P (x) is T 2.5 Truth value and Quantifiers Logics (cont.) Nguyen An Khuong et. al. • x > 3 is true or false? • 5>3 • For every number x, x > 3 holds • There is a number x such that x > 3 Contents Predicate Logic Proof Methods Some problems for discussion Quantifiers: • ∀: Universal – Với mọi • ∀xP (x) = P (x) is T for all x • ∃: Existential – Tồn tại • ∃xP (x) = There exists an element x such that P (x) is T • We need a domain of discourse for variable: Universe 2.5 Logics (cont.) Nguyen An Khuong et. al. Example Let P (x) be the statement “x < 2”. What is the truth value of the quantification ∀xP (x), where the domain consists of all real number? Contents Predicate Logic Proof Methods Some problems for discussion 2.6 Logics (cont.) Nguyen An Khuong et. al. Example Let P (x) be the statement “x < 2”. What is the truth value of the quantification ∀xP (x), where the domain consists of all real number? • P (3) = 3 < 2 is false Contents Predicate Logic Proof Methods Some problems for discussion 2.6 Logics (cont.) Nguyen An Khuong et. al. Example Let P (x) be the statement “x < 2”. What is the truth value of the quantification ∀xP (x), where the domain consists of all real number? • P (3) = 3 < 2 is false • ⇒ ∀xP (x) is false Contents Predicate Logic Proof Methods Some problems for discussion 2.6 Logics (cont.) Nguyen An Khuong et. al. Example Let P (x) be the statement “x < 2”. What is the truth value of the quantification ∀xP (x), where the domain consists of all real number? • P (3) = 3 < 2 is false • ⇒ ∀xP (x) is false Contents Predicate Logic Proof Methods Some problems for discussion • 3 is a counterexample (phản ví dụ) of ∀xP (x) 2.6 Logics (cont.) Nguyen An Khuong et. al. Example Let P (x) be the statement “x < 2”. What is the truth value of the quantification ∀xP (x), where the domain consists of all real number? • P (3) = 3 < 2 is false • ⇒ ∀xP (x) is false Contents Predicate Logic Proof Methods Some problems for discussion • 3 is a counterexample (phản ví dụ) of ∀xP (x) 2.6 Logics (cont.) Nguyen An Khuong et. al. Example Let P (x) be the statement “x < 2”. What is the truth value of the quantification ∀xP (x), where the domain consists of all real number? • P (3) = 3 < 2 is false • ⇒ ∀xP (x) is false Contents Predicate Logic Proof Methods Some problems for discussion • 3 is a counterexample (phản ví dụ) of ∀xP (x) Example What is the truth value of the quantification ∃xP (x), where the domain consists of all real number? 2.6 Logics (cont.) Nguyen An Khuong et. al. Example Express the statement “Some student in this class comes from Central Vietnam.” Contents Predicate Logic Proof Methods Some problems for discussion 2.7 Logics (cont.) Nguyen An Khuong et. al. Example Express the statement “Some student in this class comes from Central Vietnam.” Contents Predicate Logic Proof Methods Solution 1 Some problems for discussion 2.7 Logics (cont.) Nguyen An Khuong et. al. Example Express the statement “Some student in this class comes from Central Vietnam.” Contents Predicate Logic Proof Methods Solution 1 • M (x) = “x comes from Central Vietnam” Some problems for discussion 2.7 Logics (cont.) Nguyen An Khuong et. al. Example Express the statement “Some student in this class comes from Central Vietnam.” Contents Predicate Logic Proof Methods Solution 1 • M (x) = “x comes from Central Vietnam” • Domain for x is the students in the class Some problems for discussion 2.7 Logics (cont.) Nguyen An Khuong et. al. Example Express the statement “Some student in this class comes from Central Vietnam.” Contents Predicate Logic Proof Methods Solution 1 • M (x) = “x comes from Central Vietnam” • Domain for x is the students in the class Some problems for discussion • ∃xM (x) 2.7 Logics (cont.) Nguyen An Khuong et. al. Example Express the statement “Some student in this class comes from Central Vietnam.” Contents Predicate Logic Proof Methods Solution 1 • M (x) = “x comes from Central Vietnam” • Domain for x is the students in the class Some problems for discussion • ∃xM (x) Solution 2 2.7 Logics (cont.) Nguyen An Khuong et. al. Example Express the statement “Some student in this class comes from Central Vietnam.” Contents Predicate Logic Proof Methods Solution 1 • M (x) = “x comes from Central Vietnam” • Domain for x is the students in the class Some problems for discussion • ∃xM (x) Solution 2 • Domain for x is all people • ... 2.7 Logics (cont.) Negation of Quantifiers Nguyen An Khuong et. al. Statement Negation Equivalent form ∀xP (x) ¬(∀xP (x)) ∃x¬P (x) ∃xP (x) ¬(∃xP (x)) ∀x¬P (x) Contents Predicate Logic Proof Methods Some problems for discussion 2.8 Logics (cont.) Negation of Quantifiers Nguyen An Khuong et. al. Statement Negation Equivalent form ∀xP (x) ¬(∀xP (x)) ∃x¬P (x) ∃xP (x) ¬(∃xP (x)) ∀x¬P (x) Contents Predicate Logic Proof Methods Some problems for discussion Example • All CSE students study Discrete Math 1 2.8 Logics (cont.) Negation of Quantifiers Nguyen An Khuong et. al. Statement Negation Equivalent form ∀xP (x) ¬(∀xP (x)) ∃x¬P (x) ∃xP (x) ¬(∃xP (x)) ∀x¬P (x) Contents Predicate Logic Proof Methods Some problems for discussion Example • All CSE students study Discrete Math 1 • Let C(x) denote “x is a CSE student” 2.8 Logics (cont.) Negation of Quantifiers Nguyen An Khuong et. al. Statement Negation Equivalent form ∀xP (x) ¬(∀xP (x)) ∃x¬P (x) ∃xP (x) ¬(∃xP (x)) ∀x¬P (x) Contents Predicate Logic Proof Methods Some problems for discussion Example • All CSE students study Discrete Math 1 • Let C(x) denote “x is a CSE student” • Let S(x) denote “x studies Discrete Math 1” 2.8 Logics (cont.) Negation of Quantifiers Nguyen An Khuong et. al. Statement Negation Equivalent form ∀xP (x) ¬(∀xP (x)) ∃x¬P (x) ∃xP (x) ¬(∃xP (x)) ∀x¬P (x) Contents Predicate Logic Proof Methods Some problems for discussion Example • All CSE students study Discrete Math 1 • Let C(x) denote “x is a CSE student” • Let S(x) denote “x studies Discrete Math 1” • ∀x : C(x) → S(x) 2.8 Logics (cont.) Negation of Quantifiers Nguyen An Khuong et. al. Statement Negation Equivalent form ∀xP (x) ¬(∀xP (x)) ∃x¬P (x) ∃xP (x) ¬(∃xP (x)) ∀x¬P (x) Contents Predicate Logic Proof Methods Some problems for discussion Example • All CSE students study Discrete Math 1 • Let C(x) denote “x is a CSE student” • Let S(x) denote “x studies Discrete Math 1” • ∀x : C(x) → S(x) • ∃x : ¬(C(x) → S(x)) ≡ ∃x : C(x) ∧ ¬S(x) 2.8 Logics (cont.) Negation of Quantifiers Nguyen An Khuong et. al. Statement Negation Equivalent form ∀xP (x) ¬(∀xP (x)) ∃x¬P (x) ∃xP (x) ¬(∃xP (x)) ∀x¬P (x) Contents Predicate Logic Proof Methods Some problems for discussion Example • All CSE students study Discrete Math 1 • Let C(x) denote “x is a CSE student” • Let S(x) denote “x studies Discrete Math 1” • ∀x : C(x) → S(x) • ∃x : ¬(C(x) → S(x)) ≡ ∃x : C(x) ∧ ¬S(x) • There is a CSE student who does not study Discrete Math 1. 2.8 Another Example Logics (cont.) Nguyen An Khuong et. al. Example Translate these: • All lions are fierce. • Some lions do not drink coffee. • Some fierce creatures do not drink coffee. Contents Predicate Logic Proof Methods Some problems for discussion 2.9 Another Example Logics (cont.) Nguyen An Khuong et. al. Example Translate these: • All lions are fierce. • Some lions do not drink coffee. • Some fierce creatures do not drink coffee. Contents Predicate Logic Proof Methods Some problems for discussion Solution Let P (x), Q(x) and R(x) be the statements “x is a lion”, “x is fierce” and “x drinks coffee”, respectively. • ∀x(P (x) → Q(x)). 2.9 Another Example Logics (cont.) Nguyen An Khuong et. al. Example Translate these: • All lions are fierce. • Some lions do not drink coffee. • Some fierce creatures do not drink coffee. Contents Predicate Logic Proof Methods Some problems for discussion Solution Let P (x), Q(x) and R(x) be the statements “x is a lion”, “x is fierce” and “x drinks coffee”, respectively. • ∀x(P (x) → Q(x)). • ∃x(P (x) ∧ ¬R(x)). 2.9 Another Example Logics (cont.) Nguyen An Khuong et. al. Example Translate these: • All lions are fierce. • Some lions do not drink coffee. • Some fierce creatures do not drink coffee. Contents Predicate Logic Proof Methods Some problems for discussion Solution Let P (x), Q(x) and R(x) be the statements “x is a lion”, “x is fierce” and “x drinks coffee”, respectively. • ∀x(P (x) → Q(x)). • ∃x(P (x) ∧ ¬R(x)). • ∃x(Q(x) ∧ ¬R(x)). 2.9 The Order of Quantifiers Logics (cont.) Nguyen An Khuong et. al. • The order of quantifiers is important, unless all the quantifiers are universal quantifiers or all are existential quantifiers Contents Predicate Logic Proof Methods Example Some problems for discussion ∀x ∀y (x + y = y + x) T for all x, y ∈ R 2.10 The Order of Quantifiers Logics (cont.) Nguyen An Khuong et. al. • The order of quantifiers is important, unless all the quantifiers are universal quantifiers or all are existential quantifiers • Read from left to right, apply from inner to outer Example Contents Predicate Logic Proof Methods Some problems for discussion ∀x ∀y (x + y = y + x) T for all x, y ∈ R 2.10 The Order of Quantifiers Logics (cont.) Nguyen An Khuong et. al. • The order of quantifiers is important, unless all the quantifiers are universal quantifiers or all are existential quantifiers • Read from left to right, apply from inner to outer Example Contents Predicate Logic Proof Methods Some problems for discussion ∀x ∀y (x + y = y + x) T for all x, y ∈ R 2.10 The Order of Quantifiers Logics (cont.) Nguyen An Khuong et. al. • The order of quantifiers is important, unless all the quantifiers are universal quantifiers or all are existential quantifiers • Read from left to right, apply from inner to outer Example Contents Predicate Logic Proof Methods Some problems for discussion ∀x ∀y (x + y = y + x) T for all x, y ∈ R Example ∀x ∃y (x + y = 0) is T, 2.10 The Order of Quantifiers Logics (cont.) Nguyen An Khuong et. al. • The order of quantifiers is important, unless all the quantifiers are universal quantifiers or all are existential quantifiers • Read from left to right, apply from inner to outer Example Contents Predicate Logic Proof Methods Some problems for discussion ∀x ∀y (x + y = y + x) T for all x, y ∈ R Example ∀x ∃y (x + y = 0) is T, while ∃y ∀x (x + y = 0) is F 2.10 Quantifiers plus ∧ and ∨ Logics (cont.) Nguyen An Khuong et. al. Example Show ∀x(P (x) ∧ Q(x)) ≡ ∀xP (x) ∧ ∀xQ(x). (That is, show that no matter what the domain is, these 2 propositions always have the same truth value). Contents Predicate Logic Proof Methods Some problems for discussion 2.11 Quantifiers plus ∧ and ∨ Logics (cont.) Nguyen An Khuong et. al. Example Show ∀x(P (x) ∧ Q(x)) ≡ ∀xP (x) ∧ ∀xQ(x). (That is, show that no matter what the domain is, these 2 propositions always have the same truth value). Contents Predicate Logic Proof Methods Terminology: We say that ∀ distributes over ∧. Some problems for discussion 2.11 Quantifiers plus ∧ and ∨ Logics (cont.) Nguyen An Khuong et. al. Example Show ∀x(P (x) ∧ Q(x)) ≡ ∀xP (x) ∧ ∀xQ(x). (That is, show that no matter what the domain is, these 2 propositions always have the same truth value). Contents Predicate Logic Proof Methods Terminology: We say that ∀ distributes over ∧. Some problems for discussion Chứng minh. First assume that ∀x(P (x) ∧ Q(x)) is true. So for all x, P (x) is true and Q(x) is true. Therefore ∀xP (x) is true, and ∀xQ(x) is true. Therefore ∀xP (x) ∧ ∀xQ(x) is true. 2.11 Quantifiers plus ∧ and ∨ Logics (cont.) Nguyen An Khuong et. al. Example Show ∀x(P (x) ∧ Q(x)) ≡ ∀xP (x) ∧ ∀xQ(x). (That is, show that no matter what the domain is, these 2 propositions always have the same truth value). Contents Predicate Logic Proof Methods Terminology: We say that ∀ distributes over ∧. Some problems for discussion Chứng minh. First assume that ∀x(P (x) ∧ Q(x)) is true. So for all x, P (x) is true and Q(x) is true. Therefore ∀xP (x) is true, and ∀xQ(x) is true. Therefore ∀xP (x) ∧ ∀xQ(x) is true. Now assume ∀xP (x) ∧ ∀xQ(x) is true. So ∀xP (x) is true and ∀xQ(x) is true. So for all x, P (x) is true and for all x, Q(x) is true. Therefore, for all x, P (x) ∧ Q(x) is true. So ∀x(P (x) ∧ Q(x)) is true. 2.11 Quantifiers plus ∧ and ∨ Logics (cont.) Nguyen An Khuong et. al. Example Show ∀x(P (x) ∧ Q(x)) ≡ ∀xP (x) ∧ ∀xQ(x). (That is, show that no matter what the domain is, these 2 propositions always have the same truth value). Contents Predicate Logic Proof Methods Terminology: We say that ∀ distributes over ∧. Some problems for discussion Chứng minh. First assume that ∀x(P (x) ∧ Q(x)) is true. So for all x, P (x) is true and Q(x) is true. Therefore ∀xP (x) is true, and ∀xQ(x) is true. Therefore ∀xP (x) ∧ ∀xQ(x) is true. Now assume ∀xP (x) ∧ ∀xQ(x) is true. So ∀xP (x) is true and ∀xQ(x) is true. So for all x, P (x) is true and for all x, Q(x) is true. Therefore, for all x, P (x) ∧ Q(x) is true. So ∀x(P (x) ∧ Q(x)) is true. Therefore ∀x(P (x) ∧ Q(x)) ≡ ∀xP (x) ∧ ∀xQ(x). 2.11 Exercises∗ Logics (cont.) Nguyen An Khuong et. al. 1 The existential quantifier ∃ does not distribute over ∧. That is, ∃x(P (x) ∧ Q(x)) ̸≡ ∃xP (x) ∧ ∃xQ(x). Contents Predicate Logic Proof Methods Some problems for discussion 2.12 Exercises∗ Logics (cont.) Nguyen An Khuong et. al. 1 2 The existential quantifier ∃ does not distribute over ∧. That is, ∃x(P (x) ∧ Q(x)) ̸≡ ∃xP (x) ∧ ∃xQ(x). The following is true though: Contents Predicate Logic Proof Methods Some problems for discussion ∃x(P (x) ∧ Q(x)) −→ ∃xP (x) ∧ ∃xQ(x). 2.12 Exercises∗ Logics (cont.) Nguyen An Khuong et. al. 1 2 The existential quantifier ∃ does not distribute over ∧. That is, ∃x(P (x) ∧ Q(x)) ̸≡ ∃xP (x) ∧ ∃xQ(x). The following is true though: Contents Predicate Logic Proof Methods Some problems for discussion ∃x(P (x) ∧ Q(x)) −→ ∃xP (x) ∧ ∃xQ(x). 3 With ∨, the situation is reversed. ∃ distributes over ∨, but ∀ does not. 2.12 Exercises∗ Logics (cont.) Nguyen An Khuong et. al. 1 2 The existential quantifier ∃ does not distribute over ∧. That is, ∃x(P (x) ∧ Q(x)) ̸≡ ∃xP (x) ∧ ∃xQ(x). The following is true though: Contents Predicate Logic Proof Methods Some problems for discussion ∃x(P (x) ∧ Q(x)) −→ ∃xP (x) ∧ ∃xQ(x). 3 With ∨, the situation is reversed. ∃ distributes over ∨, but ∀ does not. a. ∃x(S(x) ∨ R(x)) ≡ ∃xS(x) ∨ ∃xR(x). 2.12 Exercises∗ Logics (cont.) Nguyen An Khuong et. al. 1 2 The existential quantifier ∃ does not distribute over ∧. That is, ∃x(P (x) ∧ Q(x)) ̸≡ ∃xP (x) ∧ ∃xQ(x). The following is true though: Contents Predicate Logic Proof Methods Some problems for discussion ∃x(P (x) ∧ Q(x)) −→ ∃xP (x) ∧ ∃xQ(x). 3 With ∨, the situation is reversed. ∃ distributes over ∨, but ∀ does not. a. ∃x(S(x) ∨ R(x)) ≡ ∃xS(x) ∨ ∃xR(x). b. ∀x(S(x) ∨ R(x)) ←− ∀xS(x) ∨ ∀xR(x) is true. 2.12 Exercises∗ Logics (cont.) Nguyen An Khuong et. al. 1 2 The existential quantifier ∃ does not distribute over ∧. That is, ∃x(P (x) ∧ Q(x)) ̸≡ ∃xP (x) ∧ ∃xQ(x). The following is true though: Contents Predicate Logic Proof Methods Some problems for discussion ∃x(P (x) ∧ Q(x)) −→ ∃xP (x) ∧ ∃xQ(x). 3 With ∨, the situation is reversed. ∃ distributes over ∨, but ∀ does not. a. ∃x(S(x) ∨ R(x)) ≡ ∃xS(x) ∨ ∃xR(x). b. ∀x(S(x) ∨ R(x)) ←− ∀xS(x) ∨ ∀xR(x) is true. b. ∀x(S(x) ∨ R(x)) ̸≡ ∀xS(x) ∨ ∀xR(x) 2.12 Exercises∗ Logics (cont.) Nguyen An Khuong et. al. 1 2 The existential quantifier ∃ does not distribute over ∧. That is, ∃x(P (x) ∧ Q(x)) ̸≡ ∃xP (x) ∧ ∃xQ(x). The following is true though: Contents Predicate Logic Proof Methods Some problems for discussion ∃x(P (x) ∧ Q(x)) −→ ∃xP (x) ∧ ∃xQ(x). 3 With ∨, the situation is reversed. ∃ distributes over ∨, but ∀ does not. a. ∃x(S(x) ∨ R(x)) ≡ ∃xS(x) ∨ ∃xR(x). b. ∀x(S(x) ∨ R(x)) ←− ∀xS(x) ∨ ∀xR(x) is true. b. ∀x(S(x) ∨ R(x)) ̸≡ ∀xS(x) ∨ ∀xR(x) 4 ∃ does not distribute over −→. I.e., ∃x(P (x) −→ Q(x)) ̸≡ ∃xP (x) −→ ∃xQ(x). 2.12 Translating Nested Quantifiers Logics (cont.) Nguyen An Khuong et. al. Example Contents Predicate Logic ∀x (C(x) ∨ ∃y (C(y) ∧ F (x, y)) ) Provided that: • C(x): x has a computer, Proof Methods Some problems for discussion • F (x, y): x and y are friends, • x, y ∈ all students in your school. 2.13 Translating Nested Quantifiers Logics (cont.) Nguyen An Khuong et. al. Example Contents Predicate Logic ∀x (C(x) ∨ ∃y (C(y) ∧ F (x, y)) ) Provided that: • C(x): x has a computer, Proof Methods Some problems for discussion • F (x, y): x and y are friends, • x, y ∈ all students in your school. Answer For every student x in your school, x has a computer or there is a student y such that y has a computer and x and y are friends. 2.13 Translating Nested Quantifiers Logics (cont.) Nguyen An Khuong et. al. Example Contents Predicate Logic ∃x∀y∀z (((F (x, y) ∧ F (x, z) ∧ (y ̸= z)) → ¬F (y, z))) Provided that: • F (x, y): x, y are friends Proof Methods Some problems for discussion • x, y, z ∈ all students in your school. 2.14 Translating Nested Quantifiers Logics (cont.) Nguyen An Khuong et. al. Example Contents Predicate Logic ∃x∀y∀z (((F (x, y) ∧ F (x, z) ∧ (y ̸= z)) → ¬F (y, z))) Provided that: • F (x, y): x, y are friends Proof Methods Some problems for discussion • x, y, z ∈ all students in your school. Answer There is a student x, so that for every student y, every student z not the same as y, if x and y are friends, and x and z are friends, then y and z are not friends. 2.14 Translating into Logical Expressions Logics (cont.) Nguyen An Khuong et. al. Example 1 “There is a student in the class has visited Hanoi”. 2 “Every students in the class have visited Nha Trang or Vung Tau”. Contents Predicate Logic Proof Methods Some problems for discussion 2.15 Translating into Logical Expressions Logics (cont.) Nguyen An Khuong et. al. Example 1 “There is a student in the class has visited Hanoi”. 2 “Every students in the class have visited Nha Trang or Vung Tau”. Contents Predicate Logic Proof Methods Some problems for discussion Answer Assume: C(x) : x has visited Hanoi D(x) : x has visited Nha Trang E(x) : x has visited Vung Tau We have: 2.15 Translating into Logical Expressions Logics (cont.) Nguyen An Khuong et. al. Example 1 “There is a student in the class has visited Hanoi”. 2 “Every students in the class have visited Nha Trang or Vung Tau”. Contents Predicate Logic Proof Methods Some problems for discussion Answer Assume: C(x) : x has visited Hanoi D(x) : x has visited Nha Trang E(x) : x has visited Vung Tau We have: 1 ∃xC(x) 2.15 Translating into Logical Expressions Logics (cont.) Nguyen An Khuong et. al. Example 1 “There is a student in the class has visited Hanoi”. 2 “Every students in the class have visited Nha Trang or Vung Tau”. Contents Predicate Logic Proof Methods Some problems for discussion Answer Assume: C(x) : x has visited Hanoi D(x) : x has visited Nha Trang E(x) : x has visited Vung Tau We have: 1 ∃xC(x) 2 ∀x(D(x) ∨ E(x)) 2.15 Translating into Logical Expressions Logics (cont.) Nguyen An Khuong et. al. Contents Predicate Logic Example Proof Methods Every people has one and only one best friend. Some problems for discussion 2.16 Translating into Logical Expressions Logics (cont.) Nguyen An Khuong et. al. Contents Predicate Logic Example Proof Methods Every people has one and only one best friend. Some problems for discussion Solution Assume: • B(x, y) : y is the best friend of x We have: 2.16 Translating into Logical Expressions Logics (cont.) Nguyen An Khuong et. al. Contents Predicate Logic Example Proof Methods Every people has one and only one best friend. Some problems for discussion Solution Assume: • B(x, y) : y is the best friend of x We have: ∀x∃y∀z(B(x, y) ∧ ((y ̸= z) → ¬B(x, z))) 2.16 Translating into Logical Expressions Logics (cont.) Nguyen An Khuong et. al. Example Contents Predicate Logic If a person is a woman and a parent, then this person is mother of some one. Proof Methods Some problems for discussion 2.17 Translating into Logical Expressions Logics (cont.) Nguyen An Khuong et. al. Example Contents Predicate Logic If a person is a woman and a parent, then this person is mother of some one. Proof Methods Some problems for discussion Solution We define: • C(x) : x is woman • D(x) : x is a parent • E(x, y): x is mother of y We have: 2.17 Translating into Logical Expressions Logics (cont.) Nguyen An Khuong et. al. Example Contents Predicate Logic If a person is a woman and a parent, then this person is mother of some one. Proof Methods Some problems for discussion Solution We define: • C(x) : x is woman • D(x) : x is a parent • E(x, y): x is mother of y We have: ∀x((C(x) ∧ D(x)) → ∃yE(x, y)) 2.17 Inference Logics (cont.) Nguyen An Khuong et. al. Example • If I have a girlfriend, I will take her to go shopping. • Whenever I and my girlfriend go shopping and that day is a special day, I will surely buy her some expensive gift. • If I buy my girlfriend expensive gifts, I will eat noodles for a week. • Today is March 8. Contents Predicate Logic Proof Methods Some problems for discussion • March 8 is such a special day. • Therefore, if I have a girlfriend,... 2.18 Inference Logics (cont.) Nguyen An Khuong et. al. Example • If I have a girlfriend, I will take her to go shopping. • Whenever I and my girlfriend go shopping and that day is a special day, I will surely buy her some expensive gift. • If I buy my girlfriend expensive gifts, I will eat noodles for a week. • Today is March 8. Contents Predicate Logic Proof Methods Some problems for discussion • March 8 is such a special day. • Therefore, if I have a girlfriend,... • I will eat noodles for a week. 2.18 Propositional Rules of Inferences Logics (cont.) Nguyen An Khuong et. al. Rule of Inference p p→q ∴q Name Contents Predicate Logic Proof Methods Modus ponens Some problems for discussion 2.19 Propositional Rules of Inferences Logics (cont.) Nguyen An Khuong et. al. Rule of Inference Name Contents p p→q ∴q Modus ponens ¬q p→q ∴ ¬p Modus tollens Predicate Logic Proof Methods Some problems for discussion 2.19 Propositional Rules of Inferences Logics (cont.) Nguyen An Khuong et. al. Rule of Inference Name Contents p p→q ∴q Modus ponens ¬q p→q ∴ ¬p Modus tollens p→q q→r ∴p→r Hypothetical syllogism (Tam đoạn luận giả định) Predicate Logic Proof Methods Some problems for discussion 2.19 Propositional Rules of Inferences Logics (cont.) Nguyen An Khuong et. al. Rule of Inference Name Contents p p→q ∴q Modus ponens ¬q p→q ∴ ¬p Modus tollens p→q q→r ∴p→r Hypothetical syllogism (Tam đoạn luận giả định) p∨q ¬p ∴q Disjunctive syllogism (Tam đoạn luận tuyển) Predicate Logic Proof Methods Some problems for discussion 2.19 Logics (cont.) Propositional Rules of Inferences Nguyen An Khuong et. al. Rule of Inference Name Contents Predicate Logic Proof Methods Some problems for discussion 2.20 Logics (cont.) Propositional Rules of Inferences Nguyen An Khuong et. al. Rule of Inference Name Contents p ∴p∨q Addition (Quy tắc cộng ) Predicate Logic Proof Methods Some problems for discussion 2.20 Logics (cont.) Propositional Rules of Inferences Nguyen An Khuong et. al. Rule of Inference Name Contents p ∴p∨q p∧q ∴p Addition (Quy tắc cộng ) Predicate Logic Proof Methods Some problems for discussion Simplification (Rút gọn) 2.20 Logics (cont.) Propositional Rules of Inferences Nguyen An Khuong et. al. Rule of Inference Name Contents p ∴p∨q Addition (Quy tắc cộng ) p∧q ∴p Simplification (Rút gọn) p q ∴p∧q Conjunction (Kết hợp) Predicate Logic Proof Methods Some problems for discussion 2.20 Logics (cont.) Propositional Rules of Inferences Nguyen An Khuong et. al. Rule of Inference Name Contents p ∴p∨q Addition (Quy tắc cộng ) p∧q ∴p Simplification (Rút gọn) p q ∴p∧q Conjunction (Kết hợp) p∨q ¬p ∨ r ∴q∨r Resolution (Phân giải) Predicate Logic Proof Methods Some problems for discussion 2.20 Logics (cont.) Nguyen An Khuong et. al. Example If it rains today, then we will not have a barbecue today. If we do not have a barbecue today, then we will have a barbecue tomorrow. Therefore, if it rains today, then we will have a barbecue tomorrow. Contents Predicate Logic Proof Methods Some problems for discussion 2.21 Logics (cont.) Nguyen An Khuong et. al. Example If it rains today, then we will not have a barbecue today. If we do not have a barbecue today, then we will have a barbecue tomorrow. Therefore, if it rains today, then we will have a barbecue tomorrow. Contents Predicate Logic Proof Methods Some problems for discussion Solution • p: It is raining today • q: We will not have a barbecue today • r: We will have barbecue tomorrow 2.21 Logics (cont.) Nguyen An Khuong et. al. Example If it rains today, then we will not have a barbecue today. If we do not have a barbecue today, then we will have a barbecue tomorrow. Therefore, if it rains today, then we will have a barbecue tomorrow. Contents Predicate Logic Proof Methods Some problems for discussion Solution • p: It is raining today • q: We will not have a barbecue today • r: We will have barbecue tomorrow p→q q→r ∴p→r Hypothetical syllogism 2.21 Logics (cont.) Nguyen An Khuong et. al. Example • It is not sunny this afternoon (¬p) and it is colder than yesterday (q) • We will go swimming (r) only if it is sunny Contents Predicate Logic Proof Methods Some problems for discussion • If we do not go swimming, then we will take a canoe trip (s) • If we take a canoe trip, then we will be home by sunset (t) 2.22 Logics (cont.) Nguyen An Khuong et. al. Example • It is not sunny this afternoon (¬p) and it is colder than yesterday (q) • We will go swimming (r) only if it is sunny Contents Predicate Logic Proof Methods Some problems for discussion • If we do not go swimming, then we will take a canoe trip (s) • If we take a canoe trip, then we will be home by sunset (t) • We will be home by sunset (t) 2.22 Logics (cont.) Nguyen An Khuong et. al. Example 1. ¬p ∧ q Hypothesis 2. ¬p Simplification using (1) 3. r → p Hypothesis 4. ¬r Modus tollens using (2) and (3) 5. ¬r → s Hypothesis • If we take a canoe trip, then we will be home by sunset (t) 6. s Modus ponens using (4) and (5) • We will be home by sunset (t) 7. s → t Hypothesis 8. t Modus ponens using (6) and (7) • It is not sunny this afternoon (¬p) and it is colder than yesterday (q) • We will go swimming (r) only if it is sunny • If we do not go swimming, then we will take a canoe trip (s) Contents Predicate Logic Proof Methods Some problems for discussion 2.22 Fallacies Logics (cont.) Nguyen An Khuong et. al. Contents Definition Fallacies (ngụy biện) resemble rules of inference but are based on contingencies rather than tautologies. Predicate Logic Proof Methods Some problems for discussion 2.23 Fallacies Logics (cont.) Nguyen An Khuong et. al. Contents Definition Fallacies (ngụy biện) resemble rules of inference but are based on contingencies rather than tautologies. Predicate Logic Proof Methods Some problems for discussion Example If you do correctly every questions in mid-term exam, you will get 10 grade. You got 10 grade. Therefore, you did correctly every questions in mid-term exam. Is [(p → q) ∧ q] → p a tautology? 2.23 Rules of Inference for Quantified Statements Logics (cont.) Nguyen An Khuong et. al. Rule of Inference Name Contents Predicate Logic ∀xP (x) ∴ P (c) Universal instantiation (Cụ thể hóa phổ quát) Proof Methods Some problems for discussion 2.24 Rules of Inference for Quantified Statements Logics (cont.) Nguyen An Khuong et. al. Rule of Inference Name Contents Predicate Logic ∀xP (x) ∴ P (c) Universal instantiation (Cụ thể hóa phổ quát) P (c)for an arbitrary c ∴ ∀xP (x) Universal generalization (Tổng quát hóa phổ quát) Proof Methods Some problems for discussion 2.24 Rules of Inference for Quantified Statements Logics (cont.) Nguyen An Khuong et. al. Rule of Inference Name Contents Predicate Logic ∀xP (x) ∴ P (c) Universal instantiation (Cụ thể hóa phổ quát) P (c)for an arbitrary c ∴ ∀xP (x) Universal generalization (Tổng quát hóa phổ quát) ∃xP (x) ∴ P (c)for some element c Existential instantiation (Cụ thể hóa tồn tại) Proof Methods Some problems for discussion 2.24 Rules of Inference for Quantified Statements Logics (cont.) Nguyen An Khuong et. al. Rule of Inference Name Contents Predicate Logic ∀xP (x) ∴ P (c) Universal instantiation (Cụ thể hóa phổ quát) P (c)for an arbitrary c ∴ ∀xP (x) Universal generalization (Tổng quát hóa phổ quát) ∃xP (x) ∴ P (c)for some element c Existential instantiation (Cụ thể hóa tồn tại) P (c)for some element c ∴ ∃xP (x) Existential generalization (Tổng quát hóa tồn tại) Proof Methods Some problems for discussion 2.24 Logics (cont.) Nguyen An Khuong et. al. Example • A student in this class has not gone to class • Everyone in this class passed the first exam Contents • Someone who passed the first exam has not gone to class Some problems for discussion Predicate Logic Proof Methods 2.25 Logics (cont.) Nguyen An Khuong et. al. Example • A student in this class has not gone to class • Everyone in this class passed the first exam Contents • Someone who passed the first exam has not gone to class Some problems for discussion Predicate Logic Proof Methods Hint • C(x): x is in this class • B(x): x has gone to class • P (x): x passed the first exam • Premises??? 2.25 Logics (cont.) Nguyen An Khuong et. al. 1. ∃x(C(x) ∧ ¬B(x)) Premise Contents Predicate Logic Proof Methods Some problems for discussion 2.26 Logics (cont.) Nguyen An Khuong et. al. 1. ∃x(C(x) ∧ ¬B(x)) 2. C(a) ∧ ¬B(a) Premise Existential instantiation from (1) Contents Predicate Logic Proof Methods Some problems for discussion 2.26 Logics (cont.) Nguyen An Khuong et. al. 1. ∃x(C(x) ∧ ¬B(x)) 2. C(a) ∧ ¬B(a) 3. C(a) Premise Existential instantiation from (1) Simplification from (2) Contents Predicate Logic Proof Methods Some problems for discussion 2.26 Logics (cont.) Nguyen An Khuong et. al. 1. 2. 3. 4. ∃x(C(x) ∧ ¬B(x)) C(a) ∧ ¬B(a) C(a) ∀x(C(x) → P (x)) Premise Existential instantiation from (1) Simplification from (2) Premise Contents Predicate Logic Proof Methods Some problems for discussion 2.26 Logics (cont.) Nguyen An Khuong et. al. 1. 2. 3. 4. 5. ∃x(C(x) ∧ ¬B(x)) C(a) ∧ ¬B(a) C(a) ∀x(C(x) → P (x)) C(a) → P (a) Premise Existential instantiation from (1) Simplification from (2) Premise Universal instantiation from (4) Contents Predicate Logic Proof Methods Some problems for discussion 2.26 Logics (cont.) Nguyen An Khuong et. al. 1. 2. 3. 4. 5. 6. ∃x(C(x) ∧ ¬B(x)) C(a) ∧ ¬B(a) C(a) ∀x(C(x) → P (x)) C(a) → P (a) P (a) Premise Existential instantiation from (1) Simplification from (2) Premise Universal instantiation from (4) Modus ponens from (3) and (5) Contents Predicate Logic Proof Methods Some problems for discussion 2.26 Logics (cont.) Nguyen An Khuong et. al. 1. 2. 3. 4. 5. 6. 7. ∃x(C(x) ∧ ¬B(x)) C(a) ∧ ¬B(a) C(a) ∀x(C(x) → P (x)) C(a) → P (a) P (a) ¬B(a) Premise Existential instantiation from (1) Simplification from (2) Premise Universal instantiation from (4) Modus ponens from (3) and (5) Simplification from (2) Contents Predicate Logic Proof Methods Some problems for discussion 2.26 Logics (cont.) Nguyen An Khuong et. al. 1. 2. 3. 4. 5. 6. 7. 8. ∃x(C(x) ∧ ¬B(x)) C(a) ∧ ¬B(a) C(a) ∀x(C(x) → P (x)) C(a) → P (a) P (a) ¬B(a) P (a) ∧ ¬B(a) Premise Existential instantiation from (1) Simplification from (2) Premise Universal instantiation from (4) Modus ponens from (3) and (5) Simplification from (2) Conjunction from (6) and (7) Contents Predicate Logic Proof Methods Some problems for discussion 2.26 Logics (cont.) Nguyen An Khuong et. al. 1. 2. 3. 4. 5. 6. 7. 8. 9. ∃x(C(x) ∧ ¬B(x)) C(a) ∧ ¬B(a) C(a) ∀x(C(x) → P (x)) C(a) → P (a) P (a) ¬B(a) P (a) ∧ ¬B(a) ∃x(P (x) ∧ ¬B(x)) Premise Existential instantiation from (1) Simplification from (2) Premise Universal instantiation from (4) Modus ponens from (3) and (5) Simplification from (2) Conjunction from (6) and (7) Existential generalization from (8) Contents Predicate Logic Proof Methods Some problems for discussion 2.26 Introduction Logics (cont.) Nguyen An Khuong et. al. Contents Predicate Logic Proof Methods Definition Some problems for discussion A proof is a sequence of logical deductions from - axioms, and - previously proved theorems that concludes with a new theorem. 2.27 Terminology Logics (cont.) Nguyen An Khuong et. al. Contents Predicate Logic Proof Methods Some problems for discussion • Theorem (định lý ) = a statement that can be shown to be true • Axiom (tiên đề ) = a statement we assume to be true • Hypothesis (giả thiết) = the premises of the theorem 2.28 Logics (cont.) Nguyen An Khuong et. al. Contents Predicate Logic Proof Methods Some problems for discussion • Lemma (bổ đề ) = less important theorem that is helpful in the proofs of other results • Corollary (hệ quả ) = a theorem that can be established directly from a proved theorem • Conjecture (phỏng đoán) = statement being proposed to be true, when it is proved, it becomes theorem 2.29 Proving a Theorem Logics (cont.) Nguyen An Khuong et. al. Contents Predicate Logic Many theorem has the form ∀xP (x) → Q(x) Goal: • Show that P (c) → Q(c) is true with arbitrary c of the domain Proof Methods Some problems for discussion 2.30 Proving a Theorem Logics (cont.) Nguyen An Khuong et. al. Contents Predicate Logic Many theorem has the form ∀xP (x) → Q(x) Goal: • Show that P (c) → Q(c) is true with arbitrary c of the domain • Apply universal generalization Proof Methods Some problems for discussion 2.30 Proving a Theorem Logics (cont.) Nguyen An Khuong et. al. Contents Predicate Logic Many theorem has the form ∀xP (x) → Q(x) Goal: • Show that P (c) → Q(c) is true with arbitrary c of the domain • Apply universal generalization Proof Methods Some problems for discussion 2.30 Proving a Theorem Logics (cont.) Nguyen An Khuong et. al. Contents Predicate Logic Many theorem has the form ∀xP (x) → Q(x) Goal: • Show that P (c) → Q(c) is true with arbitrary c of the domain • Apply universal generalization Proof Methods Some problems for discussion ⇒ How to show that conditional statement p → q is true. 2.30 Methods of Proof Logics (cont.) Nguyen An Khuong et. al. Contents Predicate Logic Proof Methods • Direct proofs (chứng minh trực tiếp) • Proof by contraposition (chứng minh phản đảo) • Proof by contradiction (chứng minh phản chứng ) Some problems for discussion • Mathematical induction (quy nạp toán học) 2.31 Direct Proofs Logics (cont.) Nguyen An Khuong et. al. Contents Definition A direct proof shows that p → q is true by showing that if p is true, then q must also be true. Predicate Logic Proof Methods Some problems for discussion 2.32 Direct Proofs Logics (cont.) Nguyen An Khuong et. al. Contents Definition A direct proof shows that p → q is true by showing that if p is true, then q must also be true. Predicate Logic Proof Methods Some problems for discussion Example Ex.: If n is an odd integer, then n2 is odd. Pr.: Assume that n is odd. By the definition, n = 2k + 1, k ∈ Z. n2 = (2k + 1)2 = 4k 2 + 4k + 1 = 2(2k 2 + 2k) + 1 is an odd number. 2.32 Proof by Contraposition Logics (cont.) Nguyen An Khuong et. al. Definition p → q can be proved by showing (directly) that its contrapositive, ¬q → ¬p, is true. Contents Predicate Logic Proof Methods Some problems for discussion 2.33 Proof by Contraposition Logics (cont.) Nguyen An Khuong et. al. Definition p → q can be proved by showing (directly) that its contrapositive, ¬q → ¬p, is true. Contents Predicate Logic Proof Methods Some problems for discussion Example Ex.: If n is an integer and 3n + 2 is odd, then n is odd. 2.33 Proof by Contraposition Logics (cont.) Nguyen An Khuong et. al. Definition p → q can be proved by showing (directly) that its contrapositive, ¬q → ¬p, is true. Contents Predicate Logic Proof Methods Some problems for discussion Example Ex.: If n is an integer and 3n + 2 is odd, then n is odd. Pr.: Assume that “If 3n + 2 is odd, then n is odd” is false; or n is even, so n = 2k, k ∈ Z. Substituting 3n + 2 = 3(2k) + 2 = 6k + 2 = 2(3k + 1) is even. Because the negation of the conclusion of the conditional statement implies that the hypothesis is false, Q.E.D. 2.33 Proofs by Contradiction Logics (cont.) Nguyen An Khuong et. al. Definition p is true if if can show that ¬p → (r ∧ ¬r) is true for some proposition r. Contents Predicate Logic Proof Methods Some problems for discussion 2.34 Proofs by Contradiction Logics (cont.) Nguyen An Khuong et. al. Definition p is true if if can show that ¬p → (r ∧ ¬r) is true for some proposition r. Predicate Logic Proof Methods Some problems for discussion Example Ex.: Prove that Contents √ 2 is irrational. 2.34 Proofs by Contradiction Logics (cont.) Nguyen An Khuong et. al. Definition p is true if if can show that ¬p → (r ∧ ¬r) is true for some proposition r. Predicate Logic Proof Methods Some problems for discussion Example Ex.: Prove that Contents √ 2 is irrational. √ Pr.: Let p is the proposition “ 2 is irrational”. Suppose ¬p is true, √ √ which means 2 is rational. If so, ∃a, b ∈ Z, 2 = a/b, a, b have no common factors. Squared, 2 = a2 /b2 , 2b2 = a2 , so a2 is even, and a is even, too. Because of that a = 2c, c ∈ Z. Thus, 2b2 = 4c2 , or b2 = 2c2 , which means b2 is even and so is b. That means 2 divides both a and b, contradict with the assumption. 2.34 Problem Logics (cont.) Nguyen An Khuong et. al. Contents Predicate Logic Proof Methods Some problems for discussion Assume that we have an infinite domino string, we want to know whether every dominoes will fall, if we only know two things: 1 We can push the first domino to fall 2 If a domino falls, the next one will be fall 2.35 Problem Logics (cont.) Nguyen An Khuong et. al. Contents Predicate Logic Proof Methods Some problems for discussion Assume that we have an infinite domino string, we want to know whether every dominoes will fall, if we only know two things: 1 We can push the first domino to fall 2 If a domino falls, the next one will be fall We can! Mathematical induction. 2.35 Mathematical Induction Logics (cont.) Nguyen An Khuong et. al. Definition (Induction) To prove that P (n) is true for all positive integers n, where P (n) is a propositional function, we complete two steps: • Basis Step: Verify that P (1) is true. Contents Predicate Logic Proof Methods Some problems for discussion • Inductive Step: Show that the conditional statement P (k) → P (k + 1) is true for all positive integers k Logic form: [P (1) ∧ ∀kP (k) → P (k + 1))] → ∀nP (n) 2.36 Mathematical Induction Logics (cont.) Nguyen An Khuong et. al. Definition (Induction) To prove that P (n) is true for all positive integers n, where P (n) is a propositional function, we complete two steps: • Basis Step: Verify that P (1) is true. Contents Predicate Logic Proof Methods Some problems for discussion • Inductive Step: Show that the conditional statement P (k) → P (k + 1) is true for all positive integers k Logic form: [P (1) ∧ ∀kP (k) → P (k + 1))] → ∀nP (n) What is P (n) in domino string case? 2.36 Logics (cont.) Example on Induction Nguyen An Khuong et. al. Example Show that if n is a positive integer, then 1 + 2 + ... + n = n(n + 1) . 2 Contents Predicate Logic Proof Methods Some problems for discussion 2.37 Logics (cont.) Example on Induction Nguyen An Khuong et. al. Example Show that if n is a positive integer, then 1 + 2 + ... + n = n(n + 1) . 2 Contents Predicate Logic Proof Methods Some problems for discussion Solution Let P (n) be the proposition that sum of first n is n(n + 1)/2 • Basis Step: P (1) is true, because 1 = 1(1+1) 2 2.37 Logics (cont.) Example on Induction Nguyen An Khuong et. al. Example Show that if n is a positive integer, then 1 + 2 + ... + n = n(n + 1) . 2 Contents Predicate Logic Proof Methods Some problems for discussion Solution Let P (n) be the proposition that sum of first n is n(n + 1)/2 • Basis Step: P (1) is true, because 1 = • Inductive Step: Assume that 1 + 2 + . . . + k = Then: 1(1+1) 2 k(k+1) . 2 1 + 2 + . . . + k + (k + 1) = = = k(k + 1) + (k + 1) 2 k(k + 1) + 2(k + 1) 2 (k + 1)(k + 2) 2 shows that P (k + 1) is true under the assumption that P (k) is true. 2.37 Example on Induction Logics (cont.) Nguyen An Khuong et. al. Example Prove that n < 2n for all positive integers n. Contents Predicate Logic Proof Methods Some problems for discussion 2.38 Example on Induction Logics (cont.) Nguyen An Khuong et. al. Example Prove that n < 2n for all positive integers n. Contents Predicate Logic Solution Let P (n) be the proposition that n > 2n . • Basis Step: P (1) is true, because 1 > 21 = 2 Proof Methods Some problems for discussion 2.38 Example on Induction Logics (cont.) Nguyen An Khuong et. al. Example Prove that n < 2n for all positive integers n. Contents Predicate Logic Proof Methods Solution Let P (n) be the proposition that n > 2n . • Basis Step: P (1) is true, because 1 > 21 = 2 • Inductive Step: Assume that P (k) is true for the positive k, that is, k < 2k . Add 1 to both side of k < 2k , note that 1 ≤ 2k . Some problems for discussion k + 1 < 2k + 1 ≤ 2k + 2k = 2 · 2k = 2k+1 . shows that P (k + 1) is true, namely, that k + 1 < 2k+1 , based on the assumption that P (k) is true. 2.38 On drinking in pubs Logics (cont.) Nguyen An Khuong et. al. The drinker’s paradox In every non-empty pub there is somebody such that if he (or she) drinks then everybody drinks. Contents Predicate Logic Proof Methods Some problems for discussion 2.39 On drinking in pubs Logics (cont.) Nguyen An Khuong et. al. The drinker’s paradox In every non-empty pub there is somebody such that if he (or she) drinks then everybody drinks. • Is this true? Contents Predicate Logic Proof Methods Some problems for discussion 2.39 On drinking in pubs Logics (cont.) Nguyen An Khuong et. al. The drinker’s paradox In every non-empty pub there is somebody such that if he (or she) drinks then everybody drinks. • Is this true? • Or more precisely: Is this a tautology in classical predicate logic? Contents Predicate Logic Proof Methods Some problems for discussion 2.39 On drinking in pubs Logics (cont.) Nguyen An Khuong et. al. The drinker’s paradox In every non-empty pub there is somebody such that if he (or she) drinks then everybody drinks. • Is this true? • Or more precisely: Is this a tautology in classical predicate logic? • I.e. is it true independent of the domain (here pubs, people) and the meanings of pub and to drink? Contents Predicate Logic Proof Methods Some problems for discussion 2.39 On drinking in pubs Logics (cont.) Nguyen An Khuong et. al. The drinker’s paradox In every non-empty pub there is somebody such that if he (or she) drinks then everybody drinks. • Is this true? • Or more precisely: Is this a tautology in classical predicate logic? • I.e. is it true independent of the domain (here pubs, people) and the meanings of pub and to drink? Contents Predicate Logic Proof Methods Some problems for discussion 2.39 On drinking in pubs Logics (cont.) Nguyen An Khuong et. al. The drinker’s paradox In every non-empty pub there is somebody such that if he (or she) drinks then everybody drinks. • Is this true? • Or more precisely: Is this a tautology in classical predicate logic? • I.e. is it true independent of the domain (here pubs, people) and the meanings of pub and to drink? • Predicate formula: Contents Predicate Logic Proof Methods Some problems for discussion 2.39 On drinking in pubs Logics (cont.) Nguyen An Khuong et. al. The drinker’s paradox In every non-empty pub there is somebody such that if he (or she) drinks then everybody drinks. • Is this true? • Or more precisely: Is this a tautology in classical predicate logic? • I.e. is it true independent of the domain (here pubs, people) and the meanings of pub and to drink? • Predicate formula: Contents Predicate Logic Proof Methods Some problems for discussion ∃x ∈ P, [D(x) −→ ∀y ∈ P, D(y)]. 2.39 On drinking in pubs Logics (cont.) Nguyen An Khuong et. al. The drinker’s paradox In every non-empty pub there is somebody such that if he (or she) drinks then everybody drinks. • Is this true? • Or more precisely: Is this a tautology in classical predicate logic? • I.e. is it true independent of the domain (here pubs, people) and the meanings of pub and to drink? • Predicate formula: Contents Predicate Logic Proof Methods Some problems for discussion ∃x ∈ P, [D(x) −→ ∀y ∈ P, D(y)]. • Law of excluded middle (LEM): p ∨ ¬p is a tautology. 2.39 Some MCQs Logics (cont.) Nguyen An Khuong et. al. Contents Predicate Logic MCQ1 Proof Methods Which of the following has truth value T ? Some problems for discussion 2.40 Some MCQs Logics (cont.) Nguyen An Khuong et. al. Contents Predicate Logic MCQ1 Proof Methods Which of the following has truth value T ? Some problems for discussion A. ∀x ∈ R, (x > 1 −→ x2 − 3x + 2 > 0). 2.40 Some MCQs Logics (cont.) Nguyen An Khuong et. al. Contents Predicate Logic MCQ1 Proof Methods Which of the following has truth value T ? Some problems for discussion A. ∀x ∈ R, (x > 1 −→ x2 − 3x + 2 > 0). B. ∃x ∈ Q, (x2 = 2015). 2.40 Some MCQs Logics (cont.) Nguyen An Khuong et. al. Contents Predicate Logic MCQ1 Proof Methods Which of the following has truth value T ? Some problems for discussion A. ∀x ∈ R, (x > 1 −→ x2 − 3x + 2 > 0). B. ∃x ∈ Q, (x2 = 2015). C. ∃x ∈ R, (x > 2 −→ x2 − 3x + 2 < 0). 2.40 Some MCQs Logics (cont.) Nguyen An Khuong et. al. Contents Predicate Logic MCQ1 Proof Methods Which of the following has truth value T ? Some problems for discussion A. ∀x ∈ R, (x > 1 −→ x2 − 3x + 2 > 0). B. ∃x ∈ Q, (x2 = 2015). C. ∃x ∈ R, (x > 2 −→ x2 − 3x + 2 < 0). D. ∃x ∈ R, (x2 − x = −1). 2.40 Some MCQs (cont’d) Logics (cont.) Nguyen An Khuong et. al. MCQ2 Giả sử D(x, y) là một vị từ với ý nghĩa “số nguyên y là một ước của số nguyên x.” Phát biểu nào dưới đây tương đương diễn đạt ý nghĩa của công thức ∀x, y(D(x, y) −→ ∃z(D(x, z) ∧ D(y, z)))? Contents Predicate Logic Proof Methods Some problems for discussion 2.41 Some MCQs (cont’d) Logics (cont.) Nguyen An Khuong et. al. MCQ2 Giả sử D(x, y) là một vị từ với ý nghĩa “số nguyên y là một ước của số nguyên x.” Phát biểu nào dưới đây tương đương diễn đạt ý nghĩa của công thức ∀x, y(D(x, y) −→ ∃z(D(x, z) ∧ D(y, z)))? Contents Predicate Logic Proof Methods Some problems for discussion A. Mọi cặp số tự nhiên (x, y) đều có ít nhất một ước chung. 2.41 Some MCQs (cont’d) Logics (cont.) Nguyen An Khuong et. al. MCQ2 Giả sử D(x, y) là một vị từ với ý nghĩa “số nguyên y là một ước của số nguyên x.” Phát biểu nào dưới đây tương đương diễn đạt ý nghĩa của công thức ∀x, y(D(x, y) −→ ∃z(D(x, z) ∧ D(y, z)))? Contents Predicate Logic Proof Methods Some problems for discussion A. Mọi cặp số tự nhiên (x, y) đều có ít nhất một ước chung. B. Nếu y là một ước của x và z là một ước của y thì z cũng là ước của x. 2.41 Some MCQs (cont’d) Logics (cont.) Nguyen An Khuong et. al. MCQ2 Giả sử D(x, y) là một vị từ với ý nghĩa “số nguyên y là một ước của số nguyên x.” Phát biểu nào dưới đây tương đương diễn đạt ý nghĩa của công thức ∀x, y(D(x, y) −→ ∃z(D(x, z) ∧ D(y, z)))? Contents Predicate Logic Proof Methods Some problems for discussion A. Mọi cặp số tự nhiên (x, y) đều có ít nhất một ước chung. B. Nếu y là một ước của x và z là một ước của y thì z cũng là ước của x. C. Nếu y không phải là ước của x thì chúng không có ước chung. 2.41 Some MCQs (cont’d) Logics (cont.) Nguyen An Khuong et. al. MCQ2 Giả sử D(x, y) là một vị từ với ý nghĩa “số nguyên y là một ước của số nguyên x.” Phát biểu nào dưới đây tương đương diễn đạt ý nghĩa của công thức ∀x, y(D(x, y) −→ ∃z(D(x, z) ∧ D(y, z)))? Contents Predicate Logic Proof Methods Some problems for discussion A. Mọi cặp số tự nhiên (x, y) đều có ít nhất một ước chung. B. Nếu y là một ước của x và z là một ước của y thì z cũng là ước của x. C. Nếu y không phải là ước của x thì chúng không có ước chung. D. Nếu x và y không có ước chung thì y không phải là một ước của x. 2.41 Some MCQs (cont’d) Logics (cont.) Nguyen An Khuong et. al. Contents MCQ3 Which of the following are semantically and syntactically correct translations of “No dog bites a child of its owner”? Predicate Logic Proof Methods Some problems for discussion 2.42 Some MCQs (cont’d) Logics (cont.) Nguyen An Khuong et. al. Contents MCQ3 Which of the following are semantically and syntactically correct translations of “No dog bites a child of its owner”? Predicate Logic Proof Methods Some problems for discussion A. ∀xDog(x) −→ ¬Bites(x, Child(Owner(x))). 2.42 Some MCQs (cont’d) Logics (cont.) Nguyen An Khuong et. al. Contents MCQ3 Which of the following are semantically and syntactically correct translations of “No dog bites a child of its owner”? Predicate Logic Proof Methods Some problems for discussion A. ∀xDog(x) −→ ¬Bites(x, Child(Owner(x))). B. ¬∃x, ∃yDog(x) ∧ Child(y, Owner(x)) ∧ Bites(x, y). 2.42 Some MCQs (cont’d) Logics (cont.) Nguyen An Khuong et. al. Contents MCQ3 Which of the following are semantically and syntactically correct translations of “No dog bites a child of its owner”? Predicate Logic Proof Methods Some problems for discussion A. ∀xDog(x) −→ ¬Bites(x, Child(Owner(x))). B. ¬∃x, ∃yDog(x) ∧ Child(y, Owner(x)) ∧ Bites(x, y). C. ∀xDog(x) −→ (∀yChild(y, Owner(x)) −→ ¬Bites(x, y)). 2.42 Some MCQs (cont’d) Logics (cont.) Nguyen An Khuong et. al. Contents MCQ3 Which of the following are semantically and syntactically correct translations of “No dog bites a child of its owner”? Predicate Logic Proof Methods Some problems for discussion A. ∀xDog(x) −→ ¬Bites(x, Child(Owner(x))). B. ¬∃x, ∃yDog(x) ∧ Child(y, Owner(x)) ∧ Bites(x, y). C. ∀xDog(x) −→ (∀yChild(y, Owner(x)) −→ ¬Bites(x, y)). D. ¬∃xDog(x) −→ (∃yChild(y, Owner(x)) ∧ Bites(x, y)). 2.42 Convert Codes to English and Predicate Formula Logics (cont.) Nguyen An Khuong et. al. Example Contents for (i=0; i<numObjects; i++) { Object x = Objects(i); if isMushroom(i) if isPoisonous(x) && isPurple(x) return false; } return true; Predicate Logic Proof Methods Some problems for discussion 2.43 Convert Codes to English and Predicate Formula Logics (cont.) Nguyen An Khuong et. al. Example Contents for (i=0; i<numObjects; i++) { Object x = Objects(i); if isMushroom(i) if isPoisonous(x) && isPurple(x) return false; } return true; Predicate Logic Proof Methods Some problems for discussion • There are no mushrooms that are poisonous and purple. 2.43 Convert Codes to English and Predicate Formula Logics (cont.) Nguyen An Khuong et. al. Example Contents for (i=0; i<numObjects; i++) { Object x = Objects(i); if isMushroom(i) if isPoisonous(x) && isPurple(x) return false; } return true; Predicate Logic Proof Methods Some problems for discussion • There are no mushrooms that are poisonous and purple. • ∀xM ushroom(x) −→ ¬(P oisonous(x) ∧ P urple(x)). 2.43 Convert Codes to English and Predicate Formula (cont’d) Logics (cont.) Nguyen An Khuong et. al. Contents Example Predicate Logic Proof Methods for (i=0; i<numObjects; i++) { Object x = Objects(i); if isMushroom(i) && isPoisonous(x) && isPurple(x) return true; } return false; Some problems for discussion 2.44