Verified Computing in Homological Algebra Arnaud Spiwack
Total Page:16
File Type:pdf, Size:1020Kb
Verified Computing in Homological Algebra Arnaud Spiwack To cite this version: Arnaud Spiwack. Verified Computing in Homological Algebra. Algebraic Topology [math.AT]. Ecole Polytechnique X, 2011. English. pastel-00605836 HAL Id: pastel-00605836 https://pastel.archives-ouvertes.fr/pastel-00605836 Submitted on 4 Jul 2011 HAL is a multi-disciplinary open access L’archive ouverte pluridisciplinaire HAL, est archive for the deposit and dissemination of sci- destinée au dépôt et à la diffusion de documents entific research documents, whether they are pub- scientifiques de niveau recherche, publiés ou non, lished or not. The documents may come from émanant des établissements d’enseignement et de teaching and research institutions in France or recherche français ou étrangers, des laboratoires abroad, or from public or private research centers. publics ou privés. Thèse de doctorat de l’ erified Computing in Homological Algebra V A Journey Exploring the Power and Limits of Dependent Type Theory Arnaud Spiwack Effectuée sous la direction de Benjamin Werner Thierry Coquand Défendue le 25-03-2011 devant un jury composé de Yves Bertot (président) André Hirschowitz Paul-André Melliès Julio Rubio (rapporteur) Claudio Sacerdoti Coen (rapporteur) Bas Spitters Benjamin Werner (directeur) erified Computing in Homological Algebra V A Journey Exploring the Power and Limits of Dependent Type Theory Arnaud Spiwack This thesis was defended the 25-03-2011 at École Polytechnique in Palaiseau, France. It had been carried out under the guidance of Thierry Coquand Benjamin Werner It was reviewed by Julio Rubio Claudio Sacerdoti Coen And was defended before a jury composed of Yves Bertot (president) André Hirschowitz Paul-André Melliès Julio Rubio Claudio Sacerdoti Coen Bas Spitters Benjamin Werner Jabberwocky ’Twas brillig, and the slithy toves Did gyre and gimble in the wabe; All mimsy were the borogoves, And the mome raths outgrabe. ‘Beware the Jabberwock, my son! The jaws that bite, the claws that catch! Beware the Jubjub bird, and shun The frumious Bandersnatch!’ He took his vorpal sword in hand: Long time the manxome foe he sought— So rested he by the Tumtum tree, And stood awhile in thought. And as in uffish thought he stood, The Jabberwock, with eyes of flame, Came whiffling through the tulgey wood, And burbled as it came! One, two! One, two! And through and through The vorpal blade went snicker-snack! He left it dead, and with its head He went galumphing back. ‘And hast thou slain the Jabberwock? Come to my arms, my beamish boy! O frabjous day! Callooh! Callay!’ He chortled in his joy. ’Twas brillig, and the slithy toves Did gyre and gimble in the wabe; All mimsy were the borogoves, And the mome raths outgrabe. Lewis Caroll, Through the Looking-Glass and What Alice Found There The best book on programming for the layman is “Alice in Wonderland”; but that’s because it’s the best book on anything for the layman. Alan Perlis Acknowledgement It is no simple task to reflect on the last few years of one’s life. Especially when these pretty intense years have seen me, and my life, change in more way than one. There are many people who have been involved, one way or another, into the making of this thesis. More than I can gather on this page. These many people I would like to thank, though, as this episode of my life comes to an end. If you do not appear here but think you might have: please accept my dearest thanks. I cannot thank enough my advisers, Thierry Coquand and Benjamin Werner, who taught me a lot throughout these years. They helped me through this thesis with a lot of patience, and I must confess that I probably did not make that easy every day. Besides Thierry and Benjamin, when I had a question to ask – I often had – I would turn to Bruno Barras and Hugo Herbelin. They have all my gratitude and apologies for the time they spent helping me. I also need to mention that this manuscript has been proof-read, several times, by Assia Mahboubi. She does not think she deserves praise. She certainly does. Julio Rubio and Claudio Sacerdoti-Coen have accepted to referee this thesis. Tank you both. Yves Bertot, André Hirschowitz and Bas Spitters have also accepted to be member of my jury, I am grateful for it. I like to believe that the story of this thesis has started before the beginning. When I was being taught computing science, my approach was already being shaped. Three teacher in particular were, I believe, especially influencial: Hubert Comon-Lundh, Jean Goubault-Larrecq and Jean Vuillemin. Finally, I would like to thank those whose help was more indirect, but essential nonetheless. Florent Kirchner and Stéphane Lengrand have been friends more or less since I made my first steps in research. As more exeperience young researchers, they helped me understand this world were I was lost, at first. I had many collaborations with Matthieu Sozeau, not to mention friendship. Lisa Allali, Bruno Bernardo, Denis Cousineau and Elie Soubiran have been my compagnons de route: we started a thesis at the same time, in the same team, and shared office with one another for a while. Later came Vincent Siles and he who became my favorite trolling partner: Mathieu Boespflug. In Sweden I also shared office with Alexandre Buisse, Nils Anders Danielsson, Ulf Norell and Andrés Sicard. And had many fruitful discussion with Andreas Abel and Peter Dybjer. Dear reader, if you enjoy reading my thesis, you have all these people to thank for it. 1 Contents Contents 2 0 Introduction 5 0.1 Effective homology . 6 0.2 Coq................................... 9 0.3 Conventions & notations . 10 0.4 Premises . 11 I Mathematics to compute 13 1 A theory of sets 15 1.1 Bishopian toolkit . 16 1.2 Categories . 18 1.3 Choice! . 21 2 Homological algebra in type theory 25 2.1 Homology . 25 2.2 Abelian categories will not fit . 26 2.3 Preabelian categories . 29 2.4 Graded objects and chain complexes . 30 2.5 Kernels of matrices . 35 II Intermezzo: Down to Coq Implementation 39 3 Efficient computations 41 3.1 A brief history of N .......................... 42 3.2 Going native . 45 3.3 Performance . 50 3.4 Related works . 52 4 A new tactic engine 53 4.1 Refinement . 56 4.2 Combining tactics . 59 4.3 About the implementation . 62 4.4 Further work . 62 III Faster, Higher, Stronger 65 5 On the category of sets 67 5.1 Topoi . 68 5.2 Quasitopoi . 71 2 Content 5.3 Internal language . 74 6 Sharing more code 83 6.1 Categories & additive categories . 83 6.2 Sets as categories and beyond . 86 6.3 The category of graded objects is preabelian . 90 Appendices 95 A Coq development for Kernel computations 97 A.1 Kernels are finite dimensional . 97 A.2 Testing the program . 99 B Strong subsets are classified 103 Conclusion 107 Bibliography 109 Table of slogans 115 Index 117 3 Chapter Zero Introduction - Handbook for the recently diseased. - Deceased. Tim Burton & al., Beetle Juice umans’ incredible ability to make mistakes is cosubstantial to our ability to interact with and communicate in a very noisy environ- Hment. It is necessary for us to be able to ignore differences in voice, and even accents. It contrasts strongly with computers’ stubborn preciseness. Which is at the source of their ability to deal with extremely complex computations as if it was child play. In that sense, computers are really superhuman. But human are also supercomputer. Communication between humans and computers is made hard because of the friction between the impreciseness and robustness of humans and the exactness and fragility of computers. However we can supplement one another in the areas we fail to be efficient at. It has become a banality that computers can help us in this communication process. In particular, we can write type systems to prevent evidently bad programs from being written. We could also mention many programmer-aiding tools like abstract interpretation or model-checking. They all have one thing in common: they do not do what we expect them to do. And there is a good reason for this: we expect them to solve undecidable problems. Computers cannot do that – though they can try to some extent – but humans somewhat can, by providing what computers lack: insight. In other words, humans can help the computer help them communicate with it. Hence, to go further than fully automated tools, we need to lay out an interface between the human and the computer to allow humans to participate in the computing process. Mathematics is a good candidate to that purpose. Indeed, mathematics is designed to reflect humans’ insight, yet they are expressible as rules to be applied and checked mechanically – which can be understood by a computer. Therefore, if mathematics is not, properly speaking, a language, they are a communication construct which is common to humans and computers. From that point of view, problems computers are supposed to help solving are expressed as a mathematical statement, and the human then provides a proof of it. This proof can be very fine grain, making direct use of simple rules in the style of formal logic systems. Or it can be 5 very coarse grain where the computer does most of the work and the human only gives a few hints. Or anything in between. As mathematical statement to solve become more elaborate, proofs get typically more and more tedious. And “tedious” is the job of computers. So we might consider desirable that the computer would help us help it help us communicate with it.