{"id":14966284,"url":"https://github.com/coq-community/hydra-battles","last_synced_at":"2025-03-23T10:13:26.823Z","repository":{"id":37750208,"uuid":"305692436","full_name":"coq-community/hydra-battles","owner":"coq-community","description":"Variations on Kirby \u0026 Paris' hydra battles and other entertaining math in Coq (collaborative, documented, includes  exercises) [maintainer=@Casteran]","archived":false,"fork":false,"pushed_at":"2025-01-22T14:02:32.000Z","size":21926,"stargazers_count":73,"open_issues_count":12,"forks_count":12,"subscribers_count":8,"default_branch":"master","last_synced_at":"2025-03-15T09:08:03.540Z","etag":null,"topics":["coq","coq-nix-toolbox","discrete-mathematics","docker-coq-action","formal-proofs","hydra-battles","ordinal-notations","primitive-recursive-functions"],"latest_commit_sha":null,"homepage":"https://coq-community.org/hydra-battles/doc/hydras.pdf","language":"Coq","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/coq-community.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-10-20T11:56:09.000Z","updated_at":"2025-03-10T12:09:05.000Z","dependencies_parsed_at":"2023-10-14T18:09:45.848Z","dependency_job_id":"2e6b1279-0918-459e-b4e5-2361901c27ed","html_url":"https://github.com/coq-community/hydra-battles","commit_stats":null,"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/coq-community%2Fhydra-battles","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/coq-community%2Fhydra-battles/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/coq-community%2Fhydra-battles/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/coq-community%2Fhydra-battles/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/coq-community","download_url":"https://codeload.github.com/coq-community/hydra-battles/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245084622,"owners_count":20558250,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["coq","coq-nix-toolbox","discrete-mathematics","docker-coq-action","formal-proofs","hydra-battles","ordinal-notations","primitive-recursive-functions"],"created_at":"2024-09-24T13:36:09.500Z","updated_at":"2025-03-23T10:13:26.791Z","avatar_url":"https://github.com/coq-community.png","language":"Coq","funding_links":[],"categories":["Resources"],"sub_categories":["Books"],"readme":"# Hydras \u0026 Co.\n\n[![Docker CI][docker-action-shield]][docker-action-link]\n[![Contributing][contributing-shield]][contributing-link]\n[![Code of Conduct][conduct-shield]][conduct-link]\n[![Zulip][zulip-shield]][zulip-link]\n\n[docker-action-shield]: https://github.com/coq-community/hydra-battles/workflows/Docker%20CI/badge.svg?branch=master\n[docker-action-link]: https://github.com/coq-community/hydra-battles/actions?query=workflow:\"Docker%20CI\"\n\n[contributing-shield]: https://img.shields.io/badge/contributions-welcome-%23f7931e.svg\n[contributing-link]: https://github.com/coq-community/hydra-battles#contributions-are-welcome\n\n[conduct-shield]: https://img.shields.io/badge/%E2%9D%A4-code%20of%20conduct-%23f15a24.svg\n[conduct-link]: https://github.com/coq-community/manifesto/blob/master/CODE_OF_CONDUCT.md\n\n[zulip-shield]: https://img.shields.io/badge/chat-on%20zulip-%23c1272d.svg\n[zulip-link]: https://coq.zulipchat.com/#narrow/stream/237663-coq-community-devs.20.26.20users\n\n\n\nThis Coq-based project has four parts:\n\n- An exploration of some properties of Kirby and Paris' hydra\n  battles, including the study of several representations of\n  ordinal numbers and a part of the so-called _Ketonen and Solovay\n  machinery_ (combinatorial properties of epsilon0).\n\n  This part also hosts a formalization by Russell O'Connor of\n  primitive recursive functions and Peano Arithmetic (PA).\n\n- Some algorithms for computing _x^n_ with as few multiplications as\n  possible (using _addition chains_).\n\n- A bridge to definitions and results in the\n  [Gaia project](https://github.com/coq-community/gaia), in particular\n  on ordinals.\n\n- A proof originally by Russell O'Connor of the Gödel-Rosser 1st\n  incompleteness theorem, which says that any first order theory\n  extending NN (which is PA without induction) that is complete is\n  inconsistent.\n\nBoth the [documentation](https://coq-community.org/hydra-battles/doc/hydras.pdf)\nand the Coq sources are _work continuously in progress_. For more information on\nhow the project is organized, maintained, and documented, see\n[this paper](https://hal.archives-ouvertes.fr/hal-03404668) from\nthe proceedings of [JFLA 2022](http://jfla.inria.fr/jfla2022.html).\n\n## Meta\n\n- Author(s):\n  - Yves Bertot\n  - Pierre Castéran\n  - Évelyne Contejean\n  - Jeremy Damour\n  - Stéphane Desarzens\n  - Russell O'Connor\n  - Karl Palmskog\n  - Clément Pit-Claudel\n  - Théo Zimmermann\n- Coq-community maintainer(s):\n  - Pierre Castéran ([**@Casteran**](https://github.com/Casteran))\n- License: [MIT License](LICENSE)\n- Compatible Coq versions: 8.14 or later\n- Additional dependencies:\n  - [Equations](https://github.com/mattam82/Coq-Equations) 1.2 or later\n  - [Coq-elpi](https://github.com/LPCIC/coq-elpi) 1.16 or later\n  - [MathComp SSReflect](https://github.com/math-comp/math-comp) 1.15 or later\n  - [MathComp Algebra](https://github.com/math-comp/math-comp)\n  - [Gaia's Schütte ordinals](https://github.com/coq-community/gaia) 1.14 or later\n  - [Mczify](https://github.com/math-comp/mczify)\n  - [LibHyps](https://github.com/Matafou/LibHyps)\n  - [CoqPrime](https://github.com/thery/coqprime)\n  - [ZornsLemma](https://github.com/coq-community/zorns-lemma) 10.2.0 or later\n- Coq namespace: `hydras`, `additions`, `gaia_hydras`, `Goedel`\n- Related publication(s):\n  - [Hydras \u0026 Co.: Formalized mathematics in Coq for inspiration and entertainment](https://hal.archives-ouvertes.fr/hal-03404668) \n  - [Essential Incompleteness of Arithmetic Verified by Coq](https://arxiv.org/abs/cs/0505034) doi:[10.1007/11541868_16](https://doi.org/10.1007/11541868_16)\n  - [Accessible Independence Results for Peano Arithmetic](https://faculty.baruch.cuny.edu/lkirby/accessible_independence_results.pdf) doi:[10.1112/blms/14.4.285](https://doi.org/10.1112/blms/14.4.285)\n  - [Rapidly Growing Ramsey Functions](https://www.jstor.org/stable/2006985) doi:[10.2307/2006985](https://doi.org/10.2307/2006985)\n  - [Proof Theory](https://link.springer.com/book/10.1007/978-3-642-66473-1) doi:[10.1007/978-3-642-66473-1](https://doi.org/10.1007/978-3-642-66473-1)\n\n## Building and installation\n\n- To get the required dependencies, you can use [opam](https://opam.ocaml.org)\n  or [Nix](https://nixos.org). With opam:\n  - `opam install ./coq-hydra-battles.opam --deps-only` to get the _hydra battles_ dependencies;\n  - `opam install ./coq-addition-chains.opam --deps-only` to get the _addition chains_ dependencies.\n  - `opam install ./coq-gaia-hydras.opam --deps-only` to get the _gaia hydras_ dependencies.\n  - `opam install ./coq-goedel.opam --deps-only` to get the _Goedel_ dependencies.\n\n  With Nix, just run `nix-shell` to get all the dependencies\n  (including for building the documentation). If you only want the\n  dependencies to build a sub-package, you can run one of:\n  - `nix-shell --argstr job hydra-battles`\n  - `nix-shell --argstr job addition-chains`\n  - `nix-shell --argstr job gaia-hydras`\n  - `nix-shell --argstr job goedel`\n\n- Building the PDF documentation also requires\n  [Alectryon](https://github.com/cpitclaudel/alectryon) 1.4\n  and [SerAPI](https://github.com/ejgallego/coq-serapi).\n  See [`doc/movies/Readme.md`](doc/movies/Readme.md) for details.\n\n- The general Makefile is in the top directory:\n  - `make` : compilation of the Coq scripts\n  - `make pdf` : generation of PDF documentation as `doc/hydras.pdf`\n  - `make html` : generation of HTML documentation in `theories/html`\n\n- You may also rely on `dune` to install just one part. Run:\n  - `dune build coq-hydra-battles.install` to build only the _hydra battles_ part\n  - `dune build coq-addition-chains.install` to build only the _addition chains_ part\n  - `dune build coq-gaia-hydras.install` to build only the _gaia hydras_ part\n  - `dune build coq-goedel.install` to build only the _goedel_ part\n\n- Documentation for the `master` branch is continuously deployed at:\n  - https://coq-community.org/hydra-battles/doc/hydras.pdf\n  - https://coq-community.org/hydra-battles/theories/html/toc.html\n\n## Contents\n\n### Coq sources (directory theories)\n\n- theories/ordinals\n\n  - Hydra/*.v \n    - Representation in _Coq_ of hydras and hydra battles\n    - A proof of termination of all hydra battles (using ordinal numbers below epsilon0)\n    - A proof that no variant bounded by some ordinal less than epsilon0 can prove this termination\n    - Comparison of the length of some kind of Hydra battles with the Hardy hierarchy of fast growing functions\n    \n  - OrdinalNotations/*.v\n    - Generic formalization on ordinal notations (well-founded ordered datatypes with a comparison function)\n\n  - Epsilon0/*.v\n    - Data types for representing ordinals less than epsilon0 in Cantor normal form\n    - The _Ketonen-Solovay machinery_: canonical sequences, accessibility, paths inside epsilon0\n    - Representation of some hierarchies of fast growing functions\n\n  - Schutte/*.v\n    - An axiomatization of countable ordinals, after Kurt Schütte. It is intended to be a reference for the data types considered in theories/Epsilon0.\n\n  - Gamma0/*.v\n    - A data type for ordinals below Gamma0 in Veblen normal form (**draft**).\n\n  - rpo/*.v\n    - A contribution on _recursive path orderings_ by Evelyne Contejean.\n\n  - Ackermann/*.v\n    - Primitive recursive functions, first-order logic, NN, and PA\n\n  - MoreAck/*.v\n     - Complements to the legacy **Ackermann** library\n\n  - Prelude/*.v\n    - Various auxiliary definitions and lemmas\n\n- theories/additions/*.v  \n  - Addition chains\n\n- theories/gaia/*.v\n  - Bridge to the ordinals in Gaia that are encoded following Schütte and Ackermann\n\n- theories/goedel/*.v\n  - Gödel's 1st incompleteness theorem and its variations\n\n### Exercises\n\n- exercises/ordinals/*.v\n  - Exercises on ordinals\n\n- exercises/primrec/*.v\n  - Exercises on primitive recursive functions\n\n## Contributions are welcome\n\nAny suggestion for improving the Coq scripts and/or the documentation will be taken into account.\n\n- In particular, we would be delighted to replace proofs with simpler ones, and/or to propose various proofs or definitions of the same concept, in order to illustrate different techniques and patterns. New tactics for automatizing the proofs are welcome too.\n\n- Along the text, we propose several _projects_, the solution of which is planned to be integrated in the development.\n\n- Please do not hesitate to send your remarks as GitHub issues and your suggestions of improvements (including solutions of \"projects\") as pull requests.\n- Of course, new topics are welcome !\n\n- If you wish to contribute without having to clone the project /\n  install the dependencies on your machine, you may use\n  [Gitpod](https://gitpod.io/#https://github.com/coq-community/hydra-battles/)\n  to get an editor and all the dependencies in your browser, with\n  support to open pull requests as well.\n\n- __Contact__ : pierre dot casteran at gmail dot com\n\nA bibliography is at the end of the documentation. Please feel free to suggest more references to us.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcoq-community%2Fhydra-battles","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcoq-community%2Fhydra-battles","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcoq-community%2Fhydra-battles/lists"}