Lean / Reader
Lean reader

PolyAffine.lean

53 lines4 declarationsno sorryimports PolyMinimum

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.

  1. import PolyMinimum
  2. namespace CubeCells
  3. noncomputable section
  4. open Classical
  5. /-- Orbit of a cell under all affine cubical symmetries, allowing both
  6. reflections and rotations, with unrestricted center. -/
  7. def affineClass (S : Finset Pt) (x : Pt) : Finset Pt := S.filter (AffineEquivalent S x)
  8. def affineCount (S : Finset Pt) : ℕ := (S.image (affineClass S)).card
  9. theorem count_affine {S : Finset Pt} (hs : S.Nonempty) :
  10. nclasses (centered S) = affineCount S := by
  11. let move := fun z : Pt => z-bary S
  12. have inj : Function.Injective move := fun _ _ h => sub_left_inj.mp h
  13. have hclass (x : Pt) (hx : x∈S) :
  14. cellClass (centered S) (move x) = (affineClass S x).image move := by
  15. ext w
  16. constructor
  17. · intro hw
  18. obtain ⟨g,hg,he⟩ := mem_class.mp hw
  19. have hw' : w∈centered S := he ▸ hg _ (Finset.mem_image_of_mem _ hx)
  20. obtain ⟨y,hy,hy'⟩ := Finset.mem_image.mp hw'
  21. refine Finset.mem_image.mpr ⟨y,Finset.mem_filter.mpr ⟨hy,?_⟩,hy'⟩
  22. apply (affine_iff_class hs x y).mpr
  23. rwa [hy']
  24. · rintro h
  25. obtain ⟨y,hy,rfl⟩ := Finset.mem_image.mp h
  26. exact (affine_iff_class hs x y).mp (Finset.mem_filter.mp hy).2
  27. have he : classes (centered S)=(S.image (affineClass S)).image (Finset.image move) := by
  28. unfold classes centered
  29. rw [Finset.image_image,Finset.image_image]
  30. exact Finset.image_congr (fun x hx => hclass x hx)
  31. rw [nclasses,he,Finset.card_image_of_injective _ (Finset.image_injective inj)]
  32. rfl
  33. /-- Source specification of the minimized orbit count, in terms of ordinary
  34. affine symmetries of the polycube. -/
  35. theorem minimum_spec (n : ℕ) :
  36. (∃ S : Finset Pt, Polycube S ∧ S.card=n+1 ∧ affineCount S=minimumClasses (n+1)) ∧
  37. (∀ S : Finset Pt, Polycube S → S.card=n+1 → minimumClasses (n+1) ≤ affineCount S) := by
  38. constructor
  39. · obtain ⟨S,hp,hc,he⟩ := reflects_minimum n
  40. have sn : S.Nonempty := by obtain ⟨x,hx,_⟩ := hp; exact ⟨x,hx⟩
  41. exact ⟨S,hp,hc,(count_affine sn).symm.trans he⟩
  42. · intro S hp hc
  43. have sn : S.Nonempty := by obtain ⟨x,hx,_⟩ := hp; exact ⟨x,hx⟩
  44. exact minimum_le ⟨S,hp,hc,count_affine sn⟩
  45. end
  46. end CubeCells