Logic (slides)

23
Logic

Transcript of Logic (slides)

Page 1: Logic (slides)

Logic

Page 2: Logic (slides)

Propositions and Logical OperationsDefinition: A statement or proposition is a declarative sentence that is either true (T) or false (F), but not both.

Example: Which of the following are statements?

a. It is raining.

b. 2 + 3 = 5

c. Do you speak English?

d. 3 βˆ’ π‘₯π‘₯ = 5

e. Take two aspirins.Β© S. Turaev, CSC 1700 Discrete Mathematics 2

Page 3: Logic (slides)

Propositions and Logical Operations The letters 𝑝𝑝, π‘žπ‘ž, π‘Ÿπ‘Ÿ are denote propositional variables

β€’ 𝑝𝑝: I am teaching.

β€’ π‘žπ‘ž: 3 Γ— 23 = 70

Compound statements: propositional variables combined by logical connectives (and, or, if … then, …):

β€’ 𝑝𝑝 and π‘žπ‘ž.

β€’ 𝑝𝑝 or π‘žπ‘ž.

β€’ If 𝑝𝑝 then π‘žπ‘ž.

3Β© S. Turaev, CSC 1700 Discrete Mathematics

Page 4: Logic (slides)

Propositions and Logical OperationsDefinition: If 𝑝𝑝 is a statement, the negation of 𝑝𝑝 is the statement not 𝑝𝑝, denoted by ~𝑝𝑝 (sometimes, ¬𝑝𝑝, �̅�𝑝).

~𝑝𝑝: β€œIt is not the case that 𝑝𝑝”.

Example:

𝑝𝑝: 2 + 3 > 1 ~𝑝𝑝:

π‘žπ‘ž: It is cold. ~𝑝𝑝:

4Β© S. Turaev, CSC 1700 Discrete Mathematics

𝑝𝑝 ~𝑝𝑝T FF T

Page 5: Logic (slides)

Propositions and Logical OperationsDefinition: If 𝑝𝑝 and π‘žπ‘ž are statements, the conjunction of 𝑝𝑝and π‘žπ‘ž is the compound statement 𝑝𝑝 and π‘žπ‘ž, denoted by 𝑝𝑝 ∧ π‘žπ‘ž.

Example:

𝑝𝑝: It is raining. π‘žπ‘ž: It is cold.

𝑝𝑝: 2 < 3. π‘žπ‘ž: βˆ’3 < βˆ’2.

𝑝𝑝 ∧ π‘žπ‘ž:

5Β© S. Turaev, CSC 1700 Discrete Mathematics

𝑝𝑝 π‘žπ‘ž 𝑝𝑝 ∧ π‘žπ‘žT T TT F FF T FF F F

Page 6: Logic (slides)

Propositions and Logical OperationsDefinition: If 𝑝𝑝 and π‘žπ‘ž are statements, the disjunction of 𝑝𝑝and π‘žπ‘ž is the compound statement 𝑝𝑝 or π‘žπ‘ž, denoted by 𝑝𝑝 βˆ¨π‘žπ‘ž.

Example:

𝑝𝑝: It is raining. π‘žπ‘ž: It is cold.

𝑝𝑝: 2 < 3. π‘žπ‘ž: βˆ’3 < βˆ’2.

𝑝𝑝 ∨ π‘žπ‘ž:

6Β© S. Turaev, CSC 1700 Discrete Mathematics

𝑝𝑝 π‘žπ‘ž 𝑝𝑝 ∧ π‘žπ‘žT T TT F TF T TF F F

Page 7: Logic (slides)

Propositions and Logical OperationsA compound statement may have many components:

𝑝𝑝 ∨ (π‘žπ‘ž ∧ (~ 𝑝𝑝 ∧ π‘Ÿπ‘Ÿ ))

Example: Make a truth table for 𝑝𝑝 ∧ π‘žπ‘ž ∨ ~𝑝𝑝.

7Β© S. Turaev, CSC 1700 Discrete Mathematics

𝑝𝑝 π‘žπ‘ž 𝑝𝑝 ∧ π‘žπ‘ž ~𝑝𝑝 ∨T TT FF TF F

Page 8: Logic (slides)

Propositions and Logical OperationsDefinition: If 𝑝𝑝 and π‘žπ‘ž are statements, the compound statement β€œif 𝑝𝑝 then π‘žπ‘žβ€, denoted 𝑝𝑝 β‡’ π‘žπ‘ž, is called a conditional statement or implication.

The statement 𝑝𝑝 is called antecedent or hypothesis and π‘žπ‘žis called the consequent or conclusion.

Example:

𝑝𝑝: I am hungry. π‘žπ‘ž: I will eat.

𝑝𝑝: It is snowing. π‘žπ‘ž: 3 + 2 = 5.

