Chapter 1: Mathematical Logic and Proofs PDF
Document Details
Uploaded by FastPacedThunderstorm
المعهد العالي لعلوم حاسب ونظم المعلومات التجمع الخامس
Tags
Summary
This document provides an introduction to mathematical logic, focusing on propositional logic. It defines propositions, truth tables, and different connectives such as negation, conjunction, disjunction, implication, and biconditional. The document also presents examples and truth tables for each connective.
Full Transcript
Chapter (1) Mathematical Logic and Proofs (1) Propositional Logic Propositions: A proposition is a declarative sentence that is either true or false. Examples of propositions: a) The Moon is made of green cheese. b) Trenton is the capital of Ne...
Chapter (1) Mathematical Logic and Proofs (1) Propositional Logic Propositions: A proposition is a declarative sentence that is either true or false. Examples of propositions: a) The Moon is made of green cheese. b) Trenton is the capital of New Jersey. c) Toronto is the capital of Canada. d) 1 + 0 = 1 e) 0 + 0 = 2 Examples that are not propositions. a) Sit down! b) What time is it? c) x + 1 = 2 x+y=z Constructing Propositions Propositional Variables: p, q, r, s, … The proposition that is always true is denoted by T and the proposition that is always false is denoted by F. (2) Compound Propositions; constructed from logical connectives and other propositions Negation ¬ Conjunction ∧ Disjunction ∨ Implication → Biconditional ↔ Compound Propositions: Negation The negation of a proposition p is denoted by ¬p and has this truth table: p ¬p T F F T Example: If p denotes “The earth is round.”, then ¬p denotes “It is not the case that the earth is round,” or more simply “The earth is not round.” (3) Conjunction The conjunction of propositions p and q is denoted by p ∧ q and has this truth table: p q P∧q T T T T F F F T F F F F Example: If p denotes “I am at home.” and q denotes “It is raining.” then p ∧ q denotes “I am at home and it is raining.” Disjunction The disjunction of propositions p and q is denoted by p ∨ q and has this truth table: p q P∨q T T T T F T F T T F F F (4) Example: If p denotes “I am at home.” and q denotes “It is raining.” then p ∨ q denotes “I am at home or it is raining.” p q P⊕q T T F T F T F T T F F F Implication If p and q are propositions, then p → q is a conditional statement or implication which is read as “if p, then q” and has this truth table: (5) p q P→q T T T T F F F T T F F T Example: If p denotes “I am at home.” and q denotes “It is raining.” then p → q denotes “If I am at home then it is raining.” In p → q, p is the hypothesis (antecedent or premise) and q is the conclusion (or consequence). (6) (7) Biconditional If p and q are propositions, then we can form the biconditional proposition p ↔ q, read as “p if and only if q.” The biconditional p ↔ q denotes the proposition with this truth table: p q P↔q T T T T F F F T F F F T (8) If p denotes “I am at home.” and q denotes “It is raining.” then p ↔ q denotes “I am at home if and only if it is raining.” (9) p q r ¬r p∨q p ∨ q → ¬r T T T F T F T T F T T T T F T F T F T F F T T T F T T F T F F T F T T T F F T F F T F F F T F T (10) p q ¬p ¬q p→q ¬q → ¬p T T F F T T T F F T F F F T T F T T F F T T T T (11) p q ¬p ¬q p→q ¬p → ¬q q→p T T F F T T T T F F T F T T F T T F T F F F F T T T T T Precedence of Logical Operators Operator Precedence ¬ 1 ∧ 2 ∨ 3 → 4 ↔ 5 (12) (13) (14) (15) (16) Propositional Equivalences P ¬p p ∨ ¬p p ∧ ¬p T F T F F T T F (17) p q ¬p ¬p ∨ q p→q T T F T T T F F F F F T T T T F F T T T p q ¬p ¬q (p ∨ q) ¬(p ∨ q) ¬p ∧ ¬q T T F F T F F T F F T T F F F T T F T F F F F T T F T T (18) (19) (20) (21) (22) Problems (23) Predicates and Quantifiers Propositional Logic Not Enough If we have: “All men are mortal.” “Socrates is a man.” Does it follow that “Socrates is mortal?” Can’t be represented in propositional logic. Need a language that talks about objects, their properties, and their relations. Later we’ll see how to draw inferences. Introducing Predicate Logic Predicate logic uses the following new features: Variables: x, y, z Predicates: P(x), M(x) Quantifiers (to be covered in a few slides): Propositional functions are a generalization of propositions. They contain variables and a predicate, e.g., P(x) Variables can be replaced by elements from their domain. Propositional Functions Propositional functions become propositions (and have truth values) when their variables are each replaced by a value from the domain (or bound by a quantifier, as we will see later). (24) The statement P(x) is said to be the value of the propositional function P at x. For example, let P(x) denote “x > 0” and the domain be the integers. Then: P(-3) is false. P(0) is false. P(3) is true. Often the domain is denoted by U. So in this example U is the integers. Examples of Propositional Functions Let “x + y = z” be denoted by R(x, y, z) and U (for all three variables) be the integers. Find these truth values: R(2,-1,5) Solution: F R(3,4,7) Solution: T R(x, 3, z) Solution: Not a Proposition Now let “x - y = z” be denoted by Q(x, y, z), with U as the integers. Find these truth values: Q(2,-1,3) Solution: T Q(3,4,7) Solution: F Q(x, 3, z) Solution: Not a Proposition (25) Compound Expressions Connectives from propositional logic carry over to predicate logic. If P(x) denotes “x > 0,” find these truth values: P(3) ∨ P(-1) Solution: T P(3) ∧ P(-1) Solution: F P(3) → P(-1) Solution: F P(3) → ¬P(-1) Solution: T Expressions with variables are not propositions and therefore do not have truth values. For example, P(3) ∧ P(y) P(x) → P(y) When used with quantifiers (to be introduced next), these expressions (propositional functions) become propositions. Quantifiers We need quantifiers to express the meaning of English words including all and some: “All men are Mortal.” “Some cats do not have fur.” The two most important quantifiers are: Universal Quantifier, “For all,” symbol: Existential Quantifier, “There exists,” symbol: We write as in x P(x) and x P(x). x P(x) asserts P(x) is true for every x in the domain. x P(x) asserts P(x) is true for some x in the domain. (26) The quantifiers are said to bind the variable x in these expressions. Universal Quantifier x P(x) is read as “For all x, P(x)” or “For every x, P(x)” Examples: 1) If P(x) denotes “x > 0” and U is the integers, then x P(x) is false. 2) If P(x) denotes “x > 0” and U is the positive integers, then x P(x) is true. If P(x) denotes “x is even” and U is the integers, then x P(x) is false. Existential Quantifier x P(x) is read as “For some x, P(x)”, or as “There is an x such that P(x),” or “For at least one x, P(x).” Examples: 1. If P(x) denotes “x > 0” and U is the integers, then x P(x) is true. It is also true if U is the positive integers. 2. If P(x) denotes “x < 0” and U is the positive integers, then x P(x) is false. 3. If P(x) denotes “x is even” and U is the integers, then x P(x) is true. Uniqueness Quantifier (optional) !x P(x) means that P(x) is true for one and only one x in the universe of discourse. This is commonly expressed in English in the following equivalent ways: “There is a unique x such that P(x).” “There is one and only one x such that P(x)” (27) Examples: 1. If P(x) denotes “x + 1 = 0” and U is the integers, then !x P(x) is true. 2. But if P(x) denotes “x > 0,” then !x P(x) is false. The uniqueness quantifier is not really needed as the restriction that there is a unique x such that P(x) can be expressed as: x (P(x) ∧y (P(y) → y =x) Thinking about Quantifiers When the domain of discourse is finite, we can think of quantification as looping through the elements of the domain. To evaluate x P(x) loop through all x in the domain. If at every step P(x) is true, then x P(x) is true. If at a step P(x) is false, then x P(x) is false and the loop terminates. To evaluate x P(x) loop through all x in the domain. If at some step, P(x) is true, then x P(x) is true and the loop terminates. If the loop ends without finding an x for which P(x) is true, then x P(x) is false. Even if the domains are infinite, we can still think of the quantifiers this fashion, but the loops will not terminate in some cases. (28) Properties of Quantifiers The truth value of x P(x) and x P(x) depend on both the propositional function P(x) and on the domain U. Examples: 1. If U is the positive integers and P(x) is the statement “x < 2”, then x P(x) is true, but x P(x) is false. 2. If U is the negative integers and P(x) is the statement “x < 2”, then both x P(x) and x P(x) are true. 3. If U consists of 3, 4, and 5, and P(x) is the statement “x < 2”, then both x P(x) and x P(x) are true. But if P(x) is the statement “x