# Logic Discrete Math

CHAPTER 2

LOGIC

Introduction:

Logic is the discipline that deals with the methods of reasoning. On an elementary level, logic provides rules and techniques for determining whether a given argument is valid. Logical reasoning is used in Computer Science to verify (menentusahkan) the correctness (kesahihan) of programs and to prove (membuktikan) theorems.

2.1Proposition and Logical Operations

•Statement or proposition → declarative sentence that is either true or false, but not both

Example 1: Which of the following are statements? (a)The earth is round (b)3 + 7 = 8

(c)Do you speak English? (d)3 – x = 5

(e)Take two aspirins

(f)The temperature is 35oC

(g)The sun will come out tomorrow

2.1.1 Logical connectives and compound statements

•In logic, the letters p, q, r… denote propositional variables; that is, variables that can be replaced by statements

Example 2:p: The sun is shining today

q: It is cold

r: 3 x 4 = 16

•Statements or propositional variables can be combined by logical connectives(pengaitlogik)toobtainedcompound statements (pernyataan majmuk)

Example 3:Statements p and q in example 2 can be combined by the connective and to form the compound statement

p and q: The sun is shining today and it is cold

•The truth value of a compound statement depends only on the truth values of the statements being combined and on the types of connectives being used

ϖ If p is a statement, the negation (peniadaan) of p is the statement not p, denoted by ~p

Example 4:p: today is raining

~p: today is not raining

•If p is true, then ~p is false, and if p is false, then ~p is true

•Truth table → a table that gives the truth values of a compound statement in terms of its component parts

•The truth value of ~p relative to p is given in table 2.1

T = true

F = False

Example 5:Give the negation of the following statements: (a)q: 2 + 3 > 1 (b)r: It is cold

Solution:

(a)~q: 2 + 3 is not greater than 1. That is, ~q: 2 + 3 ≤ 1. since q is true in this case, ~q is false (b)~r: It is not the case that it is cold. More simply, ~r: It is not cold

ϖ If p and q are statements, the conjunction of p and q is the compound statement “p and q”, denoted by p ∧ q

•The compound statement p ∧ q is true when both p and q are true; otherwise it is false

•The truth values of p ∧ q in terms of the truth values of p and q are given in the truth tables shown in Table 2.2

|TABLE 2.2 |

|p |q | |

| | |p ∧ q |

|T T F F |T F T F |T F F F |

Example 6:Form the conjunction of p and q for each of the following: |(a) |p: It is snowing |q: I am cold | |(b) |p: 2 < 3 |q: -5 > -8 | |(c) |p: It is snowing |q: 3 < 5 |

Solution:

(a)p ∧ q: It is snowing and I am cold

(b)p ∧ q: 2 < 3 and -5 > -8

(c)p ∧ q: It is snowing and 3 < 5

ϖ If p and q are statements, the disjunction of p and q is the compound statement “p or q”, denoted by p ∨ q

•The compound statement p ∨ q is true if at least one of p and q is true; it is false when both p and q are false

•The truth values of p ∨ q are given in the truth tables shown in Table 2.3

|TABLE 2.3 |

|p |q | |

| |...

Please join StudyMode to read the full document