𝑝𝑝 β‡’ π‘žπ‘ž:

8Β© S. Turaev, CSC 1700 Discrete Mathematics

𝑝𝑝 π‘žπ‘ž 𝑝𝑝 β‡’ π‘žπ‘žT T TT F FF T TF F T

Page 9: Logic (slides)

Propositions and Logical OperationsDefinition: If 𝑝𝑝 β‡’ π‘žπ‘ž is an implication, then

the converse of 𝑝𝑝 β‡’ π‘žπ‘ž is the implication π‘žπ‘ž β‡’ 𝑝𝑝

the inverse of 𝑝𝑝 β‡’ π‘žπ‘ž is the implication ~𝑝𝑝 β‡’ ~π‘žπ‘ž

the contrapositive of 𝑝𝑝 β‡’ π‘žπ‘ž is the implication ~π‘žπ‘ž β‡’~𝑝𝑝

Example: 𝑝𝑝 β‡’ π‘žπ‘ž: β€œIf it is raining then I get wet” then

π‘žπ‘ž β‡’ 𝑝𝑝, ~𝑝𝑝 β‡’ ~π‘žπ‘ž, ~π‘žπ‘ž β‡’ ~𝑝𝑝?

9Β© S. Turaev, CSC 1700 Discrete Mathematics

Page 10: Logic (slides)

Propositions and Logical OperationsDefinition: If 𝑝𝑝 and π‘žπ‘ž are statements, the compound statement β€œπ‘π‘ if and only if π‘žπ‘žβ€, denoted 𝑝𝑝 ⇔ π‘žπ‘ž, is called an equivalence or biconditional.

Example:

𝑝𝑝: 3 > 2. π‘žπ‘ž: 0 < 3 βˆ’ 2.

𝑝𝑝: It is snowing. π‘žπ‘ž: 3 + 2 = 5.

𝑝𝑝 ⇔ π‘žπ‘ž:

10Β© S. Turaev, CSC 1700 Discrete Mathematics

𝑝𝑝 π‘žπ‘ž 𝑝𝑝 β‡’ π‘žπ‘žT T TT F FF T FF F T

Page 11: Logic (slides)

Propositions and Logical OperationsExample: Compute the truth table of the statement

𝑝𝑝 β‡’ π‘žπ‘ž ⇔ (~π‘žπ‘ž β‡’ ~𝑝𝑝)

11Β© S. Turaev, CSC 1700 Discrete Mathematics

𝑝𝑝 π‘žπ‘ž 𝑝𝑝 β‡’ π‘žπ‘ž ~π‘žπ‘ž ~𝑝𝑝 ~π‘žπ‘ž β‡’ ~𝑝𝑝 ⇔T TT FF TF F

Page 12: Logic (slides)

Propositions and Logical OperationsDefinition: A statement that is true for all possible values of its propositional variables is called a tautology.

Definition: A statement that is false for all possible values of its propositional variables is called a contradiction or an absurdity.

Definition: A statement that can be either true or falsefor all possible values of its propositional variables is called contingency.

12Β© S. Turaev, CSC 1700 Discrete Mathematics

Page 13: Logic (slides)

Propositions and Logical OperationsExample:

The statement 𝑝𝑝 ∨ ~𝑝𝑝:

The statement 𝑝𝑝 ∧ ~𝑝𝑝:

The statement 𝑝𝑝 β‡’ π‘žπ‘ž ∧ (𝑝𝑝 ∨ π‘žπ‘ž):

13Β© S. Turaev, CSC 1700 Discrete Mathematics

Page 14: Logic (slides)

Propositions and Logical OperationsDefinition: We say that the statements 𝑝𝑝 and π‘žπ‘ž are logically equivalent (or simply equivalent), denoted by 𝑝𝑝 ≑ π‘žπ‘ž, if 𝑝𝑝 ⇔ π‘žπ‘ž is tautology.

Example: Show that

𝑝𝑝 ∨ π‘žπ‘ž ≑ π‘žπ‘ž ∨ 𝑝𝑝

𝑝𝑝 β‡’ π‘žπ‘ž ≑ ~𝑝𝑝 ∨ π‘žπ‘ž

14Β© S. Turaev, CSC 1700 Discrete Mathematics

Page 15: Logic (slides)

Propositions and Logical OperationsDefinition: A predicate or a propositional function is a noun/verb phrase template that describes a property of objects, or a relationship among objects represented by the variables:

Example: 𝑃𝑃 π‘₯π‘₯ : β€œπ‘₯π‘₯ is integer less than 8.”

𝑃𝑃 1 =

𝑃𝑃 10 =

𝑃𝑃 βˆ’11 =

15Β© S. Turaev, CSC 1700 Discrete Mathematics

