Presentation is loading. Please wait.

Presentation is loading. Please wait.

2.1 Propositions and Logical Operations

Similar presentations


Presentation on theme: "2.1 Propositions and Logical Operations"— Presentation transcript:

1 2.1 Propositions and Logical Operations

2 A statement or proposition is a declarative sentence that is either true or false, but not both.
Statement examples: The earth is round 2 + 3 = 5 Examples that are not statements: Do you speak Spanish? (this is a question) Take two aspirins. (this is a command)

3 Propositional variables used in logic are p q and r.
These variables can be replaced with statements where p: The sun is shining today. q: It is cold. Statements can be combined by logical connectives to form compound statements. and is represented by ∧ or is repersented by ∨ not is not a connective. not is represented by

4 and: both statements must be true for the result to be
or: only one statement must be true in order for the result to be true We use truth tables for our statements:

5 Truth Table for (p ∧ q) ∨ ( p) 2 variables p and q 22 =4
4 possible outcomes Col 1 Col 2 Col Col Col 5 p q p ∧ q ~ P (p ∧ q) ∨ (~p) T F

6 1. List all possibilities of p and q in column 1 and 2.
2. Fill in column 3 using the and connective. Both p and q must be true in order for the result to be true. 3. Fill in column 4 . Take the opposite of what is in column 1 and place the result in column 4. 4. Fill in column 5 by comparing column 3 and 4 using the or connective. Only one statement must be true in order for the result to be true.

7 Negation Statement 2 is an even integer and 8 is an odd integer
To negate the statement 2 is not an even integer or 8 is not an odd integer

8 Universal quantification of P(x)
Denoted ∀ x P(x) Meaning: For all values of x, P(x) is either true or false Example: P(x): -(-x)= x P(x) can be called a proposition that results in either true or false The opposite of a negative number is a positive number always. ∀ x P(x) is true (the universal quantification of P(x) is true)

9 Q(x) = x + 1 < 4 ∀ x Q(x) The universal quantification of Q(x) is false because we can replace x with a number that makes this statement false.

10 Existential quantification of P(x) is denoted ∃ xP(x)
There exists a value(s) of x for which P(x) is true. Example: Q(x) : x + 1 ≺ 4 is true because x could be 1 or 2. ∃y where y + 2 = y is false because there is no value that makes this statement true

11 In programming we have IF statements or IF THEN ELSE statements.
IF N ≺ 10 THEN replace N with N + 1 Return N The N ≺ 10 is called the guard The IF statement is a statement that can be either true or false.


Download ppt "2.1 Propositions and Logical Operations"

Similar presentations


Ads by Google