Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống
1
/ 38 trang
THÔNG TIN TÀI LIỆU
Thông tin cơ bản
Định dạng
Số trang
38
Dung lượng
395,49 KB
Nội dung
Logics (cont.) Huynh Tuong Nguyen, Tran Huong Lan Chapter Logics (cont.) Discrete Structures for Computing on 08 March 2011 Huynh Tuong Nguyen, Tran Huong Lan Faculty of Computer Science and Engineering University of Technology - VNUHCM 2.1 Contents Logics (cont.) Huynh Tuong Nguyen, Tran Huong Lan 2.2 Limits of Propositional Logic Logics (cont.) Huynh Tuong Nguyen, Tran Huong Lan • x>3 • All square numbers are not prime numbers 100 is a square number Therefore 100 is not a prime number 2.3 Predicates Logics (cont.) Huynh Tuong Nguyen, Tran Huong Lan 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 đề ) Example: • x > (predicate) • > (proposition) • > (proposition) 2.4 Predicates Logics (cont.) Huynh Tuong Nguyen, Tran Huong Lan • x > → P (x) • > → P (5) • A predicate with n variables P (x1 , x2 , , xn ) 2.5 Truth value Logics (cont.) Huynh Tuong Nguyen, Tran Huong Lan • x > is true or false? • 5>3 • For every number x, x > holds • There is a number x such that x > 2.6 Quantifiers Logics (cont.) Huynh Tuong Nguyen, Tran Huong Lan • ∀: Universal – Với • ∀xP (x) = P (x) is T for all x • ∃: Existential – Tồn • ∃xP (x) = There exists an element x such that P (x) is T • We need a domain of discourse for variable 2.7 Logics (cont.) Huynh Tuong Nguyen, Tran Huong Lan 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) = < is false • ⇒ ∀xP (x) is false • 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.8 Logics (cont.) Huynh Tuong Nguyen, Tran Huong Lan Example Express the statement “Some student in this class comes from Central Vietnam.” Solution • M (x) = x comes from Central Vietnam • Domain for x is the students in the class • ∃xM (x) Solution • Domain for x is all people • 2.9 Logics (cont.) Negation of Quantifiers Huynh Tuong Nguyen, Tran Huong Lan Statement Negation Equivalent form ∀xP (x) ¬(∀xP (x)) ∃x¬P (x) ∃xP (x) ¬(∃xP (x)) ∀x¬P (x) Example • All CSE students study Discrete Math • 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 2.10 Rules of Inference for Quantified Statements Logics (cont.) Huynh Tuong Nguyen, Tran Huong Lan Rule of Inference Name ∀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) 2.24 Logics (cont.) Huynh Tuong Nguyen, Tran Huong Lan Example • A student in this class has not gone to class • Everyone in this class passed the first exam • Someone who passed the first exam has not gone to class 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.) Huynh Tuong Nguyen, Tran Huong Lan ∃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) 2.26 Introduction Logics (cont.) Huynh Tuong Nguyen, Tran Huong Lan Definition 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.) Huynh Tuong Nguyen, Tran Huong Lan • 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.) Huynh Tuong Nguyen, Tran Huong Lan • Lemma (bổ đề ) = less important theorem that is helpful in the proofs of other results • Corollary (hệ ) = 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.) Huynh Tuong Nguyen, Tran Huong Lan 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 ⇒ How to show that conditional statement p → q is true 2.30 Methods of Proof Logics (cont.) Huynh Tuong Nguyen, Tran Huong Lan • 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 ) • Mathematical induction (quy nạp toán học) 2.31 Direct Proofs Logics (cont.) Huynh Tuong Nguyen, Tran Huong Lan Definition A direct proof shows that p → q is true by showing that if p is true, then q must also be true 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 + 4k + = 2(2k + 2k) + is an odd number 2.32 Proof by Contraposition Logics (cont.) Huynh Tuong Nguyen, Tran Huong Lan Definition p → q can be proved by showing (directly) that its contrapositive, ¬q → ¬p, is true Example Ex.: If n is an integer and 3n + is odd, then n is odd Pr.: Assume that “If 3n + is odd, then n is odd” is false; or n is even, so n = 2k, k ∈ Z Substituting 3n + = 3(2k) + = 6k + = 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.) Huynh Tuong Nguyen, Tran Huong Lan Definition p is true if if can show that ¬p → (r ∧ ¬r) is true for some proposition r Example √ Ex.: Prove that is irrational √ Pr.: Let p is the proposition “ is irrational” Suppose ¬p is true, √ √ which means is rational If so, ∃a, b ∈ Z, = a/b, a, b have no common factors Squared, = 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 divides both a and b, contradict with the assumption 2.34 Problem Logics (cont.) Huynh Tuong Nguyen, Tran Huong Lan Assume that we have an infinite domino string, we want to know whether every dominoes will fall, if we only know two things: We can push the first domino to fall If a domino falls, the next one will be fall We can! Mathematical induction 2.35 Mathematical Induction Logics (cont.) Huynh Tuong Nguyen, Tran Huong Lan 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 • 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 Huynh Tuong Nguyen, Tran Huong Lan Example Show that if n is a positive integer, then + + + n = n(n + 1) Solution Let P (n) be the proposition that sum of first n is n(n + 1)/2 • Basis Step: P (1) is true, because = • Inductive Step: Assume that + + + k = Then: 1(1+1) k(k+1) + + + k + (k + 1) = = = k(k + 1) + (k + 1) k(k + 1) + 2(k + 1) (k + 1)(k + 2) shows that P (k + 1) is true under the assumption that P (k) is true 2.37 Example on Induction Logics (cont.) Huynh Tuong Nguyen, Tran Huong Lan Example Prove that n < 2n for all positive integers n Solution Let P (n) be the proposition that n > 2n • Basis Step: P (1) is true, because > 21 = • Inductive Step: Assume that P (k) is true for the positive k, that is, k < 2k Add to both side of k < 2k , note that ≤ 2k k + < 2k + ≤ 2k + 2k = · 2k = 2k+1 shows that P (k + 1) is true, namely, that k + < 2k+1 , based on the assumption that P (k) is true 2.38 [...]... from (8) 2.26 Introduction Logics (cont.) Huynh Tuong Nguyen, Tran Huong Lan Definition 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.) Huynh Tuong Nguyen, Tran Huong Lan • Theorem (định lý ) = a statement that can be shown to be true • Axiom (tiên đề ) = a statement we assume to be true • Hypothesis ... sequence of logical deductions from - axioms, and - previously proved theorems that concludes with a new theorem 2.27 Terminology Logics (cont.) Huynh Tuong Nguyen, Tran Huong Lan • Theorem (định lý