Unit lattice step in a given direction to Distinct north-then-west corners sit at distinct vertices
DefinitionUnit lattice step in a given direction#✓fully proved
The unit step of ℤ² in direction w: 0 ↦ (1, 0) (east), 1 ↦ (0, 1) (north), 2 ↦ (-1, 0)
(west), 3 ↦ (0, -1) (south).
def stepOf : Fin 4 → ℤ × ℤ
| 0 => (1, 0)
| 1 => (0, 1)
| 2 => (-1, 0)
| 3 => (0, -1)
Used by 140
DefinitionVertices of a lattice walk from its step directions#✓fully proved
The k-th vertex of the lattice walk with step directions d: the sum of the steps stepOf (d
i) for i < k, so that pos d 0 = 0.
def pos {n : ℕ} [NeZero n] (d : Fin n → Fin 4) (k : Fin n) : ℤ × ℤ :=
∑ i ∈ Finset.filter (· < k) Finset.univ, stepOf (d i)
def stepOf : Fin 4 → ℤ × ℤ
| 0 => (1, 0)
| 1 => (0, 1)
| 2 => (-1, 0)
| 3 => (0, -1)
MathlibExt/Combinatorics/SimpleGraph/Lattice/TurningNumber/DirectionWalk.lean:49
Uses 1 · Used by 158
DefinitionNumber of left turns of a direction sequence#✓fully proved
The number of counterclockwise (left) quarter turns of the cyclic direction sequence d, i.e.
of indices i with d (i + 1) - d i = 1.
def cc {n : ℕ} [NeZero n] (d : Fin n → Fin 4) : ℕ :=
(Finset.univ.filter (fun i : Fin n => d (i + 1) - d i = 1)).card
Used by 15
TheoremTurns of a cyclic direction sequence sum to zero#✓fully proved
The turns of a cyclic direction sequence sum to zero in Fin 4.
theorem sum_turns_zero {n : ℕ} [NeZero n] (d : Fin n → Fin 4) :
(∑ i : Fin n, (d (i + 1) - d i)) = 0
Used by 1
TheoremWithout right turns, the number of left turns is divisible by four#✓fully proved
If every turn is straight or left, the number of left turns is divisible by 4.
theorem four_dvd_cc {n : ℕ} [NeZero n] (d : Fin n → Fin 4)
(hreflexfree : ∀ i : Fin n, d (i + 1) - d i = 0 ∨ d (i + 1) - d i = 1) :
4 ∣ cc d
def cc {n : ℕ} [NeZero n] (d : Fin n → Fin 4) : ℕ :=
(Finset.univ.filter (fun i : Fin n => d (i + 1) - d i = 1)).card
MathlibExt/Combinatorics/SimpleGraph/Lattice/TurningNumber/DirectionWalk.lean:62
Uses 2 · Used by 3
TheoremA closed walk without right turns turns at least once#✓fully proved
A closed walk with only straight steps and left turns turns at least once.
theorem cc_pos {n : ℕ} [NeZero n] (d : Fin n → Fin 4)
(hclosed : ∑ i, stepOf (d i) = 0)
(hreflexfree : ∀ i : Fin n, d (i + 1) - d i = 0 ∨ d (i + 1) - d i = 1) :
0 < cc d
def stepOf : Fin 4 → ℤ × ℤ
| 0 => (1, 0)
| 1 => (0, 1)
| 2 => (-1, 0)
| 3 => (0, -1)
MathlibExt/Combinatorics/SimpleGraph/Lattice/TurningNumber/DirectionWalk.lean:49
def cc {n : ℕ} [NeZero n] (d : Fin n → Fin 4) : ℕ :=
(Finset.univ.filter (fun i : Fin n => d (i + 1) - d i = 1)).card
MathlibExt/Combinatorics/SimpleGraph/Lattice/TurningNumber/DirectionWalk.lean:62
Uses 2 · Used by 1
TheoremA closed walk without right turns has at least four left turns#✓fully proved
A closed walk with only straight steps and left turns has at least four left turns.
theorem four_le_cc {n : ℕ} [NeZero n] (d : Fin n → Fin 4)
(hclosed : ∑ i, stepOf (d i) = 0)
(hreflexfree : ∀ i : Fin n, d (i + 1) - d i = 0 ∨ d (i + 1) - d i = 1) :
4 ≤ cc d
def stepOf : Fin 4 → ℤ × ℤ
| 0 => (1, 0)
| 1 => (0, 1)
| 2 => (-1, 0)
| 3 => (0, -1)
MathlibExt/Combinatorics/SimpleGraph/Lattice/TurningNumber/DirectionWalk.lean:49
def cc {n : ℕ} [NeZero n] (d : Fin n → Fin 4) : ℕ :=
(Finset.univ.filter (fun i : Fin n => d (i + 1) - d i = 1)).card
MathlibExt/Combinatorics/SimpleGraph/Lattice/TurningNumber/DirectionWalk.lean:62
Uses 4 · Used by 4
TheoremExactly four left turns when simplicity rules out eight#✓fully proved
A closed walk with only straight steps and left turns has exactly four left turns, provided simplicity rules out eight or more.
theorem base_cc_eq_four {n : ℕ} [NeZero n] (d : Fin n → Fin 4)
(hclosed : ∑ i, stepOf (d i) = 0)
(hsimple : Function.Injective (pos d))
(hreflexfree : ∀ i : Fin n, d (i + 1) - d i = 0 ∨ d (i + 1) - d i = 1)
(hnodbl : Function.Injective (pos d) → cc d < 8) :
cc d = 4
def stepOf : Fin 4 → ℤ × ℤ
| 0 => (1, 0)
| 1 => (0, 1)
| 2 => (-1, 0)
| 3 => (0, -1)
MathlibExt/Combinatorics/SimpleGraph/Lattice/TurningNumber/DirectionWalk.lean:49
def pos {n : ℕ} [NeZero n] (d : Fin n → Fin 4) (k : Fin n) : ℤ × ℤ :=
∑ i ∈ Finset.filter (· < k) Finset.univ, stepOf (d i)
MathlibExt/Combinatorics/SimpleGraph/Lattice/TurningNumber/DirectionWalk.lean:57
def cc {n : ℕ} [NeZero n] (d : Fin n → Fin 4) : ℕ :=
(Finset.univ.filter (fun i : Fin n => d (i + 1) - d i = 1)).card
MathlibExt/Combinatorics/SimpleGraph/Lattice/TurningNumber/DirectionWalk.lean:62
Uses 5
DefinitionReverse of a dart#✓fully proved
The reverse of a dart: it starts at the head of d and points in the opposite direction.
def ons_dartRev (L : ℕ) (d : ons_Dart L) : ons_Dart L :=
(ons_dirStep L d.2 d.1, d.2 + 2)
abbrev ons_Dart (L : ℕ) := (ZMod L × ZMod L) × Fin 4
MathlibExt/Combinatorics/SimpleGraph/Lattice/TurningNumber/KacWardMatrix.lean:63
def ons_dirStep (L : ℕ) (μ : Fin 4) (s : ZMod L × ZMod L) : ZMod L × ZMod L :=
match μ with
| 0 => (s.1 + 1, s.2)
| 1 => (s.1, s.2 + 1)
| 2 => (s.1 - 1, s.2)
| 3 => (s.1, s.2 - 1)
MathlibExt/Combinatorics/SimpleGraph/Lattice/TurningNumber/KacWardMatrix.lean:55
Uses 2 · Used by 60
DefinitionTurn between two directions as an element of \(\mathbb{Z}/4\)#✓fully proved
The turn from direction μ to ν as an element of ZMod 4.
Used by 1
DefinitionInteger turn exponent between two directions#✓fully proved
The integer turn exponent from μ to ν: 1 for a left turn, -1 for a right turn, 0 for
going straight (and, by convention, for a U-turn).
def ons_turnPow (μ ν : Fin 4) : ℤ :=
if ν = μ then 0 else if ν = μ + 1 then 1 else if ν = μ + 2 then 0 else -1
TheoremClosed lattice walk starts at the origin#✓fully proved
The walk starts at the origin.
theorem pos_zero (d : Fin n → Fin 4) : pos d 0 = 0
def pos {n : ℕ} [NeZero n] (d : Fin n → Fin 4) (k : Fin n) : ℤ × ℤ :=
∑ i ∈ Finset.filter (· < k) Finset.univ, stepOf (d i)
MathlibExt/Combinatorics/SimpleGraph/Lattice/TurningNumber/DirectionWalk.lean:57
Uses 2 · Used by 2
TheoremForward vertex recursion of a closed lattice walk#✓fully proved
Vertex recursion of a closed walk: the next vertex is the current one plus the current step (indices taken cyclically).
theorem pos_succ (d : Fin n → Fin 4) (hclosed : ∑ i, stepOf (d i) = 0) (k : Fin n) :
pos d (k + 1) = pos d k + stepOf (d k)
def stepOf : Fin 4 → ℤ × ℤ
| 0 => (1, 0)
| 1 => (0, 1)
| 2 => (-1, 0)
| 3 => (0, -1)
MathlibExt/Combinatorics/SimpleGraph/Lattice/TurningNumber/DirectionWalk.lean:49
def pos {n : ℕ} [NeZero n] (d : Fin n → Fin 4) (k : Fin n) : ℤ × ℤ :=
∑ i ∈ Finset.filter (· < k) Finset.univ, stepOf (d i)
MathlibExt/Combinatorics/SimpleGraph/Lattice/TurningNumber/DirectionWalk.lean:57
Uses 3 · Used by 25
TheoremBackward vertex recursion of a closed lattice walk#✓fully proved
Vertex recursion of a closed walk read backwards from vertex M.
theorem pos_pred (d : Fin n → Fin 4) (hclosed : ∑ i, stepOf (d i) = 0) (M : Fin n) :
pos d M = pos d (M - 1) + stepOf (d (M - 1))
def stepOf : Fin 4 → ℤ × ℤ
| 0 => (1, 0)
| 1 => (0, 1)
| 2 => (-1, 0)
| 3 => (0, -1)
MathlibExt/Combinatorics/SimpleGraph/Lattice/TurningNumber/DirectionWalk.lean:49
def pos {n : ℕ} [NeZero n] (d : Fin n → Fin 4) (k : Fin n) : ℤ × ℤ :=
∑ i ∈ Finset.filter (· < k) Finset.univ, stepOf (d i)
MathlibExt/Combinatorics/SimpleGraph/Lattice/TurningNumber/DirectionWalk.lean:57
Uses 3 · Used by 7
TheoremCoordinates of the four lattice steps#✓fully proved
The four lattice steps, case by case.
theorem stepOf_coords (w : Fin 4) :
(w = 0 ∧ stepOf w = (1, 0)) ∨ (w = 1 ∧ stepOf w = (0, 1)) ∨
(w = 2 ∧ stepOf w = (-1, 0)) ∨ (w = 3 ∧ stepOf w = (0, -1))
def stepOf : Fin 4 → ℤ × ℤ
| 0 => (1, 0)
| 1 => (0, 1)
| 2 => (-1, 0)
| 3 => (0, -1)
MathlibExt/Combinatorics/SimpleGraph/Lattice/TurningNumber/DirectionWalk.lean:49
Uses 1 · Used by 9
TheoremNorth step followed by west step at the top corner of a walk#✓fully proved
A closed walk with only straight steps and left turns has a north step immediately followed by a west step (at its lexicographically largest vertex).
theorem lexmax_corner (d : Fin n → Fin 4)
(hclosed : ∑ i, stepOf (d i) = 0)
(hreflexfree : ∀ i : Fin n, d (i + 1) - d i = 0 ∨ d (i + 1) - d i = 1) :
∃ M : Fin n, d (M - 1) = 1 ∧ d M = 2
def stepOf : Fin 4 → ℤ × ℤ
| 0 => (1, 0)
| 1 => (0, 1)
| 2 => (-1, 0)
| 3 => (0, -1)
MathlibExt/Combinatorics/SimpleGraph/Lattice/TurningNumber/DirectionWalk.lean:49
TheoremNorth-then-west corner at the highest vertices#✓fully proved
A closed walk without right turns has a north-then-west corner at the rightmost of its highest vertices.
theorem ymax_NW_corner (d : Fin n → Fin 4)
(hclosed : ∑ i, stepOf (d i) = 0)
(hreflexfree : ∀ i : Fin n, d (i + 1) - d i = 0 ∨ d (i + 1) - d i = 1) :
∃ M : Fin n, d (M - 1) = 1 ∧ d M = 2 ∧
(∀ j : Fin n, (pos d j).2 ≤ (pos d M).2) ∧
(∀ j : Fin n, (pos d j).2 = (pos d M).2 → (pos d j).1 ≤ (pos d M).1)
def stepOf : Fin 4 → ℤ × ℤ
| 0 => (1, 0)
| 1 => (0, 1)
| 2 => (-1, 0)
| 3 => (0, -1)
MathlibExt/Combinatorics/SimpleGraph/Lattice/TurningNumber/DirectionWalk.lean:49
def pos {n : ℕ} [NeZero n] (d : Fin n → Fin 4) (k : Fin n) : ℤ × ℤ :=
∑ i ∈ Finset.filter (· < k) Finset.univ, stepOf (d i)
MathlibExt/Combinatorics/SimpleGraph/Lattice/TurningNumber/DirectionWalk.lean:57
TheoremSouth-then-east corner at the lowest vertices#✓fully proved
A closed walk without right turns has a south-then-east corner at one of its lowest vertices.
theorem ymin_SE_corner (d : Fin n → Fin 4)
(hclosed : ∑ i, stepOf (d i) = 0)
(hreflexfree : ∀ i : Fin n, d (i + 1) - d i = 0 ∨ d (i + 1) - d i = 1) :
∃ m : Fin n, d (m - 1) = 3 ∧ d m = 0 ∧
(∀ j : Fin n, (pos d m).2 ≤ (pos d j).2)
def stepOf : Fin 4 → ℤ × ℤ
| 0 => (1, 0)
| 1 => (0, 1)
| 2 => (-1, 0)
| 3 => (0, -1)
MathlibExt/Combinatorics/SimpleGraph/Lattice/TurningNumber/DirectionWalk.lean:49
def pos {n : ℕ} [NeZero n] (d : Fin n → Fin 4) (k : Fin n) : ℤ × ℤ :=
∑ i ∈ Finset.filter (· < k) Finset.univ, stepOf (d i)
MathlibExt/Combinatorics/SimpleGraph/Lattice/TurningNumber/DirectionWalk.lean:57
TheoremPrevious and next vertices of a north-then-west corner#✓fully proved
At a north-then-west corner M, the previous vertex is just below and the next vertex just to
the left.
theorem nw_corner_neighbours (d : Fin n → Fin 4) (hclosed : ∑ i, stepOf (d i) = 0)
{M : Fin n} (hin : d (M - 1) = 1) (hout : d M = 2) :
pos d (M - 1) = pos d M + (0, -1) ∧ pos d (M + 1) = pos d M + (-1, 0)
def stepOf : Fin 4 → ℤ × ℤ
| 0 => (1, 0)
| 1 => (0, 1)
| 2 => (-1, 0)
| 3 => (0, -1)
MathlibExt/Combinatorics/SimpleGraph/Lattice/TurningNumber/DirectionWalk.lean:49
def pos {n : ℕ} [NeZero n] (d : Fin n → Fin 4) (k : Fin n) : ℤ × ℤ :=
∑ i ∈ Finset.filter (· < k) Finset.univ, stepOf (d i)
MathlibExt/Combinatorics/SimpleGraph/Lattice/TurningNumber/DirectionWalk.lean:57
TheoremDistinct north-then-west corners sit at distinct vertices#✓fully proved
In a simple walk, distinct north-then-west corners sit at distinct vertices.
theorem nw_corners_distinct_pos (d : Fin n → Fin 4) (hsimple : Function.Injective (pos d))
{i j : Fin n} (hij : i ≠ j)
(_hi : d i = 1) (_hi2 : d (i + 1) = 2) (_hj : d j = 1) (_hj2 : d (j + 1) = 2) :
pos d (i + 1) ≠ pos d (j + 1)
def pos {n : ℕ} [NeZero n] (d : Fin n → Fin 4) (k : Fin n) : ℤ × ℤ :=
∑ i ∈ Finset.filter (· < k) Finset.univ, stepOf (d i)
MathlibExt/Combinatorics/SimpleGraph/Lattice/TurningNumber/DirectionWalk.lean:57
Uses 1
Loading dependency explorer…
The dependency explorer needs JavaScript and its graph data.