Top Banner
CS 1050 (Rosen Section 1.1, 1.2)
28

Bab 1 proposisi

Jul 30, 2015

Download

Education

Dhan junkie
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Bab 1 proposisi

CS 1050(Rosen Section 1.1, 1.2)

Page 2: Bab 1 proposisi

PropositionA proposition is a statement that is either true

or false, but not both.Atlanta was the site of the 1996 Summer

Olympic games.1+1 = 23+1 = 5What will my CS1050 grade be?

Page 3: Bab 1 proposisi

Definition 1. Negation of pLet p be a proposition. The statement “It is not the case that p” is also a proposition, called the “negation of p” or ¬p (read “not p”)

Table 1. The Truth Table for theNegation of a Proposition

p ¬p

T FF T

p = The sky is blue.

p = It is not the case that the sky is blue.

p = The sky is not blue.

Page 4: Bab 1 proposisi

Definition 2. Conjunction of p and qLet p and q be propositions. The proposition “p and q,” denoted by pq is true when both p and q are true and is false otherwise. This is called the conjunction of p and q.

Table 2. The Truth Table for the Conjunction of two propositions

p q pq

T T T T F FF T FF F F

Page 5: Bab 1 proposisi

Definition 3. Disjunction of p and q

Let p and q be propositions. The proposition “p or q,” denoted by pq, is the proposition that is false when p and q are both false and true otherwise.

Table 3. The Truth Table for the Disjunction of two propositions

p q pq

T T T T F TF T TF F F

Page 6: Bab 1 proposisi

Definition 4. Exclusive or of p and q

Let p and q be propositions. The exclusive or of p and q, denoted by pq, is the proposition that is true when exactly one of p and q is true and is false otherwise.

Table 4. The Truth Table for the Exclusive OR of two propositions

p q pq

T T F T F TF T TF F F

Page 7: Bab 1 proposisi

Definition 5. Implication pqLet p and q be propositions. The implication pq is the proposition that is false when p is true and q is false, and true otherwise. In this implication p is called the hypothesis (or antecedent or premise) and q is called the conclusion (or consequence).

Table 5. The Truth Table for the Implication of pq.

p q pq

T T T T F FF T TF F T

Page 8: Bab 1 proposisi

ImplicationsIf p, then qp implies qif p,qp only if qp is sufficient for qq if pq whenever pq is necessary for p

Not the same as the if-then construct used in programming languages such as If p then S

Page 9: Bab 1 proposisi

ImplicationsHow can both p and q be false, and pq be true?•Think of p as a “contract” and q as its “obligation” that is only carried out if the contract is valid.•Example: “If you make more than $25,000, then you must file a tax return.” This says nothing about someone who makes less than $25,000. So the implication is true no matter what someone making less than $25,000 does.•Another example:

p: Bill Gates is poor.q: Pigs can fly.

pq is always true because Bill Gates is not poor. Another way of saying the implication is“Pigs can fly whenever Bill Gates is poor” which is true since neither p nor q is true.

Page 10: Bab 1 proposisi

Related ImplicationsConverse of

p q is q p

Contrapositive of p q is the proposition q p

Page 11: Bab 1 proposisi

Definition 6. BiconditionalLet p and q be propositions. The biconditional pq is the proposition that is true when p and q have the same truth values and is false otherwise. “p if and only if q, p is necessary and sufficient for q”

Table 6. The Truth Table for the biconditional pq.

p q pq

T T T T F FF T FF F T

Page 12: Bab 1 proposisi

Practice

You do not learn the simple things well.

If you learn the simple things well then the difficult things become easy.

If you do not learn the simple things well, then the difficult things will not become easy.

The difficult things become easy but you did not learn the simple things well.

You learn the simple things well but the difficult things did not become easy.

p: You learn the simple things well.q: The difficult things become easy.

p

pq

p q

q p

p q

Page 13: Bab 1 proposisi

Truth Table PuzzleSteve would like to determine the relative salaries of three coworkers using two facts (all salaries are distinct):

