
Hydra Battles in Coq Pierre Castéran LaBRI, Univ. Bordeaux, CNRS UMR 5800, Bordeaux-INP with contributions by Évelyne Contejean, Florian Hatat and Pascal Manoury November 4, 2020 DRAFT 2 3 “I start from one point and go as far as possi- ble.” John Coltrane. 4 Contents 1 Introduction 7 1.1 Remarks . 8 1.2 Acknowledgements . 12 2 Hydras and Hydra Games 15 2.1 Hydras and their Representation in Coq .............. 19 2.2 Relational Description of Hydra Battles . 24 2.3 A Long Battle . 29 2.4 Generic Properties . 38 3 Introduction to Ordinal Numbers and Ordinal Notations 43 3.1 The Mathematical Point of View . 44 3.2 Ordinal Numbers in Coq . 45 3.3 Countable Ordinals . 45 3.4 Ordinal Notations . 46 3.5 Examples of Ordinal Notations . 48 3.6 Limits and Successors . 50 3.7 The Ordinal !2 ............................ 52 3.8 A Notation for Finite Ordinals . 59 3.9 Comparing two Ordinal Notations . 62 3.10 Comparing an Ordinal Notation with Schütte’s Model . 63 3.11 Isomorphism of Ordinal Notations . 64 3.12 Other Ordinal Notations . 65 4 A proof of termination, using epsilon0 67 4.1 The Ordinal 0 ............................ 67 4.2 Well-foundedness and Transfinite Induction . 78 4.3 A Variant for Hydra Battles . 82 5 The Ketonen-Solovay machinery 89 5.1 Introduction . 89 5.2 Canonical Sequences . 90 5.3 Accessibility inside 0 : Paths . 93 5.4 A Proof of Impossibility . 96 5.5 The Case of Standard Battles . 98 5 6 CONTENTS 6 Large Sets and Rapidly Growing Functions 107 6.1 Definitions . 107 6.2 The Length of Minimal Large Sequences . 108 6.3 The Wainer-Hardy Hierarchy (Functions Hα)........... 116 6.4 The Wainer Hierarchy (Functions Fα)............... 122 7 Countable Ordinals (after Schütte) 127 7.1 Declarations and Axioms . 128 7.2 Additional Axioms . 129 7.3 The Successor Function . 132 7.4 Finite Ordinals . 134 7.5 The Definition of omega ....................... 134 7.6 The Exponential of Basis ! ..................... 138 7.7 More about 0 ............................. 141 7.8 Critical Ordinals . 141 7.9 Cantor Normal Form . 142 7.10 An Embedding of T1 into Ord .................... 144 7.11 Related Work . 145 8 The Ordinal Γ0 (first draft) 147 8.1 Introduction . 147 8.2 The Type T2 of Ordinal Terms . 148 8.3 How Big is Γ0?............................ 149 8.4 Veblen Normal Forms . 151 8.5 Main Functions on T2 ........................ 154 8.6 An Ordinal Notation for Γ0 ..................... 156 9 Appendices 159 9.1 Future Work (projects) . 163 9.2 How to Install the Libraries . 163 9.3 Comments on Exercises and Projects . 163 9.4 Index . 164 Chapter 1 Introduction Proof assistants are excellent tools for exploring the structure of mathematical proofs, studying which hypotheses are really needed, and which proof patterns are useful and/or necessary. Since the development of a theory is represented as a bunch of computer files, everyone is able to read the proofs with an arbi- trary level of detail, or to play with the theory by writing alternate proofs or definitions. Among all the theorems proved with the help of proof assistants like Coq, Isabelle, HOL, etc., several statements and proofs share some interesting fea- tures: • Their statements are easy to understand, even by non-mathematicians • Their proof requires some non-trivial mathematical tools • Their mechanization on computer presents some methodological interest. This is obviously the case of the four-color theorem [Gon08] and the Kepler conjecture [H+15]. We do not mention impressive works like the proof of the odd-order theorem [GAA+13], since understanding its statement requires a quite good mathematical culture. Hydra games (a.k.a. Hydra battles) appear in an article published in 1982 by two mathematicians: L. Kirby and J. Paris [KP82]: Accessible Independence Results for Peano Arithmetic. Although the mathematical contents of this paper are quite advanced, the rules of hydra battles are very easy to understand. There are now several sites on Internet where you can find tutorials on hydra games, together with simulators you can play with. See, for instance, the page written by Andrej Bauer [Bau08]. Hydra battles, as well as Goodstein Sequences [Goo44, KP82] are a nice way to present complex termination problems. The article by Kirby and Paris presents a proof of termination based on ordinal numbers, as well as a proof that this termination is not provable in Peano arithmetic. In the book dedicated to J.P. Jouannaud [CLKK07], N. Dershowitz and G. Moser give a thorough survey on this topic [DM07]. Here, we present a development for the Coq proof assistant, after the work of Kirby and Paris. This formalization contains the following main parts: 7 8 CHAPTER 1. INTRODUCTION • Representation in Coq of hydras and hydra battles • A proof that every battle is finite and won by Hercules. This proof is based on a variant which maps any hydra to an ordinal strictly less than 0 and is strictly decreasing along any battle. • Using a combinatorial toolkit designed by J. Ketonen and R. Solovay [KS81], we prove that, for any ordinal µ < 0, there exists no such variant mapping any hydra to an ordinal stricly less than µ. Thus, the complexity of 0 is really needed in the previous proof. • We prove a relation between the length of a “classic” class of battles 1 and the Wainer-Hardy hierarchy of “rapidly growing functions” Hα [Wai70]. The considered class of battles, which we call standard is the most con- sidered one in the scientific litterature(including popularization). Simply put, this document tries to combines the scientific interest of two articles [KP82, KS81] and a book [Sch77] with the playful activity of truly proving theorems. We hope that such a work, besides exploring a nice piece of discrete maths, will show how Coq and its standard library are well fitted to help us to understand some non-trivial mathematical developments, and also to experiment the constructive parts of the proof through functional programming. We also hope to provide a little clarification on infinity (both potential and actual) through the notions of function, computation, limit, types and proofs. 1.1 Remarks 1.1.1 Difference from Kirby and Paris’s Work In [KP82], Kirby and Paris showed that there is no proof of termination of all hydra battles in Peano Arithmetic (PA). Since we are used to writing proofs in higher order logic, the restriction to PA was quite unnatural for us. So we chosed to prove another statement without any reference to PA, by considering a class of proofs indexed by ordinal numbers upto 0. 1.1.2 Trust in our Proofs? Unlike mathematical literature, where definitions and proofs are spread over many articles and books, the whole proof is now inside your computer. It is composed of the .v files you downloaded and parts of Coq’s standard library. Thus, there is no ambiguity in our definitions and the premises of the theorems. Furthermore, you will be able to navigate through the development, using your favourite text editor or IDE, and some commands like Search, Locate, etc. 1.1.3 Assumed Redundancy It may often happen that several definitions of a given concept, or several proofs of a given theorem are possible. If all the versions present some interest, we will make them available, since each one may be of some methodological interest (by 1This class is also called standard in this document (text and proofs). The replication factor of the hydra is exactly i at the i-th round of the battle (see Sect 2.0.1 on page 15). 1.1. REMARKS 9 illustrating some tactic of proof pattern, for instance). We may use Coq’s mod- ule system to make several proofs of a given theorem co-exist in our libraries (see also Sect 1.1.10 on page 12). After some discussions of the pros and cons of each solution, we develop only one of them, leaving the others as exercises or projects (i.e., big or difficult exercises). In order to discuss which assumptions are really needed for proving a theorem, we will also present several aborted proofs. Of course, do not hesitate to contribute nice proofs or alternative definitions ! It may also happen that some proof looks to be useless, because the proven theorem is a trivial consequence of another (proven too) result. For instance, let us consider the three following statements: 1. There is no measure into N for proving the termination of all hydra battles (Sect 2.4.3 on page 39). 2. There is no measure into [0;!2) for proving the termination of all hydra battle (Sect 3.7.3 on page 55). 3. There is no measure into [0; µ) for proving the termination of all hydra battles, for any µ < 0 (Sect 5.4.1 on page 97). Obviously, the third theorem implies the second one, which implies the first one. So, theoretically, a library would contain only a proof of (3) and remarks for (2) and (1). But we found it interesting to make all the three proofs avail- able, allowing the reader to compare their common structure and notice their technical differences. In particular, the proof of (3) uses several non-trivial com- binatorial properties of ordinal numbers up to 0 [KS81], whilst (1) and (2) use simple properties of N and N2. 1.1.4 About Logic Most of the proofs we present are constructive. Whenever possible, we provide the user with an associated function, which she or he can apply in Gallina or OCaml in order to get a “concrete” feeling of the meaning of the considered theorem.
Details
-
File Typepdf
-
Upload Time-
-
Content LanguagesEnglish
-
Upload UserAnonymous/Not logged-in
-
File Pages166 Page
-
File Size-