Skip to document
This is a Premium Document. Some documents on Studocu are Premium. Upgrade to Premium to unlock it.

Propositional Logic Discrete Notes for Fall 2021

Propositional Logic Discrete Notes for Fall 2021
Course

Discrete Mathematics And Probability Theory (COMPSCI 70)

48 Documents
Students shared 48 documents in this course
Academic year: 2021/2022
Uploaded by:
Anonymous Student
This document has been uploaded by a student, just like you, who decided to remain anonymous.
Technische Universiteit Delft

Comments

Please sign in or register to post comments.

Preview text

EECS 70 Discrete Mathematics and Probability Theory

Fall 2021 Note 2

1 Proofs

In science, evidence is accumulated through experiments to assert the validity of a statement. Mathematics, in contrast, aims for a more absolute level of certainty. A mathematical proof provides a means forguar- anteeingthat a statement is true. Proofs are very powerful and are in some ways like computer programs. Indeed, there is a deep historic link between these two concepts that we will touch upon in this course — the invention of computers is intimately tied to the exploration of the idea of a mathematical proof about a century ago.

So what types of “computer science-related” statements might we want to prove? Here are two examples: (1) Does programPhalt on every input? (2) Does programPcorrectly compute the functionf(x), i. does it outputf(x)on inputx, for everyx? Note that each of these statements refers to the behavior of a program oninfinitelymany inputs. For such a statement, we can try to provideevidencethat it is true by testing that it holds for many values ofx. Unfortunately, this does not guarantee that the statement holds for the infinitely many values of x that we did not test! To be certain that the statement is true, we must provide a rigorous proof.

So what is a proof? A proof is a finite sequence of steps, calledlogical deductions, which establishes the truth of a desired statement. In particular, the power of a proof lies in the fact that usingfinitemeans, we can guarantee the truth of a statement withinfinitelymany cases.

More specifically, a proof is typically structured as follows. Recall that there are certain statements, called axioms or postulates, that we accept without proof (we have to start somewhere). Starting from these axioms, a proof consists of a sequence of logical deductions: Simple steps that apply the rules of logic. This results in a sequence of statements where each successive statement is necessarily true if the previous statements were true. This property is enforced by the rules of logic: Each statement follows from the previous statements. These rules of logic are a formal distillation of laws that were thought to underlie human thinking. They play a central role in the design of computers, starting with digital logic design or the fundamental principles behind the design of digital circuits. At a more advanced level, these rules of logic play an indispensable role in artificial intelligence, one of whose ultimate goals is to emulate human thought on a computer.

Organization of this note. We begin in Section 2 by setting notation and stating basic mathematical facts used throughout this note. We next introduce four different proof techniques: Direct proof (Section 3), proof by contraposition (Section 4), proof by contradiction (Section 5), and proof by cases (Section 6). We then briefly discuss common pitfalls in and stylistic advice for proofs (Sections 7 and 8, respectively). We close with exercises in Section 9.

2 Notation and basic facts

In this note, we use the following notation and basic mathematical facts. LetZdenote the set of integers, i={...,− 2 ,− 1 , 0 , 1 , 2 ,...}, andNthe set of natural numbersN={ 0 , 1 , 2 ,...}. Recall that the sum or product of two integers is an integer, i. the set of integers isclosedunder addition and multiplication. The

set of natural numbers is also closed under addition and multiplication.

Given integersaandb, we say thatadividesb(denoteda|b) iff there exists an integerqsuch thatb=aq. For example, 2|10 because there exists an integerq=5 such that 10= 5 ·2. We say a natural numberpis primeif it is divisible only by 1 and itself.

Finally, we use the notation :=to indicate a definition. For example,q:=6 defines variableqas having value 6.

3 Direct Proof

With the language of propositional logic from Note 0 under our belts, we can now discuss proof techniques, and the real fun can begin. Are you ready? If so, here is our first technique, known as adirect proof. Throughout this section, keep in mind that our goal is give clear and concise proofs. Let’s begin with a very simple example.

Theorem 2 any a,b,c∈Z, if a|b and a|c, then a|(b+c).

Sanity check!LetP(x,y)denote “x|y”. Convince yourself that the statement above is equivalent to(∀a,b,c∈ Z) (P(a,b)∧P(a,c)) =⇒P(a,b+c)).

At a high level, a direct proof proceeds as follows. For eachx, the proposition we are trying to prove is of the formP(x) =⇒Q(x). A direct proof of this starts by assumingP(x)for a generic value ofxand eventually concludesQ(x)through a chain of implications:

Direct Proof Goal: To proveP=⇒Q. Approach:AssumeP .. . ThereforeQ

