mondrian_defect_zero_of_equal
A rectangle list whose members all have the same area has defect zero, including the empty list.
Statement
theorem mondrian_defect_zero_of_equal (P : List (ℕ × ℕ × ℕ × ℕ)) (A : ℕ)
(h : ∀ r ∈ P, mondrian_rect_area r = A) : mondrian_defect P = 0- Source
- Helper for OP-280 and mondrian_perfect_partition_large_prime_iff. Related work: arXiv:2610.19193, Section 1 (perfect partitions and scaling); arXiv:2007.09639, Theorem 4.1 (available shapes and prime-power exclusions).
- Verified
- 26 Oct 2026
- Axioms
Quot.soundpropext- Built on 2
- mondrian_defectThe defect def(P) = max_{R∈P} |R| − min_{R∈P} |R| of a family of rectangles.
- mondrian_rect_areaThe area |R| = width × height of a rectangle.
- Used by 5
- mondrian_no_perfect_three_prime_area_one_factorFor three distinct primes p,q,r with p>r+1, no perfect admissible integer square partition has common tile area q^s*r*p^a, for arbitrary…
- mondrian_perfect_partition_mulMultiplying all coordinates by a positive integer preserves perfect admissible partitions.
- mondrian_two_prime_area_sides_dvdFor a perfect admissible square partition with common area q^s*p^t and q dividing the square side, both dimensions of every tile are…
- mondrian_perfect_partition_divDividing coordinates by a preserves perfect admissible partitions when a is positive and divides every tile side.
- mondrian_three_prime_common_area_sides_divideFor primes p,q,r with p>r+1, if q divides the square side and every tile in a perfect admissible partition has area q^s*r*p^a, then q…
The proof, explained
The proof first establishes that the list of rectangle areas is identical to a constant list repeating A of length |P|, since by assumption every rectangle in P has area A. It then unfolds the definition of defect: both the maximum and minimum of this replicated list coincide (yielding A for non-empty lists and defaulting to 0 for the empty list), so their difference is zero.
The list of rectangle areas, `P.map mondrian_rect_area`, equals the constant list of A repeated `P.length` times (`List.replicate P.length A`).
To show that mapping the area function over P produces `List.replicate P.length A`, `List.eq_replicate_iff.mpr` reduces the goal to two conditions: the lengths must match, and every element of the mapped list must equal A. The length condition holds because mapping preserves list length (`by simp`). For any element b in the mapped list, `List.mem_map.mp` provides a rectangle r in P such that b is the area of r. By the assumption h, every rectangle in P has area A, so b = A.
uses
List.eq_replicate_iff.mpr,List.mem_map.mphave he : P.map mondrian_rect_area = List.replicate P.length A := by apply List.eq_replicate_iff.mpr refine ⟨by simp, ?_⟩ intro b hb obtain ⟨r, hr, rfl⟩ := List.mem_map.mp hb exact h r hr
The defect of P is zero (`mondrian_defect P = 0`).
By definition (`mondrian_defect`), the defect is the difference between the maximum and minimum area in P, defaulting to 0 when the list is empty. Rewriting with the equality `he` from the previous step replaces the mapped list with `List.replicate P.length A`. By `List.max?_replicate` and `List.min?_replicate`, both the maximum and the minimum evaluate to `if P.length = 0 then none else some A`. Taking the default value 0 via `getD 0` makes both terms evaluate to 0 (if P is empty) or A (if P is non-empty). In both cases, their difference is 0, which `simp` evaluates directly.
uses
mondrian_defect,List.max?_replicate,List.min?_replicatesimp [mondrian_defect, he, List.max?_replicate, List.min?_replicate]
List.eq_replicate_iff.mpr- A list equals `List.replicate n a` if and only if its length is n and all of its elements are equal to a (this lemma provides the implication from right to left).
List.mem_map.mp- If an element b belongs to a mapped list `List.map f l`, then there exists an element a in l such that f(a) = b.
mondrian_defect- The defect of a rectangle partition P, defined as the difference between the maximum and minimum area of its rectangles (with both defaulting to 0 if P is empty).
List.max?_replicate- The maximum element of `List.replicate n a` is `none` if n = 0, and `some a` if n > 0.
List.min?_replicate- The minimum element of `List.replicate n a` is `none` if n = 0, and `some a` if n > 0.
Written by a model (gemini-3.8-flash) from the Lean proof and the goal states Lean reported at each step. Lean verified the proof; this explanation is a reading aid and is not itself machine-checked.
Lean source view module on GitHub
Choose a tactic — a marked line — to see the goals Lean had before and after it, as in Lean’s infoview. Step with ← → or j k.
theorem mondrian_defect_zero_of_equal (P : List (ℕ × ℕ × ℕ × ℕ)) (A : ℕ) (h : ∀ r ∈ P, mondrian_rect_area r = A) : mondrian_defect P = 0 := by have he : P.map mondrian_rect_area = List.replicate P.length A := by apply List.eq_replicate_iff.mpr refine ⟨by simp, ?_⟩ intro b hb obtain ⟨r, hr, rfl⟩ := List.mem_map.mp hb exact h r hr simp [mondrian_defect, he, List.max?_replicate, List.min?_replicate]