Ln1 - Proofs

Embed Size (px)

Citation preview

  • 7/30/2019 Ln1 - Proofs

    1/18

    MassachusettsInstituteofTechnology CourseNotes,Week16.042J/18.062J,Fall05:MathematicsforComputerScience September7Prof.AlbertR.MeyerandProf.RonittRubinfeld revisedSeptember1,2005,856minutes

    Proofs

    1 WhatisaProof?Aproofisamethodofascertainingtruth.Butwhatconstitutesaproofdiffersamongfields.

    Legaltruthisascertainedbyajurybasedonallowableevidencepresentedattrial.Authoritativetruthisascertainedbyatrustedpersonororganization. Scientifictruthishypothesized,andthehypothesisisconfirmedorrefutedbyexperiments. Probabletruthisobtainedfromstatisticalanalysisofsampledata.Forexample,publicopin-

    ionisascertainedbypollingasmallrandomsampleofpeople. Philosophical proof involves careful exposition and persuasionbased on consistency and

    plausibility. ThebestexampleisCogitoergosum,aLatinsentencethattranslatesasIthink,thereforeIam. Itcomesfromthebeginningofa17thcenturyessaybytheMathe-matician/Philospher, ReneDescartes,anditisoneofthemostfamousquotesintheworld:doawebsearchonthephraseandyouwillbefloodedwithhits.Deducingyourexistencefromthefactthatyourethinkingaboutyourexistenceisaprettycoolandpersuasive-soundingfirstaxiom. However,withjustafewmorelinesofproofinthisvein,DescartesgoesontoconcludethatthereisaninfinitelybeneficentGod.ThisaintMath.

    Mathematicsalsohasaspecificnotionofproof.Definition. Aformalproof ofapropositionisachainoflogicaldeductionsleadingtothepropositionfromabasesetofaxioms.Thethreekeyideasinthisdefinitionarehighlighted: proposition,logicaldeduction,andaxiom.In the next sections, well discuss these three ideas along with somebasic ways of organizingproofs.

    Copyright2005,Prof.AlbertR.Meyer.

    http://www.btinternet.com/~glynhughes/squashed/descartes.htmhttp://www.btinternet.com/~glynhughes/squashed/descartes.htmhttp://www.btinternet.com/~glynhughes/squashed/descartes.htmhttp://www.btinternet.com/~glynhughes/squashed/descartes.htmhttp://www.btinternet.com/~glynhughes/squashed/descartes.htmhttp://www.btinternet.com/~glynhughes/squashed/descartes.htm
  • 7/30/2019 Ln1 - Proofs

    2/18

    2 CourseNotes,Week1:Proofs2 PropositionsDefinition. Apropositionisastatementthatiseithertrueorfalse.Thisdefinitionsoundsverygeneral,butitdoesexcludesentencessuchas,WhereforeartthouRomeo?andGivemeanA!.Butnotallpropositionsaremathematical.Forexample,AlbertswifesnameisIrenehappenstobetrue,andcouldbeprovedwithlegaldocumentsandtestimonyoftheirchildren,butitsnotamathematicalstatement.Mathematically meaningfulpropositionsmustbeabout well-definedmathematical objects likenumbers,sets,functions,relations,etc.,andtheymustbestatedusingmathematicallymeaning-fulterminology,likeANDandFORALL.Itsbesttoillustratethiswithafewexamplesaboutnumbersandplanarmapsthatareallmathematicallymeaningful.Proposition2.1. 2+3=5.Thispropositionistrue.Proposition2.2. Letp(n) ::=n2 + n + 41.

    n N. p(n) isaprimenumber.Thesymbolisreadforall. ThesymbolNstandsforthesetofnaturalnumbers,whichare0,1,2,3,...(askyourTAforthecompletelist). TheperiodaftertheNisjustaseparatorbetweenphrases.Aprimeisanaturalnumbergreaterthanonethatisnotdivisiblebyanyothernaturalnumberotherthan1anditself,forexample,2,3,5,7,11,....Letstrysomenumericalexperimentationtocheckthisproposition:p(0) = 41 which isprime.

    p(1) = 43 whichisprime.p(2) = 47 whichisprime.p(3) = 53 whichisprime. ...p(20) = 461whichisprime.Hmmm,startstolooklikeaplausibleclaim.Infactwecankeepcheckingthroughn = 39 andconfirmthatp(39) = 1601 isprime.But ifn = 40, thenp(n) = 402 + 40 + 41 = 41 41, which isnotprime. Since theexpressionisnotprimeforalln,thepropositionisfalse! Infact, itsnothardtoshowthatnononconstantpolynomialcanmapallnaturalnumbersintoprimenumbers. Thepointisthatingeneralyoucantcheckaclaimaboutaninfinitesetbycheckingafinitesetof itselements, nomatterhowlargethefiniteset.Herearetwoevenmoreextremeexamples:Proposition2.3. a4+b4+c4 = d4 hasnosolutionwhena,b,c,d arepositiveintegers.Inlogicalnotation,lettingZ+ denotethepositiveintegers,wehave

    4a Z+b Z+c Z+d Z+. a4 + b4 + c = d4.Stringsofslikethisareusuallyabbreviatedforeasierreading:

    4a,b,c,d Z+. a4 + b4 + c = d4.Euler(pronouncedoiler)conjecturedthis1769.Butthepropositionwasprovenfalse218yearslaterbyNoamElkiesataliberalartsschoolupMassAve. Hefoundthesolutiona = 95800, b =217519, c = 414560, d = 422481.

  • 7/30/2019 Ln1 - Proofs

    3/18

    CourseNotes,Week1:Proofs 3Proposition2.4. 313(x3 + y3) = z3 hasnosolutionwhenx,y,z N.Thispropositionisalsofalse,butthesmallestcounterexample hasmorethan1000digits!Proposition2.5. Everymapcanbecoloredwith4colorssothatadjacent1regionshavedifferentcolors.Thisproposition is trueand isknownas thefour-color theorem. However, therehavebeenmanyincorrectproofs, includingonethatstoodfor10yearsinthelate19thcenturybeforethemistakewasfound. Anextremelylaboriousproofwasfinallyfoundin1976bymathematiciansAppelandHakenwhousedacomplexcomputerprogramtocategorizethefour-colorablemaps;the program left a couple of thousand maps uncategorized, and these were checkedby handby Haken and his assistantsincluding his 15-year-old daughter. There was a lot of debateaboutwhether thiswasa legitimateproof: theargumentwas toobig tobechecked withoutacomputer, and no one could guarantee that the computer calculated correctly, nor did anyonehavetheenergytorecheckthefour-coloringsofthousandsofmapsthatwasdonebyhand. Fi-nally,aboutfiveyearsago,ahumanlyintelligibleproofofthefourcolortheoremwasfound(seehttp://www.math.gatech.edu/thomas/FC/fourcolor.html ).2Proposition2.6(Goldbach). Everyevenintegergreaterthan2isthesumoftwoprimes.Nooneknowswhetherthispropositionistrueorfalse.ThisistheGoldbachConjecture,whichdatesbackto1742.ForaComputerScientist,someofthemostimportantquestionsareaboutprogramandsystemcorrectnesswhethera programorsystemdoeswhat itssupposed to. Programsarenoto-riouslybuggy,andtheresagrowingcommunityofresearchersandpractitionerstryingtofindwaystoproveprogramcorrectness.TheseeffortshavebeensuccessfulenoughinthecaseofCPUchipsthattheyarenowroutinelyusedbyleadingchipmanufacturerstoprovechipcorrectnessandavoidmistakeslikethenotoriousInteldivisionbuginthe1990s.Developing mathematical methods toverifyprogramsandsystemsremainsan activeresearcharea.Wellconsidersomeofthesemethodslaterinthecourse.

    3 TheAxiomaticMethodThestandardprocedureforestablishingtruthinmathematicswasinventedbyEuclid,amathe-maticianworkinginAlexadria,Egyptaround300BC.Hisideawastobeginwithfiveassumptionsaboutgeometry,whichseemedundeniablebasedondirectexperience. (Forexample,Thereisastraightlinesegmentbetweeneverypairofpoints.) Propositionslikethesethataresimplyac-ceptedastruearecalledaxioms.Startingfromtheseaxioms,Euclidestablishedthetruthofmanyadditionalpropositionsbypro-vidingproofs.Aproof isasequenceoflogicaldeductionsfromaxiomsandpreviously-proved statementsthatconcludeswiththepropositioninquestion. Youprobablywrotemanyproofsinhighschoolgeometryclass,andyoullseealotmoreinthiscourse.

    1Tworegionsareadjacentonlywhentheyshareaboundarysegmentofpositivelength.Theyarenotconsideredtobeadjacentiftheirboundariesmeetonlyatafewpoints.

    2The story of the four-color proof is told in a well-reviewed recent popular (non-technical)book: Four ColorsSuffice.HowtheMapProblemwasSolved.RobinWilson.PrincetonUniv.Press,2003,276pp.ISBN0-691-11533-8.

    http://www.math.gatech.edu/~thomas/FC/fourcolor.htmlhttp://www.math.gatech.edu/~thomas/FC/fourcolor.htmlhttp://www.math.gatech.edu/~thomas/FC/fourcolor.htmlhttp://www.math.gatech.edu/~thomas/FC/fourcolor.html
  • 7/30/2019 Ln1 - Proofs

    4/18

    4 CourseNotes,Week1:ProofsThereareseveralcommontermsforapropositionthathasbeenproved.Thedifferenttermshintattheroleofthepropositionwithinalargerbodyofwork.

    Importantpropositionsarecalledtheorems. Alemmaisapreliminarypropositionusefulforprovinglaterpropositions. Acorollaryisanafterthought,apropositionthatfollowsinjustafewlogicalstepsfroma

    theorem.Thedefinitionsarenotprecise.Infact,sometimesagoodlemmaturnsouttobefarmoreimportantthanthetheoremitwasoriginallyusedtoprove.Euclidsaxiom-and-proofapproach,nowcalledtheaxiomaticmethod,isthefoundationformath-ematicstoday. Infact,therearejustahandfulofaxioms,calledZFC,which,togetherwithafewlogicaldeductionrules,appeartobesufficienttoderiveessentiallyallofmathematics.

    3.1 OurAxiomsTheZFCaxiomsareimportantinstudyingandjustifyingthefoundationsofMathematics. Butforpracticalpurposes,theyaremuchtooprimitivebyonereckoning,provingthat2 + 2 = 4requiresmorethan20,000steps!SoinsteadofstartingwithZFC,weregoingtotakeahugesetofaxiomsasourfoundation:wellacceptallfamiliarfactsfromhighschoolmath!Thiswillgiveusaquicklaunch,butyouwillfindthisimprecisespecificationoftheaxiomstrou-blingattimes. Forexample,inthemidstofaproof,youmayfindyourselfwondering,MustIprove

    this

    little

    fact

    or

    can

    Itake

    it

    as

    an

    axiom?

    Feel

    free

    to

    ask

    for

    guidance,

    but

    really

    there

    is

    no

    absoluteanswer.Justbeupfrontaboutwhatyoureassuming,anddonttrytoevadehomeworkandexamproblemsbydeclaringeverythinganaxiom!

    3.2 ProofsinPracticeInprinciple,aproofcanbeanysequenceoflogicaldeductionsfromaxiomsandpreviously-proved statementsthatconcludeswiththepropositioninquestion.Thisfreedominconstructingaproofcanseemoverwhelmingatfirst.Howdoyouevenstartaproof?Heresthegoodnews:manyproofsfollowoneofahandfulofstandardtemplates.Proofsalldifferinthedetails,ofcourse,butthesetemplatesatleastprovideyouwithanoutlinetofillin.Wellgothroughseveralofthesestandardpatterns,pointingoutthebasicideaandcommonpitfallsandgivingsomeexamples.Manyofthesetemplatesfittogether;onemaygiveyouatop-leveloutlinewhileothershelpyouatthenextlevelofdetail. Andwellshowyouother,moresophisticatedprooftechniqueslateron.Therecipesbelowareveryspecificattimes,tellingyouexactlywhichwordstowritedownonyourpieceofpaper. Yourecertainlyfreetosaythingsyourownwayinstead;werejustgivingyousomethingyoucouldsaysothatyoureneveratacompleteloss.

  • 7/30/2019 Ln1 - Proofs

    5/18

    5CourseNotes,Week1:Proofs

    TheZFCAxiomsFortherecord, we listtheaxiomsofZermelo-FrankelSetTheory.

    Essentially all of mathematics canbe derived from these axioms to-getherwithafewlogicaldeductionrules.Extensionality. Twosetsareequaliftheyhavethesamemembers. In

    formallogicalnotation,thiswouldbestatedas:(z. (z x = y.z y)) x

    Pairing. Foranytwosetsx andy,thereisaset,{x, y

    },withx andy as

    itsonlyelements.Union. Theunionofacollection,z,ofsetsisalsoaset.

    ux. (y. x y y z) x u.Infinity. There isaninfiniteset; specifically,anonemptyset,x, such

    thatforanysety x,theset{y}isalsoamemberofxSubset. Givenanyset,x,andanypropositionP(y),thereisasetcon-

    tainingpreciselythoseelementsy x forwhichP(y) holds.PowerSet. Allthesubsetsofasetformanotherset.Replacement. Theimageofasetunderafunctionisaset.Foundation. Foreverynon-emptyset,x,thereisasety x suchthat

    x andy aredisjoint.(Inparticular,thisaxiompreventsasetfrombeingamemberofitself.)

    Choice. We can choose one element from each set in a collection ofnonempty sets. Moreprecisely, iff isa functiononaset, andthe result of applying f to any element in the set is alwaysa nonempty set, then there is a choice function g such thatg(y) y foreveryy intheset.

    WerenotgoingtobeworkingwiththeZFCaxiomsinthiscourse.Wejustthoughtyoumightliketoseethem.

  • 7/30/2019 Ln1 - Proofs

    6/18

    6 CourseNotes,Week1:Proofs4 ProvinganImplicationAnenormousnumberofmathematicalclaimshavetheformIfP,thenQor,equivalently,PimpliesQ.Herearesomeexamples:

    (QuadraticFormula)Ifax2 + bx + c = 0 anda = 0,thenx = (b b2 4ac)/2a. (GoldbachsConjecture)Ifn isanevenintegergreaterthan2,thenn isasumoftwoprimes. If0 x 2,thenx3 + 4x + 1 > 0.

    Thereareacouplestandardmethodsforprovinganimplication.4.1 Method#1InordertoprovethatPimpliesQ:

    1. Write,AssumeP.2. ShowthatQ logicallyfollows.

    ExampleTheorem4.1. If0 x 2,thenx3 + 4x + 1 > 0.Beforewewriteaproofofthistheorem,wehavetodosomescratchworktofigureoutwhyitistrue.Theinequalitycertainlyholdsforx = 0;thentheleftsideisequalto1and1 > 0.Asx grows,the4x term

    (which

    is

    positive)

    initially

    seems

    to

    have

    greater

    magnitude

    than

    x

    3

    (whichis

    negative).

    Forexample,whenx = 1,wehave4x = 4,butx3 = 1 only. Infact,itlookslikex3 doesntbegintodominateuntilx > 2. So itseemsthex3 + 4x partshouldbenonnegativeforallxbetween0and2,whichwouldimplythatx3 + 4x + 1 ispositive.So far, so good. But we still have to replace all those seems like phrases with solid, logicalarguments. Wecangetabetterhandleonthecriticalx3 + 4x partbyfactoringit,whichisnottoohard:

    2x3 + 4x = x(2 x)(2+ x)Aha! Forx between0and2,allofthetermsontherightsidearenonnegative. Andaproductofnonnegativetermsisalsononnegative.Letsorganizethisblizzardofobservationsintoacleanproof.Proof. Assume0 x 2.Thenx,2 x,and2 + x areallnonnegative.Therefore,theproductofthesetermsisalsononnegative.Adding1tothisproductgivesapositivenumber,so:

    x(2 x)(2 + x) + 1 > 0Multiplyingoutontheleftsideprovesthat

    x3 + 4x + 1 > 0asclaimed.

  • 7/30/2019 Ln1 - Proofs

    7/18

    CourseNotes,Week1:Proofs 7Thereareacouplepointsherethatapplytoallproofs:

    Youlloftenneedtodosomescratchworkwhileyouretryingtofigureoutthelogicalstepsofaproof.Yourscratchworkcanbeasdisorganizedasyoulikefullofdead-ends,strangediagrams,obscenewords,whatever. Butkeepyourscratchworkseparatefromyourfinalproof,whichshouldbeclearandconcise.

    ProofstypicallybeginwiththewordProofandendwithsomesortofdoohickeylikeorq.e.d.Theonlypurposefortheseconventionsistoclarifywhereproofsbeginandend.

    4.2 Method#2- ProvetheContrapositiveAnimplication(PimpliesQ)islogicallyequivalenttoitscontrapositivenotQ impliesnotP;provingoneisasgoodasprovingtheother. Andoftenprovingthecontrapositiveiseasierthanprovingtheoriginalstatement.Ifso,thenyoucanproceedasfollows:

    1. Write,Weprovethecontrapositive:andthenstatethecontrapositive.2. ProceedasinMethod#1.

    ExampleTheorem4.2. Ifr isirrational,thenr isalsoirrational.Recallthatrationalnumbersareequaltoaratioofintegersandirrationalnumbersarenot.Sowemustshowthatifr isnotaratioofintegers,thenr isalsonotaratioofintegers. Thatsprettyconvoluted! Wecaneliminatebothnotsandmaketheproofstraightforwardbyconsideringthecontrapositiveinstead.Proof. Weprovethecontrapositive:ifr isrational,thenr isrational.Assumethatr isrational.Thenthereexistsintegersa andb suchthat:

    ar =

    b

    Squaringbothsidesgives:2a

    r =b2

    Sincea2 andb2 areintegers,r isalsorational.

    5

    Provingan

    If

    and

    Only

    If

    Manymathematicaltheoremsassertthattwostatementsarelogicallyequivalent;thatis,oneholdsifandonlyiftheotherdoes.Herearesomeexamples:

    Anintegerisamultipleof3ifandonlyifthesumofitsdigitsisamultipleof3. Twotriangleshavethesamesidelengthsifandonlyifallanglesarethesame. Apositiveintegerp 2 isprimeifandonlyif1 + (p 1) (p 2) 3 2 1 isamultipleofp.

  • 7/30/2019 Ln1 - Proofs

    8/18

    8 CourseNotes,Week1:Proofs5.1 Method#1:ProveEachStatementImpliestheOtherThestatementP if andonly ifQ isequivalent to the twostatementsP impliesQandQimpliesP.Soyoucanproveanifandonlyifbyprovingtwoimplications:

    1. Write,WeprovePimpliesQ andvice-versa.2. Write,First,weshowPimpliesQ.DothisbyoneofthemethodsinSection4.3. Write,Now,weshowQ impliesP.Again,dothisbyoneofthemethodsinSection4.

    ExampleTwosetsaredefinedtobeequaliftheycontainthesameelements;thatis,X= Y meansz Xifandonlyifz Y. (ThisisactuallythefirstoftheZFCaxioms.) Sosetequalitytheoremscanbestatedandprovedasifandonlyiftheorems.Theorem5.1(DeMorgansLawforSets). LetA,B,andCbesets.Then:

    A (B C) = (A B) (A C)Proof. Weshowz A (B C) impliesz (A B) (A C) andvice-versa.First,weshowz A(B C) impliesz (AB)(AC).Assumez A(BC).Thenz isinA andz isalsoinB orC.Thus,z isineitherA B orA C,whichimpliesz (A B)(A C).Now,weshowz (A B) (A C) impliesz A (B C). Assumez (A B) (A C).Thenz isinbothA andB orelsez isinbothA andC.Thus,z isinA andz isalsoinB orC.Thisimpliesz A (B C).5.2 Method#2:ConstructaChainofIffsInordertoprovethatPistrueifandonlyifQ istrue:

    1. Write,Weconstructachainofif-and-only-ifimplications.2. ProvePisequivalenttoasecondstatementwhichisequivalenttoathirdstaementandso

    forthuntilyoureachQ.Thismethodisgenerallymoredifficultthanthefirst,buttheresultcanbeashort,elegantproof.

    ExampleThestandarddeviationofasequenceofvaluesx1, x2, . . . , xn isdefinedtobe:

    2(x1 )2 + (x1 )2 + . . . + (xn )where istheaverageofthevalues:

    x1 + x2 + . . . + xn =

    n

  • 7/30/2019 Ln1 - Proofs

    9/18

    CourseNotes,Week1:Proofs 9Theorem5.2. Thestandarddeviationofasequenceofvaluesx1, . . . , xn iszeroifandonlyifallthevaluesareequaltothemean.Forexample,thestandarddeviationoftestscoresiszeroifandonlyifeveryonescoredexactlytheclassaverage.Proof. Weconstructachainofifandonlyifimplications. Thestandarddeviationofx1, . . . , xniszeroifandonlyif:

    (x1 )2 + (x1 )2 + . . . + (xn )2 = 0where istheaverageofx1, . . . , xn.Thisequationholdsifandonlyif

    (x1 )2 + (x1 )2 + . . . + (xn )2 = 0sincezeroistheonlynumberwhosesquarerootiszero. Everyterminthisequationisnonnega-tive,sothisequationholdsifandonlyeverytermisactually0.Butthisistrueifandonlyifeveryvaluexi isequaltothemean.Problem1. ReformulatetheproofDeMorgansLawforSetsasachainofif-and-only-ifimplica-tions.

    6 HowtoWriteGoodProofsThepurposeofaproof is toprovide thereaderwithdefinitiveevidenceofanassertions truth.Toservethispurposeeffectively,moreisrequiredofaproofthanjustlogicalcorrectness: agoodproofmustalsobeclear. Thesegoalsareusuallycomplimentary; awell-writtenproof ismorelikelytobeacorrectproof,sincemistakesarehardertohide.Inpractice,thenotionofproofisamovingtarget. Proofsinaprofessionalresearchjournalaregenerallyunintelligibletoallbutafewexpertswhoknowallthelemmasandtheoremsassumed,oftenwithoutexplicitmention,intheproof. Andproofsinthefirstweeksofabeginningcourselike6.042wouldberegardedastediouslylong-windedbyaprofessionalmathematician. Infact,whatweacceptasagoodprooflaterinthetermwillbedifferentfromwhatweconsidergoodproofsinthefirstcoupleofweeksof6.042.Butevenso,wecanoffersomegeneraltipsonwritinggoodproofs:Stateyourgameplan. Agoodproofbeginsbyexplainingthegenerallineofreasoning,e.g.We

    usecaseanalysisorWearguebycontradiction. Thiscreatesaroughmentalpictureintowhichthereadercanfitthesubsequentdetails.

    Keepalinearflow. Wesometimesseeproofsthatarelikemathematicalmosaics,withjuicytidbitsofreasoningsprinkledacrossthepage.Thisisnotgood.Thestepsofyourargumentshouldfollowoneanotherinasequentialorder.

    Aproofisanessay,notacalculation. Manystudentsinitiallywriteproofsthewaytheycomputeintegrals. The result is a long sequence of expressions without explantion. This isbad.Agood proofusually looks likean essaywithsome equations thrown in. Usecompletesentences.

  • 7/30/2019 Ln1 - Proofs

    10/18

    10 CourseNotes,Week1:ProofsAvoidexcessivesymbolism. Yourreader isprobablygoodat understanding words,butmuch

    lessskilledatreadingarcanemathematicalsymbols. Sousewordswhereyoureasonablycan.

    Simplify. Long,complicatedproofstakethereadermoretimeandefforttounderstandandcanmoreeasilyconcealerrors.Soaproofwithfewerlogicalstepsisabetterproof.

    Introducenotationthoughtfully. Sometimesanargumentcanbegreatlysimplifiedbyintroduc-ingavariable, devisingaspecialnotation,ordefininganewterm. Butdothissparinglysinceyourerequiringthereadertorememberallthatnewstuff.Andremembertoactuallydefinethemeaningsofnewvariables,terms,ornotations;dontjuststartusingthem!

    Structurelongproofs. Longprogramsareusuallybrokenintoaheirarchyofsmallerprocedures.Longproofsaremuchthesame. Factsneededinyourproofthatareeasilystated,butnotreadily proved arebest pulled out and proved in preliminary lemmas. Also, if you arerepeatingessentiallythesameargumentoverandover, trytocapturethatargument inagenerallemma,whichyoucanciterepeatedlyinstead.

    Dontbully. Dontusephraseslikeclearlyorobviouslyinanattempttobullythereaderintoacceptingsomethingwhichyourehavingtroubleproving. Also,goonthealertwheneveryouseeoneofthesephrasesissomeoneelsesproof.

    Finish. Atsomepointinaproof,youllhaveestablishedalltheessentialfactsyouneed.Resistthetemptationtoquitandleavethereadertodrawtheobviousconclusion. Whatisobvioustoyouastheauthorisnotlikelytobeobvioustothereader.Instead,tieeverythingtogetheryourselfandexplainwhytheoriginalclaimfollows.

    Theanalogybetweengoodproofsandgoodprogramsextendsbeyondstructure. Thesamerig-orous thinking needed for proofs is essential in the design ofcritical computersystem. Whenalgorithmsandprotocolsonlymostlyworkduetorelianceonhand-wavingarguments,there-sultscanrangefromproblematictocatastrophic.AnearlyexamplewastheTherac25,amachinethatprovidedradiationtherapytocancervictims,butoccasionallykilledthemwithmassiveover-dosesduetoasoftwareracecondition. Morerecently,inAugust2004,asinglefaultycommandtoacomputersystemusedbyUnitedandAmericanAirlinesgroundedtheentirefleetofbothcompaniesandalltheirpassengers!It isacertaintythatwellallonedaybeatthemercyofcriticalcomputersystemsdesignedbyyouandyourclassmates.Sowereallyhopethatyoulldeveloptheabilitytoformulaterock-solidlogicalargumentsthatasystemactuallydoeswhatyouthinkitdoes!

    7 PropositionalFormulasItsreallysortofamazingthatpeoplemanagetocommunicateintheEnglishlanguage. Herearesometypicalsentences:

    1. Youmayhavecakeoryoumayhaveicecream.2. Ifpigscanfly,thenyoucanunderstandtheChernoffbound.

  • 7/30/2019 Ln1 - Proofs

    11/18

    CourseNotes,Week1:Proofs 113. Ifyoucansolveanyproblemwecomeupwith,thenyougetanAforthecourse.4. EveryAmericanhasadream.

    Whatpreciselydothesesentencesmean?Canyouhavebothcakeandicecreamormustyouchoosejustonedesert? Ifthesecondsentenceistrue,thenistheChernoffboundincomprehensible? Ifyoucansolvesomeproblemswecomeupwithbutnotall,thendoyougetanAforthecourse?AndcanyoustillgetanAevenifyoucantsolveanyoftheproblems? DoesthelastsentenceimplythatallAmericanshavethesamedreamormighttheyeachhaveadifferentdream?Some uncertainty is tolerable in normal conversation. But when we need to formulate ideasprecisely as in mathematics the ambiguities inherent in everyday languagebecome a realproblem. Wecanthopetomakeanexactargumentifwerenotsureexactlywhattheindividualwordsmean.(And,nottoalarmyou,butitispossiblethatwellbemakinganawfullotofexactingmathematicalargumentsintheweeksahead.) Sobeforewestartintomathematics,weneedtoinvestigatetheproblemofhowtotalkaboutmathematics.TogetaroundtheambiguityofEnglish, mathematicianshavedevisedaspecialmini-languagefortalkingabout logicalrelationships. This languagemostlyusesordinaryEnglishwordsandphrasessuchasor,implies,andforall. Butmathematiciansendowthesewordswithdef-initionsmoreprecisethanthosefoundinanordinarydictionary. Withoutknowingthesedefini-tions,youcouldsortofreadthislanguage,butyouwouldmissallthesubtletiesandsometimeshavetroublefollowingalong.Surprisingly,inthemidstoflearningthelanguageoflogic,wellcomeacrossthemostimportantopenproblemincomputerscienceaproblemwhosesolutioncouldchangetheworld.7.1 CombiningPropositionsInEnglish, wecanmodify, combine, andrelatepropositionswithwordssuchasnot, and,or,implies,andif-then.Forexample,wecancombinethreepropositionsintoonelikethis:

    IfallhumansaremortalandallGreeksarehuman,thenallGreeksaremortal.For thenextwhile, wewontbemuchconcernedwith the internalsofpropositionswhethertheyinvolvemathematicsorGreekmortalitybutratherwithhowpropositionsarecombinedandrelated. SowellfrequentlyusevariablessuchasPandQ inplaceofspecificpropositionssuchasAllhumansaremortaland2 + 3 = 5. Theunderstanding isthat thesevariables,likepropositions,cantakeononlythevaluesT(true)andF(false). Suchtrue/falsevariablesaresometimescalledBooleanvariablesaftertheirinventor,GeorgeyouguesseditBoole.7.1.1 Not,AndandOrWe can precisely define these special words using truth tables. For example, ifP denotes anarbitraryproposition,thenthetruthofthepropositionnotPisdefinedbythefollowingtruthtable:

    P notPT F

    F T

  • 7/30/2019 Ln1 - Proofs

    12/18

    12 CourseNotes,Week1:ProofsThefirstrowofthetable indicatesthatwhenpropositionP is true, thepropositionnotP isfalse(F).ThesecondlineindicatesthatwhenPisfalse,notPistrue.Thisisprobablywhatyouwouldexpect.Ingeneral,atruthtableindicatesthetrue/falsevalueofapropositionforeachpossiblesettingofthe

    variables.

    For

    example,

    the

    truth

    table

    for

    the

    proposition

    Pand

    Q

    has

    four

    lines,

    since

    the

    twovariablescanbesetinfourdifferentways:

    P QT T T

    T F F

    F T F

    F F F

    PandQ

    Accordingtothistable,thepropositionPandQistrueonlywhenPandQ arebothtrue.Thisisprobablyreflectsthewayyouthinkaboutthewordand.ThereisasubtletyinthetruthtableforPorQ:

    P Q

    T T T

    T F T

    F T T

    F F F

    PorQ

    ThissaysthatPorQistruewhenP istrue,Q istrue,orbotharetrue. Thisisntalwaystheintendedmeaningoforineverydayspeech,butthisisthestandarddefinitioninmathematicalwriting. Soifamathematiciansays,Youmayhavecakeoryourmayhaveicecream,thenyoucouldhaveboth.7.1.2 ImpliesTheleastintuitiveconnectingwordisimplies. MathematiciansregardthepropositionsPim-pliesQ and ifP thenQassynonymous, sobothhave the same truth table. (The lines arenumberedsowecanrefertothethemlater.)

    P Q1. T T T2. T F F3. F T T4. F F T

    PimpliesQ,ifPthenQ

    Letsexperimentwiththisdefinition.Forexample,isthefollowingpropositiontrueorfalse?IfGoldbachsConjectureistrue,thenx2 0 foreveryrealnumberx.

    Now,wetoldyoubeforethatnooneknowswhetherGoldbachsConjectureistrueorfalse. Butthatdoesntpreventyoufromansweringthequestion! ThispropositionhastheformP Q

  • 7/30/2019 Ln1 - Proofs

    13/18

    CourseNotes,Week1:Proofs 13wherePisGoldbachsConjectureistrueandQ isx2 0 foreveryrealnumberx.SinceQ isdefinitelytrue,wereoneitherline1orline3ofthetruthtable. Eitherway,thepropositionasawholeistrue!Oneofouroriginalexamplesdemonstratesanevenstrangersideofimplications.

    Ifpigsfly,thenyoucanunderstandtheChernoffbound.Donttakethisasaninsult;wejustneedtofigureoutwhetherthispropositionistrueorfalse.Curiously, theanswerhasnothingtodowithwhetherornotyoucanunderstandtheChernoffbound. Pigsdonotfly, sowereoneither line3or line4ofthetruthtable. Inbothcases, thepropositionistrue!Incontrast,heresanexampleofafalseimplication:

    Ifthemoonshineswhite,thenthemoonismadeofwhitecheddar.Yes,themoonshineswhite. But,no,themoonisnotmadeofwhitecheddarcheese. Sowereonline2ofthetruthtable,andthepropositionisfalse.Thetruthtableforimplicationscanbesummarizedinwordsasfollows:

    Animplicationistruewhentheif-partisfalseorthethen-partistrue.Thissentence is worth remembering; a large fraction ofall mathematicalstatementsare of theif-thenform!

    7.1.3 IfandOnlyIfMathematicianscommonlyjoinpropositionsinoneadditionalwaythatdoesntariseinordinaryspeech.ThepropositionPifandonlyifQassertsthatPandQ arelogicallyequivalent;thatis,eitherbotharetrueorbotharefalse.

    P QT T T

    T F F

    F T F

    F F T

    PifandonlyifQ

    Thefollowingif-and-only-ifstatementistrueforeveryrealnumberx:x2 4 0 ifandonlyif x 2| |

    Forsomevaluesofx,bothinequalitiesaretrue.Forothervaluesofx,neitherinequalityistrue.Ineverycase,however,thepropositionasawholeistrue.Thephraseifandonlyifcomesupsooftenthatitisoftenabbreviatediff.

  • 7/30/2019 Ln1 - Proofs

    14/18

    14 CourseNotes,Week1:Proofs7.2 PropositionalLogicinComputerProgramsPropositionsandlogicalconnectivesariseallthetimeincomputerprograms. Forexample,con-siderthefollowingsnippet,whichcouldbeeitherC,C++,orJava:

    if ( x > 0 || (x 100) )...(furtherinstructions)

    Thesymbol||denotesor,andthesymbol&&denotesand.Thefurtherinstructionsarecarriedoutonlyifthepropositionfollowingthewordifistrue.Oncloserinspection,thisbigexpressionisbuilt from twosimplerpropositions. LetA be theproposition that x > 0, and letB bethepropositionthaty > 100.Thenwecanrewritetheconditionthisway:

    A or((notA) andB)A

    truth

    table

    reveals

    that

    this

    complicated

    expression

    is

    logically

    equivalent

    to

    A or

    B.

    A B

    T T T T

    T F T T

    F T T T

    F F F F

    A or((notA) andB) A orB

    Thismeansthatwecansimplifythecodesnippetwithoutchangingtheprogramsbehavior:if ( x > 0 || y > 100 )

    (furtherinstructions)Rewritingalogicalexpressioninvolvingmanyvariablesinthesimplestformisbothdifficultandimportant.Simplifyingexpressionsinsoftwaremightslightlyincreasethespeedofyourprogram.But,moresignificantly,chipdesignersfaceessentiallythesamechallenge. However, insteadofminimizing&&and||symbolsinaprogram,theirjobistominimizethenumberofanalogousphyscial devices on a chip. The payoff is potentially enormous: a chip with fewer devices issmaller,consumeslesspower,hasalowerdefectrate,andischeapertomanufacture.7.3 ACrypticNotationProgramminglanguagesusesymbolslike&& and! inplaceofwordslikeandandnot.Math-ematicianshavedevisedtheirowncrypticsymbolstorepresentthesewords,whicharesumma-rizedinthetablebelow.

    English CrypticNotationnotP P (alternatively,P)

    P

    PandQPorQ

    impliesQorifPthenQPifandonlyifQ

    PQPQ

    PQPQ

    http://theory.csail.mit.edu/classes/6.042/fall05/ln1.pdf#AAB.snippet
  • 7/30/2019 Ln1 - Proofs

    15/18

    CourseNotes,Week1:Proofs 15Forexample,usingthisnotation,IfPandnotQ,thenRwouldbewritten:

    (PQ) RThissymboliclanguageishelpfulforwritingcomplicatedlogicalexpressionscompactly. Butinmostcontextsordinarywordssuchasorandimpliesaremucheasier tounderstand thansymbolssuchasand. Sowellusethissymboliclanguagesparingly,andweadviseyoutodothesame.7.4 LogicallyEquivalentImplicationsArethesetwosentencessayingthesamething?

    IfIamhungry,thenIamgrumpy.IfIamnotgrumpy,thenIamnothungry.

    Wecansettletheissuebyrecastingbothsentencesintermsofpropositionallogic. LetPbethepropositionIamhungry,andletQ beIamgrumpy. ThefirstsentencesaysP impliesQandthesecondsays(notQ)implies(notP). Wecancomparethesetwostatementsinatruthtable:

    P

    T T T T

    T F F F

    F T T T

    F F T T

    Q PimpliesQ (notQ)implies(notP)

    Sureenough,thetwostatementsarepreciselyequivalent.Ingeneral,(notQ)implies(notP)iscalledthecontrapositiveofP impliesQ. And,aswevejustshown,thetwoarejustdifferentwaysofsayingthesamething. Thisequivalenceismildlyusefulinprogramming,mathematicalarguments,andeveneverydayspeech,becauseyoucanalwayspickwhicheverofthetwoiseasiertosayorwrite.Incontrast,theconverseofPimpliesQisthestatementQ impliesP.Intermsofourexample,theconverseis:

    IfIamgrumpy,thenIamhungry.Thissoundslikearatherdifferentcontention,andatruthtableconfirmsthissuspicion:

    P

    T T T TT F F T

    F T T F

    F F T T

    Q PimpliesQ Q impliesP

    Thus,animplicationislogicallyequivalenttoitscontrapositive,butisnotequivalenttoitscon-verse.Onefinalrelationship:animplicationanditsconversetogetherareequivalenttoanifandonlyifstatement,specifically,tothesetwostatementstogether.Forexample,

  • 7/30/2019 Ln1 - Proofs

    16/18

    16 CourseNotes,Week1:ProofsIfIamgrumpy,thenIamhungry.IfIamhungry,thenIamgrumpy.

    areequivalenttothesinglestatement:IamgrumpyifandonlyifIamhungry.

    Onceagain,wecanverifythiswithatruthtable:P

    T T T T

    T F F F

    F T F F

    F F T T

    Q (PimpliesQ)and(Q impliesP) Q ifandonlyifP

    8 LogicalDeductionsLogicaldeductionsorinferencerulesareusedtoprovenewpropositionsusingpreviouslyprovedones.Afundamentalinferencerule ismodusponens. ThisrulesaysthataproofofP togetherwithaproofofPQ isaproofofQ.Inferencerulesaresometimeswritteninafunnynotation.Forexample,modusponensiswritten:Rule.

    P, P

    QQ

    Whenthestatementsabovetheline,calledtheantecedents,areproved,thenwecanconsiderthestatementbelowtheline,calledtheconclusionorconsequent,toalsobeproved.Akeyrequirementofaninferenceruleisthatitmustbesound: anyassignmentoftruthvaluesthatmakesalltheantecedentstruemustalsomaketheconsequenttrue. Soitwestartoffwithtrueaxiomsandapplysoundinferencerules,everythingweprovewillalsobetrue.Therearemanyothernatural,soundinferencerules,forexample:Rule.

    P

    Q, Q

    RPR

    Rule.PQ, Q

    P

    Rule.P Q Q P

  • 7/30/2019 Ln1 - Proofs

    17/18

    17CourseNotes,Week1:Proofs

    SATApropositionissatisfiableifsomesettingofthevariablesmakes

    theproposition true. Forexample,PQ issatisfiablebecausetheexpressionistruewhenP istrueandQ isfalse. Ontheotherhand,P PisnotsatisfiablebecausetheexpressionasawholeisfalseforbothsettingsofP.Butdeterminingwhetherornotamorecomplicatedpropositionissatisfiableisnotsoeasy.Howaboutthisone?

    (P Q R) (P Q) (P R) (R Q)

    ThegeneralproblemofdecidingwhetherapropositionissatisfiableiscalledSAT.Oneapproach toSAT is toconstructa truth tableandcheckwhetherornotaT everappears. Butthisapproachisnotveryefficient;apropositionwithn variableshasatruthtablewith2n lines.Forapropositionwithjust30variables,thatsalreadyoverabillion!

    IsthereanefficientsolutiontoSAT?Istheresomeingeniousproce-dure thatquicklydetermines whether any given proposition is satifi-ableornot?Nooneknows.Andanawfullothangsontheanswer.AnefficientsolutiontoSATwouldimmediatelyimplyefficientsolutionstomany,manyotherimportantproblemsinvolvingpacking,schedul-ing,routing,andcircuitverification. Thissoundsfantastic,buttherewouldalsobeworldwidechaos. Decryptingcodedmessageswouldalsobecomeaneasy task (formost codes). Onlinefinancial transac-tionswouldbeinsecureandsecretcommunicationscouldbereadbyeveryone.

    Atpresent,though,researchersarecompletelystuck. NoonehasagoodideahowtoeithersolveSATmoreefficientlyortoprovethatnoefficientsolutionexists. Thisistheoutstandingunansweredquestionincomputerscience.

  • 7/30/2019 Ln1 - Proofs

    18/18

    18 CourseNotes,Week1:ProofsOntheotherhand,Rule.

    PQPQ

    isnotsound:ifPisassignedT andQ isassignedF,thentheantecedentistrueandtheconsequentisnot.Problem2. Provethatapropositionalinferenceruleissoundifftheconjunction(AND)ofallitsantecedentsimpliesitsconsequent.Aswithaxioms,wewillnotbetooformalaboutthesetoflegalinferencerules. Eachstepinaproofshouldbeclearandlogical;inparticular,youshouldstatewhatpreviouslyprovedfactsareusedtoderiveeachnewconclusion.