Presentation is loading. Please wait.

Presentation is loading. Please wait.

Discrete Mathematical Structures: Theory and Applications 1 Logic: Learning Objectives  Learn about statements (propositions)  Learn how to use logical.

Similar presentations


Presentation on theme: "Discrete Mathematical Structures: Theory and Applications 1 Logic: Learning Objectives  Learn about statements (propositions)  Learn how to use logical."— Presentation transcript:

1 Discrete Mathematical Structures: Theory and Applications 1 Logic: Learning Objectives  Learn about statements (propositions)  Learn how to use logical connectives to combine statements  Explore how to draw conclusions using various argument forms  Become familiar with quantifiers and predicates  CS  Boolean data type  If statement  Impact of negations  Implementation of quantifiers

2 Discrete Mathematical Structures: Theory and Applications 2 Mathematical Logic  Definition: Methods of reasoning, provides rules and techniques to determine whether an argument is valid  Theorem: a statement that can be shown to be true (under certain conditions)  Example: If x is an even integer, then x + 1 is an odd integer  This statement is true under the condition that x is an integer is true

3 Discrete Mathematical Structures: Theory and Applications 3 Mathematical Logic  A statement, or a proposition, is a declarative sentence that is either true or false, but not both  Lowercase letters denote propositions  Examples:  p: 2 is an even number (true)  q: 3 is an odd number (true)  r: A is a consonant (false)  The following are not propositions:  p: My cat is beautiful  q: Are you in charge?

4 Discrete Mathematical Structures: Theory and Applications 4 Mathematical Logic  Truth value  One of the values “truth” or “falsity” assigned to a statement  True is abbreviated to T or 1  False is abbreviated to F or 0  Negation  The negation of p, written ∼ p, is the statement obtained by negating statement p  Truth values of p and ∼ p are opposite  Symbol ~ is called “not” ~p is read as as “not p”  Example:  p: A is a consonant  ~p: it is the case that A is not a consonant  q: Are you in charge?

5 Discrete Mathematical Structures: Theory and Applications 5 Mathematical Logic  Truth Table  Conjunction  Let p and q be statements.The conjunction of p and q, written p ^ q, is the statement formed by joining statements p and q using the word “and”  The statement p ∧ q is true if both p and q are true; otherwise p ∧ q is false

6 Discrete Mathematical Structures: Theory and Applications 6 Mathematical Logic  Conjunction  Truth Table for Conjunction:

7 Discrete Mathematical Structures: Theory and Applications 7 Mathematical Logic  Disjunction  Let p and q be statements. The disjunction of p and q, written p v q, is the statement formed by joining statements p and q using the word “or”  The statement p v q is true if at least one of the statements p and q is true; otherwise p v q is false  The symbol v is read “or”

8 Discrete Mathematical Structures: Theory and Applications 8 Mathematical Logic  Disjunction  Truth Table for Disjunction:

9 Discrete Mathematical Structures: Theory and Applications 9 Mathematical Logic  Implication  Let p and q be statements.The statement “if p then q” is called an implication or condition.  The implication “if p then q” is written p  q  p  q is read:  “If p, then q”  “p is sufficient for q”  q if p  q whenever p

10 Discrete Mathematical Structures: Theory and Applications 10 Mathematical Logic  Implication  Truth Table for Implication:  p is called the hypothesis, q is called the conclusion

11 Discrete Mathematical Structures: Theory and Applications 11 Mathematical Logic  Implication  Let p: Today is Sunday and q: I will wash the car. The conjunction p  q is the statement:  p  q : If today is Sunday, then I will wash the car  The converse of this implication is written q  p  If I wash the car, then today is Sunday  The inverse of this implication is ~p  ~q  If today is not Sunday, then I will not wash the car  The contrapositive of this implication is ~q  ~p  If I do not wash the car, then today is not Sunday

12 Discrete Mathematical Structures: Theory and Applications 12 Mathematical Logic  Biimplication  Let p and q be statements. The statement “p if and only if q” is called the biimplication or biconditional of p and q  The biconditional “p if and only if q” is written p  q  p  q is read:  “p if and only if q”  “p is necessary and sufficient for q”  “q if and only if p”  “q when and only when p”

13 Discrete Mathematical Structures: Theory and Applications 13 Mathematical Logic  Biconditional  Truth Table for the Biconditional:

14 Discrete Mathematical Structures: Theory and Applications 14 Mathematical Logic  Statement Formulas  Definitions  Symbols p,q,r,...,called statement variables  Symbols ~, ^, v, →,and ↔ are called logical connectives 1)A statement variable is a statement formula 2)If A and B are statement formulas, then the expressions (~A ), (A ^ B), (A v B ), (A → B ) and (A ↔ B ) are statement formulas  Expressions are statement formulas that are constructed only by using 1) and 2) above

15 Discrete Mathematical Structures: Theory and Applications 15 Mathematical Logic  Precedence of logical connectives is:  ~ highest  ^ second highest  v third highest  → fourth highest  ↔ fifth highest

