{"id":13992819,"url":"https://github.com/leanprover-community/con-nf","last_synced_at":"2026-01-07T18:54:32.354Z","repository":{"id":37095193,"uuid":"476157715","full_name":"leanprover-community/con-nf","owner":"leanprover-community","description":"A formal consistency proof of Quine's set theory New Foundations","archived":false,"fork":false,"pushed_at":"2024-04-18T15:14:40.000Z","size":5099,"stargazers_count":49,"open_issues_count":1,"forks_count":2,"subscribers_count":17,"default_branch":"main","last_synced_at":"2024-04-25T00:18:33.174Z","etag":null,"topics":["lean4","new-foundations","set-theory"],"latest_commit_sha":null,"homepage":"https://leanprover-community.github.io/con-nf/","language":"Lean","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/leanprover-community.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2022-03-31T05:04:06.000Z","updated_at":"2024-04-28T18:29:18.892Z","dependencies_parsed_at":"2023-12-22T19:31:46.866Z","dependency_job_id":"5df9caa0-df26-4ee3-94c2-da72ffe814fe","html_url":"https://github.com/leanprover-community/con-nf","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leanprover-community%2Fcon-nf","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leanprover-community%2Fcon-nf/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leanprover-community%2Fcon-nf/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leanprover-community%2Fcon-nf/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/leanprover-community","download_url":"https://codeload.github.com/leanprover-community/con-nf/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":227133903,"owners_count":17735823,"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":["lean4","new-foundations","set-theory"],"created_at":"2024-08-09T14:02:08.825Z","updated_at":"2026-01-07T18:54:32.347Z","avatar_url":"https://github.com/leanprover-community.png","language":"Lean","funding_links":[],"categories":["Lean"],"sub_categories":[],"readme":"# New Foundations is consistent\n\n[![Con(NF)](docs/social/ConNF%20social.png)](https://leanprover-community.github.io/con-nf/)\n\n[![.github/workflows/push_main.yml](https://github.com/leanprover-community/con-nf/actions/workflows/push_main.yml/badge.svg)](https://github.com/leanprover-community/con-nf/actions/workflows/push_main.yml)\n\nIn 1937, Quine proposed a set theory called \"New Foundations\", and since 2010, Randall Holmes has claimed to have a proof of its consistency.\nIn this repository, we use the interactive theorem prover Lean to verify the difficult part of his proof, thus proving that New Foundations is indeed consistent.\nThe proof is now complete, and the theorem statements can be found in `ConNF/Model/Result.lean` ([source](https://github.com/leanprover-community/con-nf/blob/main/ConNF/Model/Result.lean), [docs](https://leanprover-community.github.io/con-nf/doc/ConNF/Model/Result.html)).\n\nSee [our website](https://leanprover-community.github.io/con-nf/) for more information, the [documentation of our Lean code](https://leanprover-community.github.io/con-nf/doc/), and the [deformalisation paper](https://zeramorphic.github.io/con-nf-paper/main.l.pdf) that translates the Lean definitions into English.\nYou can also read the [blueprint](https://leanprover-community.github.io/con-nf/blueprint/) that contains a human-readable version of the proof following the Lean code, with links to the formalisations of each statement.\n\nTo run our code locally, install [elan](https://github.com/leanprover/elan), clone the repository, and run the following command in a terminal in the repository's root directory.\n```\nlake exe cache get\n```\nThe code can then be viewed in an editor such as Visual Studio Code, or compiled directly from the command-line using `lake build`.\n\n## License\n\nAll files *not under the `Old/` subdirectory* are dual-licensed under the [Apache 2.0 license](https://opensource.org/license/apache-2-0/) and the [MIT license](https://opensource.org/license/MIT/).\n\nFiles under the `Old/` subdirectory were produced partly thanks to funding from the University of Cambridge, Queens' College, and the Wes and Margaret foundation, and are *not* released under any open-source license.\n\n## Objective\n\nIt is known that New Foundations is consistent if and only if a theory called Tangled Type Theory (TTT) is consistent (see theorem 1 [here](https://randall-holmes.github.io/Papers/tangled.pdf)).\nWe have formally constructed a model of TTT in Lean, thus proving (on paper) that New Foundations is consistent, or in short, Con(NF).\nWe are working from various versions of the paper proof by Holmes:\n\n- [untangled.pdf](https://randall-holmes.github.io/Nfproof/untangled.pdf);\n- [retangled.pdf](https://randall-holmes.github.io/Nfproof/retangled.pdf);\n- [newnfdoc.pdf](https://randall-holmes.github.io/Nfproof/newnfdoc.pdf);\n- [maybedetangled.pdf](https://randall-holmes.github.io/Nfproof/maybedetangled.pdf),\n\nbut many alterations and additions have been made to make the proof compatible with Lean's type theory.\n\nThis project depends on [mathlib](https://github.com/leanprover-community/mathlib4), the community mathematical library written in Lean.\nThis allows us to use familiar results about things like cardinals and groups without having to prove them ourselves.\n\nEvery definition and theorem in mathlib and this project have been checked by Lean's trusted kernel, which computationally verifies that the proofs we have constructed are indeed correct.\nHowever, Lean cannot check that the statements of the definitions and theorems match their intended English equivalents, so when drawing conclusions from the code in this project, translation to and from English must be done with care.\n\n## Tangled type theory\n\nTTT is a many-sorted set theory with equality \"=\" and the membership relation \"∈\".\nThe sorts are indexed by a limit ordinal λ, and elements of λ are called type indices.\nA formula \"x = y\" is well-formed if x and y have the same type, and a formula \"x ∈ y\" is well-formed if x has any type less than y.\n\nOne of the axioms of tangled type theory is extensionality, which stipulates that a set of type α is uniquely determined by its elements of *any* type β \u003c α.\nThis is strange: for example, if two sets of type α differ, they have different type β elements for *every* β \u003c α.\nThis property makes it difficult to construct models of TTT.\n\n## Strategy\n\nOur construction of the model uses the following rough strategy.\n\n### Construction of the base type\n\nLet λ be a limit ordinal, κ \u003e λ be a regular ordinal, and μ \u003e κ be a strong limit cardinal with cofinality at least κ.\nSets of size less than κ are called *small*.\n\nWe first construct an auxiliary type at level -1, called the *base type*, below all types that will eventually become part of the model.\nElements of this type are called atoms (although they are not atoms in the ZFU or NFU sense, for instance).\nThere are μ atoms, partitioned into *litters* of size κ.\n\n### Constructing each type\n\nAt each type level α, we will produce a collection of model elements for our intended model of TTT, which we will sometimes call *t-sets*.\nWe also produce a group of permutations, called *allowable permutations*, which act on the t-sets.\nThe membership relation is preserved under the action of allowable permutations.\nEach t-set is stipulated to have a *support* under the action of allowable permutations; this is a small set of objects called *addresses*, such that whenever an allowable permutation fixes all elements of a support, it also fixes the t-set.\n\nEach t-set at level α will be given a preferred extension of some type β \u003c α, and we can recover from a t-set's elements which extension it prefers.\nThe extensions of such a t-set in other lower types can be deduced from its β-extension.\nThis allows us to satisfy TTT's extensionality axiom.\n\n### Controlling the size of each type\n\nEach type α can only be constructed under the assumption that all types β \u003c α are of size exactly μ (among other hypotheses).\nIt is easy to prove that the collection of t-sets at level α has cardinality at least μ, so we need to show that there are at most μ elements of this set.\nWe do this by showing that there are not that many fundamentally different descriptions of tangles under the action of allowable permutations.\nThis requires the [freedom of action theorem](https://leanprover-community.github.io/con-nf/doc/ConNF/FOA/Result.html#ConNF.StructApprox.freedom_of_action), which is a technical lemma that allows us to construct allowable permutations.\nThe main result of this section is [here](https://leanprover-community.github.io/con-nf/doc/ConNF/Counting/Conclusions.html#ConNF.mk_tSet).\n\n### Finishing the induction\n\nWe can then run the above process recursively to produce the types of tangles at all type levels α.\nThis is an easy step to perform in set theory, but requires a lot of work in type theory because of the interconnectedness of the various inductive hypotheses we need.\nWe then check that our construction indeed produces a model of TTT by checking that it satisfies a finite axiomatisation of the theory.\nWe have chosen to convert Hailperin's finite axiomatisation of NF's comprehension scheme into a finite axiomatisation of TTT, which we present in our [results file](https://leanprover-community.github.io/con-nf/doc/ConNF/Model/Result.html).\nNote, however, that this choice is arbitrary, and any other finite axiomatisation can be easily proven with the infrastructure already in place.\n\n## Dependency graph\n\n[![dependency graph](https://leanprover-community.github.io/con-nf/depgraph.png)](https://leanprover-community.github.io/con-nf/depgraph.pdf)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fleanprover-community%2Fcon-nf","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fleanprover-community%2Fcon-nf","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fleanprover-community%2Fcon-nf/lists"}