History of Computing SeriesEditor MartinCampbell-Kelly,UniversityofWarwick,Coventry,UK AdvisoryBoard GerardAlberts,UniversityofAmsterdam,Amsterdam,TheNetherlands JackCopeland,UniversityofCanterbury,Christchurch,NewZealand UlfHashagen,DeutschesMuseum,Munich,Germany JohnV.Tucker,SwanseaUniversity,Swansea,UK JeffreyR.Yost,UniversityofMinnesota,Minneapolis,USA TheHistoryofComputingseriespublisheshigh-qualitybookswhichaddressthehistoryofcomputing, withanemphasis onthe‘externalist’ viewofthis history, more accessibletoawideraudience.The seriesexaminescontentandhistoryfromfourmainquadrants:thehistoryofrelevanttechnologies,the historyofthecorescience,thehistoryofrelevantbusinessandeconomicdevelopments,andthehistory ofcomputingasitpertainstosocialhistoryandsocietaldevelopments. Titlescanspanavarietyofproducttypes,includingbutnotexclusively,themedvolumes,biographies, ‘profile’books(withbriefbiographiesofanumberofkeypeople),expansionsofworkshopproceedings, generalreaders,scholarlyexpositions,titlesusedasancillarytextbooks,revivalsandneweditionsof previousworthytitles. Thesebookswillappeal,varyingly,toacademicsandstudentsincomputerscience,history,mathematics, businessandtechnologystudies.Sometitleswillalsodirectlyappealtoprofessionalsandpractitioners ofdifferentbackgrounds. Authorguidelines:springer.com>Authors>AuthorGuidelines Forothertitlespublishedinthisseries,gotowww.springer.com/series/8442 Mark Priestley A Science of Operations Machines, Logic and the Invention of Programming Dr.MarkPriestley London UK [email protected] url:http://www.markpriestley.net ISSN2190-6831 e-ISSN2190-684X ISBN978-1-84882-554-3 e-ISBN978-1-84882-555-0 DOI10.1007/978-1-84882-555-0 SpringerLondonDordrechtHeidelbergNewYork BritishLibraryCataloguinginPublicationData AcataloguerecordforthisbookisavailablefromtheBritishLibrary LibraryofCongressControlNumber:2011921403 ©Springer-VerlagLondonLimited2011 Apartfromanyfairdealingforthepurposesofresearchorprivatestudy,orcriticismorreview,asper- mittedundertheCopyright,DesignsandPatentsAct1988,thispublicationmayonlybereproduced, storedortransmitted,inanyformorbyanymeans,withthepriorpermissioninwritingofthepublish- ers,orinthecaseofreprographicreproductioninaccordancewiththetermsoflicensesissuedbythe CopyrightLicensingAgency.Enquiriesconcerningreproductionoutsidethosetermsshouldbesentto thepublishers. Theuseofregisterednames,trademarks,etc.,inthispublicationdoesnotimply,evenintheabsenceofa specificstatement,thatsuchnamesareexemptfromtherelevantlawsandregulationsandthereforefree forgeneraluse. Thepublishermakesnorepresentation,expressorimplied,withregardtotheaccuracyoftheinformation containedinthisbookandcannotacceptanylegalresponsibilityorliabilityforanyerrorsoromissions thatmaybemade. Coverdesign:deblik Printedonacid-freepaper SpringerispartofSpringerScience+BusinessMedia(www.springer.com) Preface Ithaslongbeenrecognizedthatthereisarelationshipbetweenlogicandcomputer programming.Sincethe1940smanylogicians,includingAlanTuringandJohnvon Neumann,andcomputerscientistssuchasEdsgarDijkstraandJohnMcCarthy,have drawn attention to the connection between the two disciplines and commented on its importance. During the formal methods boom of the 1980s and 1990s it was common to read assertions to the effect that programming could be reduced to a quasi-logicalprocessoftheoremprovingandformuladerivation. However,despitehavingabackgroundinbothprogrammingandlogic,Ifound somethingelusiveaboutsuchassertions.Mypracticalexperienceofprogramming hadledmetounderstanditasaverydifferenttypeofactivityfromtheformalma- nipulationsoflogicalproof.Withtheintentionofresolvingthisuncertainty,Iem- barkeduponaPh.D.tostudythewaysinwhichthedevelopmentofprogramming languageshadbeeninfluencedbylogic.Thisbookisbasedontheresultingthesis, althoughithasawiderfocusandmarksafurtherstageinmygrowingunderstanding oftheconnectionbetweenthetwoareas. Broadlyspeaking,Ihavecometounderstandthisconnectionnotasafactabout the two disciplines, but as something more like a decision made by identifiable historicalactorsastohowthenewdisciplineofprogrammingshouldbeunderstood andstructured.AkeyeventinthisprocesswasthecreationoftheAlgollanguage in the years around 1960. The motivation for this decision has very deep roots, however, reaching back to ideas about machines and machinic processes that date fromtheverybeginningofthescientificrevolution. From this starting point, the book gives an account of the history of what we now call programming. It is useful, however, to view this not simply as computer programming,but to think more generallyof attempts to define the steps involved incomputationsandotherinformation-processingactivitiesinsuchawaythatthey could be performed by machines, or at least by humans mimicking the behaviour of machines. From this perspective, the history of programming is distinct from the history of the computer, despite the close relationship between the two in the twentiethcentury. v vi Preface Thestorytoldinthisbookstopsinthe1970s,atthepointwhereobject-oriented programming emerged as a successor, or alternative, to structured programming. Thisisnotanarbitrarycut-offpoint;rather,Ibelievethatstructuredprogramming marksthecompletionofaparticularhistoricaltrajectory,andthatobject-orientation, despiteitsrichinheritancefromexistingpractices,issomethingquitedifferent,or at least something which has deep roots in approaches and disciplines other than logic.Untanglingtheserootsispartofadifferentproject,however,andthehistory ofhowprogrammingandprogramminglanguagesdevelopedafterthe1970sispart ofadifferentstoryfromtheonetoldhere. There are several things this book is not, therefore. Although it contains much historical material, it does not pretend to be a complete history of programming languages,andstilllessahistoryofthecomputer.Whatitdoestrytodoistotella particularstoryaboutthesehistoricaldevelopmentsandtoshowonewayinwhich thehistoryofprogramminglanguagescanbesetinawidercontextandseenasan integralpartofadevelopmentwhich,ultimately,iscentraltotheprojectstartedby thescientificrevolutionintheseventeenthcentury. The history of computing has recently been expanding its focus from technical details and embracing wider narratives and historical contexts. These encouraging developments have been principally evident in studies of commercial and military applicationsofcomputingandtheirsocietalimpacts.IfIhadasinglehopeforthis book,itwouldbethatitmightcontributetoasimilarprocessinthemoretechnical aspectsofthesubjectandtoinspirecomputerscientistsandhistoriansofscienceand technologytoseeprogrammingnotasaisolatedtechnicalfield.butasaninteresting andimportantpartofgeneralintellectualhistory. Acknowledgements I would like particularly to thank my supervisor Donald GilliesandexternalexaminerJohnTucker,withoutwhoseenthusiasticadvice,sup- portandencouragementthisbookwouldneverhaveseenthelightofday. London,UK MarkPriestley Contents 1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 1.1 Minds,MethodandMachines . . . . . . . . . . . . . . . . . . . . 3 1.2 LanguageandScience . . . . . . . . . . . . . . . . . . . . . . . . 4 1.3 TheAgeofMachinery . . . . . . . . . . . . . . . . . . . . . . . . 7 1.4 TheMechanizationofMathematicalLanguage . . . . . . . . . . . 8 2 Babbage’sEngines . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17 2.1 TheDivisionofMentalLabour . . . . . . . . . . . . . . . . . . . 18 2.2 TheDifferenceEngine . . . . . . . . . . . . . . . . . . . . . . . . 21 2.3 TheMeaningsoftheDifferenceEngine . . . . . . . . . . . . . . . 25 2.4 TheMechanicalNotation . . . . . . . . . . . . . . . . . . . . . . 28 2.5 TheAnalyticalEngine . . . . . . . . . . . . . . . . . . . . . . . . 31 2.6 TheScienceofOperations . . . . . . . . . . . . . . . . . . . . . . 41 2.7 TheMeaningsoftheAnalyticalEngine . . . . . . . . . . . . . . . 44 2.8 Conclusions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48 3 Semi-AutomaticComputing . . . . . . . . . . . . . . . . . . . . . . . 53 3.1 TheCensusProblem . . . . . . . . . . . . . . . . . . . . . . . . . 53 3.2 TheHollerithTabulatingSystemof1890 . . . . . . . . . . . . . . 55 3.3 FurtherDevelopmentsinPunchedCardMachines . . . . . . . . . 57 3.4 ComrieandtheMechanizationofScientificCalculation . . . . . . 60 3.5 Semi-AutomaticProgramming . . . . . . . . . . . . . . . . . . . 65 4 Logic,ComputabilityandFormalSystems . . . . . . . . . . . . . . . 67 4.1 Gödel’sConstruction . . . . . . . . . . . . . . . . . . . . . . . . 69 4.2 RecursiveFunctions . . . . . . . . . . . . . . . . . . . . . . . . . 72 4.3 λ-definability. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 74 4.4 DirectApproachestoDefiningEffectiveComputability . . . . . . 75 4.5 Turing’sMachineTableNotation . . . . . . . . . . . . . . . . . . 77 4.6 UniversalMachines . . . . . . . . . . . . . . . . . . . . . . . . . 89 4.7 TheConceptofaFormalLanguage . . . . . . . . . . . . . . . . . 92 4.8 TheRelationshipBetweenTuring’sWorkandLogic . . . . . . . . 96 vii viii Contents 5 AutomatingControl . . . . . . . . . . . . . . . . . . . . . . . . . . . 99 5.1 KonradZuse’sEarlyMachines . . . . . . . . . . . . . . . . . . . 100 5.2 MarkI:TheAutomaticSequenceControlledCalculator . . . . . . 102 5.3 TheENIAC . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 107 5.4 TheBellLabsRelayMachines . . . . . . . . . . . . . . . . . . . 115 5.5 TheSignificanceoftheAutomaticCalculators . . . . . . . . . . . 118 6 LogicandtheInventionoftheComputer . . . . . . . . . . . . . . . . 123 6.1 TheOriginsoftheStored-ProgramComputer. . . . . . . . . . . . 126 6.2 TheEarlyDevelopmentofCybernetics . . . . . . . . . . . . . . . 130 6.3 VonNeumann’sDesignfortheEDVAC . . . . . . . . . . . . . . . 133 6.4 LogicandtheStored-ProgramConcept . . . . . . . . . . . . . . . 136 6.5 TheEDVACCodeandAddressModification . . . . . . . . . . . . 139 6.6 TuringandtheACE . . . . . . . . . . . . . . . . . . . . . . . . . 142 6.7 GiantBrains . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 145 6.8 UniversalMachines . . . . . . . . . . . . . . . . . . . . . . . . . 147 6.9 General-PurposeMachines . . . . . . . . . . . . . . . . . . . . . 153 6.10 Conclusions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 154 7 MachineCodeProgrammingandLogic . . . . . . . . . . . . . . . . 157 7.1 SequencingofOperations . . . . . . . . . . . . . . . . . . . . . . 158 7.2 TransferofControl. . . . . . . . . . . . . . . . . . . . . . . . . . 162 7.3 ConditionTesting . . . . . . . . . . . . . . . . . . . . . . . . . . 164 7.4 InstructionModification . . . . . . . . . . . . . . . . . . . . . . . 167 7.5 Subroutines . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 170 7.6 MachineCodeandProgramStructures . . . . . . . . . . . . . . . 172 7.7 MachineCodeandLogic . . . . . . . . . . . . . . . . . . . . . . 174 7.8 Syntax . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 176 7.9 FlowDiagramsandProgramSemantics . . . . . . . . . . . . . . . 179 7.10 ProgramsasMetalinguisticExpressions . . . . . . . . . . . . . . 182 7.11 Conclusions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 183 8 TheInventionofProgrammingLanguages . . . . . . . . . . . . . . . 185 8.1 AutomaticCoding . . . . . . . . . . . . . . . . . . . . . . . . . . 186 8.2 TheSemanticsofPseudocodes . . . . . . . . . . . . . . . . . . . 188 8.3 FormulaTranslation . . . . . . . . . . . . . . . . . . . . . . . . . 193 8.4 FortranandIncreasingLinguisticComplexity . . . . . . . . . . . 197 8.5 UniversalLanguages . . . . . . . . . . . . . . . . . . . . . . . . . 204 8.6 Algol60asaFormalLanguage . . . . . . . . . . . . . . . . . . . 209 8.7 TheInfluenceofLogiconAlgol. . . . . . . . . . . . . . . . . . . 217 8.8 LispandRecursiveFunctionTheory . . . . . . . . . . . . . . . . 220 8.9 Conclusions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 224 9 TheAlgolResearchProgramme. . . . . . . . . . . . . . . . . . . . . 225 9.1 Algol60asaConcreteParadigm . . . . . . . . . . . . . . . . . . 226 9.2 NormalScienceintheAlgolResearchProgramme . . . . . . . . . 229 Contents ix 9.3 TheDescriptionofProgrammingLanguages . . . . . . . . . . . . 230 9.4 DifferentPhilosophiesofProgrammingLanguageDesign . . . . . 237 9.5 LogicandtheDesignofControlStructures . . . . . . . . . . . . . 239 9.6 LogicandDataStructures . . . . . . . . . . . . . . . . . . . . . . 244 9.7 ModellingDataforInformationRetrieval . . . . . . . . . . . . . . 247 9.8 Conclusions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 252 10 TheLogicofCorrectnessinSoftwareEngineering . . . . . . . . . . 253 10.1 CheckingComputations . . . . . . . . . . . . . . . . . . . . . . . 253 10.2 DebuggingandTesting . . . . . . . . . . . . . . . . . . . . . . . 255 10.3 CorrectnessProofs . . . . . . . . . . . . . . . . . . . . . . . . . . 257 10.4 ConstructiveMethods . . . . . . . . . . . . . . . . . . . . . . . . 261 10.5 SpecificationsandCorrectness . . . . . . . . . . . . . . . . . . . 263 10.6 StructuredProgramming . . . . . . . . . . . . . . . . . . . . . . . 265 10.7 ProofandTesting . . . . . . . . . . . . . . . . . . . . . . . . . . 269 10.8 Conclusions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 275 11 TheUnificationofDataandAlgorithms . . . . . . . . . . . . . . . . 277 11.1 SimulationLanguages . . . . . . . . . . . . . . . . . . . . . . . . 278 11.2 ModellingtheRealWorld . . . . . . . . . . . . . . . . . . . . . . 281 11.3 Simula67 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 282 11.4 DataAbstraction . . . . . . . . . . . . . . . . . . . . . . . . . . . 283 11.5 Smalltalk . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 288 11.6 TheRelationshipBetweenSmalltalkandLogic. . . . . . . . . . . 293 11.7 Conclusions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 296 12 Conclusions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 297 12.1 ParadigmsandRevolutions . . . . . . . . . . . . . . . . . . . . . 298 12.2 RelatingTheoryandPractice . . . . . . . . . . . . . . . . . . . . 301 12.3 MethodologicalConclusions . . . . . . . . . . . . . . . . . . . . 303 Appendix Turing’sUniversalMachine . . . . . . . . . . . . . . . . . . 307 A.1 GeneralPurposem-functions . . . . . . . . . . . . . . . . . . . . 307 A.2 TheContentsoftheTape . . . . . . . . . . . . . . . . . . . . . . 310 A.3 TheMainTable . . . . . . . . . . . . . . . . . . . . . . . . . . . 312 References . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 317 Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 335