16 Discrete Mathematical Structures: Theory and Applications 16 Mathematical Logic  Example:  Let A be the statement formula (~(p v q )) → (q ^ p )  Truth Table for A is:

17 Discrete Mathematical Structures: Theory and Applications 17 Mathematical Logic  Tautology  A statement formula A is said to be a tautology if the truth value of A is T for any assignment of the truth values T and F to the statement variables occurring in A  Contradiction  A statement formula A is said to be a contradiction if the truth value of A is F for any assignment of the truth values T and F to the statement variables occurring in A

18 Discrete Mathematical Structures: Theory and Applications 18 Mathematical Logic  Logically Implies  A statement formula A is said to logically imply a statement formula B if the statement formula A → B is a tautology. If A logically implies B, then symbolically we write A → B  Logically Equivalent  A statement formula A is said to be logically equivalent to a statement formula B if the statement formula A ↔ B is a tautology. If A is logically equivalent to B, then symbolically we write A ≡ B

19 Discrete Mathematical Structures: Theory and Applications 19 Mathematical Logic

20 Discrete Mathematical Structures: Theory and Applications 20 Mathematical Logic  Proof of (~p ^ q ) → (~(q →p ))

21 Discrete Mathematical Structures: Theory and Applications 21 Mathematical Logic  Proof of (~p ^ q ) → (~(q →p )) [continued]

22 Discrete Mathematical Structures: Theory and Applications 22 Validity of Arguments  Proof: an argument or a proof of a theorem consists of a finite sequence of statements ending in a conclusion  Argument: a finite sequence of statements.  The final statement,, is the conclusion, and the statements are the premises of the argument.  An argument is logically valid if the statement formula is a tautology.

23 Discrete Mathematical Structures: Theory and Applications 23 Validity of Arguments - Example P QR PremisesValid TTTTTTTT TTFTFFFT TFTFTFTT TFFFTFFT FTTTTTTT FTFTFFTT FFTTTTTT FFFTTTTT

24 Discrete Mathematical Structures: Theory and Applications 24 Validity of Arguments  Valid Argument Forms  Modus Ponens (Method of Affirming) P Q Premises Conclusion Q Valid TTTTTT TFFFFT FTTFTT FFTFFT

25 Discrete Mathematical Structures: Theory and Applications 25 Validity of Arguments  Valid Argument Forms  Modus Tollens (Method of Denying) P Q Premises Conclusion Valid TTT F FFT TFF T FFT FTT F FTT FFT T TTT

26 Discrete Mathematical Structures: Theory and Applications 26 Validity of Arguments  Valid Argument Forms  Disjunctive Syllogisms

27 Discrete Mathematical Structures: Theory and Applications 27 Validity of Arguments  Valid Argument Forms  Hypothetical Syllogism (proven earlier)  Dilemma

28 Discrete Mathematical Structures: Theory and Applications 28 Validity of Arguments  Valid Argument Forms  Conjunctive Simplification

29 Discrete Mathematical Structures: Theory and Applications 29 Validity of Arguments  Valid Argument Forms  Disjunctive Addition

30 Discrete Mathematical Structures: Theory and Applications 30 Validity of Arguments  Valid Argument Forms  Conjunctive Addition

31 Discrete Mathematical Structures: Theory and Applications 31 Validity of Arguments – Formal Derivation  Prove  Formal Derivation Rule Comment 1. P  Q Premise 2. Q  R Premise 3. P Assumption Assume P 4. Q 1,3, MP 5. R 2,4, MP R is now proved 6. P  R DT Discharge P, ie, P is no longer to be used, and conclude that P  R  Uses Deduction Theorem (DT)

32 Discrete Mathematical Structures: Theory and Applications 32 Quantifiers and First Order Logic  Have dealt with Propositional Logic (Calculus) so far  Propositional variables, constants, expressions  Dealt with truth or falsity of expressions as a whole  Consider: 1. All cats have tails 2. Tom is a cat 3. Tom has a tail  Cannot conclude 3, given 1 and 2 using propositional logic  Predicate Calculus – allows us to identify individuals such as Tom together with properties and predicates.

33 Discrete Mathematical Structures: Theory and Applications 33 Quantifiers and First Order Logic  Predicate or Propositional Function  Let x be a variable and D be a set; P(x) is a sentence  Then P(x) is called a predicate or propositional function with respect to the set D if for each value of x in D, P(x) is a statement; i.e., P(x) is true or false  Moreover, D is called the domain of the discourse and x is called the free variable

34 Discrete Mathematical Structures: Theory and Applications 34 Quantifiers and First Order Logic Propositional function example #1 Let P(x) be the statement: x is an odd integer Let D be the set of all positive integers. Then P is a propositional function with domain of discourse D. For each x in D, P(x) is a proposition, i.e. a sentence which is either true or false. P(1): 1 is an odd integer – True P(14): 14 is an odd integer - False

