Lean / Reader
Lean readerFourCubeTheorem.lean
Lean 4 Web has Mathlib, so it can check files that import only Mathlib. This one also imports RealCubeEndpoint, which it does not have: you can read it there, but it will not check. Build the project itself to check it.
import RealCubeEndpointnamespace RealCubenoncomputable sectionopen scoped Classicaldef boxGrid (L : Finset ℝ) : (d : ℕ) → Finset (Point d)| 0 => {()}| d+1 => L ×ˢ boxGrid L dtheorem boxGrid_card (L : Finset ℝ) (d : ℕ) : (boxGrid L d).card=L.card^d := byinduction d with| zero => simp [boxGrid]| succ d ih =>calc_ = L.card * (boxGrid L d).card := Finset.card_product L (boxGrid L d)_ = L.card^(d+1) := by rw [ih,pow_succ,Nat.mul_comm]theorem cube_in_grid {L M : Finset ℝ} {h : ℝ} (inc : ∀ t∈L,t∈M ∧ t+h∈M)(d : ℕ) {a : Point d} (ha : a∈boxGrid L d) : vertices d h a ⊆ boxGrid M d := byinduction d with| zero => simp [vertices,boxGrid]| succ d ih =>intro x hxobtain ⟨hx1,hxt⟩ := Finset.mem_product.mp hxobtain ⟨ha1,hat⟩ := Finset.mem_product.mp haexact Finset.mem_product.mpr ⟨(Finset.mem_insert.mp hx1).elim(fun e => e ▸ (inc _ ha1).1)(fun e => (Finset.mem_singleton.mp e) ▸ (inc _ ha1).2),ih hat hxt⟩def regularHost : Host := boxGrid {0,1,2} 4def smallGridCubes : Finset Cube := (boxGrid {0,1} 4).image (fun a => (a,1))def origin4 : Point 4 := (0,0,0,0,())def regularFamily : Finset Cube := insert (origin4,2) smallGridCubestheorem regular_lower_bound : regularHost.card=81 ∧ regularFamily.card=17 ∧supported regularHost regularFamily := byhave m3 : ({0,1,2} : Finset ℝ).card=3 := by norm_numhave m2 : ({0,1} : Finset ℝ).card=2 := by norm_numhave small : smallGridCubes.card=16 := byunfold smallGridCubesrw [Finset.card_image_of_injective _ (fun _ _ eq => congrArg Prod.fst eq),boxGrid_card,m2]decidehave fresh : (origin4,(2:ℝ))∉smallGridCubes := byintro hmobtain ⟨a,_,eq⟩ := Finset.mem_image.mp hmhave := congrArg Prod.snd eqnorm_num at thisrefine ⟨by rw [regularHost,boxGrid_card,m3]; decide, by rw [regularFamily,Finset.card_insert_of_notMem fresh,small],?_⟩intro c hcrcases Finset.mem_insert.mp hc with e|e· subst crefine ⟨by norm_num, cube_in_grid (L:={0}) (M:={0,1,2}) (h:=2) ?_ 4 ?_⟩· intro t hthave eq := Finset.mem_singleton.mp htsubst t; norm_num· simp [boxGrid,origin4]· obtain ⟨a,ha,he⟩ := Finset.mem_image.mp esubst crefine ⟨by norm_num,cube_in_grid (M:={0,1,2}) (h:=1) ?_ 4 ha⟩intro t htsimp only [Finset.mem_insert,Finset.mem_singleton] at htrcases ht with e|e <;> subst t <;> norm_num/-- Among all 81-point hosts in real four-space the exact greatest possiblenumber of positive homothetic copies of the four-cube vertex set is 17. -/theorem exact_maximum :(∀ (S : Host) (C : Finset Cube), S.card≤81 → supported S C → C.card≤17) ∧∃ (S : Host) (C : Finset Cube), S.card=81 ∧ C.card=17 ∧ supported S C :=⟨at_most_seventeen,regularHost,regularFamily,regular_lower_bound⟩#print axioms exact_maximumendend RealCube