Presentation is loading. Please wait.

Presentation is loading. Please wait.

Logical Operations – Page 1CSCI 1900 – Discrete Structures CSCI 1900 Discrete Structures Logical Operations Reading: Kolman, Section 2.1.

Similar presentations


Presentation on theme: "Logical Operations – Page 1CSCI 1900 – Discrete Structures CSCI 1900 Discrete Structures Logical Operations Reading: Kolman, Section 2.1."— Presentation transcript:

1 Logical Operations – Page 1CSCI 1900 – Discrete Structures CSCI 1900 Discrete Structures Logical Operations Reading: Kolman, Section 2.1

2 Logical Operations – Page 2CSCI 1900 – Discrete Structures Statement of Proposition Statement of proposition – a declarative sentence that is either true or false, but not both Examples: –The earth is round: statement that is true 2+3=5: statement that is true –Do you speak English? This is a question, not a statement

3 Logical Operations – Page 3CSCI 1900 – Discrete Structures More Examples of Statements of Proposition 3-x=5: is a declarative sentence, but not a statement since it is true or false depending on the value of x Take two aspirins: is a command, not a statement The temperature on the surface of the planet Venus is 800 o F: is a declarative statement of whose truth is unknown to us The sun will come out tomorrow: a statement that is either true or false, but not both, although we will have to wait until tomorrow to determine the answer

4 Logical Operations – Page 4CSCI 1900 – Discrete Structures Logical Connectives and Compound Statements x, y, z, … denote variables that can represent real numbers p, q, r,… denote prepositional variables that can be replaced by statements. –p: The sun is shining today –q: It is cold

5 Logical Operations – Page 5CSCI 1900 – Discrete Structures Negation If p is a statement, the negation of p is the statement not p Denoted ~p If p is true, ~p is false If p is false, ~p is true ~p is not actually connective, i.e., it doesn’t join two of anything not is a unary operation for the collection of statements and ~p is a statement if p is

6 Logical Operations – Page 6CSCI 1900 – Discrete Structures Examples of Negation If p: 2+3 >1 then If ~p: 2+3 <1 If q: It is cold then ~q: It is not the case that it is cold, i.e., It is not cold.

7 Logical Operations – Page 7CSCI 1900 – Discrete Structures Conjunction If p and q are statements, then the conjunction of p and q is the compound statement “p and q” Denoted p  q p  q is true only if both p and q are true Example: –p: ETSU parking permits are expensive –q: ETSU has plenty of parking –p  q = ?

8 Logical Operations – Page 8CSCI 1900 – Discrete Structures Disjunction If p and q are statements, then the disjunction of p and q is the compound statement “p or q” Denoted p  q p  q is true if either p or q are true Example: –p: I am a male –q: I am under 40 years old –p  q = ?

9 Logical Operations – Page 9CSCI 1900 – Discrete Structures Exclusive Disjunction If p and q are statements, then the exclusive disjunction is the compound statement, “either p or q may be true, but both are not true at the same time.” Example: –p: It is daytime –q: It is night time –p  q (in the exclusive sense) = ?

10 Logical Operations – Page 10CSCI 1900 – Discrete Structures Inclusive Disjunction If p and q are statements, then the inclusive disjunction is the compound statement, “either p or q may be true or they may both be true at the same time.” Example: –p: It is cold –q: It is night time –p  q (in the inclusive sense) = ?

11 Logical Operations – Page 11CSCI 1900 – Discrete Structures Exclusive versus Inclusive Depending on the circumstances, some disjunctions are inclusive and some of exclusive. Examples of Inclusive –“I have a dog” or “I have a cat” –“It is warm outside” or “It is raining” Examples of Exclusive –Today is either Tuesday or it is Thursday –Pat is either male or female

12 Logical Operations – Page 12CSCI 1900 – Discrete Structures Compound Statements A compound statement is a statement made from other statements For n individual propositions, there are 2 n possible combinations of truth values A truth table contains 2 n rows identifying the truth values for the statement represented by the table. Use parenthesis to denote order of precedence  has precedence over 

13 Logical Operations – Page 13CSCI 1900 – Discrete Structures Truth Tables are Important Tools for this Material! pq pqpq TTT TFF FTF FFF pq pqpq TTT TFT FTT FFF

14 Logical Operations – Page 14CSCI 1900 – Discrete Structures Compound Statement Example (p  q)  (~p) pq p  q ~p (p  q)  (~p) TTTFT TFFFF FTFTT FFFTT

15 Logical Operations – Page 15CSCI 1900 – Discrete Structures Quantifiers Back in Section 1.1, a set was defined {x | P(x)} For an element t to be a member of the set, P(t) must evaluate to “true” P(x) is called a predicate or a propositional function

16 Logical Operations – Page 16CSCI 1900 – Discrete Structures Computer Science Functions if P(x), then execute certain steps while Q(x), do specified actions

17 Logical Operations – Page 17CSCI 1900 – Discrete Structures Universal quantification of a predicate P(x) Universal quantification of predicate P(x) = For all values of x, P(x) is true Denoted  x P(x) The symbol  is called the universal quantifier The order in which multiple quantifications are considered does not affect the truth value (e.g.,  x  y P(x,y) ≡  y  x P(x,y) )

18 Logical Operations – Page 18CSCI 1900 – Discrete Structures Examples: P(x): -(-x) = x –This predicate makes sense for all real numbers x. –The universal quantification of P(x),  x P(x), is a true statement, because for all real numbers, -(-x) = x Q(x): x+1<4 –  x Q(x) is a false statement, because, for example, Q(5) is not true

19 Logical Operations – Page 19CSCI 1900 – Discrete Structures Existential quantification of a predicate P(x) Existential quantification of a predicate P(x) is the statement “There exists a value of x for which P(x) is true.” Denoted  x P(x) Existential quantification may be applied to several variables in a predicate The order in which multiple quantifications are considered does not affect the truth value

20 Logical Operations – Page 20CSCI 1900 – Discrete Structures Applying both universal and existential quantification Order of application does matter Example: Let A and B be n x n matrices The statement  A  B A + B = I n Reads “for every A there is a B such that A + B = I n ” Prove by coming up for equations for b ii and b ij (j  i) Now reverse the order:  B  A A + B = I n Reads “there exists a B such that for all A A + B = I n ” THIS IS FALSE!

21 Logical Operations – Page 21CSCI 1900 – Discrete Structures Assigning Quantification to Proposition Let p:  x P(x) The negation of p is false when p is true and true when p is false For p to be false, there must be at least one value of x for which P(x) is false. Thus, p is false if  x ~P(x) is true. If  x ~P(x) is false, then for every x, ~P(x) is false; that is  x P(x) is true.

22 Logical Operations – Page 22CSCI 1900 – Discrete Structures Okay, what exactly did the previous slide say? Assume a statement is made that “for all x, P(x) is true.” –If we can find one case that is not true, then the statement is false. –If we cannot find one case that is not true, then the statement is true. Example:  positive integers, n, P(n) = n 2 + 41n + 41 is a prime number. –This is false because  an integer resulting in a non-prime value, i.e.,  n such that P(n) is false.


Download ppt "Logical Operations – Page 1CSCI 1900 – Discrete Structures CSCI 1900 Discrete Structures Logical Operations Reading: Kolman, Section 2.1."

Similar presentations


Ads by Google