Lean / Reader
Lean readerErdos506CatalogueCheck.lean
Lean 4 Web has Mathlib, so it can check files that import only Mathlib. This one also imports Erdos506.Canonical, which it does not have: you can read it there, but it will not check. Build the project itself to check it.
import Erdos506.Canonicalopen EuclideanGeometryabbrev Plane506 := EuclideanSpace ℝ (Fin 2)namespace Independent506noncomputable def count (P : Set Plane506) : ℕ :=Set.ncard { s : Sphere Plane506 | 3 ≤ {p ∈ P | p ∈ s}.ncard }example : count = Erdos506.numCircles := rfldef answer (n : ℕ) : ℕ :=if n=6 then 8 else if n=7 then 11 else if n=8 then 17else (n-1).choose 2 + 1 - (n-1)/2theorem agree (n : ℕ) : answer n = Erdos506.v1Target n := byunfold answer Erdos506.v1Target Erdos506.v1UniformTargetsplit_ifs <;> omegatheorem full (n : ℕ) (hn : 4 ≤ n) :IsLeast {k : ℕ | ∃ P : Finset Plane506, P.card = n ∧¬ Collinear ℝ (P : Set Plane506) ∧ ¬ Cospherical (P : Set Plane506) ∧count (P : Set Plane506) = k} (answer n) := byrw [agree]exact Erdos506.erdos_506 n hntheorem small (n : ℕ) (hn : 4 ≤ n) (_ : n ≤ 393) :IsLeast {k : ℕ | ∃ P : Finset Plane506, P.card = n ∧¬ Collinear ℝ (P : Set Plane506) ∧ ¬ Cospherical (P : Set Plane506) ∧count (P : Set Plane506) = k} (answer n) := full n hn#print axioms Erdos506.erdos_506#print axioms Independent506.full#print axioms Independent506.smallend Independent506namespace Upstream506open EuclideanGeometrylocal notation "ℝ²" => EuclideanSpace ℝ (Fin 2)noncomputable def numCircles (P : Set ℝ²) : ℕ :=Set.ncard { s : Sphere ℝ² | 3 ≤ {p ∈ P | p ∈ s}.ncard }example : numCircles = Erdos506.numCircles := rfldef erdos_506.answer := Independent506.answerdef erdos_506.variants.small_n.answer := Independent506.answertheorem erdos_506 (n : ℕ) (hn : 4 ≤ n) :IsLeast { k : ℕ | ∃ P : Finset ℝ²,P.card = n ∧ ¬ Collinear ℝ (P : Set ℝ²) ∧ ¬ Cospherical (P : Set ℝ²) ∧numCircles (P : Set ℝ²) = k }(erdos_506.answer n) := byexact Independent506.full n hn#print axioms erdos_506theorem erdos_506.variants.small_n (n : ℕ) (hn : 4 ≤ n) (hn' : n ≤ 393) :IsLeast { k : ℕ | ∃ P : Finset ℝ²,P.card = n ∧ ¬ Collinear ℝ (P : Set ℝ²) ∧ ¬ Cospherical (P : Set ℝ²) ∧numCircles (P : Set ℝ²) = k }(erdos_506.variants.small_n.answer n) := byexact Independent506.small n hn hn'#print axioms erdos_506.variants.small_nend Upstream506