35 Discrete Mathematical Structures: Theory and Applications 35 Quantifiers and First Order Logic Propositional function example #2 Let P(x) be the statement: the baseball player hit over.300 in 2003 Let D be the set of all baseball players. Then P is a propositional function with domain of discourse D. For each x in D, P(x) is a proposition, i.e. a sentence which is either true or false. P(Barry Bonds): Barry Bonds hit over.300 in 2003 - True P(Alex Rodriguez): Alex Rodriguez hit over.300 in 2003 - False

36 Discrete Mathematical Structures: Theory and Applications 36 Quantifiers and First Order Logic  Predicate or Propositional Function  Example:  Q(x,y) : x > y, where the Domain is the set of integers  Q is a 2-place predicate  Q is T for Q(4,3) and Q is F for Q (3,4)

37 Discrete Mathematical Structures: Theory and Applications 37 Quantifiers and First Order Logic  Universal Quantifier  Let P(x) be a predicate and let D be the domain of the discourse. The universal quantification of P(x) is the statement:  For all x, P(x) or  For every x, P(x)  The symbol is read as “for all and every”   Two-place predicate:

38 Discrete Mathematical Structures: Theory and Applications 38 Quantifiers and First Order Logic  Universal Quantifier Examples  Consider the statement  It is true if P(x) is true for every x in D  It is false if P(x) is false for at least one x in D  Consider with D being the set of all real numbers.  The statement is true because for every real number x, it is true that the square of x is positive or zero.  Consider that with D being the set of real numbers is false. Why?

39 Discrete Mathematical Structures: Theory and Applications 39 Quantifiers and First Order Logic  Existential Quantifier  Let P(x) be a predicate and let D be the domain of the discourse. The existential quantification of P(x) is the statement:  There exists x, P(x)  The symbol is read as “there exists”   Bound Variable  The variable appearing in: or

40 Discrete Mathematical Structures: Theory and Applications 40 Quantifiers and First Order Logic  Existential Quantifier Example  Consider  It is true since there is at least one real number x for which the proposition is true. Try x=2  Suppose that P is a propositional function whose domain of discourse consists of the elements d1,…,dn. The following pseudocode determines whether is true.

41 Discrete Mathematical Structures: Theory and Applications 41 Quantifiers and First Order Logic  Negation of Predicates (DeMorgan’s Laws)   Example:  If P(x) is the statement “x has won a race” where the domain of discourse is all runners, then the universal quantification of P(x) is, i.e., every runner has won a race. The negation of this statement is “it is not the case that every runner has won a race. Therefore there exists at least one runner who has not won a race. Therefore: and so,

42 Discrete Mathematical Structures: Theory and Applications 42 Quantifiers and First Order Logic  Negation of Predicates (DeMorgan’s Laws) 

43 Discrete Mathematical Structures: Theory and Applications 43 Quantifiers and First Order Logic  Formulas in Predicate Logic  All statement formulas are considered formulas  Each n, n =1,2,...,n-place predicate P( ) containing the variables is a formula.  If A and B are formulas, then the expressions ~A, (A ∧ B), (A ∨ B), A →B and A↔B are statement formulas, where ~, ∧, ∨, → and ↔ are logical connectives  If A is a formula and x is a variable, then ∀ x A(x) and ∃ x A(x) are formulas  All formulas constructed using only above rules are considered formulas in predicate logic

44 Discrete Mathematical Structures: Theory and Applications 44 Quantifiers and First Order Logic  Additional Rules of Inference  If the statement ∀ x P(x) is assumed to be true, then P(a) is also true,where a is an arbitrary member of the domain of the discourse. This rule is called the universal specification (US)  If P(a) is true, where a is an arbitrary member of the domain of the discourse, then ∀ x P(x) is true. This rule is called the universal generalization (UG)  If the statement ∃ x P (x) is true, then P(a) is true, for some member of the domain of the discourse. This rule is called the existential specification (ES)  If P(a) is true for some member a of the domain of the discourse, then ∃ x P(x) is also true. This rule is called the existential generalization (EG)

45 Discrete Mathematical Structures: Theory and Applications 45 Quantifiers and First Order Logic  Counterexample  An argument has the form ∀ x (P(x ) → Q(x )), where the domain of discourse is D  To show that this implication is not true in the domain D, it must be shown that there exists some x in D such that (P(x ) → Q(x )) is not true  This means that there exists some x in D such that P(x) is true but Q(x) is not true. Such an x is called a counterexample of the above implication  To show that ∀ x (P(x) → Q(x)) is false by finding an x in D such that P(x) → Q(x) is false is called the disproof of the given statement by counterexample

46 Discrete Mathematical Structures: Theory and Applications 46 Logic and CS  Logic is basis of ALU  Logic is crucial to IF statements  AND  OR  NOT  Implementation of quantifiers  Looping  Database Query Languages  Relational Algebra  Relational Calculus  SQL


Download ppt "Discrete Mathematical Structures: Theory and Applications 1 Logic: Learning Objectives  Learn about statements (propositions)  Learn how to use logical."

Similar presentations


Ads by Google