Pick's theorem
TheoremPick's theorem for lattice triangles with a vertex at the origin#✓fully proved
Let \(u, v \in \mathbb{Z}^2\) with \(u_0 v_1 - u_1 v_0 \neq 0\), and let \(T \subset \mathbb{R}^2\) be the convex hull of \(0\), \(u\) and \(v\). Let \(I\) be the number of points of \(\mathbb{Z}^2\) in the interior of \(T\) and \(B\) the number of points of \(\mathbb{Z}^2\) on the boundary of \(T\). Then the area (two-dimensional Lebesgue measure) of \(T\) equals \(I + B/2 - 1\).
theorem _root_.MeasureTheory.toReal_volume_convexHull_lattice_triangle (u v : Fin 2 → ℤ)
(h : u 0 * v 1 - u 1 * v 0 ≠ 0) :
(volume (convexHull ℝ ({0, (fun i ↦ (u i : ℝ)), (fun i ↦ (v i : ℝ))} :
Set (Fin 2 → ℝ)))).toReal =
(Set.ncard {z : Fin 2 → ℤ | (fun i ↦ (z i : ℝ)) ∈
interior (convexHull ℝ ({0, (fun i ↦ (u i : ℝ)), (fun i ↦ (v i : ℝ))} :
Set (Fin 2 → ℝ)))} : ℝ) +
(Set.ncard {z : Fin 2 → ℤ | (fun i ↦ (z i : ℝ)) ∈
frontier (convexHull ℝ ({0, (fun i ↦ (u i : ℝ)), (fun i ↦ (v i : ℝ))} :
Set (Fin 2 → ℝ)))} : ℝ) / 2 - 1
Used by 1
TheoremPick's theorem for convex lattice polygons#✓fully proved
Let \(V \subset \mathbb{Z}^2\) be a finite set of lattice points, let \(P \subset \mathbb{R}^2\) be the convex hull of \(V\), and suppose that \(P\) has nonempty interior. Let \(I\) be the number of points of \(\mathbb{Z}^2\) in the interior of \(P\) and \(B\) the number of points of \(\mathbb{Z}^2\) on the boundary of \(P\). Then the area (two-dimensional Lebesgue measure) of \(P\) equals \(I + B/2 - 1\).
Proof: The triangle case counts lattice points in a half-open fundamental parallelogram. A crossing diagonal then cuts larger polygons into two smaller full-dimensional lattice polygons, allowing strong induction on the vertex set.
MetaMathlibExt.pick_convex_lattice_polygon · 15 lines
theorem pick_convex_lattice_polygon (vertices : Finset (Fin 2 → ℤ))
(hfull :
(interior
(convexHull ℝ ((fun z i => (z i : ℝ)) '' (vertices : Set (Fin 2 → ℤ))))).Nonempty) :
(volume
(convexHull ℝ ((fun z i => (z i : ℝ)) '' (vertices : Set (Fin 2 → ℤ))))).toReal =
(Set.ncard {z : Fin 2 → ℤ |
(fun i => (z i : ℝ)) ∈
interior
(convexHull ℝ ((fun z i => (z i : ℝ)) '' (vertices : Set (Fin 2 → ℤ))))} : ℝ) +
(Set.ncard {z : Fin 2 → ℤ |
(fun i => (z i : ℝ)) ∈
frontier
(convexHull ℝ
((fun z i => (z i : ℝ)) '' (vertices : Set (Fin 2 → ℤ))))} : ℝ) / 2 - 1
Sources
- Eugen J. Ionascu, "A Parametrization of Equilateral Triangles Having Integer Coordinates", Journal of Integer Sequences 10 (2007), Article 07.6.7, standard formula
Area = #b / 2 + #i - 1, lines 87–100, https://cs.uwaterloo.ca/journals/JIS/VOL10/Ionascu/ionascu2.tex; Kevin A. Broughan, "The gcd-sum function", Journal of Integer Sequences 4 (2001), Article 01.2.2, trapezium application, lines 699–715 (the prose there prints "+1" but the paper's own derived formula uses the minus-one form), https://cs.uwaterloo.ca/journals/JIS/VOL4/BROUGHAN/gcdsum.tex; Gil Alon and Pete L. Clark, "On the Number of Representations of an Integer by a Linear Form", Journal of Integer Sequences 8 (2005), Article 05.5.2, generalized lattice versionA(P) = δ * (h + b / 2 - 1), lines 633–638 (this article is theδ = 1standard-lattice case), https://cs.uwaterloo.ca/journals/JIS/VOL8/Clark/clark80.tex.
Uses 1
DefinitionLattice points in the plane#✓fully proved
The map \(\mathbb{Z}^2 \to \mathbb{R}^2\) sending a lattice point \((a, b)\) to the point \((a, b)\) of the real plane.
def toPlane (z : ℤ × ℤ) : ℝ × ℝ := ((z.1 : ℝ), (z.2 : ℝ))
Used by 3
DefinitionLattice polygon#✓fully proved
Given integer points \(v_0, \dots, v_{n-1} \in \mathbb{Z}^2\), the lattice polygon on \(v\) is the polygon in \(\mathbb{R}^2\) with \(n\) vertices whose \(i\)-th vertex is \(v_i\), viewed as a point of \(\mathbb{R}^2\).
def latPoly {n : ℕ} (v : Fin n → ℤ × ℤ) : Polygon (ℝ × ℝ) n :=
⟨fun i => toPlane (v i)⟩
def toPlane (z : ℤ × ℤ) : ℝ × ℝ := ((z.1 : ℝ), (z.2 : ℝ))
WantedExt/Geometry/PicksTheoremWanted.lean:59
Uses 1 · Used by 3
DefinitionRegion enclosed by a planar set#✓fully proved
For a set \(S \subseteq \mathbb{R}^2\), the region enclosed by \(S\) is the set of points \(x \notin S\) whose connected component in the complement \(\mathbb{R}^2 \setminus S\) is bounded. For a simple closed curve \(S\) this is the Jordan interior.
def inside (S : Set (ℝ × ℝ)) : Set (ℝ × ℝ) :=
{x | x ∉ S ∧ Bornology.IsBounded (connectedComponentIn Sᶜ x)}
Used by 2
DefinitionEnclosed area#✓fully proved
The area enclosed by a set \(S \subseteq \mathbb{R}^2\) is the Lebesgue measure, as a real number, of the region enclosed by \(S\) (the points \(x \notin S\) whose connected component in \(\mathbb{R}^2 \setminus S\) is bounded); it is taken to be \(0\) when that measure is infinite.
noncomputable def area (S : Set (ℝ × ℝ)) : ℝ := (volume (inside S)).toReal
def inside (S : Set (ℝ × ℝ)) : Set (ℝ × ℝ) :=
{x | x ∉ S ∧ Bornology.IsBounded (connectedComponentIn Sᶜ x)}
WantedExt/Geometry/PicksTheoremWanted.lean:67
Uses 1 · Used by 1
DefinitionCyclically adjacent indices#✓fully proved
Two indices \(i, j \in \{0, \dots, n-1\}\) are adjacent when \(j \equiv i + 1 \pmod n\) or \(i \equiv j + 1 \pmod n\).
Used by 1
DefinitionSimple polygon#✓fully proved
A polygon in \(\mathbb{R}^2\) with vertices \(p_0, \dots, p_{n-1}\) (indices taken mod \(n\)) and edges the segments \(e_i = [p_i, p_{i+1}]\) is simple when consecutive vertices are distinct (\(p_i \ne p_{i+1}\) for all \(i\)), any two edges \(e_i\) and \(e_j\) with \(i \ne j\), \(j \not\equiv i + 1\) and \(i \not\equiv j + 1 \pmod n\) are disjoint, and every two consecutive edges meet only in their common vertex: \(e_i \cap e_{i+1} = \{p_{i+1}\}\) for all \(i\).
def IsSimple {n : ℕ} (poly : Polygon (ℝ × ℝ) n) : Prop :=
poly.HasNondegenerateEdges ∧
(∀ i j : Fin n, i ≠ j → ¬ Adjacent i j →
Disjoint (poly.edgeSet ℝ i) (poly.edgeSet ℝ j)) ∧
(∀ i : Fin n, poly.edgeSet ℝ i ∩ poly.edgeSet ℝ (finRotate n i)
= {poly (finRotate n i)})
def Adjacent {n : ℕ} (i j : Fin n) : Prop :=
finRotate n i = j ∨ finRotate n j = i
WantedExt/Geometry/PicksTheoremWanted.lean:74
Uses 1 · Used by 1
DefinitionNumber of boundary lattice points#✓fully proved
For integer points \(v_0, \dots, v_{n-1} \in \mathbb{Z}^2\), the number of lattice points \(z \in \mathbb{Z}^2\) that lie on the boundary (the union of the edges) of the lattice polygon on \(v\).
noncomputable def boundaryPts {n : ℕ} (v : Fin n → ℤ × ℤ) : ℕ :=
Nat.card {z : ℤ × ℤ | toPlane z ∈ (latPoly v).boundary (R := ℝ)}
def toPlane (z : ℤ × ℤ) : ℝ × ℝ := ((z.1 : ℝ), (z.2 : ℝ))
WantedExt/Geometry/PicksTheoremWanted.lean:59
def latPoly {n : ℕ} (v : Fin n → ℤ × ℤ) : Polygon (ℝ × ℝ) n :=
⟨fun i => toPlane (v i)⟩
WantedExt/Geometry/PicksTheoremWanted.lean:62
Uses 2 · Used by 1
DefinitionNumber of interior lattice points#✓fully proved
For integer points \(v_0, \dots, v_{n-1} \in \mathbb{Z}^2\), the number of lattice points \(z \in \mathbb{Z}^2\) that lie in the region enclosed by the boundary of the lattice polygon on \(v\), that is, the points off the boundary whose connected component in its complement is bounded.
noncomputable def interiorPts {n : ℕ} (v : Fin n → ℤ × ℤ) : ℕ :=
Nat.card {z : ℤ × ℤ | toPlane z ∈ inside ((latPoly v).boundary (R := ℝ))}
def toPlane (z : ℤ × ℤ) : ℝ × ℝ := ((z.1 : ℝ), (z.2 : ℝ))
WantedExt/Geometry/PicksTheoremWanted.lean:59
def inside (S : Set (ℝ × ℝ)) : Set (ℝ × ℝ) :=
{x | x ∉ S ∧ Bornology.IsBounded (connectedComponentIn Sᶜ x)}
WantedExt/Geometry/PicksTheoremWanted.lean:67
def latPoly {n : ℕ} (v : Fin n → ℤ × ℤ) : Polygon (ℝ × ℝ) n :=
⟨fun i => toPlane (v i)⟩
WantedExt/Geometry/PicksTheoremWanted.lean:62
Uses 3 · Used by 1
TheoremPick's theorem#●ready to prove
Let \(n \ge 3\) and let \(v_0, \dots, v_{n-1} \in \mathbb{Z}^2\) be integer points such that the lattice polygon \(P\) in \(\mathbb{R}^2\) with vertices \(v_0, \dots, v_{n-1}\) is simple. Then the area of the region enclosed by the boundary of \(P\) equals \(I + B/2 - 1\), where \(I\) is the number of lattice points in that region and \(B\) is the number of lattice points on the boundary of \(P\).
public theorem_wanted pick {n : ℕ} (hn : 3 ≤ n) (v : Fin n → ℤ × ℤ)
(hsimple : IsSimple (latPoly v)) :
area ((latPoly v).boundary (R := ℝ))
= (interiorPts v : ℝ) + (boundaryPts v : ℝ) / 2 - 1
def IsSimple {n : ℕ} (poly : Polygon (ℝ × ℝ) n) : Prop :=
poly.HasNondegenerateEdges ∧
(∀ i j : Fin n, i ≠ j → ¬ Adjacent i j →
Disjoint (poly.edgeSet ℝ i) (poly.edgeSet ℝ j)) ∧
(∀ i : Fin n, poly.edgeSet ℝ i ∩ poly.edgeSet ℝ (finRotate n i)
= {poly (finRotate n i)})
WantedExt/Geometry/PicksTheoremWanted.lean:78
def latPoly {n : ℕ} (v : Fin n → ℤ × ℤ) : Polygon (ℝ × ℝ) n :=
⟨fun i => toPlane (v i)⟩
WantedExt/Geometry/PicksTheoremWanted.lean:62
noncomputable def area (S : Set (ℝ × ℝ)) : ℝ := (volume (inside S)).toReal
WantedExt/Geometry/PicksTheoremWanted.lean:71
noncomputable def interiorPts {n : ℕ} (v : Fin n → ℤ × ℤ) : ℕ :=
Nat.card {z : ℤ × ℤ | toPlane z ∈ inside ((latPoly v).boundary (R := ℝ))}
WantedExt/Geometry/PicksTheoremWanted.lean:90
noncomputable def boundaryPts {n : ℕ} (v : Fin n → ℤ × ℤ) : ℕ :=
Nat.card {z : ℤ × ℤ | toPlane z ∈ (latPoly v).boundary (R := ℝ)}
WantedExt/Geometry/PicksTheoremWanted.lean:86
Sources
- G. Pick, Geometrisches zur Zahlenlehre (1899). Knill, Some fundamental theorems in mathematics, §154. Problem
pickof the lean-eval benchmark.
Uses 5
Loading dependency explorer…
The dependency explorer needs JavaScript and its graph data.