Page 16: Logic (slides)

Propositions and Logical OperationsDefinition: The universal quantification of a predicate 𝑃𝑃 π‘₯π‘₯ is the statement β€œFor all values of π‘₯π‘₯ (for every π‘₯π‘₯, for each π‘₯π‘₯, for any π‘₯π‘₯), 𝑃𝑃 π‘₯π‘₯ is true” and is denoted by βˆ€π‘₯π‘₯𝑃𝑃 π‘₯π‘₯ .

Example: 𝑃𝑃 π‘₯π‘₯ : β€œβˆ’ βˆ’π‘₯π‘₯ = π‘₯π‘₯” is a predicate that is true for all real numbers.

βˆ€π‘₯π‘₯𝑃𝑃 π‘₯π‘₯ =

Example: 𝑄𝑄 π‘₯π‘₯ : β€œπ‘₯π‘₯ + 1 < 4”.

βˆ€π‘₯π‘₯𝑄𝑄 π‘₯π‘₯ =

16Β© S. Turaev, CSC 1700 Discrete Mathematics

Page 17: Logic (slides)

Propositions and Logical OperationsA predicate may contain several variables.

Example: 𝑄𝑄 π‘₯π‘₯, 𝑦𝑦 : π‘₯π‘₯ + 𝑦𝑦 = 𝑦𝑦 + π‘₯π‘₯

βˆ€π‘₯π‘₯βˆ€π‘¦π‘¦π‘„π‘„ π‘₯π‘₯,𝑦𝑦 =

Example: Write the following statement in the form of a predicate and quantifier:

β€œThe sum of any two integers is even number.”

17Β© S. Turaev, CSC 1700 Discrete Mathematics

Page 18: Logic (slides)

Propositions and Logical OperationsDefinition: The existential quantification of a predicate 𝑃𝑃 π‘₯π‘₯ is the statement β€œThere exists a value of π‘₯π‘₯, for which 𝑃𝑃 π‘₯π‘₯ is true” and is denoted by βˆƒπ‘₯π‘₯𝑃𝑃 π‘₯π‘₯ .

Example: 𝑃𝑃 π‘₯π‘₯ : β€œβˆ’π‘₯π‘₯ = π‘₯π‘₯”.

βˆƒπ‘₯π‘₯𝑃𝑃 π‘₯π‘₯ =

Example: 𝑄𝑄 π‘₯π‘₯ : β€œπ‘₯π‘₯ + 1 < 4”.

βˆƒπ‘₯π‘₯𝑄𝑄 π‘₯π‘₯ =

18Β© S. Turaev, CSC 1700 Discrete Mathematics

Page 19: Logic (slides)

Algebraic PropertiesCommutative properties:

𝑝𝑝 ∨ π‘žπ‘ž ≑ π‘žπ‘ž ∨ 𝑝𝑝 𝑝𝑝 ∧ π‘žπ‘ž ≑ π‘žπ‘ž ∧ 𝑝𝑝

Associative properties:

𝑝𝑝 ∨ π‘žπ‘ž ∨ π‘Ÿπ‘Ÿ ≑ 𝑝𝑝 ∨ π‘žπ‘ž ∨ π‘Ÿπ‘Ÿ 𝑝𝑝 ∧ π‘žπ‘ž ∧ π‘Ÿπ‘Ÿ ≑ 𝑝𝑝 ∧ π‘žπ‘ž ∧ π‘Ÿπ‘Ÿ

Distributive properties:

𝑝𝑝 ∨ π‘žπ‘ž ∧ π‘Ÿπ‘Ÿ ≑ 𝑝𝑝 ∨ π‘žπ‘ž ∧ 𝑝𝑝 ∨ π‘Ÿπ‘Ÿ 𝑝𝑝 ∧ π‘žπ‘ž ∨ π‘Ÿπ‘Ÿ ≑ 𝑝𝑝 ∧ π‘žπ‘ž ∨ 𝑝𝑝 ∧ π‘Ÿπ‘Ÿ

19Β© S. Turaev, CSC 1700 Discrete Mathematics

Page 20: Logic (slides)

Algebraic PropertiesIdempotent properties:

𝑝𝑝 ∨ 𝑝𝑝 ≑ 𝑝𝑝

𝑝𝑝 ∧ 𝑝𝑝 ≑ 𝑝𝑝

Properties of negation:

~(~𝑝𝑝) ≑ 𝑝𝑝

~ 𝑝𝑝 ∨ π‘žπ‘ž ≑ ~𝑝𝑝 ∧ ~π‘žπ‘ž

~ 𝑝𝑝 ∧ π‘žπ‘ž ≑ ~𝑝𝑝 ∨ ~π‘žπ‘ž

20Β© S. Turaev, CSC 1700 Discrete Mathematics

