Lean / Reader
Lean readerPolyAffine.lean
Lean 4 Web has Mathlib, so it can check files that import only Mathlib. This one also imports PolyMinimum, which it does not have: you can read it there, but it will not check. Build the project itself to check it.
import PolyMinimumnamespace CubeCellsnoncomputable sectionopen Classical/-- Orbit of a cell under all affine cubical symmetries, allowing bothreflections and rotations, with unrestricted center. -/def affineClass (S : Finset Pt) (x : Pt) : Finset Pt := S.filter (AffineEquivalent S x)def affineCount (S : Finset Pt) : ℕ := (S.image (affineClass S)).cardtheorem count_affine {S : Finset Pt} (hs : S.Nonempty) :nclasses (centered S) = affineCount S := bylet move := fun z : Pt => z-bary Shave inj : Function.Injective move := fun _ _ h => sub_left_inj.mp hhave hclass (x : Pt) (hx : x∈S) :cellClass (centered S) (move x) = (affineClass S x).image move := byext wconstructor· intro hwobtain ⟨g,hg,he⟩ := mem_class.mp hwhave hw' : w∈centered S := he ▸ hg _ (Finset.mem_image_of_mem _ hx)obtain ⟨y,hy,hy'⟩ := Finset.mem_image.mp hw'refine Finset.mem_image.mpr ⟨y,Finset.mem_filter.mpr ⟨hy,?_⟩,hy'⟩apply (affine_iff_class hs x y).mprrwa [hy']· rintro hobtain ⟨y,hy,rfl⟩ := Finset.mem_image.mp hexact (affine_iff_class hs x y).mp (Finset.mem_filter.mp hy).2have he : classes (centered S)=(S.image (affineClass S)).image (Finset.image move) := byunfold classes centeredrw [Finset.image_image,Finset.image_image]exact Finset.image_congr (fun x hx => hclass x hx)rw [nclasses,he,Finset.card_image_of_injective _ (Finset.image_injective inj)]rfl/-- Source specification of the minimized orbit count, in terms of ordinaryaffine symmetries of the polycube. -/theorem minimum_spec (n : ℕ) :(∃ S : Finset Pt, Polycube S ∧ S.card=n+1 ∧ affineCount S=minimumClasses (n+1)) ∧(∀ S : Finset Pt, Polycube S → S.card=n+1 → minimumClasses (n+1) ≤ affineCount S) := byconstructor· obtain ⟨S,hp,hc,he⟩ := reflects_minimum nhave sn : S.Nonempty := by obtain ⟨x,hx,_⟩ := hp; exact ⟨x,hx⟩exact ⟨S,hp,hc,(count_affine sn).symm.trans he⟩· intro S hp hchave sn : S.Nonempty := by obtain ⟨x,hx,_⟩ := hp; exact ⟨x,hx⟩exact minimum_le ⟨S,hp,hc,count_affine sn⟩endend CubeCells