Proof of Theorem 2 thata|banda|c, i. there exist integersq 1 andq 2 such thatb=q 1 aand c=q 2 a. Then,b+c=q 1 a+q 2 a= (q 1 +q 2 )a. Since theZis closed under addition, we conclude that (q 1 +q 2 )∈Z, and soa|(b+c), as desired.

Easy as pie, right? But wait, earlier we said Theorem 2 was equivalent to(∀a,b,c∈Z) (P(a,b)∧ P(a,c)) =⇒P(a,b+c)); where in the proof above did we encounter the∀quantifier? The key insight is that the proof did not assume anyspecificvalues fora,b, andc; indeed, our proof holds for arbitrary a,b,c∈Z! Thus, we have indeed proven the desired claim.

Sanity check!Give a direct proof of the following statement: For anya,b,c∈Z, ifa|banda|c, thena|(b−c).

Let’s try something a little more challenging.

4 Proof by Contraposition

We now move to our second proof technique. Recall from our discussion on propositional logic that any implicationP=⇒Qis equivalent to its contrapositive¬Q=⇒ ¬P. Yet, sometimes¬Q=⇒ ¬Pcan be much simpler to prove thanP=⇒Q. Thus, a proof by contraposition proceeds by proving¬Q=⇒ ¬Pinstead of P=⇒Q.

Proof by Contraposition Goal: To proveP=⇒Q. Approach:Assume¬Q. .. . Therefore¬P Conclusion:¬Q=⇒ ¬P, which is equivalent toP=⇒Q.

Consider now the following theorem:

Theorem 2 n be a positive integer and let d divide n. If n is odd then d is odd.

Proving this via the technique of direct proof seems difficult; we would assumenis odd in Step 1, but then what? An approach via contraposition, on the other hand, turns out to be much easier.

Sanity check!What is the contrapositive of Theorem 2? (Answer: Ifdis even, thennis even.)

Proof of Theorem 2 proceed by contraposition. Assume thatdis even. Then, by definition,d= 2 k for somek∈Z. Becaused|n,n=dl, for somel∈Z. Combining these two statements, we haven=dl= ( 2 k)l= 2 (kl). We conclude thatnis even.

Note that this time, the first line of our proof stated our proof technique — this is good practice for any proof, similar to how commenting code is good practice when programming. Stating your proof technique like this is an enormous aid to your reader in understanding where your proof will go next. (Let us not forget that a reader who understands your proof, such a teaching assistant or instructor, is much more likely to give you a good grade for it!)

As another illustration of proof by contraposition, we will prove a famous theorem called the Pigeonhole Principle. Although the statement of the theorem may seem simple, it has surprising consequences.

Theorem 2(Pigeonhole Principle).Let n and k be positive integers. Place n objects into k boxes. If n>k, then at least one box must contain multiple objects.

The name of the theorem comes from imagining that thenobjects are pigeons and we are trying to place them in pigeonholes.

Proof of Theorem 2 proceed by contraposition. If all boxes contain at most one object, then the number of objects is at most the number of boxes, i.,n≤k.

The utility of the theorem stems from the fact that it holds regardless of theconfigurationof the objects in the box. In situations where the objects are placed in the boxes in a complicated way, the conclusions of the theorem can be non-trivial.

Here is an example. A quick search on the Internet reveals that the number of hairs on the human head is roughly, on average, 100000. So, we may be reasonably confident that no human has more than 500000 hairs on his or her head. On the other hand, the population of San Francisco (as of 2016) exceeds 800000. If we think of the residents of San Francisco as “pigeons” and the number of hairs on a resident’s head as the “box” into which he or she falls, then the Pigeonhole Principle allows us to conclude the intriguing fact thatthere are two people in San Francisco with exactly the same number of hairs on their heads!

5 Proof by Contradiction

Of all the proof techniques we discuss in this note, it’s perhaps hardest to resist the appeal of this one; after all, who wouldn’t want to use a technique known asreductio ad absurdum, i. reduction to an absurdity? The idea in a proof by contradiction is to assume that the claim you wish to prove isfalse(yes, this seems backwards, but bear with us). Then, you show that this leads to a conclusion which is utter nonsense: A contradiction. Hence, you conclude that your claim must in fact have been true.

Sanity check!A proof by contradiction relies crucially on the fact that if a proposition is not false, then it must be true. Which law from a previous lecture embodied this black or white interpretation of a statement?

Proof by Contradiction Goal: To proveP. Approach:Assume¬P. .. . R .. . ¬R Conclusion:¬P=⇒ ¬R∧R, which is a contradiction. Thus,P.

If you are not convinced by the intuitive explanation thus far as to why proof by contradiction works, here is the formal reasoning: A proof by contradiction shows that¬P=⇒ ¬R∧R≡False. The contrapositive of this statement is hence True=⇒P.

