Download presentation
Presentation is loading. Please wait.
Published byPolly Stanley Modified over 9 years ago
1
Lecture 8 Introduction to Logic CSCI – 1900 Mathematics for Computer Science Fall 2014 Bill Pine
2
CSCI 1900 Lecture 8 - 2 Lecture Introduction Reading –Rosen - Section 1.1 Logical Statements Logical Connectives / Compound Statements –Negation –Conjunction –Disjunction Truth Tables Quantifiers –Universal –Existential
3
CSCI 1900 Lecture 8 - 3 Statement of Proposition Proposition (statement of proposition) – a declarative sentence that is either true or false, but not both Examples: –Star Trek was a TV series: True –2+3 = 5: True –Do you speak Klingon? This is a question, not a statement
4
CSCI 1900 Lecture 8 - 4 Statement of Proposition (cont) –x - 3 = 5: a declarative sentence, but not a statement since it is true or false depending on the value of x –Take two aspirins: a command, not a statement –The current temperature on the surface of the planet Venus is 800 o F: a proposition of whose truth is unknown to us –The sun will come out tomorrow: a proposition that is either true or false, but not both, although we will have to wait until tomorrow to determine the answer
5
CSCI 1900 Lecture 8 - 5 Notation x, y, z, … denote variables that can represent real numbers p, q, r,… denote propositional variables that can be replaced by statements –p: The sun is shining today –q: It is cold
6
CSCI 1900 Lecture 8 - 6 Negation (Not) If p is a statement, the negation of p is the statement not p Denoted ~p ( alternately: !p or p or p ) If p is True, –~p is False If p is False, –~p is True not is a unary operator for the collection of statements and ~p is a statement if p is a statement
7
CSCI 1900 Lecture 8 - 7 Negation Truth Table p~ p TF FT
8
CSCI 1900 Lecture 8 - 8 Examples of Negation If p: 2+3 > 1 Then ~p: 2+3 < 1 If q: It is night Then –~q: It is not the case that it is night, It is not night It is day
9
CSCI 1900 Lecture 8 - 9 Conjunction If p and q are statements –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 readily available –q: ETSU has plenty of parking –p q = ?
10
CSCI 1900 Lecture 8 - 10 Conjunction Truth Table pq p q TTT TFF FTF FFF
11
English Conjunctives The following are common conjunctives in English: And, Now, But, Still, So, Only, Therefore, Moreover, Besides, Consequently, Nevertheless, For, However, Hence, Both... And, Not only... but also, While, Then, So then CSCI 1900 Lecture 8 - 11
12
CSCI 1900 Lecture 8 - 12 Disjunction (Inclusive) If p and q are statements, –The (inclusive) disjunction of p and q is the compound statement “p or q” –Denoted p q p q is true if either p is true or q is true or both are true Example: –p: I am a male q: I am under 90 years old –p q = ? –p: I am a male q: I am under 20 years old –p q = ?
13
CSCI 1900 Lecture 8 - 13 Disjunction (Inclusive) Truth Table pq p q TTT TFT FTT FFF
14
CSCI 1900 Lecture 8 - 14 Exclusive Disjunction If p and q are statements –The exclusive disjunction true if either p is true or q is true, but not both are true –Denoted p q Example: –p: It is daytime –q: It is night time –p q (in the exclusive sense) = ?
15
CSCI 1900 Lecture 8 - 15 Disjunction(Exclusive) Truth Table pq p q TTF TFT FTT FFF
16
CSCI 1900 Lecture 8 - 16 Exclusive versus Inclusive Depending on the circumstances, some English 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 –The light is either on or off
17
CSCI 1900 Lecture 8 - 17 Compound Statements A compound statement is a statement made by joining simple propositions with logical connectors For n individual propositions, there are 2 n possible combinations of truth values The 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 Use parenthesis to ensure meaning is clear
18
CSCI 1900 Lecture 8 - 18 Truth Tables as Tools Compound statements can be easily and systematically investigated with truth tables Assign a portion of the compound statement to a column Final column represents the complete compound statement
19
CSCI 1900 Lecture 8 - 19 Compound Statement Example pq p q ~p (p q) (~p) TTTFT TFFFF FTFTT FFFTT
20
CSCI 1900 Lecture 8 - 20 Quantifiers Recall from Section 1.1, a set may be defined by its properties {x | P(x)} For a specific element e to be a member of the set, P(e) must evaluate to “true” P(x) is called a predicate or a propositional function
21
CSCI 1900 Lecture 8 - 21 Computer Science Functions if P(x) then execute certain steps while Q(x) do specified actions
22
CSCI 1900 Lecture 8 - 22 Universal Quantification Universal quantification of the predicate P(x) means “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 universal quantifications are applied does not matter (e.g., x y P(x,y) ≡ y x P(x,y) )
23
CSCI 1900 Lecture 8 - 23 Universal Examples: P(x): -(-x) = x –This predicate makes sense for all real numbers x R –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
24
CSCI 1900 Lecture 8 - 24 Existential Quantification 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 existential quantifications are considered does not matter
25
CSCI 1900 Lecture 8 - 25 Existential Examples: P(x): -(-x) = x –The existential quantification of P(x), x P(x), is a true statement, because there is at least one real number where -(-x) = x Q(x): x+1<4 – x Q(x) is a true statement, because, for example, Q(2) is true Nota Bene: is not the complement of –An Example N(x): x ≠ x x N(x) is false and x N(x) is also false
26
CSCI 1900 Lecture 8 - 26 Applying Both and Quantifications Order of application matters 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, for all A, such that, A + B = I n The second proposition is F A L S E !
27
CSCI 1900 Lecture 8 - 27 Assigning Quantification - 1 Let p: x R(x) [R(x): a person is good] –If p is true then x ~R(x) is false If every person is good, then there does not exist person who is not good –If p is true then x R(x) is true If every person is good, then there exists a person who is good –If p is false then x ~R(x) is true If not every person is good, then there exists a person who is not good
28
CSCI 1900 Lecture 8 - 28 Assigning Quantification - 2 Let p: x R(x) [R(x): a person is good] –If p is true then x ~R(x) is false If there exists a person who is good, then it is not true that all people are not good –If p is false then x ~R(x) is true If there does not exist a good person then every person is not good
29
CSCI 1900 Lecture 8 - 29 Implications of the Previous Slide Assume a statement is made that “for all x, P(x) is true” –If we can find one case that is not true The statement is false –If there isn’t one case that is not true The statement is true Example: positive integers, n, n P(n) = n 2 - n + 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
30
CSCI 1900 Lecture 8 - 30 Key Concepts Summary Statement of Proposition Logical Connectives / Compound Statements –Negation –Conjunction –Disjunction Truth Tables Quantifiers –Universal –Existential
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.