Use this theorem
Create a project
lake +leanprover/lean4:v4.35.0 new myproject std.toml cd myprojectStandard template, not
math: themathtemplate adds its own Mathlib requirement pinned to the Lean release tag, not to the Mathlib commit this package is built and tested with, so you would get a second, different Mathlib. Mathlib comes in through this package. Skip this step in an existing project with the same Lean and Mathlib.Add the dependency to
lakefile.toml[[require]] name = "formalizations" git = "https://github.com/karlesmarin/formalizations" rev = "v0.15.0"Import the minimal module
import Formalizations.Reusable.CombinatoricsIn a file of the project, e.g.
Example.lean.Paste the example
open Formalizations.Reusable Filter Topology Classical /-- Bruck–Ryser–Chowla: no finite projective plane has order `6` (`6 ≡ 2 mod 4`, `6` is not a sum of two squares). -/ example (P L : Type*) [Membership P L] [Configuration.ProjectivePlane P L] [Finite P] [Finite L] : Configuration.ProjectivePlane.order P L ≠ 6 := by intro h6 obtain ⟨a, b, hab⟩ := bruck_ryser_chowla P L (Or.inr (by rw [h6])) rw [h6] at hab have ha : a ≤ 2 := by nlinarith have hb : b ≤ 2 := by nlinarith interval_cases a <;> interval_cases b <;> omegaSteps 3 and 4 together are a complete Lean file:
FormalizationsTest/ReusableCombinatoricsExample.leanat v0.15.0, compiled by the CI.Fetch and check
lake update lake lean Example.leanlake updatefetches this package and Mathlib, and Mathlib's update hook downloads the compiled Mathlib (lake exe cache get).lake lean Example.leanbuilds the imports of the file (steps 3 and 4) and checks it. If the file belongs to alean_libof your project,lake build <lib>does the same. Avoid a barelake buildin a project from the standard template: its default target is the executable, whose link compiles every imported Mathlib module to native code. Same versions required: Leanv4.35.0, Mathlibf0b4c81.
Alternative: import Formalizations.Reusable imports the whole layer (all areas).
Bruck–Ryser–Chowla: if a finite projective plane of order n exists and n ≡ 1 or 2 (mod 4), then n is a sum of two squares (so no plane of order 6 or 14).
Lean statement
theorem bruck_ryser_chowla (P L : Type*) [Membership P L] [Configuration.ProjectivePlane P L] [Finite P]
[Finite L]
(h : Configuration.ProjectivePlane.order P L % 4 = 1 ∨
Configuration.ProjectivePlane.order P L % 4 = 2) :
∃ a b : ℕ, Configuration.ProjectivePlane.order P L = a ^ 2 + b ^ 2Links
Lean docstring
Bruck–Ryser–Chowla theorem. If a finite projective plane of order n exists and n ≡ 1 or 2 (mod 4), then n is a sum of two squares (so there is no plane of order 6 or 14).
- Archive:
BruckRyserChowla.exists_sq_add_sq(Formalizations.Combinatorics.Configuration.BruckRyserChowla); the module cites no paper DOI of ours. - Classical reference: R. H. Bruck, H. J. Ryser, The nonexistence of certain finite projective planes, Canad. J. Math. 1 (1949) 88–93; S. Chowla, H. J. Ryser, Combinatorial problems, Canad. J. Math. 2 (1950) 93–99.
- Example: no finite projective plane has order
6.
Upstream
uses Mathlib's Configuration.ProjectivePlane; a specific theorem of finite geometry, not a general API
Depends on, in this repository
None besides the archive module (repo_dependencies = []).