Page 21: Logic (slides)

Algebraic PropertiesProperties of implication:

𝑝𝑝 β‡’ π‘žπ‘ž ≑ ~𝑝𝑝 ∨ π‘žπ‘ž

𝑝𝑝 β‡’ π‘žπ‘ž ≑ ~π‘žπ‘ž β‡’ ~𝑝𝑝

𝑝𝑝 ⇔ π‘žπ‘ž ≑ 𝑝𝑝 β‡’ π‘žπ‘ž ∧ π‘žπ‘ž β‡’ 𝑝𝑝

~ 𝑝𝑝 β‡’ π‘žπ‘ž ≑ 𝑝𝑝 β‡’ ~π‘žπ‘ž

~ 𝑝𝑝 ⇔ π‘žπ‘ž ≑ 𝑝𝑝 ∧ ~π‘žπ‘ž ∨ π‘žπ‘ž ∧ ~𝑝𝑝

21Β© S. Turaev, CSC 1700 Discrete Mathematics

Page 22: Logic (slides)

Algebraic PropertiesProperties of quantifiers:

~ βˆ€π‘₯π‘₯𝑃𝑃 π‘₯π‘₯ ≑ βˆƒπ‘₯π‘₯~𝑃𝑃 π‘₯π‘₯

~ βˆƒπ‘₯π‘₯𝑃𝑃 π‘₯π‘₯ ≑ βˆ€π‘₯π‘₯~𝑃𝑃 π‘₯π‘₯

βˆƒπ‘₯π‘₯ 𝑃𝑃 π‘₯π‘₯ β‡’ 𝑄𝑄 π‘₯π‘₯ ≑ βˆ€π‘₯π‘₯𝑃𝑃 π‘₯π‘₯ β‡’ βˆƒπ‘₯π‘₯𝑄𝑄 π‘₯π‘₯

βˆƒπ‘₯π‘₯ 𝑃𝑃 π‘₯π‘₯ ∨ 𝑄𝑄 π‘₯π‘₯ ≑ βˆƒπ‘₯π‘₯𝑃𝑃 π‘₯π‘₯ ∨ βˆƒπ‘₯π‘₯𝑄𝑄 π‘₯π‘₯

βˆ€π‘₯π‘₯ 𝑃𝑃 π‘₯π‘₯ ∧ 𝑄𝑄 π‘₯π‘₯ ≑ βˆ€π‘₯π‘₯𝑃𝑃 π‘₯π‘₯ ∧ βˆ€π‘₯π‘₯𝑄𝑄 π‘₯π‘₯

βˆ€π‘₯π‘₯𝑃𝑃 π‘₯π‘₯ ∨ βˆ€π‘₯π‘₯𝑄𝑄 π‘₯π‘₯ β‡’ βˆ€π‘₯π‘₯ 𝑃𝑃 π‘₯π‘₯ ∨ 𝑄𝑄 π‘₯π‘₯

βˆƒπ‘₯π‘₯ 𝑃𝑃 π‘₯π‘₯ ∧ 𝑄𝑄 π‘₯π‘₯ β‡’ βˆƒπ‘₯π‘₯𝑃𝑃 π‘₯π‘₯ ∨ βˆƒπ‘₯π‘₯𝑄𝑄 π‘₯π‘₯22Β© S. Turaev, CSC 1700 Discrete Mathematics

Page 23: Logic (slides)

Algebraic PropertiesTautologies:

𝑝𝑝 β‡’ π‘žπ‘ž ∧ π‘žπ‘ž β‡’ π‘Ÿπ‘Ÿ β‡’ (𝑝𝑝 β‡’ π‘Ÿπ‘Ÿ)23Β© S. Turaev, CSC 1700 Discrete Mathematics

𝑝𝑝 ∧ π‘žπ‘ž β‡’ 𝑝𝑝

𝑝𝑝 β‡’ 𝑝𝑝 ∨ π‘žπ‘ž

~𝑝𝑝 β‡’ 𝑝𝑝 β‡’ π‘žπ‘ž

𝑝𝑝 ∧ 𝑝𝑝 β‡’ π‘žπ‘ž β‡’ π‘žπ‘ž

~π‘žπ‘ž ∧ 𝑝𝑝 β‡’ π‘žπ‘ž β‡’ ~𝑝𝑝

𝑝𝑝 ∧ π‘žπ‘ž β‡’ π‘žπ‘ž

π‘žπ‘ž β‡’ 𝑝𝑝 ∧ π‘žπ‘ž

~ 𝑝𝑝 β‡’ π‘žπ‘ž β‡’ 𝑝𝑝

~𝑝𝑝 ∧ 𝑝𝑝 ∨ π‘žπ‘ž β‡’ π‘žπ‘ž