/
When Can You Fold a Map When Can You Fold a Map

When Can You Fold a Map - PDF document

giovanna-bartolotta
giovanna-bartolotta . @giovanna-bartolotta
Follow
376 views
Uploaded On 2017-09-10

When Can You Fold a Map - PPT Presentation

Figure1SamplecreasepatternsLefttheclassiccraneRightpatternofHull13whichcannotbefolded ID: 90673

Figure1:Samplecreasepatterns.Left:theclassiccrane.Right:patternofHull[13] whichcannotbefolded

Share:

Link:

Embed:

Download Presentation from below link

Download Pdf The PPT/PDF document "When Can You Fold a Map" is the property of its rightful owner. Permission is granted to download and print the materials on this web site for personal, non-commercial use only, and to display it on your personal computer provided you do not modify the materials and that you retain all copyright notices contained in the materials. By downloading content from our website, you accept the terms of this agreement.


Presentation Transcript

WhenCanYouFoldaMap?EstherM.Arkin¤MichaelA.BenderyErikD.DemainezMartinL.DemainezJosephS.B.Mitchell¤SaurabhSethiayStevenS.SkienaxAbstractWeexplorethefollowingproblem:givenacollectionofcreasesonapieceofpaper,eachassignedafoldingdirectionofmountainorvalley,istherea°atfoldingbyasequenceofsimplefolds?Thereareseveralmodelsofsimplefolds;thesimplestone-layersimplefoldrotatesaportionofpaperaboutacreaseinthepaperby§180±.We¯rstconsidertheanalogousquestionsinonedimensionlower|bendingasegmentintoa°atobject|whichleadtointerestingproblemsonstrings.Wedevelope±cientalgorithmsfortherecognitionofsimplyfoldable1Dcreasepatterns,andreconstructionofasequenceofsimplefolds.Indeed,weprovethata1Dcreasepatternis°at-foldablebyanymeanspreciselyifitisbyasequenceofone-layersimplefolds.Nextweexploresimplefoldabilityintwodimensions,and¯ndasurprisingcontrast:\map"foldingandvariantsarepolynomial,butslightgeneralizationsareNP-complete.Speci¯cally,wedevelopalinear-timealgorithmfordecidingfoldabilityofanorthogonalcreasepatternonarectangularpieceofpaper,andprovethatitis(weakly)NP-completetodecidefoldabilityof(1)anorthogonalcreasepatternonaorthogonalpieceofpaper,(2)acreasepatternofaxis-parallelanddiagonal(45-degree)creasesonasquarepieceofpaper,and(3)creasepatternswithoutamountain/valleyassignment.1IntroductionTheeasiestwaytorefoldaroadmapisdi®erently.|Jones'sRuleoftheRoad(M.Gardner[10])Perhapsthebest-studiedprobleminorigamimathematicsisthecharacterizationof°at-foldablecreasepatterns.Acreasepatternisastraight-edgeembeddingofagraphonapolygonalpieceofpaper;a°atfoldingmustfoldalongalloftheedgesofthegraph,butnomore.Forexample,twocreasepatternsareshowninFigure1.The¯rstonefolds°atintoaclassicorigamicrane,whereasthesecondonecannotbefolded°at(unlessthepaperisallowedtopassthroughitself),eventhougheveryvertexcanbe\locally"°atfolded.Thealgorithmicversionofthisproblemistodeterminewhetheragivencreasepatternis°at-foldable.Thecreasepatternmayalsohaveadirectionof\mountain"or\valley"assignedtoeachcrease,whichrestrictsthewayinwhichthecreasecanbefolded.(Our¯guresadheretothe¤DepartmentofAppliedMathematicsandStatistics,SUNY,StonyBrook,NY11794-3600,USA,email:festie,jsbmg@ams.sunysb.edu.yDepartmentofComputerScience,SUNY,StonyBrook,NY11794-4400,USA,email:fbender,saurabh,skienag@cs.sunysb.edu.zMITLaboratoryforComputerScience,200TechnologySquare,Cambridge,MA02139,USA,fedemaine,mdemaineg@mit.edu.xComputerScience,OregonStateUniversity,102DearbornHall,Corvallis,OR97331-3202,USA,saurabh@cs.orst.edu.1 Figure1:Samplecreasepatterns.Left:theclassiccrane.Right:patternofHull[13],whichcannotbefolded°at,foranymountain-valleyassignment.standardorigamiconventionthatvalleysaredrawnasdashedlinesandmountainsaredrawnasdot-dashedlines.)Itisknownthatthegeneralproblemofdeciding°atfoldabilityofacreasepatternisNP-hard[2].Inthispaper,weconsidertheimportantandverynaturalcaseofrecognizingcreasepatternsthatariseastheresultof°atfoldingsusingsimplefoldings.Inthismodel,a°atfoldingismadebyasequenceofsimplefolds,eachofwhichfoldsoneormorelayersofpaperalongasinglelinesegment.Figure2showsanexampleofasimplefolding.Aswede¯neinSection2,therearedi®erenttypesofsimplefolds(termed\one-layer",\some-layers",and\all-layers"),dependingonhowmanylayersofpaperarerequiredorallowedtobefoldedalongacrease.Figure2:Foldinga2£4mapviaasequenceof3simplefolds.Unsurprisingly,notevery°atfoldingcanbeachievedbyasimplefolding.Forexample,thecraneinFigure1(top)cannotbemadebyasimplefolding.Inparticular,thereisnouniformlymountainorvalleysegmentthatcouldserveasthe¯rstsimplefold.Also,thehardnessgadgetsof[2]requirenonsimplefoldswhichallowthepapertocurveduringfolding[6].Thus,thecomplexityofgeneral°atfoldabilityhasnodirectconnectiontosimplefoldability.Theproblemwestudyinthispaperisthatofdeterminingwhetheragivencreasepattern(usuallywithspeci¯edmountainandvalleyassignments)canbefolded°atbyasequenceofsimplefolds,andifso,toconstructsuchasequenceoffolds.Severalofourresultsarebasedonthespecialcaseinwhichthecreasesinthepieceofpaperareallparalleltooneanother.Thiscaseisequivalenttoaone-dimensionalfoldingproblemoffoldingalinesegment(\paper")accordingtoasetofprescribedcreasepoints(possiblylabeled\mountain"or\valley").Wewillthereforerefertothisspecialcase,whichhasarichstructureofitsown,asthe\1D"casetodistinguishitfromthegeneral2Dproblem.Incontrasttothe2Dproblem,weshowthat1D°atfoldabilityisequivalentto1Dsimplefoldability.Motivation.Inadditiontoitsinherentinterestinthemathematicsoforigami,ourstudyismo-tivatedbyapplicationsinsheetmetalandpaperproductmanufacturing,whereoneisinterestedindeterminingwhetheragivenstructurecanbemanufacturedusingagivenmachine.(Seerefer-encescitedbelow.)Whileorigamistscandevelopparticularskillinperformingnonsimplefoldsto2 makebeautifulartwork,practicalproblemsofmanufacturingwithsheetgoodsrequiresimpleandconstrainedfoldingoperations.Ourgoalistodevelopa¯rstsuiteofresultsthatmaybehelpfultowardsafulleralgorithmicunderstandingoftheseveralmanufacturingproblemsthatarise,e.g.,inmakingthree-dimensionalcardboardandsheet-metalstructures.RelatedWork.Ourproblemsarerelatedtotheclassiccombinatoricsquestionsofmapfold-ing[10,21].Thesequestionsaskforthenumberofdi®erent°atfoldingsofaparticularcreasepattern,namelyanm£nrectangulargrid,eitherbyasequenceofsimplefoldsorbyageneral°atfolding.Twofoldingsareusuallyconsidered\di®erent"inthiscontextiftheydi®erinthetotalorderofthefacesinthefolding.Thesequestionshavebeenstudiedextensively[10,21],particularlyintheone-dimensional(1£n)case[7,17,20,27],butremainlargelyunsolved.Incontrastwiththesecombinatorialquestions,westudythealgorithmiccomplexityofthedecisionproblems,andformoregeneralcreasepatterns.Themathematicalandalgorithmicproblemsarisinginthestudyof°atorigamihavebeenexaminedbyseveralresearchers,e.g.,Hull[13],Justin[14],Kawasaki[16],andLang[18].OfparticularrelevancetoourworkisthepaperbyBernandHayes[2],whichshowsthatthegeneralproblemofdeciding°atfoldabilityofacreasepatternisstronglyNP-hard.Demaineetal.[5]usedcomputationalgeometrytechniquestoshowthatanypolygonal(connected)silhouettecanbeobtainedbysimplefoldsfromarectangularpieceofpaper.Ourmodelofsimplefoldingisalsocloselyrelatedto\purelandorigami",arestrictionintroducedbySmith[24,25].Purelandfoldsincludesimplefolds,buttheyalsoallowpapertobe\tucked"intopockets,aswellas\openedup"intothreedimensionsprovidedthatnocreasesaremadeduringtheprocess.Therehasbeenquiteabitofworkontherelatedproblemsofmanufacturabilityofsheetmetalparts(seee.g.[28])andfoldingcartons(seee.g.[19]).ExistingCAD/CAMtechniques(includingBendCadandPART-S)relyonworst-caseexponential-timestatespacesearches(usingtheA¤algorithm).Ingeneral,theproblemofbendsequencegenerationisachallenging(andprovablyhard[1])coordinatedmotionplanningproblem.Forexample,LuandAkella[19]utilizeanovelcon¯guration-spaceformulationofthefoldingsequenceproblemforfoldingcartonsusing¯xtures;theirsearch,however,isstillworst-caseexponentialtime.Ourworkdi®ersfromthepriorworkonsheetmetalandcardboardbendinginthatthestructureswearefoldingareultimately\°at"intheirfoldedstates(allbendanglesintheinputcreasepatternare§180±,accordingtoamountain-valleyassignmentthatispartoftheinputcreasepattern).Also,weareconcernedonlywiththefeasibilityofthemotionofthe(sti®)materialthatisbeingfolded|doesitcollidewithitselfduringthefoldingmotion?Wearenotaddressingheretheissuesofreachabilitybythetoolsthatperformthefolding.Asweshow,evenwiththerestrictionsthatcomewiththeproblemswestudy,thereisarichmathematicalandalgorithmictheoryoffoldability.SummaryofOurResults.Wedevelopavarietyofnewalgorithmicresults(seeTable1):(1)Weanalyzethe1Done-layerandsome-layerscases,givingafullcharacterizationof°at-foldabilityandanO(n)algorithmfordecidingfoldabilityandproducingafoldingsequence,ifoneexists.(2)Weanalyzethe1Dall-layerscaseasa\stringfolding"problem.InadditiontoasimpleO(n2)algorithm,wegiveanalgorithmutilizingsu±xtreesthatrequirestimelinearinthebitcomplexityoftheinput,andarandomizedalgorithmwithexpectedO(n)runningtime.3 ModeloffoldingAll-layersSome-layersOne-layerGeneralDim.PaperCreasessimplefoldssimplefoldssimplefolds°atfolding1DO(n)rand.6´O(n)´O(n)´O(n)O(nlgn0)det.2DRectOrthoO(n)rand.6´O(n)6´O(n)6´Open[8]O(nlgn0)det.2DOrthoOrthoWeaklyWeaklyWeaklyOpenorSquareOrtho+45±NP-completeNP-completeNP-complete2DSquareGeneralStronglyNP-hard[2]Table1:Summaryofthecomplexitiesofdeciding°atfoldabilitybyvariousmodelsofsimplefolds,andbygeneral°atfoldings.Thesymbols´and6´denoteequivalencesandnonequivalencesbetweencertainmodels.Theabbreviations\rand."and\det."denoterandomizedanddeterministicalgorithms,respectively.(3)Wegiveanalgorithmfordecidingsimplefoldabilityoforthogonalcreasepatternsonarect-angularpieceofpaper1(the\mapfoldingproblem"),intheone-,some-,andall-layerscases,basedonandwiththesamerunningtimesasour1Dresults.(4)Weprovethatitis(weakly)NP-completetodecidesimplefoldabilityofanorthogonalcreasepatternonapieceofpaperthatismoregeneralthanarectangle:asimpleorthogonalpolygon.(5)Wealsoprovethatitis(weakly)NP-completetodecidesimplefoldabilityofasquarepieceofpaperwithacreasepatternthatincludesdiagonalcreases(angledat45±),inadditiontoaxis-parallelcreases.(6)Weshowthatitis(weakly)NP-completetodecidesimplefoldabilityofanorthogonalpieceofpaperhavingacreasepatternforwhichnomountain-valleyassignmentisgiven.Notethatourhardnessresultsdonotstrengthenthoseof[2],becausedecidingsimplefoldabilityisdi®erentfromdeciding°atfoldability.2De¯nitionsWeareconcernedwithfoldingsinoneandtwodimensions,althoughseveralofourde¯nitionsandresultsextendtohigherdimensions.Aone-dimensionalpieceofpaperisa(line)segmentinR1.Atwo-dimensionalpieceofpaperisa(connected)polygoninR2,possiblywithholes.Inbothcases,thepaperisfoldedthroughonedimensionhigherthantheobject;thus,segmentsarefoldedthroughR2andpolygonsarefoldedthroughR3.Creaseshaveonelessdimension;thus,acreaseisapointonasegmentandalinesegmentonapolygon.Acreasepatternisacollectionofcreasesonthepieceofpaper,notwoofwhichintersectexceptatacommonendpoint.Afoldingofacreasepatternisanisometricembeddingofthepieceofpaper,bentalongeverycreaseinthecreasepattern(andnotbentalonganysegmentthatisnotacrease).Inparticular,eachfacetofpapermustbemappedtoacongruentcopy,theconnectivitybetweenfacetsmustbepreserved,andthepapercannotcrossitself,althoughmultiplelayersofpapermaytouch.SeeFigure3.1Throughoutthispaper,thenotionsof\orthogonal"and\rectangular"implicitlyrequireaxis-parallelismwithacommonsetofaxes.4 Figure3:Samplenon°atfoldingsinoneandtwodimensions.A°atfoldinghastheadditionalpropertythatitliesinthesamespaceastheunfoldedpieceofpaper.Thatis,a°atfoldingofasegmentliesinR1,anda°atfoldingofapolygonliesinR2.Inreality,therecanbemultiplelayersofpaperatapoint,sothefoldingreallyoccupiesa¯nitenumberofin¯nitesimallyclosecopiesofR1orR2.SeeFigure4.Moreformally,a°atfoldingcanbespeci¯edbyafunctionmappingtheverticestotheirfoldedpositions,togetherwithapartialorderofthefacetsofpaperthatspeci¯estheiroverlaporder[2,13,18].Foreachpairoffacetsofthecreasepatternthatfoldtooverlappingpolygons,thispartialordermustspecifywhichfacetislayeredabovetheother.MMVVVMFigure4:Sample°atfoldingsinoneandtwodimensions.MountainsandvalleysaredenotedbyM'sandV's,respectively.Ifweorientthepieceofpapertohaveatopandbottomside,wecantalkaboutthedirectionofacreaseina°atfolding.Amountainbringstogetherthebottomsidesofthetwoadjacentfacetsofpaper,andavalleybringstogetherthetopsides.Amountain-valleyassignmentisafunctionfromthecreasesinacreasepatterntofM;Vg.ThisisthelabelingshowninFigure4.Together,acreasepatternandamountain-valleyassignmentformamountain-valleypattern.Thispaperisconcernedwiththefollowinggeneralquestion:Problem:SimpleFoldingGivenamountain-valleypattern,isthereasimplefoldingsatisfyingthespeci¯edmountainsandvalleys?Ifso,constructsuchasimplefolding.5 Therearethreenaturalversionsofthisproblem,dependingonthetypeof\simplefolds"allowed.Ingeneral,asimplefoldingisasequenceofsimplefolds.Eachsimplefoldtakesa°at-foldedpieceofpaper,andfoldsitintoanother°atfoldingusingadditionalcreases.Wedistinguishthreetypesofsimplefolds:one-layer,all-layers,andsome-layers.RefertoFigure5.Startingcon¯gurationforasimplefoldtopsidevalleyfoldleftsidecreaselocation(one-layermodel)1-layersimplefold3-layersimplefold(all-layersmodel)2-layersimplefold(some-layersmodel)Figure5:Illustrationofasimplefoldin1D,whichisspeci¯edbyacreaselocation,anotionofthe\topside",howmanyofthetoplayersarefolded(hererangingfrom1to3),whetherthefoldismountainorvalley,andwhethertheleftorrightsideisfolded.Webeginbyde¯ningin1Dthemostgeneraltypeofsimplefold,thesome-layerssimplefold.Asome-layerssimplefoldisspeci¯edby(1)anorientationofthefoldedpieceofpapertospecifyatopside,(2)anexternallyvisiblecrease(point)onthetopsideofthefoldedpieceofpaper,(3)thenumber`oflayerstobefolded,and(4)theorientationofthefold,mountainorvalley,relativetowhichsideisthetop.Suchafoldnewlycreasesthepieceofpaperat`points:atthespeci¯edcreaseonthetopmostlayerandatthe`¡1creases(points)immediatelybelow.Ifwelocallycolorthepieceofpapernearthenewcreases,bluetotheleftofthecreasesandredtotherightofthecreases,andpropagatethiscoloring,weshouldobtainapartitionofthepieceofpaperintotwo(notnecessarilyconnected)components.Ifwe¯ndacon°ictthatsomepapershouldbecoloredsimultaneouslyredandblue,thesimplefoldisnotvalid.Otherwise,theexecutionofthesimplefoldcorrespondstocontinuouslyrotatingtheblueportionofpaperby180±aroundthecreasepoint,eitherclockwiseorcounterclockwiseaccordingtowhetherthefoldisvalleyormountain.Duringthisrotation,boththeredandblueportionsofthepaperremainrigid.Ifthepaperself-intersectsduringthisrotation,thesimplefoldisinvalid.Some-layerssimplefoldsaremostgeneralinthesensethatanynumber`oflayerscanbefoldedatonce.Aone-layersimplefoldisthespecialcaseinwhich`=1.Anall-layerssimplefoldisthespecialcaseinwhich`istheentirenumberoflayerscoincidingatthespeci¯edcreasepoint.In2D,thesituationismorecomplicatedbecausethenumberoflayersfoldedcanvaryalongthecreasesegment.SeeFigure6foranexample.Thus,asome-layerssimplefoldmustspecifythedesirednumberoflayersforeachportionofthecrease,foraspeci¯edsubdivisionofthecreasesegmentintoportions.Weconstructthenewcreasesthatresultfromthisfoldbycopyingeachportionofthecreasetothespeci¯ednumberoflayersbelowthetopmostlayer.Then,asbefore,wecolorthepieceofpaper,verifythatthiscoloringisconsistent(inparticular,verifyingthattheassignmentoflayerswasvalid),androtatetheblueportionofpaper,barringself-intersection.Inthismoregeneralsetting,aone-layersimplefoldisthespecialcaseoffoldingonlyonelayeralongtheentirecrease.Anall-layerssimplefoldisthespecialcaseoffoldingalllayersforeachportionofthecrease.ThesimplefoldinFigure6isanexamplethatcannotbemadeaone-layersimplefold,andindeed,cannotbemodi¯edtouseanysmallernumberoflayersatanypoint.Thisfactcanbeveri¯edbyattemptingtofoldsuchapieceofpaperinpractice,orbycheckingthattheresultingred-bluecoloringisinvalid.6 2layers1layer3layersFigure6:Illustrationofasimplefoldin2D(startingfromFigure4,right),wherewemustspecifythenumberoffoldedlayersforeachportionofthecrease,becausethisnumbercanvaryalongasinglefold.Figure7furtherillustratesthedi®erencesamongthethreemodelsofsimplefolding,andtheirlimitationswithrespecttogeneral°atfolding,bygivingexamplesofcreasepatternsthatcanbefoldedwithonemodelbutnottheothers.Ofcourse,°atfoldabilitybyone-layersimplefoldsorbyall-layerssimplefoldsimplies°atfoldabilitybysome-layerssimplefolds,whichinturnimplies°atfoldabilityingeneral.Theexamplesinthe¯gureprovethatnoothergeneralimplicationshold.butnot°at-foldablebyall-layerssimplefoldsbutnot°at-foldablebyone-layersimplefolds°at-foldableby°at-foldablebyall-layerssimplefoldsbutnot°at-foldablebyone-layersimplefoldsall-layerssimplefoldsone-layerand/orsome-layerssimplefolds°at-foldableby°at-foldablebygeneralorigamifoldingbutnot°at-foldablebyanysimplefoldsFigure7:Creasepatternsillustratingtheuniquepowerofeachmodelofsimplefolding,andthelimitationscomparedtogeneral°atfolding.31D:One-LayerandSome-LayersThissectionisconcernedwiththe1Done-layersimple-foldproblem.Wewillprovethesurprisingresultthatweonlyneedtosearchforoneoftwolocaloperationstoperform.Thetwooperationsarecalledcrimpsandendfolds,andareshowninFigure8.Moreformally,letc1;:::;cndenotethecreasesonthesegment,orientedsothatciisleftofcjforij.Letc0[cn+1]denotetheleft[right]endofthesegment.Despitethe\c"notation(whichisusedforconvenience),c0andcn+1arenotconsideredcreases;insteadtheyarecalledtheends.First,apair(ci;ci+1)ofconsecutivecreasesiscrimpableifciandci+1haveoppositedirectionsandjci¡1¡cij¸jci¡ci+1j·jci+1¡ci+2j:Crimpingsuchapaircorrespondstofoldingciandthenfoldingci+1,usingone-layersimplefolds.7 MVciCrimpEndfoldci+1cici+1cnMcn+1cncn+1Figure8:Thetwolocaloperationsforone-dimensionalone-layerfolds.Second,c0isafoldableendifjc0¡c1j·jc1¡c2j,andcn+1isafoldableendifjcn¡1¡cnj¸jcn¡cn+1j.Foldingsuchanendcorrespondstoperformingaone-layersimplefoldatthenearestcrease(creasec1forendc0,andcreasecnforendcn+1).Weclaimthatoneofthetwolocaloperationsexistsinany°at-foldable1Dmountain-valleypattern.Weclaimfurtherthatanoperationexistsforanypatternsatisfyingacertain\minglingproperty".Speci¯cally,a1Dmountain-valleypatterniscalledminglingifforeverysequenceci;ci+1;:::;cjofconsecutivecreaseswiththesamedirection,either1.jci¡1¡cij·jci¡ci+1j;or2.jcj¡1¡cjj¸jcj¡cj+1j.Wecallthistheminglingpropertybecause,formaximalsequencesofconsecutivecreaseswiththesamedirection,itsaysthattherearefoldsoftheoppositedirectionnearby.Inthissense,themountain-valleypatternis\crowded"andthemountainsandvalleysmust\mingle"together.Firstweshowthatminglingmountain-valleypatternsinclude°at-foldablepatterns:Lemma3.1Every°at-foldable1Dmountain-valleypatternismingling.Proof:Considera°atfoldingofamountain-valleypattern,andletci;:::;cjbeconsecutivecreaseswiththesamedirection.Theportionci¡1;:::;cj+1ofthesegmentcanbeinoneofthreecon¯gurations(seeFigure9):1.Theportionformsa\spiral"with(ci¡1;ci)beingtheoutermostedgeofthespiral,and(cj;cj+1)beingtheinnermost;or2.Theportionformsa\spiral"with(cj;cj+1)beingtheoutermostedgeofthespiral,and(ci¡1;cj)beingtheinnermost;or3.Theportionformstwo\spirals"connectedbyacommonoutermostedgeandwith(ci¡1;ci)and(cj;cj+1)beingthetwoinnermostedge.Nowifjci¡1¡cij�jci¡ci+1j,then(ci¡1;ci)cannotbetheinnermostedgeofaspiral,orelse(ci¡1;ci)wouldpenetratethroughci+1.Similarly,ifjcj¡1¡cjj�jcj¡cj+1j,then(cj¡1;cj)cannotbetheinnermostedgeofthespiral.Becauseinallthreecon¯gurationsabovewemusthaveatleastoneof(ci¡1;ci)and(cj;cj+1)asinnermost,wecannothavebothinequalitiestrue.2Nextweshowthathavingtheminglingpropertysu±cestoimplytheexistenceofasinglecrimpablepairorfoldableend.Lemma3.2Anymingling1Dmountain-valleypatternhaseitheracrimpablepairorafoldableend.8 (ci¡1;ci)(cj;cj+1)(cj;cj+1)(ci¡1;ci)(ci¡1;ci)(cj;cj+1)Figure9:Theinnermostedgeofaspiralcannotbelongerthantheadjacentedge,incontrasttotheoutermostedgewhichcanbearbitrarilylong.Proof:Letibemaximumsuchthatc1;:::;ciallhavethesamedirection.Bytheminglingproperty,eitherjc0¡c1j·jc1¡c2jorjci¡1¡cij¸jci¡ci+1j.Intheformercase,c0isafoldableend,sowehavethedesiredresult.Ageneralizationofthelattercaseisthatwehaveci;:::;cjallwiththesameorientation,andjcj¡1¡cjj¸jcj¡cj+1j.Ifj=n,thencn+1isafoldableend,sowehavethedesiredresult.Otherwise,letkbemaximumsuchthatcj+1;:::;ckallhavethesamedirection.Bytheminglingproperty,eitherjcj¡cj+1j·jcj+1¡cj+2jorjck¡1¡ckj¸jck¡ck+1j.Intheformercase,(cj;cj+1)isacrimpablepair,sowehavethedesiredresult.Inthelattercase,inductionapplies.2Ideally,wecouldshowatthispointthatperformingeitherofthetwolocaloperationspreservestheminglingproperty,andhenceamountain-valleypatternisminglingpreciselyifitis°at-foldable.Unfortunatelythisisfalse,asillustratedinFigure10.Instead,wemustprovethat°atfoldabilityispreservedbyeachofthetwolocaloperations;inotherwords,ifwetreatthefoldedobjectfromasinglecrimpasanewsegment,itis°at-foldable.MMCrimpMVMMFigure10:Aminglingmountain-valleypatternthatwhencrimpedisnolongerminglingandhencenot°at-foldable.Indeed,theoriginalmountain-valleypatternisnot°at-foldable.Lemma3.3Foldingafoldableendpreserves°atfoldability.Proof:Thisisobviousbecausefoldingafoldableendisequivalenttochoppingo®aportionofthesegment.Thus,ifwetakea°atfoldingoftheoriginalpattern,removethatportionofthesegment,anddoubleupthenumberoflayersfortheadjacentportionofthesegment,wehavea°atfoldingofthenewobject.2Lemma3.4Crimpingacrimpablepairpreserves°atfoldability.Proof:Let(ci;ci+1)beacrimpablepair,andassumebysymmetrythatciisamountainandci+1isavalley.Considera°atfoldingFoftheoriginalsegment,suchastheoneinFigure11(left).9 Weorientourviewtoregardthesegment(ci;ci+1)as°ippingoverduringthefolding,sothattheremainderofthe(unfolded)segmentkeepsthesameorientation.Thus,(ci¡1;ci)isabove(ci;ci+1)whichisabove(ci+1;ci+2).NowsupposethatFplacessomelayersofpaperinbetween(ci;ci+1)and(ci+1;ci+2).Thentheselayersofpapercanbemovedtoimmediatelyabove(ci¡1;ci),because(ci¡1;ci)isatleastaslongas(ci;ci+1),andhencetherearenobarrierscloserthanci.SeeFigure11.Similarly,wemovematerialbetween(ci;ci+1)and(ci¡1;ci)toimmediatelybelow(ci+1;ci+2).Intheend,wehavea°atfoldingoftheobjectobtainedfrommakingthecrimp(ci;ci+1).2ci+1ci+1cici+2ci¡1ci¡1ci+2ciFigure11:Movinglayersofpaperoutofthezig-zagformedbyacrimp(ci;ci+1),highlightedinbold.Combiningallofthepreviousresults,wehavethefollowing:Theorem3.5Any°at-foldable1Dmountain-valleypatterncanbefoldedbyasequenceofcrimpsandendfolds.Proof:ByLemma3.1,thepatternismingling,andhencebyLemma3.2wecan¯ndacrimpablepairorafoldableend.Makingthisfoldpreserves°atfoldabilitybyLemmas3.3and3.4,sobyinductiontheresultholds.2Aparticularlyinterestingconsequenceofthistheoremisthefollowingconnectiontogeneral°atfoldability:Corollary3.6Thefollowingareequivalentfora1Dmountain-valleypatternP:1.Phasa°atfolding.2.Phasasome-layerssimplefolding.3.Phasaone-layersimplefolding.One-dimensional°atfoldabilityhasbeenstudiedextensivelyinthecombinatorialcontext[7,17,20,27],butprimarilyforthesimplecreasepatterninwhichthedistancesbetweenconsecutivecreasesareidentical.Astructuresimilartoours,inparticularhighlightingtheimportanceofcrimps,ishintedatbyJustin[14,Section6.1],thoughitisnotfollowedthroughalgorithmically.Finally,weshowthatTheorem3.5leadstoasimplelinear-timealgorithm:Theorem3.7The1Done-layerandsome-layerssimple-foldproblemscanbesolvedinO(n)worst-casetimeonamachinesupportingarithmeticontheinputlengths.10 Proof:Firstnotethatitistrivialtocheckinconstanttimewhetherapairofconsecutivefoldsformacrimporwhetheranendisfoldable.Webeginbytestingallsuchfolds,andhenceinlineartimehavealinkedlistofallpossiblefoldsatthistime.Wealsomaintainreversepointersfromeachsymbolinthestringtotheclosestrelevantpossiblefold.Nowwhenwemakeacrimporanendfold,onlyaconstantnumberofpreviouslypossiblefoldscannolongerbepossible,andaconstantnumberofpreviouslyimpossiblefoldscanbenewlypossible.Thesefoldscanbediscoveredbyexaminingaconstant-sizeneighborhoodoftheperformedfold.Weremovetheoldfoldsfromthelistofpossiblefolds,andaddthenewfoldstothelist.Thenweperformthe¯rstfoldonthelist,andrepeattheprocess.ByTheorem3.5,ifthelisteverbecomesempty,itisbecausethemountain-valleypatternisnot°at-foldable.241D:All-LayersSimpleFoldsThe1Dall-layerssimple-foldproblemcanbecastasaninteresting\stringfolding"problem.(Thisfoldingproblemisnottobeconfusedwiththewell-knownprotein/stringfoldingprobleminbiol-ogy[4].)Theinputmountain-valleypatterncanbethoughtofasastringoflengthsinterspersedwithmountainandvalleycreases.Speci¯cally,wewillassumethattheinputlengthsarespeci¯edasintegersorequivalentlyrationalnumbers.(Irrationalnumberscanbereplacedbycloserationalapproximations,providedthesortedorderofthelengthsispreserved.)Thus,aninputstringisoftheform`0d1`1d2¢¢¢dn¡1`n¡1dn`n,whereeachdi2fM;Vgspeci¯esthedirectionoftheithcreaseci,andeach`iisapositiverationalnumberspecifyingthedistancebetweenadjacentcreasesciandci+1.Wecalleachdiand`iasymbolofthestring.Itwillbehelpfultointroducesomemoreuniformnotationforsymbols.ForastringSoflengthN=2n+1,wedenotetheithsymbolbyS[i],where1·i·N.Whenwemakeanall-layerssimplefold,wecannot\coverup"acreaseexceptwithamatchingcrease(whichwhenunfoldedisinfacttheotherdirection),becauseotherwisethiscreasewillbeimpossibletofoldlater.Toformalizethiscondition,wede¯nethecomplementofsymbolsinthestring:comp(`i)=`i,comp(M)=V,andcomp(V)=M.Foreachevenindexi,atwhichS[i]=di=22fM;Vg,wede¯nethefoldatpositionitobetheall-layerssimplefoldofthecorrespondingcreaseci=2.WecallthisfoldallowableifS[i¡x]=comp(S[i+x])forall1·x·min(i¡1;N¡i),exceptthatS[1]andS[N](theendlengths)areallowedtobeshorterthantheircomplements.Lemma4.1Amountain-valleypatterncanbefoldedbyasequenceofall-layerssimplefoldspre-ciselyifthereisanallowablefold,andtheresultafterperformingthatfoldhasanallowablefold,andsoon,untilallcreasesofthesegmenthavebeenfolded.Proof:Performinganall-layerssimplefoldthatisnotallowableforbidsusfromall-layerssimplefoldingcertaincreases,andhencetheresultingsegmentcannotbecompletelyfoldedafterthatpoint.Therefore,onlyallowablefoldscanbeinthesequence.Itremainstoshowthatperforminganallowablefoldpreservesfoldabilitybyasequenceofall-layerssimplefolds.Butperforminganallowablefoldisequivalenttoremovingthesmallerportionofpapertoonesideofthefold.Hence,itcanonlymakemore(allowable)foldspossible,sothemountain-valleypatternremainsfoldable.2ByLemma4.1,theproblemoftestingfoldabilityreducestorepeatedly¯ndingallowablefoldsinthestring.TestingwhetherafoldatpositioniisallowablecanclearlybedoneinO(1+min(i¡11 1;N¡i))time,bytestingtheboundaryconditionsandwhetherS[i¡x]=comp(S[i+x])for1·x·min(i¡1;N¡i).ExplicitlytestingallcreasesinthismannerwouldyieldanO(n2)-timealgorithmfor¯ndinganallowablefold(ifoneexists).RepeatingthisO(n)timesresultsinanaiveO(n3)algorithmfortestingfoldability.Thiscubicboundcanbeimprovedbybeingabitmorecareful.InO(n2)time,wecandetermineforeachcreaseS[i]thelargestvalueofkforwhichS[i¡x]=comp(S[i+x])forall1·x·k.Usingthisinformationitiseasytotestwhetherthefoldatpositioniisallowable.Aftermakingoneoftheseallowablefolds,wecaninO(n)timeupdatethevalueofxforeachcrease,andhencemaintainthecollectionofallowablefoldsinlineartime.ThisgivesanoverallO(n2)bound,whichwenowproceedtoimprovefurther.Wepresenttwoe±cientalgorithmsforfoldingstrings.ThealgorithminSection4.1isbasedonsu±xtreesandrunsintimelinearinthebitcomplexityoftheinput.InSection4.2,weuserandomizationtoobtainasimpleralgorithmthatrunsinO(n)time.4.1Su±x-TreeAlgorithmInthissection,weprovethefollowing:Theorem4.2AstringSoflengthNcanbetestedforall-layerssimplefoldability,intimethatisdominatedbythattoconstructasu±xtreeonS.Thedi±cultywiththetimeboundisthatsortingthealphabetseemstoberequired.Otherthanthetimetosortthealphabet,itispossibletoconstructasu±xtreeinO(n)time[9].Tosortthealphabetinthecomparisonmodel,O(nlogn0)timesu±ces,wheren0isthenumberofdistinctinputlengths.Inparticular,iftheinputlengthsareencodedinbinary,thenthealgorithmislinearinthisbitcomplexity.OnaRAM,thecurrentstate-of-the-artdeterministicalgorithmforintegersorting[26]usesO(n(loglogn)2)timeandlinearspace.Proof:LetSCbethecomplementstringofS(i.e.,thecomplementofeachletterofS),andletSRbethereversestringofS.ThefoldatpositioniofSisallowablepreciselyifthe¯rstmin(i¡2;N¡i+1)charactersofthesu±xofSRstartinginthe(N¡i+2)ndpositionareidenticaltothesu±xofSCstartinginthe(i+1)stposition,andthesingleendpointofS(S[1]ifi¡1N¡i,S[N]ifN¡ii)haslengthlessthanorequaltoitscomplement.Webuildasinglesu±xtreecontainingallsu±xesofSCandSRinO(n)time.Further,weaugmentthistreewiththecapabilitytoperformleast-commonancestor(LCA)queriesinconstanttimeafterlinearpreprocessingtime[12,23].ThisLCAdatastructureenablesustoreturnthelengthofthelongestpre¯xmatchoftwogivensu±xesinconstanttime.To¯ndtheend-mostpossiblefold,wecansearchforthelongestpre¯xmatchofSC[i+1]andSR[N¡i+2],wherethejthfoldattempttakesplaceati=(j¡1)=2ifjisodd,andi=N+1¡j=2ifjiseven.Thustheattemptedfoldsalternateinfromtheleftandrightends.AfoldcanoccuratiifS[i]equalsMorV,andthelengthofthelongestpre¯xmatchbetweenSC[i+1]andSR[N¡i+2]ismin(i¡1;N¡i),oriftheboundaryconditionaboveissatis¯ed.Wethenperformthis¯rstlegalfold,thusreducingthelengthofS.Wecancontinueourscanforthenextfoldbyappropriatelyreducingthelengthofthenecessarylongestpre¯xmatchtore°ectthenewendofthestring.Notethatthesu±xtreeremainsunchanged,andhenceonceoneiscomputed,thefoldingprocesstakesO(n)time.212 4.2RandomizedAlgorithmInthissectionwedescribeasimplerandomizedalgorithmthatsolvesthe1Dall-layerssimple-foldprobleminO(n)time.Therearetwopartstothealgorithm:1.assigninglabelstotheinputlengthssothattwolengthsareequalpreciselyiftheyhavethesamelabel;and2.¯ndingandmakingallowablefolds.The¯rstpartisessentiallyelementuniqueness,andcanbesolvedinlinearexpectedtimeusinghashing.Forexample,thedynamichashingmethoddescribedbyMotwaniandRaghavan[22]supportsinsertionsandexistencequeriesinO(1)expectedtime.Wecanusethisdatastructureasfollows.Foreachinputlength,checkwhetheritisalreadyinthehashtable.Ifitisnot,weassignitanewuniqueidenti¯er,andaddittothehashtable.Ifitis,weusetheexistinguniqueidenti¯erforthatvalue(storedinthehashtable).Letn0denotethenumberofdistinctlabelsfoundinthisprocess(or2,whicheverislarger).Forthesecondpart,wewillshowthateachperformedfoldcanbefoundinO(1+r)time,whereristhenumberofcreasesremovedbythediscoveredfold(inotherwords,theminimumlengthtoanendofthesegmenttobefolded).However,itispossiblethatthealgorithmmakesamistake,andthatsomeofthereportedfoldsarenotactuallypossible.Fortunately,mistakescanbedetectedquickly,andafterO(1)expectediterationsthepatternwillbefolded.(Unlessofcoursethepatternisnot°at-foldable,inwhichcasethealgorithmreportsthisfactcorrectly.)Thealgorithmproceedssimultaneouslyfrombothendsofthesegment,sothatitwill¯ndanallowablefoldintimeproportionaltotheminimumlengthfromeitherend.Atanypoint,thealgorithmhasa¯ngerprintofthestringtraversedbeforereachingthatpoint,aswellasa¯ngerprintofthecorrespondingstringimmediatelyafterthatpoint(reversedandcomplemented).These¯ngerprintsaremaintainedinO(1)timeperstepalongthesegment.Ifthe¯ngerprintsmatch,thenwithhighprobabilitytheunderlyingvectorsalsomatch,andwehaveanallowablefold.Whenwe¯ndsuchafold(whichtakesO(1+r)time),thecreasesontheshortsidearediscardedandthetwosearchesarerestartedstartingfrombothendsofthesegment.Thisprocessisrepeateduntilnoallowablefoldsarefound,inwhichcaseeitherthefoldingiscomplete(therearenocreaseslefttoperform)orthecreasepatternisnotfoldablebyasequenceofall-layerssimplefolds(creasesremain).Intheformercase,thefoldingsequencemustbedoublechecked(againusingO(1+r)timeperfold),andifitisincorrect,theentireprocessisrepeatedwithanewrandomlychosen\basis"for¯ngerprints.The¯ngerprintsarebasedonKarpandRabin'srandomizedstringmatchingalgorithm[15].Wetreatasubstringasthebase-n0representationofaninteger,whereweuse0;:::;n0¡1todenoteoneofthelengths,and0or1todenoteafolddirection.Thenthe¯ngerprintofasubstringissimplythisintegermodulopforarandomlychosenprimep.This¯ngerprintcanbeupdatedeasilyinconstanttime.Toaddasymboltotheendofthestring,wemultiplythecurrent¯ngerprintbyn0,andaddonthenewsymbol.Toaddasymboltothebeginningofthestring(whichisnecessaryforthereversecomplementsubstring),weaddonthenewsymboltimes(n0)kwherekisthecurrentlengthofthestring(wemaintain(n0)kmodpthroughoutthecomputation).Becauseanexactmatchisnotrequiredonthelastlengthforafoldtobeallowable,both¯ngerprintsoneithersideexcludethelastsymbol,andwemakeaseparatecheckthatthelengthattheendislessthanorequaltothelengthontowhichitfolds.Thus,giventheappropriate¯ngerprints,wecancheckwhetherafoldisallowableinO(1)time.13 Bychoosingtheprimeprandomlyfromtherange2;:::;n3,theprobabilitythatthisalgorithmmakesamistakeafteratmostnfoldsisO((logn)=n);see[15].Moregenerally,ifwechoosepfromtherange2;:::;nc,thentheprobabilityoffailureisO(c(logn)=nc¡2).Thus,withhighprobability,thealgorithmgivesacorrectpositiveanswer(italwaysgivescorrectnegativeanswers).Toobtainguaranteedcorrectness,wesimplychecktheanswerandrepeattheentireprocessuponfailure.Inconclusion,thealgorithmwehavepresentedprovesthefollowingresult:Theorem4.3The1Dall-layerssimple-foldproblemcanbesolvedinO(n)time,bothinexpectationandwithhighprobability,onamachinesupportingrandomnumbersandhashingoftheinputlengths.OrthogonalSimpleFoldsin2DInthissection,wegeneralizeourresultsfor1Dsimplefoldstoorthogonal2Dcreasepatterns,whichconsistonlyofhorizontalandverticalfoldsonarectangularpieceofpaper,wherehorizontalandverticalarede¯nedbythesidesoftherectangularpaper.Insuchapattern,thecreasesmustgoallthewaythroughthepaper,becauseeveryvertexofa°at-foldablecreasepatternhasdegreeatleastfour[2,13].Hence,thecreasepatternisagridofcreases(amap),althoughthespacebetweengridlinesmayvary.Edmonds[8]observedthatorthogonal2Dmountain-valleypatternsmaybe°at-foldablebutnotbysimplefolds;seeFigure12fortwoexamples.RecallfromSection3thattheoppositeholdsin1D:one-layerandsome-layersfoldsareequivalenttogeneral°at-foldability.Inthissectionwesimultaneouslyhandlesome-layersandall-layerssimplefolds;withone-layersimplefolds,only1Dmapsarefoldable.3421758985462371Figure12:Twomapsthatcannotbefoldedbysimplefolds,butcanbefolded°at.(Thesearechallengingpuzzles.)Thenumberingindicatestheoverlaporderoffaces.Toknowwhattimeboundswedesire,wemust¯rstdiscussencodingtheinput.Anaturalencodingofmapsspeci¯estheheightofeachrowandthewidthofeachcolumn,therebyusingn1+n2spaceforann1£n2grid.Themountain-valleyassignment,however,requires£(n1n2)spacetospecifythedirectionforeachedgeofthegrid.Hence,ourgoaloflineartimeamountstobeinglinearinn=n1n2.Inasimplyfoldablemountain-valleypattern,theremustbeatleastonecreaseline,allthewayacrossthepaper,thatisentirelyvalleyormountain;otherwise,thepatternwouldnotpermitanysimplefolds.Furthermore,allsuchcreaselinesmustbeparallel;otherwise,thevertexofintersectionbetweentwocrossingcreaselineswouldnotbelocally°at-foldable.Withoutlossofgenerality,assumethatthesecreaselinesarehorizontal,andletHdenotethesetofthem.WeclaimthatallcreaselinesinHmustbefoldedbeforeanyothercrease.Thisissobecause(1)foldingalonganyverticalcreaselinevwillleadtoamismatchofcreasesattheintersection14 ofvwithanyunfoldedelementsofHand(2)horizontalcreaselinesnotinHarenotentirelymountainorvalleyandhencecannotbefoldedbeforesomeverticalfoldismade.Thuswehaveacorresponding1Dproblem(withsome-orall-layersfolds)tosolvewiththeaddednecessaryconditionthatthenon-HfoldsmustmatchupappropriatelyafterallthefoldsinHaremade.(Thetimespentcheckingthisnecessaryconditioncanbeattributedtothenon-Hfoldsthatvanishaftereveryfold.)BecauseHcontainsatleastonefold,performingtheHfolds(strictly)reducesthesizeoftheproblem,andwecontinue.Thebasecaseconsistsofjusthorizontalorverticalfolds,whichcorrespondstoa1Dproblem.InsummarywehaveLemma5.1Ifacreasepatternisfoldable,itremainsfoldableafterthefoldsinHhavebeenmadeinanyfeasiblewayconsideringHtobea1Dproblemandignoringothercreases.To¯ndHquicklywemaintainthenumberofmountainandvalleycreasesforeachrowandcolumnofcreases.WemaintainthesenumbersaswemakefoldsinH.Todothiswetraverseallthecreasesthatwillvanishafterafoldanddecrementthecorrespondingnumbers.Thecostofthistraversalisattributedtothevanishingcreases.Everytimethenumberofmountainorvalleycreaseshitszeroinacolumnorarow,weaddtheroworcolumntoalisttobeusedasthenewHinthenextstep.Thus,weobtainTheorem5.2Some-layerssimplefoldingofanorthogonalcreasepatternonarectangularpieceofpapercanbesolvedindeterministiclineartime.All-layerssimplefoldinginthesamesituationcanbesolvedinrandomizedlineartime,ordeterministiclineartimeplusthetimerequiredtosorttheedgelengths.Thistheoremeasilygeneralizestohigherdimensions,witharunningtimelinearinn=n1n2¢¢¢ndpluspossiblythetimerequiredtosorttheedgelengths.6HardnessofSimpleFoldsin2DInthissectionweprovethattheproblemofdecidingwhethera2Daxis-parallelmountain-valleypatterncanbesimplyfoldedis(weakly)NP-hard,ifweallowtheinitialpapertobeanarbitraryorthogonalpolygon.Wealsoshowthatitis(weakly)NP-hardtodecidewhetheramountain-valleypatternonasquarepieceofpapercanbefoldedbysome-layerssimplefolds,ifthecreasesareallowedtobeaxis-parallelplusata45-degreeangle.Bothhardnessproofsarebasedonareductionfromaninstanceofpartition,whichis(weakly)NP-hard[11]:givenasetXofnintegersa1;a2;:::;anwhosesumisA,doesthereexistasetS½XsuchthatPa2Sa=A=2?Forconveniencewede¯netheset¹S=XnS.Also,withoutlossofgenerality,weassumethata12S.Wetransformaninstanceofthepartitionproblemintoanorthogonal2Dcreasepatternonaorthogonalpolygon,asshowninFigure13.Allcreasesarevalleys.Thereisastaircaseofwidth",where0"2=3,withonestepoflengthaicorrespondingtoeachelementaiinX.Inaddition,therearetwo¯nalstepsoflengthLand2L,whereLischosengreaterthanA=2.ThetotalwidthW1ofthestaircaseischosentobelessthenthewidthW2oftheframeattachedtothestaircase.Themainmechanisminthereductionisformedbytheverticalcreasesv0andv1.Basically,the¯rsttimewefoldoneofthesetwocreases,thestaircasemust¯twithintheframe,orelsethesecondofthesetwocreasesisblocked.Thenwhenwefoldtheotherofthesetwocreases,thestaircaseexitstheframe,enablingustofoldtheremainingcreasesinthestaircase.15 v0vn+1vn+2L2LP4v1v2v3vnP3P0P1P5P6P2"a1a2a3an2LLP7W2W1Figure13:Hardnessreductionfrompartitionproblem.16 Lemma6.1Ifthepartitioninstancehasasolution,thenthecreasepatterninFigure13issimplyfoldable.Proof:For2·i·n,valleyfoldviifexactlyoneofai¡1andaiisinS.Afterthesefolds,aswetravelalongthestepscorrespondingtoa1;:::;an,wetravelinthe¡ydirectionforelementsthatbelongtoSandinthe+ydirectionforelementsthatbelongto¹S.BecausethesumsofelementsofbothSand¹SareA=2,thepointP5hasthesamey-coordinateasthepointP4afterthesefolds.BecauseL�A=2,thestepscorrespondingtoai'sarecon¯nedtoremaininbetweentheycoordinatesofpointsP1andP2.BecauseP5hasthesamey-coordinateasP4andbecausetheverticaldistancebetweenP5andP6isL,pointP6willhavethesamey-coordinateaseitherP1orP2.Nowvalleyfoldvn+2.BecausetheverticaldistancebetweenP6andP7is2L,they-coordinateofP7willbesameasthatofP1orP2andthestepbetweenP6andP7willlieexactlybetweenthey-coordinatesofP1andP2.ThissituationisillustratedinFigure14.v1W2W1v0L2LP4vn+1P7P6P0P5P3L2LP2P1"Figure14:Semi-foldedstaircasecon¯nedbetweenycoordinatesofP1andP2.Thetopsideofthepaperisdrawnwhiteandtheothersideisdrawngray.Nowvalleyfoldv1.BecauseW2�W1,thepartlyfoldedstaircase,whichcurrentlyliesbetweenthey-coordinatesofP1andP2,¯tswithintherectangleP0P1P2P3.Nowvalleyfoldv0.Wenowhavethesemi-foldedstairsontherightandtherectangularframeP0P1P2P3ontheleft.Finally,valleyfoldalloftheremainingunfoldedcreasesinthestaircase.ThiscanbedonebecausetherectangularframeisnowontheleftofP4andallstepsofthestaircaseareontherightofP4.2Lemma6.2IfthecreasepatterninFigure13issimplyfoldable,thereisasolutiontotheparti-tioninstance.Proof:Ifeitherv0orv1isfoldedwithouthavingthestaircasecon¯nedbetweenthey-coordinatesofP1andP2,therectangularframeP0P1P2P3wouldintersectwiththestaircaseandwouldmaketheotherofv0andv1impossibletofold.Hencethestaircasemustbebroughtbetweenthey-coordinatesofP1andP2beforefoldingeitherv0orv1.Becausethelastandthesecond-laststepsofthestaircaseareofsize2LandL,respectively,pointP5musthavethesamecoordinateasthepointP4whenthestaircaseiscon¯nedbetweenthey-coordinatesofP1andP2.17 AswetravelfromP4toP5alongthestaircase,wetravelequallyinpositiveandnegativeydirectionsalongthestepscorrespondingtotheelementsofX.Hencethesumofelementsalongwhosestepswetravelinnegativeydirectionissameasthesumofelementsalongwhosestepswetravelinthe+ydirection.Thusthereisasolutiontothepartitioninstance,ifthecreasepatterninFigure13isfoldable.2Lemmas6.1and6.2implythefollowingtheorem.Theorem6.3Theproblemofdecidingsimplefoldabilityofanorthogonalpieceofpaperwithanorthogonalmountain-valleypatternis(weakly)NP-complete,forall-layers,some-layers,andone-layersimplefolds.Evenonarectangularpieceofpaperitishardtodecidefoldabilityif,besidesaxis-parallel,therearecreasesindiagonaldirections(45degreeswithrespecttotheaxes):Theorem6.4Itis(weakly)NP-completetodecidethesimplefoldabilityofan(axis-parallel)squaresheetofpaperwithamountain-valleypatternhavingaxis-parallelcreasesandcreasesatthediagonalanglesof45degreeswithrespecttotheaxes,forbothall-layersandsome-layerssimplefolds.of:Wetransformaninstanceofthepartitionproblemtoa2Dcreasepatternonanaxis-parallelsquarehavingallcreaseseitherorthogonal(axis-parallel)orat45degreestotheaxes.First,weestablishasetofhorizontalfolds,evenlyspacedandalternatingmountainandvalley,whichresultinthepaperbecomingalongthinrectangle(\strip");theseinitialfoldswillbecalledI-folds.Now,arectangularstripcanbeturnedby90degreesbymakingasinglefoldasshowninFigure15.BymakingseveralsuchturnswecangetthestripintotheshapeoftheinitialpaperasinFigure13,exceptthatthecornersateachturnare\shaved"by45-degreechamfers.(Astripcanreadilybefoldedinordertoavoidthesechamfers;however,itiseasiertodescribeourconstructionwiththesimplersinglefoldsateachbend.)Callthesefoldsd1;d2;d3;:::.Immediatelyaftereachdiwemakeafoldparalleltothestriptoreduceitswidth.SeeFigure16.Callthesefoldsr1;r2;r3;:::respectively.Thuswemakethesefoldsinthefollowingorder:d1;r1;d2;r2;:::.WerefertothedifoldsastheD-folds,therifoldsastheR-folds,andbothkindstogetherasDR-folds.Figure15:Turningastrip.Finally,wecreatevalleyfolds,asshowninFigure13.WerefertothesevalleysasF-folds.AftermakingtheF-folds,wecanunfoldthepapertogetthedesiredcreasepattern.Itiseasytoseethatifasolutiontothepartitionproblemexists,theabovecreasepatterncanbefoldedby¯rstmakingtheI-folds,followedbytheDR-foldsintheorderinwhichtheywerecreated,followedbytheF-folds(asdoneinFigure13).Wenowprovetheotherdirection:ifthecreasepatterncanbe°atfolded,thenthepartitionproblemhasasolution.18 11rd2r2d33rdFigure16:Illustrationof¯rstfewDR-foldsusedinconstruction.EachD-foldintersectsallI-folds.AndeachR-foldintersectsatleastoneD-fold.HencenoneoftheDR-foldscanbemadebeforeallofthe(initial)I-foldsaremade.Becauser1intersectsd1andwascreatedafterfoldingd1,thereisaprecedenceconstraintthatinanyvalidfoldingd1occursbeforer1.Similarlyr1occursbefored2andsoon.ThustheDR-foldsmustoccurintheorderd1;r1;d2;r2;:::.AlsononeoftheF-foldscanbemadebeforethecorrespondingR-foldswhichitintersectsaremade.ThusitisguaranteedthatafterI-foldsd1;r1;d2;r2;r3wouldbemadeinthatorderbeforeanyotherfolds.ThisputsourrectangularframeP0;P1;P2;P3inplaceasinFigure13.JustasinproofofLemma6.2,toenablefoldsv0andv1tobemade,thestripfollowingd3.mustbefoldedsothatitiscon¯nedbetweenthey-coordinatesofP1andP2.Forthisproof,thisproofthereisanadditionalconstraintthatnopointonthestripfollowingd3shouldhaveanx-coordinatedi®eringfromthatofP0bymorethanW2.WecanchooseW2assmallaswewant,byreducingthewidthofthestripthatI-foldscreate.InparticularwecanchooseW2tobesmallerthanallai's.Thustomeettheaboveconstraintsallthelengthsofthestripwhichcorrespondtoai'swillhavetobevertical.AndjustasinproofofLemma6.2,theremustexistasolutiontopartitionproblem,ifalltheseverticalstripshavetobebetweenthey-coordinatesofP1andP2.2Theproblemisopenfortheone-layercase.7NoMountain-ValleyAssignmentsAninterestingcasetoconsideriswhenthecreasesdonothavemountain-valleyassignment:anycreasecanbefoldedineitherdirection.Evenwiththis°exibility,weareabletoshowthattheproblemishard:Theorem7.1Theproblemofdecidingthesimplefoldabilityofanorthogonalpieceofpaperwithacreasepattern(withoutamountain-valleyassignment)is(weakly)NP-complete,forbothall-layersandsome-layerssimplefolds.Proof:Fortheall-layerscase,theproofofTheorem6.3workswithoutmountain-valleyassignmentsaswell.Thisissobecausethestaircasemustbecon¯nedasbeforetomakebothturnsv1andv2in19 eitherdirection.Ifthestaircaseisnotcon¯nedbeforeeitherofv1orv2ismadeineitherdirection,itwilloverlapwiththeframe,and,intheall-layerscase,assoonastwolayersofpaperoverlaptheyare\stuck"together.W2v1W1vn+1vn+2P6P5"a1a2a3anL2LP7vnv3v2v0P3P4L2LP1P2P0Figure17:Hardnessreductionwhennomountain-valleyassignmentisgiven.Forthesome-layerscasetheproofofTheorem6.3doesnotwork,asthefoldsv0andv1canbemadeinoppositedirections,andsoafoldingexistswhetherornotapartitionexists.Wemodifytheconstructiontoensurethatv0andv1mustbefoldedinthesamedirection.SeeFigure17,andthemoredetailedFigure18.Thereareonlytwodi®erencesbetweenthisconstructionandtheoneinFigure13.Firstistheextrapieceofpaper(°ap)attachedatthetopofthestaircase.Secondistheadditionofthefoldofthe°ap,andthree\crimps"showninFigure18.Whencreatingthecreasepattern,thesenewfoldsaremadebeforethefoldsv0andv1.Eachcrimpconsistsoftwofoldsveryclosetoeachother,changingtheshapeofourconstructiononlyin¯nitesimally.Itiseasytoarguethatifthereisasolutiontothepartitionproblem,thenourconstructioncanbefolded.Thiscanbedoneby¯rstfoldingthe°ap,followedbycrimpc0,followedbycrimpsc1,c2andthenfollowingthealgorithmdescribedinproofofLemma6.1.Wenowprovetheotherdirection;thatis,ifourconstructionisfoldable,thenthereisasolutiontothepartitionproblem.Westartbynotingthefollowing:Givenacreasepatterninwhichtwofoldsintersectatanangleotherthan90degrees,itiseasytotellwhichofthetwofoldsmustbefolded¯rstinanylegalfolding.Thisisbecausethesecondfoldmustbeamirrorimagethrough20 v1v0v1v0c0c1c2Figure18:Interestingpartofconstructionforhardnessreduction.the¯rstfold.Iftheangleofintersectionisnot90degrees,thenthesecondfolddoesnotformastraightlineinthecreasepattern,butratheristwolinesegmentsre°ectedaroundthe¯rstfold.(Iftwocreasesmeetata90-degreeangle,andnomountain-valleyassignmentisgiven,thentherearetwopossibleordersoffoldingthetwocreases.)Asaconsequence,whileconstructingacreasepattern,ifacrimporafoldcyisfoldedafteranothercrimporfoldcxandifcyintersectscxatanyangleotherthan90degrees,thencxmustbefoldedbeforecycanbefoldedinanylegalfoldingofthiscreasepattern.Figure19illustratestwocrimpsintersectingat45degreesandthecreasepatterntheycreate.BothcrimpsunfoldedFirstcrimpmarkedFirstcrimpfoldedSecondcrimpmarkedSecondcrimpfoldedFigure19:Crimpsintersectingatanangleotherthan90degreescannotbefoldedoutoforder.Inourconstruction,fromtheabovediscussion,the°apmustbefoldedbeforecrimpc0canbefolded,whichinturnneedstobefoldedbeforecrimpsc1andc2canbefolded.Further,crimpsc1andc2needtobefoldedbeforefoldsv0andv1canrespectivelybefolded.Thus,beforeeitherv0orv1canbefolded,the°apmustbefolded.Oncethe°apisfoldedineitherdirection,v0andv1areforcedtofoldinthesamedirection.Withthisconstraint,therestoftheproofisthesameasthatofLemma6.2.2Theproblemisopenfortheone-layercase.8ConclusionWehavepresentede±cientalgorithmsfordeciding°atfoldabilityofamap(rectanglewithhor-izontalandverticalcreases)viaasequenceofsimplefolds,foranyofthreedi®erentrestrictions21 onthenumberoflayersthatcanbefoldedatonce.Intheall-layersmodel,theremaybeseveralsolutionsequencesofsimplefolds,andtheycanvarysigni¯cantlyinlength;forexample,ina1Dpatternthatalternatesmountainandvalley,thereisasequencewithroughlylognfoldsandasequencewithroughlynfolds.(Incontrast,theshapeofthe¯nalfoldedstateisindependentofthefoldingprocess,dependingonlyinthecreasepattern.)Je®Erickson2observedthatthereisalsoapolynomial-timealgorithmforminimizingthelengthofthesimple-foldsequence:theone-dimensionalsubproblemsareforced,andineachone-dimensionalsubproblem,wecanusedynamicprogrammingontheO(n2)substringsofthemountain-valleypattern.Thisoptimizationproblemisofcoursetrivialforone-layersimplefolds(thenumberoffoldsequalsthenumberofcreases),butitremainsopenforsome-layerssimplefolds,wherethereisaninterestinginterplaybetweenthee±ciencyofall-layersfoldsandthepowerofone-layerfolds.Onthecomplexityside,wehaveshownthatslightgeneralizationsofthebasicmap-foldingproblemare(weakly)NP-complete.However,therestillremainsagap.Forexample,whatisthecomplexityofdecidingsimplefoldabilityofanorthogonalcreasepatternonanorthogonallyconvexpieceofpaper?Evenmoresimply,whatisthecomplexityofdecidingsimplefoldabilityofanorthogonalcreasepatternonaconvexpieceofpaper,orevenanon-axis-alignedrectangle?Thesevariationspossesstheneededdi±cultythatmakingonefoldmayproduceapieceofpaperthatisnolongerasubsetoftheoriginalpieceofpaper;thus,itisnotclearthatmakingafoldalwaysmakesprogress.Anotherdirectiontoconsiderisnonrectangularmaps,forexample,atriangularmapwhosefacesareunitequilateraltriangles(polyiamonds).Weconjecturethatdecidingsimplefoldabilityisagain(weakly)NP-completeinthiscontext.Also,fortheproblemsthatweshowtobeweaklyNP-hard,itremainsopenwhethertherearepseudopolynomial-timealgorithmsforsolvingsimplefoldability,orwhethertheproblemsarestronglyNP-complete.Ourstudyofspecialcasesofcreasepatternsmayalsobeinterestinginthecontextofgeneral°atfoldings.HerethegoalwouldbetostrengthenBernandHayes'sNP-hardnessresult[2]tospecialcreasepatterns,orperhapsmoreinteresting,to¯ndspecialcasesinwhich°atfoldabilityispolynomiallytestable.Onespecialcaseofparticularinterest,posedbyEdmonds[8],isanm£ngridwithaprescribedmountain-valleyassignment.Alongtheselines,Justin[14]observedthateven2£nmapsinwhichevery2£2submapis°at-foldablemaynotbetotally°at-foldable.DiFrancesco[7]suggeststhatausefulalgebraicstructurein1£nmapfoldingmaygeneralize.However,wedonotevenknowwhethertestinggeneral°atfoldabilityisNP-hardforthecasesinwhichtestingsimplefoldabilityisNP-hard:orthogonalpolygonswithorthogonalcreases,andrectangleswithorthogonaland45±creases.Ourhardnessreductionsrelyontherestrictiontosimplefolds.AcknowledgmentsWethankJackEdmondsforhelpfuldiscussionswhichinspiredthisresearch,inparticularforposingsomeoftheproblemsaddressedhere.WealsothankJosephO'Rourkeandananonymousrefereeforextensivecommentswhichgreatlyimprovedthispaper.E.ArkinandJ.MitchellthankMikeToddforposingalgorithmicversionsofthemap-folder'sprobleminageometryseminaratCornell.E.ArkinacknowledgessupportfromtheNationalScienceFoundation(CCR-9732221)andHRLLaboratories.M.BenderacknowledgessupportfromHRLLaboratories.J.MitchellacknowledgessupportfromHRLLaboratories,theNationalScienceFoundation(CCR-9732221),NASAAmesResearchCenter,Northrop-GrummanCorporation,SandiaNationalLabs,SeagullTechnology,and2Personalcommunication,March2001.22 SunMicrosystems.AddendumerecentlylearnedthatCalinescu,Karlo®,andThorup[3]independentlydiscoveredlinear-timealgorithmsforsome-layerssimplefoldabilityinthe1Dand2Dorthogonalcases.References[1]EstherM.Arkin,S¶andorP.Fekete,andJosephS.B.Mitchell.Analgorithmicstudyofmanufacturingpaperclipsandotherfoldedstructures.ComputationalGeometry:TheoryandApplications,25:117{138,2003.[2]MarshallBernandBarryHayes.Thecomplexityof°atorigami.InProceedingsofthe7thAnnualACM-SIAMSymposiumonDiscreteAlgorithms,pages175{183,Atlanta,January1996.[3]GruiaCalinescu,HowardKarlo®,andMikkelThorup.Manuscript,2000.[4]PierluigiCrescenzi,DeborahGoldman,ChristosPapadimitriou,AntonioPiccolboni,andMi-halisYannakakis.Onthecomplexityofproteinfolding.JournalofComputationalBiology,5(3),1998.[5]ErikD.Demaine,MartinL.Demaine,andJosephS.B.Mitchell.Folding°atsilhouettesandwrappingpolyhedralpackages:Newresultsincomputationalorigami.ComputationalGeometry:TheoryandApplications,16(1):3{21,2000.[6]ErikD.DemaineandJosephS.B.Mitchell.Reachingfoldedstatesofarectangularpieceofpaper.InProceedingsofthe13thCanadianConferenceonComputationalGeometry,pages73{75,Waterloo,Canada,August2001.http://compgeo.math.uwaterloo.ca/~cccg01/proceedings/short/eddemaine-33029.ps.[7]P.DiFrancesco.Foldingandcoloringproblemsinmathematicsandphysics.BulletinoftheAmericanMathematicalSociet,37(3):251{307,July2000.[8]JackEdmonds.Personalcommunication,August1997.[9]MartinFarach.Optimalsu±xtreeconstructionwithlargealphabets.InProceedingsofthe38thAnnualSymposiumonFoundationsofComputerScience,pages137{143,MiamiBeach,Florida,October1997.[10]MartinGardner.Thecombinatoricsofpaperfolding.InWheels,LifeandOtherMathematicalAmusements,chapter7,pages60{73.W.H.FreemanandCompany,1983.[11]MichaelR.GareyandDavidS.Johnson.ComputersandIntractability:AGuidetotheTheoryofNP-Completeness.W.H.Freeman&Co.,1979.[12]DovHarelandRobertEndreTarjan.Fastalgorithmsfor¯ndingnearestcommonancestors.SIAMJournalonComputing,13(2):338{355,May1984.23 [13]ThomasHull.Onthemathematicsof°atorigamis.CongressusNumerantium,100:215{224,1994.[14]JacquesJustin.Towardsamathematicaltheoryoforigami.InKoryoMiura,editor,Proceedingsofthe2ndInternationalMeetingofOrigamiScienceandScienti¯cOrigami,pages15{29,Otsu,Japan,November{December1994.[15]RichardM.KarpandMichaelO.Rabin.E±cientrandomizedpattern-matchingalgorithms.IBMJournalofResearchandDevelopment,31(2):249{260,March1987.[16]ToshikazuKawasaki.Ontherelationbetweenmountain-creasesandvalley-creasesofa°atorigami.InH.Huzita,editor,Proceedingsofthe1stInternationalMeetingofOrigamiSci-enceandTechnology,pages229{237,Ferrara,Italy,December1989.AnunabridgedJapaneseversionappearedinSaseboCollegeofTechnologyReport,27:153{157,1990.[17]JohnE.Koehler.Foldingastripofstamps.JournalofCombinatorialTheory,5:135{152,1968.MinorerrataappearinSeriesA,19(3):367,1975.[18]RobertJ.Lang.Acomputationalalgorithmfororigamidesign.InProceedingsofthe12thAnnualACMSymposiumonComputationalGeometry,pages98{105,Philadelphia,PA,May1996.[19]L.LuandS.Akella.Foldingcartonswith¯xtures:Amotionplanningapproach.IEEETransactionsonRoboticsandAutomation,16(4):346{356,August2000.[20]W.F.Lunnon.Amap-foldingproblem.MathematicsofComputation,22(101):193{199,1968.[21]W.F.Lunnon.Multi-dimensionalmap-folding.TheComputerJournal,14(1):75{80,February1971.[22]RajeevMotwaniandPrabhakarRaghavan.RandomizedAlgorithms,chapter8.4,pages213{221.CambridgeUniversityPress,1995.[23]BaruchSchieberandUziVishkin.On¯ndinglowestcommonancestors:Simpli¯cationandparallelization.SIAMJournalonComputing,17(6):1253{1262,December1988.[24]JohnS.Smith.Origamipro¯les.BritishOrigami,58,June1976.[25]JohnS.Smith.PurelandOrigami1,2,and3.BritishOrigamiSociety.Booklets14,29,and43,1980,1988,and1993.[26]MikkelThorup.Fasterdeterministicsortingandpriorityqueuesinlinearspace.InProceed-ingsofthe9thAnnualACM-SIAMSymposiumonDiscreteAlgorithms,pages550{555,SanFrancisco,California,January1998.[27]JacquesTouchard.Contributionµal'¶etudeduproblµemedestimbresposte(Contributiontothestudyoftheproblemofpostagestamps).CanadianJournalofMathematics,2:385{398,1950.[28]Cheng-HuaWang.Manufacturability-drivendecompositionofsheetmetal.PhDthesis,CarnegieMellonUniversity,RoboticsInstitute,September1997.TechnicalreportCMU-RI-TR-97-35.24