Let us now take this proof technique on a trial run. Note that in doing so, we are continuing a long- standing legacy — the proof of the theorem below dates back more than 2000 years to the ancient Greek mathematician, Euclid of Alexandria! 1

Theorem 2 are infinitely many prime numbers.

To appreciate the power of contradiction, let us pause for a moment to ponder how we might try to prove

1 It is perhaps worth pausing here to appreciate the true scale of this statement — after all, how many aspects of our human heritage remain relevant after multiple millenia? Music? Fashion? All of these are quickly outdated with time. But mathematics is, in a sense, timeless.

6 Proof by Cases

Here is a proof to tickle your fancy; it relies on another proof technique known as proof bycases, which we will touch on informally in this section. Specifically, the idea behind a proof by cases is as follows: Sometimes when we wish to prove a claim, we don’t know which of a set of possible cases is true, but we know thatat least oneof the cases is true. What we can do then is to prove the result inbothcases; then, clearly the general statement must hold.

Theorem 2 exist irrational numbers x and y such that xyis rational.

Proof. We proceed by cases. Note that the statement of the theorem is quantified by an existential quantifier: Thus, to prove our claim, it suffices to demonstrate a singlexandysuch thatxyis rational. To do so, let x=

2 andy=

  1. Let us divide our proof into two cases, exactly one of which must be true:

(a)

2

√ 2 is rational, or

(b)

2

√ 2 is irrational.

(Case (a)) Assume first that

2

√ 2 is rational. But this immediately yields our claim, sincexandyare irrational numbers such thatxyis rational.

(Case (b)) Assume now that

2

√ 2 is irrational. Our first guess forxandywas not quite right, but now we

have a new irrational number to play with,

2

√ 2 . So, let’s try settingx=

2

√ 2 andy=

  1. Then,

xy=

(√

2

√ 2

)√ 2

=

2

√ 2 √ 2 =

2

2 = 2 ,

where the second equality follows from the axiom(xy)z=xyz. But now we again started with two irrational numbersxandyand obtained rationalxy.

Since one of case (a) or case (b) must hold, we thus conclude that the statement of Theorem 2 is true.

Before closing, let us point out a peculiarity of the proof above. What were theactualnumbersxandy

satisfying the claim of Theorem 2? Were theyx=

2 andy=

2? Orx=

2

√ 2 andy=

2? Well, since we did a case analysis, it’s not clear which of the two choices is actually the correct one. In other words, we have just demonstrated something rather remarkable known as anon-constructiveproof: We’ve proven that some objectXexists, but without explicitly revealing whatXitself is!

7 Common Errors When Writing Proofs

The ability to write clean and concise proofs is a remarkable thing, and is arguably among the highest forms of intellectual enlightenment one can achieve. It requires your mind to critically reflect on its own inner workings (i. your thought processes), and reorganize them into a coherent and logical sequence of thoughts. In other words, your mind is improving itself at a very fundamental level, far transcending the boundaries of computer science or any particular area of study. The benefits of this training will touch every aspect of your life as you know it; indeed, it will shape the way you approach life itself.

As with any such fundamental achievement, developing the ability to write rigorous proofs is likely among the most difficult learning challenges you will face in university, so do not despair if it gives you trouble;

you are not alone. There is simply no substitute here for lots and lots of practice. To help get you started on your way, we now raise some red flags regarding common pitfalls in composing proofs. Let us begin with a simple, but common error.

Claim:− 2 =2.

Proof?Assume− 2 =2. Squaring both sides, we have(− 2 ) 2 = 22 , or 4=4, which is true. We conclude that− 2 =2, as desired.♠

The theorem is obviously false, so what did we do wrong? Our arithmetic is correct, and each step rigorously follows from the previous step. So, the error must lie in the very beginning of the proof, where we made a brazen assumption: That− 2 =2. But wait, wasn’t this the very statement we were trying to prove? Exactly. In other words, to prove the statementP≡“− 2 =2”, we just proved thatP=⇒True, which is not the same as provingP. Lesson #1: When writing proofs, do not assume the claim you aim to prove!

Lesson #2 is about the number zero: In particular, never forget to consider the case where your variables take on the value 0. Otherwise, this can happen:

Claim: 1 =2.

Proof?Assume thatx=yfor integersx,y∈Z. Then,

x 2 −xy = x 2 −y 2 (sincex=y) x(x−y) = (x+y)(x−y) x = x+y (divide both sides byx−y) x = 2 x.

Settingx=y=1 yields the claim.♠

