580 likes | 993 Views
Discrete Mathematical Structures. 离散数学结构. Bernard Kolman Robert C. Busby Sharon Cutler Ross. 《 离散数学 》 教学组. Chapter 2 Logic. 2.1 Propositions and Logical Operations 2.2 Conditional Statements 2.3 Methods of Proof 2.4 Mathematical Induction. 推理的符号化(形式化) 推理规则举例: 假言推理( modus ponens )
E N D
Discrete MathematicalStructures 离散数学结构 Bernard Kolman Robert C. Busby Sharon Cutler Ross 《离散数学》教学组
中山大学软件学院 Chapter 2 Logic 2.1 Propositions and Logical Operations 2.2 Conditional Statements 2.3 Methods of Proof 2.4 Mathematical Induction
推理的符号化(形式化) 推理规则举例: 假言推理(modus ponens) 如果张三是软院2011级学生,那么离散数学是张三的必修课 张三是软院2011级学生 所以,离散数学是张三的必修课 符号化: p =>q p ------------ q 若 p 则 q p ------------ q
推理规则举例: 三段论(Syllogism) 所有软院2011级学生必修离散数学 张三是软院2011级学生 所以,张三必修离散数学 符号化: x(A(x) -> B(x)) A(a) ------------ B(a)
Gottfried Wilhelm Leibniz’s (July 1, 1646 – November 14, 1716) Symbolic thought: The only way to rectify our reasonings is to make them as tangible as those of the Mathematicians, so that we can find our error at a glance, and when there are disputes among persons, we can simply say: Let us calculate [calculemus], without further ado, to see who is right. It is obvious that if we could find characters or signs suited for expressing all our thoughts as clearly and as exactly as arithmetic expresses numbers or geometry expresses lines, we could do in all matters insofar as they are subject to reasoning all that we can do in arithmetic and geometry. For all investigations which depend on reasoning would be carried out by transposing these characters and by a species of calculus. Formal Logic George Boole (2 November 1815 -8 December 1864 ) invented Boolean Logic. Reasoning in Mathematics
中山大学软件学院 2.1 Propositions and Logical Operations 1) Statement or Proposition A statement or proposition (命题) is a declarative sentence that is either true or false, but not both. Ex. Which of the following are statements? (a) The earth is round. (b) 2 + 3 = 5. (c) Do you speak English? (d) 3 – x = 5 (e) Take two aspirins. (f) The temperature on the surface of the planet Venus (金星) is 800F. (g) The sun will come out tomorrow. Yes Yes No, it is a question. No, it is a declaration sentence, not a statement. No, it is a command. Yes, it is a statement. Yes, it is a statement.
Proposition examples (compound propositions): 2 is an even number and 3 is an odd number. 2 is an even number and 3 is an even number. 2 is an odd number and 3 is an odd number. 2 is an odd number and 3 is an even number. 2 is an odd number and I am a student. Pattern of the proposition: with connective “and” Symbol: /\ (conjunction) Truth of the pattern, or the truth table of “/\”
Compound proposition examples: 2 is an even number or 3 is an odd number. 2 is an even number or 3 is an even number. 2 is an odd number or 3 is an odd number. 2 is an odd number or 3 is an even number. 2 is an odd number or 2 is an even number. Pattern of the proposition: with connective “or” Symbol: \/ (disjunction) Truth of the pattern, or the truth table of “\/”
Compound proposition examples: If I am hungry, then I’ll eat. If it is raining, then 2+3 = 5. If it is raining, then 2+3 = 4. If 2 is an even number, then 3+3 = 4. If 2 is an odd number, then 3 +3 = 4. If 2 is an odd number, then the sun rise on the west. Pattern of the proposition: with connective “if … then …” Symbol: => (implication, antecedent, consequent) Truth of the pattern, or the truth table of “=>”
Compound proposition examples 2 is not an odd number. 2 is not an even number. Pattern of the proposition: with connective “not” Symbol: ~ Truth of the pattern, or the truth table of “~”
Equivalence of propositions p => q and ~p \/ q Bidirectional p < = > q Tautologies Absurdity Videos:Inventing on Principle http://worrydream.com/ABriefRantOnTheFutureOfInteractionDesign/
中山大学软件学院 2.1 Propositions and Logical Operations 2) Proposition variable and Compound statements In Logic, the letters p, q, r, … denote propositionvariable (命题变量), they are replaced by statements. p: The sun is shining today. q: It is cold. Statement or proposition variables can be combined by logical connectives (逻辑联结词) to obtain compound statements(复合命题). Ex. and p and q: The sun is shining today and it is cold.
中山大学软件学院 2.1 Propositions and Logical Operations 3) Negation of statement – 否定命题 If p is a statement, the negation (非) of p is the statement not p, denote by ~p. ~p is the statement “it is not the case that p”. If p is true, ~p is false. If p is false, ~p is true. The truth table(真值表) is a table that shows the truth valuesof a compound statement in terms of its component parts. The truth table p ~p T F F T
中山大学软件学院 2.1 Propositions and Logical Operations 3) Negation of statement not is not a connective, it does not join two statements. notp is not compound statement. not is a unary operation for collection of statements. ~p is statement if p is. Ex. Give the negation of the following statements: (1) p: 2 + 3 > 1. (2) q: it is cold. Solution: (1) ~p: 2 + 3 1. (2) ~q: it is not cold.
中山大学软件学院 2.1 Propositions and Logical Operations 4) Conjunction of statements –合取式 If p and q are statements, the conjunction of p and q is “p and q”, denote by pq. stands for connective and. The compound pq is true if both p and q are true, otherwise, it is false. The truth table of pq pq pq T T T F F T F F T F F F
中山大学软件学院 2.1 Propositions and Logical Operations 4) Conjunction of statements Ex. From the conjunction of p and q for each of the following. (a) p: It is snowing, q: I am cold. (b) p: 2 < 3, q: -5 > -8. (c) p: It is snowing, q: 3 < 5. Solution: (a) pq: it is snowing and I am cold. (b) pq: 2 < 3 and -5 > -8. (c) pq: It is snowing and 3 < 5.
中山大学软件学院 2.1 Propositions and Logical Operations 5) Disjunction of statements – 析取式 If p and q are statements, the disjunction of p and q is “p or q”, denote by pq. denotes the connective or. The compound pq is true if at least one of p or q is true, it is false when both p and q are false. The truth table of pq pq p q T T T F F T F F T T T F
中山大学软件学院 2.1 Propositions and Logical Operations 5) Disjunction of statements Ex. From the disjunction of p and q for each of the following. (a) p: 2 is a positive integer q: 21/2 is a rational number. (b) p: 2 + 3 5 q: London is the capital of France. Solution: (a) pq: 2 is a positive integer or 21/2 is a rational number. p is true, q is false, so pq is true. (b) pq: 2 + 3 5 or London is the capitcal of France. p and q are false, so pq is false.
中山大学软件学院 2.1 Propositions and Logical Operations 6) Compound statement – 复合命题 The compound statement has many component parts, both of component parts are connected by connective. pq(pr) is compound statement and has three compound parts (propositions): p, q and r. pq(pr) = pqr pr q(pr) pq(pr) p q r T T T T T F T F T T F F F T T F T F F F T F F F T T T T T F T F T T F F T F F F T T T T T F F F
中山大学软件学院 2.1 Propositions and Logical Operations 7) The truth table – 真值表 If a compound statement s has n component statements, there will need to be 2n rows in the truth table for s. its truth table may be systematically constructed in the following way. (1). The first n columns of the table are labeled by statements, further columns are included for all intermediate expression, the last column is for the full statement. (2). Under each of the first n headings, we list the 2n possible n-tuples of truth values for the n component statements. (3). For each of the remaining columns, we compute the remaining truth values in sequence.
中山大学软件学院 2.2 Conditional Statements If p and q are statements, the compound statement “if p then q” denoted by pq, is called a conditional statement (条件命题), or implication (蕴涵). To pq, p is called the antecedent (前件) or hypothesis (假设), and q is called the consequent (后件) or conclusion(结论). Ex. Write the implication pq for each of the following. (a) p: I am hungry. q: I will eat. (b) p: It is snowing. q: 3 + 5 = 8 Solution: (a) If I am hungry, then I will eat. (b) If it is snowing, then 3 + 5 = 8.
中山大学软件学院 2.2 Conditional Statements pq: p implies q; q if p; p only if q. p is a sufficient condition for q, q is necessary condition for p. If pq is a implication, the converse (逆命题) of pq is the implication qp, and the contrapositive (逆否命题) of pq is the implication ~q ~p. Ex. Give the converse and contrapositive of the implication “If it is raining, then I get wet.” Solution: p: It is raining;q: I get wet. the converse is qp: If I get wet, then It is raining. the contrapositive is ~q ~p: If I don’t get wet, then it is not raining.
中山大学软件学院 2.2 Conditional Statements If p and q are statements, the compound statement p if and only if q, denoted by pq, is called an equivalence (等价) or biconditional (双条件). The connective if and only if is denoted by the symbol . conditional statement (条件命题), or implication (蕴涵). The truth table of pq is following. pq is true only when both p and q are true or when both p and q are false. The equivalence pq can also be stated as p is a necessary and sufficient condition for q. The truth table of p q p q p q T T T F F T F F T F F T
中山大学软件学院 2.2 Conditional Statements Ex. Compute the truth table of the statement (p q) (~q ~p). Solution: pq p q ~q ~p ~q ~p (p q) (~q ~p) T T T F F T F F T F T T F T F T F F T T T F T T T T T T
中山大学软件学院 2.2 Conditional Statements A statement that is true for all possible values of its propositional variables is called a tautology(重言式/永真式). A statement that is always false is called a contradiction (矛盾/永假式) or an absurdity (谬论). A statement that can be either true or false, depending on the truth values of its propositional variables, is called a contingency (不定式). Ex. (a) (p q) (~q ~p) is a tautology. (b) p ~p is an absurdity. (c) (pq) (pq) is a contingency.
中山大学软件学院 2.2 Conditional Statements If p q is a tautology, p and q are logically equivalent (逻辑等价), or simply equivalent (等价). “p is equivalent to q” is denoted by p q. Ex. p qqp. pq p q qp (p q) (qp) T T T F F T F F T T T F T T TF T T T T The truth table for (p q) (qp) shows the statement is a tautology.
中山大学软件学院 2.2 Conditional Statements Ex. p q is equivalent to (~pq). p q ~p ~p q pq T T T F F T F F T F T T F F T T T F T T Column 1 and 3 in the above table show that for any truth values of p and q, p q and (~pq) have the same truth values.
中山大学软件学院 2.2 Conditional Statements Theorem 1 The operations for propositions have the following properties. (1) Commutative properties p qqp p qqp (2) Associative properties p (q r) (pq) rp (q r) (pq) r (3) Distributive properties p (q r) (pq) (pr) p (q r) (pq) (pr) (4) Idempotent properties p ppp pp (5) PropertiesofNegation ~(~p) p ~(p q) (~p) (~q) ~(p q) (~p) (~q)
中山大学软件学院 2.2 Conditional Statements Theorem 2 (a) (p q) ((~p) q) (b) (p q) (~q ~p) (c) (p q) ((pq) (qp)) (d) ~(p q) (p ~q) (e) ~(p q) ((p ~q) (q ~p))
2.2 Conditional Statements 中山大学软件学院 Theorem 4 Each of the following is a tautology. (a) (pq) p (b) (pq) q (c) p (pq) (d) q (pq) (e) ~p (pq) (f) ~(pq) p (g) (p (pq)) q (h) (~p (pq)) q (i) (~q (pq)) ~p (j) ((pq) (qr)) (pr)
Theorem If A and B are finite sets, then |A∪B|=|A|+|B|-|A∩B|. Implicitly, we are saying that for all sets A and B, if A and B are finite, then |A∪B|=|A|+|B|-|A∩B|. Here we have a predicate P(x): x is a finite set. Formalization of math statements
Theorem Let a, b and c be integers. If a | b and a | c, then a | (b+c). Implicitly, we are saying that for all integers a, b and c If a | b and a | c, then a | (b+c). Here we have a binary predicate (or a relation) R(x,y): x | y.
2.1 Propositions and Logical Operations 中山大学软件学院 8) Quantifiers – 量词 A = { x | P(x) } The set A is the collection that an object t for which P(t) is true. P(x) is called predicate(谓词) or propositional function (命题函数). To each choice of x, P(x) is a proposition that is either true ot false. Ex. A = { x | x is an integer less than 8 }. P(x) is the sentence “x is an integer less than 8”. P(1) and P(2) are true, P(9) is false.
2.1 Propositions and Logical Operations 中山大学软件学院 9) Universal quantification – 全称量化 The universal quantification of a predicate P(x) is the statement “For all values of x, P(x) is true”, it is denoted by xP(x). The symbol is called universal quantifier(全称量词). Ex. P(x): -(-x) = x, x is a real number. xP(x) is true because for all real numbers, -(-x) = x. Q(x): x + 1 = 4. xQ(x) is false because Q(1) is false. 判定xP(x)真假的一般方法: (1) 当要确定xP(x)为“真”时, 则要确定所有P(x)都为“真”; (2) 当要确定xP(x)为“假”时, 只要找一个y, 使得: P(y)为“假”.
2.1 Propositions and Logical Operations 中山大学软件学院 9) Universal quantification A predicate may contain many variables. The universal quantification may be applied to each of the variables. if P(x, y) is a predicate, its universal quantification is xyP(x, y). For example, P(x, y): x + y = y + x xyP(x, y) is true for every x and y. Q(x, y): x ∪ y = y ∪ x xyQ(x, y) is true for any set x and y.
2.1 Propositions and Logical Operations 中山大学软件学院 10) Existentialquantification – 存在量化 The existentialquantification of a predicate P(x) is the statement “There exists a value of x for which P(x) is true”, it is denoted by xP(x). The symbol is called existentialquantifier(存在量词). Ex. P(x): x + 1 < 4, x is a real number. xP(x) is true because P(2) is true. Q(y): y + 2 = y. yQ(y) is false because Q(y) is false for any y. 判定xP(x)真假的一般方法: (1) 当要确定xP(x)为“真”时, 只要找到一个x, 使得: P(x)为“真”; (2) 当要确定xP(x)为“假”时, 则要确定所有的x, 都有: P(x)为“假”.
2.1 Propositions and Logical Operations 中山大学软件学院 10) Existential quantification A predicate may contain many variables. The existentialquantification may be applied to each of the variables. if P(x, y) is a predicate, its existentialquantification is xyP(x, y). Ex. P(x, y): x * y = y + x xyP(x, y) is true because x = 2 and y = 2. Q(x, y): x∩y = x - y xyQ(x, y) is false for any set x and y. x=?
2.1 Propositions and Logical Operations 中山大学软件学院 10) The order of quantifiers The order of same quantifiers is not important, it does n’t affect the truth value. The order of different quantifiers is important, it affects the truth value. Ex. P(x, y): x + y = 0 xyP(x, y) is true, xyP(x, y) is false. Q(x, y): x * y = 0 xyP(x, y) is true, xyP(x, y) is true too. R(x, y): <x, y> E(G), x, y V(G) xyR(x, y) is true, xyR(x, y) is false. v2 v1 v3 v4 图G
2.1 Propositions and Logical Operations 中山大学软件学院 11) Negation of quantifiers Let p: xP(x), what is the negation of p? (~p) ~p: ~xP(x) = x~P(x). Let q: xQ(x), what is the negation of q? (~q) ~q: ~xQ(x) = x~Q(x). 3
中山大学软件学院 2.2 Conditional Statements Theorem 3 (a) ~(xP(x)) x~P(x) (b) ~(xP(x)) x(~P(x)) (c) x(P(x) Q(x)) xP(x) xQ(x) (d) x(P(x) Q(x)) xP(x) xQ(x) (e) x(P(x) Q(x)) xP(x) xQ(x) (f) xP(x) xQ(x) x(P(x) Q(x)) is a tautology (g) x(P(x) Q(x)) xP(x) xQ(x) is a tautology
中山大学软件学院 2.3 Methods of Proof If an implication p q is a tautology, where p and q may be compound statements involving any number of proposition variables, we say that qlogically follows from p. Suppose that an implication of the form (p1p2 … pn) q is a tautology. We say that q logically follows from p1,p2,…, pn, and write p1 p2 ┆ pn q If p1,p2, …, pn are true, we know q is true.
中山大学软件学院 2.3 Methods of Proof (p1p2 … pn) q The pi’s are called the hypotheses (假设) or premises (前提), and q is called the conclusion(结论). To “prove the theorem” means to show that the implica-tion is a tautology. If p1,p2,… and pn are true, q will be true. For this reason, mathematical proofs often begin with the statement “suppose that p1,p2,… and pn are true” and conclude with the statement “therefore, q is true.” The proof does not show that that q is true, but simply shows if the pi are all true, then q has to be true.
Arguments based on tautologies represent universally correct methods of reasoning. The validity only depends on the form of the statements involved and not on the truth values of the variables they contain. Such arguments are called rules of inference. A mathematical proof of a theorem must start with the hypotheses, proceed through various steps, each justified by some rule of reference, and arrive at the conclusion. (see page 63). Methods of Proofs
中山大学软件学院 2.3 Methods of Proof Ex. ((pq) (qr)) (pr) The argument pq qr pr is valid, and so is a rule of inference. Ex. Is the following argument valid? If you invest in the stock market, then you will get rich. If you get rich, then you are happy. If you invest in the stock market, then you are happy. The argument is valid, although the conclusion may be false.
中山大学软件学院 2.3 Methods of Proof A important rule of inference is p pq q That is, p is true and p q is true, so q is true. The rule is called modus ponens (假言推理), or the method of asserting (论断方法).
中山大学软件学院 2.3 Methods of Proof Ex. Is the following argument valid? Smoke is healthy. If Smoke is healthy, then cigarettes are prescribed by physicians. Cigarettes are prescribed by physicians. The argument is valid. However, the conclusion is false. Ex. Is the following argument valid? If taxes are lowered, then income rises. Income rises. Taxes are lowered. Solution: p: taxes are lowered, q: income rises. p q may be true with p being false. Then the conclusion p is false. The argument is not valid. p q q p
中山大学软件学院 2.3 Methods of Proof Ex. Let n be an integer. Prove that if n2 is odd, then n is odd. Proof: p: n2 is odd. q: n is odd. We have to prove that p q is true. Suppose that ~q is true, i.e. n is not odd. Then n = 2k, where k is an integer. n2 = (2k)2 = 4k2 = 2(2k2), so n2 is even. So we have that if n is even, then n2 is even, which is the contrapositive of the given statement. Hence the given statement has been proved.
中山大学软件学院 2.3 Methods of Proof An important indirect proof technique is proof by contradiction(反证法). This method is based on the tautology ((pq) (~q)) ~p Thus the rule of inference is valid. pq ~q ~p Suppose we prove that a statement q logically follows from statements p1,p2, …, pn. If p1p2 … pn (~q) implies a contradiction, then at least one of the statements p1, p2, …, pn, (~q) must be false. If all the pi’s are true, then ~q must be false, so q is true. This is proof by contradiction.
中山大学软件学院 2.3 Methods of Proof Ex. Prove there is no rational number p/q whose square is 2. In other words, show 21/2 is irrational. Proof: Assume (p/q)2 = 2 for some integers p and q, which have no common factors. Then p2 = 2q2, so p2 is even. Since the square of an odd number is odd, so p is even. Suppose that p = 2k for some integer k. 2q2 = (2k)2 = 4k2 q2 = 2k2 Thus, q2 is even, and q is even. Now p and q are even, and have a common factor 2. This is a contradiction to the assumption. Thus the assumption is false.
中山大学软件学院 2.3 Methods of Proof In order to prove a theorem of the form (p1p2 … pn) q, we begin with the hypothesis p1, p2, …, pn and show that some result r1 logically follows. Then, using p1, p2, …, pn, r1, we show that some other statement r2 logically follows. We continue this process, producing intermediate statements r1, r2, …, rk, called steps in the proof, until we can finally show that the conclusion qlogically follows from p1, p2, …, pn, r1, r2, …, rk. Each logical step must be justified by some valid proof technique, based on the rules of inference, or on some other rules that come from tautological implications. 4