37
MATH 100 – Introduction to the Profession Logic Greg Fasshauer Department of Applied Mathematics Illinois Institute of Technology Fall 2012 [email protected] MATH 100 – ITP 1

MATH 100 – Introduction to the Profession - Logic

  • Upload
    others

  • View
    11

  • Download
    0

Embed Size (px)

Citation preview

Page 1: MATH 100 – Introduction to the Profession - Logic

MATH 100 ndash Introduction to the ProfessionLogic

Greg Fasshauer

Department of Applied MathematicsIllinois Institute of Technology

Fall 2012

fasshaueriitedu MATH 100 ndash ITP 1

Outline1

1 ldquoThatrsquos Logicrdquo

2 Logical Connectives

3 Conditionals and Biconditionals

4 Truth Tables

5 Looking Ahead Toward Proofs

6 Quantifiers

1Most of this discussion is closely linked to [Devlin Chapter 2] but we also discussconnections to MATLAB and Mathematica where appropriate

fasshaueriitedu MATH 100 ndash ITP 2

ldquoThatrsquos Logicrdquo

ldquoI know what yoursquore thinkingaboutrdquo said Tweedledum ldquobut itisnrsquot so nohowrdquoldquoContrariwiserdquo continuedTweedledee ldquoif it was so it mightbe and if it were so it would bebut as it isnrsquot it ainrsquot Thatrsquos logicrdquo

From ldquoThrough the Looking Glassrdquo by Lewis Carroll (see httpwwwonline-literaturecomcarrolllookingglass4for the complete Chapter 4 Tweedledee and Tweedledum)

fasshaueriitedu MATH 100 ndash ITP 3

ldquoThatrsquos Logicrdquo

Famous (western) Logicians

Artistole (right with Plato) Gottlob Frege George Boole

fasshaueriitedu MATH 100 ndash ITP 4

Logical Connectives

ldquoAndrdquo ldquoOrrdquo and ldquoNotrdquo

And used when two ldquosentencesrdquo hold simultaneouslyMathematical notation and ampIn words φ and ψ is T only if both φ and ψ are TExample2(in MATLAB)is_true = (3ltpi) ampamp (4gtpi)is_true = (3ltpi) amp (4gtpi)is_true = and(3ltpi 4gtpi)

Example (in Mathematica)(3ltPi) ampamp (4gtPi)And[3ltPi 4gtPi]

Truth table httpwwwwolframalphacominputi=P+2626+Q

2It is recommended that you run all the examples using either MATLAB orMathematica (or possibly Wolfram Alpha)

fasshaueriitedu MATH 100 ndash ITP 5

Logical Connectives

Or used when either one of two ldquosentencesrdquo holds (inclusiveldquoorrdquo)

Mathematical notation or |In words φ or ψ is T if at least one of φ and ψ is TExample (in MATLAB)is_true = (pilt3) || (4ltpi)is_true = (pilt3) | (4ltpi)is_true = or(pilt3 4ltpi)

Example (in Mathematica)(Pilt3) || (4ltPi)Or[Pilt3 4ltPi]

Truth table httpwwwwolframalphacominputi=P+||+Q

fasshaueriitedu MATH 100 ndash ITP 6

Logical Connectives

Not negates the ldquosentencerdquoMathematical notation not simIn words notφ is T if φ is FExample (in MATLAB)is_true = ~(3ltpi)is_true = not(3ltpi)

Example (in Mathematica)(3ltPi)Not[3ltPi]

Truth tableφ notφT FF T

fasshaueriitedu MATH 100 ndash ITP 7

Logical Connectives

Example (Negating a statement)

Being a German who loves a good beer Irsquove been asked by myGerman friends how I can live in the US claiming

All American beer tastes dreadful

Obviously this is not true So how do I reply if I want to negate thisstatement

1 Not all American beer tastes dreadful2 All non-American (ie German) beer tastes great3 All American beer tastes great4 All American beer does not taste dreadful5 At least one American beer tastes great6 At least one American beer does not taste dreadful

We will see below which of these statements is logically mostappropriate

fasshaueriitedu MATH 100 ndash ITP 8

Logical Connectives

Example (Leap year calculation from Ch 3 [ExM])Using this year (1st element of vector returned by clock function)

c = clock y = c(1)mod(y4) == 0 ampamp mod(y100) ~= 0 || mod(y400) == 0

Using two years at once

y = [2000 2100]mod(y4) == 0 ampamp mod(y100) ~= 0 || mod(y400) == 0

leads to an error Replace the ldquoshort-circuitrdquoa operators ampamp and || bythe ldquoelementwiserdquo operators amp and |

y = [2000 2100]mod(y4) == 0 amp mod(y100) ~= 0 | mod(y400) == 0

Note and and or have ldquoelementwiserdquo interpretations notldquoshort-circuitrdquo not doesnrsquot care Try it

aThe 2nd operand eg mod(y100) is evaluated only when the result isnot fully determined by the 1st operand eg mod(y4)

fasshaueriitedu MATH 100 ndash ITP 9

Logical Connectives

Example (Logical operations and arrays in MATLAB)R=rand(43)(R gt 03) amp (R lt 07)

Note here the ldquoelementwiserdquo operator is required

Example (Logical operations and find in MATLAB)find(R gt 03 amp R lt 07)

Note find goes through matrix in column-major order and returnsvector of indicesMore detailed

[rowcolval] = find(R gt 03 amp R lt 07)

fasshaueriitedu MATH 100 ndash ITP 10

Conditionals and Biconditionals

Conditional for logical implications if thenMathematical notation rArrrarrExample3 (in MATLAB)x = -3if x lt 0

abs_x = -xelse

abs_x = xendor ndash if you want a function ndash using logical multipliersabs = (x) (xlt0)(-x) + (xgt=0)xabs(-3) abs(4)Example (in Mathematica)abs[x_] = If[x lt 0 -x x]abs[-3]abs[-4]

3This computer code use is different than the mathematical use since we canrsquotassign a truth value to the ldquoif thenrdquo code fragment

fasshaueriitedu MATH 100 ndash ITP 11

Conditionals and Biconditionals

Truth tablehttpwwwwolframalphacominputi=P+Implies+QImportant concepts for all of mathematics

φ implies ψif φ then ψφ is sufficient for ψφ only if ψψ if φψ whenever φψ is necessary for φ

fasshaueriitedu MATH 100 ndash ITP 12

Conditionals and Biconditionals

Are conditionals confusingProbably so Consider the following interpretation of the truth table4

If Springfield is the capital of Illinois then Springfield is the capitalof Illinois (TrArr T is T) OKIf Springfield is the capital of Illinois then Chicago is the capital ofIllinois (TrArr F is F) This better be falseIf Chicago is the capital of Illinois then Springfield is the capital ofIllinois (FrArr T is T) WeirdIf Chicago is the capital of Illinois then Rockford is the capital ofIllinois (FrArr F is T) Very weird

Read (carefully) the discussion in [Devlin pp 18-19]Conditional in words

φrArr ψ is only then not T if ψ is F in spite of φ being T

More colloquially φrArr ψ is considered true until proven false(ldquoinnocent until proven guiltyrdquo)

4The state capital of Illinois is Springfieldfasshaueriitedu MATH 100 ndash ITP 13

Conditionals and Biconditionals

Another example for the conditional

Letrsquos consider the following promise I make to you

If you average 85 or above in this class then you will get anA

At the end of the semester we could have various outcomesYou average 90 and get an A (Trarr T is T ie I kept my promise)You average 90 and get a B (Trarr F is F ie I broke mypromise)You average 80 and get an A (Frarr T is T ie I didnrsquot break mypromise uml )You average 80 and get a B (Frarr F is T ie I didnrsquot break mypromise ndash and you received what you expected)

This illustrates perfectly that scoring 85 or higher was sufficient foran A but not necessary

fasshaueriitedu MATH 100 ndash ITP 14

Conditionals and Biconditionals

And a mathematical example

Letrsquos assume that n is a positive integer Then

(n is a perfect square with last digit 7)rArr (n is a prime number)

is a true statementThis is so because we have both (by definition)

FrArr T is TFrArr F is T

and we know that no perfect square ends in 7 (so it is irrelevant that allwe know about n is that it is a positive integer)

RemarkStatements like these (and the earlier ones about the IL state capital)do not agree with common sense Usually we work with statementsthat are in some logical context (see the discussion of causation in[Devlin p 17])

fasshaueriitedu MATH 100 ndash ITP 15

Conditionals and Biconditionals

Biconditional for logical equivalence if and only ifMathematical notation hArrharrDoes not make sense in MATLAB (only in SymbolicToolbox)Example (in Mathematica)Equivalent[3ltPi 4gtPi]

Truth table httpwwwwolframalphacominputi=P+Equivalent+Q

fasshaueriitedu MATH 100 ndash ITP 16

Truth Tables

Further insights via truth tables

Example

Prove not(φ and ψ) is equivalent to (notφ) or (notψ)

φ ψ φ and ψ not(φ and ψ)T T T FT F F TF T F TF F F T

φ ψ notφ notψ (notφ) or (notψ)T T F F FT F F T TF T T F TF F T T T

fasshaueriitedu MATH 100 ndash ITP 17

Truth Tables

Example (Exercise 229(a) in [Devlin])

Prove not(φrArr ψ) is equivalent to φ and (notψ)

φ ψ φrArr ψ not(φrArr ψ)

T T T FT F F TF T T FF F T F

φ ψ φ and (notψ)T T FT F TF T FF F F

How can we then interpret φrArr ψ in terms of and or and not (notφ) or ψ

fasshaueriitedu MATH 100 ndash ITP 18

Truth Tables

Example (Wason Selection Task Exercise 2220 in [Devlin])

Assuming each card has a letter on one face and a numberon the other which card(s) do you have to turn over in orderto test the truth of the proposition that if a card has a vowel onone face then its opposite shows an even numbera

Answer Cards ldquoErdquo and ldquo7rdquo

Checking the other side of ldquoErdquo is obvious (we need an even number toshow for the proposition to hold)It doesnrsquot matter whatrsquos on the other side of ldquoKrdquo (the proposition makesno claim about cards with a consonant)Nor does it matter whatrsquos on the other side of ldquo4rdquo (if itrsquos a vowel great ifitrsquos a consonant no rule was violated either)We need to check ldquo7rdquo (if a vowel shows up the proposition is false)

aOnly about 10 of the population get this rightfasshaueriitedu MATH 100 ndash ITP 19

Looking Ahead Toward Proofs

When we do a mathematical proof then we need to decide whether acertain mathematical statement is logically true or not

The direct approach (known as modus ponens ie method byaffirmation) is to conclude

If φ and (φrArr ψ) then ψ

Example

Show that if n is an even integer then (minus1)n = 1

Proofn is an arbitrary even integer so n = 2k for some integer k But then

(minus1)n = (minus1)2k =((minus1)2︸ ︷︷ ︸

=1

)k= 1k = 1

fasshaueriitedu MATH 100 ndash ITP 20

Looking Ahead Toward Proofs

Contrapositive

Sometimes it is difficult to prove an implication directly In this case wecan try to show that the contrapositive of the conditional holds ie weuse (see HW 2211)

φrArr ψ is equivalent to (notψ)rArr (notφ)

and conclude (modus tollens method by denial)

If φ and ((notψ)rArr (notφ)) then ψ

Note that this has nothing to do with proof by contradiction (more onthat later)

Example

Conditional If you average 85 or above then you will get an AContrapositive If you donrsquotdidnrsquot get an A then you donrsquotdidnrsquot average85 or above

fasshaueriitedu MATH 100 ndash ITP 21

Looking Ahead Toward Proofs

Converse

Do not confuse the contrapositive of a conditional with its converse

If φrArr ψ then its converse is ψ rArr φ

There is no logical connection between a conditional and its converse

The only link is that if both are true then the biconditional holds ie

(φrArr ψ) and (ψ rArr φ) is equivalent to (φhArr ψ)

Example

Conditional If you average 85 or above then you will get an AContrapositive If you donrsquotdidnrsquot get an A then you donrsquotdidnrsquot average85 or aboveConverse If you getgot an A then you averageaveraged 85 or above

Note The converse assures us that scoring 85 or above isnecessary for an A (not so good for you _)

fasshaueriitedu MATH 100 ndash ITP 22

Looking Ahead Toward Proofs

Also do not confuse a statement with itsconverse

More Lewis CarrolllsquoNot the same thing a bitrsquo saidthe Hatter lsquoYou might just as wellsay that ldquoI see what I eatrdquo is thesame thing as ldquoI eat what I seerdquorsquo

From ldquoAlice in Wonderlandrdquo by Lewis Carroll (seehttpwwwonline-literaturecomcarrollalice7 forthe complete Chapter 7 A Mad Tea Party)

fasshaueriitedu MATH 100 ndash ITP 23

Looking Ahead Toward Proofs

Inverse

One could also consider the contrapositive of the converse5 of aconditional also known as the inverse of the conditional

Example

Conditional If you average 85 or above then you will get an AContrapositive If you donrsquotdidnrsquot get an A then you donrsquotdidnrsquot average85 or aboveConverse If you getgot an A then you averageaveraged 85 or aboveInverse If you donrsquot average 85 or above then you wonrsquot get an A

Note The inverse (which is equivalent to the converse) perhaps showseven better that scoring 85 or above is necessary for an A

5Or equivalently the converse of the contrapositivefasshaueriitedu MATH 100 ndash ITP 24

Looking Ahead Toward Proofs

Negated Conditional

You also might be tempted to confuse the contrapositive of aconditional with its negation As we showed earlier the negation of aconditional

not(φrArr ψ) is equivalent to φ and (notψ)

which is different from the contrapositive of φrArr ψ

(notψ)rArr (notφ)

The latter would be equivalent to (verify this)

(notφ) or ψ

fasshaueriitedu MATH 100 ndash ITP 25

Looking Ahead Toward Proofs

We just said that the negated conditional is

φ and (notψ)

Example

Conditional If you average 85 or above then you will get an AContrapositive If you donrsquotdidnrsquot get an A then you donrsquotdidnrsquot average85 or aboveConverse If you getgot an A then you averageaveraged 85 or aboveInverse If you donrsquot average 85 or above then you wonrsquot get an ANegated conditional You average 85 or above and you wonrsquot get an A

Note The negated conditional is only true if the conditional is falseie in the case when I break my promise

fasshaueriitedu MATH 100 ndash ITP 26

Looking Ahead Toward Proofs

The perverse cube of reversed implications

notφrArr notψφornotψ

larrrarr notψ rArr notφψornotφ

l lφrArr ψnotφorψ

larrrarr ψ rArr φnotψorφ

l Negation l

not (notφrArr notψ)notφandψ

middot middot middot not (notψ rArr notφ)notψandφ

l lnot (φrArr ψ)

φandnotψmiddot middot middot not (ψ rArr φ)

ψandnotφ

Create the truth tables for all these statements to verify their relations

fasshaueriitedu MATH 100 ndash ITP 27

Quantifiers

ldquoFor allrdquo and ldquothere existsrdquo

Universal quantifier forallx ldquofor all x it is the case that rdquoExistential quantifier existx ldquothere exists an x such that rdquo

Example (in Mathematica ndash quantifiers donrsquot exist in MATLAB)ForAll[x Element[xReals] x^2 + 2 x + c gt 0]Reduce[ c] ( find c st the statement is T )

In words For what values of c is the inequality x2 + 2x + c gt 0 true forall values of x

Example (in Mathematica)Exists[x x^2 + 2 x + c == 0 ampamp x gt 0]Reduce[ c Reals] (consider only real numbers)

In words For what values of c does the equation x2 + 2x + c = 0 havea positive solution x When does a positive solution exista

aExistence (and uniqueness) of a solution are fundamental issues in math

fasshaueriitedu MATH 100 ndash ITP 28

Quantifiers

We can also nicely visualize whatrsquos going on in Mathematica

Manipulate[Plot[x^2 + 2 x + c x -5 5PlotRange -gt -6 10] c -5 5]

This shows thatfor c le 0 there is an intersection with the positive x-axis so apositive solution to the equation x2 + 2x + c = 0 existsfor c gt 0 the parabola does not intersect the positive x-axis sothe equation x2 + 2x + c = 0 is false for positive values of x for c gt 1 the parabola does not intersect the x-axis at all so theinequality x2 + 2x + c gt 0 is true for all values of x (but theequation x2 + 2x + c = 0 is false)

RemarkWe could also use a restricted domain for the existence example ie

Exists[x xgt0 x^2 + 2 x + c == 0]Reduce[ c Reals] (consider only real numbers)

fasshaueriitedu MATH 100 ndash ITP 29

Quantifiers

Example (Comparing the use of exist and forall in common language)

Consider the two statementsEverybody likes at least one drink namely water(one drink liked by everybody)Everybody likes at least one drink I myself go for beer(everybody likes some drink)

How can we formalize these two statements using quantifiers

There exists a drink D such that for every person P P likes D

(existD) (forallP) [P likes D]

For every person P there exists a drink D such that P likes D

(forallP) (existD) [P likes D]

The order of quantifiers matters What about the other two casesfasshaueriitedu MATH 100 ndash ITP 30

Quantifiers

A mathematical example

Let P be the set of prime numbers and N the set of natural numbersThen

(foralln isin N) (existm isin N) [(m gt n) and (m isin P)]

says that there are infinitely many primes

Actually it says that

For whatever natural number n we pickwe can find another natural number mthat is both larger than n and a prime number

The statement m isin P (or ldquom is a prime numberrdquo) can be formalized as

(forallab isin N) [(ab = m)rArr ((a = 1) or (b = 1))]

fasshaueriitedu MATH 100 ndash ITP 31

Quantifiers

Negation of Universal Statements

Earlier we used the example (in Mathematica)

(forallx isin R)[x2 + 2x + c gt 0

]Letrsquos assume it is true ie

For all x the inequality x2 + 2x + c gt 0 is true

What if we want to negate this statement We get

not[(forallx isin R)

[x2 + 2x + c gt 0

]]Not[ForAll[x Element[xReals] x^2 + 2 x + c gt 0]]Reduce[ c] ( find c st the statement is T )

What does the statement mean (Mathematica resolved it)

There exists some x for which the inequality is not trueNote that the values of c found by Mathematica are complementary tothose for which the original statement was true

fasshaueriitedu MATH 100 ndash ITP 32

Quantifiers

Negation of Existential StatementsLetrsquos use our second earlier example

(existx isin R)[(x2 + 2x + c = 0) and (x gt 0)

]Letrsquos assume it is true ie

There exists an x such that the equation x2 + 2x + c = 0 istrue and x gt 0

What if we want to negate this statement We get

not[(existx isin R)

[(x2 + 2x + c = 0) and (x gt 0)

]]Not[Exists[x x^2 + 2 x + c == 0 ampamp x gt 0]]Reduce[ c Reals] (consider only real numbers)

What does the statement meanFor all x the equation is not true or x le 0

Again the values of c found by Mathematica are complementary tothose for which the original statement was true

fasshaueriitedu MATH 100 ndash ITP 33

Quantifiers

Using a restricted domain things are a little simpler

(existx isin R+)[x2 + 2x + c = 0

]Letrsquos assume it is true ie

There exists a positive x the equation x2 + 2x + c = 0 is true

What if we want to negate this statement We get

not[(existx isin R+)

[x2 + 2x + c = 0

]]Not[Exists[x x gt 0 x^2 + 2 x + c == 0]]Reduce[ c Reals] (consider only real numbers)

What does the statement meanFor all positive x the equation is not true

Again the values of c found by Mathematica are complementary tothose for which the original statement was true

fasshaueriitedu MATH 100 ndash ITP 34

Quantifiers

Back to Beer

We end by determining the ldquocorrectrdquo formulation for the beer exampleLetrsquos formalize the statement

All American beer tastes dreadful

We introduce the following notationB the set of all beers

A(x) the statement ldquox is AmericanrdquoD(x) the statement ldquox tastes dreadfulrdquo

Then we get(forallx isin B) [A(x)rArr D(x)]

ieFor all beers if the beer is American then it tastes dreadful

fasshaueriitedu MATH 100 ndash ITP 35

Quantifiers

Now we need to negate

(forallx isin B) [A(x)rArr D(x)]

According to our earlier discussion we have

(existx isin B)not [A(x)rArr D(x)]

which using the fact that not [φrArr ψ] is equivalent to φ and (notψ) yields

(existx isin B) [A(x) and (notD(x))]

In wordsThere exists a beer which is American and does not tastedreadful

fasshaueriitedu MATH 100 ndash ITP 36

Appendix References

References I

Devlin Keith JSet Functions and Logic (3rd Ed)Chapman amp HallCRC 2004

Moler CleveExperiments with MATLABhttpwwwmathworkscommolerexmchaptershtml

fasshaueriitedu MATH 100 ndash ITP 37

  • ``Thats Logic
  • Logical Connectives
  • Conditionals and Biconditionals
  • Truth Tables
  • Looking Ahead Toward Proofs
  • Quantifiers
  • Appendix
Page 2: MATH 100 – Introduction to the Profession - Logic

Outline1

1 ldquoThatrsquos Logicrdquo

2 Logical Connectives

3 Conditionals and Biconditionals

4 Truth Tables

5 Looking Ahead Toward Proofs

6 Quantifiers

1Most of this discussion is closely linked to [Devlin Chapter 2] but we also discussconnections to MATLAB and Mathematica where appropriate

fasshaueriitedu MATH 100 ndash ITP 2

ldquoThatrsquos Logicrdquo

ldquoI know what yoursquore thinkingaboutrdquo said Tweedledum ldquobut itisnrsquot so nohowrdquoldquoContrariwiserdquo continuedTweedledee ldquoif it was so it mightbe and if it were so it would bebut as it isnrsquot it ainrsquot Thatrsquos logicrdquo

From ldquoThrough the Looking Glassrdquo by Lewis Carroll (see httpwwwonline-literaturecomcarrolllookingglass4for the complete Chapter 4 Tweedledee and Tweedledum)

fasshaueriitedu MATH 100 ndash ITP 3

ldquoThatrsquos Logicrdquo

Famous (western) Logicians

Artistole (right with Plato) Gottlob Frege George Boole

fasshaueriitedu MATH 100 ndash ITP 4

Logical Connectives

ldquoAndrdquo ldquoOrrdquo and ldquoNotrdquo

And used when two ldquosentencesrdquo hold simultaneouslyMathematical notation and ampIn words φ and ψ is T only if both φ and ψ are TExample2(in MATLAB)is_true = (3ltpi) ampamp (4gtpi)is_true = (3ltpi) amp (4gtpi)is_true = and(3ltpi 4gtpi)

Example (in Mathematica)(3ltPi) ampamp (4gtPi)And[3ltPi 4gtPi]

Truth table httpwwwwolframalphacominputi=P+2626+Q

2It is recommended that you run all the examples using either MATLAB orMathematica (or possibly Wolfram Alpha)

fasshaueriitedu MATH 100 ndash ITP 5

Logical Connectives

Or used when either one of two ldquosentencesrdquo holds (inclusiveldquoorrdquo)

Mathematical notation or |In words φ or ψ is T if at least one of φ and ψ is TExample (in MATLAB)is_true = (pilt3) || (4ltpi)is_true = (pilt3) | (4ltpi)is_true = or(pilt3 4ltpi)

Example (in Mathematica)(Pilt3) || (4ltPi)Or[Pilt3 4ltPi]

Truth table httpwwwwolframalphacominputi=P+||+Q

fasshaueriitedu MATH 100 ndash ITP 6

Logical Connectives

Not negates the ldquosentencerdquoMathematical notation not simIn words notφ is T if φ is FExample (in MATLAB)is_true = ~(3ltpi)is_true = not(3ltpi)

Example (in Mathematica)(3ltPi)Not[3ltPi]

Truth tableφ notφT FF T

fasshaueriitedu MATH 100 ndash ITP 7

Logical Connectives

Example (Negating a statement)

Being a German who loves a good beer Irsquove been asked by myGerman friends how I can live in the US claiming

All American beer tastes dreadful

Obviously this is not true So how do I reply if I want to negate thisstatement

1 Not all American beer tastes dreadful2 All non-American (ie German) beer tastes great3 All American beer tastes great4 All American beer does not taste dreadful5 At least one American beer tastes great6 At least one American beer does not taste dreadful

We will see below which of these statements is logically mostappropriate

fasshaueriitedu MATH 100 ndash ITP 8

Logical Connectives

Example (Leap year calculation from Ch 3 [ExM])Using this year (1st element of vector returned by clock function)

c = clock y = c(1)mod(y4) == 0 ampamp mod(y100) ~= 0 || mod(y400) == 0

Using two years at once

y = [2000 2100]mod(y4) == 0 ampamp mod(y100) ~= 0 || mod(y400) == 0

leads to an error Replace the ldquoshort-circuitrdquoa operators ampamp and || bythe ldquoelementwiserdquo operators amp and |

y = [2000 2100]mod(y4) == 0 amp mod(y100) ~= 0 | mod(y400) == 0

Note and and or have ldquoelementwiserdquo interpretations notldquoshort-circuitrdquo not doesnrsquot care Try it

aThe 2nd operand eg mod(y100) is evaluated only when the result isnot fully determined by the 1st operand eg mod(y4)

fasshaueriitedu MATH 100 ndash ITP 9

Logical Connectives

Example (Logical operations and arrays in MATLAB)R=rand(43)(R gt 03) amp (R lt 07)

Note here the ldquoelementwiserdquo operator is required

Example (Logical operations and find in MATLAB)find(R gt 03 amp R lt 07)

Note find goes through matrix in column-major order and returnsvector of indicesMore detailed

[rowcolval] = find(R gt 03 amp R lt 07)

fasshaueriitedu MATH 100 ndash ITP 10

Conditionals and Biconditionals

Conditional for logical implications if thenMathematical notation rArrrarrExample3 (in MATLAB)x = -3if x lt 0

abs_x = -xelse

abs_x = xendor ndash if you want a function ndash using logical multipliersabs = (x) (xlt0)(-x) + (xgt=0)xabs(-3) abs(4)Example (in Mathematica)abs[x_] = If[x lt 0 -x x]abs[-3]abs[-4]

3This computer code use is different than the mathematical use since we canrsquotassign a truth value to the ldquoif thenrdquo code fragment

fasshaueriitedu MATH 100 ndash ITP 11

Conditionals and Biconditionals

Truth tablehttpwwwwolframalphacominputi=P+Implies+QImportant concepts for all of mathematics

φ implies ψif φ then ψφ is sufficient for ψφ only if ψψ if φψ whenever φψ is necessary for φ

fasshaueriitedu MATH 100 ndash ITP 12

Conditionals and Biconditionals

Are conditionals confusingProbably so Consider the following interpretation of the truth table4

If Springfield is the capital of Illinois then Springfield is the capitalof Illinois (TrArr T is T) OKIf Springfield is the capital of Illinois then Chicago is the capital ofIllinois (TrArr F is F) This better be falseIf Chicago is the capital of Illinois then Springfield is the capital ofIllinois (FrArr T is T) WeirdIf Chicago is the capital of Illinois then Rockford is the capital ofIllinois (FrArr F is T) Very weird

Read (carefully) the discussion in [Devlin pp 18-19]Conditional in words

φrArr ψ is only then not T if ψ is F in spite of φ being T

More colloquially φrArr ψ is considered true until proven false(ldquoinnocent until proven guiltyrdquo)

4The state capital of Illinois is Springfieldfasshaueriitedu MATH 100 ndash ITP 13

Conditionals and Biconditionals

Another example for the conditional

Letrsquos consider the following promise I make to you

If you average 85 or above in this class then you will get anA

At the end of the semester we could have various outcomesYou average 90 and get an A (Trarr T is T ie I kept my promise)You average 90 and get a B (Trarr F is F ie I broke mypromise)You average 80 and get an A (Frarr T is T ie I didnrsquot break mypromise uml )You average 80 and get a B (Frarr F is T ie I didnrsquot break mypromise ndash and you received what you expected)

This illustrates perfectly that scoring 85 or higher was sufficient foran A but not necessary

fasshaueriitedu MATH 100 ndash ITP 14

Conditionals and Biconditionals

And a mathematical example

Letrsquos assume that n is a positive integer Then

(n is a perfect square with last digit 7)rArr (n is a prime number)

is a true statementThis is so because we have both (by definition)

FrArr T is TFrArr F is T

and we know that no perfect square ends in 7 (so it is irrelevant that allwe know about n is that it is a positive integer)

RemarkStatements like these (and the earlier ones about the IL state capital)do not agree with common sense Usually we work with statementsthat are in some logical context (see the discussion of causation in[Devlin p 17])

fasshaueriitedu MATH 100 ndash ITP 15

Conditionals and Biconditionals

Biconditional for logical equivalence if and only ifMathematical notation hArrharrDoes not make sense in MATLAB (only in SymbolicToolbox)Example (in Mathematica)Equivalent[3ltPi 4gtPi]

Truth table httpwwwwolframalphacominputi=P+Equivalent+Q

fasshaueriitedu MATH 100 ndash ITP 16

Truth Tables

Further insights via truth tables

Example

Prove not(φ and ψ) is equivalent to (notφ) or (notψ)

φ ψ φ and ψ not(φ and ψ)T T T FT F F TF T F TF F F T

φ ψ notφ notψ (notφ) or (notψ)T T F F FT F F T TF T T F TF F T T T

fasshaueriitedu MATH 100 ndash ITP 17

Truth Tables

Example (Exercise 229(a) in [Devlin])

Prove not(φrArr ψ) is equivalent to φ and (notψ)

φ ψ φrArr ψ not(φrArr ψ)

T T T FT F F TF T T FF F T F

φ ψ φ and (notψ)T T FT F TF T FF F F

How can we then interpret φrArr ψ in terms of and or and not (notφ) or ψ

fasshaueriitedu MATH 100 ndash ITP 18

Truth Tables

Example (Wason Selection Task Exercise 2220 in [Devlin])

Assuming each card has a letter on one face and a numberon the other which card(s) do you have to turn over in orderto test the truth of the proposition that if a card has a vowel onone face then its opposite shows an even numbera

Answer Cards ldquoErdquo and ldquo7rdquo

Checking the other side of ldquoErdquo is obvious (we need an even number toshow for the proposition to hold)It doesnrsquot matter whatrsquos on the other side of ldquoKrdquo (the proposition makesno claim about cards with a consonant)Nor does it matter whatrsquos on the other side of ldquo4rdquo (if itrsquos a vowel great ifitrsquos a consonant no rule was violated either)We need to check ldquo7rdquo (if a vowel shows up the proposition is false)

aOnly about 10 of the population get this rightfasshaueriitedu MATH 100 ndash ITP 19

Looking Ahead Toward Proofs

When we do a mathematical proof then we need to decide whether acertain mathematical statement is logically true or not

The direct approach (known as modus ponens ie method byaffirmation) is to conclude

If φ and (φrArr ψ) then ψ

Example

Show that if n is an even integer then (minus1)n = 1

Proofn is an arbitrary even integer so n = 2k for some integer k But then

(minus1)n = (minus1)2k =((minus1)2︸ ︷︷ ︸

=1

)k= 1k = 1

fasshaueriitedu MATH 100 ndash ITP 20

Looking Ahead Toward Proofs

Contrapositive

Sometimes it is difficult to prove an implication directly In this case wecan try to show that the contrapositive of the conditional holds ie weuse (see HW 2211)

φrArr ψ is equivalent to (notψ)rArr (notφ)

and conclude (modus tollens method by denial)

If φ and ((notψ)rArr (notφ)) then ψ

Note that this has nothing to do with proof by contradiction (more onthat later)

Example

Conditional If you average 85 or above then you will get an AContrapositive If you donrsquotdidnrsquot get an A then you donrsquotdidnrsquot average85 or above

fasshaueriitedu MATH 100 ndash ITP 21

Looking Ahead Toward Proofs

Converse

Do not confuse the contrapositive of a conditional with its converse

If φrArr ψ then its converse is ψ rArr φ

There is no logical connection between a conditional and its converse

The only link is that if both are true then the biconditional holds ie

(φrArr ψ) and (ψ rArr φ) is equivalent to (φhArr ψ)

Example

Conditional If you average 85 or above then you will get an AContrapositive If you donrsquotdidnrsquot get an A then you donrsquotdidnrsquot average85 or aboveConverse If you getgot an A then you averageaveraged 85 or above

Note The converse assures us that scoring 85 or above isnecessary for an A (not so good for you _)

fasshaueriitedu MATH 100 ndash ITP 22

Looking Ahead Toward Proofs

Also do not confuse a statement with itsconverse

More Lewis CarrolllsquoNot the same thing a bitrsquo saidthe Hatter lsquoYou might just as wellsay that ldquoI see what I eatrdquo is thesame thing as ldquoI eat what I seerdquorsquo

From ldquoAlice in Wonderlandrdquo by Lewis Carroll (seehttpwwwonline-literaturecomcarrollalice7 forthe complete Chapter 7 A Mad Tea Party)

fasshaueriitedu MATH 100 ndash ITP 23

Looking Ahead Toward Proofs

Inverse

One could also consider the contrapositive of the converse5 of aconditional also known as the inverse of the conditional

Example

Conditional If you average 85 or above then you will get an AContrapositive If you donrsquotdidnrsquot get an A then you donrsquotdidnrsquot average85 or aboveConverse If you getgot an A then you averageaveraged 85 or aboveInverse If you donrsquot average 85 or above then you wonrsquot get an A

Note The inverse (which is equivalent to the converse) perhaps showseven better that scoring 85 or above is necessary for an A

5Or equivalently the converse of the contrapositivefasshaueriitedu MATH 100 ndash ITP 24

Looking Ahead Toward Proofs

Negated Conditional

You also might be tempted to confuse the contrapositive of aconditional with its negation As we showed earlier the negation of aconditional

not(φrArr ψ) is equivalent to φ and (notψ)

which is different from the contrapositive of φrArr ψ

(notψ)rArr (notφ)

The latter would be equivalent to (verify this)

(notφ) or ψ

fasshaueriitedu MATH 100 ndash ITP 25

Looking Ahead Toward Proofs

We just said that the negated conditional is

φ and (notψ)

Example

Conditional If you average 85 or above then you will get an AContrapositive If you donrsquotdidnrsquot get an A then you donrsquotdidnrsquot average85 or aboveConverse If you getgot an A then you averageaveraged 85 or aboveInverse If you donrsquot average 85 or above then you wonrsquot get an ANegated conditional You average 85 or above and you wonrsquot get an A

Note The negated conditional is only true if the conditional is falseie in the case when I break my promise

fasshaueriitedu MATH 100 ndash ITP 26

Looking Ahead Toward Proofs

The perverse cube of reversed implications

notφrArr notψφornotψ

larrrarr notψ rArr notφψornotφ

l lφrArr ψnotφorψ

larrrarr ψ rArr φnotψorφ

l Negation l

not (notφrArr notψ)notφandψ

middot middot middot not (notψ rArr notφ)notψandφ

l lnot (φrArr ψ)

φandnotψmiddot middot middot not (ψ rArr φ)

ψandnotφ

Create the truth tables for all these statements to verify their relations

fasshaueriitedu MATH 100 ndash ITP 27

Quantifiers

ldquoFor allrdquo and ldquothere existsrdquo

Universal quantifier forallx ldquofor all x it is the case that rdquoExistential quantifier existx ldquothere exists an x such that rdquo

Example (in Mathematica ndash quantifiers donrsquot exist in MATLAB)ForAll[x Element[xReals] x^2 + 2 x + c gt 0]Reduce[ c] ( find c st the statement is T )

In words For what values of c is the inequality x2 + 2x + c gt 0 true forall values of x

Example (in Mathematica)Exists[x x^2 + 2 x + c == 0 ampamp x gt 0]Reduce[ c Reals] (consider only real numbers)

In words For what values of c does the equation x2 + 2x + c = 0 havea positive solution x When does a positive solution exista

aExistence (and uniqueness) of a solution are fundamental issues in math

fasshaueriitedu MATH 100 ndash ITP 28

Quantifiers

We can also nicely visualize whatrsquos going on in Mathematica

Manipulate[Plot[x^2 + 2 x + c x -5 5PlotRange -gt -6 10] c -5 5]

This shows thatfor c le 0 there is an intersection with the positive x-axis so apositive solution to the equation x2 + 2x + c = 0 existsfor c gt 0 the parabola does not intersect the positive x-axis sothe equation x2 + 2x + c = 0 is false for positive values of x for c gt 1 the parabola does not intersect the x-axis at all so theinequality x2 + 2x + c gt 0 is true for all values of x (but theequation x2 + 2x + c = 0 is false)

RemarkWe could also use a restricted domain for the existence example ie

Exists[x xgt0 x^2 + 2 x + c == 0]Reduce[ c Reals] (consider only real numbers)

fasshaueriitedu MATH 100 ndash ITP 29

Quantifiers

Example (Comparing the use of exist and forall in common language)

Consider the two statementsEverybody likes at least one drink namely water(one drink liked by everybody)Everybody likes at least one drink I myself go for beer(everybody likes some drink)

How can we formalize these two statements using quantifiers

There exists a drink D such that for every person P P likes D

(existD) (forallP) [P likes D]

For every person P there exists a drink D such that P likes D

(forallP) (existD) [P likes D]

The order of quantifiers matters What about the other two casesfasshaueriitedu MATH 100 ndash ITP 30

Quantifiers

A mathematical example

Let P be the set of prime numbers and N the set of natural numbersThen

(foralln isin N) (existm isin N) [(m gt n) and (m isin P)]

says that there are infinitely many primes

Actually it says that

For whatever natural number n we pickwe can find another natural number mthat is both larger than n and a prime number

The statement m isin P (or ldquom is a prime numberrdquo) can be formalized as

(forallab isin N) [(ab = m)rArr ((a = 1) or (b = 1))]

fasshaueriitedu MATH 100 ndash ITP 31

Quantifiers

Negation of Universal Statements

Earlier we used the example (in Mathematica)

(forallx isin R)[x2 + 2x + c gt 0

]Letrsquos assume it is true ie

For all x the inequality x2 + 2x + c gt 0 is true

What if we want to negate this statement We get

not[(forallx isin R)

[x2 + 2x + c gt 0

]]Not[ForAll[x Element[xReals] x^2 + 2 x + c gt 0]]Reduce[ c] ( find c st the statement is T )

What does the statement mean (Mathematica resolved it)

There exists some x for which the inequality is not trueNote that the values of c found by Mathematica are complementary tothose for which the original statement was true

fasshaueriitedu MATH 100 ndash ITP 32

Quantifiers

Negation of Existential StatementsLetrsquos use our second earlier example

(existx isin R)[(x2 + 2x + c = 0) and (x gt 0)

]Letrsquos assume it is true ie

There exists an x such that the equation x2 + 2x + c = 0 istrue and x gt 0

What if we want to negate this statement We get

not[(existx isin R)

[(x2 + 2x + c = 0) and (x gt 0)

]]Not[Exists[x x^2 + 2 x + c == 0 ampamp x gt 0]]Reduce[ c Reals] (consider only real numbers)

What does the statement meanFor all x the equation is not true or x le 0

Again the values of c found by Mathematica are complementary tothose for which the original statement was true

fasshaueriitedu MATH 100 ndash ITP 33

Quantifiers

Using a restricted domain things are a little simpler

(existx isin R+)[x2 + 2x + c = 0

]Letrsquos assume it is true ie

There exists a positive x the equation x2 + 2x + c = 0 is true

What if we want to negate this statement We get

not[(existx isin R+)

[x2 + 2x + c = 0

]]Not[Exists[x x gt 0 x^2 + 2 x + c == 0]]Reduce[ c Reals] (consider only real numbers)

What does the statement meanFor all positive x the equation is not true

Again the values of c found by Mathematica are complementary tothose for which the original statement was true

fasshaueriitedu MATH 100 ndash ITP 34

Quantifiers

Back to Beer

We end by determining the ldquocorrectrdquo formulation for the beer exampleLetrsquos formalize the statement

All American beer tastes dreadful

We introduce the following notationB the set of all beers

A(x) the statement ldquox is AmericanrdquoD(x) the statement ldquox tastes dreadfulrdquo

Then we get(forallx isin B) [A(x)rArr D(x)]

ieFor all beers if the beer is American then it tastes dreadful

fasshaueriitedu MATH 100 ndash ITP 35

Quantifiers

Now we need to negate

(forallx isin B) [A(x)rArr D(x)]

According to our earlier discussion we have

(existx isin B)not [A(x)rArr D(x)]

which using the fact that not [φrArr ψ] is equivalent to φ and (notψ) yields

(existx isin B) [A(x) and (notD(x))]

In wordsThere exists a beer which is American and does not tastedreadful

fasshaueriitedu MATH 100 ndash ITP 36

Appendix References

References I

Devlin Keith JSet Functions and Logic (3rd Ed)Chapman amp HallCRC 2004

Moler CleveExperiments with MATLABhttpwwwmathworkscommolerexmchaptershtml

fasshaueriitedu MATH 100 ndash ITP 37

  • ``Thats Logic
  • Logical Connectives
  • Conditionals and Biconditionals
  • Truth Tables
  • Looking Ahead Toward Proofs
  • Quantifiers
  • Appendix
Page 3: MATH 100 – Introduction to the Profession - Logic

ldquoThatrsquos Logicrdquo

ldquoI know what yoursquore thinkingaboutrdquo said Tweedledum ldquobut itisnrsquot so nohowrdquoldquoContrariwiserdquo continuedTweedledee ldquoif it was so it mightbe and if it were so it would bebut as it isnrsquot it ainrsquot Thatrsquos logicrdquo

From ldquoThrough the Looking Glassrdquo by Lewis Carroll (see httpwwwonline-literaturecomcarrolllookingglass4for the complete Chapter 4 Tweedledee and Tweedledum)

fasshaueriitedu MATH 100 ndash ITP 3

ldquoThatrsquos Logicrdquo

Famous (western) Logicians

Artistole (right with Plato) Gottlob Frege George Boole

fasshaueriitedu MATH 100 ndash ITP 4

Logical Connectives

ldquoAndrdquo ldquoOrrdquo and ldquoNotrdquo

And used when two ldquosentencesrdquo hold simultaneouslyMathematical notation and ampIn words φ and ψ is T only if both φ and ψ are TExample2(in MATLAB)is_true = (3ltpi) ampamp (4gtpi)is_true = (3ltpi) amp (4gtpi)is_true = and(3ltpi 4gtpi)

Example (in Mathematica)(3ltPi) ampamp (4gtPi)And[3ltPi 4gtPi]

Truth table httpwwwwolframalphacominputi=P+2626+Q

2It is recommended that you run all the examples using either MATLAB orMathematica (or possibly Wolfram Alpha)

fasshaueriitedu MATH 100 ndash ITP 5

Logical Connectives

Or used when either one of two ldquosentencesrdquo holds (inclusiveldquoorrdquo)

Mathematical notation or |In words φ or ψ is T if at least one of φ and ψ is TExample (in MATLAB)is_true = (pilt3) || (4ltpi)is_true = (pilt3) | (4ltpi)is_true = or(pilt3 4ltpi)

Example (in Mathematica)(Pilt3) || (4ltPi)Or[Pilt3 4ltPi]

Truth table httpwwwwolframalphacominputi=P+||+Q

fasshaueriitedu MATH 100 ndash ITP 6

Logical Connectives

Not negates the ldquosentencerdquoMathematical notation not simIn words notφ is T if φ is FExample (in MATLAB)is_true = ~(3ltpi)is_true = not(3ltpi)

Example (in Mathematica)(3ltPi)Not[3ltPi]

Truth tableφ notφT FF T

fasshaueriitedu MATH 100 ndash ITP 7

Logical Connectives

Example (Negating a statement)

Being a German who loves a good beer Irsquove been asked by myGerman friends how I can live in the US claiming

All American beer tastes dreadful

Obviously this is not true So how do I reply if I want to negate thisstatement

1 Not all American beer tastes dreadful2 All non-American (ie German) beer tastes great3 All American beer tastes great4 All American beer does not taste dreadful5 At least one American beer tastes great6 At least one American beer does not taste dreadful

We will see below which of these statements is logically mostappropriate

fasshaueriitedu MATH 100 ndash ITP 8

Logical Connectives

Example (Leap year calculation from Ch 3 [ExM])Using this year (1st element of vector returned by clock function)

c = clock y = c(1)mod(y4) == 0 ampamp mod(y100) ~= 0 || mod(y400) == 0

Using two years at once

y = [2000 2100]mod(y4) == 0 ampamp mod(y100) ~= 0 || mod(y400) == 0

leads to an error Replace the ldquoshort-circuitrdquoa operators ampamp and || bythe ldquoelementwiserdquo operators amp and |

y = [2000 2100]mod(y4) == 0 amp mod(y100) ~= 0 | mod(y400) == 0

Note and and or have ldquoelementwiserdquo interpretations notldquoshort-circuitrdquo not doesnrsquot care Try it

aThe 2nd operand eg mod(y100) is evaluated only when the result isnot fully determined by the 1st operand eg mod(y4)

fasshaueriitedu MATH 100 ndash ITP 9

Logical Connectives

Example (Logical operations and arrays in MATLAB)R=rand(43)(R gt 03) amp (R lt 07)

Note here the ldquoelementwiserdquo operator is required

Example (Logical operations and find in MATLAB)find(R gt 03 amp R lt 07)

Note find goes through matrix in column-major order and returnsvector of indicesMore detailed

[rowcolval] = find(R gt 03 amp R lt 07)

fasshaueriitedu MATH 100 ndash ITP 10

Conditionals and Biconditionals

Conditional for logical implications if thenMathematical notation rArrrarrExample3 (in MATLAB)x = -3if x lt 0

abs_x = -xelse

abs_x = xendor ndash if you want a function ndash using logical multipliersabs = (x) (xlt0)(-x) + (xgt=0)xabs(-3) abs(4)Example (in Mathematica)abs[x_] = If[x lt 0 -x x]abs[-3]abs[-4]

3This computer code use is different than the mathematical use since we canrsquotassign a truth value to the ldquoif thenrdquo code fragment

fasshaueriitedu MATH 100 ndash ITP 11

Conditionals and Biconditionals

Truth tablehttpwwwwolframalphacominputi=P+Implies+QImportant concepts for all of mathematics

φ implies ψif φ then ψφ is sufficient for ψφ only if ψψ if φψ whenever φψ is necessary for φ

fasshaueriitedu MATH 100 ndash ITP 12

Conditionals and Biconditionals

Are conditionals confusingProbably so Consider the following interpretation of the truth table4

If Springfield is the capital of Illinois then Springfield is the capitalof Illinois (TrArr T is T) OKIf Springfield is the capital of Illinois then Chicago is the capital ofIllinois (TrArr F is F) This better be falseIf Chicago is the capital of Illinois then Springfield is the capital ofIllinois (FrArr T is T) WeirdIf Chicago is the capital of Illinois then Rockford is the capital ofIllinois (FrArr F is T) Very weird

Read (carefully) the discussion in [Devlin pp 18-19]Conditional in words

φrArr ψ is only then not T if ψ is F in spite of φ being T

More colloquially φrArr ψ is considered true until proven false(ldquoinnocent until proven guiltyrdquo)

4The state capital of Illinois is Springfieldfasshaueriitedu MATH 100 ndash ITP 13

Conditionals and Biconditionals

Another example for the conditional

Letrsquos consider the following promise I make to you

If you average 85 or above in this class then you will get anA

At the end of the semester we could have various outcomesYou average 90 and get an A (Trarr T is T ie I kept my promise)You average 90 and get a B (Trarr F is F ie I broke mypromise)You average 80 and get an A (Frarr T is T ie I didnrsquot break mypromise uml )You average 80 and get a B (Frarr F is T ie I didnrsquot break mypromise ndash and you received what you expected)

This illustrates perfectly that scoring 85 or higher was sufficient foran A but not necessary

fasshaueriitedu MATH 100 ndash ITP 14

Conditionals and Biconditionals

And a mathematical example

Letrsquos assume that n is a positive integer Then

(n is a perfect square with last digit 7)rArr (n is a prime number)

is a true statementThis is so because we have both (by definition)

FrArr T is TFrArr F is T

and we know that no perfect square ends in 7 (so it is irrelevant that allwe know about n is that it is a positive integer)

RemarkStatements like these (and the earlier ones about the IL state capital)do not agree with common sense Usually we work with statementsthat are in some logical context (see the discussion of causation in[Devlin p 17])

fasshaueriitedu MATH 100 ndash ITP 15

Conditionals and Biconditionals

Biconditional for logical equivalence if and only ifMathematical notation hArrharrDoes not make sense in MATLAB (only in SymbolicToolbox)Example (in Mathematica)Equivalent[3ltPi 4gtPi]

Truth table httpwwwwolframalphacominputi=P+Equivalent+Q

fasshaueriitedu MATH 100 ndash ITP 16

Truth Tables

Further insights via truth tables

Example

Prove not(φ and ψ) is equivalent to (notφ) or (notψ)

φ ψ φ and ψ not(φ and ψ)T T T FT F F TF T F TF F F T

φ ψ notφ notψ (notφ) or (notψ)T T F F FT F F T TF T T F TF F T T T

fasshaueriitedu MATH 100 ndash ITP 17

Truth Tables

Example (Exercise 229(a) in [Devlin])

Prove not(φrArr ψ) is equivalent to φ and (notψ)

φ ψ φrArr ψ not(φrArr ψ)

T T T FT F F TF T T FF F T F

φ ψ φ and (notψ)T T FT F TF T FF F F

How can we then interpret φrArr ψ in terms of and or and not (notφ) or ψ

fasshaueriitedu MATH 100 ndash ITP 18

Truth Tables

Example (Wason Selection Task Exercise 2220 in [Devlin])

Assuming each card has a letter on one face and a numberon the other which card(s) do you have to turn over in orderto test the truth of the proposition that if a card has a vowel onone face then its opposite shows an even numbera

Answer Cards ldquoErdquo and ldquo7rdquo

Checking the other side of ldquoErdquo is obvious (we need an even number toshow for the proposition to hold)It doesnrsquot matter whatrsquos on the other side of ldquoKrdquo (the proposition makesno claim about cards with a consonant)Nor does it matter whatrsquos on the other side of ldquo4rdquo (if itrsquos a vowel great ifitrsquos a consonant no rule was violated either)We need to check ldquo7rdquo (if a vowel shows up the proposition is false)

aOnly about 10 of the population get this rightfasshaueriitedu MATH 100 ndash ITP 19

Looking Ahead Toward Proofs

When we do a mathematical proof then we need to decide whether acertain mathematical statement is logically true or not

The direct approach (known as modus ponens ie method byaffirmation) is to conclude

If φ and (φrArr ψ) then ψ

Example

Show that if n is an even integer then (minus1)n = 1

Proofn is an arbitrary even integer so n = 2k for some integer k But then

(minus1)n = (minus1)2k =((minus1)2︸ ︷︷ ︸

=1

)k= 1k = 1

fasshaueriitedu MATH 100 ndash ITP 20

Looking Ahead Toward Proofs

Contrapositive

Sometimes it is difficult to prove an implication directly In this case wecan try to show that the contrapositive of the conditional holds ie weuse (see HW 2211)

φrArr ψ is equivalent to (notψ)rArr (notφ)

and conclude (modus tollens method by denial)

If φ and ((notψ)rArr (notφ)) then ψ

Note that this has nothing to do with proof by contradiction (more onthat later)

Example

Conditional If you average 85 or above then you will get an AContrapositive If you donrsquotdidnrsquot get an A then you donrsquotdidnrsquot average85 or above

fasshaueriitedu MATH 100 ndash ITP 21

Looking Ahead Toward Proofs

Converse

Do not confuse the contrapositive of a conditional with its converse

If φrArr ψ then its converse is ψ rArr φ

There is no logical connection between a conditional and its converse

The only link is that if both are true then the biconditional holds ie

(φrArr ψ) and (ψ rArr φ) is equivalent to (φhArr ψ)

Example

Conditional If you average 85 or above then you will get an AContrapositive If you donrsquotdidnrsquot get an A then you donrsquotdidnrsquot average85 or aboveConverse If you getgot an A then you averageaveraged 85 or above

Note The converse assures us that scoring 85 or above isnecessary for an A (not so good for you _)

fasshaueriitedu MATH 100 ndash ITP 22

Looking Ahead Toward Proofs

Also do not confuse a statement with itsconverse

More Lewis CarrolllsquoNot the same thing a bitrsquo saidthe Hatter lsquoYou might just as wellsay that ldquoI see what I eatrdquo is thesame thing as ldquoI eat what I seerdquorsquo

From ldquoAlice in Wonderlandrdquo by Lewis Carroll (seehttpwwwonline-literaturecomcarrollalice7 forthe complete Chapter 7 A Mad Tea Party)

fasshaueriitedu MATH 100 ndash ITP 23

Looking Ahead Toward Proofs

Inverse

One could also consider the contrapositive of the converse5 of aconditional also known as the inverse of the conditional

Example

Conditional If you average 85 or above then you will get an AContrapositive If you donrsquotdidnrsquot get an A then you donrsquotdidnrsquot average85 or aboveConverse If you getgot an A then you averageaveraged 85 or aboveInverse If you donrsquot average 85 or above then you wonrsquot get an A

Note The inverse (which is equivalent to the converse) perhaps showseven better that scoring 85 or above is necessary for an A

5Or equivalently the converse of the contrapositivefasshaueriitedu MATH 100 ndash ITP 24

Looking Ahead Toward Proofs

Negated Conditional

You also might be tempted to confuse the contrapositive of aconditional with its negation As we showed earlier the negation of aconditional

not(φrArr ψ) is equivalent to φ and (notψ)

which is different from the contrapositive of φrArr ψ

(notψ)rArr (notφ)

The latter would be equivalent to (verify this)

(notφ) or ψ

fasshaueriitedu MATH 100 ndash ITP 25

Looking Ahead Toward Proofs

We just said that the negated conditional is

φ and (notψ)

Example

Conditional If you average 85 or above then you will get an AContrapositive If you donrsquotdidnrsquot get an A then you donrsquotdidnrsquot average85 or aboveConverse If you getgot an A then you averageaveraged 85 or aboveInverse If you donrsquot average 85 or above then you wonrsquot get an ANegated conditional You average 85 or above and you wonrsquot get an A

Note The negated conditional is only true if the conditional is falseie in the case when I break my promise

fasshaueriitedu MATH 100 ndash ITP 26

Looking Ahead Toward Proofs

The perverse cube of reversed implications

notφrArr notψφornotψ

larrrarr notψ rArr notφψornotφ

l lφrArr ψnotφorψ

larrrarr ψ rArr φnotψorφ

l Negation l

not (notφrArr notψ)notφandψ

middot middot middot not (notψ rArr notφ)notψandφ

l lnot (φrArr ψ)

φandnotψmiddot middot middot not (ψ rArr φ)

ψandnotφ

Create the truth tables for all these statements to verify their relations

fasshaueriitedu MATH 100 ndash ITP 27

Quantifiers

ldquoFor allrdquo and ldquothere existsrdquo

Universal quantifier forallx ldquofor all x it is the case that rdquoExistential quantifier existx ldquothere exists an x such that rdquo

Example (in Mathematica ndash quantifiers donrsquot exist in MATLAB)ForAll[x Element[xReals] x^2 + 2 x + c gt 0]Reduce[ c] ( find c st the statement is T )

In words For what values of c is the inequality x2 + 2x + c gt 0 true forall values of x

Example (in Mathematica)Exists[x x^2 + 2 x + c == 0 ampamp x gt 0]Reduce[ c Reals] (consider only real numbers)

In words For what values of c does the equation x2 + 2x + c = 0 havea positive solution x When does a positive solution exista

aExistence (and uniqueness) of a solution are fundamental issues in math

fasshaueriitedu MATH 100 ndash ITP 28

Quantifiers

We can also nicely visualize whatrsquos going on in Mathematica

Manipulate[Plot[x^2 + 2 x + c x -5 5PlotRange -gt -6 10] c -5 5]

This shows thatfor c le 0 there is an intersection with the positive x-axis so apositive solution to the equation x2 + 2x + c = 0 existsfor c gt 0 the parabola does not intersect the positive x-axis sothe equation x2 + 2x + c = 0 is false for positive values of x for c gt 1 the parabola does not intersect the x-axis at all so theinequality x2 + 2x + c gt 0 is true for all values of x (but theequation x2 + 2x + c = 0 is false)

RemarkWe could also use a restricted domain for the existence example ie

Exists[x xgt0 x^2 + 2 x + c == 0]Reduce[ c Reals] (consider only real numbers)

fasshaueriitedu MATH 100 ndash ITP 29

Quantifiers

Example (Comparing the use of exist and forall in common language)

Consider the two statementsEverybody likes at least one drink namely water(one drink liked by everybody)Everybody likes at least one drink I myself go for beer(everybody likes some drink)

How can we formalize these two statements using quantifiers

There exists a drink D such that for every person P P likes D

(existD) (forallP) [P likes D]

For every person P there exists a drink D such that P likes D

(forallP) (existD) [P likes D]

The order of quantifiers matters What about the other two casesfasshaueriitedu MATH 100 ndash ITP 30

Quantifiers

A mathematical example

Let P be the set of prime numbers and N the set of natural numbersThen

(foralln isin N) (existm isin N) [(m gt n) and (m isin P)]

says that there are infinitely many primes

Actually it says that

For whatever natural number n we pickwe can find another natural number mthat is both larger than n and a prime number

The statement m isin P (or ldquom is a prime numberrdquo) can be formalized as

(forallab isin N) [(ab = m)rArr ((a = 1) or (b = 1))]

fasshaueriitedu MATH 100 ndash ITP 31

Quantifiers

Negation of Universal Statements

Earlier we used the example (in Mathematica)

(forallx isin R)[x2 + 2x + c gt 0

]Letrsquos assume it is true ie

For all x the inequality x2 + 2x + c gt 0 is true

What if we want to negate this statement We get

not[(forallx isin R)

[x2 + 2x + c gt 0

]]Not[ForAll[x Element[xReals] x^2 + 2 x + c gt 0]]Reduce[ c] ( find c st the statement is T )

What does the statement mean (Mathematica resolved it)

There exists some x for which the inequality is not trueNote that the values of c found by Mathematica are complementary tothose for which the original statement was true

fasshaueriitedu MATH 100 ndash ITP 32

Quantifiers

Negation of Existential StatementsLetrsquos use our second earlier example

(existx isin R)[(x2 + 2x + c = 0) and (x gt 0)

]Letrsquos assume it is true ie

There exists an x such that the equation x2 + 2x + c = 0 istrue and x gt 0

What if we want to negate this statement We get

not[(existx isin R)

[(x2 + 2x + c = 0) and (x gt 0)

]]Not[Exists[x x^2 + 2 x + c == 0 ampamp x gt 0]]Reduce[ c Reals] (consider only real numbers)

What does the statement meanFor all x the equation is not true or x le 0

Again the values of c found by Mathematica are complementary tothose for which the original statement was true

fasshaueriitedu MATH 100 ndash ITP 33

Quantifiers

Using a restricted domain things are a little simpler

(existx isin R+)[x2 + 2x + c = 0

]Letrsquos assume it is true ie

There exists a positive x the equation x2 + 2x + c = 0 is true

What if we want to negate this statement We get

not[(existx isin R+)

[x2 + 2x + c = 0

]]Not[Exists[x x gt 0 x^2 + 2 x + c == 0]]Reduce[ c Reals] (consider only real numbers)

What does the statement meanFor all positive x the equation is not true

Again the values of c found by Mathematica are complementary tothose for which the original statement was true

fasshaueriitedu MATH 100 ndash ITP 34

Quantifiers

Back to Beer

We end by determining the ldquocorrectrdquo formulation for the beer exampleLetrsquos formalize the statement

All American beer tastes dreadful

We introduce the following notationB the set of all beers

A(x) the statement ldquox is AmericanrdquoD(x) the statement ldquox tastes dreadfulrdquo

Then we get(forallx isin B) [A(x)rArr D(x)]

ieFor all beers if the beer is American then it tastes dreadful

fasshaueriitedu MATH 100 ndash ITP 35

Quantifiers

Now we need to negate

(forallx isin B) [A(x)rArr D(x)]

According to our earlier discussion we have

(existx isin B)not [A(x)rArr D(x)]

which using the fact that not [φrArr ψ] is equivalent to φ and (notψ) yields

(existx isin B) [A(x) and (notD(x))]

In wordsThere exists a beer which is American and does not tastedreadful

fasshaueriitedu MATH 100 ndash ITP 36

Appendix References

References I

Devlin Keith JSet Functions and Logic (3rd Ed)Chapman amp HallCRC 2004

Moler CleveExperiments with MATLABhttpwwwmathworkscommolerexmchaptershtml

fasshaueriitedu MATH 100 ndash ITP 37

  • ``Thats Logic
  • Logical Connectives
  • Conditionals and Biconditionals
  • Truth Tables
  • Looking Ahead Toward Proofs
  • Quantifiers
  • Appendix
Page 4: MATH 100 – Introduction to the Profession - Logic

ldquoThatrsquos Logicrdquo

Famous (western) Logicians

Artistole (right with Plato) Gottlob Frege George Boole

fasshaueriitedu MATH 100 ndash ITP 4

Logical Connectives

ldquoAndrdquo ldquoOrrdquo and ldquoNotrdquo

And used when two ldquosentencesrdquo hold simultaneouslyMathematical notation and ampIn words φ and ψ is T only if both φ and ψ are TExample2(in MATLAB)is_true = (3ltpi) ampamp (4gtpi)is_true = (3ltpi) amp (4gtpi)is_true = and(3ltpi 4gtpi)

Example (in Mathematica)(3ltPi) ampamp (4gtPi)And[3ltPi 4gtPi]

Truth table httpwwwwolframalphacominputi=P+2626+Q

2It is recommended that you run all the examples using either MATLAB orMathematica (or possibly Wolfram Alpha)

fasshaueriitedu MATH 100 ndash ITP 5

Logical Connectives

Or used when either one of two ldquosentencesrdquo holds (inclusiveldquoorrdquo)

Mathematical notation or |In words φ or ψ is T if at least one of φ and ψ is TExample (in MATLAB)is_true = (pilt3) || (4ltpi)is_true = (pilt3) | (4ltpi)is_true = or(pilt3 4ltpi)

Example (in Mathematica)(Pilt3) || (4ltPi)Or[Pilt3 4ltPi]

Truth table httpwwwwolframalphacominputi=P+||+Q

fasshaueriitedu MATH 100 ndash ITP 6

Logical Connectives

Not negates the ldquosentencerdquoMathematical notation not simIn words notφ is T if φ is FExample (in MATLAB)is_true = ~(3ltpi)is_true = not(3ltpi)

Example (in Mathematica)(3ltPi)Not[3ltPi]

Truth tableφ notφT FF T

fasshaueriitedu MATH 100 ndash ITP 7

Logical Connectives

Example (Negating a statement)

Being a German who loves a good beer Irsquove been asked by myGerman friends how I can live in the US claiming

All American beer tastes dreadful

Obviously this is not true So how do I reply if I want to negate thisstatement

1 Not all American beer tastes dreadful2 All non-American (ie German) beer tastes great3 All American beer tastes great4 All American beer does not taste dreadful5 At least one American beer tastes great6 At least one American beer does not taste dreadful

We will see below which of these statements is logically mostappropriate

fasshaueriitedu MATH 100 ndash ITP 8

Logical Connectives

Example (Leap year calculation from Ch 3 [ExM])Using this year (1st element of vector returned by clock function)

c = clock y = c(1)mod(y4) == 0 ampamp mod(y100) ~= 0 || mod(y400) == 0

Using two years at once

y = [2000 2100]mod(y4) == 0 ampamp mod(y100) ~= 0 || mod(y400) == 0

leads to an error Replace the ldquoshort-circuitrdquoa operators ampamp and || bythe ldquoelementwiserdquo operators amp and |

y = [2000 2100]mod(y4) == 0 amp mod(y100) ~= 0 | mod(y400) == 0

Note and and or have ldquoelementwiserdquo interpretations notldquoshort-circuitrdquo not doesnrsquot care Try it

aThe 2nd operand eg mod(y100) is evaluated only when the result isnot fully determined by the 1st operand eg mod(y4)

fasshaueriitedu MATH 100 ndash ITP 9

Logical Connectives

Example (Logical operations and arrays in MATLAB)R=rand(43)(R gt 03) amp (R lt 07)

Note here the ldquoelementwiserdquo operator is required

Example (Logical operations and find in MATLAB)find(R gt 03 amp R lt 07)

Note find goes through matrix in column-major order and returnsvector of indicesMore detailed

[rowcolval] = find(R gt 03 amp R lt 07)

fasshaueriitedu MATH 100 ndash ITP 10

Conditionals and Biconditionals

Conditional for logical implications if thenMathematical notation rArrrarrExample3 (in MATLAB)x = -3if x lt 0

abs_x = -xelse

abs_x = xendor ndash if you want a function ndash using logical multipliersabs = (x) (xlt0)(-x) + (xgt=0)xabs(-3) abs(4)Example (in Mathematica)abs[x_] = If[x lt 0 -x x]abs[-3]abs[-4]

3This computer code use is different than the mathematical use since we canrsquotassign a truth value to the ldquoif thenrdquo code fragment

fasshaueriitedu MATH 100 ndash ITP 11

Conditionals and Biconditionals

Truth tablehttpwwwwolframalphacominputi=P+Implies+QImportant concepts for all of mathematics

φ implies ψif φ then ψφ is sufficient for ψφ only if ψψ if φψ whenever φψ is necessary for φ

fasshaueriitedu MATH 100 ndash ITP 12

Conditionals and Biconditionals

Are conditionals confusingProbably so Consider the following interpretation of the truth table4

If Springfield is the capital of Illinois then Springfield is the capitalof Illinois (TrArr T is T) OKIf Springfield is the capital of Illinois then Chicago is the capital ofIllinois (TrArr F is F) This better be falseIf Chicago is the capital of Illinois then Springfield is the capital ofIllinois (FrArr T is T) WeirdIf Chicago is the capital of Illinois then Rockford is the capital ofIllinois (FrArr F is T) Very weird

Read (carefully) the discussion in [Devlin pp 18-19]Conditional in words

φrArr ψ is only then not T if ψ is F in spite of φ being T

More colloquially φrArr ψ is considered true until proven false(ldquoinnocent until proven guiltyrdquo)

4The state capital of Illinois is Springfieldfasshaueriitedu MATH 100 ndash ITP 13

Conditionals and Biconditionals

Another example for the conditional

Letrsquos consider the following promise I make to you

If you average 85 or above in this class then you will get anA

At the end of the semester we could have various outcomesYou average 90 and get an A (Trarr T is T ie I kept my promise)You average 90 and get a B (Trarr F is F ie I broke mypromise)You average 80 and get an A (Frarr T is T ie I didnrsquot break mypromise uml )You average 80 and get a B (Frarr F is T ie I didnrsquot break mypromise ndash and you received what you expected)

This illustrates perfectly that scoring 85 or higher was sufficient foran A but not necessary

fasshaueriitedu MATH 100 ndash ITP 14

Conditionals and Biconditionals

And a mathematical example

Letrsquos assume that n is a positive integer Then

(n is a perfect square with last digit 7)rArr (n is a prime number)

is a true statementThis is so because we have both (by definition)

FrArr T is TFrArr F is T

and we know that no perfect square ends in 7 (so it is irrelevant that allwe know about n is that it is a positive integer)

RemarkStatements like these (and the earlier ones about the IL state capital)do not agree with common sense Usually we work with statementsthat are in some logical context (see the discussion of causation in[Devlin p 17])

fasshaueriitedu MATH 100 ndash ITP 15

Conditionals and Biconditionals

Biconditional for logical equivalence if and only ifMathematical notation hArrharrDoes not make sense in MATLAB (only in SymbolicToolbox)Example (in Mathematica)Equivalent[3ltPi 4gtPi]

Truth table httpwwwwolframalphacominputi=P+Equivalent+Q

fasshaueriitedu MATH 100 ndash ITP 16

Truth Tables

Further insights via truth tables

Example

Prove not(φ and ψ) is equivalent to (notφ) or (notψ)

φ ψ φ and ψ not(φ and ψ)T T T FT F F TF T F TF F F T

φ ψ notφ notψ (notφ) or (notψ)T T F F FT F F T TF T T F TF F T T T

fasshaueriitedu MATH 100 ndash ITP 17

Truth Tables

Example (Exercise 229(a) in [Devlin])

Prove not(φrArr ψ) is equivalent to φ and (notψ)

φ ψ φrArr ψ not(φrArr ψ)

T T T FT F F TF T T FF F T F

φ ψ φ and (notψ)T T FT F TF T FF F F

How can we then interpret φrArr ψ in terms of and or and not (notφ) or ψ

fasshaueriitedu MATH 100 ndash ITP 18

Truth Tables

Example (Wason Selection Task Exercise 2220 in [Devlin])

Assuming each card has a letter on one face and a numberon the other which card(s) do you have to turn over in orderto test the truth of the proposition that if a card has a vowel onone face then its opposite shows an even numbera

Answer Cards ldquoErdquo and ldquo7rdquo

Checking the other side of ldquoErdquo is obvious (we need an even number toshow for the proposition to hold)It doesnrsquot matter whatrsquos on the other side of ldquoKrdquo (the proposition makesno claim about cards with a consonant)Nor does it matter whatrsquos on the other side of ldquo4rdquo (if itrsquos a vowel great ifitrsquos a consonant no rule was violated either)We need to check ldquo7rdquo (if a vowel shows up the proposition is false)

aOnly about 10 of the population get this rightfasshaueriitedu MATH 100 ndash ITP 19

Looking Ahead Toward Proofs

When we do a mathematical proof then we need to decide whether acertain mathematical statement is logically true or not

The direct approach (known as modus ponens ie method byaffirmation) is to conclude

If φ and (φrArr ψ) then ψ

Example

Show that if n is an even integer then (minus1)n = 1

Proofn is an arbitrary even integer so n = 2k for some integer k But then

(minus1)n = (minus1)2k =((minus1)2︸ ︷︷ ︸

=1

)k= 1k = 1

fasshaueriitedu MATH 100 ndash ITP 20

Looking Ahead Toward Proofs

Contrapositive

Sometimes it is difficult to prove an implication directly In this case wecan try to show that the contrapositive of the conditional holds ie weuse (see HW 2211)

φrArr ψ is equivalent to (notψ)rArr (notφ)

and conclude (modus tollens method by denial)

If φ and ((notψ)rArr (notφ)) then ψ

Note that this has nothing to do with proof by contradiction (more onthat later)

Example

Conditional If you average 85 or above then you will get an AContrapositive If you donrsquotdidnrsquot get an A then you donrsquotdidnrsquot average85 or above

fasshaueriitedu MATH 100 ndash ITP 21

Looking Ahead Toward Proofs

Converse

Do not confuse the contrapositive of a conditional with its converse

If φrArr ψ then its converse is ψ rArr φ

There is no logical connection between a conditional and its converse

The only link is that if both are true then the biconditional holds ie

(φrArr ψ) and (ψ rArr φ) is equivalent to (φhArr ψ)

Example

Conditional If you average 85 or above then you will get an AContrapositive If you donrsquotdidnrsquot get an A then you donrsquotdidnrsquot average85 or aboveConverse If you getgot an A then you averageaveraged 85 or above

Note The converse assures us that scoring 85 or above isnecessary for an A (not so good for you _)

fasshaueriitedu MATH 100 ndash ITP 22

Looking Ahead Toward Proofs

Also do not confuse a statement with itsconverse

More Lewis CarrolllsquoNot the same thing a bitrsquo saidthe Hatter lsquoYou might just as wellsay that ldquoI see what I eatrdquo is thesame thing as ldquoI eat what I seerdquorsquo

From ldquoAlice in Wonderlandrdquo by Lewis Carroll (seehttpwwwonline-literaturecomcarrollalice7 forthe complete Chapter 7 A Mad Tea Party)

fasshaueriitedu MATH 100 ndash ITP 23

Looking Ahead Toward Proofs

Inverse

One could also consider the contrapositive of the converse5 of aconditional also known as the inverse of the conditional

Example

Conditional If you average 85 or above then you will get an AContrapositive If you donrsquotdidnrsquot get an A then you donrsquotdidnrsquot average85 or aboveConverse If you getgot an A then you averageaveraged 85 or aboveInverse If you donrsquot average 85 or above then you wonrsquot get an A

Note The inverse (which is equivalent to the converse) perhaps showseven better that scoring 85 or above is necessary for an A

5Or equivalently the converse of the contrapositivefasshaueriitedu MATH 100 ndash ITP 24

Looking Ahead Toward Proofs

Negated Conditional

You also might be tempted to confuse the contrapositive of aconditional with its negation As we showed earlier the negation of aconditional

not(φrArr ψ) is equivalent to φ and (notψ)

which is different from the contrapositive of φrArr ψ

(notψ)rArr (notφ)

The latter would be equivalent to (verify this)

(notφ) or ψ

fasshaueriitedu MATH 100 ndash ITP 25

Looking Ahead Toward Proofs

We just said that the negated conditional is

φ and (notψ)

Example

Conditional If you average 85 or above then you will get an AContrapositive If you donrsquotdidnrsquot get an A then you donrsquotdidnrsquot average85 or aboveConverse If you getgot an A then you averageaveraged 85 or aboveInverse If you donrsquot average 85 or above then you wonrsquot get an ANegated conditional You average 85 or above and you wonrsquot get an A

Note The negated conditional is only true if the conditional is falseie in the case when I break my promise

fasshaueriitedu MATH 100 ndash ITP 26

Looking Ahead Toward Proofs

The perverse cube of reversed implications

notφrArr notψφornotψ

larrrarr notψ rArr notφψornotφ

l lφrArr ψnotφorψ

larrrarr ψ rArr φnotψorφ

l Negation l

not (notφrArr notψ)notφandψ

middot middot middot not (notψ rArr notφ)notψandφ

l lnot (φrArr ψ)

φandnotψmiddot middot middot not (ψ rArr φ)

ψandnotφ

Create the truth tables for all these statements to verify their relations

fasshaueriitedu MATH 100 ndash ITP 27

Quantifiers

ldquoFor allrdquo and ldquothere existsrdquo

Universal quantifier forallx ldquofor all x it is the case that rdquoExistential quantifier existx ldquothere exists an x such that rdquo

Example (in Mathematica ndash quantifiers donrsquot exist in MATLAB)ForAll[x Element[xReals] x^2 + 2 x + c gt 0]Reduce[ c] ( find c st the statement is T )

In words For what values of c is the inequality x2 + 2x + c gt 0 true forall values of x

Example (in Mathematica)Exists[x x^2 + 2 x + c == 0 ampamp x gt 0]Reduce[ c Reals] (consider only real numbers)

In words For what values of c does the equation x2 + 2x + c = 0 havea positive solution x When does a positive solution exista

aExistence (and uniqueness) of a solution are fundamental issues in math

fasshaueriitedu MATH 100 ndash ITP 28

Quantifiers

We can also nicely visualize whatrsquos going on in Mathematica

Manipulate[Plot[x^2 + 2 x + c x -5 5PlotRange -gt -6 10] c -5 5]

This shows thatfor c le 0 there is an intersection with the positive x-axis so apositive solution to the equation x2 + 2x + c = 0 existsfor c gt 0 the parabola does not intersect the positive x-axis sothe equation x2 + 2x + c = 0 is false for positive values of x for c gt 1 the parabola does not intersect the x-axis at all so theinequality x2 + 2x + c gt 0 is true for all values of x (but theequation x2 + 2x + c = 0 is false)

RemarkWe could also use a restricted domain for the existence example ie

Exists[x xgt0 x^2 + 2 x + c == 0]Reduce[ c Reals] (consider only real numbers)

fasshaueriitedu MATH 100 ndash ITP 29

Quantifiers

Example (Comparing the use of exist and forall in common language)

Consider the two statementsEverybody likes at least one drink namely water(one drink liked by everybody)Everybody likes at least one drink I myself go for beer(everybody likes some drink)

How can we formalize these two statements using quantifiers

There exists a drink D such that for every person P P likes D

(existD) (forallP) [P likes D]

For every person P there exists a drink D such that P likes D

(forallP) (existD) [P likes D]

The order of quantifiers matters What about the other two casesfasshaueriitedu MATH 100 ndash ITP 30

Quantifiers

A mathematical example

Let P be the set of prime numbers and N the set of natural numbersThen

(foralln isin N) (existm isin N) [(m gt n) and (m isin P)]

says that there are infinitely many primes

Actually it says that

For whatever natural number n we pickwe can find another natural number mthat is both larger than n and a prime number

The statement m isin P (or ldquom is a prime numberrdquo) can be formalized as

(forallab isin N) [(ab = m)rArr ((a = 1) or (b = 1))]

fasshaueriitedu MATH 100 ndash ITP 31

Quantifiers

Negation of Universal Statements

Earlier we used the example (in Mathematica)

(forallx isin R)[x2 + 2x + c gt 0

]Letrsquos assume it is true ie

For all x the inequality x2 + 2x + c gt 0 is true

What if we want to negate this statement We get

not[(forallx isin R)

[x2 + 2x + c gt 0

]]Not[ForAll[x Element[xReals] x^2 + 2 x + c gt 0]]Reduce[ c] ( find c st the statement is T )

What does the statement mean (Mathematica resolved it)

There exists some x for which the inequality is not trueNote that the values of c found by Mathematica are complementary tothose for which the original statement was true

fasshaueriitedu MATH 100 ndash ITP 32

Quantifiers

Negation of Existential StatementsLetrsquos use our second earlier example

(existx isin R)[(x2 + 2x + c = 0) and (x gt 0)

]Letrsquos assume it is true ie

There exists an x such that the equation x2 + 2x + c = 0 istrue and x gt 0

What if we want to negate this statement We get

not[(existx isin R)

[(x2 + 2x + c = 0) and (x gt 0)

]]Not[Exists[x x^2 + 2 x + c == 0 ampamp x gt 0]]Reduce[ c Reals] (consider only real numbers)

What does the statement meanFor all x the equation is not true or x le 0

Again the values of c found by Mathematica are complementary tothose for which the original statement was true

fasshaueriitedu MATH 100 ndash ITP 33

Quantifiers

Using a restricted domain things are a little simpler

(existx isin R+)[x2 + 2x + c = 0

]Letrsquos assume it is true ie

There exists a positive x the equation x2 + 2x + c = 0 is true

What if we want to negate this statement We get

not[(existx isin R+)

[x2 + 2x + c = 0

]]Not[Exists[x x gt 0 x^2 + 2 x + c == 0]]Reduce[ c Reals] (consider only real numbers)

What does the statement meanFor all positive x the equation is not true

Again the values of c found by Mathematica are complementary tothose for which the original statement was true

fasshaueriitedu MATH 100 ndash ITP 34

Quantifiers

Back to Beer

We end by determining the ldquocorrectrdquo formulation for the beer exampleLetrsquos formalize the statement

All American beer tastes dreadful

We introduce the following notationB the set of all beers

A(x) the statement ldquox is AmericanrdquoD(x) the statement ldquox tastes dreadfulrdquo

Then we get(forallx isin B) [A(x)rArr D(x)]

ieFor all beers if the beer is American then it tastes dreadful

fasshaueriitedu MATH 100 ndash ITP 35

Quantifiers

Now we need to negate

(forallx isin B) [A(x)rArr D(x)]

According to our earlier discussion we have

(existx isin B)not [A(x)rArr D(x)]

which using the fact that not [φrArr ψ] is equivalent to φ and (notψ) yields

(existx isin B) [A(x) and (notD(x))]

In wordsThere exists a beer which is American and does not tastedreadful

fasshaueriitedu MATH 100 ndash ITP 36

Appendix References

References I

Devlin Keith JSet Functions and Logic (3rd Ed)Chapman amp HallCRC 2004

Moler CleveExperiments with MATLABhttpwwwmathworkscommolerexmchaptershtml

fasshaueriitedu MATH 100 ndash ITP 37

  • ``Thats Logic
  • Logical Connectives
  • Conditionals and Biconditionals
  • Truth Tables
  • Looking Ahead Toward Proofs
  • Quantifiers
  • Appendix
Page 5: MATH 100 – Introduction to the Profession - Logic

Logical Connectives

ldquoAndrdquo ldquoOrrdquo and ldquoNotrdquo

And used when two ldquosentencesrdquo hold simultaneouslyMathematical notation and ampIn words φ and ψ is T only if both φ and ψ are TExample2(in MATLAB)is_true = (3ltpi) ampamp (4gtpi)is_true = (3ltpi) amp (4gtpi)is_true = and(3ltpi 4gtpi)

Example (in Mathematica)(3ltPi) ampamp (4gtPi)And[3ltPi 4gtPi]

Truth table httpwwwwolframalphacominputi=P+2626+Q

2It is recommended that you run all the examples using either MATLAB orMathematica (or possibly Wolfram Alpha)

fasshaueriitedu MATH 100 ndash ITP 5

Logical Connectives

Or used when either one of two ldquosentencesrdquo holds (inclusiveldquoorrdquo)

Mathematical notation or |In words φ or ψ is T if at least one of φ and ψ is TExample (in MATLAB)is_true = (pilt3) || (4ltpi)is_true = (pilt3) | (4ltpi)is_true = or(pilt3 4ltpi)

Example (in Mathematica)(Pilt3) || (4ltPi)Or[Pilt3 4ltPi]

Truth table httpwwwwolframalphacominputi=P+||+Q

fasshaueriitedu MATH 100 ndash ITP 6

Logical Connectives

Not negates the ldquosentencerdquoMathematical notation not simIn words notφ is T if φ is FExample (in MATLAB)is_true = ~(3ltpi)is_true = not(3ltpi)

Example (in Mathematica)(3ltPi)Not[3ltPi]

Truth tableφ notφT FF T

fasshaueriitedu MATH 100 ndash ITP 7

Logical Connectives

Example (Negating a statement)

Being a German who loves a good beer Irsquove been asked by myGerman friends how I can live in the US claiming

All American beer tastes dreadful

Obviously this is not true So how do I reply if I want to negate thisstatement

1 Not all American beer tastes dreadful2 All non-American (ie German) beer tastes great3 All American beer tastes great4 All American beer does not taste dreadful5 At least one American beer tastes great6 At least one American beer does not taste dreadful

We will see below which of these statements is logically mostappropriate

fasshaueriitedu MATH 100 ndash ITP 8

Logical Connectives

Example (Leap year calculation from Ch 3 [ExM])Using this year (1st element of vector returned by clock function)

c = clock y = c(1)mod(y4) == 0 ampamp mod(y100) ~= 0 || mod(y400) == 0

Using two years at once

y = [2000 2100]mod(y4) == 0 ampamp mod(y100) ~= 0 || mod(y400) == 0

leads to an error Replace the ldquoshort-circuitrdquoa operators ampamp and || bythe ldquoelementwiserdquo operators amp and |

y = [2000 2100]mod(y4) == 0 amp mod(y100) ~= 0 | mod(y400) == 0

Note and and or have ldquoelementwiserdquo interpretations notldquoshort-circuitrdquo not doesnrsquot care Try it

aThe 2nd operand eg mod(y100) is evaluated only when the result isnot fully determined by the 1st operand eg mod(y4)

fasshaueriitedu MATH 100 ndash ITP 9

Logical Connectives

Example (Logical operations and arrays in MATLAB)R=rand(43)(R gt 03) amp (R lt 07)

Note here the ldquoelementwiserdquo operator is required

Example (Logical operations and find in MATLAB)find(R gt 03 amp R lt 07)

Note find goes through matrix in column-major order and returnsvector of indicesMore detailed

[rowcolval] = find(R gt 03 amp R lt 07)

fasshaueriitedu MATH 100 ndash ITP 10

Conditionals and Biconditionals

Conditional for logical implications if thenMathematical notation rArrrarrExample3 (in MATLAB)x = -3if x lt 0

abs_x = -xelse

abs_x = xendor ndash if you want a function ndash using logical multipliersabs = (x) (xlt0)(-x) + (xgt=0)xabs(-3) abs(4)Example (in Mathematica)abs[x_] = If[x lt 0 -x x]abs[-3]abs[-4]

3This computer code use is different than the mathematical use since we canrsquotassign a truth value to the ldquoif thenrdquo code fragment

fasshaueriitedu MATH 100 ndash ITP 11

Conditionals and Biconditionals

Truth tablehttpwwwwolframalphacominputi=P+Implies+QImportant concepts for all of mathematics

φ implies ψif φ then ψφ is sufficient for ψφ only if ψψ if φψ whenever φψ is necessary for φ

fasshaueriitedu MATH 100 ndash ITP 12

Conditionals and Biconditionals

Are conditionals confusingProbably so Consider the following interpretation of the truth table4

If Springfield is the capital of Illinois then Springfield is the capitalof Illinois (TrArr T is T) OKIf Springfield is the capital of Illinois then Chicago is the capital ofIllinois (TrArr F is F) This better be falseIf Chicago is the capital of Illinois then Springfield is the capital ofIllinois (FrArr T is T) WeirdIf Chicago is the capital of Illinois then Rockford is the capital ofIllinois (FrArr F is T) Very weird

Read (carefully) the discussion in [Devlin pp 18-19]Conditional in words

φrArr ψ is only then not T if ψ is F in spite of φ being T

More colloquially φrArr ψ is considered true until proven false(ldquoinnocent until proven guiltyrdquo)

4The state capital of Illinois is Springfieldfasshaueriitedu MATH 100 ndash ITP 13

Conditionals and Biconditionals

Another example for the conditional

Letrsquos consider the following promise I make to you

If you average 85 or above in this class then you will get anA

At the end of the semester we could have various outcomesYou average 90 and get an A (Trarr T is T ie I kept my promise)You average 90 and get a B (Trarr F is F ie I broke mypromise)You average 80 and get an A (Frarr T is T ie I didnrsquot break mypromise uml )You average 80 and get a B (Frarr F is T ie I didnrsquot break mypromise ndash and you received what you expected)

This illustrates perfectly that scoring 85 or higher was sufficient foran A but not necessary

fasshaueriitedu MATH 100 ndash ITP 14

Conditionals and Biconditionals

And a mathematical example

Letrsquos assume that n is a positive integer Then

(n is a perfect square with last digit 7)rArr (n is a prime number)

is a true statementThis is so because we have both (by definition)

FrArr T is TFrArr F is T

and we know that no perfect square ends in 7 (so it is irrelevant that allwe know about n is that it is a positive integer)

RemarkStatements like these (and the earlier ones about the IL state capital)do not agree with common sense Usually we work with statementsthat are in some logical context (see the discussion of causation in[Devlin p 17])

fasshaueriitedu MATH 100 ndash ITP 15

Conditionals and Biconditionals

Biconditional for logical equivalence if and only ifMathematical notation hArrharrDoes not make sense in MATLAB (only in SymbolicToolbox)Example (in Mathematica)Equivalent[3ltPi 4gtPi]

Truth table httpwwwwolframalphacominputi=P+Equivalent+Q

fasshaueriitedu MATH 100 ndash ITP 16

Truth Tables

Further insights via truth tables

Example

Prove not(φ and ψ) is equivalent to (notφ) or (notψ)

φ ψ φ and ψ not(φ and ψ)T T T FT F F TF T F TF F F T

φ ψ notφ notψ (notφ) or (notψ)T T F F FT F F T TF T T F TF F T T T

fasshaueriitedu MATH 100 ndash ITP 17

Truth Tables

Example (Exercise 229(a) in [Devlin])

Prove not(φrArr ψ) is equivalent to φ and (notψ)

φ ψ φrArr ψ not(φrArr ψ)

T T T FT F F TF T T FF F T F

φ ψ φ and (notψ)T T FT F TF T FF F F

How can we then interpret φrArr ψ in terms of and or and not (notφ) or ψ

fasshaueriitedu MATH 100 ndash ITP 18

Truth Tables

Example (Wason Selection Task Exercise 2220 in [Devlin])

Assuming each card has a letter on one face and a numberon the other which card(s) do you have to turn over in orderto test the truth of the proposition that if a card has a vowel onone face then its opposite shows an even numbera

Answer Cards ldquoErdquo and ldquo7rdquo

Checking the other side of ldquoErdquo is obvious (we need an even number toshow for the proposition to hold)It doesnrsquot matter whatrsquos on the other side of ldquoKrdquo (the proposition makesno claim about cards with a consonant)Nor does it matter whatrsquos on the other side of ldquo4rdquo (if itrsquos a vowel great ifitrsquos a consonant no rule was violated either)We need to check ldquo7rdquo (if a vowel shows up the proposition is false)

aOnly about 10 of the population get this rightfasshaueriitedu MATH 100 ndash ITP 19

Looking Ahead Toward Proofs

When we do a mathematical proof then we need to decide whether acertain mathematical statement is logically true or not

The direct approach (known as modus ponens ie method byaffirmation) is to conclude

If φ and (φrArr ψ) then ψ

Example

Show that if n is an even integer then (minus1)n = 1

Proofn is an arbitrary even integer so n = 2k for some integer k But then

(minus1)n = (minus1)2k =((minus1)2︸ ︷︷ ︸

=1

)k= 1k = 1

fasshaueriitedu MATH 100 ndash ITP 20

Looking Ahead Toward Proofs

Contrapositive

Sometimes it is difficult to prove an implication directly In this case wecan try to show that the contrapositive of the conditional holds ie weuse (see HW 2211)

φrArr ψ is equivalent to (notψ)rArr (notφ)

and conclude (modus tollens method by denial)

If φ and ((notψ)rArr (notφ)) then ψ

Note that this has nothing to do with proof by contradiction (more onthat later)

Example

Conditional If you average 85 or above then you will get an AContrapositive If you donrsquotdidnrsquot get an A then you donrsquotdidnrsquot average85 or above

fasshaueriitedu MATH 100 ndash ITP 21

Looking Ahead Toward Proofs

Converse

Do not confuse the contrapositive of a conditional with its converse

If φrArr ψ then its converse is ψ rArr φ

There is no logical connection between a conditional and its converse

The only link is that if both are true then the biconditional holds ie

(φrArr ψ) and (ψ rArr φ) is equivalent to (φhArr ψ)

Example

Conditional If you average 85 or above then you will get an AContrapositive If you donrsquotdidnrsquot get an A then you donrsquotdidnrsquot average85 or aboveConverse If you getgot an A then you averageaveraged 85 or above

Note The converse assures us that scoring 85 or above isnecessary for an A (not so good for you _)

fasshaueriitedu MATH 100 ndash ITP 22

Looking Ahead Toward Proofs

Also do not confuse a statement with itsconverse

More Lewis CarrolllsquoNot the same thing a bitrsquo saidthe Hatter lsquoYou might just as wellsay that ldquoI see what I eatrdquo is thesame thing as ldquoI eat what I seerdquorsquo

From ldquoAlice in Wonderlandrdquo by Lewis Carroll (seehttpwwwonline-literaturecomcarrollalice7 forthe complete Chapter 7 A Mad Tea Party)

fasshaueriitedu MATH 100 ndash ITP 23

Looking Ahead Toward Proofs

Inverse

One could also consider the contrapositive of the converse5 of aconditional also known as the inverse of the conditional

Example

Conditional If you average 85 or above then you will get an AContrapositive If you donrsquotdidnrsquot get an A then you donrsquotdidnrsquot average85 or aboveConverse If you getgot an A then you averageaveraged 85 or aboveInverse If you donrsquot average 85 or above then you wonrsquot get an A

Note The inverse (which is equivalent to the converse) perhaps showseven better that scoring 85 or above is necessary for an A

5Or equivalently the converse of the contrapositivefasshaueriitedu MATH 100 ndash ITP 24

Looking Ahead Toward Proofs

Negated Conditional

You also might be tempted to confuse the contrapositive of aconditional with its negation As we showed earlier the negation of aconditional

not(φrArr ψ) is equivalent to φ and (notψ)

which is different from the contrapositive of φrArr ψ

(notψ)rArr (notφ)

The latter would be equivalent to (verify this)

(notφ) or ψ

fasshaueriitedu MATH 100 ndash ITP 25

Looking Ahead Toward Proofs

We just said that the negated conditional is

φ and (notψ)

Example

Conditional If you average 85 or above then you will get an AContrapositive If you donrsquotdidnrsquot get an A then you donrsquotdidnrsquot average85 or aboveConverse If you getgot an A then you averageaveraged 85 or aboveInverse If you donrsquot average 85 or above then you wonrsquot get an ANegated conditional You average 85 or above and you wonrsquot get an A

Note The negated conditional is only true if the conditional is falseie in the case when I break my promise

fasshaueriitedu MATH 100 ndash ITP 26

Looking Ahead Toward Proofs

The perverse cube of reversed implications

notφrArr notψφornotψ

larrrarr notψ rArr notφψornotφ

l lφrArr ψnotφorψ

larrrarr ψ rArr φnotψorφ

l Negation l

not (notφrArr notψ)notφandψ

middot middot middot not (notψ rArr notφ)notψandφ

l lnot (φrArr ψ)

φandnotψmiddot middot middot not (ψ rArr φ)

ψandnotφ

Create the truth tables for all these statements to verify their relations

fasshaueriitedu MATH 100 ndash ITP 27

Quantifiers

ldquoFor allrdquo and ldquothere existsrdquo

Universal quantifier forallx ldquofor all x it is the case that rdquoExistential quantifier existx ldquothere exists an x such that rdquo

Example (in Mathematica ndash quantifiers donrsquot exist in MATLAB)ForAll[x Element[xReals] x^2 + 2 x + c gt 0]Reduce[ c] ( find c st the statement is T )

In words For what values of c is the inequality x2 + 2x + c gt 0 true forall values of x

Example (in Mathematica)Exists[x x^2 + 2 x + c == 0 ampamp x gt 0]Reduce[ c Reals] (consider only real numbers)

In words For what values of c does the equation x2 + 2x + c = 0 havea positive solution x When does a positive solution exista

aExistence (and uniqueness) of a solution are fundamental issues in math

fasshaueriitedu MATH 100 ndash ITP 28

Quantifiers

We can also nicely visualize whatrsquos going on in Mathematica

Manipulate[Plot[x^2 + 2 x + c x -5 5PlotRange -gt -6 10] c -5 5]

This shows thatfor c le 0 there is an intersection with the positive x-axis so apositive solution to the equation x2 + 2x + c = 0 existsfor c gt 0 the parabola does not intersect the positive x-axis sothe equation x2 + 2x + c = 0 is false for positive values of x for c gt 1 the parabola does not intersect the x-axis at all so theinequality x2 + 2x + c gt 0 is true for all values of x (but theequation x2 + 2x + c = 0 is false)

RemarkWe could also use a restricted domain for the existence example ie

Exists[x xgt0 x^2 + 2 x + c == 0]Reduce[ c Reals] (consider only real numbers)

fasshaueriitedu MATH 100 ndash ITP 29

Quantifiers

Example (Comparing the use of exist and forall in common language)

Consider the two statementsEverybody likes at least one drink namely water(one drink liked by everybody)Everybody likes at least one drink I myself go for beer(everybody likes some drink)

How can we formalize these two statements using quantifiers

There exists a drink D such that for every person P P likes D

(existD) (forallP) [P likes D]

For every person P there exists a drink D such that P likes D

(forallP) (existD) [P likes D]

The order of quantifiers matters What about the other two casesfasshaueriitedu MATH 100 ndash ITP 30

Quantifiers

A mathematical example

Let P be the set of prime numbers and N the set of natural numbersThen

(foralln isin N) (existm isin N) [(m gt n) and (m isin P)]

says that there are infinitely many primes

Actually it says that

For whatever natural number n we pickwe can find another natural number mthat is both larger than n and a prime number

The statement m isin P (or ldquom is a prime numberrdquo) can be formalized as

(forallab isin N) [(ab = m)rArr ((a = 1) or (b = 1))]

fasshaueriitedu MATH 100 ndash ITP 31

Quantifiers

Negation of Universal Statements

Earlier we used the example (in Mathematica)

(forallx isin R)[x2 + 2x + c gt 0

]Letrsquos assume it is true ie

For all x the inequality x2 + 2x + c gt 0 is true

What if we want to negate this statement We get

not[(forallx isin R)

[x2 + 2x + c gt 0

]]Not[ForAll[x Element[xReals] x^2 + 2 x + c gt 0]]Reduce[ c] ( find c st the statement is T )

What does the statement mean (Mathematica resolved it)

There exists some x for which the inequality is not trueNote that the values of c found by Mathematica are complementary tothose for which the original statement was true

fasshaueriitedu MATH 100 ndash ITP 32

Quantifiers

Negation of Existential StatementsLetrsquos use our second earlier example

(existx isin R)[(x2 + 2x + c = 0) and (x gt 0)

]Letrsquos assume it is true ie

There exists an x such that the equation x2 + 2x + c = 0 istrue and x gt 0

What if we want to negate this statement We get

not[(existx isin R)

[(x2 + 2x + c = 0) and (x gt 0)

]]Not[Exists[x x^2 + 2 x + c == 0 ampamp x gt 0]]Reduce[ c Reals] (consider only real numbers)

What does the statement meanFor all x the equation is not true or x le 0

Again the values of c found by Mathematica are complementary tothose for which the original statement was true

fasshaueriitedu MATH 100 ndash ITP 33

Quantifiers

Using a restricted domain things are a little simpler

(existx isin R+)[x2 + 2x + c = 0

]Letrsquos assume it is true ie

There exists a positive x the equation x2 + 2x + c = 0 is true

What if we want to negate this statement We get

not[(existx isin R+)

[x2 + 2x + c = 0

]]Not[Exists[x x gt 0 x^2 + 2 x + c == 0]]Reduce[ c Reals] (consider only real numbers)

What does the statement meanFor all positive x the equation is not true

Again the values of c found by Mathematica are complementary tothose for which the original statement was true

fasshaueriitedu MATH 100 ndash ITP 34

Quantifiers

Back to Beer

We end by determining the ldquocorrectrdquo formulation for the beer exampleLetrsquos formalize the statement

All American beer tastes dreadful

We introduce the following notationB the set of all beers

A(x) the statement ldquox is AmericanrdquoD(x) the statement ldquox tastes dreadfulrdquo

Then we get(forallx isin B) [A(x)rArr D(x)]

ieFor all beers if the beer is American then it tastes dreadful

fasshaueriitedu MATH 100 ndash ITP 35

Quantifiers

Now we need to negate

(forallx isin B) [A(x)rArr D(x)]

According to our earlier discussion we have

(existx isin B)not [A(x)rArr D(x)]

which using the fact that not [φrArr ψ] is equivalent to φ and (notψ) yields

(existx isin B) [A(x) and (notD(x))]

In wordsThere exists a beer which is American and does not tastedreadful

fasshaueriitedu MATH 100 ndash ITP 36

Appendix References

References I

Devlin Keith JSet Functions and Logic (3rd Ed)Chapman amp HallCRC 2004

Moler CleveExperiments with MATLABhttpwwwmathworkscommolerexmchaptershtml

fasshaueriitedu MATH 100 ndash ITP 37

  • ``Thats Logic
  • Logical Connectives
  • Conditionals and Biconditionals
  • Truth Tables
  • Looking Ahead Toward Proofs
  • Quantifiers
  • Appendix
Page 6: MATH 100 – Introduction to the Profession - Logic

Logical Connectives

Or used when either one of two ldquosentencesrdquo holds (inclusiveldquoorrdquo)

Mathematical notation or |In words φ or ψ is T if at least one of φ and ψ is TExample (in MATLAB)is_true = (pilt3) || (4ltpi)is_true = (pilt3) | (4ltpi)is_true = or(pilt3 4ltpi)

Example (in Mathematica)(Pilt3) || (4ltPi)Or[Pilt3 4ltPi]

Truth table httpwwwwolframalphacominputi=P+||+Q

fasshaueriitedu MATH 100 ndash ITP 6

Logical Connectives

Not negates the ldquosentencerdquoMathematical notation not simIn words notφ is T if φ is FExample (in MATLAB)is_true = ~(3ltpi)is_true = not(3ltpi)

Example (in Mathematica)(3ltPi)Not[3ltPi]

Truth tableφ notφT FF T

fasshaueriitedu MATH 100 ndash ITP 7

Logical Connectives

Example (Negating a statement)

Being a German who loves a good beer Irsquove been asked by myGerman friends how I can live in the US claiming

All American beer tastes dreadful

Obviously this is not true So how do I reply if I want to negate thisstatement

1 Not all American beer tastes dreadful2 All non-American (ie German) beer tastes great3 All American beer tastes great4 All American beer does not taste dreadful5 At least one American beer tastes great6 At least one American beer does not taste dreadful

We will see below which of these statements is logically mostappropriate

fasshaueriitedu MATH 100 ndash ITP 8

Logical Connectives

Example (Leap year calculation from Ch 3 [ExM])Using this year (1st element of vector returned by clock function)

c = clock y = c(1)mod(y4) == 0 ampamp mod(y100) ~= 0 || mod(y400) == 0

Using two years at once

y = [2000 2100]mod(y4) == 0 ampamp mod(y100) ~= 0 || mod(y400) == 0

leads to an error Replace the ldquoshort-circuitrdquoa operators ampamp and || bythe ldquoelementwiserdquo operators amp and |

y = [2000 2100]mod(y4) == 0 amp mod(y100) ~= 0 | mod(y400) == 0

Note and and or have ldquoelementwiserdquo interpretations notldquoshort-circuitrdquo not doesnrsquot care Try it

aThe 2nd operand eg mod(y100) is evaluated only when the result isnot fully determined by the 1st operand eg mod(y4)

fasshaueriitedu MATH 100 ndash ITP 9

Logical Connectives

Example (Logical operations and arrays in MATLAB)R=rand(43)(R gt 03) amp (R lt 07)

Note here the ldquoelementwiserdquo operator is required

Example (Logical operations and find in MATLAB)find(R gt 03 amp R lt 07)

Note find goes through matrix in column-major order and returnsvector of indicesMore detailed

[rowcolval] = find(R gt 03 amp R lt 07)

fasshaueriitedu MATH 100 ndash ITP 10

Conditionals and Biconditionals

Conditional for logical implications if thenMathematical notation rArrrarrExample3 (in MATLAB)x = -3if x lt 0

abs_x = -xelse

abs_x = xendor ndash if you want a function ndash using logical multipliersabs = (x) (xlt0)(-x) + (xgt=0)xabs(-3) abs(4)Example (in Mathematica)abs[x_] = If[x lt 0 -x x]abs[-3]abs[-4]

3This computer code use is different than the mathematical use since we canrsquotassign a truth value to the ldquoif thenrdquo code fragment

fasshaueriitedu MATH 100 ndash ITP 11

Conditionals and Biconditionals

Truth tablehttpwwwwolframalphacominputi=P+Implies+QImportant concepts for all of mathematics

φ implies ψif φ then ψφ is sufficient for ψφ only if ψψ if φψ whenever φψ is necessary for φ

fasshaueriitedu MATH 100 ndash ITP 12

Conditionals and Biconditionals

Are conditionals confusingProbably so Consider the following interpretation of the truth table4

If Springfield is the capital of Illinois then Springfield is the capitalof Illinois (TrArr T is T) OKIf Springfield is the capital of Illinois then Chicago is the capital ofIllinois (TrArr F is F) This better be falseIf Chicago is the capital of Illinois then Springfield is the capital ofIllinois (FrArr T is T) WeirdIf Chicago is the capital of Illinois then Rockford is the capital ofIllinois (FrArr F is T) Very weird

Read (carefully) the discussion in [Devlin pp 18-19]Conditional in words

φrArr ψ is only then not T if ψ is F in spite of φ being T

More colloquially φrArr ψ is considered true until proven false(ldquoinnocent until proven guiltyrdquo)

4The state capital of Illinois is Springfieldfasshaueriitedu MATH 100 ndash ITP 13

Conditionals and Biconditionals

Another example for the conditional

Letrsquos consider the following promise I make to you

If you average 85 or above in this class then you will get anA

At the end of the semester we could have various outcomesYou average 90 and get an A (Trarr T is T ie I kept my promise)You average 90 and get a B (Trarr F is F ie I broke mypromise)You average 80 and get an A (Frarr T is T ie I didnrsquot break mypromise uml )You average 80 and get a B (Frarr F is T ie I didnrsquot break mypromise ndash and you received what you expected)

This illustrates perfectly that scoring 85 or higher was sufficient foran A but not necessary

fasshaueriitedu MATH 100 ndash ITP 14

Conditionals and Biconditionals

And a mathematical example

Letrsquos assume that n is a positive integer Then

(n is a perfect square with last digit 7)rArr (n is a prime number)

is a true statementThis is so because we have both (by definition)

FrArr T is TFrArr F is T

and we know that no perfect square ends in 7 (so it is irrelevant that allwe know about n is that it is a positive integer)

RemarkStatements like these (and the earlier ones about the IL state capital)do not agree with common sense Usually we work with statementsthat are in some logical context (see the discussion of causation in[Devlin p 17])

fasshaueriitedu MATH 100 ndash ITP 15

Conditionals and Biconditionals

Biconditional for logical equivalence if and only ifMathematical notation hArrharrDoes not make sense in MATLAB (only in SymbolicToolbox)Example (in Mathematica)Equivalent[3ltPi 4gtPi]

Truth table httpwwwwolframalphacominputi=P+Equivalent+Q

fasshaueriitedu MATH 100 ndash ITP 16

Truth Tables

Further insights via truth tables

Example

Prove not(φ and ψ) is equivalent to (notφ) or (notψ)

φ ψ φ and ψ not(φ and ψ)T T T FT F F TF T F TF F F T

φ ψ notφ notψ (notφ) or (notψ)T T F F FT F F T TF T T F TF F T T T

fasshaueriitedu MATH 100 ndash ITP 17

Truth Tables

Example (Exercise 229(a) in [Devlin])

Prove not(φrArr ψ) is equivalent to φ and (notψ)

φ ψ φrArr ψ not(φrArr ψ)

T T T FT F F TF T T FF F T F

φ ψ φ and (notψ)T T FT F TF T FF F F

How can we then interpret φrArr ψ in terms of and or and not (notφ) or ψ

fasshaueriitedu MATH 100 ndash ITP 18

Truth Tables

Example (Wason Selection Task Exercise 2220 in [Devlin])

Assuming each card has a letter on one face and a numberon the other which card(s) do you have to turn over in orderto test the truth of the proposition that if a card has a vowel onone face then its opposite shows an even numbera

Answer Cards ldquoErdquo and ldquo7rdquo

Checking the other side of ldquoErdquo is obvious (we need an even number toshow for the proposition to hold)It doesnrsquot matter whatrsquos on the other side of ldquoKrdquo (the proposition makesno claim about cards with a consonant)Nor does it matter whatrsquos on the other side of ldquo4rdquo (if itrsquos a vowel great ifitrsquos a consonant no rule was violated either)We need to check ldquo7rdquo (if a vowel shows up the proposition is false)

aOnly about 10 of the population get this rightfasshaueriitedu MATH 100 ndash ITP 19

Looking Ahead Toward Proofs

When we do a mathematical proof then we need to decide whether acertain mathematical statement is logically true or not

The direct approach (known as modus ponens ie method byaffirmation) is to conclude

If φ and (φrArr ψ) then ψ

Example

Show that if n is an even integer then (minus1)n = 1

Proofn is an arbitrary even integer so n = 2k for some integer k But then

(minus1)n = (minus1)2k =((minus1)2︸ ︷︷ ︸

=1

)k= 1k = 1

fasshaueriitedu MATH 100 ndash ITP 20

Looking Ahead Toward Proofs

Contrapositive

Sometimes it is difficult to prove an implication directly In this case wecan try to show that the contrapositive of the conditional holds ie weuse (see HW 2211)

φrArr ψ is equivalent to (notψ)rArr (notφ)

and conclude (modus tollens method by denial)

If φ and ((notψ)rArr (notφ)) then ψ

Note that this has nothing to do with proof by contradiction (more onthat later)

Example

Conditional If you average 85 or above then you will get an AContrapositive If you donrsquotdidnrsquot get an A then you donrsquotdidnrsquot average85 or above

fasshaueriitedu MATH 100 ndash ITP 21

Looking Ahead Toward Proofs

Converse

Do not confuse the contrapositive of a conditional with its converse

If φrArr ψ then its converse is ψ rArr φ

There is no logical connection between a conditional and its converse

The only link is that if both are true then the biconditional holds ie

(φrArr ψ) and (ψ rArr φ) is equivalent to (φhArr ψ)

Example

Conditional If you average 85 or above then you will get an AContrapositive If you donrsquotdidnrsquot get an A then you donrsquotdidnrsquot average85 or aboveConverse If you getgot an A then you averageaveraged 85 or above

Note The converse assures us that scoring 85 or above isnecessary for an A (not so good for you _)

fasshaueriitedu MATH 100 ndash ITP 22

Looking Ahead Toward Proofs

Also do not confuse a statement with itsconverse

More Lewis CarrolllsquoNot the same thing a bitrsquo saidthe Hatter lsquoYou might just as wellsay that ldquoI see what I eatrdquo is thesame thing as ldquoI eat what I seerdquorsquo

From ldquoAlice in Wonderlandrdquo by Lewis Carroll (seehttpwwwonline-literaturecomcarrollalice7 forthe complete Chapter 7 A Mad Tea Party)

fasshaueriitedu MATH 100 ndash ITP 23

Looking Ahead Toward Proofs

Inverse

One could also consider the contrapositive of the converse5 of aconditional also known as the inverse of the conditional

Example

Conditional If you average 85 or above then you will get an AContrapositive If you donrsquotdidnrsquot get an A then you donrsquotdidnrsquot average85 or aboveConverse If you getgot an A then you averageaveraged 85 or aboveInverse If you donrsquot average 85 or above then you wonrsquot get an A

Note The inverse (which is equivalent to the converse) perhaps showseven better that scoring 85 or above is necessary for an A

5Or equivalently the converse of the contrapositivefasshaueriitedu MATH 100 ndash ITP 24

Looking Ahead Toward Proofs

Negated Conditional

You also might be tempted to confuse the contrapositive of aconditional with its negation As we showed earlier the negation of aconditional

not(φrArr ψ) is equivalent to φ and (notψ)

which is different from the contrapositive of φrArr ψ

(notψ)rArr (notφ)

The latter would be equivalent to (verify this)

(notφ) or ψ

fasshaueriitedu MATH 100 ndash ITP 25

Looking Ahead Toward Proofs

We just said that the negated conditional is

φ and (notψ)

Example

Conditional If you average 85 or above then you will get an AContrapositive If you donrsquotdidnrsquot get an A then you donrsquotdidnrsquot average85 or aboveConverse If you getgot an A then you averageaveraged 85 or aboveInverse If you donrsquot average 85 or above then you wonrsquot get an ANegated conditional You average 85 or above and you wonrsquot get an A

Note The negated conditional is only true if the conditional is falseie in the case when I break my promise

fasshaueriitedu MATH 100 ndash ITP 26

Looking Ahead Toward Proofs

The perverse cube of reversed implications

notφrArr notψφornotψ

larrrarr notψ rArr notφψornotφ

l lφrArr ψnotφorψ

larrrarr ψ rArr φnotψorφ

l Negation l

not (notφrArr notψ)notφandψ

middot middot middot not (notψ rArr notφ)notψandφ

l lnot (φrArr ψ)

φandnotψmiddot middot middot not (ψ rArr φ)

ψandnotφ

Create the truth tables for all these statements to verify their relations

fasshaueriitedu MATH 100 ndash ITP 27

Quantifiers

ldquoFor allrdquo and ldquothere existsrdquo

Universal quantifier forallx ldquofor all x it is the case that rdquoExistential quantifier existx ldquothere exists an x such that rdquo

Example (in Mathematica ndash quantifiers donrsquot exist in MATLAB)ForAll[x Element[xReals] x^2 + 2 x + c gt 0]Reduce[ c] ( find c st the statement is T )

In words For what values of c is the inequality x2 + 2x + c gt 0 true forall values of x

Example (in Mathematica)Exists[x x^2 + 2 x + c == 0 ampamp x gt 0]Reduce[ c Reals] (consider only real numbers)

In words For what values of c does the equation x2 + 2x + c = 0 havea positive solution x When does a positive solution exista

aExistence (and uniqueness) of a solution are fundamental issues in math

fasshaueriitedu MATH 100 ndash ITP 28

Quantifiers

We can also nicely visualize whatrsquos going on in Mathematica

Manipulate[Plot[x^2 + 2 x + c x -5 5PlotRange -gt -6 10] c -5 5]

This shows thatfor c le 0 there is an intersection with the positive x-axis so apositive solution to the equation x2 + 2x + c = 0 existsfor c gt 0 the parabola does not intersect the positive x-axis sothe equation x2 + 2x + c = 0 is false for positive values of x for c gt 1 the parabola does not intersect the x-axis at all so theinequality x2 + 2x + c gt 0 is true for all values of x (but theequation x2 + 2x + c = 0 is false)

RemarkWe could also use a restricted domain for the existence example ie

Exists[x xgt0 x^2 + 2 x + c == 0]Reduce[ c Reals] (consider only real numbers)

fasshaueriitedu MATH 100 ndash ITP 29

Quantifiers

Example (Comparing the use of exist and forall in common language)

Consider the two statementsEverybody likes at least one drink namely water(one drink liked by everybody)Everybody likes at least one drink I myself go for beer(everybody likes some drink)

How can we formalize these two statements using quantifiers

There exists a drink D such that for every person P P likes D

(existD) (forallP) [P likes D]

For every person P there exists a drink D such that P likes D

(forallP) (existD) [P likes D]

The order of quantifiers matters What about the other two casesfasshaueriitedu MATH 100 ndash ITP 30

Quantifiers

A mathematical example

Let P be the set of prime numbers and N the set of natural numbersThen

(foralln isin N) (existm isin N) [(m gt n) and (m isin P)]

says that there are infinitely many primes

Actually it says that

For whatever natural number n we pickwe can find another natural number mthat is both larger than n and a prime number

The statement m isin P (or ldquom is a prime numberrdquo) can be formalized as

(forallab isin N) [(ab = m)rArr ((a = 1) or (b = 1))]

fasshaueriitedu MATH 100 ndash ITP 31

Quantifiers

Negation of Universal Statements

Earlier we used the example (in Mathematica)

(forallx isin R)[x2 + 2x + c gt 0

]Letrsquos assume it is true ie

For all x the inequality x2 + 2x + c gt 0 is true

What if we want to negate this statement We get

not[(forallx isin R)

[x2 + 2x + c gt 0

]]Not[ForAll[x Element[xReals] x^2 + 2 x + c gt 0]]Reduce[ c] ( find c st the statement is T )

What does the statement mean (Mathematica resolved it)

There exists some x for which the inequality is not trueNote that the values of c found by Mathematica are complementary tothose for which the original statement was true

fasshaueriitedu MATH 100 ndash ITP 32

Quantifiers

Negation of Existential StatementsLetrsquos use our second earlier example

(existx isin R)[(x2 + 2x + c = 0) and (x gt 0)

]Letrsquos assume it is true ie

There exists an x such that the equation x2 + 2x + c = 0 istrue and x gt 0

What if we want to negate this statement We get

not[(existx isin R)

[(x2 + 2x + c = 0) and (x gt 0)

]]Not[Exists[x x^2 + 2 x + c == 0 ampamp x gt 0]]Reduce[ c Reals] (consider only real numbers)

What does the statement meanFor all x the equation is not true or x le 0

Again the values of c found by Mathematica are complementary tothose for which the original statement was true

fasshaueriitedu MATH 100 ndash ITP 33

Quantifiers

Using a restricted domain things are a little simpler

(existx isin R+)[x2 + 2x + c = 0

]Letrsquos assume it is true ie

There exists a positive x the equation x2 + 2x + c = 0 is true

What if we want to negate this statement We get

not[(existx isin R+)

[x2 + 2x + c = 0

]]Not[Exists[x x gt 0 x^2 + 2 x + c == 0]]Reduce[ c Reals] (consider only real numbers)

What does the statement meanFor all positive x the equation is not true

Again the values of c found by Mathematica are complementary tothose for which the original statement was true

fasshaueriitedu MATH 100 ndash ITP 34

Quantifiers

Back to Beer

We end by determining the ldquocorrectrdquo formulation for the beer exampleLetrsquos formalize the statement

All American beer tastes dreadful

We introduce the following notationB the set of all beers

A(x) the statement ldquox is AmericanrdquoD(x) the statement ldquox tastes dreadfulrdquo

Then we get(forallx isin B) [A(x)rArr D(x)]

ieFor all beers if the beer is American then it tastes dreadful

fasshaueriitedu MATH 100 ndash ITP 35

Quantifiers

Now we need to negate

(forallx isin B) [A(x)rArr D(x)]

According to our earlier discussion we have

(existx isin B)not [A(x)rArr D(x)]

which using the fact that not [φrArr ψ] is equivalent to φ and (notψ) yields

(existx isin B) [A(x) and (notD(x))]

In wordsThere exists a beer which is American and does not tastedreadful

fasshaueriitedu MATH 100 ndash ITP 36

Appendix References

References I

Devlin Keith JSet Functions and Logic (3rd Ed)Chapman amp HallCRC 2004

Moler CleveExperiments with MATLABhttpwwwmathworkscommolerexmchaptershtml

fasshaueriitedu MATH 100 ndash ITP 37

  • ``Thats Logic
  • Logical Connectives
  • Conditionals and Biconditionals
  • Truth Tables
  • Looking Ahead Toward Proofs
  • Quantifiers
  • Appendix
Page 7: MATH 100 – Introduction to the Profession - Logic

Logical Connectives

Not negates the ldquosentencerdquoMathematical notation not simIn words notφ is T if φ is FExample (in MATLAB)is_true = ~(3ltpi)is_true = not(3ltpi)

Example (in Mathematica)(3ltPi)Not[3ltPi]

Truth tableφ notφT FF T

fasshaueriitedu MATH 100 ndash ITP 7

Logical Connectives

Example (Negating a statement)

Being a German who loves a good beer Irsquove been asked by myGerman friends how I can live in the US claiming

All American beer tastes dreadful

Obviously this is not true So how do I reply if I want to negate thisstatement

1 Not all American beer tastes dreadful2 All non-American (ie German) beer tastes great3 All American beer tastes great4 All American beer does not taste dreadful5 At least one American beer tastes great6 At least one American beer does not taste dreadful

We will see below which of these statements is logically mostappropriate

fasshaueriitedu MATH 100 ndash ITP 8

Logical Connectives

Example (Leap year calculation from Ch 3 [ExM])Using this year (1st element of vector returned by clock function)

c = clock y = c(1)mod(y4) == 0 ampamp mod(y100) ~= 0 || mod(y400) == 0

Using two years at once

y = [2000 2100]mod(y4) == 0 ampamp mod(y100) ~= 0 || mod(y400) == 0

leads to an error Replace the ldquoshort-circuitrdquoa operators ampamp and || bythe ldquoelementwiserdquo operators amp and |

y = [2000 2100]mod(y4) == 0 amp mod(y100) ~= 0 | mod(y400) == 0

Note and and or have ldquoelementwiserdquo interpretations notldquoshort-circuitrdquo not doesnrsquot care Try it

aThe 2nd operand eg mod(y100) is evaluated only when the result isnot fully determined by the 1st operand eg mod(y4)

fasshaueriitedu MATH 100 ndash ITP 9

Logical Connectives

Example (Logical operations and arrays in MATLAB)R=rand(43)(R gt 03) amp (R lt 07)

Note here the ldquoelementwiserdquo operator is required

Example (Logical operations and find in MATLAB)find(R gt 03 amp R lt 07)

Note find goes through matrix in column-major order and returnsvector of indicesMore detailed

[rowcolval] = find(R gt 03 amp R lt 07)

fasshaueriitedu MATH 100 ndash ITP 10

Conditionals and Biconditionals

Conditional for logical implications if thenMathematical notation rArrrarrExample3 (in MATLAB)x = -3if x lt 0

abs_x = -xelse

abs_x = xendor ndash if you want a function ndash using logical multipliersabs = (x) (xlt0)(-x) + (xgt=0)xabs(-3) abs(4)Example (in Mathematica)abs[x_] = If[x lt 0 -x x]abs[-3]abs[-4]

3This computer code use is different than the mathematical use since we canrsquotassign a truth value to the ldquoif thenrdquo code fragment

fasshaueriitedu MATH 100 ndash ITP 11

Conditionals and Biconditionals

Truth tablehttpwwwwolframalphacominputi=P+Implies+QImportant concepts for all of mathematics

φ implies ψif φ then ψφ is sufficient for ψφ only if ψψ if φψ whenever φψ is necessary for φ

fasshaueriitedu MATH 100 ndash ITP 12

Conditionals and Biconditionals

Are conditionals confusingProbably so Consider the following interpretation of the truth table4

If Springfield is the capital of Illinois then Springfield is the capitalof Illinois (TrArr T is T) OKIf Springfield is the capital of Illinois then Chicago is the capital ofIllinois (TrArr F is F) This better be falseIf Chicago is the capital of Illinois then Springfield is the capital ofIllinois (FrArr T is T) WeirdIf Chicago is the capital of Illinois then Rockford is the capital ofIllinois (FrArr F is T) Very weird

Read (carefully) the discussion in [Devlin pp 18-19]Conditional in words

φrArr ψ is only then not T if ψ is F in spite of φ being T

More colloquially φrArr ψ is considered true until proven false(ldquoinnocent until proven guiltyrdquo)

4The state capital of Illinois is Springfieldfasshaueriitedu MATH 100 ndash ITP 13

Conditionals and Biconditionals

Another example for the conditional

Letrsquos consider the following promise I make to you

If you average 85 or above in this class then you will get anA

At the end of the semester we could have various outcomesYou average 90 and get an A (Trarr T is T ie I kept my promise)You average 90 and get a B (Trarr F is F ie I broke mypromise)You average 80 and get an A (Frarr T is T ie I didnrsquot break mypromise uml )You average 80 and get a B (Frarr F is T ie I didnrsquot break mypromise ndash and you received what you expected)

This illustrates perfectly that scoring 85 or higher was sufficient foran A but not necessary

fasshaueriitedu MATH 100 ndash ITP 14

Conditionals and Biconditionals

And a mathematical example

Letrsquos assume that n is a positive integer Then

(n is a perfect square with last digit 7)rArr (n is a prime number)

is a true statementThis is so because we have both (by definition)

FrArr T is TFrArr F is T

and we know that no perfect square ends in 7 (so it is irrelevant that allwe know about n is that it is a positive integer)

RemarkStatements like these (and the earlier ones about the IL state capital)do not agree with common sense Usually we work with statementsthat are in some logical context (see the discussion of causation in[Devlin p 17])

fasshaueriitedu MATH 100 ndash ITP 15

Conditionals and Biconditionals

Biconditional for logical equivalence if and only ifMathematical notation hArrharrDoes not make sense in MATLAB (only in SymbolicToolbox)Example (in Mathematica)Equivalent[3ltPi 4gtPi]

Truth table httpwwwwolframalphacominputi=P+Equivalent+Q

fasshaueriitedu MATH 100 ndash ITP 16

Truth Tables

Further insights via truth tables

Example

Prove not(φ and ψ) is equivalent to (notφ) or (notψ)

φ ψ φ and ψ not(φ and ψ)T T T FT F F TF T F TF F F T

φ ψ notφ notψ (notφ) or (notψ)T T F F FT F F T TF T T F TF F T T T

fasshaueriitedu MATH 100 ndash ITP 17

Truth Tables

Example (Exercise 229(a) in [Devlin])

Prove not(φrArr ψ) is equivalent to φ and (notψ)

φ ψ φrArr ψ not(φrArr ψ)

T T T FT F F TF T T FF F T F

φ ψ φ and (notψ)T T FT F TF T FF F F

How can we then interpret φrArr ψ in terms of and or and not (notφ) or ψ

fasshaueriitedu MATH 100 ndash ITP 18

Truth Tables

Example (Wason Selection Task Exercise 2220 in [Devlin])

Assuming each card has a letter on one face and a numberon the other which card(s) do you have to turn over in orderto test the truth of the proposition that if a card has a vowel onone face then its opposite shows an even numbera

Answer Cards ldquoErdquo and ldquo7rdquo

Checking the other side of ldquoErdquo is obvious (we need an even number toshow for the proposition to hold)It doesnrsquot matter whatrsquos on the other side of ldquoKrdquo (the proposition makesno claim about cards with a consonant)Nor does it matter whatrsquos on the other side of ldquo4rdquo (if itrsquos a vowel great ifitrsquos a consonant no rule was violated either)We need to check ldquo7rdquo (if a vowel shows up the proposition is false)

aOnly about 10 of the population get this rightfasshaueriitedu MATH 100 ndash ITP 19

Looking Ahead Toward Proofs

When we do a mathematical proof then we need to decide whether acertain mathematical statement is logically true or not

The direct approach (known as modus ponens ie method byaffirmation) is to conclude

If φ and (φrArr ψ) then ψ

Example

Show that if n is an even integer then (minus1)n = 1

Proofn is an arbitrary even integer so n = 2k for some integer k But then

(minus1)n = (minus1)2k =((minus1)2︸ ︷︷ ︸

=1

)k= 1k = 1

fasshaueriitedu MATH 100 ndash ITP 20

Looking Ahead Toward Proofs

Contrapositive

Sometimes it is difficult to prove an implication directly In this case wecan try to show that the contrapositive of the conditional holds ie weuse (see HW 2211)

φrArr ψ is equivalent to (notψ)rArr (notφ)

and conclude (modus tollens method by denial)

If φ and ((notψ)rArr (notφ)) then ψ

Note that this has nothing to do with proof by contradiction (more onthat later)

Example

Conditional If you average 85 or above then you will get an AContrapositive If you donrsquotdidnrsquot get an A then you donrsquotdidnrsquot average85 or above

fasshaueriitedu MATH 100 ndash ITP 21

Looking Ahead Toward Proofs

Converse

Do not confuse the contrapositive of a conditional with its converse

If φrArr ψ then its converse is ψ rArr φ

There is no logical connection between a conditional and its converse

The only link is that if both are true then the biconditional holds ie

(φrArr ψ) and (ψ rArr φ) is equivalent to (φhArr ψ)

Example

Conditional If you average 85 or above then you will get an AContrapositive If you donrsquotdidnrsquot get an A then you donrsquotdidnrsquot average85 or aboveConverse If you getgot an A then you averageaveraged 85 or above

Note The converse assures us that scoring 85 or above isnecessary for an A (not so good for you _)

fasshaueriitedu MATH 100 ndash ITP 22

Looking Ahead Toward Proofs

Also do not confuse a statement with itsconverse

More Lewis CarrolllsquoNot the same thing a bitrsquo saidthe Hatter lsquoYou might just as wellsay that ldquoI see what I eatrdquo is thesame thing as ldquoI eat what I seerdquorsquo

From ldquoAlice in Wonderlandrdquo by Lewis Carroll (seehttpwwwonline-literaturecomcarrollalice7 forthe complete Chapter 7 A Mad Tea Party)

fasshaueriitedu MATH 100 ndash ITP 23

Looking Ahead Toward Proofs

Inverse

One could also consider the contrapositive of the converse5 of aconditional also known as the inverse of the conditional

Example

Conditional If you average 85 or above then you will get an AContrapositive If you donrsquotdidnrsquot get an A then you donrsquotdidnrsquot average85 or aboveConverse If you getgot an A then you averageaveraged 85 or aboveInverse If you donrsquot average 85 or above then you wonrsquot get an A

Note The inverse (which is equivalent to the converse) perhaps showseven better that scoring 85 or above is necessary for an A

5Or equivalently the converse of the contrapositivefasshaueriitedu MATH 100 ndash ITP 24

Looking Ahead Toward Proofs

Negated Conditional

You also might be tempted to confuse the contrapositive of aconditional with its negation As we showed earlier the negation of aconditional

not(φrArr ψ) is equivalent to φ and (notψ)

which is different from the contrapositive of φrArr ψ

(notψ)rArr (notφ)

The latter would be equivalent to (verify this)

(notφ) or ψ

fasshaueriitedu MATH 100 ndash ITP 25

Looking Ahead Toward Proofs

We just said that the negated conditional is

φ and (notψ)

Example

Conditional If you average 85 or above then you will get an AContrapositive If you donrsquotdidnrsquot get an A then you donrsquotdidnrsquot average85 or aboveConverse If you getgot an A then you averageaveraged 85 or aboveInverse If you donrsquot average 85 or above then you wonrsquot get an ANegated conditional You average 85 or above and you wonrsquot get an A

Note The negated conditional is only true if the conditional is falseie in the case when I break my promise

fasshaueriitedu MATH 100 ndash ITP 26

Looking Ahead Toward Proofs

The perverse cube of reversed implications

notφrArr notψφornotψ

larrrarr notψ rArr notφψornotφ

l lφrArr ψnotφorψ

larrrarr ψ rArr φnotψorφ

l Negation l

not (notφrArr notψ)notφandψ

middot middot middot not (notψ rArr notφ)notψandφ

l lnot (φrArr ψ)

φandnotψmiddot middot middot not (ψ rArr φ)

ψandnotφ

Create the truth tables for all these statements to verify their relations

fasshaueriitedu MATH 100 ndash ITP 27

Quantifiers

ldquoFor allrdquo and ldquothere existsrdquo

Universal quantifier forallx ldquofor all x it is the case that rdquoExistential quantifier existx ldquothere exists an x such that rdquo

Example (in Mathematica ndash quantifiers donrsquot exist in MATLAB)ForAll[x Element[xReals] x^2 + 2 x + c gt 0]Reduce[ c] ( find c st the statement is T )

In words For what values of c is the inequality x2 + 2x + c gt 0 true forall values of x

Example (in Mathematica)Exists[x x^2 + 2 x + c == 0 ampamp x gt 0]Reduce[ c Reals] (consider only real numbers)

In words For what values of c does the equation x2 + 2x + c = 0 havea positive solution x When does a positive solution exista

aExistence (and uniqueness) of a solution are fundamental issues in math

fasshaueriitedu MATH 100 ndash ITP 28

Quantifiers

We can also nicely visualize whatrsquos going on in Mathematica

Manipulate[Plot[x^2 + 2 x + c x -5 5PlotRange -gt -6 10] c -5 5]

This shows thatfor c le 0 there is an intersection with the positive x-axis so apositive solution to the equation x2 + 2x + c = 0 existsfor c gt 0 the parabola does not intersect the positive x-axis sothe equation x2 + 2x + c = 0 is false for positive values of x for c gt 1 the parabola does not intersect the x-axis at all so theinequality x2 + 2x + c gt 0 is true for all values of x (but theequation x2 + 2x + c = 0 is false)

RemarkWe could also use a restricted domain for the existence example ie

Exists[x xgt0 x^2 + 2 x + c == 0]Reduce[ c Reals] (consider only real numbers)

fasshaueriitedu MATH 100 ndash ITP 29

Quantifiers

Example (Comparing the use of exist and forall in common language)

Consider the two statementsEverybody likes at least one drink namely water(one drink liked by everybody)Everybody likes at least one drink I myself go for beer(everybody likes some drink)

How can we formalize these two statements using quantifiers

There exists a drink D such that for every person P P likes D

(existD) (forallP) [P likes D]

For every person P there exists a drink D such that P likes D

(forallP) (existD) [P likes D]

The order of quantifiers matters What about the other two casesfasshaueriitedu MATH 100 ndash ITP 30

Quantifiers

A mathematical example

Let P be the set of prime numbers and N the set of natural numbersThen

(foralln isin N) (existm isin N) [(m gt n) and (m isin P)]

says that there are infinitely many primes

Actually it says that

For whatever natural number n we pickwe can find another natural number mthat is both larger than n and a prime number

The statement m isin P (or ldquom is a prime numberrdquo) can be formalized as

(forallab isin N) [(ab = m)rArr ((a = 1) or (b = 1))]

fasshaueriitedu MATH 100 ndash ITP 31

Quantifiers

Negation of Universal Statements

Earlier we used the example (in Mathematica)

(forallx isin R)[x2 + 2x + c gt 0

]Letrsquos assume it is true ie

For all x the inequality x2 + 2x + c gt 0 is true

What if we want to negate this statement We get

not[(forallx isin R)

[x2 + 2x + c gt 0

]]Not[ForAll[x Element[xReals] x^2 + 2 x + c gt 0]]Reduce[ c] ( find c st the statement is T )

What does the statement mean (Mathematica resolved it)

There exists some x for which the inequality is not trueNote that the values of c found by Mathematica are complementary tothose for which the original statement was true

fasshaueriitedu MATH 100 ndash ITP 32

Quantifiers

Negation of Existential StatementsLetrsquos use our second earlier example

(existx isin R)[(x2 + 2x + c = 0) and (x gt 0)

]Letrsquos assume it is true ie

There exists an x such that the equation x2 + 2x + c = 0 istrue and x gt 0

What if we want to negate this statement We get

not[(existx isin R)

[(x2 + 2x + c = 0) and (x gt 0)

]]Not[Exists[x x^2 + 2 x + c == 0 ampamp x gt 0]]Reduce[ c Reals] (consider only real numbers)

What does the statement meanFor all x the equation is not true or x le 0

Again the values of c found by Mathematica are complementary tothose for which the original statement was true

fasshaueriitedu MATH 100 ndash ITP 33

Quantifiers

Using a restricted domain things are a little simpler

(existx isin R+)[x2 + 2x + c = 0

]Letrsquos assume it is true ie

There exists a positive x the equation x2 + 2x + c = 0 is true

What if we want to negate this statement We get

not[(existx isin R+)

[x2 + 2x + c = 0

]]Not[Exists[x x gt 0 x^2 + 2 x + c == 0]]Reduce[ c Reals] (consider only real numbers)

What does the statement meanFor all positive x the equation is not true

Again the values of c found by Mathematica are complementary tothose for which the original statement was true

fasshaueriitedu MATH 100 ndash ITP 34

Quantifiers

Back to Beer

We end by determining the ldquocorrectrdquo formulation for the beer exampleLetrsquos formalize the statement

All American beer tastes dreadful

We introduce the following notationB the set of all beers

A(x) the statement ldquox is AmericanrdquoD(x) the statement ldquox tastes dreadfulrdquo

Then we get(forallx isin B) [A(x)rArr D(x)]

ieFor all beers if the beer is American then it tastes dreadful

fasshaueriitedu MATH 100 ndash ITP 35

Quantifiers

Now we need to negate

(forallx isin B) [A(x)rArr D(x)]

According to our earlier discussion we have

(existx isin B)not [A(x)rArr D(x)]

which using the fact that not [φrArr ψ] is equivalent to φ and (notψ) yields

(existx isin B) [A(x) and (notD(x))]

In wordsThere exists a beer which is American and does not tastedreadful

fasshaueriitedu MATH 100 ndash ITP 36

Appendix References

References I

Devlin Keith JSet Functions and Logic (3rd Ed)Chapman amp HallCRC 2004

Moler CleveExperiments with MATLABhttpwwwmathworkscommolerexmchaptershtml

fasshaueriitedu MATH 100 ndash ITP 37

  • ``Thats Logic
  • Logical Connectives
  • Conditionals and Biconditionals
  • Truth Tables
  • Looking Ahead Toward Proofs
  • Quantifiers
  • Appendix
Page 8: MATH 100 – Introduction to the Profession - Logic

Logical Connectives

Example (Negating a statement)

Being a German who loves a good beer Irsquove been asked by myGerman friends how I can live in the US claiming

All American beer tastes dreadful

Obviously this is not true So how do I reply if I want to negate thisstatement

1 Not all American beer tastes dreadful2 All non-American (ie German) beer tastes great3 All American beer tastes great4 All American beer does not taste dreadful5 At least one American beer tastes great6 At least one American beer does not taste dreadful

We will see below which of these statements is logically mostappropriate

fasshaueriitedu MATH 100 ndash ITP 8

Logical Connectives

Example (Leap year calculation from Ch 3 [ExM])Using this year (1st element of vector returned by clock function)

c = clock y = c(1)mod(y4) == 0 ampamp mod(y100) ~= 0 || mod(y400) == 0

Using two years at once

y = [2000 2100]mod(y4) == 0 ampamp mod(y100) ~= 0 || mod(y400) == 0

leads to an error Replace the ldquoshort-circuitrdquoa operators ampamp and || bythe ldquoelementwiserdquo operators amp and |

y = [2000 2100]mod(y4) == 0 amp mod(y100) ~= 0 | mod(y400) == 0

Note and and or have ldquoelementwiserdquo interpretations notldquoshort-circuitrdquo not doesnrsquot care Try it

aThe 2nd operand eg mod(y100) is evaluated only when the result isnot fully determined by the 1st operand eg mod(y4)

fasshaueriitedu MATH 100 ndash ITP 9

Logical Connectives

Example (Logical operations and arrays in MATLAB)R=rand(43)(R gt 03) amp (R lt 07)

Note here the ldquoelementwiserdquo operator is required

Example (Logical operations and find in MATLAB)find(R gt 03 amp R lt 07)

Note find goes through matrix in column-major order and returnsvector of indicesMore detailed

[rowcolval] = find(R gt 03 amp R lt 07)

fasshaueriitedu MATH 100 ndash ITP 10

Conditionals and Biconditionals

Conditional for logical implications if thenMathematical notation rArrrarrExample3 (in MATLAB)x = -3if x lt 0

abs_x = -xelse

abs_x = xendor ndash if you want a function ndash using logical multipliersabs = (x) (xlt0)(-x) + (xgt=0)xabs(-3) abs(4)Example (in Mathematica)abs[x_] = If[x lt 0 -x x]abs[-3]abs[-4]

3This computer code use is different than the mathematical use since we canrsquotassign a truth value to the ldquoif thenrdquo code fragment

fasshaueriitedu MATH 100 ndash ITP 11

Conditionals and Biconditionals

Truth tablehttpwwwwolframalphacominputi=P+Implies+QImportant concepts for all of mathematics

φ implies ψif φ then ψφ is sufficient for ψφ only if ψψ if φψ whenever φψ is necessary for φ

fasshaueriitedu MATH 100 ndash ITP 12

Conditionals and Biconditionals

Are conditionals confusingProbably so Consider the following interpretation of the truth table4

If Springfield is the capital of Illinois then Springfield is the capitalof Illinois (TrArr T is T) OKIf Springfield is the capital of Illinois then Chicago is the capital ofIllinois (TrArr F is F) This better be falseIf Chicago is the capital of Illinois then Springfield is the capital ofIllinois (FrArr T is T) WeirdIf Chicago is the capital of Illinois then Rockford is the capital ofIllinois (FrArr F is T) Very weird

Read (carefully) the discussion in [Devlin pp 18-19]Conditional in words

φrArr ψ is only then not T if ψ is F in spite of φ being T

More colloquially φrArr ψ is considered true until proven false(ldquoinnocent until proven guiltyrdquo)

4The state capital of Illinois is Springfieldfasshaueriitedu MATH 100 ndash ITP 13

Conditionals and Biconditionals

Another example for the conditional

Letrsquos consider the following promise I make to you

If you average 85 or above in this class then you will get anA

At the end of the semester we could have various outcomesYou average 90 and get an A (Trarr T is T ie I kept my promise)You average 90 and get a B (Trarr F is F ie I broke mypromise)You average 80 and get an A (Frarr T is T ie I didnrsquot break mypromise uml )You average 80 and get a B (Frarr F is T ie I didnrsquot break mypromise ndash and you received what you expected)

This illustrates perfectly that scoring 85 or higher was sufficient foran A but not necessary

fasshaueriitedu MATH 100 ndash ITP 14

Conditionals and Biconditionals

And a mathematical example

Letrsquos assume that n is a positive integer Then

(n is a perfect square with last digit 7)rArr (n is a prime number)

is a true statementThis is so because we have both (by definition)

FrArr T is TFrArr F is T

and we know that no perfect square ends in 7 (so it is irrelevant that allwe know about n is that it is a positive integer)

RemarkStatements like these (and the earlier ones about the IL state capital)do not agree with common sense Usually we work with statementsthat are in some logical context (see the discussion of causation in[Devlin p 17])

fasshaueriitedu MATH 100 ndash ITP 15

Conditionals and Biconditionals

Biconditional for logical equivalence if and only ifMathematical notation hArrharrDoes not make sense in MATLAB (only in SymbolicToolbox)Example (in Mathematica)Equivalent[3ltPi 4gtPi]

Truth table httpwwwwolframalphacominputi=P+Equivalent+Q

fasshaueriitedu MATH 100 ndash ITP 16

Truth Tables

Further insights via truth tables

Example

Prove not(φ and ψ) is equivalent to (notφ) or (notψ)

φ ψ φ and ψ not(φ and ψ)T T T FT F F TF T F TF F F T

φ ψ notφ notψ (notφ) or (notψ)T T F F FT F F T TF T T F TF F T T T

fasshaueriitedu MATH 100 ndash ITP 17

Truth Tables

Example (Exercise 229(a) in [Devlin])

Prove not(φrArr ψ) is equivalent to φ and (notψ)

φ ψ φrArr ψ not(φrArr ψ)

T T T FT F F TF T T FF F T F

φ ψ φ and (notψ)T T FT F TF T FF F F

How can we then interpret φrArr ψ in terms of and or and not (notφ) or ψ

fasshaueriitedu MATH 100 ndash ITP 18

Truth Tables

Example (Wason Selection Task Exercise 2220 in [Devlin])

Assuming each card has a letter on one face and a numberon the other which card(s) do you have to turn over in orderto test the truth of the proposition that if a card has a vowel onone face then its opposite shows an even numbera

Answer Cards ldquoErdquo and ldquo7rdquo

Checking the other side of ldquoErdquo is obvious (we need an even number toshow for the proposition to hold)It doesnrsquot matter whatrsquos on the other side of ldquoKrdquo (the proposition makesno claim about cards with a consonant)Nor does it matter whatrsquos on the other side of ldquo4rdquo (if itrsquos a vowel great ifitrsquos a consonant no rule was violated either)We need to check ldquo7rdquo (if a vowel shows up the proposition is false)

aOnly about 10 of the population get this rightfasshaueriitedu MATH 100 ndash ITP 19

Looking Ahead Toward Proofs

When we do a mathematical proof then we need to decide whether acertain mathematical statement is logically true or not

The direct approach (known as modus ponens ie method byaffirmation) is to conclude

If φ and (φrArr ψ) then ψ

Example

Show that if n is an even integer then (minus1)n = 1

Proofn is an arbitrary even integer so n = 2k for some integer k But then

(minus1)n = (minus1)2k =((minus1)2︸ ︷︷ ︸

=1

)k= 1k = 1

fasshaueriitedu MATH 100 ndash ITP 20

Looking Ahead Toward Proofs

Contrapositive

Sometimes it is difficult to prove an implication directly In this case wecan try to show that the contrapositive of the conditional holds ie weuse (see HW 2211)

φrArr ψ is equivalent to (notψ)rArr (notφ)

and conclude (modus tollens method by denial)

If φ and ((notψ)rArr (notφ)) then ψ

Note that this has nothing to do with proof by contradiction (more onthat later)

Example

Conditional If you average 85 or above then you will get an AContrapositive If you donrsquotdidnrsquot get an A then you donrsquotdidnrsquot average85 or above

fasshaueriitedu MATH 100 ndash ITP 21

Looking Ahead Toward Proofs

Converse

Do not confuse the contrapositive of a conditional with its converse

If φrArr ψ then its converse is ψ rArr φ

There is no logical connection between a conditional and its converse

The only link is that if both are true then the biconditional holds ie

(φrArr ψ) and (ψ rArr φ) is equivalent to (φhArr ψ)

Example

Conditional If you average 85 or above then you will get an AContrapositive If you donrsquotdidnrsquot get an A then you donrsquotdidnrsquot average85 or aboveConverse If you getgot an A then you averageaveraged 85 or above

Note The converse assures us that scoring 85 or above isnecessary for an A (not so good for you _)

fasshaueriitedu MATH 100 ndash ITP 22

Looking Ahead Toward Proofs

Also do not confuse a statement with itsconverse

More Lewis CarrolllsquoNot the same thing a bitrsquo saidthe Hatter lsquoYou might just as wellsay that ldquoI see what I eatrdquo is thesame thing as ldquoI eat what I seerdquorsquo

From ldquoAlice in Wonderlandrdquo by Lewis Carroll (seehttpwwwonline-literaturecomcarrollalice7 forthe complete Chapter 7 A Mad Tea Party)

fasshaueriitedu MATH 100 ndash ITP 23

Looking Ahead Toward Proofs

Inverse

One could also consider the contrapositive of the converse5 of aconditional also known as the inverse of the conditional

Example

Conditional If you average 85 or above then you will get an AContrapositive If you donrsquotdidnrsquot get an A then you donrsquotdidnrsquot average85 or aboveConverse If you getgot an A then you averageaveraged 85 or aboveInverse If you donrsquot average 85 or above then you wonrsquot get an A

Note The inverse (which is equivalent to the converse) perhaps showseven better that scoring 85 or above is necessary for an A

5Or equivalently the converse of the contrapositivefasshaueriitedu MATH 100 ndash ITP 24

Looking Ahead Toward Proofs

Negated Conditional

You also might be tempted to confuse the contrapositive of aconditional with its negation As we showed earlier the negation of aconditional

not(φrArr ψ) is equivalent to φ and (notψ)

which is different from the contrapositive of φrArr ψ

(notψ)rArr (notφ)

The latter would be equivalent to (verify this)

(notφ) or ψ

fasshaueriitedu MATH 100 ndash ITP 25

Looking Ahead Toward Proofs

We just said that the negated conditional is

φ and (notψ)

Example

Conditional If you average 85 or above then you will get an AContrapositive If you donrsquotdidnrsquot get an A then you donrsquotdidnrsquot average85 or aboveConverse If you getgot an A then you averageaveraged 85 or aboveInverse If you donrsquot average 85 or above then you wonrsquot get an ANegated conditional You average 85 or above and you wonrsquot get an A

Note The negated conditional is only true if the conditional is falseie in the case when I break my promise

fasshaueriitedu MATH 100 ndash ITP 26

Looking Ahead Toward Proofs

The perverse cube of reversed implications

notφrArr notψφornotψ

larrrarr notψ rArr notφψornotφ

l lφrArr ψnotφorψ

larrrarr ψ rArr φnotψorφ

l Negation l

not (notφrArr notψ)notφandψ

middot middot middot not (notψ rArr notφ)notψandφ

l lnot (φrArr ψ)

φandnotψmiddot middot middot not (ψ rArr φ)

ψandnotφ

Create the truth tables for all these statements to verify their relations

fasshaueriitedu MATH 100 ndash ITP 27

Quantifiers

ldquoFor allrdquo and ldquothere existsrdquo

Universal quantifier forallx ldquofor all x it is the case that rdquoExistential quantifier existx ldquothere exists an x such that rdquo

Example (in Mathematica ndash quantifiers donrsquot exist in MATLAB)ForAll[x Element[xReals] x^2 + 2 x + c gt 0]Reduce[ c] ( find c st the statement is T )

In words For what values of c is the inequality x2 + 2x + c gt 0 true forall values of x

Example (in Mathematica)Exists[x x^2 + 2 x + c == 0 ampamp x gt 0]Reduce[ c Reals] (consider only real numbers)

In words For what values of c does the equation x2 + 2x + c = 0 havea positive solution x When does a positive solution exista

aExistence (and uniqueness) of a solution are fundamental issues in math

fasshaueriitedu MATH 100 ndash ITP 28

Quantifiers

We can also nicely visualize whatrsquos going on in Mathematica

Manipulate[Plot[x^2 + 2 x + c x -5 5PlotRange -gt -6 10] c -5 5]

This shows thatfor c le 0 there is an intersection with the positive x-axis so apositive solution to the equation x2 + 2x + c = 0 existsfor c gt 0 the parabola does not intersect the positive x-axis sothe equation x2 + 2x + c = 0 is false for positive values of x for c gt 1 the parabola does not intersect the x-axis at all so theinequality x2 + 2x + c gt 0 is true for all values of x (but theequation x2 + 2x + c = 0 is false)

RemarkWe could also use a restricted domain for the existence example ie

Exists[x xgt0 x^2 + 2 x + c == 0]Reduce[ c Reals] (consider only real numbers)

fasshaueriitedu MATH 100 ndash ITP 29

Quantifiers

Example (Comparing the use of exist and forall in common language)

Consider the two statementsEverybody likes at least one drink namely water(one drink liked by everybody)Everybody likes at least one drink I myself go for beer(everybody likes some drink)

How can we formalize these two statements using quantifiers

There exists a drink D such that for every person P P likes D

(existD) (forallP) [P likes D]

For every person P there exists a drink D such that P likes D

(forallP) (existD) [P likes D]

The order of quantifiers matters What about the other two casesfasshaueriitedu MATH 100 ndash ITP 30

Quantifiers

A mathematical example

Let P be the set of prime numbers and N the set of natural numbersThen

(foralln isin N) (existm isin N) [(m gt n) and (m isin P)]

says that there are infinitely many primes

Actually it says that

For whatever natural number n we pickwe can find another natural number mthat is both larger than n and a prime number

The statement m isin P (or ldquom is a prime numberrdquo) can be formalized as

(forallab isin N) [(ab = m)rArr ((a = 1) or (b = 1))]

fasshaueriitedu MATH 100 ndash ITP 31

Quantifiers

Negation of Universal Statements

Earlier we used the example (in Mathematica)

(forallx isin R)[x2 + 2x + c gt 0

]Letrsquos assume it is true ie

For all x the inequality x2 + 2x + c gt 0 is true

What if we want to negate this statement We get

not[(forallx isin R)

[x2 + 2x + c gt 0

]]Not[ForAll[x Element[xReals] x^2 + 2 x + c gt 0]]Reduce[ c] ( find c st the statement is T )

What does the statement mean (Mathematica resolved it)

There exists some x for which the inequality is not trueNote that the values of c found by Mathematica are complementary tothose for which the original statement was true

fasshaueriitedu MATH 100 ndash ITP 32

Quantifiers

Negation of Existential StatementsLetrsquos use our second earlier example

(existx isin R)[(x2 + 2x + c = 0) and (x gt 0)

]Letrsquos assume it is true ie

There exists an x such that the equation x2 + 2x + c = 0 istrue and x gt 0

What if we want to negate this statement We get

not[(existx isin R)

[(x2 + 2x + c = 0) and (x gt 0)

]]Not[Exists[x x^2 + 2 x + c == 0 ampamp x gt 0]]Reduce[ c Reals] (consider only real numbers)

What does the statement meanFor all x the equation is not true or x le 0

Again the values of c found by Mathematica are complementary tothose for which the original statement was true

fasshaueriitedu MATH 100 ndash ITP 33

Quantifiers

Using a restricted domain things are a little simpler

(existx isin R+)[x2 + 2x + c = 0

]Letrsquos assume it is true ie

There exists a positive x the equation x2 + 2x + c = 0 is true

What if we want to negate this statement We get

not[(existx isin R+)

[x2 + 2x + c = 0

]]Not[Exists[x x gt 0 x^2 + 2 x + c == 0]]Reduce[ c Reals] (consider only real numbers)

What does the statement meanFor all positive x the equation is not true

Again the values of c found by Mathematica are complementary tothose for which the original statement was true

fasshaueriitedu MATH 100 ndash ITP 34

Quantifiers

Back to Beer

We end by determining the ldquocorrectrdquo formulation for the beer exampleLetrsquos formalize the statement

All American beer tastes dreadful

We introduce the following notationB the set of all beers

A(x) the statement ldquox is AmericanrdquoD(x) the statement ldquox tastes dreadfulrdquo

Then we get(forallx isin B) [A(x)rArr D(x)]

ieFor all beers if the beer is American then it tastes dreadful

fasshaueriitedu MATH 100 ndash ITP 35

Quantifiers

Now we need to negate

(forallx isin B) [A(x)rArr D(x)]

According to our earlier discussion we have

(existx isin B)not [A(x)rArr D(x)]

which using the fact that not [φrArr ψ] is equivalent to φ and (notψ) yields

(existx isin B) [A(x) and (notD(x))]

In wordsThere exists a beer which is American and does not tastedreadful

fasshaueriitedu MATH 100 ndash ITP 36

Appendix References

References I

Devlin Keith JSet Functions and Logic (3rd Ed)Chapman amp HallCRC 2004

Moler CleveExperiments with MATLABhttpwwwmathworkscommolerexmchaptershtml

fasshaueriitedu MATH 100 ndash ITP 37

  • ``Thats Logic
  • Logical Connectives
  • Conditionals and Biconditionals
  • Truth Tables
  • Looking Ahead Toward Proofs
  • Quantifiers
  • Appendix
Page 9: MATH 100 – Introduction to the Profession - Logic

Logical Connectives

Example (Leap year calculation from Ch 3 [ExM])Using this year (1st element of vector returned by clock function)

c = clock y = c(1)mod(y4) == 0 ampamp mod(y100) ~= 0 || mod(y400) == 0

Using two years at once

y = [2000 2100]mod(y4) == 0 ampamp mod(y100) ~= 0 || mod(y400) == 0

leads to an error Replace the ldquoshort-circuitrdquoa operators ampamp and || bythe ldquoelementwiserdquo operators amp and |

y = [2000 2100]mod(y4) == 0 amp mod(y100) ~= 0 | mod(y400) == 0

Note and and or have ldquoelementwiserdquo interpretations notldquoshort-circuitrdquo not doesnrsquot care Try it

aThe 2nd operand eg mod(y100) is evaluated only when the result isnot fully determined by the 1st operand eg mod(y4)

fasshaueriitedu MATH 100 ndash ITP 9

Logical Connectives

Example (Logical operations and arrays in MATLAB)R=rand(43)(R gt 03) amp (R lt 07)

Note here the ldquoelementwiserdquo operator is required

Example (Logical operations and find in MATLAB)find(R gt 03 amp R lt 07)

Note find goes through matrix in column-major order and returnsvector of indicesMore detailed

[rowcolval] = find(R gt 03 amp R lt 07)

fasshaueriitedu MATH 100 ndash ITP 10

Conditionals and Biconditionals

Conditional for logical implications if thenMathematical notation rArrrarrExample3 (in MATLAB)x = -3if x lt 0

abs_x = -xelse

abs_x = xendor ndash if you want a function ndash using logical multipliersabs = (x) (xlt0)(-x) + (xgt=0)xabs(-3) abs(4)Example (in Mathematica)abs[x_] = If[x lt 0 -x x]abs[-3]abs[-4]

3This computer code use is different than the mathematical use since we canrsquotassign a truth value to the ldquoif thenrdquo code fragment

fasshaueriitedu MATH 100 ndash ITP 11

Conditionals and Biconditionals

Truth tablehttpwwwwolframalphacominputi=P+Implies+QImportant concepts for all of mathematics

φ implies ψif φ then ψφ is sufficient for ψφ only if ψψ if φψ whenever φψ is necessary for φ

fasshaueriitedu MATH 100 ndash ITP 12

Conditionals and Biconditionals

Are conditionals confusingProbably so Consider the following interpretation of the truth table4

If Springfield is the capital of Illinois then Springfield is the capitalof Illinois (TrArr T is T) OKIf Springfield is the capital of Illinois then Chicago is the capital ofIllinois (TrArr F is F) This better be falseIf Chicago is the capital of Illinois then Springfield is the capital ofIllinois (FrArr T is T) WeirdIf Chicago is the capital of Illinois then Rockford is the capital ofIllinois (FrArr F is T) Very weird

Read (carefully) the discussion in [Devlin pp 18-19]Conditional in words

φrArr ψ is only then not T if ψ is F in spite of φ being T

More colloquially φrArr ψ is considered true until proven false(ldquoinnocent until proven guiltyrdquo)

4The state capital of Illinois is Springfieldfasshaueriitedu MATH 100 ndash ITP 13

Conditionals and Biconditionals

Another example for the conditional

Letrsquos consider the following promise I make to you

If you average 85 or above in this class then you will get anA

At the end of the semester we could have various outcomesYou average 90 and get an A (Trarr T is T ie I kept my promise)You average 90 and get a B (Trarr F is F ie I broke mypromise)You average 80 and get an A (Frarr T is T ie I didnrsquot break mypromise uml )You average 80 and get a B (Frarr F is T ie I didnrsquot break mypromise ndash and you received what you expected)

This illustrates perfectly that scoring 85 or higher was sufficient foran A but not necessary

fasshaueriitedu MATH 100 ndash ITP 14

Conditionals and Biconditionals

And a mathematical example

Letrsquos assume that n is a positive integer Then

(n is a perfect square with last digit 7)rArr (n is a prime number)

is a true statementThis is so because we have both (by definition)

FrArr T is TFrArr F is T

and we know that no perfect square ends in 7 (so it is irrelevant that allwe know about n is that it is a positive integer)

RemarkStatements like these (and the earlier ones about the IL state capital)do not agree with common sense Usually we work with statementsthat are in some logical context (see the discussion of causation in[Devlin p 17])

fasshaueriitedu MATH 100 ndash ITP 15

Conditionals and Biconditionals

Biconditional for logical equivalence if and only ifMathematical notation hArrharrDoes not make sense in MATLAB (only in SymbolicToolbox)Example (in Mathematica)Equivalent[3ltPi 4gtPi]

Truth table httpwwwwolframalphacominputi=P+Equivalent+Q

fasshaueriitedu MATH 100 ndash ITP 16

Truth Tables

Further insights via truth tables

Example

Prove not(φ and ψ) is equivalent to (notφ) or (notψ)

φ ψ φ and ψ not(φ and ψ)T T T FT F F TF T F TF F F T

φ ψ notφ notψ (notφ) or (notψ)T T F F FT F F T TF T T F TF F T T T

fasshaueriitedu MATH 100 ndash ITP 17

Truth Tables

Example (Exercise 229(a) in [Devlin])

Prove not(φrArr ψ) is equivalent to φ and (notψ)

φ ψ φrArr ψ not(φrArr ψ)

T T T FT F F TF T T FF F T F

φ ψ φ and (notψ)T T FT F TF T FF F F

How can we then interpret φrArr ψ in terms of and or and not (notφ) or ψ

fasshaueriitedu MATH 100 ndash ITP 18

Truth Tables

Example (Wason Selection Task Exercise 2220 in [Devlin])

Assuming each card has a letter on one face and a numberon the other which card(s) do you have to turn over in orderto test the truth of the proposition that if a card has a vowel onone face then its opposite shows an even numbera

Answer Cards ldquoErdquo and ldquo7rdquo

Checking the other side of ldquoErdquo is obvious (we need an even number toshow for the proposition to hold)It doesnrsquot matter whatrsquos on the other side of ldquoKrdquo (the proposition makesno claim about cards with a consonant)Nor does it matter whatrsquos on the other side of ldquo4rdquo (if itrsquos a vowel great ifitrsquos a consonant no rule was violated either)We need to check ldquo7rdquo (if a vowel shows up the proposition is false)

aOnly about 10 of the population get this rightfasshaueriitedu MATH 100 ndash ITP 19

Looking Ahead Toward Proofs

When we do a mathematical proof then we need to decide whether acertain mathematical statement is logically true or not

The direct approach (known as modus ponens ie method byaffirmation) is to conclude

If φ and (φrArr ψ) then ψ

Example

Show that if n is an even integer then (minus1)n = 1

Proofn is an arbitrary even integer so n = 2k for some integer k But then

(minus1)n = (minus1)2k =((minus1)2︸ ︷︷ ︸

=1

)k= 1k = 1

fasshaueriitedu MATH 100 ndash ITP 20

Looking Ahead Toward Proofs

Contrapositive

Sometimes it is difficult to prove an implication directly In this case wecan try to show that the contrapositive of the conditional holds ie weuse (see HW 2211)

φrArr ψ is equivalent to (notψ)rArr (notφ)

and conclude (modus tollens method by denial)

If φ and ((notψ)rArr (notφ)) then ψ

Note that this has nothing to do with proof by contradiction (more onthat later)

Example

Conditional If you average 85 or above then you will get an AContrapositive If you donrsquotdidnrsquot get an A then you donrsquotdidnrsquot average85 or above

fasshaueriitedu MATH 100 ndash ITP 21

Looking Ahead Toward Proofs

Converse

Do not confuse the contrapositive of a conditional with its converse

If φrArr ψ then its converse is ψ rArr φ

There is no logical connection between a conditional and its converse

The only link is that if both are true then the biconditional holds ie

(φrArr ψ) and (ψ rArr φ) is equivalent to (φhArr ψ)

Example

Conditional If you average 85 or above then you will get an AContrapositive If you donrsquotdidnrsquot get an A then you donrsquotdidnrsquot average85 or aboveConverse If you getgot an A then you averageaveraged 85 or above

Note The converse assures us that scoring 85 or above isnecessary for an A (not so good for you _)

fasshaueriitedu MATH 100 ndash ITP 22

Looking Ahead Toward Proofs

Also do not confuse a statement with itsconverse

More Lewis CarrolllsquoNot the same thing a bitrsquo saidthe Hatter lsquoYou might just as wellsay that ldquoI see what I eatrdquo is thesame thing as ldquoI eat what I seerdquorsquo

From ldquoAlice in Wonderlandrdquo by Lewis Carroll (seehttpwwwonline-literaturecomcarrollalice7 forthe complete Chapter 7 A Mad Tea Party)

fasshaueriitedu MATH 100 ndash ITP 23

Looking Ahead Toward Proofs

Inverse

One could also consider the contrapositive of the converse5 of aconditional also known as the inverse of the conditional

Example

Conditional If you average 85 or above then you will get an AContrapositive If you donrsquotdidnrsquot get an A then you donrsquotdidnrsquot average85 or aboveConverse If you getgot an A then you averageaveraged 85 or aboveInverse If you donrsquot average 85 or above then you wonrsquot get an A

Note The inverse (which is equivalent to the converse) perhaps showseven better that scoring 85 or above is necessary for an A

5Or equivalently the converse of the contrapositivefasshaueriitedu MATH 100 ndash ITP 24

Looking Ahead Toward Proofs

Negated Conditional

You also might be tempted to confuse the contrapositive of aconditional with its negation As we showed earlier the negation of aconditional

not(φrArr ψ) is equivalent to φ and (notψ)

which is different from the contrapositive of φrArr ψ

(notψ)rArr (notφ)

The latter would be equivalent to (verify this)

(notφ) or ψ

fasshaueriitedu MATH 100 ndash ITP 25

Looking Ahead Toward Proofs

We just said that the negated conditional is

φ and (notψ)

Example

Conditional If you average 85 or above then you will get an AContrapositive If you donrsquotdidnrsquot get an A then you donrsquotdidnrsquot average85 or aboveConverse If you getgot an A then you averageaveraged 85 or aboveInverse If you donrsquot average 85 or above then you wonrsquot get an ANegated conditional You average 85 or above and you wonrsquot get an A

Note The negated conditional is only true if the conditional is falseie in the case when I break my promise

fasshaueriitedu MATH 100 ndash ITP 26

Looking Ahead Toward Proofs

The perverse cube of reversed implications

notφrArr notψφornotψ

larrrarr notψ rArr notφψornotφ

l lφrArr ψnotφorψ

larrrarr ψ rArr φnotψorφ

l Negation l

not (notφrArr notψ)notφandψ

middot middot middot not (notψ rArr notφ)notψandφ

l lnot (φrArr ψ)

φandnotψmiddot middot middot not (ψ rArr φ)

ψandnotφ

Create the truth tables for all these statements to verify their relations

fasshaueriitedu MATH 100 ndash ITP 27

Quantifiers

ldquoFor allrdquo and ldquothere existsrdquo

Universal quantifier forallx ldquofor all x it is the case that rdquoExistential quantifier existx ldquothere exists an x such that rdquo

Example (in Mathematica ndash quantifiers donrsquot exist in MATLAB)ForAll[x Element[xReals] x^2 + 2 x + c gt 0]Reduce[ c] ( find c st the statement is T )

In words For what values of c is the inequality x2 + 2x + c gt 0 true forall values of x

Example (in Mathematica)Exists[x x^2 + 2 x + c == 0 ampamp x gt 0]Reduce[ c Reals] (consider only real numbers)

In words For what values of c does the equation x2 + 2x + c = 0 havea positive solution x When does a positive solution exista

aExistence (and uniqueness) of a solution are fundamental issues in math

fasshaueriitedu MATH 100 ndash ITP 28

Quantifiers

We can also nicely visualize whatrsquos going on in Mathematica

Manipulate[Plot[x^2 + 2 x + c x -5 5PlotRange -gt -6 10] c -5 5]

This shows thatfor c le 0 there is an intersection with the positive x-axis so apositive solution to the equation x2 + 2x + c = 0 existsfor c gt 0 the parabola does not intersect the positive x-axis sothe equation x2 + 2x + c = 0 is false for positive values of x for c gt 1 the parabola does not intersect the x-axis at all so theinequality x2 + 2x + c gt 0 is true for all values of x (but theequation x2 + 2x + c = 0 is false)

RemarkWe could also use a restricted domain for the existence example ie

Exists[x xgt0 x^2 + 2 x + c == 0]Reduce[ c Reals] (consider only real numbers)

fasshaueriitedu MATH 100 ndash ITP 29

Quantifiers

Example (Comparing the use of exist and forall in common language)

Consider the two statementsEverybody likes at least one drink namely water(one drink liked by everybody)Everybody likes at least one drink I myself go for beer(everybody likes some drink)

How can we formalize these two statements using quantifiers

There exists a drink D such that for every person P P likes D

(existD) (forallP) [P likes D]

For every person P there exists a drink D such that P likes D

(forallP) (existD) [P likes D]

The order of quantifiers matters What about the other two casesfasshaueriitedu MATH 100 ndash ITP 30

Quantifiers

A mathematical example

Let P be the set of prime numbers and N the set of natural numbersThen

(foralln isin N) (existm isin N) [(m gt n) and (m isin P)]

says that there are infinitely many primes

Actually it says that

For whatever natural number n we pickwe can find another natural number mthat is both larger than n and a prime number

The statement m isin P (or ldquom is a prime numberrdquo) can be formalized as

(forallab isin N) [(ab = m)rArr ((a = 1) or (b = 1))]

fasshaueriitedu MATH 100 ndash ITP 31

Quantifiers

Negation of Universal Statements

Earlier we used the example (in Mathematica)

(forallx isin R)[x2 + 2x + c gt 0

]Letrsquos assume it is true ie

For all x the inequality x2 + 2x + c gt 0 is true

What if we want to negate this statement We get

not[(forallx isin R)

[x2 + 2x + c gt 0

]]Not[ForAll[x Element[xReals] x^2 + 2 x + c gt 0]]Reduce[ c] ( find c st the statement is T )

What does the statement mean (Mathematica resolved it)

There exists some x for which the inequality is not trueNote that the values of c found by Mathematica are complementary tothose for which the original statement was true

fasshaueriitedu MATH 100 ndash ITP 32

Quantifiers

Negation of Existential StatementsLetrsquos use our second earlier example

(existx isin R)[(x2 + 2x + c = 0) and (x gt 0)

]Letrsquos assume it is true ie

There exists an x such that the equation x2 + 2x + c = 0 istrue and x gt 0

What if we want to negate this statement We get

not[(existx isin R)

[(x2 + 2x + c = 0) and (x gt 0)

]]Not[Exists[x x^2 + 2 x + c == 0 ampamp x gt 0]]Reduce[ c Reals] (consider only real numbers)

What does the statement meanFor all x the equation is not true or x le 0

Again the values of c found by Mathematica are complementary tothose for which the original statement was true

fasshaueriitedu MATH 100 ndash ITP 33

Quantifiers

Using a restricted domain things are a little simpler

(existx isin R+)[x2 + 2x + c = 0

]Letrsquos assume it is true ie

There exists a positive x the equation x2 + 2x + c = 0 is true

What if we want to negate this statement We get

not[(existx isin R+)

[x2 + 2x + c = 0

]]Not[Exists[x x gt 0 x^2 + 2 x + c == 0]]Reduce[ c Reals] (consider only real numbers)

What does the statement meanFor all positive x the equation is not true

Again the values of c found by Mathematica are complementary tothose for which the original statement was true

fasshaueriitedu MATH 100 ndash ITP 34

Quantifiers

Back to Beer

We end by determining the ldquocorrectrdquo formulation for the beer exampleLetrsquos formalize the statement

All American beer tastes dreadful

We introduce the following notationB the set of all beers

A(x) the statement ldquox is AmericanrdquoD(x) the statement ldquox tastes dreadfulrdquo

Then we get(forallx isin B) [A(x)rArr D(x)]

ieFor all beers if the beer is American then it tastes dreadful

fasshaueriitedu MATH 100 ndash ITP 35

Quantifiers

Now we need to negate

(forallx isin B) [A(x)rArr D(x)]

According to our earlier discussion we have

(existx isin B)not [A(x)rArr D(x)]

which using the fact that not [φrArr ψ] is equivalent to φ and (notψ) yields

(existx isin B) [A(x) and (notD(x))]

In wordsThere exists a beer which is American and does not tastedreadful

fasshaueriitedu MATH 100 ndash ITP 36

Appendix References

References I

Devlin Keith JSet Functions and Logic (3rd Ed)Chapman amp HallCRC 2004

Moler CleveExperiments with MATLABhttpwwwmathworkscommolerexmchaptershtml

fasshaueriitedu MATH 100 ndash ITP 37

  • ``Thats Logic
  • Logical Connectives
  • Conditionals and Biconditionals
  • Truth Tables
  • Looking Ahead Toward Proofs
  • Quantifiers
  • Appendix
Page 10: MATH 100 – Introduction to the Profession - Logic

Logical Connectives

Example (Logical operations and arrays in MATLAB)R=rand(43)(R gt 03) amp (R lt 07)

Note here the ldquoelementwiserdquo operator is required

Example (Logical operations and find in MATLAB)find(R gt 03 amp R lt 07)

Note find goes through matrix in column-major order and returnsvector of indicesMore detailed

[rowcolval] = find(R gt 03 amp R lt 07)

fasshaueriitedu MATH 100 ndash ITP 10

Conditionals and Biconditionals

Conditional for logical implications if thenMathematical notation rArrrarrExample3 (in MATLAB)x = -3if x lt 0

abs_x = -xelse

abs_x = xendor ndash if you want a function ndash using logical multipliersabs = (x) (xlt0)(-x) + (xgt=0)xabs(-3) abs(4)Example (in Mathematica)abs[x_] = If[x lt 0 -x x]abs[-3]abs[-4]

3This computer code use is different than the mathematical use since we canrsquotassign a truth value to the ldquoif thenrdquo code fragment

fasshaueriitedu MATH 100 ndash ITP 11

Conditionals and Biconditionals

Truth tablehttpwwwwolframalphacominputi=P+Implies+QImportant concepts for all of mathematics

φ implies ψif φ then ψφ is sufficient for ψφ only if ψψ if φψ whenever φψ is necessary for φ

fasshaueriitedu MATH 100 ndash ITP 12

Conditionals and Biconditionals

Are conditionals confusingProbably so Consider the following interpretation of the truth table4

If Springfield is the capital of Illinois then Springfield is the capitalof Illinois (TrArr T is T) OKIf Springfield is the capital of Illinois then Chicago is the capital ofIllinois (TrArr F is F) This better be falseIf Chicago is the capital of Illinois then Springfield is the capital ofIllinois (FrArr T is T) WeirdIf Chicago is the capital of Illinois then Rockford is the capital ofIllinois (FrArr F is T) Very weird

Read (carefully) the discussion in [Devlin pp 18-19]Conditional in words

φrArr ψ is only then not T if ψ is F in spite of φ being T

More colloquially φrArr ψ is considered true until proven false(ldquoinnocent until proven guiltyrdquo)

4The state capital of Illinois is Springfieldfasshaueriitedu MATH 100 ndash ITP 13

Conditionals and Biconditionals

Another example for the conditional

Letrsquos consider the following promise I make to you

If you average 85 or above in this class then you will get anA

At the end of the semester we could have various outcomesYou average 90 and get an A (Trarr T is T ie I kept my promise)You average 90 and get a B (Trarr F is F ie I broke mypromise)You average 80 and get an A (Frarr T is T ie I didnrsquot break mypromise uml )You average 80 and get a B (Frarr F is T ie I didnrsquot break mypromise ndash and you received what you expected)

This illustrates perfectly that scoring 85 or higher was sufficient foran A but not necessary

fasshaueriitedu MATH 100 ndash ITP 14

Conditionals and Biconditionals

And a mathematical example

Letrsquos assume that n is a positive integer Then

(n is a perfect square with last digit 7)rArr (n is a prime number)

is a true statementThis is so because we have both (by definition)

FrArr T is TFrArr F is T

and we know that no perfect square ends in 7 (so it is irrelevant that allwe know about n is that it is a positive integer)

RemarkStatements like these (and the earlier ones about the IL state capital)do not agree with common sense Usually we work with statementsthat are in some logical context (see the discussion of causation in[Devlin p 17])

fasshaueriitedu MATH 100 ndash ITP 15

Conditionals and Biconditionals

Biconditional for logical equivalence if and only ifMathematical notation hArrharrDoes not make sense in MATLAB (only in SymbolicToolbox)Example (in Mathematica)Equivalent[3ltPi 4gtPi]

Truth table httpwwwwolframalphacominputi=P+Equivalent+Q

fasshaueriitedu MATH 100 ndash ITP 16

Truth Tables

Further insights via truth tables

Example

Prove not(φ and ψ) is equivalent to (notφ) or (notψ)

φ ψ φ and ψ not(φ and ψ)T T T FT F F TF T F TF F F T

φ ψ notφ notψ (notφ) or (notψ)T T F F FT F F T TF T T F TF F T T T

fasshaueriitedu MATH 100 ndash ITP 17

Truth Tables

Example (Exercise 229(a) in [Devlin])

Prove not(φrArr ψ) is equivalent to φ and (notψ)

φ ψ φrArr ψ not(φrArr ψ)

T T T FT F F TF T T FF F T F

φ ψ φ and (notψ)T T FT F TF T FF F F

How can we then interpret φrArr ψ in terms of and or and not (notφ) or ψ

fasshaueriitedu MATH 100 ndash ITP 18

Truth Tables

Example (Wason Selection Task Exercise 2220 in [Devlin])

Assuming each card has a letter on one face and a numberon the other which card(s) do you have to turn over in orderto test the truth of the proposition that if a card has a vowel onone face then its opposite shows an even numbera

Answer Cards ldquoErdquo and ldquo7rdquo

Checking the other side of ldquoErdquo is obvious (we need an even number toshow for the proposition to hold)It doesnrsquot matter whatrsquos on the other side of ldquoKrdquo (the proposition makesno claim about cards with a consonant)Nor does it matter whatrsquos on the other side of ldquo4rdquo (if itrsquos a vowel great ifitrsquos a consonant no rule was violated either)We need to check ldquo7rdquo (if a vowel shows up the proposition is false)

aOnly about 10 of the population get this rightfasshaueriitedu MATH 100 ndash ITP 19

Looking Ahead Toward Proofs

When we do a mathematical proof then we need to decide whether acertain mathematical statement is logically true or not

The direct approach (known as modus ponens ie method byaffirmation) is to conclude

If φ and (φrArr ψ) then ψ

Example

Show that if n is an even integer then (minus1)n = 1

Proofn is an arbitrary even integer so n = 2k for some integer k But then

(minus1)n = (minus1)2k =((minus1)2︸ ︷︷ ︸

=1

)k= 1k = 1

fasshaueriitedu MATH 100 ndash ITP 20

Looking Ahead Toward Proofs

Contrapositive

Sometimes it is difficult to prove an implication directly In this case wecan try to show that the contrapositive of the conditional holds ie weuse (see HW 2211)

φrArr ψ is equivalent to (notψ)rArr (notφ)

and conclude (modus tollens method by denial)

If φ and ((notψ)rArr (notφ)) then ψ

Note that this has nothing to do with proof by contradiction (more onthat later)

Example

Conditional If you average 85 or above then you will get an AContrapositive If you donrsquotdidnrsquot get an A then you donrsquotdidnrsquot average85 or above

fasshaueriitedu MATH 100 ndash ITP 21

Looking Ahead Toward Proofs

Converse

Do not confuse the contrapositive of a conditional with its converse

If φrArr ψ then its converse is ψ rArr φ

There is no logical connection between a conditional and its converse

The only link is that if both are true then the biconditional holds ie

(φrArr ψ) and (ψ rArr φ) is equivalent to (φhArr ψ)

Example

Conditional If you average 85 or above then you will get an AContrapositive If you donrsquotdidnrsquot get an A then you donrsquotdidnrsquot average85 or aboveConverse If you getgot an A then you averageaveraged 85 or above

Note The converse assures us that scoring 85 or above isnecessary for an A (not so good for you _)

fasshaueriitedu MATH 100 ndash ITP 22

Looking Ahead Toward Proofs

Also do not confuse a statement with itsconverse

More Lewis CarrolllsquoNot the same thing a bitrsquo saidthe Hatter lsquoYou might just as wellsay that ldquoI see what I eatrdquo is thesame thing as ldquoI eat what I seerdquorsquo

From ldquoAlice in Wonderlandrdquo by Lewis Carroll (seehttpwwwonline-literaturecomcarrollalice7 forthe complete Chapter 7 A Mad Tea Party)

fasshaueriitedu MATH 100 ndash ITP 23

Looking Ahead Toward Proofs

Inverse

One could also consider the contrapositive of the converse5 of aconditional also known as the inverse of the conditional

Example

Conditional If you average 85 or above then you will get an AContrapositive If you donrsquotdidnrsquot get an A then you donrsquotdidnrsquot average85 or aboveConverse If you getgot an A then you averageaveraged 85 or aboveInverse If you donrsquot average 85 or above then you wonrsquot get an A

Note The inverse (which is equivalent to the converse) perhaps showseven better that scoring 85 or above is necessary for an A

5Or equivalently the converse of the contrapositivefasshaueriitedu MATH 100 ndash ITP 24

Looking Ahead Toward Proofs

Negated Conditional

You also might be tempted to confuse the contrapositive of aconditional with its negation As we showed earlier the negation of aconditional

not(φrArr ψ) is equivalent to φ and (notψ)

which is different from the contrapositive of φrArr ψ

(notψ)rArr (notφ)

The latter would be equivalent to (verify this)

(notφ) or ψ

fasshaueriitedu MATH 100 ndash ITP 25

Looking Ahead Toward Proofs

We just said that the negated conditional is

φ and (notψ)

Example

Conditional If you average 85 or above then you will get an AContrapositive If you donrsquotdidnrsquot get an A then you donrsquotdidnrsquot average85 or aboveConverse If you getgot an A then you averageaveraged 85 or aboveInverse If you donrsquot average 85 or above then you wonrsquot get an ANegated conditional You average 85 or above and you wonrsquot get an A

Note The negated conditional is only true if the conditional is falseie in the case when I break my promise

fasshaueriitedu MATH 100 ndash ITP 26

Looking Ahead Toward Proofs

The perverse cube of reversed implications

notφrArr notψφornotψ

larrrarr notψ rArr notφψornotφ

l lφrArr ψnotφorψ

larrrarr ψ rArr φnotψorφ

l Negation l

not (notφrArr notψ)notφandψ

middot middot middot not (notψ rArr notφ)notψandφ

l lnot (φrArr ψ)

φandnotψmiddot middot middot not (ψ rArr φ)

ψandnotφ

Create the truth tables for all these statements to verify their relations

fasshaueriitedu MATH 100 ndash ITP 27

Quantifiers

ldquoFor allrdquo and ldquothere existsrdquo

Universal quantifier forallx ldquofor all x it is the case that rdquoExistential quantifier existx ldquothere exists an x such that rdquo

Example (in Mathematica ndash quantifiers donrsquot exist in MATLAB)ForAll[x Element[xReals] x^2 + 2 x + c gt 0]Reduce[ c] ( find c st the statement is T )

In words For what values of c is the inequality x2 + 2x + c gt 0 true forall values of x

Example (in Mathematica)Exists[x x^2 + 2 x + c == 0 ampamp x gt 0]Reduce[ c Reals] (consider only real numbers)

In words For what values of c does the equation x2 + 2x + c = 0 havea positive solution x When does a positive solution exista

aExistence (and uniqueness) of a solution are fundamental issues in math

fasshaueriitedu MATH 100 ndash ITP 28

Quantifiers

We can also nicely visualize whatrsquos going on in Mathematica

Manipulate[Plot[x^2 + 2 x + c x -5 5PlotRange -gt -6 10] c -5 5]

This shows thatfor c le 0 there is an intersection with the positive x-axis so apositive solution to the equation x2 + 2x + c = 0 existsfor c gt 0 the parabola does not intersect the positive x-axis sothe equation x2 + 2x + c = 0 is false for positive values of x for c gt 1 the parabola does not intersect the x-axis at all so theinequality x2 + 2x + c gt 0 is true for all values of x (but theequation x2 + 2x + c = 0 is false)

RemarkWe could also use a restricted domain for the existence example ie

Exists[x xgt0 x^2 + 2 x + c == 0]Reduce[ c Reals] (consider only real numbers)

fasshaueriitedu MATH 100 ndash ITP 29

Quantifiers

Example (Comparing the use of exist and forall in common language)

Consider the two statementsEverybody likes at least one drink namely water(one drink liked by everybody)Everybody likes at least one drink I myself go for beer(everybody likes some drink)

How can we formalize these two statements using quantifiers

There exists a drink D such that for every person P P likes D

(existD) (forallP) [P likes D]

For every person P there exists a drink D such that P likes D

(forallP) (existD) [P likes D]

The order of quantifiers matters What about the other two casesfasshaueriitedu MATH 100 ndash ITP 30

Quantifiers

A mathematical example

Let P be the set of prime numbers and N the set of natural numbersThen

(foralln isin N) (existm isin N) [(m gt n) and (m isin P)]

says that there are infinitely many primes

Actually it says that

For whatever natural number n we pickwe can find another natural number mthat is both larger than n and a prime number

The statement m isin P (or ldquom is a prime numberrdquo) can be formalized as

(forallab isin N) [(ab = m)rArr ((a = 1) or (b = 1))]

fasshaueriitedu MATH 100 ndash ITP 31

Quantifiers

Negation of Universal Statements

Earlier we used the example (in Mathematica)

(forallx isin R)[x2 + 2x + c gt 0

]Letrsquos assume it is true ie

For all x the inequality x2 + 2x + c gt 0 is true

What if we want to negate this statement We get

not[(forallx isin R)

[x2 + 2x + c gt 0

]]Not[ForAll[x Element[xReals] x^2 + 2 x + c gt 0]]Reduce[ c] ( find c st the statement is T )

What does the statement mean (Mathematica resolved it)

There exists some x for which the inequality is not trueNote that the values of c found by Mathematica are complementary tothose for which the original statement was true

fasshaueriitedu MATH 100 ndash ITP 32

Quantifiers

Negation of Existential StatementsLetrsquos use our second earlier example

(existx isin R)[(x2 + 2x + c = 0) and (x gt 0)

]Letrsquos assume it is true ie

There exists an x such that the equation x2 + 2x + c = 0 istrue and x gt 0

What if we want to negate this statement We get

not[(existx isin R)

[(x2 + 2x + c = 0) and (x gt 0)

]]Not[Exists[x x^2 + 2 x + c == 0 ampamp x gt 0]]Reduce[ c Reals] (consider only real numbers)

What does the statement meanFor all x the equation is not true or x le 0

Again the values of c found by Mathematica are complementary tothose for which the original statement was true

fasshaueriitedu MATH 100 ndash ITP 33

Quantifiers

Using a restricted domain things are a little simpler

(existx isin R+)[x2 + 2x + c = 0

]Letrsquos assume it is true ie

There exists a positive x the equation x2 + 2x + c = 0 is true

What if we want to negate this statement We get

not[(existx isin R+)

[x2 + 2x + c = 0

]]Not[Exists[x x gt 0 x^2 + 2 x + c == 0]]Reduce[ c Reals] (consider only real numbers)

What does the statement meanFor all positive x the equation is not true

Again the values of c found by Mathematica are complementary tothose for which the original statement was true

fasshaueriitedu MATH 100 ndash ITP 34

Quantifiers

Back to Beer

We end by determining the ldquocorrectrdquo formulation for the beer exampleLetrsquos formalize the statement

All American beer tastes dreadful

We introduce the following notationB the set of all beers

A(x) the statement ldquox is AmericanrdquoD(x) the statement ldquox tastes dreadfulrdquo

Then we get(forallx isin B) [A(x)rArr D(x)]

ieFor all beers if the beer is American then it tastes dreadful

fasshaueriitedu MATH 100 ndash ITP 35

Quantifiers

Now we need to negate

(forallx isin B) [A(x)rArr D(x)]

According to our earlier discussion we have

(existx isin B)not [A(x)rArr D(x)]

which using the fact that not [φrArr ψ] is equivalent to φ and (notψ) yields

(existx isin B) [A(x) and (notD(x))]

In wordsThere exists a beer which is American and does not tastedreadful

fasshaueriitedu MATH 100 ndash ITP 36

Appendix References

References I

Devlin Keith JSet Functions and Logic (3rd Ed)Chapman amp HallCRC 2004

Moler CleveExperiments with MATLABhttpwwwmathworkscommolerexmchaptershtml

fasshaueriitedu MATH 100 ndash ITP 37

  • ``Thats Logic
  • Logical Connectives
  • Conditionals and Biconditionals
  • Truth Tables
  • Looking Ahead Toward Proofs
  • Quantifiers
  • Appendix
Page 11: MATH 100 – Introduction to the Profession - Logic

Conditionals and Biconditionals

Conditional for logical implications if thenMathematical notation rArrrarrExample3 (in MATLAB)x = -3if x lt 0

abs_x = -xelse

abs_x = xendor ndash if you want a function ndash using logical multipliersabs = (x) (xlt0)(-x) + (xgt=0)xabs(-3) abs(4)Example (in Mathematica)abs[x_] = If[x lt 0 -x x]abs[-3]abs[-4]

3This computer code use is different than the mathematical use since we canrsquotassign a truth value to the ldquoif thenrdquo code fragment

fasshaueriitedu MATH 100 ndash ITP 11

Conditionals and Biconditionals

Truth tablehttpwwwwolframalphacominputi=P+Implies+QImportant concepts for all of mathematics

φ implies ψif φ then ψφ is sufficient for ψφ only if ψψ if φψ whenever φψ is necessary for φ

fasshaueriitedu MATH 100 ndash ITP 12

Conditionals and Biconditionals

Are conditionals confusingProbably so Consider the following interpretation of the truth table4

If Springfield is the capital of Illinois then Springfield is the capitalof Illinois (TrArr T is T) OKIf Springfield is the capital of Illinois then Chicago is the capital ofIllinois (TrArr F is F) This better be falseIf Chicago is the capital of Illinois then Springfield is the capital ofIllinois (FrArr T is T) WeirdIf Chicago is the capital of Illinois then Rockford is the capital ofIllinois (FrArr F is T) Very weird

Read (carefully) the discussion in [Devlin pp 18-19]Conditional in words

φrArr ψ is only then not T if ψ is F in spite of φ being T

More colloquially φrArr ψ is considered true until proven false(ldquoinnocent until proven guiltyrdquo)

4The state capital of Illinois is Springfieldfasshaueriitedu MATH 100 ndash ITP 13

Conditionals and Biconditionals

Another example for the conditional

Letrsquos consider the following promise I make to you

If you average 85 or above in this class then you will get anA

At the end of the semester we could have various outcomesYou average 90 and get an A (Trarr T is T ie I kept my promise)You average 90 and get a B (Trarr F is F ie I broke mypromise)You average 80 and get an A (Frarr T is T ie I didnrsquot break mypromise uml )You average 80 and get a B (Frarr F is T ie I didnrsquot break mypromise ndash and you received what you expected)

This illustrates perfectly that scoring 85 or higher was sufficient foran A but not necessary

fasshaueriitedu MATH 100 ndash ITP 14

Conditionals and Biconditionals

And a mathematical example

Letrsquos assume that n is a positive integer Then

(n is a perfect square with last digit 7)rArr (n is a prime number)

is a true statementThis is so because we have both (by definition)

FrArr T is TFrArr F is T

and we know that no perfect square ends in 7 (so it is irrelevant that allwe know about n is that it is a positive integer)

RemarkStatements like these (and the earlier ones about the IL state capital)do not agree with common sense Usually we work with statementsthat are in some logical context (see the discussion of causation in[Devlin p 17])

fasshaueriitedu MATH 100 ndash ITP 15

Conditionals and Biconditionals

Biconditional for logical equivalence if and only ifMathematical notation hArrharrDoes not make sense in MATLAB (only in SymbolicToolbox)Example (in Mathematica)Equivalent[3ltPi 4gtPi]

Truth table httpwwwwolframalphacominputi=P+Equivalent+Q

fasshaueriitedu MATH 100 ndash ITP 16

Truth Tables

Further insights via truth tables

Example

Prove not(φ and ψ) is equivalent to (notφ) or (notψ)

φ ψ φ and ψ not(φ and ψ)T T T FT F F TF T F TF F F T

φ ψ notφ notψ (notφ) or (notψ)T T F F FT F F T TF T T F TF F T T T

fasshaueriitedu MATH 100 ndash ITP 17

Truth Tables

Example (Exercise 229(a) in [Devlin])

Prove not(φrArr ψ) is equivalent to φ and (notψ)

φ ψ φrArr ψ not(φrArr ψ)

T T T FT F F TF T T FF F T F

φ ψ φ and (notψ)T T FT F TF T FF F F

How can we then interpret φrArr ψ in terms of and or and not (notφ) or ψ

fasshaueriitedu MATH 100 ndash ITP 18

Truth Tables

Example (Wason Selection Task Exercise 2220 in [Devlin])

Assuming each card has a letter on one face and a numberon the other which card(s) do you have to turn over in orderto test the truth of the proposition that if a card has a vowel onone face then its opposite shows an even numbera

Answer Cards ldquoErdquo and ldquo7rdquo

Checking the other side of ldquoErdquo is obvious (we need an even number toshow for the proposition to hold)It doesnrsquot matter whatrsquos on the other side of ldquoKrdquo (the proposition makesno claim about cards with a consonant)Nor does it matter whatrsquos on the other side of ldquo4rdquo (if itrsquos a vowel great ifitrsquos a consonant no rule was violated either)We need to check ldquo7rdquo (if a vowel shows up the proposition is false)

aOnly about 10 of the population get this rightfasshaueriitedu MATH 100 ndash ITP 19

Looking Ahead Toward Proofs

When we do a mathematical proof then we need to decide whether acertain mathematical statement is logically true or not

The direct approach (known as modus ponens ie method byaffirmation) is to conclude

If φ and (φrArr ψ) then ψ

Example

Show that if n is an even integer then (minus1)n = 1

Proofn is an arbitrary even integer so n = 2k for some integer k But then

(minus1)n = (minus1)2k =((minus1)2︸ ︷︷ ︸

=1

)k= 1k = 1

fasshaueriitedu MATH 100 ndash ITP 20

Looking Ahead Toward Proofs

Contrapositive

Sometimes it is difficult to prove an implication directly In this case wecan try to show that the contrapositive of the conditional holds ie weuse (see HW 2211)

φrArr ψ is equivalent to (notψ)rArr (notφ)

and conclude (modus tollens method by denial)

If φ and ((notψ)rArr (notφ)) then ψ

Note that this has nothing to do with proof by contradiction (more onthat later)

Example

Conditional If you average 85 or above then you will get an AContrapositive If you donrsquotdidnrsquot get an A then you donrsquotdidnrsquot average85 or above

fasshaueriitedu MATH 100 ndash ITP 21

Looking Ahead Toward Proofs

Converse

Do not confuse the contrapositive of a conditional with its converse

If φrArr ψ then its converse is ψ rArr φ

There is no logical connection between a conditional and its converse

The only link is that if both are true then the biconditional holds ie

(φrArr ψ) and (ψ rArr φ) is equivalent to (φhArr ψ)

Example

Conditional If you average 85 or above then you will get an AContrapositive If you donrsquotdidnrsquot get an A then you donrsquotdidnrsquot average85 or aboveConverse If you getgot an A then you averageaveraged 85 or above

Note The converse assures us that scoring 85 or above isnecessary for an A (not so good for you _)

fasshaueriitedu MATH 100 ndash ITP 22

Looking Ahead Toward Proofs

Also do not confuse a statement with itsconverse

More Lewis CarrolllsquoNot the same thing a bitrsquo saidthe Hatter lsquoYou might just as wellsay that ldquoI see what I eatrdquo is thesame thing as ldquoI eat what I seerdquorsquo

From ldquoAlice in Wonderlandrdquo by Lewis Carroll (seehttpwwwonline-literaturecomcarrollalice7 forthe complete Chapter 7 A Mad Tea Party)

fasshaueriitedu MATH 100 ndash ITP 23

Looking Ahead Toward Proofs

Inverse

One could also consider the contrapositive of the converse5 of aconditional also known as the inverse of the conditional

Example

Conditional If you average 85 or above then you will get an AContrapositive If you donrsquotdidnrsquot get an A then you donrsquotdidnrsquot average85 or aboveConverse If you getgot an A then you averageaveraged 85 or aboveInverse If you donrsquot average 85 or above then you wonrsquot get an A

Note The inverse (which is equivalent to the converse) perhaps showseven better that scoring 85 or above is necessary for an A

5Or equivalently the converse of the contrapositivefasshaueriitedu MATH 100 ndash ITP 24

Looking Ahead Toward Proofs

Negated Conditional

You also might be tempted to confuse the contrapositive of aconditional with its negation As we showed earlier the negation of aconditional

not(φrArr ψ) is equivalent to φ and (notψ)

which is different from the contrapositive of φrArr ψ

(notψ)rArr (notφ)

The latter would be equivalent to (verify this)

(notφ) or ψ

fasshaueriitedu MATH 100 ndash ITP 25

Looking Ahead Toward Proofs

We just said that the negated conditional is

φ and (notψ)

Example

Conditional If you average 85 or above then you will get an AContrapositive If you donrsquotdidnrsquot get an A then you donrsquotdidnrsquot average85 or aboveConverse If you getgot an A then you averageaveraged 85 or aboveInverse If you donrsquot average 85 or above then you wonrsquot get an ANegated conditional You average 85 or above and you wonrsquot get an A

Note The negated conditional is only true if the conditional is falseie in the case when I break my promise

fasshaueriitedu MATH 100 ndash ITP 26

Looking Ahead Toward Proofs

The perverse cube of reversed implications

notφrArr notψφornotψ

larrrarr notψ rArr notφψornotφ

l lφrArr ψnotφorψ

larrrarr ψ rArr φnotψorφ

l Negation l

not (notφrArr notψ)notφandψ

middot middot middot not (notψ rArr notφ)notψandφ

l lnot (φrArr ψ)

φandnotψmiddot middot middot not (ψ rArr φ)

ψandnotφ

Create the truth tables for all these statements to verify their relations

fasshaueriitedu MATH 100 ndash ITP 27

Quantifiers

ldquoFor allrdquo and ldquothere existsrdquo

Universal quantifier forallx ldquofor all x it is the case that rdquoExistential quantifier existx ldquothere exists an x such that rdquo

Example (in Mathematica ndash quantifiers donrsquot exist in MATLAB)ForAll[x Element[xReals] x^2 + 2 x + c gt 0]Reduce[ c] ( find c st the statement is T )

In words For what values of c is the inequality x2 + 2x + c gt 0 true forall values of x

Example (in Mathematica)Exists[x x^2 + 2 x + c == 0 ampamp x gt 0]Reduce[ c Reals] (consider only real numbers)

In words For what values of c does the equation x2 + 2x + c = 0 havea positive solution x When does a positive solution exista

aExistence (and uniqueness) of a solution are fundamental issues in math

fasshaueriitedu MATH 100 ndash ITP 28

Quantifiers

We can also nicely visualize whatrsquos going on in Mathematica

Manipulate[Plot[x^2 + 2 x + c x -5 5PlotRange -gt -6 10] c -5 5]

This shows thatfor c le 0 there is an intersection with the positive x-axis so apositive solution to the equation x2 + 2x + c = 0 existsfor c gt 0 the parabola does not intersect the positive x-axis sothe equation x2 + 2x + c = 0 is false for positive values of x for c gt 1 the parabola does not intersect the x-axis at all so theinequality x2 + 2x + c gt 0 is true for all values of x (but theequation x2 + 2x + c = 0 is false)

RemarkWe could also use a restricted domain for the existence example ie

Exists[x xgt0 x^2 + 2 x + c == 0]Reduce[ c Reals] (consider only real numbers)

fasshaueriitedu MATH 100 ndash ITP 29

Quantifiers

Example (Comparing the use of exist and forall in common language)

Consider the two statementsEverybody likes at least one drink namely water(one drink liked by everybody)Everybody likes at least one drink I myself go for beer(everybody likes some drink)

How can we formalize these two statements using quantifiers

There exists a drink D such that for every person P P likes D

(existD) (forallP) [P likes D]

For every person P there exists a drink D such that P likes D

(forallP) (existD) [P likes D]

The order of quantifiers matters What about the other two casesfasshaueriitedu MATH 100 ndash ITP 30

Quantifiers

A mathematical example

Let P be the set of prime numbers and N the set of natural numbersThen

(foralln isin N) (existm isin N) [(m gt n) and (m isin P)]

says that there are infinitely many primes

Actually it says that

For whatever natural number n we pickwe can find another natural number mthat is both larger than n and a prime number

The statement m isin P (or ldquom is a prime numberrdquo) can be formalized as

(forallab isin N) [(ab = m)rArr ((a = 1) or (b = 1))]

fasshaueriitedu MATH 100 ndash ITP 31

Quantifiers

Negation of Universal Statements

Earlier we used the example (in Mathematica)

(forallx isin R)[x2 + 2x + c gt 0

]Letrsquos assume it is true ie

For all x the inequality x2 + 2x + c gt 0 is true

What if we want to negate this statement We get

not[(forallx isin R)

[x2 + 2x + c gt 0

]]Not[ForAll[x Element[xReals] x^2 + 2 x + c gt 0]]Reduce[ c] ( find c st the statement is T )

What does the statement mean (Mathematica resolved it)

There exists some x for which the inequality is not trueNote that the values of c found by Mathematica are complementary tothose for which the original statement was true

fasshaueriitedu MATH 100 ndash ITP 32

Quantifiers

Negation of Existential StatementsLetrsquos use our second earlier example

(existx isin R)[(x2 + 2x + c = 0) and (x gt 0)

]Letrsquos assume it is true ie

There exists an x such that the equation x2 + 2x + c = 0 istrue and x gt 0

What if we want to negate this statement We get

not[(existx isin R)

[(x2 + 2x + c = 0) and (x gt 0)

]]Not[Exists[x x^2 + 2 x + c == 0 ampamp x gt 0]]Reduce[ c Reals] (consider only real numbers)

What does the statement meanFor all x the equation is not true or x le 0

Again the values of c found by Mathematica are complementary tothose for which the original statement was true

fasshaueriitedu MATH 100 ndash ITP 33

Quantifiers

Using a restricted domain things are a little simpler

(existx isin R+)[x2 + 2x + c = 0

]Letrsquos assume it is true ie

There exists a positive x the equation x2 + 2x + c = 0 is true

What if we want to negate this statement We get

not[(existx isin R+)

[x2 + 2x + c = 0

]]Not[Exists[x x gt 0 x^2 + 2 x + c == 0]]Reduce[ c Reals] (consider only real numbers)

What does the statement meanFor all positive x the equation is not true

Again the values of c found by Mathematica are complementary tothose for which the original statement was true

fasshaueriitedu MATH 100 ndash ITP 34

Quantifiers

Back to Beer

We end by determining the ldquocorrectrdquo formulation for the beer exampleLetrsquos formalize the statement

All American beer tastes dreadful

We introduce the following notationB the set of all beers

A(x) the statement ldquox is AmericanrdquoD(x) the statement ldquox tastes dreadfulrdquo

Then we get(forallx isin B) [A(x)rArr D(x)]

ieFor all beers if the beer is American then it tastes dreadful

fasshaueriitedu MATH 100 ndash ITP 35

Quantifiers

Now we need to negate

(forallx isin B) [A(x)rArr D(x)]

According to our earlier discussion we have

(existx isin B)not [A(x)rArr D(x)]

which using the fact that not [φrArr ψ] is equivalent to φ and (notψ) yields

(existx isin B) [A(x) and (notD(x))]

In wordsThere exists a beer which is American and does not tastedreadful

fasshaueriitedu MATH 100 ndash ITP 36

Appendix References

References I

Devlin Keith JSet Functions and Logic (3rd Ed)Chapman amp HallCRC 2004

Moler CleveExperiments with MATLABhttpwwwmathworkscommolerexmchaptershtml

fasshaueriitedu MATH 100 ndash ITP 37

  • ``Thats Logic
  • Logical Connectives
  • Conditionals and Biconditionals
  • Truth Tables
  • Looking Ahead Toward Proofs
  • Quantifiers
  • Appendix
Page 12: MATH 100 – Introduction to the Profession - Logic

Conditionals and Biconditionals

Truth tablehttpwwwwolframalphacominputi=P+Implies+QImportant concepts for all of mathematics

φ implies ψif φ then ψφ is sufficient for ψφ only if ψψ if φψ whenever φψ is necessary for φ

fasshaueriitedu MATH 100 ndash ITP 12

Conditionals and Biconditionals

Are conditionals confusingProbably so Consider the following interpretation of the truth table4

If Springfield is the capital of Illinois then Springfield is the capitalof Illinois (TrArr T is T) OKIf Springfield is the capital of Illinois then Chicago is the capital ofIllinois (TrArr F is F) This better be falseIf Chicago is the capital of Illinois then Springfield is the capital ofIllinois (FrArr T is T) WeirdIf Chicago is the capital of Illinois then Rockford is the capital ofIllinois (FrArr F is T) Very weird

Read (carefully) the discussion in [Devlin pp 18-19]Conditional in words

φrArr ψ is only then not T if ψ is F in spite of φ being T

More colloquially φrArr ψ is considered true until proven false(ldquoinnocent until proven guiltyrdquo)

4The state capital of Illinois is Springfieldfasshaueriitedu MATH 100 ndash ITP 13

Conditionals and Biconditionals

Another example for the conditional

Letrsquos consider the following promise I make to you

If you average 85 or above in this class then you will get anA

At the end of the semester we could have various outcomesYou average 90 and get an A (Trarr T is T ie I kept my promise)You average 90 and get a B (Trarr F is F ie I broke mypromise)You average 80 and get an A (Frarr T is T ie I didnrsquot break mypromise uml )You average 80 and get a B (Frarr F is T ie I didnrsquot break mypromise ndash and you received what you expected)

This illustrates perfectly that scoring 85 or higher was sufficient foran A but not necessary

fasshaueriitedu MATH 100 ndash ITP 14

Conditionals and Biconditionals

And a mathematical example

Letrsquos assume that n is a positive integer Then

(n is a perfect square with last digit 7)rArr (n is a prime number)

is a true statementThis is so because we have both (by definition)

FrArr T is TFrArr F is T

and we know that no perfect square ends in 7 (so it is irrelevant that allwe know about n is that it is a positive integer)

RemarkStatements like these (and the earlier ones about the IL state capital)do not agree with common sense Usually we work with statementsthat are in some logical context (see the discussion of causation in[Devlin p 17])

fasshaueriitedu MATH 100 ndash ITP 15

Conditionals and Biconditionals

Biconditional for logical equivalence if and only ifMathematical notation hArrharrDoes not make sense in MATLAB (only in SymbolicToolbox)Example (in Mathematica)Equivalent[3ltPi 4gtPi]

Truth table httpwwwwolframalphacominputi=P+Equivalent+Q

fasshaueriitedu MATH 100 ndash ITP 16

Truth Tables

Further insights via truth tables

Example

Prove not(φ and ψ) is equivalent to (notφ) or (notψ)

φ ψ φ and ψ not(φ and ψ)T T T FT F F TF T F TF F F T

φ ψ notφ notψ (notφ) or (notψ)T T F F FT F F T TF T T F TF F T T T

fasshaueriitedu MATH 100 ndash ITP 17

Truth Tables

Example (Exercise 229(a) in [Devlin])

Prove not(φrArr ψ) is equivalent to φ and (notψ)

φ ψ φrArr ψ not(φrArr ψ)

T T T FT F F TF T T FF F T F

φ ψ φ and (notψ)T T FT F TF T FF F F

How can we then interpret φrArr ψ in terms of and or and not (notφ) or ψ

fasshaueriitedu MATH 100 ndash ITP 18

Truth Tables

Example (Wason Selection Task Exercise 2220 in [Devlin])

Assuming each card has a letter on one face and a numberon the other which card(s) do you have to turn over in orderto test the truth of the proposition that if a card has a vowel onone face then its opposite shows an even numbera

Answer Cards ldquoErdquo and ldquo7rdquo

Checking the other side of ldquoErdquo is obvious (we need an even number toshow for the proposition to hold)It doesnrsquot matter whatrsquos on the other side of ldquoKrdquo (the proposition makesno claim about cards with a consonant)Nor does it matter whatrsquos on the other side of ldquo4rdquo (if itrsquos a vowel great ifitrsquos a consonant no rule was violated either)We need to check ldquo7rdquo (if a vowel shows up the proposition is false)

aOnly about 10 of the population get this rightfasshaueriitedu MATH 100 ndash ITP 19

Looking Ahead Toward Proofs

When we do a mathematical proof then we need to decide whether acertain mathematical statement is logically true or not

The direct approach (known as modus ponens ie method byaffirmation) is to conclude

If φ and (φrArr ψ) then ψ

Example

Show that if n is an even integer then (minus1)n = 1

Proofn is an arbitrary even integer so n = 2k for some integer k But then

(minus1)n = (minus1)2k =((minus1)2︸ ︷︷ ︸

=1

)k= 1k = 1

fasshaueriitedu MATH 100 ndash ITP 20

Looking Ahead Toward Proofs

Contrapositive

Sometimes it is difficult to prove an implication directly In this case wecan try to show that the contrapositive of the conditional holds ie weuse (see HW 2211)

φrArr ψ is equivalent to (notψ)rArr (notφ)

and conclude (modus tollens method by denial)

If φ and ((notψ)rArr (notφ)) then ψ

Note that this has nothing to do with proof by contradiction (more onthat later)

Example

Conditional If you average 85 or above then you will get an AContrapositive If you donrsquotdidnrsquot get an A then you donrsquotdidnrsquot average85 or above

fasshaueriitedu MATH 100 ndash ITP 21

Looking Ahead Toward Proofs

Converse

Do not confuse the contrapositive of a conditional with its converse

If φrArr ψ then its converse is ψ rArr φ

There is no logical connection between a conditional and its converse

The only link is that if both are true then the biconditional holds ie

(φrArr ψ) and (ψ rArr φ) is equivalent to (φhArr ψ)

Example

Conditional If you average 85 or above then you will get an AContrapositive If you donrsquotdidnrsquot get an A then you donrsquotdidnrsquot average85 or aboveConverse If you getgot an A then you averageaveraged 85 or above

Note The converse assures us that scoring 85 or above isnecessary for an A (not so good for you _)

fasshaueriitedu MATH 100 ndash ITP 22

Looking Ahead Toward Proofs

Also do not confuse a statement with itsconverse

More Lewis CarrolllsquoNot the same thing a bitrsquo saidthe Hatter lsquoYou might just as wellsay that ldquoI see what I eatrdquo is thesame thing as ldquoI eat what I seerdquorsquo

From ldquoAlice in Wonderlandrdquo by Lewis Carroll (seehttpwwwonline-literaturecomcarrollalice7 forthe complete Chapter 7 A Mad Tea Party)

fasshaueriitedu MATH 100 ndash ITP 23

Looking Ahead Toward Proofs

Inverse

One could also consider the contrapositive of the converse5 of aconditional also known as the inverse of the conditional

Example

Conditional If you average 85 or above then you will get an AContrapositive If you donrsquotdidnrsquot get an A then you donrsquotdidnrsquot average85 or aboveConverse If you getgot an A then you averageaveraged 85 or aboveInverse If you donrsquot average 85 or above then you wonrsquot get an A

Note The inverse (which is equivalent to the converse) perhaps showseven better that scoring 85 or above is necessary for an A

5Or equivalently the converse of the contrapositivefasshaueriitedu MATH 100 ndash ITP 24

Looking Ahead Toward Proofs

Negated Conditional

You also might be tempted to confuse the contrapositive of aconditional with its negation As we showed earlier the negation of aconditional

not(φrArr ψ) is equivalent to φ and (notψ)

which is different from the contrapositive of φrArr ψ

(notψ)rArr (notφ)

The latter would be equivalent to (verify this)

(notφ) or ψ

fasshaueriitedu MATH 100 ndash ITP 25

Looking Ahead Toward Proofs

We just said that the negated conditional is

φ and (notψ)

Example

Conditional If you average 85 or above then you will get an AContrapositive If you donrsquotdidnrsquot get an A then you donrsquotdidnrsquot average85 or aboveConverse If you getgot an A then you averageaveraged 85 or aboveInverse If you donrsquot average 85 or above then you wonrsquot get an ANegated conditional You average 85 or above and you wonrsquot get an A

Note The negated conditional is only true if the conditional is falseie in the case when I break my promise

fasshaueriitedu MATH 100 ndash ITP 26

Looking Ahead Toward Proofs

The perverse cube of reversed implications

notφrArr notψφornotψ

larrrarr notψ rArr notφψornotφ

l lφrArr ψnotφorψ

larrrarr ψ rArr φnotψorφ

l Negation l

not (notφrArr notψ)notφandψ

middot middot middot not (notψ rArr notφ)notψandφ

l lnot (φrArr ψ)

φandnotψmiddot middot middot not (ψ rArr φ)

ψandnotφ

Create the truth tables for all these statements to verify their relations

fasshaueriitedu MATH 100 ndash ITP 27

Quantifiers

ldquoFor allrdquo and ldquothere existsrdquo

Universal quantifier forallx ldquofor all x it is the case that rdquoExistential quantifier existx ldquothere exists an x such that rdquo

Example (in Mathematica ndash quantifiers donrsquot exist in MATLAB)ForAll[x Element[xReals] x^2 + 2 x + c gt 0]Reduce[ c] ( find c st the statement is T )

In words For what values of c is the inequality x2 + 2x + c gt 0 true forall values of x

Example (in Mathematica)Exists[x x^2 + 2 x + c == 0 ampamp x gt 0]Reduce[ c Reals] (consider only real numbers)

In words For what values of c does the equation x2 + 2x + c = 0 havea positive solution x When does a positive solution exista

aExistence (and uniqueness) of a solution are fundamental issues in math

fasshaueriitedu MATH 100 ndash ITP 28

Quantifiers

We can also nicely visualize whatrsquos going on in Mathematica

Manipulate[Plot[x^2 + 2 x + c x -5 5PlotRange -gt -6 10] c -5 5]

This shows thatfor c le 0 there is an intersection with the positive x-axis so apositive solution to the equation x2 + 2x + c = 0 existsfor c gt 0 the parabola does not intersect the positive x-axis sothe equation x2 + 2x + c = 0 is false for positive values of x for c gt 1 the parabola does not intersect the x-axis at all so theinequality x2 + 2x + c gt 0 is true for all values of x (but theequation x2 + 2x + c = 0 is false)

RemarkWe could also use a restricted domain for the existence example ie

Exists[x xgt0 x^2 + 2 x + c == 0]Reduce[ c Reals] (consider only real numbers)

fasshaueriitedu MATH 100 ndash ITP 29

Quantifiers

Example (Comparing the use of exist and forall in common language)

Consider the two statementsEverybody likes at least one drink namely water(one drink liked by everybody)Everybody likes at least one drink I myself go for beer(everybody likes some drink)

How can we formalize these two statements using quantifiers

There exists a drink D such that for every person P P likes D

(existD) (forallP) [P likes D]

For every person P there exists a drink D such that P likes D

(forallP) (existD) [P likes D]

The order of quantifiers matters What about the other two casesfasshaueriitedu MATH 100 ndash ITP 30

Quantifiers

A mathematical example

Let P be the set of prime numbers and N the set of natural numbersThen

(foralln isin N) (existm isin N) [(m gt n) and (m isin P)]

says that there are infinitely many primes

Actually it says that

For whatever natural number n we pickwe can find another natural number mthat is both larger than n and a prime number

The statement m isin P (or ldquom is a prime numberrdquo) can be formalized as

(forallab isin N) [(ab = m)rArr ((a = 1) or (b = 1))]

fasshaueriitedu MATH 100 ndash ITP 31

Quantifiers

Negation of Universal Statements

Earlier we used the example (in Mathematica)

(forallx isin R)[x2 + 2x + c gt 0

]Letrsquos assume it is true ie

For all x the inequality x2 + 2x + c gt 0 is true

What if we want to negate this statement We get

not[(forallx isin R)

[x2 + 2x + c gt 0

]]Not[ForAll[x Element[xReals] x^2 + 2 x + c gt 0]]Reduce[ c] ( find c st the statement is T )

What does the statement mean (Mathematica resolved it)

There exists some x for which the inequality is not trueNote that the values of c found by Mathematica are complementary tothose for which the original statement was true

fasshaueriitedu MATH 100 ndash ITP 32

Quantifiers

Negation of Existential StatementsLetrsquos use our second earlier example

(existx isin R)[(x2 + 2x + c = 0) and (x gt 0)

]Letrsquos assume it is true ie

There exists an x such that the equation x2 + 2x + c = 0 istrue and x gt 0

What if we want to negate this statement We get

not[(existx isin R)

[(x2 + 2x + c = 0) and (x gt 0)

]]Not[Exists[x x^2 + 2 x + c == 0 ampamp x gt 0]]Reduce[ c Reals] (consider only real numbers)

What does the statement meanFor all x the equation is not true or x le 0

Again the values of c found by Mathematica are complementary tothose for which the original statement was true

fasshaueriitedu MATH 100 ndash ITP 33

Quantifiers

Using a restricted domain things are a little simpler

(existx isin R+)[x2 + 2x + c = 0

]Letrsquos assume it is true ie

There exists a positive x the equation x2 + 2x + c = 0 is true

What if we want to negate this statement We get

not[(existx isin R+)

[x2 + 2x + c = 0

]]Not[Exists[x x gt 0 x^2 + 2 x + c == 0]]Reduce[ c Reals] (consider only real numbers)

What does the statement meanFor all positive x the equation is not true

Again the values of c found by Mathematica are complementary tothose for which the original statement was true

fasshaueriitedu MATH 100 ndash ITP 34

Quantifiers

Back to Beer

We end by determining the ldquocorrectrdquo formulation for the beer exampleLetrsquos formalize the statement

All American beer tastes dreadful

We introduce the following notationB the set of all beers

A(x) the statement ldquox is AmericanrdquoD(x) the statement ldquox tastes dreadfulrdquo

Then we get(forallx isin B) [A(x)rArr D(x)]

ieFor all beers if the beer is American then it tastes dreadful

fasshaueriitedu MATH 100 ndash ITP 35

Quantifiers

Now we need to negate

(forallx isin B) [A(x)rArr D(x)]

According to our earlier discussion we have

(existx isin B)not [A(x)rArr D(x)]

which using the fact that not [φrArr ψ] is equivalent to φ and (notψ) yields

(existx isin B) [A(x) and (notD(x))]

In wordsThere exists a beer which is American and does not tastedreadful

fasshaueriitedu MATH 100 ndash ITP 36

Appendix References

References I

Devlin Keith JSet Functions and Logic (3rd Ed)Chapman amp HallCRC 2004

Moler CleveExperiments with MATLABhttpwwwmathworkscommolerexmchaptershtml

fasshaueriitedu MATH 100 ndash ITP 37

  • ``Thats Logic
  • Logical Connectives
  • Conditionals and Biconditionals
  • Truth Tables
  • Looking Ahead Toward Proofs
  • Quantifiers
  • Appendix
Page 13: MATH 100 – Introduction to the Profession - Logic

Conditionals and Biconditionals

Are conditionals confusingProbably so Consider the following interpretation of the truth table4

If Springfield is the capital of Illinois then Springfield is the capitalof Illinois (TrArr T is T) OKIf Springfield is the capital of Illinois then Chicago is the capital ofIllinois (TrArr F is F) This better be falseIf Chicago is the capital of Illinois then Springfield is the capital ofIllinois (FrArr T is T) WeirdIf Chicago is the capital of Illinois then Rockford is the capital ofIllinois (FrArr F is T) Very weird

Read (carefully) the discussion in [Devlin pp 18-19]Conditional in words

φrArr ψ is only then not T if ψ is F in spite of φ being T

More colloquially φrArr ψ is considered true until proven false(ldquoinnocent until proven guiltyrdquo)

4The state capital of Illinois is Springfieldfasshaueriitedu MATH 100 ndash ITP 13

Conditionals and Biconditionals

Another example for the conditional

Letrsquos consider the following promise I make to you

If you average 85 or above in this class then you will get anA

At the end of the semester we could have various outcomesYou average 90 and get an A (Trarr T is T ie I kept my promise)You average 90 and get a B (Trarr F is F ie I broke mypromise)You average 80 and get an A (Frarr T is T ie I didnrsquot break mypromise uml )You average 80 and get a B (Frarr F is T ie I didnrsquot break mypromise ndash and you received what you expected)

This illustrates perfectly that scoring 85 or higher was sufficient foran A but not necessary

fasshaueriitedu MATH 100 ndash ITP 14

Conditionals and Biconditionals

And a mathematical example

Letrsquos assume that n is a positive integer Then

(n is a perfect square with last digit 7)rArr (n is a prime number)

is a true statementThis is so because we have both (by definition)

FrArr T is TFrArr F is T

and we know that no perfect square ends in 7 (so it is irrelevant that allwe know about n is that it is a positive integer)

RemarkStatements like these (and the earlier ones about the IL state capital)do not agree with common sense Usually we work with statementsthat are in some logical context (see the discussion of causation in[Devlin p 17])

fasshaueriitedu MATH 100 ndash ITP 15

Conditionals and Biconditionals

Biconditional for logical equivalence if and only ifMathematical notation hArrharrDoes not make sense in MATLAB (only in SymbolicToolbox)Example (in Mathematica)Equivalent[3ltPi 4gtPi]

Truth table httpwwwwolframalphacominputi=P+Equivalent+Q

fasshaueriitedu MATH 100 ndash ITP 16

Truth Tables

Further insights via truth tables

Example

Prove not(φ and ψ) is equivalent to (notφ) or (notψ)

φ ψ φ and ψ not(φ and ψ)T T T FT F F TF T F TF F F T

φ ψ notφ notψ (notφ) or (notψ)T T F F FT F F T TF T T F TF F T T T

fasshaueriitedu MATH 100 ndash ITP 17

Truth Tables

Example (Exercise 229(a) in [Devlin])

Prove not(φrArr ψ) is equivalent to φ and (notψ)

φ ψ φrArr ψ not(φrArr ψ)

T T T FT F F TF T T FF F T F

φ ψ φ and (notψ)T T FT F TF T FF F F

How can we then interpret φrArr ψ in terms of and or and not (notφ) or ψ

fasshaueriitedu MATH 100 ndash ITP 18

Truth Tables

Example (Wason Selection Task Exercise 2220 in [Devlin])

Assuming each card has a letter on one face and a numberon the other which card(s) do you have to turn over in orderto test the truth of the proposition that if a card has a vowel onone face then its opposite shows an even numbera

Answer Cards ldquoErdquo and ldquo7rdquo

Checking the other side of ldquoErdquo is obvious (we need an even number toshow for the proposition to hold)It doesnrsquot matter whatrsquos on the other side of ldquoKrdquo (the proposition makesno claim about cards with a consonant)Nor does it matter whatrsquos on the other side of ldquo4rdquo (if itrsquos a vowel great ifitrsquos a consonant no rule was violated either)We need to check ldquo7rdquo (if a vowel shows up the proposition is false)

aOnly about 10 of the population get this rightfasshaueriitedu MATH 100 ndash ITP 19

Looking Ahead Toward Proofs

When we do a mathematical proof then we need to decide whether acertain mathematical statement is logically true or not

The direct approach (known as modus ponens ie method byaffirmation) is to conclude

If φ and (φrArr ψ) then ψ

Example

Show that if n is an even integer then (minus1)n = 1

Proofn is an arbitrary even integer so n = 2k for some integer k But then

(minus1)n = (minus1)2k =((minus1)2︸ ︷︷ ︸

=1

)k= 1k = 1

fasshaueriitedu MATH 100 ndash ITP 20

Looking Ahead Toward Proofs

Contrapositive

Sometimes it is difficult to prove an implication directly In this case wecan try to show that the contrapositive of the conditional holds ie weuse (see HW 2211)

φrArr ψ is equivalent to (notψ)rArr (notφ)

and conclude (modus tollens method by denial)

If φ and ((notψ)rArr (notφ)) then ψ

Note that this has nothing to do with proof by contradiction (more onthat later)

Example

Conditional If you average 85 or above then you will get an AContrapositive If you donrsquotdidnrsquot get an A then you donrsquotdidnrsquot average85 or above

fasshaueriitedu MATH 100 ndash ITP 21

Looking Ahead Toward Proofs

Converse

Do not confuse the contrapositive of a conditional with its converse

If φrArr ψ then its converse is ψ rArr φ

There is no logical connection between a conditional and its converse

The only link is that if both are true then the biconditional holds ie

(φrArr ψ) and (ψ rArr φ) is equivalent to (φhArr ψ)

Example

Conditional If you average 85 or above then you will get an AContrapositive If you donrsquotdidnrsquot get an A then you donrsquotdidnrsquot average85 or aboveConverse If you getgot an A then you averageaveraged 85 or above

Note The converse assures us that scoring 85 or above isnecessary for an A (not so good for you _)

fasshaueriitedu MATH 100 ndash ITP 22

Looking Ahead Toward Proofs

Also do not confuse a statement with itsconverse

More Lewis CarrolllsquoNot the same thing a bitrsquo saidthe Hatter lsquoYou might just as wellsay that ldquoI see what I eatrdquo is thesame thing as ldquoI eat what I seerdquorsquo

From ldquoAlice in Wonderlandrdquo by Lewis Carroll (seehttpwwwonline-literaturecomcarrollalice7 forthe complete Chapter 7 A Mad Tea Party)

fasshaueriitedu MATH 100 ndash ITP 23

Looking Ahead Toward Proofs

Inverse

One could also consider the contrapositive of the converse5 of aconditional also known as the inverse of the conditional

Example

Conditional If you average 85 or above then you will get an AContrapositive If you donrsquotdidnrsquot get an A then you donrsquotdidnrsquot average85 or aboveConverse If you getgot an A then you averageaveraged 85 or aboveInverse If you donrsquot average 85 or above then you wonrsquot get an A

Note The inverse (which is equivalent to the converse) perhaps showseven better that scoring 85 or above is necessary for an A

5Or equivalently the converse of the contrapositivefasshaueriitedu MATH 100 ndash ITP 24

Looking Ahead Toward Proofs

Negated Conditional

You also might be tempted to confuse the contrapositive of aconditional with its negation As we showed earlier the negation of aconditional

not(φrArr ψ) is equivalent to φ and (notψ)

which is different from the contrapositive of φrArr ψ

(notψ)rArr (notφ)

The latter would be equivalent to (verify this)

(notφ) or ψ

fasshaueriitedu MATH 100 ndash ITP 25

Looking Ahead Toward Proofs

We just said that the negated conditional is

φ and (notψ)

Example

Conditional If you average 85 or above then you will get an AContrapositive If you donrsquotdidnrsquot get an A then you donrsquotdidnrsquot average85 or aboveConverse If you getgot an A then you averageaveraged 85 or aboveInverse If you donrsquot average 85 or above then you wonrsquot get an ANegated conditional You average 85 or above and you wonrsquot get an A

Note The negated conditional is only true if the conditional is falseie in the case when I break my promise

fasshaueriitedu MATH 100 ndash ITP 26

Looking Ahead Toward Proofs

The perverse cube of reversed implications

notφrArr notψφornotψ

larrrarr notψ rArr notφψornotφ

l lφrArr ψnotφorψ

larrrarr ψ rArr φnotψorφ

l Negation l

not (notφrArr notψ)notφandψ

middot middot middot not (notψ rArr notφ)notψandφ

l lnot (φrArr ψ)

φandnotψmiddot middot middot not (ψ rArr φ)

ψandnotφ

Create the truth tables for all these statements to verify their relations

fasshaueriitedu MATH 100 ndash ITP 27

Quantifiers

ldquoFor allrdquo and ldquothere existsrdquo

Universal quantifier forallx ldquofor all x it is the case that rdquoExistential quantifier existx ldquothere exists an x such that rdquo

Example (in Mathematica ndash quantifiers donrsquot exist in MATLAB)ForAll[x Element[xReals] x^2 + 2 x + c gt 0]Reduce[ c] ( find c st the statement is T )

In words For what values of c is the inequality x2 + 2x + c gt 0 true forall values of x

Example (in Mathematica)Exists[x x^2 + 2 x + c == 0 ampamp x gt 0]Reduce[ c Reals] (consider only real numbers)

In words For what values of c does the equation x2 + 2x + c = 0 havea positive solution x When does a positive solution exista

aExistence (and uniqueness) of a solution are fundamental issues in math

fasshaueriitedu MATH 100 ndash ITP 28

Quantifiers

We can also nicely visualize whatrsquos going on in Mathematica

Manipulate[Plot[x^2 + 2 x + c x -5 5PlotRange -gt -6 10] c -5 5]

This shows thatfor c le 0 there is an intersection with the positive x-axis so apositive solution to the equation x2 + 2x + c = 0 existsfor c gt 0 the parabola does not intersect the positive x-axis sothe equation x2 + 2x + c = 0 is false for positive values of x for c gt 1 the parabola does not intersect the x-axis at all so theinequality x2 + 2x + c gt 0 is true for all values of x (but theequation x2 + 2x + c = 0 is false)

RemarkWe could also use a restricted domain for the existence example ie

Exists[x xgt0 x^2 + 2 x + c == 0]Reduce[ c Reals] (consider only real numbers)

fasshaueriitedu MATH 100 ndash ITP 29

Quantifiers

Example (Comparing the use of exist and forall in common language)

Consider the two statementsEverybody likes at least one drink namely water(one drink liked by everybody)Everybody likes at least one drink I myself go for beer(everybody likes some drink)

How can we formalize these two statements using quantifiers

There exists a drink D such that for every person P P likes D

(existD) (forallP) [P likes D]

For every person P there exists a drink D such that P likes D

(forallP) (existD) [P likes D]

The order of quantifiers matters What about the other two casesfasshaueriitedu MATH 100 ndash ITP 30

Quantifiers

A mathematical example

Let P be the set of prime numbers and N the set of natural numbersThen

(foralln isin N) (existm isin N) [(m gt n) and (m isin P)]

says that there are infinitely many primes

Actually it says that

For whatever natural number n we pickwe can find another natural number mthat is both larger than n and a prime number

The statement m isin P (or ldquom is a prime numberrdquo) can be formalized as

(forallab isin N) [(ab = m)rArr ((a = 1) or (b = 1))]

fasshaueriitedu MATH 100 ndash ITP 31

Quantifiers

Negation of Universal Statements

Earlier we used the example (in Mathematica)

(forallx isin R)[x2 + 2x + c gt 0

]Letrsquos assume it is true ie

For all x the inequality x2 + 2x + c gt 0 is true

What if we want to negate this statement We get

not[(forallx isin R)

[x2 + 2x + c gt 0

]]Not[ForAll[x Element[xReals] x^2 + 2 x + c gt 0]]Reduce[ c] ( find c st the statement is T )

What does the statement mean (Mathematica resolved it)

There exists some x for which the inequality is not trueNote that the values of c found by Mathematica are complementary tothose for which the original statement was true

fasshaueriitedu MATH 100 ndash ITP 32

Quantifiers

Negation of Existential StatementsLetrsquos use our second earlier example

(existx isin R)[(x2 + 2x + c = 0) and (x gt 0)

]Letrsquos assume it is true ie

There exists an x such that the equation x2 + 2x + c = 0 istrue and x gt 0

What if we want to negate this statement We get

not[(existx isin R)

[(x2 + 2x + c = 0) and (x gt 0)

]]Not[Exists[x x^2 + 2 x + c == 0 ampamp x gt 0]]Reduce[ c Reals] (consider only real numbers)

What does the statement meanFor all x the equation is not true or x le 0

Again the values of c found by Mathematica are complementary tothose for which the original statement was true

fasshaueriitedu MATH 100 ndash ITP 33

Quantifiers

Using a restricted domain things are a little simpler

(existx isin R+)[x2 + 2x + c = 0

]Letrsquos assume it is true ie

There exists a positive x the equation x2 + 2x + c = 0 is true

What if we want to negate this statement We get

not[(existx isin R+)

[x2 + 2x + c = 0

]]Not[Exists[x x gt 0 x^2 + 2 x + c == 0]]Reduce[ c Reals] (consider only real numbers)

What does the statement meanFor all positive x the equation is not true

Again the values of c found by Mathematica are complementary tothose for which the original statement was true

fasshaueriitedu MATH 100 ndash ITP 34

Quantifiers

Back to Beer

We end by determining the ldquocorrectrdquo formulation for the beer exampleLetrsquos formalize the statement

All American beer tastes dreadful

We introduce the following notationB the set of all beers

A(x) the statement ldquox is AmericanrdquoD(x) the statement ldquox tastes dreadfulrdquo

Then we get(forallx isin B) [A(x)rArr D(x)]

ieFor all beers if the beer is American then it tastes dreadful

fasshaueriitedu MATH 100 ndash ITP 35

Quantifiers

Now we need to negate

(forallx isin B) [A(x)rArr D(x)]

According to our earlier discussion we have

(existx isin B)not [A(x)rArr D(x)]

which using the fact that not [φrArr ψ] is equivalent to φ and (notψ) yields

(existx isin B) [A(x) and (notD(x))]

In wordsThere exists a beer which is American and does not tastedreadful

fasshaueriitedu MATH 100 ndash ITP 36

Appendix References

References I

Devlin Keith JSet Functions and Logic (3rd Ed)Chapman amp HallCRC 2004

Moler CleveExperiments with MATLABhttpwwwmathworkscommolerexmchaptershtml

fasshaueriitedu MATH 100 ndash ITP 37

  • ``Thats Logic
  • Logical Connectives
  • Conditionals and Biconditionals
  • Truth Tables
  • Looking Ahead Toward Proofs
  • Quantifiers
  • Appendix
Page 14: MATH 100 – Introduction to the Profession - Logic

Conditionals and Biconditionals

Another example for the conditional

Letrsquos consider the following promise I make to you

If you average 85 or above in this class then you will get anA

At the end of the semester we could have various outcomesYou average 90 and get an A (Trarr T is T ie I kept my promise)You average 90 and get a B (Trarr F is F ie I broke mypromise)You average 80 and get an A (Frarr T is T ie I didnrsquot break mypromise uml )You average 80 and get a B (Frarr F is T ie I didnrsquot break mypromise ndash and you received what you expected)

This illustrates perfectly that scoring 85 or higher was sufficient foran A but not necessary

fasshaueriitedu MATH 100 ndash ITP 14

Conditionals and Biconditionals

And a mathematical example

Letrsquos assume that n is a positive integer Then

(n is a perfect square with last digit 7)rArr (n is a prime number)

is a true statementThis is so because we have both (by definition)

FrArr T is TFrArr F is T

and we know that no perfect square ends in 7 (so it is irrelevant that allwe know about n is that it is a positive integer)

RemarkStatements like these (and the earlier ones about the IL state capital)do not agree with common sense Usually we work with statementsthat are in some logical context (see the discussion of causation in[Devlin p 17])

fasshaueriitedu MATH 100 ndash ITP 15

Conditionals and Biconditionals

Biconditional for logical equivalence if and only ifMathematical notation hArrharrDoes not make sense in MATLAB (only in SymbolicToolbox)Example (in Mathematica)Equivalent[3ltPi 4gtPi]

Truth table httpwwwwolframalphacominputi=P+Equivalent+Q

fasshaueriitedu MATH 100 ndash ITP 16

Truth Tables

Further insights via truth tables

Example

Prove not(φ and ψ) is equivalent to (notφ) or (notψ)

φ ψ φ and ψ not(φ and ψ)T T T FT F F TF T F TF F F T

φ ψ notφ notψ (notφ) or (notψ)T T F F FT F F T TF T T F TF F T T T

fasshaueriitedu MATH 100 ndash ITP 17

Truth Tables

Example (Exercise 229(a) in [Devlin])

Prove not(φrArr ψ) is equivalent to φ and (notψ)

φ ψ φrArr ψ not(φrArr ψ)

T T T FT F F TF T T FF F T F

φ ψ φ and (notψ)T T FT F TF T FF F F

How can we then interpret φrArr ψ in terms of and or and not (notφ) or ψ

fasshaueriitedu MATH 100 ndash ITP 18

Truth Tables

Example (Wason Selection Task Exercise 2220 in [Devlin])

Assuming each card has a letter on one face and a numberon the other which card(s) do you have to turn over in orderto test the truth of the proposition that if a card has a vowel onone face then its opposite shows an even numbera

Answer Cards ldquoErdquo and ldquo7rdquo

Checking the other side of ldquoErdquo is obvious (we need an even number toshow for the proposition to hold)It doesnrsquot matter whatrsquos on the other side of ldquoKrdquo (the proposition makesno claim about cards with a consonant)Nor does it matter whatrsquos on the other side of ldquo4rdquo (if itrsquos a vowel great ifitrsquos a consonant no rule was violated either)We need to check ldquo7rdquo (if a vowel shows up the proposition is false)

aOnly about 10 of the population get this rightfasshaueriitedu MATH 100 ndash ITP 19

Looking Ahead Toward Proofs

When we do a mathematical proof then we need to decide whether acertain mathematical statement is logically true or not

The direct approach (known as modus ponens ie method byaffirmation) is to conclude

If φ and (φrArr ψ) then ψ

Example

Show that if n is an even integer then (minus1)n = 1

Proofn is an arbitrary even integer so n = 2k for some integer k But then

(minus1)n = (minus1)2k =((minus1)2︸ ︷︷ ︸

=1

)k= 1k = 1

fasshaueriitedu MATH 100 ndash ITP 20

Looking Ahead Toward Proofs

Contrapositive

Sometimes it is difficult to prove an implication directly In this case wecan try to show that the contrapositive of the conditional holds ie weuse (see HW 2211)

φrArr ψ is equivalent to (notψ)rArr (notφ)

and conclude (modus tollens method by denial)

If φ and ((notψ)rArr (notφ)) then ψ

Note that this has nothing to do with proof by contradiction (more onthat later)

Example

Conditional If you average 85 or above then you will get an AContrapositive If you donrsquotdidnrsquot get an A then you donrsquotdidnrsquot average85 or above

fasshaueriitedu MATH 100 ndash ITP 21

Looking Ahead Toward Proofs

Converse

Do not confuse the contrapositive of a conditional with its converse

If φrArr ψ then its converse is ψ rArr φ

There is no logical connection between a conditional and its converse

The only link is that if both are true then the biconditional holds ie

(φrArr ψ) and (ψ rArr φ) is equivalent to (φhArr ψ)

Example

Conditional If you average 85 or above then you will get an AContrapositive If you donrsquotdidnrsquot get an A then you donrsquotdidnrsquot average85 or aboveConverse If you getgot an A then you averageaveraged 85 or above

Note The converse assures us that scoring 85 or above isnecessary for an A (not so good for you _)

fasshaueriitedu MATH 100 ndash ITP 22

Looking Ahead Toward Proofs

Also do not confuse a statement with itsconverse

More Lewis CarrolllsquoNot the same thing a bitrsquo saidthe Hatter lsquoYou might just as wellsay that ldquoI see what I eatrdquo is thesame thing as ldquoI eat what I seerdquorsquo

From ldquoAlice in Wonderlandrdquo by Lewis Carroll (seehttpwwwonline-literaturecomcarrollalice7 forthe complete Chapter 7 A Mad Tea Party)

fasshaueriitedu MATH 100 ndash ITP 23

Looking Ahead Toward Proofs

Inverse

One could also consider the contrapositive of the converse5 of aconditional also known as the inverse of the conditional

Example

Conditional If you average 85 or above then you will get an AContrapositive If you donrsquotdidnrsquot get an A then you donrsquotdidnrsquot average85 or aboveConverse If you getgot an A then you averageaveraged 85 or aboveInverse If you donrsquot average 85 or above then you wonrsquot get an A

Note The inverse (which is equivalent to the converse) perhaps showseven better that scoring 85 or above is necessary for an A

5Or equivalently the converse of the contrapositivefasshaueriitedu MATH 100 ndash ITP 24

Looking Ahead Toward Proofs

Negated Conditional

You also might be tempted to confuse the contrapositive of aconditional with its negation As we showed earlier the negation of aconditional

not(φrArr ψ) is equivalent to φ and (notψ)

which is different from the contrapositive of φrArr ψ

(notψ)rArr (notφ)

The latter would be equivalent to (verify this)

(notφ) or ψ

fasshaueriitedu MATH 100 ndash ITP 25

Looking Ahead Toward Proofs

We just said that the negated conditional is

φ and (notψ)

Example

Conditional If you average 85 or above then you will get an AContrapositive If you donrsquotdidnrsquot get an A then you donrsquotdidnrsquot average85 or aboveConverse If you getgot an A then you averageaveraged 85 or aboveInverse If you donrsquot average 85 or above then you wonrsquot get an ANegated conditional You average 85 or above and you wonrsquot get an A

Note The negated conditional is only true if the conditional is falseie in the case when I break my promise

fasshaueriitedu MATH 100 ndash ITP 26

Looking Ahead Toward Proofs

The perverse cube of reversed implications

notφrArr notψφornotψ

larrrarr notψ rArr notφψornotφ

l lφrArr ψnotφorψ

larrrarr ψ rArr φnotψorφ

l Negation l

not (notφrArr notψ)notφandψ

middot middot middot not (notψ rArr notφ)notψandφ

l lnot (φrArr ψ)

φandnotψmiddot middot middot not (ψ rArr φ)

ψandnotφ

Create the truth tables for all these statements to verify their relations

fasshaueriitedu MATH 100 ndash ITP 27

Quantifiers

ldquoFor allrdquo and ldquothere existsrdquo

Universal quantifier forallx ldquofor all x it is the case that rdquoExistential quantifier existx ldquothere exists an x such that rdquo

Example (in Mathematica ndash quantifiers donrsquot exist in MATLAB)ForAll[x Element[xReals] x^2 + 2 x + c gt 0]Reduce[ c] ( find c st the statement is T )

In words For what values of c is the inequality x2 + 2x + c gt 0 true forall values of x

Example (in Mathematica)Exists[x x^2 + 2 x + c == 0 ampamp x gt 0]Reduce[ c Reals] (consider only real numbers)

In words For what values of c does the equation x2 + 2x + c = 0 havea positive solution x When does a positive solution exista

aExistence (and uniqueness) of a solution are fundamental issues in math

fasshaueriitedu MATH 100 ndash ITP 28

Quantifiers

We can also nicely visualize whatrsquos going on in Mathematica

Manipulate[Plot[x^2 + 2 x + c x -5 5PlotRange -gt -6 10] c -5 5]

This shows thatfor c le 0 there is an intersection with the positive x-axis so apositive solution to the equation x2 + 2x + c = 0 existsfor c gt 0 the parabola does not intersect the positive x-axis sothe equation x2 + 2x + c = 0 is false for positive values of x for c gt 1 the parabola does not intersect the x-axis at all so theinequality x2 + 2x + c gt 0 is true for all values of x (but theequation x2 + 2x + c = 0 is false)

RemarkWe could also use a restricted domain for the existence example ie

Exists[x xgt0 x^2 + 2 x + c == 0]Reduce[ c Reals] (consider only real numbers)

fasshaueriitedu MATH 100 ndash ITP 29

Quantifiers

Example (Comparing the use of exist and forall in common language)

Consider the two statementsEverybody likes at least one drink namely water(one drink liked by everybody)Everybody likes at least one drink I myself go for beer(everybody likes some drink)

How can we formalize these two statements using quantifiers

There exists a drink D such that for every person P P likes D

(existD) (forallP) [P likes D]

For every person P there exists a drink D such that P likes D

(forallP) (existD) [P likes D]

The order of quantifiers matters What about the other two casesfasshaueriitedu MATH 100 ndash ITP 30

Quantifiers

A mathematical example

Let P be the set of prime numbers and N the set of natural numbersThen

(foralln isin N) (existm isin N) [(m gt n) and (m isin P)]

says that there are infinitely many primes

Actually it says that

For whatever natural number n we pickwe can find another natural number mthat is both larger than n and a prime number

The statement m isin P (or ldquom is a prime numberrdquo) can be formalized as

(forallab isin N) [(ab = m)rArr ((a = 1) or (b = 1))]

fasshaueriitedu MATH 100 ndash ITP 31

Quantifiers

Negation of Universal Statements

Earlier we used the example (in Mathematica)

(forallx isin R)[x2 + 2x + c gt 0

]Letrsquos assume it is true ie

For all x the inequality x2 + 2x + c gt 0 is true

What if we want to negate this statement We get

not[(forallx isin R)

[x2 + 2x + c gt 0

]]Not[ForAll[x Element[xReals] x^2 + 2 x + c gt 0]]Reduce[ c] ( find c st the statement is T )

What does the statement mean (Mathematica resolved it)

There exists some x for which the inequality is not trueNote that the values of c found by Mathematica are complementary tothose for which the original statement was true

fasshaueriitedu MATH 100 ndash ITP 32

Quantifiers

Negation of Existential StatementsLetrsquos use our second earlier example

(existx isin R)[(x2 + 2x + c = 0) and (x gt 0)

]Letrsquos assume it is true ie

There exists an x such that the equation x2 + 2x + c = 0 istrue and x gt 0

What if we want to negate this statement We get

not[(existx isin R)

[(x2 + 2x + c = 0) and (x gt 0)

]]Not[Exists[x x^2 + 2 x + c == 0 ampamp x gt 0]]Reduce[ c Reals] (consider only real numbers)

What does the statement meanFor all x the equation is not true or x le 0

Again the values of c found by Mathematica are complementary tothose for which the original statement was true

fasshaueriitedu MATH 100 ndash ITP 33

Quantifiers

Using a restricted domain things are a little simpler

(existx isin R+)[x2 + 2x + c = 0

]Letrsquos assume it is true ie

There exists a positive x the equation x2 + 2x + c = 0 is true

What if we want to negate this statement We get

not[(existx isin R+)

[x2 + 2x + c = 0

]]Not[Exists[x x gt 0 x^2 + 2 x + c == 0]]Reduce[ c Reals] (consider only real numbers)

What does the statement meanFor all positive x the equation is not true

Again the values of c found by Mathematica are complementary tothose for which the original statement was true

fasshaueriitedu MATH 100 ndash ITP 34

Quantifiers

Back to Beer

We end by determining the ldquocorrectrdquo formulation for the beer exampleLetrsquos formalize the statement

All American beer tastes dreadful

We introduce the following notationB the set of all beers

A(x) the statement ldquox is AmericanrdquoD(x) the statement ldquox tastes dreadfulrdquo

Then we get(forallx isin B) [A(x)rArr D(x)]

ieFor all beers if the beer is American then it tastes dreadful

fasshaueriitedu MATH 100 ndash ITP 35

Quantifiers

Now we need to negate

(forallx isin B) [A(x)rArr D(x)]

According to our earlier discussion we have

(existx isin B)not [A(x)rArr D(x)]

which using the fact that not [φrArr ψ] is equivalent to φ and (notψ) yields

(existx isin B) [A(x) and (notD(x))]

In wordsThere exists a beer which is American and does not tastedreadful

fasshaueriitedu MATH 100 ndash ITP 36

Appendix References

References I

Devlin Keith JSet Functions and Logic (3rd Ed)Chapman amp HallCRC 2004

Moler CleveExperiments with MATLABhttpwwwmathworkscommolerexmchaptershtml

fasshaueriitedu MATH 100 ndash ITP 37

  • ``Thats Logic
  • Logical Connectives
  • Conditionals and Biconditionals
  • Truth Tables
  • Looking Ahead Toward Proofs
  • Quantifiers
  • Appendix
Page 15: MATH 100 – Introduction to the Profession - Logic

Conditionals and Biconditionals

And a mathematical example

Letrsquos assume that n is a positive integer Then

(n is a perfect square with last digit 7)rArr (n is a prime number)

is a true statementThis is so because we have both (by definition)

FrArr T is TFrArr F is T

and we know that no perfect square ends in 7 (so it is irrelevant that allwe know about n is that it is a positive integer)

RemarkStatements like these (and the earlier ones about the IL state capital)do not agree with common sense Usually we work with statementsthat are in some logical context (see the discussion of causation in[Devlin p 17])

fasshaueriitedu MATH 100 ndash ITP 15

Conditionals and Biconditionals

Biconditional for logical equivalence if and only ifMathematical notation hArrharrDoes not make sense in MATLAB (only in SymbolicToolbox)Example (in Mathematica)Equivalent[3ltPi 4gtPi]

Truth table httpwwwwolframalphacominputi=P+Equivalent+Q

fasshaueriitedu MATH 100 ndash ITP 16

Truth Tables

Further insights via truth tables

Example

Prove not(φ and ψ) is equivalent to (notφ) or (notψ)

φ ψ φ and ψ not(φ and ψ)T T T FT F F TF T F TF F F T

φ ψ notφ notψ (notφ) or (notψ)T T F F FT F F T TF T T F TF F T T T

fasshaueriitedu MATH 100 ndash ITP 17

Truth Tables

Example (Exercise 229(a) in [Devlin])

Prove not(φrArr ψ) is equivalent to φ and (notψ)

φ ψ φrArr ψ not(φrArr ψ)

T T T FT F F TF T T FF F T F

φ ψ φ and (notψ)T T FT F TF T FF F F

How can we then interpret φrArr ψ in terms of and or and not (notφ) or ψ

fasshaueriitedu MATH 100 ndash ITP 18

Truth Tables

Example (Wason Selection Task Exercise 2220 in [Devlin])

Assuming each card has a letter on one face and a numberon the other which card(s) do you have to turn over in orderto test the truth of the proposition that if a card has a vowel onone face then its opposite shows an even numbera

Answer Cards ldquoErdquo and ldquo7rdquo

Checking the other side of ldquoErdquo is obvious (we need an even number toshow for the proposition to hold)It doesnrsquot matter whatrsquos on the other side of ldquoKrdquo (the proposition makesno claim about cards with a consonant)Nor does it matter whatrsquos on the other side of ldquo4rdquo (if itrsquos a vowel great ifitrsquos a consonant no rule was violated either)We need to check ldquo7rdquo (if a vowel shows up the proposition is false)

aOnly about 10 of the population get this rightfasshaueriitedu MATH 100 ndash ITP 19

Looking Ahead Toward Proofs

When we do a mathematical proof then we need to decide whether acertain mathematical statement is logically true or not

The direct approach (known as modus ponens ie method byaffirmation) is to conclude

If φ and (φrArr ψ) then ψ

Example

Show that if n is an even integer then (minus1)n = 1

Proofn is an arbitrary even integer so n = 2k for some integer k But then

(minus1)n = (minus1)2k =((minus1)2︸ ︷︷ ︸

=1

)k= 1k = 1

fasshaueriitedu MATH 100 ndash ITP 20

Looking Ahead Toward Proofs

Contrapositive

Sometimes it is difficult to prove an implication directly In this case wecan try to show that the contrapositive of the conditional holds ie weuse (see HW 2211)

φrArr ψ is equivalent to (notψ)rArr (notφ)

and conclude (modus tollens method by denial)

If φ and ((notψ)rArr (notφ)) then ψ

Note that this has nothing to do with proof by contradiction (more onthat later)

Example

Conditional If you average 85 or above then you will get an AContrapositive If you donrsquotdidnrsquot get an A then you donrsquotdidnrsquot average85 or above

fasshaueriitedu MATH 100 ndash ITP 21

Looking Ahead Toward Proofs

Converse

Do not confuse the contrapositive of a conditional with its converse

If φrArr ψ then its converse is ψ rArr φ

There is no logical connection between a conditional and its converse

The only link is that if both are true then the biconditional holds ie

(φrArr ψ) and (ψ rArr φ) is equivalent to (φhArr ψ)

Example

Conditional If you average 85 or above then you will get an AContrapositive If you donrsquotdidnrsquot get an A then you donrsquotdidnrsquot average85 or aboveConverse If you getgot an A then you averageaveraged 85 or above

Note The converse assures us that scoring 85 or above isnecessary for an A (not so good for you _)

fasshaueriitedu MATH 100 ndash ITP 22

Looking Ahead Toward Proofs

Also do not confuse a statement with itsconverse

More Lewis CarrolllsquoNot the same thing a bitrsquo saidthe Hatter lsquoYou might just as wellsay that ldquoI see what I eatrdquo is thesame thing as ldquoI eat what I seerdquorsquo

From ldquoAlice in Wonderlandrdquo by Lewis Carroll (seehttpwwwonline-literaturecomcarrollalice7 forthe complete Chapter 7 A Mad Tea Party)

fasshaueriitedu MATH 100 ndash ITP 23

Looking Ahead Toward Proofs

Inverse

One could also consider the contrapositive of the converse5 of aconditional also known as the inverse of the conditional

Example

Conditional If you average 85 or above then you will get an AContrapositive If you donrsquotdidnrsquot get an A then you donrsquotdidnrsquot average85 or aboveConverse If you getgot an A then you averageaveraged 85 or aboveInverse If you donrsquot average 85 or above then you wonrsquot get an A

Note The inverse (which is equivalent to the converse) perhaps showseven better that scoring 85 or above is necessary for an A

5Or equivalently the converse of the contrapositivefasshaueriitedu MATH 100 ndash ITP 24

Looking Ahead Toward Proofs

Negated Conditional

You also might be tempted to confuse the contrapositive of aconditional with its negation As we showed earlier the negation of aconditional

not(φrArr ψ) is equivalent to φ and (notψ)

which is different from the contrapositive of φrArr ψ

(notψ)rArr (notφ)

The latter would be equivalent to (verify this)

(notφ) or ψ

fasshaueriitedu MATH 100 ndash ITP 25

Looking Ahead Toward Proofs

We just said that the negated conditional is

φ and (notψ)

Example

Conditional If you average 85 or above then you will get an AContrapositive If you donrsquotdidnrsquot get an A then you donrsquotdidnrsquot average85 or aboveConverse If you getgot an A then you averageaveraged 85 or aboveInverse If you donrsquot average 85 or above then you wonrsquot get an ANegated conditional You average 85 or above and you wonrsquot get an A

Note The negated conditional is only true if the conditional is falseie in the case when I break my promise

fasshaueriitedu MATH 100 ndash ITP 26

Looking Ahead Toward Proofs

The perverse cube of reversed implications

notφrArr notψφornotψ

larrrarr notψ rArr notφψornotφ

l lφrArr ψnotφorψ

larrrarr ψ rArr φnotψorφ

l Negation l

not (notφrArr notψ)notφandψ

middot middot middot not (notψ rArr notφ)notψandφ

l lnot (φrArr ψ)

φandnotψmiddot middot middot not (ψ rArr φ)

ψandnotφ

Create the truth tables for all these statements to verify their relations

fasshaueriitedu MATH 100 ndash ITP 27

Quantifiers

ldquoFor allrdquo and ldquothere existsrdquo

Universal quantifier forallx ldquofor all x it is the case that rdquoExistential quantifier existx ldquothere exists an x such that rdquo

Example (in Mathematica ndash quantifiers donrsquot exist in MATLAB)ForAll[x Element[xReals] x^2 + 2 x + c gt 0]Reduce[ c] ( find c st the statement is T )

In words For what values of c is the inequality x2 + 2x + c gt 0 true forall values of x

Example (in Mathematica)Exists[x x^2 + 2 x + c == 0 ampamp x gt 0]Reduce[ c Reals] (consider only real numbers)

In words For what values of c does the equation x2 + 2x + c = 0 havea positive solution x When does a positive solution exista

aExistence (and uniqueness) of a solution are fundamental issues in math

fasshaueriitedu MATH 100 ndash ITP 28

Quantifiers

We can also nicely visualize whatrsquos going on in Mathematica

Manipulate[Plot[x^2 + 2 x + c x -5 5PlotRange -gt -6 10] c -5 5]

This shows thatfor c le 0 there is an intersection with the positive x-axis so apositive solution to the equation x2 + 2x + c = 0 existsfor c gt 0 the parabola does not intersect the positive x-axis sothe equation x2 + 2x + c = 0 is false for positive values of x for c gt 1 the parabola does not intersect the x-axis at all so theinequality x2 + 2x + c gt 0 is true for all values of x (but theequation x2 + 2x + c = 0 is false)

RemarkWe could also use a restricted domain for the existence example ie

Exists[x xgt0 x^2 + 2 x + c == 0]Reduce[ c Reals] (consider only real numbers)

fasshaueriitedu MATH 100 ndash ITP 29

Quantifiers

Example (Comparing the use of exist and forall in common language)

Consider the two statementsEverybody likes at least one drink namely water(one drink liked by everybody)Everybody likes at least one drink I myself go for beer(everybody likes some drink)

How can we formalize these two statements using quantifiers

There exists a drink D such that for every person P P likes D

(existD) (forallP) [P likes D]

For every person P there exists a drink D such that P likes D

(forallP) (existD) [P likes D]

The order of quantifiers matters What about the other two casesfasshaueriitedu MATH 100 ndash ITP 30

Quantifiers

A mathematical example

Let P be the set of prime numbers and N the set of natural numbersThen

(foralln isin N) (existm isin N) [(m gt n) and (m isin P)]

says that there are infinitely many primes

Actually it says that

For whatever natural number n we pickwe can find another natural number mthat is both larger than n and a prime number

The statement m isin P (or ldquom is a prime numberrdquo) can be formalized as

(forallab isin N) [(ab = m)rArr ((a = 1) or (b = 1))]

fasshaueriitedu MATH 100 ndash ITP 31

Quantifiers

Negation of Universal Statements

Earlier we used the example (in Mathematica)

(forallx isin R)[x2 + 2x + c gt 0

]Letrsquos assume it is true ie

For all x the inequality x2 + 2x + c gt 0 is true

What if we want to negate this statement We get

not[(forallx isin R)

[x2 + 2x + c gt 0

]]Not[ForAll[x Element[xReals] x^2 + 2 x + c gt 0]]Reduce[ c] ( find c st the statement is T )

What does the statement mean (Mathematica resolved it)

There exists some x for which the inequality is not trueNote that the values of c found by Mathematica are complementary tothose for which the original statement was true

fasshaueriitedu MATH 100 ndash ITP 32

Quantifiers

Negation of Existential StatementsLetrsquos use our second earlier example

(existx isin R)[(x2 + 2x + c = 0) and (x gt 0)

]Letrsquos assume it is true ie

There exists an x such that the equation x2 + 2x + c = 0 istrue and x gt 0

What if we want to negate this statement We get

not[(existx isin R)

[(x2 + 2x + c = 0) and (x gt 0)

]]Not[Exists[x x^2 + 2 x + c == 0 ampamp x gt 0]]Reduce[ c Reals] (consider only real numbers)

What does the statement meanFor all x the equation is not true or x le 0

Again the values of c found by Mathematica are complementary tothose for which the original statement was true

fasshaueriitedu MATH 100 ndash ITP 33

Quantifiers

Using a restricted domain things are a little simpler

(existx isin R+)[x2 + 2x + c = 0

]Letrsquos assume it is true ie

There exists a positive x the equation x2 + 2x + c = 0 is true

What if we want to negate this statement We get

not[(existx isin R+)

[x2 + 2x + c = 0

]]Not[Exists[x x gt 0 x^2 + 2 x + c == 0]]Reduce[ c Reals] (consider only real numbers)

What does the statement meanFor all positive x the equation is not true

Again the values of c found by Mathematica are complementary tothose for which the original statement was true

fasshaueriitedu MATH 100 ndash ITP 34

Quantifiers

Back to Beer

We end by determining the ldquocorrectrdquo formulation for the beer exampleLetrsquos formalize the statement

All American beer tastes dreadful

We introduce the following notationB the set of all beers

A(x) the statement ldquox is AmericanrdquoD(x) the statement ldquox tastes dreadfulrdquo

Then we get(forallx isin B) [A(x)rArr D(x)]

ieFor all beers if the beer is American then it tastes dreadful

fasshaueriitedu MATH 100 ndash ITP 35

Quantifiers

Now we need to negate

(forallx isin B) [A(x)rArr D(x)]

According to our earlier discussion we have

(existx isin B)not [A(x)rArr D(x)]

which using the fact that not [φrArr ψ] is equivalent to φ and (notψ) yields

(existx isin B) [A(x) and (notD(x))]

In wordsThere exists a beer which is American and does not tastedreadful

fasshaueriitedu MATH 100 ndash ITP 36

Appendix References

References I

Devlin Keith JSet Functions and Logic (3rd Ed)Chapman amp HallCRC 2004

Moler CleveExperiments with MATLABhttpwwwmathworkscommolerexmchaptershtml

fasshaueriitedu MATH 100 ndash ITP 37

  • ``Thats Logic
  • Logical Connectives
  • Conditionals and Biconditionals
  • Truth Tables
  • Looking Ahead Toward Proofs
  • Quantifiers
  • Appendix
Page 16: MATH 100 – Introduction to the Profession - Logic

Conditionals and Biconditionals

Biconditional for logical equivalence if and only ifMathematical notation hArrharrDoes not make sense in MATLAB (only in SymbolicToolbox)Example (in Mathematica)Equivalent[3ltPi 4gtPi]

Truth table httpwwwwolframalphacominputi=P+Equivalent+Q

fasshaueriitedu MATH 100 ndash ITP 16

Truth Tables

Further insights via truth tables

Example

Prove not(φ and ψ) is equivalent to (notφ) or (notψ)

φ ψ φ and ψ not(φ and ψ)T T T FT F F TF T F TF F F T

φ ψ notφ notψ (notφ) or (notψ)T T F F FT F F T TF T T F TF F T T T

fasshaueriitedu MATH 100 ndash ITP 17

Truth Tables

Example (Exercise 229(a) in [Devlin])

Prove not(φrArr ψ) is equivalent to φ and (notψ)

φ ψ φrArr ψ not(φrArr ψ)

T T T FT F F TF T T FF F T F

φ ψ φ and (notψ)T T FT F TF T FF F F

How can we then interpret φrArr ψ in terms of and or and not (notφ) or ψ

fasshaueriitedu MATH 100 ndash ITP 18

Truth Tables

Example (Wason Selection Task Exercise 2220 in [Devlin])

Assuming each card has a letter on one face and a numberon the other which card(s) do you have to turn over in orderto test the truth of the proposition that if a card has a vowel onone face then its opposite shows an even numbera

Answer Cards ldquoErdquo and ldquo7rdquo

Checking the other side of ldquoErdquo is obvious (we need an even number toshow for the proposition to hold)It doesnrsquot matter whatrsquos on the other side of ldquoKrdquo (the proposition makesno claim about cards with a consonant)Nor does it matter whatrsquos on the other side of ldquo4rdquo (if itrsquos a vowel great ifitrsquos a consonant no rule was violated either)We need to check ldquo7rdquo (if a vowel shows up the proposition is false)

aOnly about 10 of the population get this rightfasshaueriitedu MATH 100 ndash ITP 19

Looking Ahead Toward Proofs

When we do a mathematical proof then we need to decide whether acertain mathematical statement is logically true or not

The direct approach (known as modus ponens ie method byaffirmation) is to conclude

If φ and (φrArr ψ) then ψ

Example

Show that if n is an even integer then (minus1)n = 1

Proofn is an arbitrary even integer so n = 2k for some integer k But then

(minus1)n = (minus1)2k =((minus1)2︸ ︷︷ ︸

=1

)k= 1k = 1

fasshaueriitedu MATH 100 ndash ITP 20

Looking Ahead Toward Proofs

Contrapositive

Sometimes it is difficult to prove an implication directly In this case wecan try to show that the contrapositive of the conditional holds ie weuse (see HW 2211)

φrArr ψ is equivalent to (notψ)rArr (notφ)

and conclude (modus tollens method by denial)

If φ and ((notψ)rArr (notφ)) then ψ

Note that this has nothing to do with proof by contradiction (more onthat later)

Example

Conditional If you average 85 or above then you will get an AContrapositive If you donrsquotdidnrsquot get an A then you donrsquotdidnrsquot average85 or above

fasshaueriitedu MATH 100 ndash ITP 21

Looking Ahead Toward Proofs

Converse

Do not confuse the contrapositive of a conditional with its converse

If φrArr ψ then its converse is ψ rArr φ

There is no logical connection between a conditional and its converse

The only link is that if both are true then the biconditional holds ie

(φrArr ψ) and (ψ rArr φ) is equivalent to (φhArr ψ)

Example

Conditional If you average 85 or above then you will get an AContrapositive If you donrsquotdidnrsquot get an A then you donrsquotdidnrsquot average85 or aboveConverse If you getgot an A then you averageaveraged 85 or above

Note The converse assures us that scoring 85 or above isnecessary for an A (not so good for you _)

fasshaueriitedu MATH 100 ndash ITP 22

Looking Ahead Toward Proofs

Also do not confuse a statement with itsconverse

More Lewis CarrolllsquoNot the same thing a bitrsquo saidthe Hatter lsquoYou might just as wellsay that ldquoI see what I eatrdquo is thesame thing as ldquoI eat what I seerdquorsquo

From ldquoAlice in Wonderlandrdquo by Lewis Carroll (seehttpwwwonline-literaturecomcarrollalice7 forthe complete Chapter 7 A Mad Tea Party)

fasshaueriitedu MATH 100 ndash ITP 23

Looking Ahead Toward Proofs

Inverse

One could also consider the contrapositive of the converse5 of aconditional also known as the inverse of the conditional

Example

Conditional If you average 85 or above then you will get an AContrapositive If you donrsquotdidnrsquot get an A then you donrsquotdidnrsquot average85 or aboveConverse If you getgot an A then you averageaveraged 85 or aboveInverse If you donrsquot average 85 or above then you wonrsquot get an A

Note The inverse (which is equivalent to the converse) perhaps showseven better that scoring 85 or above is necessary for an A

5Or equivalently the converse of the contrapositivefasshaueriitedu MATH 100 ndash ITP 24

Looking Ahead Toward Proofs

Negated Conditional

You also might be tempted to confuse the contrapositive of aconditional with its negation As we showed earlier the negation of aconditional

not(φrArr ψ) is equivalent to φ and (notψ)

which is different from the contrapositive of φrArr ψ

(notψ)rArr (notφ)

The latter would be equivalent to (verify this)

(notφ) or ψ

fasshaueriitedu MATH 100 ndash ITP 25

Looking Ahead Toward Proofs

We just said that the negated conditional is

φ and (notψ)

Example

Conditional If you average 85 or above then you will get an AContrapositive If you donrsquotdidnrsquot get an A then you donrsquotdidnrsquot average85 or aboveConverse If you getgot an A then you averageaveraged 85 or aboveInverse If you donrsquot average 85 or above then you wonrsquot get an ANegated conditional You average 85 or above and you wonrsquot get an A

Note The negated conditional is only true if the conditional is falseie in the case when I break my promise

fasshaueriitedu MATH 100 ndash ITP 26

Looking Ahead Toward Proofs

The perverse cube of reversed implications

notφrArr notψφornotψ

larrrarr notψ rArr notφψornotφ

l lφrArr ψnotφorψ

larrrarr ψ rArr φnotψorφ

l Negation l

not (notφrArr notψ)notφandψ

middot middot middot not (notψ rArr notφ)notψandφ

l lnot (φrArr ψ)

φandnotψmiddot middot middot not (ψ rArr φ)

ψandnotφ

Create the truth tables for all these statements to verify their relations

fasshaueriitedu MATH 100 ndash ITP 27

Quantifiers

ldquoFor allrdquo and ldquothere existsrdquo

Universal quantifier forallx ldquofor all x it is the case that rdquoExistential quantifier existx ldquothere exists an x such that rdquo

Example (in Mathematica ndash quantifiers donrsquot exist in MATLAB)ForAll[x Element[xReals] x^2 + 2 x + c gt 0]Reduce[ c] ( find c st the statement is T )

In words For what values of c is the inequality x2 + 2x + c gt 0 true forall values of x

Example (in Mathematica)Exists[x x^2 + 2 x + c == 0 ampamp x gt 0]Reduce[ c Reals] (consider only real numbers)

In words For what values of c does the equation x2 + 2x + c = 0 havea positive solution x When does a positive solution exista

aExistence (and uniqueness) of a solution are fundamental issues in math

fasshaueriitedu MATH 100 ndash ITP 28

Quantifiers

We can also nicely visualize whatrsquos going on in Mathematica

Manipulate[Plot[x^2 + 2 x + c x -5 5PlotRange -gt -6 10] c -5 5]

This shows thatfor c le 0 there is an intersection with the positive x-axis so apositive solution to the equation x2 + 2x + c = 0 existsfor c gt 0 the parabola does not intersect the positive x-axis sothe equation x2 + 2x + c = 0 is false for positive values of x for c gt 1 the parabola does not intersect the x-axis at all so theinequality x2 + 2x + c gt 0 is true for all values of x (but theequation x2 + 2x + c = 0 is false)

RemarkWe could also use a restricted domain for the existence example ie

Exists[x xgt0 x^2 + 2 x + c == 0]Reduce[ c Reals] (consider only real numbers)

fasshaueriitedu MATH 100 ndash ITP 29

Quantifiers

Example (Comparing the use of exist and forall in common language)

Consider the two statementsEverybody likes at least one drink namely water(one drink liked by everybody)Everybody likes at least one drink I myself go for beer(everybody likes some drink)

How can we formalize these two statements using quantifiers

There exists a drink D such that for every person P P likes D

(existD) (forallP) [P likes D]

For every person P there exists a drink D such that P likes D

(forallP) (existD) [P likes D]

The order of quantifiers matters What about the other two casesfasshaueriitedu MATH 100 ndash ITP 30

Quantifiers

A mathematical example

Let P be the set of prime numbers and N the set of natural numbersThen

(foralln isin N) (existm isin N) [(m gt n) and (m isin P)]

says that there are infinitely many primes

Actually it says that

For whatever natural number n we pickwe can find another natural number mthat is both larger than n and a prime number

The statement m isin P (or ldquom is a prime numberrdquo) can be formalized as

(forallab isin N) [(ab = m)rArr ((a = 1) or (b = 1))]

fasshaueriitedu MATH 100 ndash ITP 31

Quantifiers

Negation of Universal Statements

Earlier we used the example (in Mathematica)

(forallx isin R)[x2 + 2x + c gt 0

]Letrsquos assume it is true ie

For all x the inequality x2 + 2x + c gt 0 is true

What if we want to negate this statement We get

not[(forallx isin R)

[x2 + 2x + c gt 0

]]Not[ForAll[x Element[xReals] x^2 + 2 x + c gt 0]]Reduce[ c] ( find c st the statement is T )

What does the statement mean (Mathematica resolved it)

There exists some x for which the inequality is not trueNote that the values of c found by Mathematica are complementary tothose for which the original statement was true

fasshaueriitedu MATH 100 ndash ITP 32

Quantifiers

Negation of Existential StatementsLetrsquos use our second earlier example

(existx isin R)[(x2 + 2x + c = 0) and (x gt 0)

]Letrsquos assume it is true ie

There exists an x such that the equation x2 + 2x + c = 0 istrue and x gt 0

What if we want to negate this statement We get

not[(existx isin R)

[(x2 + 2x + c = 0) and (x gt 0)

]]Not[Exists[x x^2 + 2 x + c == 0 ampamp x gt 0]]Reduce[ c Reals] (consider only real numbers)

What does the statement meanFor all x the equation is not true or x le 0

Again the values of c found by Mathematica are complementary tothose for which the original statement was true

fasshaueriitedu MATH 100 ndash ITP 33

Quantifiers

Using a restricted domain things are a little simpler

(existx isin R+)[x2 + 2x + c = 0

]Letrsquos assume it is true ie

There exists a positive x the equation x2 + 2x + c = 0 is true

What if we want to negate this statement We get

not[(existx isin R+)

[x2 + 2x + c = 0

]]Not[Exists[x x gt 0 x^2 + 2 x + c == 0]]Reduce[ c Reals] (consider only real numbers)

What does the statement meanFor all positive x the equation is not true

Again the values of c found by Mathematica are complementary tothose for which the original statement was true

fasshaueriitedu MATH 100 ndash ITP 34

Quantifiers

Back to Beer

We end by determining the ldquocorrectrdquo formulation for the beer exampleLetrsquos formalize the statement

All American beer tastes dreadful

We introduce the following notationB the set of all beers

A(x) the statement ldquox is AmericanrdquoD(x) the statement ldquox tastes dreadfulrdquo

Then we get(forallx isin B) [A(x)rArr D(x)]

ieFor all beers if the beer is American then it tastes dreadful

fasshaueriitedu MATH 100 ndash ITP 35

Quantifiers

Now we need to negate

(forallx isin B) [A(x)rArr D(x)]

According to our earlier discussion we have

(existx isin B)not [A(x)rArr D(x)]

which using the fact that not [φrArr ψ] is equivalent to φ and (notψ) yields

(existx isin B) [A(x) and (notD(x))]

In wordsThere exists a beer which is American and does not tastedreadful

fasshaueriitedu MATH 100 ndash ITP 36

Appendix References

References I

Devlin Keith JSet Functions and Logic (3rd Ed)Chapman amp HallCRC 2004

Moler CleveExperiments with MATLABhttpwwwmathworkscommolerexmchaptershtml

fasshaueriitedu MATH 100 ndash ITP 37

  • ``Thats Logic
  • Logical Connectives
  • Conditionals and Biconditionals
  • Truth Tables
  • Looking Ahead Toward Proofs
  • Quantifiers
  • Appendix
Page 17: MATH 100 – Introduction to the Profession - Logic

Truth Tables

Further insights via truth tables

Example

Prove not(φ and ψ) is equivalent to (notφ) or (notψ)

φ ψ φ and ψ not(φ and ψ)T T T FT F F TF T F TF F F T

φ ψ notφ notψ (notφ) or (notψ)T T F F FT F F T TF T T F TF F T T T

fasshaueriitedu MATH 100 ndash ITP 17

Truth Tables

Example (Exercise 229(a) in [Devlin])

Prove not(φrArr ψ) is equivalent to φ and (notψ)

φ ψ φrArr ψ not(φrArr ψ)

T T T FT F F TF T T FF F T F

φ ψ φ and (notψ)T T FT F TF T FF F F

How can we then interpret φrArr ψ in terms of and or and not (notφ) or ψ

fasshaueriitedu MATH 100 ndash ITP 18

Truth Tables

Example (Wason Selection Task Exercise 2220 in [Devlin])

Assuming each card has a letter on one face and a numberon the other which card(s) do you have to turn over in orderto test the truth of the proposition that if a card has a vowel onone face then its opposite shows an even numbera

Answer Cards ldquoErdquo and ldquo7rdquo

Checking the other side of ldquoErdquo is obvious (we need an even number toshow for the proposition to hold)It doesnrsquot matter whatrsquos on the other side of ldquoKrdquo (the proposition makesno claim about cards with a consonant)Nor does it matter whatrsquos on the other side of ldquo4rdquo (if itrsquos a vowel great ifitrsquos a consonant no rule was violated either)We need to check ldquo7rdquo (if a vowel shows up the proposition is false)

aOnly about 10 of the population get this rightfasshaueriitedu MATH 100 ndash ITP 19

Looking Ahead Toward Proofs

When we do a mathematical proof then we need to decide whether acertain mathematical statement is logically true or not

The direct approach (known as modus ponens ie method byaffirmation) is to conclude

If φ and (φrArr ψ) then ψ

Example

Show that if n is an even integer then (minus1)n = 1

Proofn is an arbitrary even integer so n = 2k for some integer k But then

(minus1)n = (minus1)2k =((minus1)2︸ ︷︷ ︸

=1

)k= 1k = 1

fasshaueriitedu MATH 100 ndash ITP 20

Looking Ahead Toward Proofs

Contrapositive

Sometimes it is difficult to prove an implication directly In this case wecan try to show that the contrapositive of the conditional holds ie weuse (see HW 2211)

φrArr ψ is equivalent to (notψ)rArr (notφ)

and conclude (modus tollens method by denial)

If φ and ((notψ)rArr (notφ)) then ψ

Note that this has nothing to do with proof by contradiction (more onthat later)

Example

Conditional If you average 85 or above then you will get an AContrapositive If you donrsquotdidnrsquot get an A then you donrsquotdidnrsquot average85 or above

fasshaueriitedu MATH 100 ndash ITP 21

Looking Ahead Toward Proofs

Converse

Do not confuse the contrapositive of a conditional with its converse

If φrArr ψ then its converse is ψ rArr φ

There is no logical connection between a conditional and its converse

The only link is that if both are true then the biconditional holds ie

(φrArr ψ) and (ψ rArr φ) is equivalent to (φhArr ψ)

Example

Conditional If you average 85 or above then you will get an AContrapositive If you donrsquotdidnrsquot get an A then you donrsquotdidnrsquot average85 or aboveConverse If you getgot an A then you averageaveraged 85 or above

Note The converse assures us that scoring 85 or above isnecessary for an A (not so good for you _)

fasshaueriitedu MATH 100 ndash ITP 22

Looking Ahead Toward Proofs

Also do not confuse a statement with itsconverse

More Lewis CarrolllsquoNot the same thing a bitrsquo saidthe Hatter lsquoYou might just as wellsay that ldquoI see what I eatrdquo is thesame thing as ldquoI eat what I seerdquorsquo

From ldquoAlice in Wonderlandrdquo by Lewis Carroll (seehttpwwwonline-literaturecomcarrollalice7 forthe complete Chapter 7 A Mad Tea Party)

fasshaueriitedu MATH 100 ndash ITP 23

Looking Ahead Toward Proofs

Inverse

One could also consider the contrapositive of the converse5 of aconditional also known as the inverse of the conditional

Example

Conditional If you average 85 or above then you will get an AContrapositive If you donrsquotdidnrsquot get an A then you donrsquotdidnrsquot average85 or aboveConverse If you getgot an A then you averageaveraged 85 or aboveInverse If you donrsquot average 85 or above then you wonrsquot get an A

Note The inverse (which is equivalent to the converse) perhaps showseven better that scoring 85 or above is necessary for an A

5Or equivalently the converse of the contrapositivefasshaueriitedu MATH 100 ndash ITP 24

Looking Ahead Toward Proofs

Negated Conditional

You also might be tempted to confuse the contrapositive of aconditional with its negation As we showed earlier the negation of aconditional

not(φrArr ψ) is equivalent to φ and (notψ)

which is different from the contrapositive of φrArr ψ

(notψ)rArr (notφ)

The latter would be equivalent to (verify this)

(notφ) or ψ

fasshaueriitedu MATH 100 ndash ITP 25

Looking Ahead Toward Proofs

We just said that the negated conditional is

φ and (notψ)

Example

Conditional If you average 85 or above then you will get an AContrapositive If you donrsquotdidnrsquot get an A then you donrsquotdidnrsquot average85 or aboveConverse If you getgot an A then you averageaveraged 85 or aboveInverse If you donrsquot average 85 or above then you wonrsquot get an ANegated conditional You average 85 or above and you wonrsquot get an A

Note The negated conditional is only true if the conditional is falseie in the case when I break my promise

fasshaueriitedu MATH 100 ndash ITP 26

Looking Ahead Toward Proofs

The perverse cube of reversed implications

notφrArr notψφornotψ

larrrarr notψ rArr notφψornotφ

l lφrArr ψnotφorψ

larrrarr ψ rArr φnotψorφ

l Negation l

not (notφrArr notψ)notφandψ

middot middot middot not (notψ rArr notφ)notψandφ

l lnot (φrArr ψ)

φandnotψmiddot middot middot not (ψ rArr φ)

ψandnotφ

Create the truth tables for all these statements to verify their relations

fasshaueriitedu MATH 100 ndash ITP 27

Quantifiers

ldquoFor allrdquo and ldquothere existsrdquo

Universal quantifier forallx ldquofor all x it is the case that rdquoExistential quantifier existx ldquothere exists an x such that rdquo

Example (in Mathematica ndash quantifiers donrsquot exist in MATLAB)ForAll[x Element[xReals] x^2 + 2 x + c gt 0]Reduce[ c] ( find c st the statement is T )

In words For what values of c is the inequality x2 + 2x + c gt 0 true forall values of x

Example (in Mathematica)Exists[x x^2 + 2 x + c == 0 ampamp x gt 0]Reduce[ c Reals] (consider only real numbers)

In words For what values of c does the equation x2 + 2x + c = 0 havea positive solution x When does a positive solution exista

aExistence (and uniqueness) of a solution are fundamental issues in math

fasshaueriitedu MATH 100 ndash ITP 28

Quantifiers

We can also nicely visualize whatrsquos going on in Mathematica

Manipulate[Plot[x^2 + 2 x + c x -5 5PlotRange -gt -6 10] c -5 5]

This shows thatfor c le 0 there is an intersection with the positive x-axis so apositive solution to the equation x2 + 2x + c = 0 existsfor c gt 0 the parabola does not intersect the positive x-axis sothe equation x2 + 2x + c = 0 is false for positive values of x for c gt 1 the parabola does not intersect the x-axis at all so theinequality x2 + 2x + c gt 0 is true for all values of x (but theequation x2 + 2x + c = 0 is false)

RemarkWe could also use a restricted domain for the existence example ie

Exists[x xgt0 x^2 + 2 x + c == 0]Reduce[ c Reals] (consider only real numbers)

fasshaueriitedu MATH 100 ndash ITP 29

Quantifiers

Example (Comparing the use of exist and forall in common language)

Consider the two statementsEverybody likes at least one drink namely water(one drink liked by everybody)Everybody likes at least one drink I myself go for beer(everybody likes some drink)

How can we formalize these two statements using quantifiers

There exists a drink D such that for every person P P likes D

(existD) (forallP) [P likes D]

For every person P there exists a drink D such that P likes D

(forallP) (existD) [P likes D]

The order of quantifiers matters What about the other two casesfasshaueriitedu MATH 100 ndash ITP 30

Quantifiers

A mathematical example

Let P be the set of prime numbers and N the set of natural numbersThen

(foralln isin N) (existm isin N) [(m gt n) and (m isin P)]

says that there are infinitely many primes

Actually it says that

For whatever natural number n we pickwe can find another natural number mthat is both larger than n and a prime number

The statement m isin P (or ldquom is a prime numberrdquo) can be formalized as

(forallab isin N) [(ab = m)rArr ((a = 1) or (b = 1))]

fasshaueriitedu MATH 100 ndash ITP 31

Quantifiers

Negation of Universal Statements

Earlier we used the example (in Mathematica)

(forallx isin R)[x2 + 2x + c gt 0

]Letrsquos assume it is true ie

For all x the inequality x2 + 2x + c gt 0 is true

What if we want to negate this statement We get

not[(forallx isin R)

[x2 + 2x + c gt 0

]]Not[ForAll[x Element[xReals] x^2 + 2 x + c gt 0]]Reduce[ c] ( find c st the statement is T )

What does the statement mean (Mathematica resolved it)

There exists some x for which the inequality is not trueNote that the values of c found by Mathematica are complementary tothose for which the original statement was true

fasshaueriitedu MATH 100 ndash ITP 32

Quantifiers

Negation of Existential StatementsLetrsquos use our second earlier example

(existx isin R)[(x2 + 2x + c = 0) and (x gt 0)

]Letrsquos assume it is true ie

There exists an x such that the equation x2 + 2x + c = 0 istrue and x gt 0

What if we want to negate this statement We get

not[(existx isin R)

[(x2 + 2x + c = 0) and (x gt 0)

]]Not[Exists[x x^2 + 2 x + c == 0 ampamp x gt 0]]Reduce[ c Reals] (consider only real numbers)

What does the statement meanFor all x the equation is not true or x le 0

Again the values of c found by Mathematica are complementary tothose for which the original statement was true

fasshaueriitedu MATH 100 ndash ITP 33

Quantifiers

Using a restricted domain things are a little simpler

(existx isin R+)[x2 + 2x + c = 0

]Letrsquos assume it is true ie

There exists a positive x the equation x2 + 2x + c = 0 is true

What if we want to negate this statement We get

not[(existx isin R+)

[x2 + 2x + c = 0

]]Not[Exists[x x gt 0 x^2 + 2 x + c == 0]]Reduce[ c Reals] (consider only real numbers)

What does the statement meanFor all positive x the equation is not true

Again the values of c found by Mathematica are complementary tothose for which the original statement was true

fasshaueriitedu MATH 100 ndash ITP 34

Quantifiers

Back to Beer

We end by determining the ldquocorrectrdquo formulation for the beer exampleLetrsquos formalize the statement

All American beer tastes dreadful

We introduce the following notationB the set of all beers

A(x) the statement ldquox is AmericanrdquoD(x) the statement ldquox tastes dreadfulrdquo

Then we get(forallx isin B) [A(x)rArr D(x)]

ieFor all beers if the beer is American then it tastes dreadful

fasshaueriitedu MATH 100 ndash ITP 35

Quantifiers

Now we need to negate

(forallx isin B) [A(x)rArr D(x)]

According to our earlier discussion we have

(existx isin B)not [A(x)rArr D(x)]

which using the fact that not [φrArr ψ] is equivalent to φ and (notψ) yields

(existx isin B) [A(x) and (notD(x))]

In wordsThere exists a beer which is American and does not tastedreadful

fasshaueriitedu MATH 100 ndash ITP 36

Appendix References

References I

Devlin Keith JSet Functions and Logic (3rd Ed)Chapman amp HallCRC 2004

Moler CleveExperiments with MATLABhttpwwwmathworkscommolerexmchaptershtml

fasshaueriitedu MATH 100 ndash ITP 37

  • ``Thats Logic
  • Logical Connectives
  • Conditionals and Biconditionals
  • Truth Tables
  • Looking Ahead Toward Proofs
  • Quantifiers
  • Appendix
Page 18: MATH 100 – Introduction to the Profession - Logic

Truth Tables

Example (Exercise 229(a) in [Devlin])

Prove not(φrArr ψ) is equivalent to φ and (notψ)

φ ψ φrArr ψ not(φrArr ψ)

T T T FT F F TF T T FF F T F

φ ψ φ and (notψ)T T FT F TF T FF F F

How can we then interpret φrArr ψ in terms of and or and not (notφ) or ψ

fasshaueriitedu MATH 100 ndash ITP 18

Truth Tables

Example (Wason Selection Task Exercise 2220 in [Devlin])

Assuming each card has a letter on one face and a numberon the other which card(s) do you have to turn over in orderto test the truth of the proposition that if a card has a vowel onone face then its opposite shows an even numbera

Answer Cards ldquoErdquo and ldquo7rdquo

Checking the other side of ldquoErdquo is obvious (we need an even number toshow for the proposition to hold)It doesnrsquot matter whatrsquos on the other side of ldquoKrdquo (the proposition makesno claim about cards with a consonant)Nor does it matter whatrsquos on the other side of ldquo4rdquo (if itrsquos a vowel great ifitrsquos a consonant no rule was violated either)We need to check ldquo7rdquo (if a vowel shows up the proposition is false)

aOnly about 10 of the population get this rightfasshaueriitedu MATH 100 ndash ITP 19

Looking Ahead Toward Proofs

When we do a mathematical proof then we need to decide whether acertain mathematical statement is logically true or not

The direct approach (known as modus ponens ie method byaffirmation) is to conclude

If φ and (φrArr ψ) then ψ

Example

Show that if n is an even integer then (minus1)n = 1

Proofn is an arbitrary even integer so n = 2k for some integer k But then

(minus1)n = (minus1)2k =((minus1)2︸ ︷︷ ︸

=1

)k= 1k = 1

fasshaueriitedu MATH 100 ndash ITP 20

Looking Ahead Toward Proofs

Contrapositive

Sometimes it is difficult to prove an implication directly In this case wecan try to show that the contrapositive of the conditional holds ie weuse (see HW 2211)

φrArr ψ is equivalent to (notψ)rArr (notφ)

and conclude (modus tollens method by denial)

If φ and ((notψ)rArr (notφ)) then ψ

Note that this has nothing to do with proof by contradiction (more onthat later)

Example

Conditional If you average 85 or above then you will get an AContrapositive If you donrsquotdidnrsquot get an A then you donrsquotdidnrsquot average85 or above

fasshaueriitedu MATH 100 ndash ITP 21

Looking Ahead Toward Proofs

Converse

Do not confuse the contrapositive of a conditional with its converse

If φrArr ψ then its converse is ψ rArr φ

There is no logical connection between a conditional and its converse

The only link is that if both are true then the biconditional holds ie

(φrArr ψ) and (ψ rArr φ) is equivalent to (φhArr ψ)

Example

Conditional If you average 85 or above then you will get an AContrapositive If you donrsquotdidnrsquot get an A then you donrsquotdidnrsquot average85 or aboveConverse If you getgot an A then you averageaveraged 85 or above

Note The converse assures us that scoring 85 or above isnecessary for an A (not so good for you _)

fasshaueriitedu MATH 100 ndash ITP 22

Looking Ahead Toward Proofs

Also do not confuse a statement with itsconverse

More Lewis CarrolllsquoNot the same thing a bitrsquo saidthe Hatter lsquoYou might just as wellsay that ldquoI see what I eatrdquo is thesame thing as ldquoI eat what I seerdquorsquo

From ldquoAlice in Wonderlandrdquo by Lewis Carroll (seehttpwwwonline-literaturecomcarrollalice7 forthe complete Chapter 7 A Mad Tea Party)

fasshaueriitedu MATH 100 ndash ITP 23

Looking Ahead Toward Proofs

Inverse

One could also consider the contrapositive of the converse5 of aconditional also known as the inverse of the conditional

Example

Conditional If you average 85 or above then you will get an AContrapositive If you donrsquotdidnrsquot get an A then you donrsquotdidnrsquot average85 or aboveConverse If you getgot an A then you averageaveraged 85 or aboveInverse If you donrsquot average 85 or above then you wonrsquot get an A

Note The inverse (which is equivalent to the converse) perhaps showseven better that scoring 85 or above is necessary for an A

5Or equivalently the converse of the contrapositivefasshaueriitedu MATH 100 ndash ITP 24

Looking Ahead Toward Proofs

Negated Conditional

You also might be tempted to confuse the contrapositive of aconditional with its negation As we showed earlier the negation of aconditional

not(φrArr ψ) is equivalent to φ and (notψ)

which is different from the contrapositive of φrArr ψ

(notψ)rArr (notφ)

The latter would be equivalent to (verify this)

(notφ) or ψ

fasshaueriitedu MATH 100 ndash ITP 25

Looking Ahead Toward Proofs

We just said that the negated conditional is

φ and (notψ)

Example

Conditional If you average 85 or above then you will get an AContrapositive If you donrsquotdidnrsquot get an A then you donrsquotdidnrsquot average85 or aboveConverse If you getgot an A then you averageaveraged 85 or aboveInverse If you donrsquot average 85 or above then you wonrsquot get an ANegated conditional You average 85 or above and you wonrsquot get an A

Note The negated conditional is only true if the conditional is falseie in the case when I break my promise

fasshaueriitedu MATH 100 ndash ITP 26

Looking Ahead Toward Proofs

The perverse cube of reversed implications

notφrArr notψφornotψ

larrrarr notψ rArr notφψornotφ

l lφrArr ψnotφorψ

larrrarr ψ rArr φnotψorφ

l Negation l

not (notφrArr notψ)notφandψ

middot middot middot not (notψ rArr notφ)notψandφ

l lnot (φrArr ψ)

φandnotψmiddot middot middot not (ψ rArr φ)

ψandnotφ

Create the truth tables for all these statements to verify their relations

fasshaueriitedu MATH 100 ndash ITP 27

Quantifiers

ldquoFor allrdquo and ldquothere existsrdquo

Universal quantifier forallx ldquofor all x it is the case that rdquoExistential quantifier existx ldquothere exists an x such that rdquo

Example (in Mathematica ndash quantifiers donrsquot exist in MATLAB)ForAll[x Element[xReals] x^2 + 2 x + c gt 0]Reduce[ c] ( find c st the statement is T )

In words For what values of c is the inequality x2 + 2x + c gt 0 true forall values of x

Example (in Mathematica)Exists[x x^2 + 2 x + c == 0 ampamp x gt 0]Reduce[ c Reals] (consider only real numbers)

In words For what values of c does the equation x2 + 2x + c = 0 havea positive solution x When does a positive solution exista

aExistence (and uniqueness) of a solution are fundamental issues in math

fasshaueriitedu MATH 100 ndash ITP 28

Quantifiers

We can also nicely visualize whatrsquos going on in Mathematica

Manipulate[Plot[x^2 + 2 x + c x -5 5PlotRange -gt -6 10] c -5 5]

This shows thatfor c le 0 there is an intersection with the positive x-axis so apositive solution to the equation x2 + 2x + c = 0 existsfor c gt 0 the parabola does not intersect the positive x-axis sothe equation x2 + 2x + c = 0 is false for positive values of x for c gt 1 the parabola does not intersect the x-axis at all so theinequality x2 + 2x + c gt 0 is true for all values of x (but theequation x2 + 2x + c = 0 is false)

RemarkWe could also use a restricted domain for the existence example ie

Exists[x xgt0 x^2 + 2 x + c == 0]Reduce[ c Reals] (consider only real numbers)

fasshaueriitedu MATH 100 ndash ITP 29

Quantifiers

Example (Comparing the use of exist and forall in common language)

Consider the two statementsEverybody likes at least one drink namely water(one drink liked by everybody)Everybody likes at least one drink I myself go for beer(everybody likes some drink)

How can we formalize these two statements using quantifiers

There exists a drink D such that for every person P P likes D

(existD) (forallP) [P likes D]

For every person P there exists a drink D such that P likes D

(forallP) (existD) [P likes D]

The order of quantifiers matters What about the other two casesfasshaueriitedu MATH 100 ndash ITP 30

Quantifiers

A mathematical example

Let P be the set of prime numbers and N the set of natural numbersThen

(foralln isin N) (existm isin N) [(m gt n) and (m isin P)]

says that there are infinitely many primes

Actually it says that

For whatever natural number n we pickwe can find another natural number mthat is both larger than n and a prime number

The statement m isin P (or ldquom is a prime numberrdquo) can be formalized as

(forallab isin N) [(ab = m)rArr ((a = 1) or (b = 1))]

fasshaueriitedu MATH 100 ndash ITP 31

Quantifiers

Negation of Universal Statements

Earlier we used the example (in Mathematica)

(forallx isin R)[x2 + 2x + c gt 0

]Letrsquos assume it is true ie

For all x the inequality x2 + 2x + c gt 0 is true

What if we want to negate this statement We get

not[(forallx isin R)

[x2 + 2x + c gt 0

]]Not[ForAll[x Element[xReals] x^2 + 2 x + c gt 0]]Reduce[ c] ( find c st the statement is T )

What does the statement mean (Mathematica resolved it)

There exists some x for which the inequality is not trueNote that the values of c found by Mathematica are complementary tothose for which the original statement was true

fasshaueriitedu MATH 100 ndash ITP 32

Quantifiers

Negation of Existential StatementsLetrsquos use our second earlier example

(existx isin R)[(x2 + 2x + c = 0) and (x gt 0)

]Letrsquos assume it is true ie

There exists an x such that the equation x2 + 2x + c = 0 istrue and x gt 0

What if we want to negate this statement We get

not[(existx isin R)

[(x2 + 2x + c = 0) and (x gt 0)

]]Not[Exists[x x^2 + 2 x + c == 0 ampamp x gt 0]]Reduce[ c Reals] (consider only real numbers)

What does the statement meanFor all x the equation is not true or x le 0

Again the values of c found by Mathematica are complementary tothose for which the original statement was true

fasshaueriitedu MATH 100 ndash ITP 33

Quantifiers

Using a restricted domain things are a little simpler

(existx isin R+)[x2 + 2x + c = 0

]Letrsquos assume it is true ie

There exists a positive x the equation x2 + 2x + c = 0 is true

What if we want to negate this statement We get

not[(existx isin R+)

[x2 + 2x + c = 0

]]Not[Exists[x x gt 0 x^2 + 2 x + c == 0]]Reduce[ c Reals] (consider only real numbers)

What does the statement meanFor all positive x the equation is not true

Again the values of c found by Mathematica are complementary tothose for which the original statement was true

fasshaueriitedu MATH 100 ndash ITP 34

Quantifiers

Back to Beer

We end by determining the ldquocorrectrdquo formulation for the beer exampleLetrsquos formalize the statement

All American beer tastes dreadful

We introduce the following notationB the set of all beers

A(x) the statement ldquox is AmericanrdquoD(x) the statement ldquox tastes dreadfulrdquo

Then we get(forallx isin B) [A(x)rArr D(x)]

ieFor all beers if the beer is American then it tastes dreadful

fasshaueriitedu MATH 100 ndash ITP 35

Quantifiers

Now we need to negate

(forallx isin B) [A(x)rArr D(x)]

According to our earlier discussion we have

(existx isin B)not [A(x)rArr D(x)]

which using the fact that not [φrArr ψ] is equivalent to φ and (notψ) yields

(existx isin B) [A(x) and (notD(x))]

In wordsThere exists a beer which is American and does not tastedreadful

fasshaueriitedu MATH 100 ndash ITP 36

Appendix References

References I

Devlin Keith JSet Functions and Logic (3rd Ed)Chapman amp HallCRC 2004

Moler CleveExperiments with MATLABhttpwwwmathworkscommolerexmchaptershtml

fasshaueriitedu MATH 100 ndash ITP 37

  • ``Thats Logic
  • Logical Connectives
  • Conditionals and Biconditionals
  • Truth Tables
  • Looking Ahead Toward Proofs
  • Quantifiers
  • Appendix
Page 19: MATH 100 – Introduction to the Profession - Logic

Truth Tables

Example (Wason Selection Task Exercise 2220 in [Devlin])

Assuming each card has a letter on one face and a numberon the other which card(s) do you have to turn over in orderto test the truth of the proposition that if a card has a vowel onone face then its opposite shows an even numbera

Answer Cards ldquoErdquo and ldquo7rdquo

Checking the other side of ldquoErdquo is obvious (we need an even number toshow for the proposition to hold)It doesnrsquot matter whatrsquos on the other side of ldquoKrdquo (the proposition makesno claim about cards with a consonant)Nor does it matter whatrsquos on the other side of ldquo4rdquo (if itrsquos a vowel great ifitrsquos a consonant no rule was violated either)We need to check ldquo7rdquo (if a vowel shows up the proposition is false)

aOnly about 10 of the population get this rightfasshaueriitedu MATH 100 ndash ITP 19

Looking Ahead Toward Proofs

When we do a mathematical proof then we need to decide whether acertain mathematical statement is logically true or not

The direct approach (known as modus ponens ie method byaffirmation) is to conclude

If φ and (φrArr ψ) then ψ

Example

Show that if n is an even integer then (minus1)n = 1

Proofn is an arbitrary even integer so n = 2k for some integer k But then

(minus1)n = (minus1)2k =((minus1)2︸ ︷︷ ︸

=1

)k= 1k = 1

fasshaueriitedu MATH 100 ndash ITP 20

Looking Ahead Toward Proofs

Contrapositive

Sometimes it is difficult to prove an implication directly In this case wecan try to show that the contrapositive of the conditional holds ie weuse (see HW 2211)

φrArr ψ is equivalent to (notψ)rArr (notφ)

and conclude (modus tollens method by denial)

If φ and ((notψ)rArr (notφ)) then ψ

Note that this has nothing to do with proof by contradiction (more onthat later)

Example

Conditional If you average 85 or above then you will get an AContrapositive If you donrsquotdidnrsquot get an A then you donrsquotdidnrsquot average85 or above

fasshaueriitedu MATH 100 ndash ITP 21

Looking Ahead Toward Proofs

Converse

Do not confuse the contrapositive of a conditional with its converse

If φrArr ψ then its converse is ψ rArr φ

There is no logical connection between a conditional and its converse

The only link is that if both are true then the biconditional holds ie

(φrArr ψ) and (ψ rArr φ) is equivalent to (φhArr ψ)

Example

Conditional If you average 85 or above then you will get an AContrapositive If you donrsquotdidnrsquot get an A then you donrsquotdidnrsquot average85 or aboveConverse If you getgot an A then you averageaveraged 85 or above

Note The converse assures us that scoring 85 or above isnecessary for an A (not so good for you _)

fasshaueriitedu MATH 100 ndash ITP 22

Looking Ahead Toward Proofs

Also do not confuse a statement with itsconverse

More Lewis CarrolllsquoNot the same thing a bitrsquo saidthe Hatter lsquoYou might just as wellsay that ldquoI see what I eatrdquo is thesame thing as ldquoI eat what I seerdquorsquo

From ldquoAlice in Wonderlandrdquo by Lewis Carroll (seehttpwwwonline-literaturecomcarrollalice7 forthe complete Chapter 7 A Mad Tea Party)

fasshaueriitedu MATH 100 ndash ITP 23

Looking Ahead Toward Proofs

Inverse

One could also consider the contrapositive of the converse5 of aconditional also known as the inverse of the conditional

Example

Conditional If you average 85 or above then you will get an AContrapositive If you donrsquotdidnrsquot get an A then you donrsquotdidnrsquot average85 or aboveConverse If you getgot an A then you averageaveraged 85 or aboveInverse If you donrsquot average 85 or above then you wonrsquot get an A

Note The inverse (which is equivalent to the converse) perhaps showseven better that scoring 85 or above is necessary for an A

5Or equivalently the converse of the contrapositivefasshaueriitedu MATH 100 ndash ITP 24

Looking Ahead Toward Proofs

Negated Conditional

You also might be tempted to confuse the contrapositive of aconditional with its negation As we showed earlier the negation of aconditional

not(φrArr ψ) is equivalent to φ and (notψ)

which is different from the contrapositive of φrArr ψ

(notψ)rArr (notφ)

The latter would be equivalent to (verify this)

(notφ) or ψ

fasshaueriitedu MATH 100 ndash ITP 25

Looking Ahead Toward Proofs

We just said that the negated conditional is

φ and (notψ)

Example

Conditional If you average 85 or above then you will get an AContrapositive If you donrsquotdidnrsquot get an A then you donrsquotdidnrsquot average85 or aboveConverse If you getgot an A then you averageaveraged 85 or aboveInverse If you donrsquot average 85 or above then you wonrsquot get an ANegated conditional You average 85 or above and you wonrsquot get an A

Note The negated conditional is only true if the conditional is falseie in the case when I break my promise

fasshaueriitedu MATH 100 ndash ITP 26

Looking Ahead Toward Proofs

The perverse cube of reversed implications

notφrArr notψφornotψ

larrrarr notψ rArr notφψornotφ

l lφrArr ψnotφorψ

larrrarr ψ rArr φnotψorφ

l Negation l

not (notφrArr notψ)notφandψ

middot middot middot not (notψ rArr notφ)notψandφ

l lnot (φrArr ψ)

φandnotψmiddot middot middot not (ψ rArr φ)

ψandnotφ

Create the truth tables for all these statements to verify their relations

fasshaueriitedu MATH 100 ndash ITP 27

Quantifiers

ldquoFor allrdquo and ldquothere existsrdquo

Universal quantifier forallx ldquofor all x it is the case that rdquoExistential quantifier existx ldquothere exists an x such that rdquo

Example (in Mathematica ndash quantifiers donrsquot exist in MATLAB)ForAll[x Element[xReals] x^2 + 2 x + c gt 0]Reduce[ c] ( find c st the statement is T )

In words For what values of c is the inequality x2 + 2x + c gt 0 true forall values of x

Example (in Mathematica)Exists[x x^2 + 2 x + c == 0 ampamp x gt 0]Reduce[ c Reals] (consider only real numbers)

In words For what values of c does the equation x2 + 2x + c = 0 havea positive solution x When does a positive solution exista

aExistence (and uniqueness) of a solution are fundamental issues in math

fasshaueriitedu MATH 100 ndash ITP 28

Quantifiers

We can also nicely visualize whatrsquos going on in Mathematica

Manipulate[Plot[x^2 + 2 x + c x -5 5PlotRange -gt -6 10] c -5 5]

This shows thatfor c le 0 there is an intersection with the positive x-axis so apositive solution to the equation x2 + 2x + c = 0 existsfor c gt 0 the parabola does not intersect the positive x-axis sothe equation x2 + 2x + c = 0 is false for positive values of x for c gt 1 the parabola does not intersect the x-axis at all so theinequality x2 + 2x + c gt 0 is true for all values of x (but theequation x2 + 2x + c = 0 is false)

RemarkWe could also use a restricted domain for the existence example ie

Exists[x xgt0 x^2 + 2 x + c == 0]Reduce[ c Reals] (consider only real numbers)

fasshaueriitedu MATH 100 ndash ITP 29

Quantifiers

Example (Comparing the use of exist and forall in common language)

Consider the two statementsEverybody likes at least one drink namely water(one drink liked by everybody)Everybody likes at least one drink I myself go for beer(everybody likes some drink)

How can we formalize these two statements using quantifiers

There exists a drink D such that for every person P P likes D

(existD) (forallP) [P likes D]

For every person P there exists a drink D such that P likes D

(forallP) (existD) [P likes D]

The order of quantifiers matters What about the other two casesfasshaueriitedu MATH 100 ndash ITP 30

Quantifiers

A mathematical example

Let P be the set of prime numbers and N the set of natural numbersThen

(foralln isin N) (existm isin N) [(m gt n) and (m isin P)]

says that there are infinitely many primes

Actually it says that

For whatever natural number n we pickwe can find another natural number mthat is both larger than n and a prime number

The statement m isin P (or ldquom is a prime numberrdquo) can be formalized as

(forallab isin N) [(ab = m)rArr ((a = 1) or (b = 1))]

fasshaueriitedu MATH 100 ndash ITP 31

Quantifiers

Negation of Universal Statements

Earlier we used the example (in Mathematica)

(forallx isin R)[x2 + 2x + c gt 0

]Letrsquos assume it is true ie

For all x the inequality x2 + 2x + c gt 0 is true

What if we want to negate this statement We get

not[(forallx isin R)

[x2 + 2x + c gt 0

]]Not[ForAll[x Element[xReals] x^2 + 2 x + c gt 0]]Reduce[ c] ( find c st the statement is T )

What does the statement mean (Mathematica resolved it)

There exists some x for which the inequality is not trueNote that the values of c found by Mathematica are complementary tothose for which the original statement was true

fasshaueriitedu MATH 100 ndash ITP 32

Quantifiers

Negation of Existential StatementsLetrsquos use our second earlier example

(existx isin R)[(x2 + 2x + c = 0) and (x gt 0)

]Letrsquos assume it is true ie

There exists an x such that the equation x2 + 2x + c = 0 istrue and x gt 0

What if we want to negate this statement We get

not[(existx isin R)

[(x2 + 2x + c = 0) and (x gt 0)

]]Not[Exists[x x^2 + 2 x + c == 0 ampamp x gt 0]]Reduce[ c Reals] (consider only real numbers)

What does the statement meanFor all x the equation is not true or x le 0

Again the values of c found by Mathematica are complementary tothose for which the original statement was true

fasshaueriitedu MATH 100 ndash ITP 33

Quantifiers

Using a restricted domain things are a little simpler

(existx isin R+)[x2 + 2x + c = 0

]Letrsquos assume it is true ie

There exists a positive x the equation x2 + 2x + c = 0 is true

What if we want to negate this statement We get

not[(existx isin R+)

[x2 + 2x + c = 0

]]Not[Exists[x x gt 0 x^2 + 2 x + c == 0]]Reduce[ c Reals] (consider only real numbers)

What does the statement meanFor all positive x the equation is not true

Again the values of c found by Mathematica are complementary tothose for which the original statement was true

fasshaueriitedu MATH 100 ndash ITP 34

Quantifiers

Back to Beer

We end by determining the ldquocorrectrdquo formulation for the beer exampleLetrsquos formalize the statement

All American beer tastes dreadful

We introduce the following notationB the set of all beers

A(x) the statement ldquox is AmericanrdquoD(x) the statement ldquox tastes dreadfulrdquo

Then we get(forallx isin B) [A(x)rArr D(x)]

ieFor all beers if the beer is American then it tastes dreadful

fasshaueriitedu MATH 100 ndash ITP 35

Quantifiers

Now we need to negate

(forallx isin B) [A(x)rArr D(x)]

According to our earlier discussion we have

(existx isin B)not [A(x)rArr D(x)]

which using the fact that not [φrArr ψ] is equivalent to φ and (notψ) yields

(existx isin B) [A(x) and (notD(x))]

In wordsThere exists a beer which is American and does not tastedreadful

fasshaueriitedu MATH 100 ndash ITP 36

Appendix References

References I

Devlin Keith JSet Functions and Logic (3rd Ed)Chapman amp HallCRC 2004

Moler CleveExperiments with MATLABhttpwwwmathworkscommolerexmchaptershtml

fasshaueriitedu MATH 100 ndash ITP 37

  • ``Thats Logic
  • Logical Connectives
  • Conditionals and Biconditionals
  • Truth Tables
  • Looking Ahead Toward Proofs
  • Quantifiers
  • Appendix
Page 20: MATH 100 – Introduction to the Profession - Logic

Looking Ahead Toward Proofs

When we do a mathematical proof then we need to decide whether acertain mathematical statement is logically true or not

The direct approach (known as modus ponens ie method byaffirmation) is to conclude

If φ and (φrArr ψ) then ψ

Example

Show that if n is an even integer then (minus1)n = 1

Proofn is an arbitrary even integer so n = 2k for some integer k But then

(minus1)n = (minus1)2k =((minus1)2︸ ︷︷ ︸

=1

)k= 1k = 1

fasshaueriitedu MATH 100 ndash ITP 20

Looking Ahead Toward Proofs

Contrapositive

Sometimes it is difficult to prove an implication directly In this case wecan try to show that the contrapositive of the conditional holds ie weuse (see HW 2211)

φrArr ψ is equivalent to (notψ)rArr (notφ)

and conclude (modus tollens method by denial)

If φ and ((notψ)rArr (notφ)) then ψ

Note that this has nothing to do with proof by contradiction (more onthat later)

Example

Conditional If you average 85 or above then you will get an AContrapositive If you donrsquotdidnrsquot get an A then you donrsquotdidnrsquot average85 or above

fasshaueriitedu MATH 100 ndash ITP 21

Looking Ahead Toward Proofs

Converse

Do not confuse the contrapositive of a conditional with its converse

If φrArr ψ then its converse is ψ rArr φ

There is no logical connection between a conditional and its converse

The only link is that if both are true then the biconditional holds ie

(φrArr ψ) and (ψ rArr φ) is equivalent to (φhArr ψ)

Example

Conditional If you average 85 or above then you will get an AContrapositive If you donrsquotdidnrsquot get an A then you donrsquotdidnrsquot average85 or aboveConverse If you getgot an A then you averageaveraged 85 or above

Note The converse assures us that scoring 85 or above isnecessary for an A (not so good for you _)

fasshaueriitedu MATH 100 ndash ITP 22

Looking Ahead Toward Proofs

Also do not confuse a statement with itsconverse

More Lewis CarrolllsquoNot the same thing a bitrsquo saidthe Hatter lsquoYou might just as wellsay that ldquoI see what I eatrdquo is thesame thing as ldquoI eat what I seerdquorsquo

From ldquoAlice in Wonderlandrdquo by Lewis Carroll (seehttpwwwonline-literaturecomcarrollalice7 forthe complete Chapter 7 A Mad Tea Party)

fasshaueriitedu MATH 100 ndash ITP 23

Looking Ahead Toward Proofs

Inverse

One could also consider the contrapositive of the converse5 of aconditional also known as the inverse of the conditional

Example

Conditional If you average 85 or above then you will get an AContrapositive If you donrsquotdidnrsquot get an A then you donrsquotdidnrsquot average85 or aboveConverse If you getgot an A then you averageaveraged 85 or aboveInverse If you donrsquot average 85 or above then you wonrsquot get an A

Note The inverse (which is equivalent to the converse) perhaps showseven better that scoring 85 or above is necessary for an A

5Or equivalently the converse of the contrapositivefasshaueriitedu MATH 100 ndash ITP 24

Looking Ahead Toward Proofs

Negated Conditional

You also might be tempted to confuse the contrapositive of aconditional with its negation As we showed earlier the negation of aconditional

not(φrArr ψ) is equivalent to φ and (notψ)

which is different from the contrapositive of φrArr ψ

(notψ)rArr (notφ)

The latter would be equivalent to (verify this)

(notφ) or ψ

fasshaueriitedu MATH 100 ndash ITP 25

Looking Ahead Toward Proofs

We just said that the negated conditional is

φ and (notψ)

Example

Conditional If you average 85 or above then you will get an AContrapositive If you donrsquotdidnrsquot get an A then you donrsquotdidnrsquot average85 or aboveConverse If you getgot an A then you averageaveraged 85 or aboveInverse If you donrsquot average 85 or above then you wonrsquot get an ANegated conditional You average 85 or above and you wonrsquot get an A

Note The negated conditional is only true if the conditional is falseie in the case when I break my promise

fasshaueriitedu MATH 100 ndash ITP 26

Looking Ahead Toward Proofs

The perverse cube of reversed implications

notφrArr notψφornotψ

larrrarr notψ rArr notφψornotφ

l lφrArr ψnotφorψ

larrrarr ψ rArr φnotψorφ

l Negation l

not (notφrArr notψ)notφandψ

middot middot middot not (notψ rArr notφ)notψandφ

l lnot (φrArr ψ)

φandnotψmiddot middot middot not (ψ rArr φ)

ψandnotφ

Create the truth tables for all these statements to verify their relations

fasshaueriitedu MATH 100 ndash ITP 27

Quantifiers

ldquoFor allrdquo and ldquothere existsrdquo

Universal quantifier forallx ldquofor all x it is the case that rdquoExistential quantifier existx ldquothere exists an x such that rdquo

Example (in Mathematica ndash quantifiers donrsquot exist in MATLAB)ForAll[x Element[xReals] x^2 + 2 x + c gt 0]Reduce[ c] ( find c st the statement is T )

In words For what values of c is the inequality x2 + 2x + c gt 0 true forall values of x

Example (in Mathematica)Exists[x x^2 + 2 x + c == 0 ampamp x gt 0]Reduce[ c Reals] (consider only real numbers)

In words For what values of c does the equation x2 + 2x + c = 0 havea positive solution x When does a positive solution exista

aExistence (and uniqueness) of a solution are fundamental issues in math

fasshaueriitedu MATH 100 ndash ITP 28

Quantifiers

We can also nicely visualize whatrsquos going on in Mathematica

Manipulate[Plot[x^2 + 2 x + c x -5 5PlotRange -gt -6 10] c -5 5]

This shows thatfor c le 0 there is an intersection with the positive x-axis so apositive solution to the equation x2 + 2x + c = 0 existsfor c gt 0 the parabola does not intersect the positive x-axis sothe equation x2 + 2x + c = 0 is false for positive values of x for c gt 1 the parabola does not intersect the x-axis at all so theinequality x2 + 2x + c gt 0 is true for all values of x (but theequation x2 + 2x + c = 0 is false)

RemarkWe could also use a restricted domain for the existence example ie

Exists[x xgt0 x^2 + 2 x + c == 0]Reduce[ c Reals] (consider only real numbers)

fasshaueriitedu MATH 100 ndash ITP 29

Quantifiers

Example (Comparing the use of exist and forall in common language)

Consider the two statementsEverybody likes at least one drink namely water(one drink liked by everybody)Everybody likes at least one drink I myself go for beer(everybody likes some drink)

How can we formalize these two statements using quantifiers

There exists a drink D such that for every person P P likes D

(existD) (forallP) [P likes D]

For every person P there exists a drink D such that P likes D

(forallP) (existD) [P likes D]

The order of quantifiers matters What about the other two casesfasshaueriitedu MATH 100 ndash ITP 30

Quantifiers

A mathematical example

Let P be the set of prime numbers and N the set of natural numbersThen

(foralln isin N) (existm isin N) [(m gt n) and (m isin P)]

says that there are infinitely many primes

Actually it says that

For whatever natural number n we pickwe can find another natural number mthat is both larger than n and a prime number

The statement m isin P (or ldquom is a prime numberrdquo) can be formalized as

(forallab isin N) [(ab = m)rArr ((a = 1) or (b = 1))]

fasshaueriitedu MATH 100 ndash ITP 31

Quantifiers

Negation of Universal Statements

Earlier we used the example (in Mathematica)

(forallx isin R)[x2 + 2x + c gt 0

]Letrsquos assume it is true ie

For all x the inequality x2 + 2x + c gt 0 is true

What if we want to negate this statement We get

not[(forallx isin R)

[x2 + 2x + c gt 0

]]Not[ForAll[x Element[xReals] x^2 + 2 x + c gt 0]]Reduce[ c] ( find c st the statement is T )

What does the statement mean (Mathematica resolved it)

There exists some x for which the inequality is not trueNote that the values of c found by Mathematica are complementary tothose for which the original statement was true

fasshaueriitedu MATH 100 ndash ITP 32

Quantifiers

Negation of Existential StatementsLetrsquos use our second earlier example

(existx isin R)[(x2 + 2x + c = 0) and (x gt 0)

]Letrsquos assume it is true ie

There exists an x such that the equation x2 + 2x + c = 0 istrue and x gt 0

What if we want to negate this statement We get

not[(existx isin R)

[(x2 + 2x + c = 0) and (x gt 0)

]]Not[Exists[x x^2 + 2 x + c == 0 ampamp x gt 0]]Reduce[ c Reals] (consider only real numbers)

What does the statement meanFor all x the equation is not true or x le 0

Again the values of c found by Mathematica are complementary tothose for which the original statement was true

fasshaueriitedu MATH 100 ndash ITP 33

Quantifiers

Using a restricted domain things are a little simpler

(existx isin R+)[x2 + 2x + c = 0

]Letrsquos assume it is true ie

There exists a positive x the equation x2 + 2x + c = 0 is true

What if we want to negate this statement We get

not[(existx isin R+)

[x2 + 2x + c = 0

]]Not[Exists[x x gt 0 x^2 + 2 x + c == 0]]Reduce[ c Reals] (consider only real numbers)

What does the statement meanFor all positive x the equation is not true

Again the values of c found by Mathematica are complementary tothose for which the original statement was true

fasshaueriitedu MATH 100 ndash ITP 34

Quantifiers

Back to Beer

We end by determining the ldquocorrectrdquo formulation for the beer exampleLetrsquos formalize the statement

All American beer tastes dreadful

We introduce the following notationB the set of all beers

A(x) the statement ldquox is AmericanrdquoD(x) the statement ldquox tastes dreadfulrdquo

Then we get(forallx isin B) [A(x)rArr D(x)]

ieFor all beers if the beer is American then it tastes dreadful

fasshaueriitedu MATH 100 ndash ITP 35

Quantifiers

Now we need to negate

(forallx isin B) [A(x)rArr D(x)]

According to our earlier discussion we have

(existx isin B)not [A(x)rArr D(x)]

which using the fact that not [φrArr ψ] is equivalent to φ and (notψ) yields

(existx isin B) [A(x) and (notD(x))]

In wordsThere exists a beer which is American and does not tastedreadful

fasshaueriitedu MATH 100 ndash ITP 36

Appendix References

References I

Devlin Keith JSet Functions and Logic (3rd Ed)Chapman amp HallCRC 2004

Moler CleveExperiments with MATLABhttpwwwmathworkscommolerexmchaptershtml

fasshaueriitedu MATH 100 ndash ITP 37

  • ``Thats Logic
  • Logical Connectives
  • Conditionals and Biconditionals
  • Truth Tables
  • Looking Ahead Toward Proofs
  • Quantifiers
  • Appendix
Page 21: MATH 100 – Introduction to the Profession - Logic

Looking Ahead Toward Proofs

Contrapositive

Sometimes it is difficult to prove an implication directly In this case wecan try to show that the contrapositive of the conditional holds ie weuse (see HW 2211)

φrArr ψ is equivalent to (notψ)rArr (notφ)

and conclude (modus tollens method by denial)

If φ and ((notψ)rArr (notφ)) then ψ

Note that this has nothing to do with proof by contradiction (more onthat later)

Example

Conditional If you average 85 or above then you will get an AContrapositive If you donrsquotdidnrsquot get an A then you donrsquotdidnrsquot average85 or above

fasshaueriitedu MATH 100 ndash ITP 21

Looking Ahead Toward Proofs

Converse

Do not confuse the contrapositive of a conditional with its converse

If φrArr ψ then its converse is ψ rArr φ

There is no logical connection between a conditional and its converse

The only link is that if both are true then the biconditional holds ie

(φrArr ψ) and (ψ rArr φ) is equivalent to (φhArr ψ)

Example

Conditional If you average 85 or above then you will get an AContrapositive If you donrsquotdidnrsquot get an A then you donrsquotdidnrsquot average85 or aboveConverse If you getgot an A then you averageaveraged 85 or above

Note The converse assures us that scoring 85 or above isnecessary for an A (not so good for you _)

fasshaueriitedu MATH 100 ndash ITP 22

Looking Ahead Toward Proofs

Also do not confuse a statement with itsconverse

More Lewis CarrolllsquoNot the same thing a bitrsquo saidthe Hatter lsquoYou might just as wellsay that ldquoI see what I eatrdquo is thesame thing as ldquoI eat what I seerdquorsquo

From ldquoAlice in Wonderlandrdquo by Lewis Carroll (seehttpwwwonline-literaturecomcarrollalice7 forthe complete Chapter 7 A Mad Tea Party)

fasshaueriitedu MATH 100 ndash ITP 23

Looking Ahead Toward Proofs

Inverse

One could also consider the contrapositive of the converse5 of aconditional also known as the inverse of the conditional

Example

Conditional If you average 85 or above then you will get an AContrapositive If you donrsquotdidnrsquot get an A then you donrsquotdidnrsquot average85 or aboveConverse If you getgot an A then you averageaveraged 85 or aboveInverse If you donrsquot average 85 or above then you wonrsquot get an A

Note The inverse (which is equivalent to the converse) perhaps showseven better that scoring 85 or above is necessary for an A

5Or equivalently the converse of the contrapositivefasshaueriitedu MATH 100 ndash ITP 24

Looking Ahead Toward Proofs

Negated Conditional

You also might be tempted to confuse the contrapositive of aconditional with its negation As we showed earlier the negation of aconditional

not(φrArr ψ) is equivalent to φ and (notψ)

which is different from the contrapositive of φrArr ψ

(notψ)rArr (notφ)

The latter would be equivalent to (verify this)

(notφ) or ψ

fasshaueriitedu MATH 100 ndash ITP 25

Looking Ahead Toward Proofs

We just said that the negated conditional is

φ and (notψ)

Example

Conditional If you average 85 or above then you will get an AContrapositive If you donrsquotdidnrsquot get an A then you donrsquotdidnrsquot average85 or aboveConverse If you getgot an A then you averageaveraged 85 or aboveInverse If you donrsquot average 85 or above then you wonrsquot get an ANegated conditional You average 85 or above and you wonrsquot get an A

Note The negated conditional is only true if the conditional is falseie in the case when I break my promise

fasshaueriitedu MATH 100 ndash ITP 26

Looking Ahead Toward Proofs

The perverse cube of reversed implications

notφrArr notψφornotψ

larrrarr notψ rArr notφψornotφ

l lφrArr ψnotφorψ

larrrarr ψ rArr φnotψorφ

l Negation l

not (notφrArr notψ)notφandψ

middot middot middot not (notψ rArr notφ)notψandφ

l lnot (φrArr ψ)

φandnotψmiddot middot middot not (ψ rArr φ)

ψandnotφ

Create the truth tables for all these statements to verify their relations

fasshaueriitedu MATH 100 ndash ITP 27

Quantifiers

ldquoFor allrdquo and ldquothere existsrdquo

Universal quantifier forallx ldquofor all x it is the case that rdquoExistential quantifier existx ldquothere exists an x such that rdquo

Example (in Mathematica ndash quantifiers donrsquot exist in MATLAB)ForAll[x Element[xReals] x^2 + 2 x + c gt 0]Reduce[ c] ( find c st the statement is T )

In words For what values of c is the inequality x2 + 2x + c gt 0 true forall values of x

Example (in Mathematica)Exists[x x^2 + 2 x + c == 0 ampamp x gt 0]Reduce[ c Reals] (consider only real numbers)

In words For what values of c does the equation x2 + 2x + c = 0 havea positive solution x When does a positive solution exista

aExistence (and uniqueness) of a solution are fundamental issues in math

fasshaueriitedu MATH 100 ndash ITP 28

Quantifiers

We can also nicely visualize whatrsquos going on in Mathematica

Manipulate[Plot[x^2 + 2 x + c x -5 5PlotRange -gt -6 10] c -5 5]

This shows thatfor c le 0 there is an intersection with the positive x-axis so apositive solution to the equation x2 + 2x + c = 0 existsfor c gt 0 the parabola does not intersect the positive x-axis sothe equation x2 + 2x + c = 0 is false for positive values of x for c gt 1 the parabola does not intersect the x-axis at all so theinequality x2 + 2x + c gt 0 is true for all values of x (but theequation x2 + 2x + c = 0 is false)

RemarkWe could also use a restricted domain for the existence example ie

Exists[x xgt0 x^2 + 2 x + c == 0]Reduce[ c Reals] (consider only real numbers)

fasshaueriitedu MATH 100 ndash ITP 29

Quantifiers

Example (Comparing the use of exist and forall in common language)

Consider the two statementsEverybody likes at least one drink namely water(one drink liked by everybody)Everybody likes at least one drink I myself go for beer(everybody likes some drink)

How can we formalize these two statements using quantifiers

There exists a drink D such that for every person P P likes D

(existD) (forallP) [P likes D]

For every person P there exists a drink D such that P likes D

(forallP) (existD) [P likes D]

The order of quantifiers matters What about the other two casesfasshaueriitedu MATH 100 ndash ITP 30

Quantifiers

A mathematical example

Let P be the set of prime numbers and N the set of natural numbersThen

(foralln isin N) (existm isin N) [(m gt n) and (m isin P)]

says that there are infinitely many primes

Actually it says that

For whatever natural number n we pickwe can find another natural number mthat is both larger than n and a prime number

The statement m isin P (or ldquom is a prime numberrdquo) can be formalized as

(forallab isin N) [(ab = m)rArr ((a = 1) or (b = 1))]

fasshaueriitedu MATH 100 ndash ITP 31

Quantifiers

Negation of Universal Statements

Earlier we used the example (in Mathematica)

(forallx isin R)[x2 + 2x + c gt 0

]Letrsquos assume it is true ie

For all x the inequality x2 + 2x + c gt 0 is true

What if we want to negate this statement We get

not[(forallx isin R)

[x2 + 2x + c gt 0

]]Not[ForAll[x Element[xReals] x^2 + 2 x + c gt 0]]Reduce[ c] ( find c st the statement is T )

What does the statement mean (Mathematica resolved it)

There exists some x for which the inequality is not trueNote that the values of c found by Mathematica are complementary tothose for which the original statement was true

fasshaueriitedu MATH 100 ndash ITP 32

Quantifiers

Negation of Existential StatementsLetrsquos use our second earlier example

(existx isin R)[(x2 + 2x + c = 0) and (x gt 0)

]Letrsquos assume it is true ie

There exists an x such that the equation x2 + 2x + c = 0 istrue and x gt 0

What if we want to negate this statement We get

not[(existx isin R)

[(x2 + 2x + c = 0) and (x gt 0)

]]Not[Exists[x x^2 + 2 x + c == 0 ampamp x gt 0]]Reduce[ c Reals] (consider only real numbers)

What does the statement meanFor all x the equation is not true or x le 0

Again the values of c found by Mathematica are complementary tothose for which the original statement was true

fasshaueriitedu MATH 100 ndash ITP 33

Quantifiers

Using a restricted domain things are a little simpler

(existx isin R+)[x2 + 2x + c = 0

]Letrsquos assume it is true ie

There exists a positive x the equation x2 + 2x + c = 0 is true

What if we want to negate this statement We get

not[(existx isin R+)

[x2 + 2x + c = 0

]]Not[Exists[x x gt 0 x^2 + 2 x + c == 0]]Reduce[ c Reals] (consider only real numbers)

What does the statement meanFor all positive x the equation is not true

Again the values of c found by Mathematica are complementary tothose for which the original statement was true

fasshaueriitedu MATH 100 ndash ITP 34

Quantifiers

Back to Beer

We end by determining the ldquocorrectrdquo formulation for the beer exampleLetrsquos formalize the statement

All American beer tastes dreadful

We introduce the following notationB the set of all beers

A(x) the statement ldquox is AmericanrdquoD(x) the statement ldquox tastes dreadfulrdquo

Then we get(forallx isin B) [A(x)rArr D(x)]

ieFor all beers if the beer is American then it tastes dreadful

fasshaueriitedu MATH 100 ndash ITP 35

Quantifiers

Now we need to negate

(forallx isin B) [A(x)rArr D(x)]

According to our earlier discussion we have

(existx isin B)not [A(x)rArr D(x)]

which using the fact that not [φrArr ψ] is equivalent to φ and (notψ) yields

(existx isin B) [A(x) and (notD(x))]

In wordsThere exists a beer which is American and does not tastedreadful

fasshaueriitedu MATH 100 ndash ITP 36

Appendix References

References I

Devlin Keith JSet Functions and Logic (3rd Ed)Chapman amp HallCRC 2004

Moler CleveExperiments with MATLABhttpwwwmathworkscommolerexmchaptershtml

fasshaueriitedu MATH 100 ndash ITP 37

  • ``Thats Logic
  • Logical Connectives
  • Conditionals and Biconditionals
  • Truth Tables
  • Looking Ahead Toward Proofs
  • Quantifiers
  • Appendix
Page 22: MATH 100 – Introduction to the Profession - Logic

Looking Ahead Toward Proofs

Converse

Do not confuse the contrapositive of a conditional with its converse

If φrArr ψ then its converse is ψ rArr φ

There is no logical connection between a conditional and its converse

The only link is that if both are true then the biconditional holds ie

(φrArr ψ) and (ψ rArr φ) is equivalent to (φhArr ψ)

Example

Conditional If you average 85 or above then you will get an AContrapositive If you donrsquotdidnrsquot get an A then you donrsquotdidnrsquot average85 or aboveConverse If you getgot an A then you averageaveraged 85 or above

Note The converse assures us that scoring 85 or above isnecessary for an A (not so good for you _)

fasshaueriitedu MATH 100 ndash ITP 22

Looking Ahead Toward Proofs

Also do not confuse a statement with itsconverse

More Lewis CarrolllsquoNot the same thing a bitrsquo saidthe Hatter lsquoYou might just as wellsay that ldquoI see what I eatrdquo is thesame thing as ldquoI eat what I seerdquorsquo

From ldquoAlice in Wonderlandrdquo by Lewis Carroll (seehttpwwwonline-literaturecomcarrollalice7 forthe complete Chapter 7 A Mad Tea Party)

fasshaueriitedu MATH 100 ndash ITP 23

Looking Ahead Toward Proofs

Inverse

One could also consider the contrapositive of the converse5 of aconditional also known as the inverse of the conditional

Example

Conditional If you average 85 or above then you will get an AContrapositive If you donrsquotdidnrsquot get an A then you donrsquotdidnrsquot average85 or aboveConverse If you getgot an A then you averageaveraged 85 or aboveInverse If you donrsquot average 85 or above then you wonrsquot get an A

Note The inverse (which is equivalent to the converse) perhaps showseven better that scoring 85 or above is necessary for an A

5Or equivalently the converse of the contrapositivefasshaueriitedu MATH 100 ndash ITP 24

Looking Ahead Toward Proofs

Negated Conditional

You also might be tempted to confuse the contrapositive of aconditional with its negation As we showed earlier the negation of aconditional

not(φrArr ψ) is equivalent to φ and (notψ)

which is different from the contrapositive of φrArr ψ

(notψ)rArr (notφ)

The latter would be equivalent to (verify this)

(notφ) or ψ

fasshaueriitedu MATH 100 ndash ITP 25

Looking Ahead Toward Proofs

We just said that the negated conditional is

φ and (notψ)

Example

Conditional If you average 85 or above then you will get an AContrapositive If you donrsquotdidnrsquot get an A then you donrsquotdidnrsquot average85 or aboveConverse If you getgot an A then you averageaveraged 85 or aboveInverse If you donrsquot average 85 or above then you wonrsquot get an ANegated conditional You average 85 or above and you wonrsquot get an A

Note The negated conditional is only true if the conditional is falseie in the case when I break my promise

fasshaueriitedu MATH 100 ndash ITP 26

Looking Ahead Toward Proofs

The perverse cube of reversed implications

notφrArr notψφornotψ

larrrarr notψ rArr notφψornotφ

l lφrArr ψnotφorψ

larrrarr ψ rArr φnotψorφ

l Negation l

not (notφrArr notψ)notφandψ

middot middot middot not (notψ rArr notφ)notψandφ

l lnot (φrArr ψ)

φandnotψmiddot middot middot not (ψ rArr φ)

ψandnotφ

Create the truth tables for all these statements to verify their relations

fasshaueriitedu MATH 100 ndash ITP 27

Quantifiers

ldquoFor allrdquo and ldquothere existsrdquo

Universal quantifier forallx ldquofor all x it is the case that rdquoExistential quantifier existx ldquothere exists an x such that rdquo

Example (in Mathematica ndash quantifiers donrsquot exist in MATLAB)ForAll[x Element[xReals] x^2 + 2 x + c gt 0]Reduce[ c] ( find c st the statement is T )

In words For what values of c is the inequality x2 + 2x + c gt 0 true forall values of x

Example (in Mathematica)Exists[x x^2 + 2 x + c == 0 ampamp x gt 0]Reduce[ c Reals] (consider only real numbers)

In words For what values of c does the equation x2 + 2x + c = 0 havea positive solution x When does a positive solution exista

aExistence (and uniqueness) of a solution are fundamental issues in math

fasshaueriitedu MATH 100 ndash ITP 28

Quantifiers

We can also nicely visualize whatrsquos going on in Mathematica

Manipulate[Plot[x^2 + 2 x + c x -5 5PlotRange -gt -6 10] c -5 5]

This shows thatfor c le 0 there is an intersection with the positive x-axis so apositive solution to the equation x2 + 2x + c = 0 existsfor c gt 0 the parabola does not intersect the positive x-axis sothe equation x2 + 2x + c = 0 is false for positive values of x for c gt 1 the parabola does not intersect the x-axis at all so theinequality x2 + 2x + c gt 0 is true for all values of x (but theequation x2 + 2x + c = 0 is false)

RemarkWe could also use a restricted domain for the existence example ie

Exists[x xgt0 x^2 + 2 x + c == 0]Reduce[ c Reals] (consider only real numbers)

fasshaueriitedu MATH 100 ndash ITP 29

Quantifiers

Example (Comparing the use of exist and forall in common language)

Consider the two statementsEverybody likes at least one drink namely water(one drink liked by everybody)Everybody likes at least one drink I myself go for beer(everybody likes some drink)

How can we formalize these two statements using quantifiers

There exists a drink D such that for every person P P likes D

(existD) (forallP) [P likes D]

For every person P there exists a drink D such that P likes D

(forallP) (existD) [P likes D]

The order of quantifiers matters What about the other two casesfasshaueriitedu MATH 100 ndash ITP 30

Quantifiers

A mathematical example

Let P be the set of prime numbers and N the set of natural numbersThen

(foralln isin N) (existm isin N) [(m gt n) and (m isin P)]

says that there are infinitely many primes

Actually it says that

For whatever natural number n we pickwe can find another natural number mthat is both larger than n and a prime number

The statement m isin P (or ldquom is a prime numberrdquo) can be formalized as

(forallab isin N) [(ab = m)rArr ((a = 1) or (b = 1))]

fasshaueriitedu MATH 100 ndash ITP 31

Quantifiers

Negation of Universal Statements

Earlier we used the example (in Mathematica)

(forallx isin R)[x2 + 2x + c gt 0

]Letrsquos assume it is true ie

For all x the inequality x2 + 2x + c gt 0 is true

What if we want to negate this statement We get

not[(forallx isin R)

[x2 + 2x + c gt 0

]]Not[ForAll[x Element[xReals] x^2 + 2 x + c gt 0]]Reduce[ c] ( find c st the statement is T )

What does the statement mean (Mathematica resolved it)

There exists some x for which the inequality is not trueNote that the values of c found by Mathematica are complementary tothose for which the original statement was true

fasshaueriitedu MATH 100 ndash ITP 32

Quantifiers

Negation of Existential StatementsLetrsquos use our second earlier example

(existx isin R)[(x2 + 2x + c = 0) and (x gt 0)

]Letrsquos assume it is true ie

There exists an x such that the equation x2 + 2x + c = 0 istrue and x gt 0

What if we want to negate this statement We get

not[(existx isin R)

[(x2 + 2x + c = 0) and (x gt 0)

]]Not[Exists[x x^2 + 2 x + c == 0 ampamp x gt 0]]Reduce[ c Reals] (consider only real numbers)

What does the statement meanFor all x the equation is not true or x le 0

Again the values of c found by Mathematica are complementary tothose for which the original statement was true

fasshaueriitedu MATH 100 ndash ITP 33

Quantifiers

Using a restricted domain things are a little simpler

(existx isin R+)[x2 + 2x + c = 0

]Letrsquos assume it is true ie

There exists a positive x the equation x2 + 2x + c = 0 is true

What if we want to negate this statement We get

not[(existx isin R+)

[x2 + 2x + c = 0

]]Not[Exists[x x gt 0 x^2 + 2 x + c == 0]]Reduce[ c Reals] (consider only real numbers)

What does the statement meanFor all positive x the equation is not true

Again the values of c found by Mathematica are complementary tothose for which the original statement was true

fasshaueriitedu MATH 100 ndash ITP 34

Quantifiers

Back to Beer

We end by determining the ldquocorrectrdquo formulation for the beer exampleLetrsquos formalize the statement

All American beer tastes dreadful

We introduce the following notationB the set of all beers

A(x) the statement ldquox is AmericanrdquoD(x) the statement ldquox tastes dreadfulrdquo

Then we get(forallx isin B) [A(x)rArr D(x)]

ieFor all beers if the beer is American then it tastes dreadful

fasshaueriitedu MATH 100 ndash ITP 35

Quantifiers

Now we need to negate

(forallx isin B) [A(x)rArr D(x)]

According to our earlier discussion we have

(existx isin B)not [A(x)rArr D(x)]

which using the fact that not [φrArr ψ] is equivalent to φ and (notψ) yields

(existx isin B) [A(x) and (notD(x))]

In wordsThere exists a beer which is American and does not tastedreadful

fasshaueriitedu MATH 100 ndash ITP 36

Appendix References

References I

Devlin Keith JSet Functions and Logic (3rd Ed)Chapman amp HallCRC 2004

Moler CleveExperiments with MATLABhttpwwwmathworkscommolerexmchaptershtml

fasshaueriitedu MATH 100 ndash ITP 37

  • ``Thats Logic
  • Logical Connectives
  • Conditionals and Biconditionals
  • Truth Tables
  • Looking Ahead Toward Proofs
  • Quantifiers
  • Appendix
Page 23: MATH 100 – Introduction to the Profession - Logic

Looking Ahead Toward Proofs

Also do not confuse a statement with itsconverse

More Lewis CarrolllsquoNot the same thing a bitrsquo saidthe Hatter lsquoYou might just as wellsay that ldquoI see what I eatrdquo is thesame thing as ldquoI eat what I seerdquorsquo

From ldquoAlice in Wonderlandrdquo by Lewis Carroll (seehttpwwwonline-literaturecomcarrollalice7 forthe complete Chapter 7 A Mad Tea Party)

fasshaueriitedu MATH 100 ndash ITP 23

Looking Ahead Toward Proofs

Inverse

One could also consider the contrapositive of the converse5 of aconditional also known as the inverse of the conditional

Example

Conditional If you average 85 or above then you will get an AContrapositive If you donrsquotdidnrsquot get an A then you donrsquotdidnrsquot average85 or aboveConverse If you getgot an A then you averageaveraged 85 or aboveInverse If you donrsquot average 85 or above then you wonrsquot get an A

Note The inverse (which is equivalent to the converse) perhaps showseven better that scoring 85 or above is necessary for an A

5Or equivalently the converse of the contrapositivefasshaueriitedu MATH 100 ndash ITP 24

Looking Ahead Toward Proofs

Negated Conditional

You also might be tempted to confuse the contrapositive of aconditional with its negation As we showed earlier the negation of aconditional

not(φrArr ψ) is equivalent to φ and (notψ)

which is different from the contrapositive of φrArr ψ

(notψ)rArr (notφ)

The latter would be equivalent to (verify this)

(notφ) or ψ

fasshaueriitedu MATH 100 ndash ITP 25

Looking Ahead Toward Proofs

We just said that the negated conditional is

φ and (notψ)

Example

Conditional If you average 85 or above then you will get an AContrapositive If you donrsquotdidnrsquot get an A then you donrsquotdidnrsquot average85 or aboveConverse If you getgot an A then you averageaveraged 85 or aboveInverse If you donrsquot average 85 or above then you wonrsquot get an ANegated conditional You average 85 or above and you wonrsquot get an A

Note The negated conditional is only true if the conditional is falseie in the case when I break my promise

fasshaueriitedu MATH 100 ndash ITP 26

Looking Ahead Toward Proofs

The perverse cube of reversed implications

notφrArr notψφornotψ

larrrarr notψ rArr notφψornotφ

l lφrArr ψnotφorψ

larrrarr ψ rArr φnotψorφ

l Negation l

not (notφrArr notψ)notφandψ

middot middot middot not (notψ rArr notφ)notψandφ

l lnot (φrArr ψ)

φandnotψmiddot middot middot not (ψ rArr φ)

ψandnotφ

Create the truth tables for all these statements to verify their relations

fasshaueriitedu MATH 100 ndash ITP 27

Quantifiers

ldquoFor allrdquo and ldquothere existsrdquo

Universal quantifier forallx ldquofor all x it is the case that rdquoExistential quantifier existx ldquothere exists an x such that rdquo

Example (in Mathematica ndash quantifiers donrsquot exist in MATLAB)ForAll[x Element[xReals] x^2 + 2 x + c gt 0]Reduce[ c] ( find c st the statement is T )

In words For what values of c is the inequality x2 + 2x + c gt 0 true forall values of x

Example (in Mathematica)Exists[x x^2 + 2 x + c == 0 ampamp x gt 0]Reduce[ c Reals] (consider only real numbers)

In words For what values of c does the equation x2 + 2x + c = 0 havea positive solution x When does a positive solution exista

aExistence (and uniqueness) of a solution are fundamental issues in math

fasshaueriitedu MATH 100 ndash ITP 28

Quantifiers

We can also nicely visualize whatrsquos going on in Mathematica

Manipulate[Plot[x^2 + 2 x + c x -5 5PlotRange -gt -6 10] c -5 5]

This shows thatfor c le 0 there is an intersection with the positive x-axis so apositive solution to the equation x2 + 2x + c = 0 existsfor c gt 0 the parabola does not intersect the positive x-axis sothe equation x2 + 2x + c = 0 is false for positive values of x for c gt 1 the parabola does not intersect the x-axis at all so theinequality x2 + 2x + c gt 0 is true for all values of x (but theequation x2 + 2x + c = 0 is false)

RemarkWe could also use a restricted domain for the existence example ie

Exists[x xgt0 x^2 + 2 x + c == 0]Reduce[ c Reals] (consider only real numbers)

fasshaueriitedu MATH 100 ndash ITP 29

Quantifiers

Example (Comparing the use of exist and forall in common language)

Consider the two statementsEverybody likes at least one drink namely water(one drink liked by everybody)Everybody likes at least one drink I myself go for beer(everybody likes some drink)

How can we formalize these two statements using quantifiers

There exists a drink D such that for every person P P likes D

(existD) (forallP) [P likes D]

For every person P there exists a drink D such that P likes D

(forallP) (existD) [P likes D]

The order of quantifiers matters What about the other two casesfasshaueriitedu MATH 100 ndash ITP 30

Quantifiers

A mathematical example

Let P be the set of prime numbers and N the set of natural numbersThen

(foralln isin N) (existm isin N) [(m gt n) and (m isin P)]

says that there are infinitely many primes

Actually it says that

For whatever natural number n we pickwe can find another natural number mthat is both larger than n and a prime number

The statement m isin P (or ldquom is a prime numberrdquo) can be formalized as

(forallab isin N) [(ab = m)rArr ((a = 1) or (b = 1))]

fasshaueriitedu MATH 100 ndash ITP 31

Quantifiers

Negation of Universal Statements

Earlier we used the example (in Mathematica)

(forallx isin R)[x2 + 2x + c gt 0

]Letrsquos assume it is true ie

For all x the inequality x2 + 2x + c gt 0 is true

What if we want to negate this statement We get

not[(forallx isin R)

[x2 + 2x + c gt 0

]]Not[ForAll[x Element[xReals] x^2 + 2 x + c gt 0]]Reduce[ c] ( find c st the statement is T )

What does the statement mean (Mathematica resolved it)

There exists some x for which the inequality is not trueNote that the values of c found by Mathematica are complementary tothose for which the original statement was true

fasshaueriitedu MATH 100 ndash ITP 32

Quantifiers

Negation of Existential StatementsLetrsquos use our second earlier example

(existx isin R)[(x2 + 2x + c = 0) and (x gt 0)

]Letrsquos assume it is true ie

There exists an x such that the equation x2 + 2x + c = 0 istrue and x gt 0

What if we want to negate this statement We get

not[(existx isin R)

[(x2 + 2x + c = 0) and (x gt 0)

]]Not[Exists[x x^2 + 2 x + c == 0 ampamp x gt 0]]Reduce[ c Reals] (consider only real numbers)

What does the statement meanFor all x the equation is not true or x le 0

Again the values of c found by Mathematica are complementary tothose for which the original statement was true

fasshaueriitedu MATH 100 ndash ITP 33

Quantifiers

Using a restricted domain things are a little simpler

(existx isin R+)[x2 + 2x + c = 0

]Letrsquos assume it is true ie

There exists a positive x the equation x2 + 2x + c = 0 is true

What if we want to negate this statement We get

not[(existx isin R+)

[x2 + 2x + c = 0

]]Not[Exists[x x gt 0 x^2 + 2 x + c == 0]]Reduce[ c Reals] (consider only real numbers)

What does the statement meanFor all positive x the equation is not true

Again the values of c found by Mathematica are complementary tothose for which the original statement was true

fasshaueriitedu MATH 100 ndash ITP 34

Quantifiers

Back to Beer

We end by determining the ldquocorrectrdquo formulation for the beer exampleLetrsquos formalize the statement

All American beer tastes dreadful

We introduce the following notationB the set of all beers

A(x) the statement ldquox is AmericanrdquoD(x) the statement ldquox tastes dreadfulrdquo

Then we get(forallx isin B) [A(x)rArr D(x)]

ieFor all beers if the beer is American then it tastes dreadful

fasshaueriitedu MATH 100 ndash ITP 35

Quantifiers

Now we need to negate

(forallx isin B) [A(x)rArr D(x)]

According to our earlier discussion we have

(existx isin B)not [A(x)rArr D(x)]

which using the fact that not [φrArr ψ] is equivalent to φ and (notψ) yields

(existx isin B) [A(x) and (notD(x))]

In wordsThere exists a beer which is American and does not tastedreadful

fasshaueriitedu MATH 100 ndash ITP 36

Appendix References

References I

Devlin Keith JSet Functions and Logic (3rd Ed)Chapman amp HallCRC 2004

Moler CleveExperiments with MATLABhttpwwwmathworkscommolerexmchaptershtml

fasshaueriitedu MATH 100 ndash ITP 37

  • ``Thats Logic
  • Logical Connectives
  • Conditionals and Biconditionals
  • Truth Tables
  • Looking Ahead Toward Proofs
  • Quantifiers
  • Appendix
Page 24: MATH 100 – Introduction to the Profession - Logic

Looking Ahead Toward Proofs

Inverse

One could also consider the contrapositive of the converse5 of aconditional also known as the inverse of the conditional

Example

Conditional If you average 85 or above then you will get an AContrapositive If you donrsquotdidnrsquot get an A then you donrsquotdidnrsquot average85 or aboveConverse If you getgot an A then you averageaveraged 85 or aboveInverse If you donrsquot average 85 or above then you wonrsquot get an A

Note The inverse (which is equivalent to the converse) perhaps showseven better that scoring 85 or above is necessary for an A

5Or equivalently the converse of the contrapositivefasshaueriitedu MATH 100 ndash ITP 24

Looking Ahead Toward Proofs

Negated Conditional

You also might be tempted to confuse the contrapositive of aconditional with its negation As we showed earlier the negation of aconditional

not(φrArr ψ) is equivalent to φ and (notψ)

which is different from the contrapositive of φrArr ψ

(notψ)rArr (notφ)

The latter would be equivalent to (verify this)

(notφ) or ψ

fasshaueriitedu MATH 100 ndash ITP 25

Looking Ahead Toward Proofs

We just said that the negated conditional is

φ and (notψ)

Example

Conditional If you average 85 or above then you will get an AContrapositive If you donrsquotdidnrsquot get an A then you donrsquotdidnrsquot average85 or aboveConverse If you getgot an A then you averageaveraged 85 or aboveInverse If you donrsquot average 85 or above then you wonrsquot get an ANegated conditional You average 85 or above and you wonrsquot get an A

Note The negated conditional is only true if the conditional is falseie in the case when I break my promise

fasshaueriitedu MATH 100 ndash ITP 26

Looking Ahead Toward Proofs

The perverse cube of reversed implications

notφrArr notψφornotψ

larrrarr notψ rArr notφψornotφ

l lφrArr ψnotφorψ

larrrarr ψ rArr φnotψorφ

l Negation l

not (notφrArr notψ)notφandψ

middot middot middot not (notψ rArr notφ)notψandφ

l lnot (φrArr ψ)

φandnotψmiddot middot middot not (ψ rArr φ)

ψandnotφ

Create the truth tables for all these statements to verify their relations

fasshaueriitedu MATH 100 ndash ITP 27

Quantifiers

ldquoFor allrdquo and ldquothere existsrdquo

Universal quantifier forallx ldquofor all x it is the case that rdquoExistential quantifier existx ldquothere exists an x such that rdquo

Example (in Mathematica ndash quantifiers donrsquot exist in MATLAB)ForAll[x Element[xReals] x^2 + 2 x + c gt 0]Reduce[ c] ( find c st the statement is T )

In words For what values of c is the inequality x2 + 2x + c gt 0 true forall values of x

Example (in Mathematica)Exists[x x^2 + 2 x + c == 0 ampamp x gt 0]Reduce[ c Reals] (consider only real numbers)

In words For what values of c does the equation x2 + 2x + c = 0 havea positive solution x When does a positive solution exista

aExistence (and uniqueness) of a solution are fundamental issues in math

fasshaueriitedu MATH 100 ndash ITP 28

Quantifiers

We can also nicely visualize whatrsquos going on in Mathematica

Manipulate[Plot[x^2 + 2 x + c x -5 5PlotRange -gt -6 10] c -5 5]

This shows thatfor c le 0 there is an intersection with the positive x-axis so apositive solution to the equation x2 + 2x + c = 0 existsfor c gt 0 the parabola does not intersect the positive x-axis sothe equation x2 + 2x + c = 0 is false for positive values of x for c gt 1 the parabola does not intersect the x-axis at all so theinequality x2 + 2x + c gt 0 is true for all values of x (but theequation x2 + 2x + c = 0 is false)

RemarkWe could also use a restricted domain for the existence example ie

Exists[x xgt0 x^2 + 2 x + c == 0]Reduce[ c Reals] (consider only real numbers)

fasshaueriitedu MATH 100 ndash ITP 29

Quantifiers

Example (Comparing the use of exist and forall in common language)

Consider the two statementsEverybody likes at least one drink namely water(one drink liked by everybody)Everybody likes at least one drink I myself go for beer(everybody likes some drink)

How can we formalize these two statements using quantifiers

There exists a drink D such that for every person P P likes D

(existD) (forallP) [P likes D]

For every person P there exists a drink D such that P likes D

(forallP) (existD) [P likes D]

The order of quantifiers matters What about the other two casesfasshaueriitedu MATH 100 ndash ITP 30

Quantifiers

A mathematical example

Let P be the set of prime numbers and N the set of natural numbersThen

(foralln isin N) (existm isin N) [(m gt n) and (m isin P)]

says that there are infinitely many primes

Actually it says that

For whatever natural number n we pickwe can find another natural number mthat is both larger than n and a prime number

The statement m isin P (or ldquom is a prime numberrdquo) can be formalized as

(forallab isin N) [(ab = m)rArr ((a = 1) or (b = 1))]

fasshaueriitedu MATH 100 ndash ITP 31

Quantifiers

Negation of Universal Statements

Earlier we used the example (in Mathematica)

(forallx isin R)[x2 + 2x + c gt 0

]Letrsquos assume it is true ie

For all x the inequality x2 + 2x + c gt 0 is true

What if we want to negate this statement We get

not[(forallx isin R)

[x2 + 2x + c gt 0

]]Not[ForAll[x Element[xReals] x^2 + 2 x + c gt 0]]Reduce[ c] ( find c st the statement is T )

What does the statement mean (Mathematica resolved it)

There exists some x for which the inequality is not trueNote that the values of c found by Mathematica are complementary tothose for which the original statement was true

fasshaueriitedu MATH 100 ndash ITP 32

Quantifiers

Negation of Existential StatementsLetrsquos use our second earlier example

(existx isin R)[(x2 + 2x + c = 0) and (x gt 0)

]Letrsquos assume it is true ie

There exists an x such that the equation x2 + 2x + c = 0 istrue and x gt 0

What if we want to negate this statement We get

not[(existx isin R)

[(x2 + 2x + c = 0) and (x gt 0)

]]Not[Exists[x x^2 + 2 x + c == 0 ampamp x gt 0]]Reduce[ c Reals] (consider only real numbers)

What does the statement meanFor all x the equation is not true or x le 0

Again the values of c found by Mathematica are complementary tothose for which the original statement was true

fasshaueriitedu MATH 100 ndash ITP 33

Quantifiers

Using a restricted domain things are a little simpler

(existx isin R+)[x2 + 2x + c = 0

]Letrsquos assume it is true ie

There exists a positive x the equation x2 + 2x + c = 0 is true

What if we want to negate this statement We get

not[(existx isin R+)

[x2 + 2x + c = 0

]]Not[Exists[x x gt 0 x^2 + 2 x + c == 0]]Reduce[ c Reals] (consider only real numbers)

What does the statement meanFor all positive x the equation is not true

Again the values of c found by Mathematica are complementary tothose for which the original statement was true

fasshaueriitedu MATH 100 ndash ITP 34

Quantifiers

Back to Beer

We end by determining the ldquocorrectrdquo formulation for the beer exampleLetrsquos formalize the statement

All American beer tastes dreadful

We introduce the following notationB the set of all beers

A(x) the statement ldquox is AmericanrdquoD(x) the statement ldquox tastes dreadfulrdquo

Then we get(forallx isin B) [A(x)rArr D(x)]

ieFor all beers if the beer is American then it tastes dreadful

fasshaueriitedu MATH 100 ndash ITP 35

Quantifiers

Now we need to negate

(forallx isin B) [A(x)rArr D(x)]

According to our earlier discussion we have

(existx isin B)not [A(x)rArr D(x)]

which using the fact that not [φrArr ψ] is equivalent to φ and (notψ) yields

(existx isin B) [A(x) and (notD(x))]

In wordsThere exists a beer which is American and does not tastedreadful

fasshaueriitedu MATH 100 ndash ITP 36

Appendix References

References I

Devlin Keith JSet Functions and Logic (3rd Ed)Chapman amp HallCRC 2004

Moler CleveExperiments with MATLABhttpwwwmathworkscommolerexmchaptershtml

fasshaueriitedu MATH 100 ndash ITP 37

  • ``Thats Logic
  • Logical Connectives
  • Conditionals and Biconditionals
  • Truth Tables
  • Looking Ahead Toward Proofs
  • Quantifiers
  • Appendix
Page 25: MATH 100 – Introduction to the Profession - Logic

Looking Ahead Toward Proofs

Negated Conditional

You also might be tempted to confuse the contrapositive of aconditional with its negation As we showed earlier the negation of aconditional

not(φrArr ψ) is equivalent to φ and (notψ)

which is different from the contrapositive of φrArr ψ

(notψ)rArr (notφ)

The latter would be equivalent to (verify this)

(notφ) or ψ

fasshaueriitedu MATH 100 ndash ITP 25

Looking Ahead Toward Proofs

We just said that the negated conditional is

φ and (notψ)

Example

Conditional If you average 85 or above then you will get an AContrapositive If you donrsquotdidnrsquot get an A then you donrsquotdidnrsquot average85 or aboveConverse If you getgot an A then you averageaveraged 85 or aboveInverse If you donrsquot average 85 or above then you wonrsquot get an ANegated conditional You average 85 or above and you wonrsquot get an A

Note The negated conditional is only true if the conditional is falseie in the case when I break my promise

fasshaueriitedu MATH 100 ndash ITP 26

Looking Ahead Toward Proofs

The perverse cube of reversed implications

notφrArr notψφornotψ

larrrarr notψ rArr notφψornotφ

l lφrArr ψnotφorψ

larrrarr ψ rArr φnotψorφ

l Negation l

not (notφrArr notψ)notφandψ

middot middot middot not (notψ rArr notφ)notψandφ

l lnot (φrArr ψ)

φandnotψmiddot middot middot not (ψ rArr φ)

ψandnotφ

Create the truth tables for all these statements to verify their relations

fasshaueriitedu MATH 100 ndash ITP 27

Quantifiers

ldquoFor allrdquo and ldquothere existsrdquo

Universal quantifier forallx ldquofor all x it is the case that rdquoExistential quantifier existx ldquothere exists an x such that rdquo

Example (in Mathematica ndash quantifiers donrsquot exist in MATLAB)ForAll[x Element[xReals] x^2 + 2 x + c gt 0]Reduce[ c] ( find c st the statement is T )

In words For what values of c is the inequality x2 + 2x + c gt 0 true forall values of x

Example (in Mathematica)Exists[x x^2 + 2 x + c == 0 ampamp x gt 0]Reduce[ c Reals] (consider only real numbers)

In words For what values of c does the equation x2 + 2x + c = 0 havea positive solution x When does a positive solution exista

aExistence (and uniqueness) of a solution are fundamental issues in math

fasshaueriitedu MATH 100 ndash ITP 28

Quantifiers

We can also nicely visualize whatrsquos going on in Mathematica

Manipulate[Plot[x^2 + 2 x + c x -5 5PlotRange -gt -6 10] c -5 5]

This shows thatfor c le 0 there is an intersection with the positive x-axis so apositive solution to the equation x2 + 2x + c = 0 existsfor c gt 0 the parabola does not intersect the positive x-axis sothe equation x2 + 2x + c = 0 is false for positive values of x for c gt 1 the parabola does not intersect the x-axis at all so theinequality x2 + 2x + c gt 0 is true for all values of x (but theequation x2 + 2x + c = 0 is false)

RemarkWe could also use a restricted domain for the existence example ie

Exists[x xgt0 x^2 + 2 x + c == 0]Reduce[ c Reals] (consider only real numbers)

fasshaueriitedu MATH 100 ndash ITP 29

Quantifiers

Example (Comparing the use of exist and forall in common language)

Consider the two statementsEverybody likes at least one drink namely water(one drink liked by everybody)Everybody likes at least one drink I myself go for beer(everybody likes some drink)

How can we formalize these two statements using quantifiers

There exists a drink D such that for every person P P likes D

(existD) (forallP) [P likes D]

For every person P there exists a drink D such that P likes D

(forallP) (existD) [P likes D]

The order of quantifiers matters What about the other two casesfasshaueriitedu MATH 100 ndash ITP 30

Quantifiers

A mathematical example

Let P be the set of prime numbers and N the set of natural numbersThen

(foralln isin N) (existm isin N) [(m gt n) and (m isin P)]

says that there are infinitely many primes

Actually it says that

For whatever natural number n we pickwe can find another natural number mthat is both larger than n and a prime number

The statement m isin P (or ldquom is a prime numberrdquo) can be formalized as

(forallab isin N) [(ab = m)rArr ((a = 1) or (b = 1))]

fasshaueriitedu MATH 100 ndash ITP 31

Quantifiers

Negation of Universal Statements

Earlier we used the example (in Mathematica)

(forallx isin R)[x2 + 2x + c gt 0

]Letrsquos assume it is true ie

For all x the inequality x2 + 2x + c gt 0 is true

What if we want to negate this statement We get

not[(forallx isin R)

[x2 + 2x + c gt 0

]]Not[ForAll[x Element[xReals] x^2 + 2 x + c gt 0]]Reduce[ c] ( find c st the statement is T )

What does the statement mean (Mathematica resolved it)

There exists some x for which the inequality is not trueNote that the values of c found by Mathematica are complementary tothose for which the original statement was true

fasshaueriitedu MATH 100 ndash ITP 32

Quantifiers

Negation of Existential StatementsLetrsquos use our second earlier example

(existx isin R)[(x2 + 2x + c = 0) and (x gt 0)

]Letrsquos assume it is true ie

There exists an x such that the equation x2 + 2x + c = 0 istrue and x gt 0

What if we want to negate this statement We get

not[(existx isin R)

[(x2 + 2x + c = 0) and (x gt 0)

]]Not[Exists[x x^2 + 2 x + c == 0 ampamp x gt 0]]Reduce[ c Reals] (consider only real numbers)

What does the statement meanFor all x the equation is not true or x le 0

Again the values of c found by Mathematica are complementary tothose for which the original statement was true

fasshaueriitedu MATH 100 ndash ITP 33

Quantifiers

Using a restricted domain things are a little simpler

(existx isin R+)[x2 + 2x + c = 0

]Letrsquos assume it is true ie

There exists a positive x the equation x2 + 2x + c = 0 is true

What if we want to negate this statement We get

not[(existx isin R+)

[x2 + 2x + c = 0

]]Not[Exists[x x gt 0 x^2 + 2 x + c == 0]]Reduce[ c Reals] (consider only real numbers)

What does the statement meanFor all positive x the equation is not true

Again the values of c found by Mathematica are complementary tothose for which the original statement was true

fasshaueriitedu MATH 100 ndash ITP 34

Quantifiers

Back to Beer

We end by determining the ldquocorrectrdquo formulation for the beer exampleLetrsquos formalize the statement

All American beer tastes dreadful

We introduce the following notationB the set of all beers

A(x) the statement ldquox is AmericanrdquoD(x) the statement ldquox tastes dreadfulrdquo

Then we get(forallx isin B) [A(x)rArr D(x)]

ieFor all beers if the beer is American then it tastes dreadful

fasshaueriitedu MATH 100 ndash ITP 35

Quantifiers

Now we need to negate

(forallx isin B) [A(x)rArr D(x)]

According to our earlier discussion we have

(existx isin B)not [A(x)rArr D(x)]

which using the fact that not [φrArr ψ] is equivalent to φ and (notψ) yields

(existx isin B) [A(x) and (notD(x))]

In wordsThere exists a beer which is American and does not tastedreadful

fasshaueriitedu MATH 100 ndash ITP 36

Appendix References

References I

Devlin Keith JSet Functions and Logic (3rd Ed)Chapman amp HallCRC 2004

Moler CleveExperiments with MATLABhttpwwwmathworkscommolerexmchaptershtml

fasshaueriitedu MATH 100 ndash ITP 37

  • ``Thats Logic
  • Logical Connectives
  • Conditionals and Biconditionals
  • Truth Tables
  • Looking Ahead Toward Proofs
  • Quantifiers
  • Appendix
Page 26: MATH 100 – Introduction to the Profession - Logic

Looking Ahead Toward Proofs

We just said that the negated conditional is

φ and (notψ)

Example

Conditional If you average 85 or above then you will get an AContrapositive If you donrsquotdidnrsquot get an A then you donrsquotdidnrsquot average85 or aboveConverse If you getgot an A then you averageaveraged 85 or aboveInverse If you donrsquot average 85 or above then you wonrsquot get an ANegated conditional You average 85 or above and you wonrsquot get an A

Note The negated conditional is only true if the conditional is falseie in the case when I break my promise

fasshaueriitedu MATH 100 ndash ITP 26

Looking Ahead Toward Proofs

The perverse cube of reversed implications

notφrArr notψφornotψ

larrrarr notψ rArr notφψornotφ

l lφrArr ψnotφorψ

larrrarr ψ rArr φnotψorφ

l Negation l

not (notφrArr notψ)notφandψ

middot middot middot not (notψ rArr notφ)notψandφ

l lnot (φrArr ψ)

φandnotψmiddot middot middot not (ψ rArr φ)

ψandnotφ

Create the truth tables for all these statements to verify their relations

fasshaueriitedu MATH 100 ndash ITP 27

Quantifiers

ldquoFor allrdquo and ldquothere existsrdquo

Universal quantifier forallx ldquofor all x it is the case that rdquoExistential quantifier existx ldquothere exists an x such that rdquo

Example (in Mathematica ndash quantifiers donrsquot exist in MATLAB)ForAll[x Element[xReals] x^2 + 2 x + c gt 0]Reduce[ c] ( find c st the statement is T )

In words For what values of c is the inequality x2 + 2x + c gt 0 true forall values of x

Example (in Mathematica)Exists[x x^2 + 2 x + c == 0 ampamp x gt 0]Reduce[ c Reals] (consider only real numbers)

In words For what values of c does the equation x2 + 2x + c = 0 havea positive solution x When does a positive solution exista

aExistence (and uniqueness) of a solution are fundamental issues in math

fasshaueriitedu MATH 100 ndash ITP 28

Quantifiers

We can also nicely visualize whatrsquos going on in Mathematica

Manipulate[Plot[x^2 + 2 x + c x -5 5PlotRange -gt -6 10] c -5 5]

This shows thatfor c le 0 there is an intersection with the positive x-axis so apositive solution to the equation x2 + 2x + c = 0 existsfor c gt 0 the parabola does not intersect the positive x-axis sothe equation x2 + 2x + c = 0 is false for positive values of x for c gt 1 the parabola does not intersect the x-axis at all so theinequality x2 + 2x + c gt 0 is true for all values of x (but theequation x2 + 2x + c = 0 is false)

RemarkWe could also use a restricted domain for the existence example ie

Exists[x xgt0 x^2 + 2 x + c == 0]Reduce[ c Reals] (consider only real numbers)

fasshaueriitedu MATH 100 ndash ITP 29

Quantifiers

Example (Comparing the use of exist and forall in common language)

Consider the two statementsEverybody likes at least one drink namely water(one drink liked by everybody)Everybody likes at least one drink I myself go for beer(everybody likes some drink)

How can we formalize these two statements using quantifiers

There exists a drink D such that for every person P P likes D

(existD) (forallP) [P likes D]

For every person P there exists a drink D such that P likes D

(forallP) (existD) [P likes D]

The order of quantifiers matters What about the other two casesfasshaueriitedu MATH 100 ndash ITP 30

Quantifiers

A mathematical example

Let P be the set of prime numbers and N the set of natural numbersThen

(foralln isin N) (existm isin N) [(m gt n) and (m isin P)]

says that there are infinitely many primes

Actually it says that

For whatever natural number n we pickwe can find another natural number mthat is both larger than n and a prime number

The statement m isin P (or ldquom is a prime numberrdquo) can be formalized as

(forallab isin N) [(ab = m)rArr ((a = 1) or (b = 1))]

fasshaueriitedu MATH 100 ndash ITP 31

Quantifiers

Negation of Universal Statements

Earlier we used the example (in Mathematica)

(forallx isin R)[x2 + 2x + c gt 0

]Letrsquos assume it is true ie

For all x the inequality x2 + 2x + c gt 0 is true

What if we want to negate this statement We get

not[(forallx isin R)

[x2 + 2x + c gt 0

]]Not[ForAll[x Element[xReals] x^2 + 2 x + c gt 0]]Reduce[ c] ( find c st the statement is T )

What does the statement mean (Mathematica resolved it)

There exists some x for which the inequality is not trueNote that the values of c found by Mathematica are complementary tothose for which the original statement was true

fasshaueriitedu MATH 100 ndash ITP 32

Quantifiers

Negation of Existential StatementsLetrsquos use our second earlier example

(existx isin R)[(x2 + 2x + c = 0) and (x gt 0)

]Letrsquos assume it is true ie

There exists an x such that the equation x2 + 2x + c = 0 istrue and x gt 0

What if we want to negate this statement We get

not[(existx isin R)

[(x2 + 2x + c = 0) and (x gt 0)

]]Not[Exists[x x^2 + 2 x + c == 0 ampamp x gt 0]]Reduce[ c Reals] (consider only real numbers)

What does the statement meanFor all x the equation is not true or x le 0

Again the values of c found by Mathematica are complementary tothose for which the original statement was true

fasshaueriitedu MATH 100 ndash ITP 33

Quantifiers

Using a restricted domain things are a little simpler

(existx isin R+)[x2 + 2x + c = 0

]Letrsquos assume it is true ie

There exists a positive x the equation x2 + 2x + c = 0 is true

What if we want to negate this statement We get

not[(existx isin R+)

[x2 + 2x + c = 0

]]Not[Exists[x x gt 0 x^2 + 2 x + c == 0]]Reduce[ c Reals] (consider only real numbers)

What does the statement meanFor all positive x the equation is not true

Again the values of c found by Mathematica are complementary tothose for which the original statement was true

fasshaueriitedu MATH 100 ndash ITP 34

Quantifiers

Back to Beer

We end by determining the ldquocorrectrdquo formulation for the beer exampleLetrsquos formalize the statement

All American beer tastes dreadful

We introduce the following notationB the set of all beers

A(x) the statement ldquox is AmericanrdquoD(x) the statement ldquox tastes dreadfulrdquo

Then we get(forallx isin B) [A(x)rArr D(x)]

ieFor all beers if the beer is American then it tastes dreadful

fasshaueriitedu MATH 100 ndash ITP 35

Quantifiers

Now we need to negate

(forallx isin B) [A(x)rArr D(x)]

According to our earlier discussion we have

(existx isin B)not [A(x)rArr D(x)]

which using the fact that not [φrArr ψ] is equivalent to φ and (notψ) yields

(existx isin B) [A(x) and (notD(x))]

In wordsThere exists a beer which is American and does not tastedreadful

fasshaueriitedu MATH 100 ndash ITP 36

Appendix References

References I

Devlin Keith JSet Functions and Logic (3rd Ed)Chapman amp HallCRC 2004

Moler CleveExperiments with MATLABhttpwwwmathworkscommolerexmchaptershtml

fasshaueriitedu MATH 100 ndash ITP 37

  • ``Thats Logic
  • Logical Connectives
  • Conditionals and Biconditionals
  • Truth Tables
  • Looking Ahead Toward Proofs
  • Quantifiers
  • Appendix
Page 27: MATH 100 – Introduction to the Profession - Logic

Looking Ahead Toward Proofs

The perverse cube of reversed implications

notφrArr notψφornotψ

larrrarr notψ rArr notφψornotφ

l lφrArr ψnotφorψ

larrrarr ψ rArr φnotψorφ

l Negation l

not (notφrArr notψ)notφandψ

middot middot middot not (notψ rArr notφ)notψandφ

l lnot (φrArr ψ)

φandnotψmiddot middot middot not (ψ rArr φ)

ψandnotφ

Create the truth tables for all these statements to verify their relations

fasshaueriitedu MATH 100 ndash ITP 27

Quantifiers

ldquoFor allrdquo and ldquothere existsrdquo

Universal quantifier forallx ldquofor all x it is the case that rdquoExistential quantifier existx ldquothere exists an x such that rdquo

Example (in Mathematica ndash quantifiers donrsquot exist in MATLAB)ForAll[x Element[xReals] x^2 + 2 x + c gt 0]Reduce[ c] ( find c st the statement is T )

In words For what values of c is the inequality x2 + 2x + c gt 0 true forall values of x

Example (in Mathematica)Exists[x x^2 + 2 x + c == 0 ampamp x gt 0]Reduce[ c Reals] (consider only real numbers)

In words For what values of c does the equation x2 + 2x + c = 0 havea positive solution x When does a positive solution exista

aExistence (and uniqueness) of a solution are fundamental issues in math

fasshaueriitedu MATH 100 ndash ITP 28

Quantifiers

We can also nicely visualize whatrsquos going on in Mathematica

Manipulate[Plot[x^2 + 2 x + c x -5 5PlotRange -gt -6 10] c -5 5]

This shows thatfor c le 0 there is an intersection with the positive x-axis so apositive solution to the equation x2 + 2x + c = 0 existsfor c gt 0 the parabola does not intersect the positive x-axis sothe equation x2 + 2x + c = 0 is false for positive values of x for c gt 1 the parabola does not intersect the x-axis at all so theinequality x2 + 2x + c gt 0 is true for all values of x (but theequation x2 + 2x + c = 0 is false)

RemarkWe could also use a restricted domain for the existence example ie

Exists[x xgt0 x^2 + 2 x + c == 0]Reduce[ c Reals] (consider only real numbers)

fasshaueriitedu MATH 100 ndash ITP 29

Quantifiers

Example (Comparing the use of exist and forall in common language)

Consider the two statementsEverybody likes at least one drink namely water(one drink liked by everybody)Everybody likes at least one drink I myself go for beer(everybody likes some drink)

How can we formalize these two statements using quantifiers

There exists a drink D such that for every person P P likes D

(existD) (forallP) [P likes D]

For every person P there exists a drink D such that P likes D

(forallP) (existD) [P likes D]

The order of quantifiers matters What about the other two casesfasshaueriitedu MATH 100 ndash ITP 30

Quantifiers

A mathematical example

Let P be the set of prime numbers and N the set of natural numbersThen

(foralln isin N) (existm isin N) [(m gt n) and (m isin P)]

says that there are infinitely many primes

Actually it says that

For whatever natural number n we pickwe can find another natural number mthat is both larger than n and a prime number

The statement m isin P (or ldquom is a prime numberrdquo) can be formalized as

(forallab isin N) [(ab = m)rArr ((a = 1) or (b = 1))]

fasshaueriitedu MATH 100 ndash ITP 31

Quantifiers

Negation of Universal Statements

Earlier we used the example (in Mathematica)

(forallx isin R)[x2 + 2x + c gt 0

]Letrsquos assume it is true ie

For all x the inequality x2 + 2x + c gt 0 is true

What if we want to negate this statement We get

not[(forallx isin R)

[x2 + 2x + c gt 0

]]Not[ForAll[x Element[xReals] x^2 + 2 x + c gt 0]]Reduce[ c] ( find c st the statement is T )

What does the statement mean (Mathematica resolved it)

There exists some x for which the inequality is not trueNote that the values of c found by Mathematica are complementary tothose for which the original statement was true

fasshaueriitedu MATH 100 ndash ITP 32

Quantifiers

Negation of Existential StatementsLetrsquos use our second earlier example

(existx isin R)[(x2 + 2x + c = 0) and (x gt 0)

]Letrsquos assume it is true ie

There exists an x such that the equation x2 + 2x + c = 0 istrue and x gt 0

What if we want to negate this statement We get

not[(existx isin R)

[(x2 + 2x + c = 0) and (x gt 0)

]]Not[Exists[x x^2 + 2 x + c == 0 ampamp x gt 0]]Reduce[ c Reals] (consider only real numbers)

What does the statement meanFor all x the equation is not true or x le 0

Again the values of c found by Mathematica are complementary tothose for which the original statement was true

fasshaueriitedu MATH 100 ndash ITP 33

Quantifiers

Using a restricted domain things are a little simpler

(existx isin R+)[x2 + 2x + c = 0

]Letrsquos assume it is true ie

There exists a positive x the equation x2 + 2x + c = 0 is true

What if we want to negate this statement We get

not[(existx isin R+)

[x2 + 2x + c = 0

]]Not[Exists[x x gt 0 x^2 + 2 x + c == 0]]Reduce[ c Reals] (consider only real numbers)

What does the statement meanFor all positive x the equation is not true

Again the values of c found by Mathematica are complementary tothose for which the original statement was true

fasshaueriitedu MATH 100 ndash ITP 34

Quantifiers

Back to Beer

We end by determining the ldquocorrectrdquo formulation for the beer exampleLetrsquos formalize the statement

All American beer tastes dreadful

We introduce the following notationB the set of all beers

A(x) the statement ldquox is AmericanrdquoD(x) the statement ldquox tastes dreadfulrdquo

Then we get(forallx isin B) [A(x)rArr D(x)]

ieFor all beers if the beer is American then it tastes dreadful

fasshaueriitedu MATH 100 ndash ITP 35

Quantifiers

Now we need to negate

(forallx isin B) [A(x)rArr D(x)]

According to our earlier discussion we have

(existx isin B)not [A(x)rArr D(x)]

which using the fact that not [φrArr ψ] is equivalent to φ and (notψ) yields

(existx isin B) [A(x) and (notD(x))]

In wordsThere exists a beer which is American and does not tastedreadful

fasshaueriitedu MATH 100 ndash ITP 36

Appendix References

References I

Devlin Keith JSet Functions and Logic (3rd Ed)Chapman amp HallCRC 2004

Moler CleveExperiments with MATLABhttpwwwmathworkscommolerexmchaptershtml

fasshaueriitedu MATH 100 ndash ITP 37

  • ``Thats Logic
  • Logical Connectives
  • Conditionals and Biconditionals
  • Truth Tables
  • Looking Ahead Toward Proofs
  • Quantifiers
  • Appendix
Page 28: MATH 100 – Introduction to the Profession - Logic

Quantifiers

ldquoFor allrdquo and ldquothere existsrdquo

Universal quantifier forallx ldquofor all x it is the case that rdquoExistential quantifier existx ldquothere exists an x such that rdquo

Example (in Mathematica ndash quantifiers donrsquot exist in MATLAB)ForAll[x Element[xReals] x^2 + 2 x + c gt 0]Reduce[ c] ( find c st the statement is T )

In words For what values of c is the inequality x2 + 2x + c gt 0 true forall values of x

Example (in Mathematica)Exists[x x^2 + 2 x + c == 0 ampamp x gt 0]Reduce[ c Reals] (consider only real numbers)

In words For what values of c does the equation x2 + 2x + c = 0 havea positive solution x When does a positive solution exista

aExistence (and uniqueness) of a solution are fundamental issues in math

fasshaueriitedu MATH 100 ndash ITP 28

Quantifiers

We can also nicely visualize whatrsquos going on in Mathematica

Manipulate[Plot[x^2 + 2 x + c x -5 5PlotRange -gt -6 10] c -5 5]

This shows thatfor c le 0 there is an intersection with the positive x-axis so apositive solution to the equation x2 + 2x + c = 0 existsfor c gt 0 the parabola does not intersect the positive x-axis sothe equation x2 + 2x + c = 0 is false for positive values of x for c gt 1 the parabola does not intersect the x-axis at all so theinequality x2 + 2x + c gt 0 is true for all values of x (but theequation x2 + 2x + c = 0 is false)

RemarkWe could also use a restricted domain for the existence example ie

Exists[x xgt0 x^2 + 2 x + c == 0]Reduce[ c Reals] (consider only real numbers)

fasshaueriitedu MATH 100 ndash ITP 29

Quantifiers

Example (Comparing the use of exist and forall in common language)

Consider the two statementsEverybody likes at least one drink namely water(one drink liked by everybody)Everybody likes at least one drink I myself go for beer(everybody likes some drink)

How can we formalize these two statements using quantifiers

There exists a drink D such that for every person P P likes D

(existD) (forallP) [P likes D]

For every person P there exists a drink D such that P likes D

(forallP) (existD) [P likes D]

The order of quantifiers matters What about the other two casesfasshaueriitedu MATH 100 ndash ITP 30

Quantifiers

A mathematical example

Let P be the set of prime numbers and N the set of natural numbersThen

(foralln isin N) (existm isin N) [(m gt n) and (m isin P)]

says that there are infinitely many primes

Actually it says that

For whatever natural number n we pickwe can find another natural number mthat is both larger than n and a prime number

The statement m isin P (or ldquom is a prime numberrdquo) can be formalized as

(forallab isin N) [(ab = m)rArr ((a = 1) or (b = 1))]

fasshaueriitedu MATH 100 ndash ITP 31

Quantifiers

Negation of Universal Statements

Earlier we used the example (in Mathematica)

(forallx isin R)[x2 + 2x + c gt 0

]Letrsquos assume it is true ie

For all x the inequality x2 + 2x + c gt 0 is true

What if we want to negate this statement We get

not[(forallx isin R)

[x2 + 2x + c gt 0

]]Not[ForAll[x Element[xReals] x^2 + 2 x + c gt 0]]Reduce[ c] ( find c st the statement is T )

What does the statement mean (Mathematica resolved it)

There exists some x for which the inequality is not trueNote that the values of c found by Mathematica are complementary tothose for which the original statement was true

fasshaueriitedu MATH 100 ndash ITP 32

Quantifiers

Negation of Existential StatementsLetrsquos use our second earlier example

(existx isin R)[(x2 + 2x + c = 0) and (x gt 0)

]Letrsquos assume it is true ie

There exists an x such that the equation x2 + 2x + c = 0 istrue and x gt 0

What if we want to negate this statement We get

not[(existx isin R)

[(x2 + 2x + c = 0) and (x gt 0)

]]Not[Exists[x x^2 + 2 x + c == 0 ampamp x gt 0]]Reduce[ c Reals] (consider only real numbers)

What does the statement meanFor all x the equation is not true or x le 0

Again the values of c found by Mathematica are complementary tothose for which the original statement was true

fasshaueriitedu MATH 100 ndash ITP 33

Quantifiers

Using a restricted domain things are a little simpler

(existx isin R+)[x2 + 2x + c = 0

]Letrsquos assume it is true ie

There exists a positive x the equation x2 + 2x + c = 0 is true

What if we want to negate this statement We get

not[(existx isin R+)

[x2 + 2x + c = 0

]]Not[Exists[x x gt 0 x^2 + 2 x + c == 0]]Reduce[ c Reals] (consider only real numbers)

What does the statement meanFor all positive x the equation is not true

Again the values of c found by Mathematica are complementary tothose for which the original statement was true

fasshaueriitedu MATH 100 ndash ITP 34

Quantifiers

Back to Beer

We end by determining the ldquocorrectrdquo formulation for the beer exampleLetrsquos formalize the statement

All American beer tastes dreadful

We introduce the following notationB the set of all beers

A(x) the statement ldquox is AmericanrdquoD(x) the statement ldquox tastes dreadfulrdquo

Then we get(forallx isin B) [A(x)rArr D(x)]

ieFor all beers if the beer is American then it tastes dreadful

fasshaueriitedu MATH 100 ndash ITP 35

Quantifiers

Now we need to negate

(forallx isin B) [A(x)rArr D(x)]

According to our earlier discussion we have

(existx isin B)not [A(x)rArr D(x)]

which using the fact that not [φrArr ψ] is equivalent to φ and (notψ) yields

(existx isin B) [A(x) and (notD(x))]

In wordsThere exists a beer which is American and does not tastedreadful

fasshaueriitedu MATH 100 ndash ITP 36

Appendix References

References I

Devlin Keith JSet Functions and Logic (3rd Ed)Chapman amp HallCRC 2004

Moler CleveExperiments with MATLABhttpwwwmathworkscommolerexmchaptershtml

fasshaueriitedu MATH 100 ndash ITP 37

  • ``Thats Logic
  • Logical Connectives
  • Conditionals and Biconditionals
  • Truth Tables
  • Looking Ahead Toward Proofs
  • Quantifiers
  • Appendix
Page 29: MATH 100 – Introduction to the Profession - Logic

Quantifiers

We can also nicely visualize whatrsquos going on in Mathematica

Manipulate[Plot[x^2 + 2 x + c x -5 5PlotRange -gt -6 10] c -5 5]

This shows thatfor c le 0 there is an intersection with the positive x-axis so apositive solution to the equation x2 + 2x + c = 0 existsfor c gt 0 the parabola does not intersect the positive x-axis sothe equation x2 + 2x + c = 0 is false for positive values of x for c gt 1 the parabola does not intersect the x-axis at all so theinequality x2 + 2x + c gt 0 is true for all values of x (but theequation x2 + 2x + c = 0 is false)

RemarkWe could also use a restricted domain for the existence example ie

Exists[x xgt0 x^2 + 2 x + c == 0]Reduce[ c Reals] (consider only real numbers)

fasshaueriitedu MATH 100 ndash ITP 29

Quantifiers

Example (Comparing the use of exist and forall in common language)

Consider the two statementsEverybody likes at least one drink namely water(one drink liked by everybody)Everybody likes at least one drink I myself go for beer(everybody likes some drink)

How can we formalize these two statements using quantifiers

There exists a drink D such that for every person P P likes D

(existD) (forallP) [P likes D]

For every person P there exists a drink D such that P likes D

(forallP) (existD) [P likes D]

The order of quantifiers matters What about the other two casesfasshaueriitedu MATH 100 ndash ITP 30

Quantifiers

A mathematical example

Let P be the set of prime numbers and N the set of natural numbersThen

(foralln isin N) (existm isin N) [(m gt n) and (m isin P)]

says that there are infinitely many primes

Actually it says that

For whatever natural number n we pickwe can find another natural number mthat is both larger than n and a prime number

The statement m isin P (or ldquom is a prime numberrdquo) can be formalized as

(forallab isin N) [(ab = m)rArr ((a = 1) or (b = 1))]

fasshaueriitedu MATH 100 ndash ITP 31

Quantifiers

Negation of Universal Statements

Earlier we used the example (in Mathematica)

(forallx isin R)[x2 + 2x + c gt 0

]Letrsquos assume it is true ie

For all x the inequality x2 + 2x + c gt 0 is true

What if we want to negate this statement We get

not[(forallx isin R)

[x2 + 2x + c gt 0

]]Not[ForAll[x Element[xReals] x^2 + 2 x + c gt 0]]Reduce[ c] ( find c st the statement is T )

What does the statement mean (Mathematica resolved it)

There exists some x for which the inequality is not trueNote that the values of c found by Mathematica are complementary tothose for which the original statement was true

fasshaueriitedu MATH 100 ndash ITP 32

Quantifiers

Negation of Existential StatementsLetrsquos use our second earlier example

(existx isin R)[(x2 + 2x + c = 0) and (x gt 0)

]Letrsquos assume it is true ie

There exists an x such that the equation x2 + 2x + c = 0 istrue and x gt 0

What if we want to negate this statement We get

not[(existx isin R)

[(x2 + 2x + c = 0) and (x gt 0)

]]Not[Exists[x x^2 + 2 x + c == 0 ampamp x gt 0]]Reduce[ c Reals] (consider only real numbers)

What does the statement meanFor all x the equation is not true or x le 0

Again the values of c found by Mathematica are complementary tothose for which the original statement was true

fasshaueriitedu MATH 100 ndash ITP 33

Quantifiers

Using a restricted domain things are a little simpler

(existx isin R+)[x2 + 2x + c = 0

]Letrsquos assume it is true ie

There exists a positive x the equation x2 + 2x + c = 0 is true

What if we want to negate this statement We get

not[(existx isin R+)

[x2 + 2x + c = 0

]]Not[Exists[x x gt 0 x^2 + 2 x + c == 0]]Reduce[ c Reals] (consider only real numbers)

What does the statement meanFor all positive x the equation is not true

Again the values of c found by Mathematica are complementary tothose for which the original statement was true

fasshaueriitedu MATH 100 ndash ITP 34

Quantifiers

Back to Beer

We end by determining the ldquocorrectrdquo formulation for the beer exampleLetrsquos formalize the statement

All American beer tastes dreadful

We introduce the following notationB the set of all beers

A(x) the statement ldquox is AmericanrdquoD(x) the statement ldquox tastes dreadfulrdquo

Then we get(forallx isin B) [A(x)rArr D(x)]

ieFor all beers if the beer is American then it tastes dreadful

fasshaueriitedu MATH 100 ndash ITP 35

Quantifiers

Now we need to negate

(forallx isin B) [A(x)rArr D(x)]

According to our earlier discussion we have

(existx isin B)not [A(x)rArr D(x)]

which using the fact that not [φrArr ψ] is equivalent to φ and (notψ) yields

(existx isin B) [A(x) and (notD(x))]

In wordsThere exists a beer which is American and does not tastedreadful

fasshaueriitedu MATH 100 ndash ITP 36

Appendix References

References I

Devlin Keith JSet Functions and Logic (3rd Ed)Chapman amp HallCRC 2004

Moler CleveExperiments with MATLABhttpwwwmathworkscommolerexmchaptershtml

fasshaueriitedu MATH 100 ndash ITP 37

  • ``Thats Logic
  • Logical Connectives
  • Conditionals and Biconditionals
  • Truth Tables
  • Looking Ahead Toward Proofs
  • Quantifiers
  • Appendix
Page 30: MATH 100 – Introduction to the Profession - Logic

Quantifiers

Example (Comparing the use of exist and forall in common language)

Consider the two statementsEverybody likes at least one drink namely water(one drink liked by everybody)Everybody likes at least one drink I myself go for beer(everybody likes some drink)

How can we formalize these two statements using quantifiers

There exists a drink D such that for every person P P likes D

(existD) (forallP) [P likes D]

For every person P there exists a drink D such that P likes D

(forallP) (existD) [P likes D]

The order of quantifiers matters What about the other two casesfasshaueriitedu MATH 100 ndash ITP 30

Quantifiers

A mathematical example

Let P be the set of prime numbers and N the set of natural numbersThen

(foralln isin N) (existm isin N) [(m gt n) and (m isin P)]

says that there are infinitely many primes

Actually it says that

For whatever natural number n we pickwe can find another natural number mthat is both larger than n and a prime number

The statement m isin P (or ldquom is a prime numberrdquo) can be formalized as

(forallab isin N) [(ab = m)rArr ((a = 1) or (b = 1))]

fasshaueriitedu MATH 100 ndash ITP 31

Quantifiers

Negation of Universal Statements

Earlier we used the example (in Mathematica)

(forallx isin R)[x2 + 2x + c gt 0

]Letrsquos assume it is true ie

For all x the inequality x2 + 2x + c gt 0 is true

What if we want to negate this statement We get

not[(forallx isin R)

[x2 + 2x + c gt 0

]]Not[ForAll[x Element[xReals] x^2 + 2 x + c gt 0]]Reduce[ c] ( find c st the statement is T )

What does the statement mean (Mathematica resolved it)

There exists some x for which the inequality is not trueNote that the values of c found by Mathematica are complementary tothose for which the original statement was true

fasshaueriitedu MATH 100 ndash ITP 32

Quantifiers

Negation of Existential StatementsLetrsquos use our second earlier example

(existx isin R)[(x2 + 2x + c = 0) and (x gt 0)

]Letrsquos assume it is true ie

There exists an x such that the equation x2 + 2x + c = 0 istrue and x gt 0

What if we want to negate this statement We get

not[(existx isin R)

[(x2 + 2x + c = 0) and (x gt 0)

]]Not[Exists[x x^2 + 2 x + c == 0 ampamp x gt 0]]Reduce[ c Reals] (consider only real numbers)

What does the statement meanFor all x the equation is not true or x le 0

Again the values of c found by Mathematica are complementary tothose for which the original statement was true

fasshaueriitedu MATH 100 ndash ITP 33

Quantifiers

Using a restricted domain things are a little simpler

(existx isin R+)[x2 + 2x + c = 0

]Letrsquos assume it is true ie

There exists a positive x the equation x2 + 2x + c = 0 is true

What if we want to negate this statement We get

not[(existx isin R+)

[x2 + 2x + c = 0

]]Not[Exists[x x gt 0 x^2 + 2 x + c == 0]]Reduce[ c Reals] (consider only real numbers)

What does the statement meanFor all positive x the equation is not true

Again the values of c found by Mathematica are complementary tothose for which the original statement was true

fasshaueriitedu MATH 100 ndash ITP 34

Quantifiers

Back to Beer

We end by determining the ldquocorrectrdquo formulation for the beer exampleLetrsquos formalize the statement

All American beer tastes dreadful

We introduce the following notationB the set of all beers

A(x) the statement ldquox is AmericanrdquoD(x) the statement ldquox tastes dreadfulrdquo

Then we get(forallx isin B) [A(x)rArr D(x)]

ieFor all beers if the beer is American then it tastes dreadful

fasshaueriitedu MATH 100 ndash ITP 35

Quantifiers

Now we need to negate

(forallx isin B) [A(x)rArr D(x)]

According to our earlier discussion we have

(existx isin B)not [A(x)rArr D(x)]

which using the fact that not [φrArr ψ] is equivalent to φ and (notψ) yields

(existx isin B) [A(x) and (notD(x))]

In wordsThere exists a beer which is American and does not tastedreadful

fasshaueriitedu MATH 100 ndash ITP 36

Appendix References

References I

Devlin Keith JSet Functions and Logic (3rd Ed)Chapman amp HallCRC 2004

Moler CleveExperiments with MATLABhttpwwwmathworkscommolerexmchaptershtml

fasshaueriitedu MATH 100 ndash ITP 37

  • ``Thats Logic
  • Logical Connectives
  • Conditionals and Biconditionals
  • Truth Tables
  • Looking Ahead Toward Proofs
  • Quantifiers
  • Appendix
Page 31: MATH 100 – Introduction to the Profession - Logic

Quantifiers

A mathematical example

Let P be the set of prime numbers and N the set of natural numbersThen

(foralln isin N) (existm isin N) [(m gt n) and (m isin P)]

says that there are infinitely many primes

Actually it says that

For whatever natural number n we pickwe can find another natural number mthat is both larger than n and a prime number

The statement m isin P (or ldquom is a prime numberrdquo) can be formalized as

(forallab isin N) [(ab = m)rArr ((a = 1) or (b = 1))]

fasshaueriitedu MATH 100 ndash ITP 31

Quantifiers

Negation of Universal Statements

Earlier we used the example (in Mathematica)

(forallx isin R)[x2 + 2x + c gt 0

]Letrsquos assume it is true ie

For all x the inequality x2 + 2x + c gt 0 is true

What if we want to negate this statement We get

not[(forallx isin R)

[x2 + 2x + c gt 0

]]Not[ForAll[x Element[xReals] x^2 + 2 x + c gt 0]]Reduce[ c] ( find c st the statement is T )

What does the statement mean (Mathematica resolved it)

There exists some x for which the inequality is not trueNote that the values of c found by Mathematica are complementary tothose for which the original statement was true

fasshaueriitedu MATH 100 ndash ITP 32

Quantifiers

Negation of Existential StatementsLetrsquos use our second earlier example

(existx isin R)[(x2 + 2x + c = 0) and (x gt 0)

]Letrsquos assume it is true ie

There exists an x such that the equation x2 + 2x + c = 0 istrue and x gt 0

What if we want to negate this statement We get

not[(existx isin R)

[(x2 + 2x + c = 0) and (x gt 0)

]]Not[Exists[x x^2 + 2 x + c == 0 ampamp x gt 0]]Reduce[ c Reals] (consider only real numbers)

What does the statement meanFor all x the equation is not true or x le 0

Again the values of c found by Mathematica are complementary tothose for which the original statement was true

fasshaueriitedu MATH 100 ndash ITP 33

Quantifiers

Using a restricted domain things are a little simpler

(existx isin R+)[x2 + 2x + c = 0

]Letrsquos assume it is true ie

There exists a positive x the equation x2 + 2x + c = 0 is true

What if we want to negate this statement We get

not[(existx isin R+)

[x2 + 2x + c = 0

]]Not[Exists[x x gt 0 x^2 + 2 x + c == 0]]Reduce[ c Reals] (consider only real numbers)

What does the statement meanFor all positive x the equation is not true

Again the values of c found by Mathematica are complementary tothose for which the original statement was true

fasshaueriitedu MATH 100 ndash ITP 34

Quantifiers

Back to Beer

We end by determining the ldquocorrectrdquo formulation for the beer exampleLetrsquos formalize the statement

All American beer tastes dreadful

We introduce the following notationB the set of all beers

A(x) the statement ldquox is AmericanrdquoD(x) the statement ldquox tastes dreadfulrdquo

Then we get(forallx isin B) [A(x)rArr D(x)]

ieFor all beers if the beer is American then it tastes dreadful

fasshaueriitedu MATH 100 ndash ITP 35

Quantifiers

Now we need to negate

(forallx isin B) [A(x)rArr D(x)]

According to our earlier discussion we have

(existx isin B)not [A(x)rArr D(x)]

which using the fact that not [φrArr ψ] is equivalent to φ and (notψ) yields

(existx isin B) [A(x) and (notD(x))]

In wordsThere exists a beer which is American and does not tastedreadful

fasshaueriitedu MATH 100 ndash ITP 36

Appendix References

References I

Devlin Keith JSet Functions and Logic (3rd Ed)Chapman amp HallCRC 2004

Moler CleveExperiments with MATLABhttpwwwmathworkscommolerexmchaptershtml

fasshaueriitedu MATH 100 ndash ITP 37

  • ``Thats Logic
  • Logical Connectives
  • Conditionals and Biconditionals
  • Truth Tables
  • Looking Ahead Toward Proofs
  • Quantifiers
  • Appendix
Page 32: MATH 100 – Introduction to the Profession - Logic

Quantifiers

Negation of Universal Statements

Earlier we used the example (in Mathematica)

(forallx isin R)[x2 + 2x + c gt 0

]Letrsquos assume it is true ie

For all x the inequality x2 + 2x + c gt 0 is true

What if we want to negate this statement We get

not[(forallx isin R)

[x2 + 2x + c gt 0

]]Not[ForAll[x Element[xReals] x^2 + 2 x + c gt 0]]Reduce[ c] ( find c st the statement is T )

What does the statement mean (Mathematica resolved it)

There exists some x for which the inequality is not trueNote that the values of c found by Mathematica are complementary tothose for which the original statement was true

fasshaueriitedu MATH 100 ndash ITP 32

Quantifiers

Negation of Existential StatementsLetrsquos use our second earlier example

(existx isin R)[(x2 + 2x + c = 0) and (x gt 0)

]Letrsquos assume it is true ie

There exists an x such that the equation x2 + 2x + c = 0 istrue and x gt 0

What if we want to negate this statement We get

not[(existx isin R)

[(x2 + 2x + c = 0) and (x gt 0)

]]Not[Exists[x x^2 + 2 x + c == 0 ampamp x gt 0]]Reduce[ c Reals] (consider only real numbers)

What does the statement meanFor all x the equation is not true or x le 0

Again the values of c found by Mathematica are complementary tothose for which the original statement was true

fasshaueriitedu MATH 100 ndash ITP 33

Quantifiers

Using a restricted domain things are a little simpler

(existx isin R+)[x2 + 2x + c = 0

]Letrsquos assume it is true ie

There exists a positive x the equation x2 + 2x + c = 0 is true

What if we want to negate this statement We get

not[(existx isin R+)

[x2 + 2x + c = 0

]]Not[Exists[x x gt 0 x^2 + 2 x + c == 0]]Reduce[ c Reals] (consider only real numbers)

What does the statement meanFor all positive x the equation is not true

Again the values of c found by Mathematica are complementary tothose for which the original statement was true

fasshaueriitedu MATH 100 ndash ITP 34

Quantifiers

Back to Beer

We end by determining the ldquocorrectrdquo formulation for the beer exampleLetrsquos formalize the statement

All American beer tastes dreadful

We introduce the following notationB the set of all beers

A(x) the statement ldquox is AmericanrdquoD(x) the statement ldquox tastes dreadfulrdquo

Then we get(forallx isin B) [A(x)rArr D(x)]

ieFor all beers if the beer is American then it tastes dreadful

fasshaueriitedu MATH 100 ndash ITP 35

Quantifiers

Now we need to negate

(forallx isin B) [A(x)rArr D(x)]

According to our earlier discussion we have

(existx isin B)not [A(x)rArr D(x)]

which using the fact that not [φrArr ψ] is equivalent to φ and (notψ) yields

(existx isin B) [A(x) and (notD(x))]

In wordsThere exists a beer which is American and does not tastedreadful

fasshaueriitedu MATH 100 ndash ITP 36

Appendix References

References I

Devlin Keith JSet Functions and Logic (3rd Ed)Chapman amp HallCRC 2004

Moler CleveExperiments with MATLABhttpwwwmathworkscommolerexmchaptershtml

fasshaueriitedu MATH 100 ndash ITP 37

  • ``Thats Logic
  • Logical Connectives
  • Conditionals and Biconditionals
  • Truth Tables
  • Looking Ahead Toward Proofs
  • Quantifiers
  • Appendix
Page 33: MATH 100 – Introduction to the Profession - Logic

Quantifiers

Negation of Existential StatementsLetrsquos use our second earlier example

(existx isin R)[(x2 + 2x + c = 0) and (x gt 0)

]Letrsquos assume it is true ie

There exists an x such that the equation x2 + 2x + c = 0 istrue and x gt 0

What if we want to negate this statement We get

not[(existx isin R)

[(x2 + 2x + c = 0) and (x gt 0)

]]Not[Exists[x x^2 + 2 x + c == 0 ampamp x gt 0]]Reduce[ c Reals] (consider only real numbers)

What does the statement meanFor all x the equation is not true or x le 0

Again the values of c found by Mathematica are complementary tothose for which the original statement was true

fasshaueriitedu MATH 100 ndash ITP 33

Quantifiers

Using a restricted domain things are a little simpler

(existx isin R+)[x2 + 2x + c = 0

]Letrsquos assume it is true ie

There exists a positive x the equation x2 + 2x + c = 0 is true

What if we want to negate this statement We get

not[(existx isin R+)

[x2 + 2x + c = 0

]]Not[Exists[x x gt 0 x^2 + 2 x + c == 0]]Reduce[ c Reals] (consider only real numbers)

What does the statement meanFor all positive x the equation is not true

Again the values of c found by Mathematica are complementary tothose for which the original statement was true

fasshaueriitedu MATH 100 ndash ITP 34

Quantifiers

Back to Beer

We end by determining the ldquocorrectrdquo formulation for the beer exampleLetrsquos formalize the statement

All American beer tastes dreadful

We introduce the following notationB the set of all beers

A(x) the statement ldquox is AmericanrdquoD(x) the statement ldquox tastes dreadfulrdquo

Then we get(forallx isin B) [A(x)rArr D(x)]

ieFor all beers if the beer is American then it tastes dreadful

fasshaueriitedu MATH 100 ndash ITP 35

Quantifiers

Now we need to negate

(forallx isin B) [A(x)rArr D(x)]

According to our earlier discussion we have

(existx isin B)not [A(x)rArr D(x)]

which using the fact that not [φrArr ψ] is equivalent to φ and (notψ) yields

(existx isin B) [A(x) and (notD(x))]

In wordsThere exists a beer which is American and does not tastedreadful

fasshaueriitedu MATH 100 ndash ITP 36

Appendix References

References I

Devlin Keith JSet Functions and Logic (3rd Ed)Chapman amp HallCRC 2004

Moler CleveExperiments with MATLABhttpwwwmathworkscommolerexmchaptershtml

fasshaueriitedu MATH 100 ndash ITP 37

  • ``Thats Logic
  • Logical Connectives
  • Conditionals and Biconditionals
  • Truth Tables
  • Looking Ahead Toward Proofs
  • Quantifiers
  • Appendix
Page 34: MATH 100 – Introduction to the Profession - Logic

Quantifiers

Using a restricted domain things are a little simpler

(existx isin R+)[x2 + 2x + c = 0

]Letrsquos assume it is true ie

There exists a positive x the equation x2 + 2x + c = 0 is true

What if we want to negate this statement We get

not[(existx isin R+)

[x2 + 2x + c = 0

]]Not[Exists[x x gt 0 x^2 + 2 x + c == 0]]Reduce[ c Reals] (consider only real numbers)

What does the statement meanFor all positive x the equation is not true

Again the values of c found by Mathematica are complementary tothose for which the original statement was true

fasshaueriitedu MATH 100 ndash ITP 34

Quantifiers

Back to Beer

We end by determining the ldquocorrectrdquo formulation for the beer exampleLetrsquos formalize the statement

All American beer tastes dreadful

We introduce the following notationB the set of all beers

A(x) the statement ldquox is AmericanrdquoD(x) the statement ldquox tastes dreadfulrdquo

Then we get(forallx isin B) [A(x)rArr D(x)]

ieFor all beers if the beer is American then it tastes dreadful

fasshaueriitedu MATH 100 ndash ITP 35

Quantifiers

Now we need to negate

(forallx isin B) [A(x)rArr D(x)]

According to our earlier discussion we have

(existx isin B)not [A(x)rArr D(x)]

which using the fact that not [φrArr ψ] is equivalent to φ and (notψ) yields

(existx isin B) [A(x) and (notD(x))]

In wordsThere exists a beer which is American and does not tastedreadful

fasshaueriitedu MATH 100 ndash ITP 36

Appendix References

References I

Devlin Keith JSet Functions and Logic (3rd Ed)Chapman amp HallCRC 2004

Moler CleveExperiments with MATLABhttpwwwmathworkscommolerexmchaptershtml

fasshaueriitedu MATH 100 ndash ITP 37

  • ``Thats Logic
  • Logical Connectives
  • Conditionals and Biconditionals
  • Truth Tables
  • Looking Ahead Toward Proofs
  • Quantifiers
  • Appendix
Page 35: MATH 100 – Introduction to the Profession - Logic

Quantifiers

Back to Beer

We end by determining the ldquocorrectrdquo formulation for the beer exampleLetrsquos formalize the statement

All American beer tastes dreadful

We introduce the following notationB the set of all beers

A(x) the statement ldquox is AmericanrdquoD(x) the statement ldquox tastes dreadfulrdquo

Then we get(forallx isin B) [A(x)rArr D(x)]

ieFor all beers if the beer is American then it tastes dreadful

fasshaueriitedu MATH 100 ndash ITP 35

Quantifiers

Now we need to negate

(forallx isin B) [A(x)rArr D(x)]

According to our earlier discussion we have

(existx isin B)not [A(x)rArr D(x)]

which using the fact that not [φrArr ψ] is equivalent to φ and (notψ) yields

(existx isin B) [A(x) and (notD(x))]

In wordsThere exists a beer which is American and does not tastedreadful

fasshaueriitedu MATH 100 ndash ITP 36

Appendix References

References I

Devlin Keith JSet Functions and Logic (3rd Ed)Chapman amp HallCRC 2004

Moler CleveExperiments with MATLABhttpwwwmathworkscommolerexmchaptershtml

fasshaueriitedu MATH 100 ndash ITP 37

  • ``Thats Logic
  • Logical Connectives
  • Conditionals and Biconditionals
  • Truth Tables
  • Looking Ahead Toward Proofs
  • Quantifiers
  • Appendix
Page 36: MATH 100 – Introduction to the Profession - Logic

Quantifiers

Now we need to negate

(forallx isin B) [A(x)rArr D(x)]

According to our earlier discussion we have

(existx isin B)not [A(x)rArr D(x)]

which using the fact that not [φrArr ψ] is equivalent to φ and (notψ) yields

(existx isin B) [A(x) and (notD(x))]

In wordsThere exists a beer which is American and does not tastedreadful

fasshaueriitedu MATH 100 ndash ITP 36

Appendix References

References I

Devlin Keith JSet Functions and Logic (3rd Ed)Chapman amp HallCRC 2004

Moler CleveExperiments with MATLABhttpwwwmathworkscommolerexmchaptershtml

fasshaueriitedu MATH 100 ndash ITP 37

  • ``Thats Logic
  • Logical Connectives
  • Conditionals and Biconditionals
  • Truth Tables
  • Looking Ahead Toward Proofs
  • Quantifiers
  • Appendix
Page 37: MATH 100 – Introduction to the Profession - Logic

Appendix References

References I

Devlin Keith JSet Functions and Logic (3rd Ed)Chapman amp HallCRC 2004

Moler CleveExperiments with MATLABhttpwwwmathworkscommolerexmchaptershtml

fasshaueriitedu MATH 100 ndash ITP 37

  • ``Thats Logic
  • Logical Connectives
  • Conditionals and Biconditionals
  • Truth Tables
  • Looking Ahead Toward Proofs
  • Quantifiers
  • Appendix