If Fred is not the highest paid of the three, then Janice is.

If Janice is not the lowest paid, then Maggie is paid the most.

Who is paid the most and who is paid the least?

Page 14: Bab 1 proposisi

p : Janice is paid the most.q: Maggie is paid the most.r: Fred is paid the most.s: Janice is paid the least.

p q r s rp s q (rp) (sq)T F F F T F FF T F T F T FF F T T T T TF T F F F T FF F T F T F F

Fred, Maggie, Janice

•If Fred is not the highest paid of the three, then Janice is.•If Janice is not the lowest paid, then Maggie is paid the most.

Page 15: Bab 1 proposisi

p : Janice is paid the most.q: Maggie is paid the most.r: Fred is paid the most.s: Janice is paid the least.

p q r s rp s q (rp) (sq)T F F F T T TF T F T F T FF F T T T F FF T F F F T FF F T F T T T

Fred, Janice, Maggie or Janice, Maggie, Fredor Janice, Fred, Maggie

•If Fred is not the highest paid of the three, then Janice is.•If Janice is the lowest paid, then Maggie is paid the most.

Page 16: Bab 1 proposisi

A computer bit has two possible values: 0 (false) and 1 (true). A variable is called a Boolean variable is its value is either true or false.

Bit operations correspond to the logical connectives: OR AND XOR

Information can be represented by bit strings, which are sequences of zeros and ones, and manipulated by operations on the bit strings.

Page 17: Bab 1 proposisi

0 1

0 0 1

1 1 1 0 1

0 0 0

1 0 1

0 1

0 0 1

1 1 0

Page 18: Bab 1 proposisi

Logical EquivalenceAn important technique in proofs is to

replace a statement with another statement that is “logically equivalent.”

Tautology: compound proposition that is always true regardless of the truth values of the propositions in it.

Contradiction: Compound proposition that is always false regardless of the truth values of the propositions in it.

Page 19: Bab 1 proposisi

Logically EquivalentCompound propositions P and Q are logically

equivalent if PQ is a tautology. In other words, P and Q have the same truth values for all combinations of truth values of simple propositions.

This is denoted: PQ (or by P Q)

Page 20: Bab 1 proposisi

Example: DeMorgansProve that (pq) (p q)pq (pq) (pq) p q (p q) T T

T F

F T

F F

T F F T F

T F F F F

T F T F F F T T T T

Page 21: Bab 1 proposisi

qp

(pq)

Illustration of De Morgan’s Law

Page 22: Bab 1 proposisi

p

p

Illustration of De Morgan’s Law

Page 23: Bab 1 proposisi

q

q

Illustration of De Morgan’s Law

Page 24: Bab 1 proposisi

qp

p q

Illustration of De Morgan’s Law

Page 25: Bab 1 proposisi

Prove that: p (q r) (p q) (p r)

p q r qr p(qr) pq pr (pq)(pr)T T T T T T T TT T F F T T T TT F T F T T T TT F F F T T T TF T T T T T T TF T F F F T F FF F T F F F T FF F F F F F F F

Page 26: Bab 1 proposisi

Prove: pq(pq) (qp)p q pq pq qp (pq)(qp)T T T T T TT F F F T FFT F T F FFF T T T T

We call this biconditional equivalence.

Page 27: Bab 1 proposisi

pT p; pF p Identity Laws

pT T; pF F Domination Laws

pp p; pp p Idempotent Laws

(p) p Double Negation Law

pq qp; pq qp Commutative Laws

(pq) r p (qr); (pq) r p (qr) Associative Laws

Page 28: Bab 1 proposisi

p(qr) (pq)(pr) Distribution Lawsp(qr) (pq)(pr)

(pq)(p q) De Morgan’s Laws(pq)(p q)

Miscellaneousp p T Or Tautologyp p F And Contradiction(pq) (p q) Implication Equivalence

pq(pq) (qp) Biconditional Equivalence