Discrete Gauss–Bonnet formula for polyominoes
AbbreviationUnit cell of the plane#✓fully proved
A unit cell [a, a + 1] × [b, b + 1] of the plane, labelled by its lower left corner.
abbrev Cell := ℤ × ℤ
Used by 48
AbbreviationLattice point as a vertex of the cell complex#✓fully proved
A lattice point of ℤ², used as a vertex of the cell complex.
abbrev Vtx := ℤ × ℤ
Used by 45
DefinitionCorners of a unit cell#✓fully proved
The four corners of a unit cell.
def cellVerts (c : Cell) : Finset Vtx :=
{(c.1, c.2), (c.1 + 1, c.2), (c.1, c.2 + 1), (c.1 + 1, c.2 + 1)}
abbrev Cell := ℤ × ℤ
MathlibExt/Combinatorics/SimpleGraph/Lattice/CellEulerCharacteristic.lean:46
abbrev Vtx := ℤ × ℤ
MathlibExt/Combinatorics/SimpleGraph/Lattice/CellEulerCharacteristic.lean:49
Uses 2 · Used by 13
DefinitionSides of a unit cell#✓fully proved
The four sides of a unit cell, as unordered pairs of corners.
def cellEdges (c : Cell) : Finset (Sym2 Vtx) :=
{ s((c.1, c.2), (c.1 + 1, c.2)),
s((c.1, c.2 + 1), (c.1 + 1, c.2 + 1)),
s((c.1, c.2), (c.1, c.2 + 1)),
s((c.1 + 1, c.2), (c.1 + 1, c.2 + 1)) }
abbrev Cell := ℤ × ℤ
MathlibExt/Combinatorics/SimpleGraph/Lattice/CellEulerCharacteristic.lean:46
abbrev Vtx := ℤ × ℤ
MathlibExt/Combinatorics/SimpleGraph/Lattice/CellEulerCharacteristic.lean:49
Uses 2 · Used by 15
DefinitionVertices of a union of unit cells#✓fully proved
The vertices of the union of the cells in K.
def regVerts (K : Finset Cell) : Finset Vtx := K.biUnion cellVerts
abbrev Cell := ℤ × ℤ
MathlibExt/Combinatorics/SimpleGraph/Lattice/CellEulerCharacteristic.lean:46
abbrev Vtx := ℤ × ℤ
MathlibExt/Combinatorics/SimpleGraph/Lattice/CellEulerCharacteristic.lean:49
def cellVerts (c : Cell) : Finset Vtx :=
{(c.1, c.2), (c.1 + 1, c.2), (c.1, c.2 + 1), (c.1 + 1, c.2 + 1)}
MathlibExt/Combinatorics/SimpleGraph/Lattice/CellEulerCharacteristic.lean:52
Uses 3 · Used by 25
DefinitionEdges of a union of unit cells#✓fully proved
The edges of the union of the cells in K.
def regEdges (K : Finset Cell) : Finset (Sym2 Vtx) := K.biUnion cellEdges
abbrev Cell := ℤ × ℤ
MathlibExt/Combinatorics/SimpleGraph/Lattice/CellEulerCharacteristic.lean:46
abbrev Vtx := ℤ × ℤ
MathlibExt/Combinatorics/SimpleGraph/Lattice/CellEulerCharacteristic.lean:49
def cellEdges (c : Cell) : Finset (Sym2 Vtx) :=
{ s((c.1, c.2), (c.1 + 1, c.2)),
s((c.1, c.2 + 1), (c.1 + 1, c.2 + 1)),
s((c.1, c.2), (c.1, c.2 + 1)),
s((c.1 + 1, c.2), (c.1 + 1, c.2 + 1)) }
MathlibExt/Combinatorics/SimpleGraph/Lattice/CellEulerCharacteristic.lean:56
Uses 3 · Used by 19
DefinitionEuler characteristic of a union of unit cells#✓fully proved
The Euler characteristic V - E + F of the union of the cells in K, with one face
per
cell.
def regChi (K : Finset Cell) : ℤ :=
(regVerts K).card - (regEdges K).card + K.card
abbrev Cell := ℤ × ℤ
MathlibExt/Combinatorics/SimpleGraph/Lattice/CellEulerCharacteristic.lean:46
def regVerts (K : Finset Cell) : Finset Vtx := K.biUnion cellVerts
MathlibExt/Combinatorics/SimpleGraph/Lattice/CellEulerCharacteristic.lean:63
def regEdges (K : Finset Cell) : Finset (Sym2 Vtx) := K.biUnion cellEdges
MathlibExt/Combinatorics/SimpleGraph/Lattice/CellEulerCharacteristic.lean:66
Uses 4 · Used by 5
DefinitionNumber of new corners added by a cell#✓fully proved
The number of corners of c that are not already vertices of the region K.
def newVerts (c : Cell) (K : Finset Cell) : ℕ := (cellVerts c \ regVerts K).card
abbrev Cell := ℤ × ℤ
MathlibExt/Combinatorics/SimpleGraph/Lattice/CellEulerCharacteristic.lean:46
def cellVerts (c : Cell) : Finset Vtx :=
{(c.1, c.2), (c.1 + 1, c.2), (c.1, c.2 + 1), (c.1 + 1, c.2 + 1)}
MathlibExt/Combinatorics/SimpleGraph/Lattice/CellEulerCharacteristic.lean:52
def regVerts (K : Finset Cell) : Finset Vtx := K.biUnion cellVerts
MathlibExt/Combinatorics/SimpleGraph/Lattice/CellEulerCharacteristic.lean:63
Uses 4 · Used by 1
DefinitionNumber of new sides added by a cell#✓fully proved
The number of sides of c that are not already edges of the region K.
def newEdges (c : Cell) (K : Finset Cell) : ℕ := (cellEdges c \ regEdges K).card
abbrev Cell := ℤ × ℤ
MathlibExt/Combinatorics/SimpleGraph/Lattice/CellEulerCharacteristic.lean:46
def cellEdges (c : Cell) : Finset (Sym2 Vtx) :=
{ s((c.1, c.2), (c.1 + 1, c.2)),
s((c.1, c.2 + 1), (c.1 + 1, c.2 + 1)),
s((c.1, c.2), (c.1, c.2 + 1)),
s((c.1 + 1, c.2), (c.1 + 1, c.2 + 1)) }
MathlibExt/Combinatorics/SimpleGraph/Lattice/CellEulerCharacteristic.lean:56
def regEdges (K : Finset Cell) : Finset (Sym2 Vtx) := K.biUnion cellEdges
MathlibExt/Combinatorics/SimpleGraph/Lattice/CellEulerCharacteristic.lean:66
Uses 4 · Used by 1
InductiveCell regions built by attaching cells along boundary arcs#✓fully proved
Regions built from a single cell by repeatedly attaching a new cell along a boundary arc: the new cell adds one more edge than vertex, so the Euler characteristic is unchanged.
inductive EucBuildable : Finset Cell → Prop
| singleton (c : Cell) : EucBuildable {c}
| attach (c : Cell) (K : Finset Cell) (hK : EucBuildable K) (hc : c ∉ K)
(harc : newEdges c K = newVerts c K + 1) : EucBuildable (insert c K)
abbrev Cell := ℤ × ℤ
MathlibExt/Combinatorics/SimpleGraph/Lattice/CellEulerCharacteristic.lean:46
def newEdges (c : Cell) (K : Finset Cell) : ℕ := (cellEdges c \ regEdges K).card
MathlibExt/Combinatorics/SimpleGraph/Lattice/CellEulerCharacteristic.lean:96
def newVerts (c : Cell) (K : Finset Cell) : ℕ := (cellVerts c \ regVerts K).card
MathlibExt/Combinatorics/SimpleGraph/Lattice/CellEulerCharacteristic.lean:93
Uses 3
DefinitionFour cells around a lattice vertex#✓fully proved
The four cells having v as a corner.
def surroundCells (v : Vtx) : Finset Cell :=
{(v.1 - 1, v.2 - 1), (v.1, v.2 - 1), (v.1 - 1, v.2), (v.1, v.2)}
abbrev Vtx := ℤ × ℤ
MathlibExt/Combinatorics/SimpleGraph/Lattice/CellEulerCharacteristic.lean:49
abbrev Cell := ℤ × ℤ
MathlibExt/Combinatorics/SimpleGraph/Lattice/CellEulerCharacteristic.lean:46
Uses 2 · Used by 1
DefinitionCell degree of a lattice vertex#✓fully proved
The number of cells of K having v as a corner.
def cellDeg (K : Finset Cell) (v : Vtx) : ℕ := (surroundCells v ∩ K).card
abbrev Cell := ℤ × ℤ
MathlibExt/Combinatorics/SimpleGraph/Lattice/CellEulerCharacteristic.lean:46
abbrev Vtx := ℤ × ℤ
MathlibExt/Combinatorics/SimpleGraph/Lattice/CellEulerCharacteristic.lean:49
def surroundCells (v : Vtx) : Finset Cell :=
{(v.1 - 1, v.2 - 1), (v.1, v.2 - 1), (v.1 - 1, v.2), (v.1, v.2)}
MathlibExt/Combinatorics/SimpleGraph/Lattice/AngleDefect.lean:55
Uses 3 · Used by 1
DefinitionEdge degree of a lattice vertex#✓fully proved
The number of edges of the region K incident to v.
def edgeDeg (K : Finset Cell) (v : Vtx) : ℕ :=
((regEdges K).filter (fun e => v ∈ e)).card
abbrev Cell := ℤ × ℤ
MathlibExt/Combinatorics/SimpleGraph/Lattice/CellEulerCharacteristic.lean:46
abbrev Vtx := ℤ × ℤ
MathlibExt/Combinatorics/SimpleGraph/Lattice/CellEulerCharacteristic.lean:49
def regEdges (K : Finset Cell) : Finset (Sym2 Vtx) := K.biUnion cellEdges
MathlibExt/Combinatorics/SimpleGraph/Lattice/CellEulerCharacteristic.lean:66
Uses 3 · Used by 1
DefinitionAngle defect at a lattice vertex#✓fully proved
The angle defect at v, in quarter turns: 4 - 2 · edgeDeg K v + cellDeg K v.
def defect (K : Finset Cell) (v : Vtx) : ℤ :=
4 - 2 * (edgeDeg K v : ℤ) + (cellDeg K v : ℤ)
abbrev Cell := ℤ × ℤ
MathlibExt/Combinatorics/SimpleGraph/Lattice/CellEulerCharacteristic.lean:46
abbrev Vtx := ℤ × ℤ
MathlibExt/Combinatorics/SimpleGraph/Lattice/CellEulerCharacteristic.lean:49
def edgeDeg (K : Finset Cell) (v : Vtx) : ℕ :=
((regEdges K).filter (fun e => v ∈ e)).card
MathlibExt/Combinatorics/SimpleGraph/Lattice/AngleDefect.lean:62
def cellDeg (K : Finset Cell) (v : Vtx) : ℕ := (surroundCells v ∩ K).card
MathlibExt/Combinatorics/SimpleGraph/Lattice/AngleDefect.lean:59
Uses 4 · Used by 3
DefinitionLattice edge to the right neighbour#✓fully proved
The lattice edge from v to its right neighbour.
def incidentEdgeR (v : Vtx) : Sym2 Vtx := s(v, (v.1 + 1, v.2))
abbrev Vtx := ℤ × ℤ
MathlibExt/Combinatorics/SimpleGraph/Lattice/CellEulerCharacteristic.lean:49
Uses 1
DefinitionLattice edge to the left neighbour#✓fully proved
The lattice edge from v to its left neighbour.
def incidentEdgeL (v : Vtx) : Sym2 Vtx := s(v, (v.1 - 1, v.2))
abbrev Vtx := ℤ × ℤ
MathlibExt/Combinatorics/SimpleGraph/Lattice/CellEulerCharacteristic.lean:49
Uses 1
DefinitionLattice edge to the upper neighbour#✓fully proved
The lattice edge from v to its upper neighbour.
def incidentEdgeU (v : Vtx) : Sym2 Vtx := s(v, (v.1, v.2 + 1))
abbrev Vtx := ℤ × ℤ
MathlibExt/Combinatorics/SimpleGraph/Lattice/CellEulerCharacteristic.lean:49
Uses 1
DefinitionLattice edge to the lower neighbour#✓fully proved
The lattice edge from v to its lower neighbour.
def incidentEdgeD (v : Vtx) : Sym2 Vtx := s(v, (v.1, v.2 - 1))
abbrev Vtx := ℤ × ℤ
MathlibExt/Combinatorics/SimpleGraph/Lattice/CellEulerCharacteristic.lean:49
Uses 1
DefinitionNumber of convex corners of a lattice region#✓fully proved
The number of vertices of the region with defect 1 (convex corners).
def wad_n1 (K : Finset Cell) : ℤ :=
((regVerts K).filter (fun v => defect K v = 1)).card
abbrev Cell := ℤ × ℤ
MathlibExt/Combinatorics/SimpleGraph/Lattice/CellEulerCharacteristic.lean:46
def regVerts (K : Finset Cell) : Finset Vtx := K.biUnion cellVerts
MathlibExt/Combinatorics/SimpleGraph/Lattice/CellEulerCharacteristic.lean:63
def defect (K : Finset Cell) (v : Vtx) : ℤ :=
4 - 2 * (edgeDeg K v : ℤ) + (cellDeg K v : ℤ)
MathlibExt/Combinatorics/SimpleGraph/Lattice/AngleDefect.lean:166
DefinitionNumber of reflex corners of a lattice region#✓fully proved
The number of vertices of the region with defect -1 (reflex corners).
def wad_n3 (K : Finset Cell) : ℤ :=
((regVerts K).filter (fun v => defect K v = -1)).card
abbrev Cell := ℤ × ℤ
MathlibExt/Combinatorics/SimpleGraph/Lattice/CellEulerCharacteristic.lean:46
def regVerts (K : Finset Cell) : Finset Vtx := K.biUnion cellVerts
MathlibExt/Combinatorics/SimpleGraph/Lattice/CellEulerCharacteristic.lean:63
def defect (K : Finset Cell) (v : Vtx) : ℤ :=
4 - 2 * (edgeDeg K v : ℤ) + (cellDeg K v : ℤ)
MathlibExt/Combinatorics/SimpleGraph/Lattice/AngleDefect.lean:166
DefinitionNumber of pinch points of a lattice region#✓fully proved
The number of vertices of the region with defect -2 (pinch points, where two cells meet only
at a corner).
def wad_n2d (K : Finset Cell) : ℤ :=
((regVerts K).filter (fun v => defect K v = -2)).card
abbrev Cell := ℤ × ℤ
MathlibExt/Combinatorics/SimpleGraph/Lattice/CellEulerCharacteristic.lean:46
def regVerts (K : Finset Cell) : Finset Vtx := K.biUnion cellVerts
MathlibExt/Combinatorics/SimpleGraph/Lattice/CellEulerCharacteristic.lean:63
def defect (K : Finset Cell) (v : Vtx) : ℤ :=
4 - 2 * (edgeDeg K v : ℤ) + (cellDeg K v : ℤ)
MathlibExt/Combinatorics/SimpleGraph/Lattice/AngleDefect.lean:166
DefinitionFour corners of a unit cell#✓fully proved
The four corners of the unit cell with lower-left corner c.
def cornersOf (c : ℤ × ℤ) : Finset (ℤ × ℤ) :=
{c, (c.1 + 1, c.2), (c.1, c.2 + 1), (c.1 + 1, c.2 + 1)}
Used by 20
DefinitionCorner count of a lattice point#✓fully proved
The number of cells of S having the lattice point v as a corner.
def cornerCount (S : Finset (ℤ × ℤ)) (v : ℤ × ℤ) : ℕ :=
(S.filter (fun c => v ∈ cornersOf c)).card
def cornersOf (c : ℤ × ℤ) : Finset (ℤ × ℤ) :=
{c, (c.1 + 1, c.2), (c.1, c.2 + 1), (c.1 + 1, c.2 + 1)}
MathlibExt/Combinatorics/SimpleGraph/Lattice/TurningNumber/CellCount.lean:42
Uses 1 · Used by 37
DefinitionVertices of a cell complex#✓fully proved
The vertices of the cell complex S: all corners of its cells.
def cellVerts (S : Finset (ℤ × ℤ)) : Finset (ℤ × ℤ) :=
S.biUnion cornersOf
def cornersOf (c : ℤ × ℤ) : Finset (ℤ × ℤ) :=
{c, (c.1 + 1, c.2), (c.1, c.2 + 1), (c.1 + 1, c.2 + 1)}
MathlibExt/Combinatorics/SimpleGraph/Lattice/TurningNumber/CellCount.lean:42
Uses 1 · Used by 22
TheoremA unit cell has four distinct corners#✓fully proved
A cell has four distinct corners.
theorem cornersOf_card (c : ℤ × ℤ) : (cornersOf c).card = 4
def cornersOf (c : ℤ × ℤ) : Finset (ℤ × ℤ) :=
{c, (c.1 + 1, c.2), (c.1, c.2 + 1), (c.1 + 1, c.2 + 1)}
MathlibExt/Combinatorics/SimpleGraph/Lattice/TurningNumber/CellCount.lean:42
Uses 1 · Used by 3
TheoremCharacterization of the corners of a unit cell#✓fully proved
v is a corner of c iff c is one of the four cells around v.
theorem mem_cornersOf_iff (c v : ℤ × ℤ) :
v ∈ cornersOf c ↔
c = v ∨ c = (v.1 - 1, v.2) ∨ c = (v.1, v.2 - 1) ∨ c = (v.1 - 1, v.2 - 1)
def cornersOf (c : ℤ × ℤ) : Finset (ℤ × ℤ) :=
{c, (c.1 + 1, c.2), (c.1, c.2 + 1), (c.1 + 1, c.2 + 1)}
MathlibExt/Combinatorics/SimpleGraph/Lattice/TurningNumber/CellCount.lean:42
Uses 1 · Used by 3
TheoremAt most four cells meet at a lattice point#✓fully proved
At most four cells meet at a lattice point.
theorem cornerCount_le_four (S : Finset (ℤ × ℤ)) (v : ℤ × ℤ) :
cornerCount S v ≤ 4
def cornerCount (S : Finset (ℤ × ℤ)) (v : ℤ × ℤ) : ℕ :=
(S.filter (fun c => v ∈ cornersOf c)).card
MathlibExt/Combinatorics/SimpleGraph/Lattice/TurningNumber/CellCount.lean:46
Uses 3
TheoremDouble counting of cell–corner incidences#✓fully proved
Double counting of cell–corner incidences: ∑ v, cornerCount S v = 4 * S.card.
theorem sum_cornerCount (S : Finset (ℤ × ℤ)) :
∑ v ∈ cellVerts S, cornerCount S v = 4 * S.card
def cellVerts (S : Finset (ℤ × ℤ)) : Finset (ℤ × ℤ) :=
S.biUnion cornersOf
MathlibExt/Combinatorics/SimpleGraph/Lattice/TurningNumber/CellCount.lean:50
def cornerCount (S : Finset (ℤ × ℤ)) (v : ℤ × ℤ) : ℕ :=
(S.filter (fun c => v ∈ cornersOf c)).card
MathlibExt/Combinatorics/SimpleGraph/Lattice/TurningNumber/CellCount.lean:46
Uses 4
DefinitionCorner defect of a set of unit cells#✓fully proved
The corner defect of S: the number of vertices with exactly one incident cell of S (convex
corners) minus the number with exactly three (reflex corners).
def cornerDiff (S : Finset (ℤ × ℤ)) : ℤ :=
((cellVerts S).filter (fun v => cornerCount S v = 1)).card
- ((cellVerts S).filter (fun v => cornerCount S v = 3)).card
def cellVerts (S : Finset (ℤ × ℤ)) : Finset (ℤ × ℤ) :=
S.biUnion cornersOf
MathlibExt/Combinatorics/SimpleGraph/Lattice/TurningNumber/CellCount.lean:50
def cornerCount (S : Finset (ℤ × ℤ)) (v : ℤ × ℤ) : ℕ :=
(S.filter (fun c => v ∈ cornersOf c)).card
MathlibExt/Combinatorics/SimpleGraph/Lattice/TurningNumber/CellCount.lean:46
Uses 2 · Used by 12
TheoremCorner count after adding a cell#✓fully proved
Adding a new cell c raises the corner count by one exactly at the corners of c.
theorem cornerCount_insert (S : Finset (ℤ × ℤ)) (c : ℤ × ℤ) (hc : c ∉ S) (v : ℤ × ℤ) :
cornerCount (insert c S) v = cornerCount S v + (if v ∈ cornersOf c then 1 else 0)
def cornerCount (S : Finset (ℤ × ℤ)) (v : ℤ × ℤ) : ℕ :=
(S.filter (fun c => v ∈ cornersOf c)).card
MathlibExt/Combinatorics/SimpleGraph/Lattice/TurningNumber/CellCount.lean:46
def cornersOf (c : ℤ × ℤ) : Finset (ℤ × ℤ) :=
{c, (c.1 + 1, c.2), (c.1, c.2 + 1), (c.1 + 1, c.2 + 1)}
MathlibExt/Combinatorics/SimpleGraph/Lattice/TurningNumber/CellCount.lean:42
Uses 2 · Used by 1
TheoremVertices of a cell complex after adding a cell#✓fully proved
The vertices of insert c S.
theorem cellVerts_insert (S : Finset (ℤ × ℤ)) (c : ℤ × ℤ) :
cellVerts (insert c S) = cornersOf c ∪ cellVerts S
def cellVerts (S : Finset (ℤ × ℤ)) : Finset (ℤ × ℤ) :=
S.biUnion cornersOf
MathlibExt/Combinatorics/SimpleGraph/Lattice/TurningNumber/CellCount.lean:50
def cornersOf (c : ℤ × ℤ) : Finset (ℤ × ℤ) :=
{c, (c.1 + 1, c.2), (c.1, c.2 + 1), (c.1 + 1, c.2 + 1)}
MathlibExt/Combinatorics/SimpleGraph/Lattice/TurningNumber/CellCount.lean:42
DefinitionCorner weight of a vertex#✓fully proved
The weight of a vertex with k incident cells in the corner defect: 1 if k = 1, -1 if k
= 3, and 0 otherwise.
def cornerWeight (k : ℕ) : ℤ := (if k = 1 then 1 else 0) - (if k = 3 then 1 else 0)
Used by 22
TheoremA lattice point has an incident cell iff it is a vertex#✓fully proved
A lattice point has an incident cell iff it is a vertex of S.
theorem cornerCount_pos_iff_mem (S : Finset (ℤ × ℤ)) (v : ℤ × ℤ) :
0 < cornerCount S v ↔ v ∈ cellVerts S
def cornerCount (S : Finset (ℤ × ℤ)) (v : ℤ × ℤ) : ℕ :=
(S.filter (fun c => v ∈ cornersOf c)).card
MathlibExt/Combinatorics/SimpleGraph/Lattice/TurningNumber/CellCount.lean:46
def cellVerts (S : Finset (ℤ × ℤ)) : Finset (ℤ × ℤ) :=
S.biUnion cornersOf
MathlibExt/Combinatorics/SimpleGraph/Lattice/TurningNumber/CellCount.lean:50
Uses 3 · Used by 5
TheoremCorner defect as a sum of vertex weights#✓fully proved
The corner defect as a sum of vertex weights.
theorem cornerDiff_eq_sum (S : Finset (ℤ × ℤ)) :
cornerDiff S = ∑ v ∈ cellVerts S, cornerWeight (cornerCount S v)
def cornerDiff (S : Finset (ℤ × ℤ)) : ℤ :=
((cellVerts S).filter (fun v => cornerCount S v = 1)).card
- ((cellVerts S).filter (fun v => cornerCount S v = 3)).card
MathlibExt/Combinatorics/SimpleGraph/Lattice/TurningNumber/CellEuler.lean:51
def cellVerts (S : Finset (ℤ × ℤ)) : Finset (ℤ × ℤ) :=
S.biUnion cornersOf
MathlibExt/Combinatorics/SimpleGraph/Lattice/TurningNumber/CellCount.lean:50
def cornerWeight (k : ℕ) : ℤ := (if k = 1 then 1 else 0) - (if k = 3 then 1 else 0)
MathlibExt/Combinatorics/SimpleGraph/Lattice/TurningNumber/CellEuler.lean:74
def cornerCount (S : Finset (ℤ × ℤ)) (v : ℤ × ℤ) : ℕ :=
(S.filter (fun c => v ∈ cornersOf c)).card
MathlibExt/Combinatorics/SimpleGraph/Lattice/TurningNumber/CellCount.lean:46
Uses 4 · Used by 3
TheoremChange of the corner defect when a cell is added#✓fully proved
Change of the corner defect when a new cell is added.
theorem cornerDiff_insert (S : Finset (ℤ × ℤ)) (c : ℤ × ℤ) (hc : c ∉ S) :
cornerDiff (insert c S)
= cornerDiff S + ∑ v ∈ cornersOf c,
(cornerWeight (cornerCount S v + 1) - cornerWeight (cornerCount S v))
def cornerDiff (S : Finset (ℤ × ℤ)) : ℤ :=
((cellVerts S).filter (fun v => cornerCount S v = 1)).card
- ((cellVerts S).filter (fun v => cornerCount S v = 3)).card
MathlibExt/Combinatorics/SimpleGraph/Lattice/TurningNumber/CellEuler.lean:51
def cornersOf (c : ℤ × ℤ) : Finset (ℤ × ℤ) :=
{c, (c.1 + 1, c.2), (c.1, c.2 + 1), (c.1 + 1, c.2 + 1)}
MathlibExt/Combinatorics/SimpleGraph/Lattice/TurningNumber/CellCount.lean:42
def cornerWeight (k : ℕ) : ℤ := (if k = 1 then 1 else 0) - (if k = 3 then 1 else 0)
MathlibExt/Combinatorics/SimpleGraph/Lattice/TurningNumber/CellEuler.lean:74
def cornerCount (S : Finset (ℤ × ℤ)) (v : ℤ × ℤ) : ℕ :=
(S.filter (fun c => v ∈ cornersOf c)).card
MathlibExt/Combinatorics/SimpleGraph/Lattice/TurningNumber/CellCount.lean:46
Uses 9 · Used by 1
TheoremA single cell has corner defect 4#✓fully proved
A single cell has corner defect 4.
theorem cornerDiff_singleton (c : ℤ × ℤ) : cornerDiff ({c} : Finset (ℤ × ℤ)) = 4
def cornerDiff (S : Finset (ℤ × ℤ)) : ℤ :=
((cellVerts S).filter (fun v => cornerCount S v = 1)).card
- ((cellVerts S).filter (fun v => cornerCount S v = 3)).card
MathlibExt/Combinatorics/SimpleGraph/Lattice/TurningNumber/CellEuler.lean:51
Uses 5
TheoremCorner count as a count of the four surrounding cells#✓fully proved
The corner count at v counts the cells of S among the four cells around v.
theorem cornerCount_eq_inter (S : Finset (ℤ × ℤ)) (v : ℤ × ℤ) :
cornerCount S v
= (S ∩ ({v, (v.1 - 1, v.2), (v.1, v.2 - 1), (v.1 - 1, v.2 - 1)} : Finset (ℤ × ℤ))).card
def cornerCount (S : Finset (ℤ × ℤ)) (v : ℤ × ℤ) : ℕ :=
(S.filter (fun c => v ∈ cornersOf c)).card
MathlibExt/Combinatorics/SimpleGraph/Lattice/TurningNumber/CellCount.lean:46
Uses 3 · Used by 7
DefinitionFour edges of a unit cell#✓fully proved
The four edges of cell c, each encoded by twice its midpoint.
def edgesOf (c : ℤ × ℤ) : Finset (ℤ × ℤ) :=
{(2 * c.1 + 1, 2 * c.2), (2 * c.1 + 1, 2 * c.2 + 2),
(2 * c.1, 2 * c.2 + 1), (2 * c.1 + 2, 2 * c.2 + 1)}
Used by 11
DefinitionEdges of a cell complex#✓fully proved
The edges of the cell complex S, encoded by doubled midpoints.
def cellEdges (S : Finset (ℤ × ℤ)) : Finset (ℤ × ℤ) := S.biUnion edgesOf
def edgesOf (c : ℤ × ℤ) : Finset (ℤ × ℤ) :=
{(2 * c.1 + 1, 2 * c.2), (2 * c.1 + 1, 2 * c.2 + 2),
(2 * c.1, 2 * c.2 + 1), (2 * c.1 + 2, 2 * c.2 + 1)}
MathlibExt/Combinatorics/SimpleGraph/Lattice/TurningNumber/CellEuler.lean:168
Uses 1 · Used by 11
DefinitionEuler characteristic of a cell complex#✓fully proved
The Euler characteristic V - E + F of the closed cell complex formed by the cells of S.
def eulerChar (S : Finset (ℤ × ℤ)) : ℤ :=
((cellVerts S).card : ℤ) - (cellEdges S).card + S.card
def cellVerts (S : Finset (ℤ × ℤ)) : Finset (ℤ × ℤ) :=
S.biUnion cornersOf
MathlibExt/Combinatorics/SimpleGraph/Lattice/TurningNumber/CellCount.lean:50
def cellEdges (S : Finset (ℤ × ℤ)) : Finset (ℤ × ℤ) := S.biUnion edgesOf
MathlibExt/Combinatorics/SimpleGraph/Lattice/TurningNumber/CellEuler.lean:173
Uses 2 · Used by 12
TheoremA single cell has Euler characteristic 1#✓fully proved
A single cell has Euler characteristic 1.
theorem eulerChar_singleton (c : ℤ × ℤ) : eulerChar ({c} : Finset (ℤ × ℤ)) = 1
def eulerChar (S : Finset (ℤ × ℤ)) : ℤ :=
((cellVerts S).card : ℤ) - (cellEdges S).card + S.card
MathlibExt/Combinatorics/SimpleGraph/Lattice/TurningNumber/CellEuler.lean:176
Uses 6
TheoremChange of the Euler characteristic when a cell is added#✓fully proved
Change of the Euler characteristic when a new cell is added: new vertices minus new edges plus one.
theorem eulerChar_insert (S : Finset (ℤ × ℤ)) (c : ℤ × ℤ) (hc : c ∉ S) :
eulerChar (insert c S)
= eulerChar S + (((cornersOf c \ cellVerts S).card : ℤ)
- (edgesOf c \ cellEdges S).card + 1)
def eulerChar (S : Finset (ℤ × ℤ)) : ℤ :=
((cellVerts S).card : ℤ) - (cellEdges S).card + S.card
MathlibExt/Combinatorics/SimpleGraph/Lattice/TurningNumber/CellEuler.lean:176
def cornersOf (c : ℤ × ℤ) : Finset (ℤ × ℤ) :=
{c, (c.1 + 1, c.2), (c.1, c.2 + 1), (c.1 + 1, c.2 + 1)}
MathlibExt/Combinatorics/SimpleGraph/Lattice/TurningNumber/CellCount.lean:42
def cellVerts (S : Finset (ℤ × ℤ)) : Finset (ℤ × ℤ) :=
S.biUnion cornersOf
MathlibExt/Combinatorics/SimpleGraph/Lattice/TurningNumber/CellCount.lean:50
def edgesOf (c : ℤ × ℤ) : Finset (ℤ × ℤ) :=
{(2 * c.1 + 1, 2 * c.2), (2 * c.1 + 1, 2 * c.2 + 2),
(2 * c.1, 2 * c.2 + 1), (2 * c.1 + 2, 2 * c.2 + 1)}
MathlibExt/Combinatorics/SimpleGraph/Lattice/TurningNumber/CellEuler.lean:168
def cellEdges (S : Finset (ℤ × ℤ)) : Finset (ℤ × ℤ) := S.biUnion edgesOf
MathlibExt/Combinatorics/SimpleGraph/Lattice/TurningNumber/CellEuler.lean:173
Uses 6 · Used by 1
TheoremCardinality of an intersection as a sum of indicators#✓fully proved
The size of S ∩ T as the sum over T of the indicator of S. See also Finset.sum_boole.
theorem card_inter_eq_sum (S T : Finset (ℤ × ℤ)) :
((S ∩ T).card : ℤ) = ∑ t ∈ T, (if t ∈ S then (1 : ℤ) else 0)
Used by 6
TheoremCorner count at the bottom-left corner of a new cell#✓fully proved
The corner count at the bottom-left corner of a cell (x, y) ∉ S.
theorem cornerCount_BL (S : Finset (ℤ × ℤ)) (x y : ℤ) (hc : (x, y) ∉ S) :
(cornerCount S (x, y) : ℤ)
= (if (x - 1, y) ∈ S then 1 else 0) + (if (x, y - 1) ∈ S then 1 else 0)
+ (if (x - 1, y - 1) ∈ S then 1 else 0)
def cornerCount (S : Finset (ℤ × ℤ)) (v : ℤ × ℤ) : ℕ :=
(S.filter (fun c => v ∈ cornersOf c)).card
MathlibExt/Combinatorics/SimpleGraph/Lattice/TurningNumber/CellCount.lean:46
Uses 3 · Used by 2
TheoremCorner count at the bottom-right corner of a new cell#✓fully proved
The corner count at the bottom-right corner of a cell (x, y) ∉ S.
theorem cornerCount_BR (S : Finset (ℤ × ℤ)) (x y : ℤ) (hc : (x, y) ∉ S) :
(cornerCount S (x + 1, y) : ℤ)
= (if (x + 1, y) ∈ S then 1 else 0) + (if (x + 1, y - 1) ∈ S then 1 else 0)
+ (if (x, y - 1) ∈ S then 1 else 0)
def cornerCount (S : Finset (ℤ × ℤ)) (v : ℤ × ℤ) : ℕ :=
(S.filter (fun c => v ∈ cornersOf c)).card
MathlibExt/Combinatorics/SimpleGraph/Lattice/TurningNumber/CellCount.lean:46
Uses 3 · Used by 2
TheoremCorner count at the top-left corner of a new cell#✓fully proved
The corner count at the top-left corner of a cell (x, y) ∉ S.
theorem cornerCount_TL (S : Finset (ℤ × ℤ)) (x y : ℤ) (hc : (x, y) ∉ S) :
(cornerCount S (x, y + 1) : ℤ)
= (if (x, y + 1) ∈ S then 1 else 0) + (if (x - 1, y + 1) ∈ S then 1 else 0)
+ (if (x - 1, y) ∈ S then 1 else 0)
def cornerCount (S : Finset (ℤ × ℤ)) (v : ℤ × ℤ) : ℕ :=
(S.filter (fun c => v ∈ cornersOf c)).card
MathlibExt/Combinatorics/SimpleGraph/Lattice/TurningNumber/CellCount.lean:46
Uses 3 · Used by 2
TheoremCorner count at the top-right corner of a new cell#✓fully proved
The corner count at the top-right corner of a cell (x, y) ∉ S.
theorem cornerCount_TR (S : Finset (ℤ × ℤ)) (x y : ℤ) (hc : (x, y) ∉ S) :
(cornerCount S (x + 1, y + 1) : ℤ)
= (if (x + 1, y + 1) ∈ S then 1 else 0) + (if (x, y + 1) ∈ S then 1 else 0)
+ (if (x + 1, y) ∈ S then 1 else 0)
def cornerCount (S : Finset (ℤ × ℤ)) (v : ℤ × ℤ) : ℕ :=
(S.filter (fun c => v ∈ cornersOf c)).card
MathlibExt/Combinatorics/SimpleGraph/Lattice/TurningNumber/CellCount.lean:46
Uses 3 · Used by 2
DefinitionMidpoint encoding of a lattice edge#✓fully proved
The lattice edge {a, b} encoded by the sum a + b, twice its midpoint; injective on unit
edges.
TheoremEdge codes of a unit cell are its doubled edge midpoints#✓fully proved
The codes of the edges of a cell are StatMech.Onsager.CellEuler.edgesOf.
theorem image_cellEdges_edgeCode (c : Cell) :
(StatMech.CellEulerChar.cellEdges c).image edgeCode = edgesOf c
abbrev Cell := ℤ × ℤ
MathlibExt/Combinatorics/SimpleGraph/Lattice/CellEulerCharacteristic.lean:46
def cellEdges (c : Cell) : Finset (Sym2 Vtx) :=
{ s((c.1, c.2), (c.1 + 1, c.2)),
s((c.1, c.2 + 1), (c.1 + 1, c.2 + 1)),
s((c.1, c.2), (c.1, c.2 + 1)),
s((c.1 + 1, c.2), (c.1 + 1, c.2 + 1)) }
MathlibExt/Combinatorics/SimpleGraph/Lattice/CellEulerCharacteristic.lean:56
def edgeCode : Sym2 (ℤ × ℤ) → ℤ × ℤ :=
Sym2.lift ⟨fun a b => (a.1 + b.1, a.2 + b.2), by
intro a b
ext <;> simp only <;> omega⟩
MathlibExt/Combinatorics/SimpleGraph/Lattice/TurningNumber/CellEulerBound.lean:52
def edgesOf (c : ℤ × ℤ) : Finset (ℤ × ℤ) :=
{(2 * c.1 + 1, 2 * c.2), (2 * c.1 + 1, 2 * c.2 + 2),
(2 * c.1, 2 * c.2 + 1), (2 * c.1 + 2, 2 * c.2 + 1)}
MathlibExt/Combinatorics/SimpleGraph/Lattice/TurningNumber/CellEuler.lean:168
Uses 5 · Used by 1
TheoremAgreement of the two edge counts of a cell complex#✓fully proved
The two edge counts of a cell complex agree.
theorem card_cellEdges_eq_regEdges (S : Finset Cell) :
(StatMech.Onsager.CellEuler.cellEdges S).card = (regEdges S).card
abbrev Cell := ℤ × ℤ
MathlibExt/Combinatorics/SimpleGraph/Lattice/CellEulerCharacteristic.lean:46
def cellEdges (S : Finset (ℤ × ℤ)) : Finset (ℤ × ℤ) := S.biUnion edgesOf
MathlibExt/Combinatorics/SimpleGraph/Lattice/TurningNumber/CellEuler.lean:173
def regEdges (K : Finset Cell) : Finset (Sym2 Vtx) := K.biUnion cellEdges
MathlibExt/Combinatorics/SimpleGraph/Lattice/CellEulerCharacteristic.lean:66
Uses 8 · Used by 1
TheoremAgreement of the two vertex sets of a cell complex#✓fully proved
The two vertex sets of a cell complex agree.
theorem cellVerts_eq_regVerts (S : Finset Cell) :
StatMech.Onsager.CellCount.cellVerts S = regVerts S
abbrev Cell := ℤ × ℤ
MathlibExt/Combinatorics/SimpleGraph/Lattice/CellEulerCharacteristic.lean:46
def cellVerts (S : Finset (ℤ × ℤ)) : Finset (ℤ × ℤ) :=
S.biUnion cornersOf
MathlibExt/Combinatorics/SimpleGraph/Lattice/TurningNumber/CellCount.lean:50
def regVerts (K : Finset Cell) : Finset Vtx := K.biUnion cellVerts
MathlibExt/Combinatorics/SimpleGraph/Lattice/CellEulerCharacteristic.lean:63
Uses 6 · Used by 1
TheoremAgreement of the two Euler characteristics of a cell complex#✓fully proved
The Euler characteristic eulerChar agrees with StatMech.CellEulerChar.regChi.
theorem eulerChar_eq_regChi (S : Finset Cell) : eulerChar S = regChi S
abbrev Cell := ℤ × ℤ
MathlibExt/Combinatorics/SimpleGraph/Lattice/CellEulerCharacteristic.lean:46
def eulerChar (S : Finset (ℤ × ℤ)) : ℤ :=
((cellVerts S).card : ℤ) - (cellEdges S).card + S.card
MathlibExt/Combinatorics/SimpleGraph/Lattice/TurningNumber/CellEuler.lean:176
def regChi (K : Finset Cell) : ℤ :=
(regVerts K).card - (regEdges K).card + K.card
MathlibExt/Combinatorics/SimpleGraph/Lattice/CellEulerCharacteristic.lean:71
Uses 10 · Used by 3
DefinitionTop edge of a unit cell#✓fully proved
The top edge of the cell c.
def topEdge (c : Cell) : Sym2 Vtx :=
s((c.1, c.2 + 1), (c.1 + 1, c.2 + 1))
abbrev Cell := ℤ × ℤ
MathlibExt/Combinatorics/SimpleGraph/Lattice/CellEulerCharacteristic.lean:46
abbrev Vtx := ℤ × ℤ
MathlibExt/Combinatorics/SimpleGraph/Lattice/CellEulerCharacteristic.lean:49
Uses 2 · Used by 3
DefinitionTop edges of a set of cells#✓fully proved
The top edges of the cells of S.
def topEdges (S : Finset Cell) : Finset (Sym2 Vtx) := S.image topEdge
abbrev Cell := ℤ × ℤ
MathlibExt/Combinatorics/SimpleGraph/Lattice/CellEulerCharacteristic.lean:46
abbrev Vtx := ℤ × ℤ
MathlibExt/Combinatorics/SimpleGraph/Lattice/CellEulerCharacteristic.lean:49
def topEdge (c : Cell) : Sym2 Vtx :=
s((c.1, c.2 + 1), (c.1 + 1, c.2 + 1))
MathlibExt/Combinatorics/SimpleGraph/Lattice/TurningNumber/CellEulerBound.lean:150
Uses 3 · Used by 5
TheoremDistinct cells have distinct top edges#✓fully proved
Distinct cells have distinct top edges.
theorem card_topEdges (S : Finset Cell) : (topEdges S).card = S.card
abbrev Cell := ℤ × ℤ
MathlibExt/Combinatorics/SimpleGraph/Lattice/CellEulerCharacteristic.lean:46
def topEdges (S : Finset Cell) : Finset (Sym2 Vtx) := S.image topEdge
MathlibExt/Combinatorics/SimpleGraph/Lattice/TurningNumber/CellEulerBound.lean:154
Uses 4 · Used by 1
DefinitionOpen-top skeleton of a cell complex#✓fully proved
The 1-skeleton of the cell complex S with the top edge of every cell removed, as a simple
graph on its vertices.
def openTopSkeleton (S : Finset Cell) : SimpleGraph {v // v ∈ regVerts S} where
Adj a b := s(a.1, b.1) ∈ regEdges S \ topEdges S
symm := ⟨fun a b h => by
rwa [Sym2.eq_swap]⟩
loopless := ⟨by
intro a h
exact (wad_edge_not_diag (mem_sdiff.mp h).1) (by simp)⟩
abbrev Cell := ℤ × ℤ
MathlibExt/Combinatorics/SimpleGraph/Lattice/CellEulerCharacteristic.lean:46
def regVerts (K : Finset Cell) : Finset Vtx := K.biUnion cellVerts
MathlibExt/Combinatorics/SimpleGraph/Lattice/CellEulerCharacteristic.lean:63
def regEdges (K : Finset Cell) : Finset (Sym2 Vtx) := K.biUnion cellEdges
MathlibExt/Combinatorics/SimpleGraph/Lattice/CellEulerCharacteristic.lean:66
def topEdges (S : Finset Cell) : Finset (Sym2 Vtx) := S.image topEdge
MathlibExt/Combinatorics/SimpleGraph/Lattice/TurningNumber/CellEulerBound.lean:154
Uses 6 · Used by 4
DefinitionEdges of the open-top skeleton#✓fully proved
The edges of openTopSkeleton S are the edges of S other than top edges.
StatMech.Onsager.CellEulerBound.openTopEdgeEquiv · 15 lines
noncomputable def openTopEdgeEquiv (S : Finset Cell) :
{e // e ∈ (openTopSkeleton S).edgeSet} ≃ {e // e ∈ regEdges S \ topEdges S} where
toFun e := ⟨Sym2.map Subtype.val e.1,
(mem_openTopSkeleton_edgeSet_iff S e.1).mp e.2⟩
invFun e := ⟨e.1.attachWith (fun v hv =>
wad_edge_mem_regVerts (mem_sdiff.mp e.2).1 hv), by
rw [mem_openTopSkeleton_edgeSet_iff]
simpa only [Sym2.attachWith_map_subtypeVal] using e.2⟩
left_inv e := by
apply Subtype.ext
apply Sym2.map.injective Subtype.val_injective
simp only [Sym2.attachWith_map_subtypeVal]
right_inv e := by
apply Subtype.ext
simp only [Sym2.attachWith_map_subtypeVal]
abbrev Cell := ℤ × ℤ
MathlibExt/Combinatorics/SimpleGraph/Lattice/CellEulerCharacteristic.lean:46
def openTopSkeleton (S : Finset Cell) : SimpleGraph {v // v ∈ regVerts S} where
Adj a b := s(a.1, b.1) ∈ regEdges S \ topEdges S
symm := ⟨fun a b h => by
rwa [Sym2.eq_swap]⟩
loopless := ⟨by
intro a h
exact (wad_edge_not_diag (mem_sdiff.mp h).1) (by simp)⟩
MathlibExt/Combinatorics/SimpleGraph/Lattice/TurningNumber/CellEulerBound.lean:172
def regEdges (K : Finset Cell) : Finset (Sym2 Vtx) := K.biUnion cellEdges
MathlibExt/Combinatorics/SimpleGraph/Lattice/CellEulerCharacteristic.lean:66
def topEdges (S : Finset Cell) : Finset (Sym2 Vtx) := S.image topEdge
MathlibExt/Combinatorics/SimpleGraph/Lattice/TurningNumber/CellEulerBound.lean:154
theorem mem_openTopSkeleton_edgeSet_iff (S : Finset Cell)
(e : Sym2 {v // v ∈ regVerts S}) :
e ∈ (openTopSkeleton S).edgeSet ↔
Sym2.map Subtype.val e ∈ regEdges S \ topEdges S
MathlibExt/Combinatorics/SimpleGraph/Lattice/TurningNumber/CellEulerBound.lean:180
theorem wad_edge_mem_regVerts {K : Finset Cell} {e : Sym2 Vtx} (he : e ∈ regEdges K)
{v : Vtx} (hv : v ∈ e) : v ∈ regVerts K
MathlibExt/Combinatorics/SimpleGraph/Lattice/AngleDefect.lean:119
TheoremEdge count bound for a connected open-top skeleton#✓fully proved
If the open-top skeleton is connected, it has at least as many edges as vertices minus one.
theorem regVerts_card_le (S : Finset Cell) (hconn : (openTopSkeleton S).Connected) :
(regVerts S).card ≤ (regEdges S \ topEdges S).card + 1
abbrev Cell := ℤ × ℤ
MathlibExt/Combinatorics/SimpleGraph/Lattice/CellEulerCharacteristic.lean:46
def openTopSkeleton (S : Finset Cell) : SimpleGraph {v // v ∈ regVerts S} where
Adj a b := s(a.1, b.1) ∈ regEdges S \ topEdges S
symm := ⟨fun a b h => by
rwa [Sym2.eq_swap]⟩
loopless := ⟨by
intro a h
exact (wad_edge_not_diag (mem_sdiff.mp h).1) (by simp)⟩
MathlibExt/Combinatorics/SimpleGraph/Lattice/TurningNumber/CellEulerBound.lean:172
def regVerts (K : Finset Cell) : Finset Vtx := K.biUnion cellVerts
MathlibExt/Combinatorics/SimpleGraph/Lattice/CellEulerCharacteristic.lean:63
def regEdges (K : Finset Cell) : Finset (Sym2 Vtx) := K.biUnion cellEdges
MathlibExt/Combinatorics/SimpleGraph/Lattice/CellEulerCharacteristic.lean:66
def topEdges (S : Finset Cell) : Finset (Sym2 Vtx) := S.image topEdge
MathlibExt/Combinatorics/SimpleGraph/Lattice/TurningNumber/CellEulerBound.lean:154
Uses 7 · Used by 1
TheoremRegular Euler characteristic bound via the open-top skeleton#✓fully proved
If the open-top skeleton of S is connected, then regChi S ≤ 1.
theorem regChi_le_one (S : Finset Cell) (hconn : (openTopSkeleton S).Connected) :
regChi S ≤ 1
abbrev Cell := ℤ × ℤ
MathlibExt/Combinatorics/SimpleGraph/Lattice/CellEulerCharacteristic.lean:46
def openTopSkeleton (S : Finset Cell) : SimpleGraph {v // v ∈ regVerts S} where
Adj a b := s(a.1, b.1) ∈ regEdges S \ topEdges S
symm := ⟨fun a b h => by
rwa [Sym2.eq_swap]⟩
loopless := ⟨by
intro a h
exact (wad_edge_not_diag (mem_sdiff.mp h).1) (by simp)⟩
MathlibExt/Combinatorics/SimpleGraph/Lattice/TurningNumber/CellEulerBound.lean:172
def regChi (K : Finset Cell) : ℤ :=
(regVerts K).card - (regEdges K).card + K.card
MathlibExt/Combinatorics/SimpleGraph/Lattice/CellEulerCharacteristic.lean:71
Uses 11 · Used by 1
TheoremEuler characteristic bound via the open-top skeleton#✓fully proved
If the open-top skeleton of S is connected, then eulerChar S ≤ 1. See also
StatMech.Onsager.CellEulerFaithful.eulerChar_le_one_of_skeleton_connected, which assumes
connectivity of the full skeleton.
theorem eulerChar_le_one (S : Finset Cell) (hconn : (openTopSkeleton S).Connected) :
eulerChar S ≤ 1
abbrev Cell := ℤ × ℤ
MathlibExt/Combinatorics/SimpleGraph/Lattice/CellEulerCharacteristic.lean:46
def openTopSkeleton (S : Finset Cell) : SimpleGraph {v // v ∈ regVerts S} where
Adj a b := s(a.1, b.1) ∈ regEdges S \ topEdges S
symm := ⟨fun a b h => by
rwa [Sym2.eq_swap]⟩
loopless := ⟨by
intro a h
exact (wad_edge_not_diag (mem_sdiff.mp h).1) (by simp)⟩
MathlibExt/Combinatorics/SimpleGraph/Lattice/TurningNumber/CellEulerBound.lean:172
def eulerChar (S : Finset (ℤ × ℤ)) : ℤ :=
((cellVerts S).card : ℤ) - (cellEdges S).card + S.card
MathlibExt/Combinatorics/SimpleGraph/Lattice/TurningNumber/CellEuler.lean:176
TheoremCorner defect of two diagonally touching cells#✓fully proved
Two diagonally touching cells have corner defect 6.
theorem cornerDiff_cex :
cornerDiff ({((0:ℤ), (0:ℤ)), ((1:ℤ), (1:ℤ))} : Finset (ℤ × ℤ)) = 6
def cornerDiff (S : Finset (ℤ × ℤ)) : ℤ :=
((cellVerts S).filter (fun v => cornerCount S v = 1)).card
- ((cellVerts S).filter (fun v => cornerCount S v = 3)).card
MathlibExt/Combinatorics/SimpleGraph/Lattice/TurningNumber/CellEuler.lean:51
Uses 1 · Used by 1
TheoremEuler characteristic of two diagonally touching cells#✓fully proved
Two diagonally touching cells have Euler characteristic 1.
theorem eulerChar_cex :
eulerChar ({((0:ℤ), (0:ℤ)), ((1:ℤ), (1:ℤ))} : Finset (ℤ × ℤ)) = 1
def eulerChar (S : Finset (ℤ × ℤ)) : ℤ :=
((cellVerts S).card : ℤ) - (cellEdges S).card + S.card
MathlibExt/Combinatorics/SimpleGraph/Lattice/TurningNumber/CellEuler.lean:176
Uses 1 · Used by 1
TheoremFailure of the cell Gauss–Bonnet formula without a pinch term#✓fully proved
The formula cornerDiff S = 4 * eulerChar S fails in general (two diagonally touching cells);
see StatMech.Onsager.CellGaussBonnetGlobal.cornerDiff_eq for the correct formula with a pinch
term.
theorem gaussBonnet_stated_false :
¬ ∀ S : Finset (ℤ × ℤ), cornerDiff S = 4 * eulerChar S
def cornerDiff (S : Finset (ℤ × ℤ)) : ℤ :=
((cellVerts S).filter (fun v => cornerCount S v = 1)).card
- ((cellVerts S).filter (fun v => cornerCount S v = 3)).card
MathlibExt/Combinatorics/SimpleGraph/Lattice/TurningNumber/CellEuler.lean:51
def eulerChar (S : Finset (ℤ × ℤ)) : ℤ :=
((cellVerts S).card : ℤ) - (cellEdges S).card + S.card
MathlibExt/Combinatorics/SimpleGraph/Lattice/TurningNumber/CellEuler.lean:176
DefinitionIndicator of a Boolean#✓fully proved
The indicator 1 or 0 of a Boolean.
def bI (b : Bool) : ℤ := if b then 1 else 0
Used by 10
DefinitionInteger-valued corner weight#✓fully proved
The vertex weight cornerWeight extended to integers.
def icw (k : ℤ) : ℤ := (if k = 1 then 1 else 0) - (if k = 3 then 1 else 0)
DefinitionInteger jump of the corner weight#✓fully proved
The change of the vertex weight from m to m + 1 incident cells.
DefinitionIndicator of zero#✓fully proved
The indicator of m = 0.
def isZero (m : ℤ) : ℤ := if m = 0 then 1 else 0
DefinitionLocal change of the corner defect#✓fully proved
The change of the corner defect when a cell is added, given which of its eight neighbours are
present (e, w, n, s, ne, nw, se, sw).
def lhsLocal (e w n s ne nw se sw : Bool) : ℤ :=
ijump (bI w + bI s + bI sw) + ijump (bI e + bI se + bI s)
+ ijump (bI n + bI nw + bI w) + ijump (bI ne + bI n + bI e)
def ijump (m : ℤ) : ℤ := icw (m + 1) - icw m
MathlibExt/Combinatorics/SimpleGraph/Lattice/TurningNumber/CellGaussBonnetLocal.lean:69
def bI (b : Bool) : ℤ := if b then 1 else 0
MathlibExt/Combinatorics/SimpleGraph/Lattice/TurningNumber/CellGaussBonnetLocal.lean:63
DefinitionNumber of new vertices when a cell is added#✓fully proved
The number of new vertices when a cell is added, given its eight neighbours.
def deltaV (e w n s ne nw se sw : Bool) : ℤ :=
isZero (bI w + bI s + bI sw) + isZero (bI e + bI se + bI s)
+ isZero (bI n + bI nw + bI w) + isZero (bI ne + bI n + bI e)
def isZero (m : ℤ) : ℤ := if m = 0 then 1 else 0
MathlibExt/Combinatorics/SimpleGraph/Lattice/TurningNumber/CellGaussBonnetLocal.lean:72
def bI (b : Bool) : ℤ := if b then 1 else 0
MathlibExt/Combinatorics/SimpleGraph/Lattice/TurningNumber/CellGaussBonnetLocal.lean:63
DefinitionNumber of new edges when a cell is added#✓fully proved
The number of new edges when a cell is added, given its four side neighbours.
def deltaE (e w n s : Bool) : ℤ :=
(1 - bI s) + (1 - bI n) + (1 - bI w) + (1 - bI e)
def bI (b : Bool) : ℤ := if b then 1 else 0
MathlibExt/Combinatorics/SimpleGraph/Lattice/TurningNumber/CellGaussBonnetLocal.lean:63
Uses 1 · Used by 4
DefinitionFour times the local change of the Euler characteristic#✓fully proved
Four times the change of the Euler characteristic when a cell is added.
def rhsStated (e w n s ne nw se sw : Bool) : ℤ :=
4 * (deltaV e w n s ne nw se sw - deltaE e w n s + 1)
def deltaV (e w n s ne nw se sw : Bool) : ℤ :=
isZero (bI w + bI s + bI sw) + isZero (bI e + bI se + bI s)
+ isZero (bI n + bI nw + bI w) + isZero (bI ne + bI n + bI e)
MathlibExt/Combinatorics/SimpleGraph/Lattice/TurningNumber/CellGaussBonnetLocal.lean:81
def deltaE (e w n s : Bool) : ℤ :=
(1 - bI s) + (1 - bI n) + (1 - bI w) + (1 - bI e)
MathlibExt/Combinatorics/SimpleGraph/Lattice/TurningNumber/CellGaussBonnetLocal.lean:86
Uses 2 · Used by 2
TheoremFailure of the local identity without a pinch term#✓fully proved
The change of the corner defect is not always four times the change of the Euler characteristic.
theorem localIdentity_stated_false :
¬ ∀ e w n s ne nw se sw : Bool,
lhsLocal e w n s ne nw se sw = rhsStated e w n s ne nw se sw
def lhsLocal (e w n s ne nw se sw : Bool) : ℤ :=
ijump (bI w + bI s + bI sw) + ijump (bI e + bI se + bI s)
+ ijump (bI n + bI nw + bI w) + ijump (bI ne + bI n + bI e)
MathlibExt/Combinatorics/SimpleGraph/Lattice/TurningNumber/CellGaussBonnetLocal.lean:76
def rhsStated (e w n s ne nw se sw : Bool) : ℤ :=
4 * (deltaV e w n s ne nw se sw - deltaE e w n s + 1)
MathlibExt/Combinatorics/SimpleGraph/Lattice/TurningNumber/CellGaussBonnetLocal.lean:90
Uses 8
DefinitionLocal change of the number of pinch points#✓fully proved
The change of the number of pinch points at the four corners of a new cell, given its eight neighbours.
def pinchDelta (e w n s ne nw se sw : Bool) : ℤ :=
(bI (sw && !w && !s) - bI (w && s && !sw))
+ (bI (se && !e && !s) - bI (e && s && !se))
+ (bI (nw && !n && !w) - bI (n && w && !nw))
+ (bI (ne && !n && !e) - bI (n && e && !ne))
def bI (b : Bool) : ℤ := if b then 1 else 0
MathlibExt/Combinatorics/SimpleGraph/Lattice/TurningNumber/CellGaussBonnetLocal.lean:63
Uses 1 · Used by 3
DefinitionCorrected right side of the local Gauss–Bonnet identity#✓fully proved
Four times the change of the Euler characteristic plus twice the change of the number of pinch points.
def rhsCorrected (e w n s ne nw se sw : Bool) : ℤ :=
rhsStated e w n s ne nw se sw + 2 * pinchDelta e w n s ne nw se sw
def rhsStated (e w n s ne nw se sw : Bool) : ℤ :=
4 * (deltaV e w n s ne nw se sw - deltaE e w n s + 1)
MathlibExt/Combinatorics/SimpleGraph/Lattice/TurningNumber/CellGaussBonnetLocal.lean:90
def pinchDelta (e w n s ne nw se sw : Bool) : ℤ :=
(bI (sw && !w && !s) - bI (w && s && !sw))
+ (bI (se && !e && !s) - bI (e && s && !se))
+ (bI (nw && !n && !w) - bI (n && w && !nw))
+ (bI (ne && !n && !e) - bI (n && e && !ne))
MathlibExt/Combinatorics/SimpleGraph/Lattice/TurningNumber/CellGaussBonnetLocal.lean:105
Uses 2 · Used by 2
TheoremLocal cell Gauss–Bonnet identity#✓fully proved
Local cell Gauss–Bonnet identity: when a cell is added, the change of the corner defect is four times the change of the Euler characteristic plus twice the change of the number of pinch points.
theorem localIdentity_corrected :
∀ e w n s ne nw se sw : Bool,
lhsLocal e w n s ne nw se sw = rhsCorrected e w n s ne nw se sw
def lhsLocal (e w n s ne nw se sw : Bool) : ℤ :=
ijump (bI w + bI s + bI sw) + ijump (bI e + bI se + bI s)
+ ijump (bI n + bI nw + bI w) + ijump (bI ne + bI n + bI e)
MathlibExt/Combinatorics/SimpleGraph/Lattice/TurningNumber/CellGaussBonnetLocal.lean:76
def rhsCorrected (e w n s ne nw se sw : Bool) : ℤ :=
rhsStated e w n s ne nw se sw + 2 * pinchDelta e w n s ne nw se sw
MathlibExt/Combinatorics/SimpleGraph/Lattice/TurningNumber/CellGaussBonnetLocal.lean:113
Uses 2 · Used by 1
TheoremCorner weight agrees with its integer version#✓fully proved
cornerWeight agrees with its integer version icw.
theorem cornerWeight_eq_icw (m : ℕ) : cornerWeight m = icw (m : ℤ)
def cornerWeight (k : ℕ) : ℤ := (if k = 1 then 1 else 0) - (if k = 3 then 1 else 0)
MathlibExt/Combinatorics/SimpleGraph/Lattice/TurningNumber/CellEuler.lean:74
def icw (k : ℤ) : ℤ := (if k = 1 then 1 else 0) - (if k = 3 then 1 else 0)
MathlibExt/Combinatorics/SimpleGraph/Lattice/TurningNumber/CellGaussBonnetLocal.lean:66
Uses 2 · Used by 1
TheoremChange of a vertex weight when one more cell is incident#✓fully proved
The change of a vertex weight when one more cell becomes incident.
theorem cornerWeight_jump (m : ℕ) :
cornerWeight (m + 1) - cornerWeight m = ijump (m : ℤ)
def cornerWeight (k : ℕ) : ℤ := (if k = 1 then 1 else 0) - (if k = 3 then 1 else 0)
MathlibExt/Combinatorics/SimpleGraph/Lattice/TurningNumber/CellEuler.lean:74
def ijump (m : ℤ) : ℤ := icw (m + 1) - icw m
MathlibExt/Combinatorics/SimpleGraph/Lattice/TurningNumber/CellGaussBonnetLocal.lean:69
Uses 4 · Used by 1
TheoremBoolean indicator of a decided proposition#✓fully proved
The indicator bI of a decided proposition.
theorem bI_decide (p : Prop) [Decidable p] : bI (decide p) = if p then 1 else 0
def bI (b : Bool) : ℤ := if b then 1 else 0
MathlibExt/Combinatorics/SimpleGraph/Lattice/TurningNumber/CellGaussBonnetLocal.lean:63
Uses 1
TheoremChange of the corner defect in terms of eight neighbours#✓fully proved
The change of the corner defect when the cell (x, y) is added, in terms of its eight
neighbours.
theorem cornerDiff_jump_sum (S : Finset (ℤ × ℤ)) (x y : ℤ) (hc : (x, y) ∉ S) :
(∑ v ∈ cornersOf (x, y),
(cornerWeight (cornerCount S v + 1) - cornerWeight (cornerCount S v)))
= lhsLocal (decide ((x + 1, y) ∈ S)) (decide ((x - 1, y) ∈ S)) (decide ((x, y + 1) ∈ S))
(decide ((x, y - 1) ∈ S)) (decide ((x + 1, y + 1) ∈ S)) (decide ((x - 1, y + 1) ∈ S))
(decide ((x + 1, y - 1) ∈ S)) (decide ((x - 1, y - 1) ∈ S))
def cornersOf (c : ℤ × ℤ) : Finset (ℤ × ℤ) :=
{c, (c.1 + 1, c.2), (c.1, c.2 + 1), (c.1 + 1, c.2 + 1)}
MathlibExt/Combinatorics/SimpleGraph/Lattice/TurningNumber/CellCount.lean:42
def cornerWeight (k : ℕ) : ℤ := (if k = 1 then 1 else 0) - (if k = 3 then 1 else 0)
MathlibExt/Combinatorics/SimpleGraph/Lattice/TurningNumber/CellEuler.lean:74
def cornerCount (S : Finset (ℤ × ℤ)) (v : ℤ × ℤ) : ℕ :=
(S.filter (fun c => v ∈ cornersOf c)).card
MathlibExt/Combinatorics/SimpleGraph/Lattice/TurningNumber/CellCount.lean:46
def lhsLocal (e w n s ne nw se sw : Bool) : ℤ :=
ijump (bI w + bI s + bI sw) + ijump (bI e + bI se + bI s)
+ ijump (bI n + bI nw + bI w) + ijump (bI ne + bI n + bI e)
MathlibExt/Combinatorics/SimpleGraph/Lattice/TurningNumber/CellGaussBonnetLocal.lean:76
Uses 11 · Used by 1
TheoremNon-vertices are the points with no incident cell#✓fully proved
A lattice point is not a vertex of S iff no cell of S is incident to it.
theorem notMem_cellVerts_iff_cornerCount_zero (S : Finset (ℤ × ℤ)) (v : ℤ × ℤ) :
v ∉ cellVerts S ↔ cornerCount S v = 0
def cellVerts (S : Finset (ℤ × ℤ)) : Finset (ℤ × ℤ) :=
S.biUnion cornersOf
MathlibExt/Combinatorics/SimpleGraph/Lattice/TurningNumber/CellCount.lean:50
def cornerCount (S : Finset (ℤ × ℤ)) (v : ℤ × ℤ) : ℕ :=
(S.filter (fun c => v ∈ cornersOf c)).card
MathlibExt/Combinatorics/SimpleGraph/Lattice/TurningNumber/CellCount.lean:46
Uses 3 · Used by 1
TheoremCardinality of a set difference as a sum of indicators#✓fully proved
The size of s \ t as a sum of indicators.
theorem card_sdiff_eq_sum (s t : Finset (ℤ × ℤ)) :
((s \ t).card : ℤ) = ∑ v ∈ s, (if v ∉ t then (1 : ℤ) else 0)
TheoremNew vertices of an added cell match the local count#✓fully proved
The number of new vertices when the cell (x, y) is added.
theorem sdiff_cellVerts_card_eq_deltaV (S : Finset (ℤ × ℤ)) (x y : ℤ) (hc : (x, y) ∉ S) :
((cornersOf (x, y) \ cellVerts S).card : ℤ)
= deltaV (decide ((x + 1, y) ∈ S)) (decide ((x - 1, y) ∈ S)) (decide ((x, y + 1) ∈ S))
(decide ((x, y - 1) ∈ S)) (decide ((x + 1, y + 1) ∈ S)) (decide ((x - 1, y + 1) ∈ S))
(decide ((x + 1, y - 1) ∈ S)) (decide ((x - 1, y - 1) ∈ S))
def cornersOf (c : ℤ × ℤ) : Finset (ℤ × ℤ) :=
{c, (c.1 + 1, c.2), (c.1, c.2 + 1), (c.1 + 1, c.2 + 1)}
MathlibExt/Combinatorics/SimpleGraph/Lattice/TurningNumber/CellCount.lean:42
def cellVerts (S : Finset (ℤ × ℤ)) : Finset (ℤ × ℤ) :=
S.biUnion cornersOf
MathlibExt/Combinatorics/SimpleGraph/Lattice/TurningNumber/CellCount.lean:50
def deltaV (e w n s ne nw se sw : Bool) : ℤ :=
isZero (bI w + bI s + bI sw) + isZero (bI e + bI se + bI s)
+ isZero (bI n + bI nw + bI w) + isZero (bI ne + bI n + bI e)
MathlibExt/Combinatorics/SimpleGraph/Lattice/TurningNumber/CellGaussBonnetLocal.lean:81
Uses 12 · Used by 1
TheoremMembership of a cell's bottom edge in the cell complex#✓fully proved
The horizontal edge with doubled midpoint (2x + 1, 2y) belongs to S iff one of the two cells
it bounds does.
theorem mem_cellEdges_bottom (S : Finset (ℤ × ℤ)) (x y : ℤ) :
((2 * x + 1, 2 * y) : ℤ × ℤ) ∈ cellEdges S ↔ (x, y) ∈ S ∨ (x, y - 1) ∈ S
def cellEdges (S : Finset (ℤ × ℤ)) : Finset (ℤ × ℤ) := S.biUnion edgesOf
MathlibExt/Combinatorics/SimpleGraph/Lattice/TurningNumber/CellEuler.lean:173
Uses 2 · Used by 1
TheoremMembership of a cell's top edge in the cell complex#✓fully proved
The horizontal edge with doubled midpoint (2x + 1, 2y + 2) belongs to S iff one of the two
cells it bounds does.
theorem mem_cellEdges_top (S : Finset (ℤ × ℤ)) (x y : ℤ) :
((2 * x + 1, 2 * y + 2) : ℤ × ℤ) ∈ cellEdges S ↔ (x, y) ∈ S ∨ (x, y + 1) ∈ S
def cellEdges (S : Finset (ℤ × ℤ)) : Finset (ℤ × ℤ) := S.biUnion edgesOf
MathlibExt/Combinatorics/SimpleGraph/Lattice/TurningNumber/CellEuler.lean:173
Uses 2 · Used by 1
TheoremMembership of a cell's left edge in the cell complex#✓fully proved
The vertical edge with doubled midpoint (2x, 2y + 1) belongs to S iff one of the two cells
it bounds does.
theorem mem_cellEdges_left (S : Finset (ℤ × ℤ)) (x y : ℤ) :
((2 * x, 2 * y + 1) : ℤ × ℤ) ∈ cellEdges S ↔ (x, y) ∈ S ∨ (x - 1, y) ∈ S
def cellEdges (S : Finset (ℤ × ℤ)) : Finset (ℤ × ℤ) := S.biUnion edgesOf
MathlibExt/Combinatorics/SimpleGraph/Lattice/TurningNumber/CellEuler.lean:173
Uses 2 · Used by 1
TheoremMembership of a cell's right edge in the cell complex#✓fully proved
The vertical edge with doubled midpoint (2x + 2, 2y + 1) belongs to S iff one of the two
cells it bounds does.
theorem mem_cellEdges_right (S : Finset (ℤ × ℤ)) (x y : ℤ) :
((2 * x + 2, 2 * y + 1) : ℤ × ℤ) ∈ cellEdges S ↔ (x, y) ∈ S ∨ (x + 1, y) ∈ S
def cellEdges (S : Finset (ℤ × ℤ)) : Finset (ℤ × ℤ) := S.biUnion edgesOf
MathlibExt/Combinatorics/SimpleGraph/Lattice/TurningNumber/CellEuler.lean:173
Uses 2 · Used by 1
TheoremNew edges of an added cell match the local count#✓fully proved
The number of new edges when the cell (x, y) is added.
theorem sdiff_cellEdges_card_eq_deltaE (S : Finset (ℤ × ℤ)) (x y : ℤ) (hc : (x, y) ∉ S) :
((edgesOf (x, y) \ cellEdges S).card : ℤ)
= deltaE (decide ((x + 1, y) ∈ S)) (decide ((x - 1, y) ∈ S)) (decide ((x, y + 1) ∈ S))
(decide ((x, y - 1) ∈ S))
def edgesOf (c : ℤ × ℤ) : Finset (ℤ × ℤ) :=
{(2 * c.1 + 1, 2 * c.2), (2 * c.1 + 1, 2 * c.2 + 2),
(2 * c.1, 2 * c.2 + 1), (2 * c.1 + 2, 2 * c.2 + 1)}
MathlibExt/Combinatorics/SimpleGraph/Lattice/TurningNumber/CellEuler.lean:168
def cellEdges (S : Finset (ℤ × ℤ)) : Finset (ℤ × ℤ) := S.biUnion edgesOf
MathlibExt/Combinatorics/SimpleGraph/Lattice/TurningNumber/CellEuler.lean:173
def deltaE (e w n s : Bool) : ℤ :=
(1 - bI s) + (1 - bI n) + (1 - bI w) + (1 - bI e)
MathlibExt/Combinatorics/SimpleGraph/Lattice/TurningNumber/CellGaussBonnetLocal.lean:86
Uses 9 · Used by 1
DefinitionPinch point of a set of unit cells#✓fully proved
The lattice point v is a pinch point of S: of the four cells around v, exactly two
diagonally opposite ones belong to S.
def pinchAt (S : Finset (ℤ × ℤ)) (v : ℤ × ℤ) : Prop :=
(v ∈ S ∧ (v.1 - 1, v.2 - 1) ∈ S ∧ (v.1 - 1, v.2) ∉ S ∧ (v.1, v.2 - 1) ∉ S) ∨
((v.1 - 1, v.2) ∈ S ∧ (v.1, v.2 - 1) ∈ S ∧ v ∉ S ∧ (v.1 - 1, v.2 - 1) ∉ S)
Used by 13
DefinitionPinch point indicator#✓fully proved
The indicator of v being a pinch point of S.
def pinchW (S : Finset (ℤ × ℤ)) (v : ℤ × ℤ) : ℤ := if pinchAt S v then 1 else 0
def pinchAt (S : Finset (ℤ × ℤ)) (v : ℤ × ℤ) : Prop :=
(v ∈ S ∧ (v.1 - 1, v.2 - 1) ∈ S ∧ (v.1 - 1, v.2) ∉ S ∧ (v.1, v.2 - 1) ∉ S) ∨
((v.1 - 1, v.2) ∈ S ∧ (v.1, v.2 - 1) ∈ S ∧ v ∉ S ∧ (v.1 - 1, v.2 - 1) ∉ S)
MathlibExt/Combinatorics/SimpleGraph/Lattice/TurningNumber/CellPinch.lean:40
Uses 1 · Used by 10
DefinitionNumber of pinch points#✓fully proved
The number of pinch points of S.
def pinchCount (S : Finset (ℤ × ℤ)) : ℤ := ∑ v ∈ cellVerts S, pinchW S v
def cellVerts (S : Finset (ℤ × ℤ)) : Finset (ℤ × ℤ) :=
S.biUnion cornersOf
MathlibExt/Combinatorics/SimpleGraph/Lattice/TurningNumber/CellCount.lean:50
def pinchW (S : Finset (ℤ × ℤ)) (v : ℤ × ℤ) : ℤ := if pinchAt S v then 1 else 0
MathlibExt/Combinatorics/SimpleGraph/Lattice/TurningNumber/CellPinch.lean:49
Uses 2 · Used by 7
TheoremA pinch point is a vertex#✓fully proved
A pinch point is a vertex of S.
theorem pinchAt_mem_cellVerts (S : Finset (ℤ × ℤ)) (v : ℤ × ℤ) (h : pinchAt S v) :
v ∈ cellVerts S
def pinchAt (S : Finset (ℤ × ℤ)) (v : ℤ × ℤ) : Prop :=
(v ∈ S ∧ (v.1 - 1, v.2 - 1) ∈ S ∧ (v.1 - 1, v.2) ∉ S ∧ (v.1, v.2 - 1) ∉ S) ∨
((v.1 - 1, v.2) ∈ S ∧ (v.1, v.2 - 1) ∈ S ∧ v ∉ S ∧ (v.1 - 1, v.2 - 1) ∉ S)
MathlibExt/Combinatorics/SimpleGraph/Lattice/TurningNumber/CellPinch.lean:40
def cellVerts (S : Finset (ℤ × ℤ)) : Finset (ℤ × ℤ) :=
S.biUnion cornersOf
MathlibExt/Combinatorics/SimpleGraph/Lattice/TurningNumber/CellCount.lean:50
Uses 5 · Used by 1
TheoremPinch count changes only at the corners of a new cell#✓fully proved
Adding a cell changes the pinch count only at the corners of that cell.
theorem pinchCount_insert (S : Finset (ℤ × ℤ)) (c : ℤ × ℤ) (_hc : c ∉ S) :
pinchCount (insert c S)
= pinchCount S + ∑ v ∈ cornersOf c, (pinchW (insert c S) v - pinchW S v)
def pinchCount (S : Finset (ℤ × ℤ)) : ℤ := ∑ v ∈ cellVerts S, pinchW S v
MathlibExt/Combinatorics/SimpleGraph/Lattice/TurningNumber/CellPinch.lean:52
def cornersOf (c : ℤ × ℤ) : Finset (ℤ × ℤ) :=
{c, (c.1 + 1, c.2), (c.1, c.2 + 1), (c.1 + 1, c.2 + 1)}
MathlibExt/Combinatorics/SimpleGraph/Lattice/TurningNumber/CellCount.lean:42
def pinchW (S : Finset (ℤ × ℤ)) (v : ℤ × ℤ) : ℤ := if pinchAt S v then 1 else 0
MathlibExt/Combinatorics/SimpleGraph/Lattice/TurningNumber/CellPinch.lean:49
Uses 8 · Used by 1
TheoremChange of the pinch indicator at the bottom-left corner of a new cell#✓fully proved
Change of the pinch indicator at the bottom-left corner of a new cell.
theorem pinch_diff_BL (S : Finset (ℤ × ℤ)) (x y : ℤ) (hc : (x, y) ∉ S) :
pinchW (insert (x, y) S) (x, y) - pinchW S (x, y)
= (if ((x - 1, y - 1) ∈ S ∧ (x - 1, y) ∉ S ∧ (x, y - 1) ∉ S) then (1 : ℤ) else 0)
- (if ((x - 1, y) ∈ S ∧ (x, y - 1) ∈ S ∧ (x - 1, y - 1) ∉ S) then (1 : ℤ) else 0)
def pinchW (S : Finset (ℤ × ℤ)) (v : ℤ × ℤ) : ℤ := if pinchAt S v then 1 else 0
MathlibExt/Combinatorics/SimpleGraph/Lattice/TurningNumber/CellPinch.lean:49
Uses 2 · Used by 1
TheoremChange of the pinch indicator at the bottom-right corner of a new cell#✓fully proved
Change of the pinch indicator at the bottom-right corner of a new cell.
theorem pinch_diff_BR (S : Finset (ℤ × ℤ)) (x y : ℤ) (hc : (x, y) ∉ S) :
pinchW (insert (x, y) S) (x + 1, y) - pinchW S (x + 1, y)
= (if ((x + 1, y - 1) ∈ S ∧ (x + 1, y) ∉ S ∧ (x, y - 1) ∉ S) then (1 : ℤ) else 0)
- (if ((x + 1, y) ∈ S ∧ (x, y - 1) ∈ S ∧ (x + 1, y - 1) ∉ S) then (1 : ℤ) else 0)
def pinchW (S : Finset (ℤ × ℤ)) (v : ℤ × ℤ) : ℤ := if pinchAt S v then 1 else 0
MathlibExt/Combinatorics/SimpleGraph/Lattice/TurningNumber/CellPinch.lean:49
Uses 2 · Used by 1
TheoremChange of the pinch indicator at the top-left corner of a new cell#✓fully proved
Change of the pinch indicator at the top-left corner of a new cell.
theorem pinch_diff_TL (S : Finset (ℤ × ℤ)) (x y : ℤ) (hc : (x, y) ∉ S) :
pinchW (insert (x, y) S) (x, y + 1) - pinchW S (x, y + 1)
= (if ((x - 1, y + 1) ∈ S ∧ (x, y + 1) ∉ S ∧ (x - 1, y) ∉ S) then (1 : ℤ) else 0)
- (if ((x, y + 1) ∈ S ∧ (x - 1, y) ∈ S ∧ (x - 1, y + 1) ∉ S) then (1 : ℤ) else 0)
def pinchW (S : Finset (ℤ × ℤ)) (v : ℤ × ℤ) : ℤ := if pinchAt S v then 1 else 0
MathlibExt/Combinatorics/SimpleGraph/Lattice/TurningNumber/CellPinch.lean:49
Uses 2 · Used by 1
TheoremChange of the pinch indicator at the top-right corner of a new cell#✓fully proved
Change of the pinch indicator at the top-right corner of a new cell.
theorem pinch_diff_TR (S : Finset (ℤ × ℤ)) (x y : ℤ) (hc : (x, y) ∉ S) :
pinchW (insert (x, y) S) (x + 1, y + 1) - pinchW S (x + 1, y + 1)
= (if ((x + 1, y + 1) ∈ S ∧ (x, y + 1) ∉ S ∧ (x + 1, y) ∉ S) then (1 : ℤ) else 0)
- (if ((x, y + 1) ∈ S ∧ (x + 1, y) ∈ S ∧ (x + 1, y + 1) ∉ S) then (1 : ℤ) else 0)
def pinchW (S : Finset (ℤ × ℤ)) (v : ℤ × ℤ) : ℤ := if pinchAt S v then 1 else 0
MathlibExt/Combinatorics/SimpleGraph/Lattice/TurningNumber/CellPinch.lean:49
Uses 2 · Used by 1
TheoremChange of the pinch count in terms of eight neighbours#✓fully proved
The change of the pinch count when a cell is added, in terms of its eight neighbours.
theorem pinch_jump_sum (S : Finset (ℤ × ℤ)) (x y : ℤ) (hc : (x, y) ∉ S) :
(∑ v ∈ cornersOf (x, y), (pinchW (insert (x, y) S) v - pinchW S v))
= pinchDelta (decide ((x + 1, y) ∈ S)) (decide ((x - 1, y) ∈ S)) (decide ((x, y + 1) ∈ S))
(decide ((x, y - 1) ∈ S)) (decide ((x + 1, y + 1) ∈ S)) (decide ((x - 1, y + 1) ∈ S))
(decide ((x + 1, y - 1) ∈ S)) (decide ((x - 1, y - 1) ∈ S))
def cornersOf (c : ℤ × ℤ) : Finset (ℤ × ℤ) :=
{c, (c.1 + 1, c.2), (c.1, c.2 + 1), (c.1 + 1, c.2 + 1)}
MathlibExt/Combinatorics/SimpleGraph/Lattice/TurningNumber/CellCount.lean:42
def pinchW (S : Finset (ℤ × ℤ)) (v : ℤ × ℤ) : ℤ := if pinchAt S v then 1 else 0
MathlibExt/Combinatorics/SimpleGraph/Lattice/TurningNumber/CellPinch.lean:49
def pinchDelta (e w n s ne nw se sw : Bool) : ℤ :=
(bI (sw && !w && !s) - bI (w && s && !sw))
+ (bI (se && !e && !s) - bI (e && s && !se))
+ (bI (nw && !n && !w) - bI (n && w && !nw))
+ (bI (ne && !n && !e) - bI (n && e && !ne))
MathlibExt/Combinatorics/SimpleGraph/Lattice/TurningNumber/CellGaussBonnetLocal.lean:105
Uses 8 · Used by 1
TheoremCell Gauss–Bonnet formula#✓fully proved
Cell Gauss–Bonnet formula: for every finite set of unit cells, convex corners minus reflex corners equals four times the Euler characteristic plus twice the number of pinch points.
theorem cornerDiff_eq (S : Finset (ℤ × ℤ)) :
cornerDiff S = 4 * eulerChar S + 2 * pinchCount S
def cornerDiff (S : Finset (ℤ × ℤ)) : ℤ :=
((cellVerts S).filter (fun v => cornerCount S v = 1)).card
- ((cellVerts S).filter (fun v => cornerCount S v = 3)).card
MathlibExt/Combinatorics/SimpleGraph/Lattice/TurningNumber/CellEuler.lean:51
def eulerChar (S : Finset (ℤ × ℤ)) : ℤ :=
((cellVerts S).card : ℤ) - (cellEdges S).card + S.card
MathlibExt/Combinatorics/SimpleGraph/Lattice/TurningNumber/CellEuler.lean:176
def pinchCount (S : Finset (ℤ × ℤ)) : ℤ := ∑ v ∈ cellVerts S, pinchW S v
MathlibExt/Combinatorics/SimpleGraph/Lattice/TurningNumber/CellPinch.lean:52
Uses 23 · Used by 3
Loading dependency explorer…
The dependency explorer needs JavaScript and its graph data.