Lean / AlexWang-AI/ordered-corner-lean4 / CornerRemoval.lean
Lean reader

CornerRemoval.lean

54 lines6 declarationsno sorryimports CornerRemoval.Main CornerRemoval.Packing CornerRemoval.StripeRemoval CornerRemoval.IdentityMain

Lean 4 Web has Mathlib, so it can check files that import only Mathlib. This one also imports CornerRemoval.Main, CornerRemoval.Packing, CornerRemoval.StripeRemoval, CornerRemoval.IdentityMain, which it does not have: you can read it there, but it will not check. Build the project itself to check it.

  1. import CornerRemoval.Main
  2. import CornerRemoval.Packing
  3. import CornerRemoval.StripeRemoval
  4. import CornerRemoval.IdentityMain
  5. namespace CornerRemoval.Orbit
  6. /-- Explicit bound for all eight patterns having just one zero or just one one. -/
  7. theorem corner_orbit_bound {n : ℕ} (hn : 2 ≤ n) (Q : Pattern)
  8. (hQ : weight Q = 1 ∨ weight Q = 3) (M : Rect n n) :
  9. (((patternDistance Q M : ℝ)/(n:ℝ)^2)/9)^10 ≤
  10. ((patternCopies Q M).card:ℝ)/(n:ℝ)^4 :=
  11. removal_all_corners polynomial_removal hn Q hQ M
  12. def antiDiagonalRep : Pattern := fun i j => !(i == j)
  13. /-- All fourteen non-checkerboard patterns have polynomial removal bounds. -/
  14. theorem removal_except_diagonals (Q : Pattern) (hi : Q ≠ diagonalRep)
  15. (ha : Q ≠ antiDiagonalRep) : PolynomialRemoval Q := by
  16. rcases sixteen_partition Q with hc | ⟨t,b,h | h | h⟩
  17. · exact ⟨9, by norm_num, 10, by decide, fun hn M => corner_orbit_bound hn Q hc M⟩
  18. · exact h ▸ removal_symm t b constant_removal
  19. · exact h ▸ removal_symm t b stripe_removal
  20. · have diag_sym : ∀ a b : Bool,
  21. transposeComplementPattern a b diagonalRep = diagonalRep ∨
  22. transposeComplementPattern a b diagonalRep = antiDiagonalRep := by decide
  23. exact ((diag_sym t b).elim (fun e => hi (h.trans e)) (fun e => ha (h.trans e))).elim
  24. /-- The remaining external input to the sixteen-pattern classification is precisely
  25. polynomial removal for the ordered identity. -/
  26. theorem all_patterns_iff_ordered_identity :
  27. (∀ Q : Pattern, PolynomialRemoval Q) ↔ PolynomialRemoval diagonalRep :=
  28. ⟨fun h => h _, fun h => sixteen_patterns_of_three_representatives polynomial_removal
  29. constant_removal stripe_removal h⟩
  30. /-- The two binary checkerboards share the same numerical removal estimate. -/
  31. theorem diagonal_orbit_bound {n : ℕ} (hn : 2 ≤ n) (Q : Pattern)
  32. (hQ : Q = diagonalRep ∨ Q = antiDiagonalRep) (M : Rect n n) :
  33. (((patternDistance Q M : ℝ)/(n:ℝ)^2)/14)^16 ≤
  34. ((patternCopies Q M).card:ℝ)/(n:ℝ)^4 := by
  35. rcases hQ with rfl | rfl
  36. · exact Identity.ordered_identity_bound hn M
  37. · have e : antiDiagonalRep = transposeComplementPattern false true diagonalRep := by decide
  38. rw [e, patternDistance_symm,patternCounts_symm]
  39. exact Identity.ordered_identity_bound hn _
  40. /-- Polynomial removal for every single ordered binary 2 × 2 pattern. All four
  41. symmetry classes are discharged within this development. -/
  42. theorem polynomial_removal_all_patterns (Q : Pattern) : PolynomialRemoval Q :=
  43. all_patterns_iff_ordered_identity.mpr
  44. ⟨14, by norm_num, 16, by decide, fun hn M => Identity.ordered_identity_bound hn M⟩ Q
  45. end CornerRemoval.Orbit