But, clearly 1 6 =2, unless your grade school teachers were lying to you. Where did we go wrong? In deriving the third equality, we divided by(x−y). What is the value of(x−y)in our setting? Zero. Dividing by zero is not well-defined; thus the third equality does not hold.

Lesson #3 says to be careful when mixing negative numbers and inequalities. For example:

Claim: 4 ≤1.

Proof?We know that− 2 ≤1; squaring both sides of this inequality yields 4≤1.♠

Sanity check!To see why this proof fails, ask yourself this: Ifa≤b, is it necessarily true that|a|≤|b|? Can you give a counterexample?

In addition, do not forget that multiplying an inequality by a negative number flips the direction of the inequality! For example, multiplying both sides of− 2 <5 by−1 yields 2>−5, as you would expect.

8 Style and substance in proofs

We conclude with some general words of advice. First, get in the habit of thinking carefully before you write down the next sentence of your proof. If you cannot explain clearly why the step is justified, you are making a leap and you need to go back and think some more. In theory, each step in a proof must be justified by appealing to a definition or general axiom. In practice the depth to which one must do this is a matter of taste. For example, we could break down the step, “Sinceais an integer,( 2 a 2 + 2 a)is an integer,” into

Was this document helpful?
This is a Premium Document. Some documents on Studocu are Premium. Upgrade to Premium to unlock it.

Propositional Logic Discrete Notes for Fall 2021

Course: Discrete Mathematics And Probability Theory (COMPSCI 70)

48 Documents
Students shared 48 documents in this course
Was this document helpful?

This is a preview

Do you want full access? Go Premium and unlock all 9 pages
  • Access to all documents

  • Get Unlimited Downloads

  • Improve your grades

Upload

Share your documents to unlock

Already Premium?
EECS 70 Discrete Mathematics and Probability Theory
Fall 2021 Note 2
1 Proofs
In science, evidence is accumulated through experiments to assert the validity of a statement. Mathematics,
in contrast, aims for a more absolute level of certainty. A mathematical proof provides a means for guar-
anteeing that a statement is true. Proofs are very powerful and are in some ways like computer programs.
Indeed, there is a deep historic link between these two concepts that we will touch upon in this course
the invention of computers is intimately tied to the exploration of the idea of a mathematical proof about a
century ago.
So what types of “computer science-related” statements might we want to prove? Here are two examples:
(1) Does program Phalt on every input? (2) Does program Pcorrectly compute the function f(x), i.e. does
it output f(x)on input x, for every x? Note that each of these statements refers to the behavior of a program
on infinitely many inputs. For such a statement, we can try to provide evidence that it is true by testing that it
holds for many values of x. Unfortunately, this does not guarantee that the statement holds for the infinitely
many values of x that we did not test! To be certain that the statement is true, we must provide a rigorous
proof.
So what is a proof? A proof is a finite sequence of steps, called logical deductions, which establishes the
truth of a desired statement. In particular, the power of a proof lies in the fact that using finite means, we
can guarantee the truth of a statement with infinitely many cases.
More specifically, a proof is typically structured as follows. Recall that there are certain statements, called
axioms or postulates, that we accept without proof (we have to start somewhere). Starting from these axioms,
a proof consists of a sequence of logical deductions: Simple steps that apply the rules of logic. This results in
a sequence of statements where each successive statement is necessarily true if the previous statements were
true. This property is enforced by the rules of logic: Each statement follows from the previous statements.
These rules of logic are a formal distillation of laws that were thought to underlie human thinking. They
play a central role in the design of computers, starting with digital logic design or the fundamental principles
behind the design of digital circuits. At a more advanced level, these rules of logic play an indispensable
role in artificial intelligence, one of whose ultimate goals is to emulate human thought on a computer.
Organization of this note. We begin in Section 2 by setting notation and stating basic mathematical facts
used throughout this note. We next introduce four different proof techniques: Direct proof (Section 3), proof
by contraposition (Section 4), proof by contradiction (Section 5), and proof by cases (Section 6). We then
briefly discuss common pitfalls in and stylistic advice for proofs (Sections 7 and 8, respectively). We close
with exercises in Section 9.
2 Notation and basic facts
In this note, we use the following notation and basic mathematical facts. Let Zdenote the set of integers,
i.e. Z={...,2,1,0,1,2,...}, and Nthe set of natural numbers N={0,1,2,...}. Recall that the sum or
product of two integers is an integer, i.e. the set of integers is closed under addition and multiplication. The
EECS 70, Fall 2021, Note 2 1

Why is this page out of focus?

This is a Premium document. Become Premium to read the whole document.

Why is this page out of focus?

This is a Premium document. Become Premium to read the whole document.

Why is this page out of focus?

This is a Premium document. Become Premium to read the whole document.