A lattice point lies on a walk step to Four left turns, given that two corners force a self-intersection
DefinitionA lattice point lies on a walk step#✓fully proved
The lattice point p lies on the closed segment traversed by step k.
def onEdge (d : Fin n → Fin 4) (k : Fin n) (p : ℤ × ℤ) : Prop :=
(min (pos d k).1 (pos d (k + 1)).1 ≤ p.1 ∧ p.1 ≤ max (pos d k).1 (pos d (k + 1)).1) ∧
(min (pos d k).2 (pos d (k + 1)).2 ≤ p.2 ∧ p.2 ≤ max (pos d k).2 (pos d (k + 1)).2)
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 · Used by 1
TheoremCrossing steps force a repeated vertex#✓fully proved
If a horizontal and a vertical step that share no index endpoint meet at a point, the walk visits some vertex twice.
theorem edges_cross_not_injective (d : Fin n → Fin 4) (hclosed : ∑ i, stepOf (d i) = 0)
(k j : Fin n) (hk : isHorizEdge (d k)) (hj : isVertEdge (d j))
(hne1 : k ≠ j) (hne2 : k + 1 ≠ j) (hne3 : k ≠ j + 1) (hne4 : k + 1 ≠ j + 1)
(p : ℤ × ℤ) (hpk : onEdge d k p) (hpj : onEdge d j p) :
¬ Function.Injective (pos 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 isHorizEdge (w : Fin 4) : Prop := w = 0 ∨ w = 2
MathlibExt/Combinatorics/SimpleGraph/Lattice/TurningNumber/WalkCrossing.lean:55
def isVertEdge (w : Fin 4) : Prop := w = 1 ∨ w = 3
MathlibExt/Combinatorics/SimpleGraph/Lattice/TurningNumber/WalkCrossing.lean:52
def onEdge (d : Fin n → Fin 4) (k : Fin n) (p : ℤ × ℤ) : Prop :=
(min (pos d k).1 (pos d (k + 1)).1 ≤ p.1 ∧ p.1 ≤ max (pos d k).1 (pos d (k + 1)).1) ∧
(min (pos d k).2 (pos d (k + 1)).2 ≤ p.2 ∧ p.2 ≤ max (pos d k).2 (pos d (k + 1)).2)
MathlibExt/Combinatorics/SimpleGraph/Lattice/TurningNumber/WalkCrossing.lean:204
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
DefinitionNumber of crossings of a horizontal ray#✓fully proved
The number of vertical steps crossing the line y = m + 1/2 strictly to the right of x =
qx.
def rayCross (d : Fin n → Fin 4) (m qx : ℤ) : ℕ :=
(Finset.univ.filter (fun k : Fin n =>
isVertEdge (d k) ∧ qx < (pos d k).1 ∧
min ((pos d k).2) ((pos d (k + 1)).2) = m)).card
def isVertEdge (w : Fin 4) : Prop := w = 1 ∨ w = 3
MathlibExt/Combinatorics/SimpleGraph/Lattice/TurningNumber/WalkCrossing.lean:52
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
DefinitionUpward ray crossings above a cell#✓fully proved
The number of horizontal steps of the walk on the column [a, a + 1] strictly above the cell
(a, b): the crossings of the upward vertical ray from the center of that cell.
def upCross (d : Fin n → Fin 4) (a b : ℤ) : ℕ :=
(Finset.univ.filter
(fun k : Fin n =>
isHorizEdge (d k) ∧
min ((pos d k).1) ((pos d (k+1)).1) = a ∧
b < (pos d k).2)).card
def isHorizEdge (w : Fin 4) : Prop := w = 0 ∨ w = 2
MathlibExt/Combinatorics/SimpleGraph/Lattice/TurningNumber/WalkCrossing.lean:55
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 14
DefinitionRay-crossing parity of a lattice cell#✓fully proved
The parity of the number of crossings of the upward ray from the center of cell (a, b) with
the walk; cells with parity 1 are inside the walk.
def rayParity (d : Fin n → Fin 4) (a b : ℤ) : ZMod 2 := (upCross d a b : ZMod 2)
def upCross (d : Fin n → Fin 4) (a b : ℤ) : ℕ :=
(Finset.univ.filter
(fun k : Fin n =>
isHorizEdge (d k) ∧
min ((pos d k).1) ((pos d (k+1)).1) = a ∧
b < (pos d k).2)).card
MathlibExt/Combinatorics/SimpleGraph/Lattice/TurningNumber/JordanParity.lean:46
Uses 1 · Used by 49
LemmaUpward crossing count is unchanged across a vertical move#✓fully proved
The upward crossing count is the same for cells (a, b) and (a, b + 1) when no horizontal
step lies between them.
lemma upCross_vstep (d : Fin n → Fin 4) (a b : ℤ)
(h : ∀ k : Fin n, isHorizEdge (d k) →
min ((pos d k).1) ((pos d (k+1)).1) = a → (pos d k).2 ≠ b + 1) :
upCross d a b = upCross d a (b + 1)
def isHorizEdge (w : Fin 4) : Prop := w = 0 ∨ w = 2
MathlibExt/Combinatorics/SimpleGraph/Lattice/TurningNumber/WalkCrossing.lean:55
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 upCross (d : Fin n → Fin 4) (a b : ℤ) : ℕ :=
(Finset.univ.filter
(fun k : Fin n =>
isHorizEdge (d k) ∧
min ((pos d k).1) ((pos d (k+1)).1) = a ∧
b < (pos d k).2)).card
MathlibExt/Combinatorics/SimpleGraph/Lattice/TurningNumber/JordanParity.lean:46
Uses 3 · Used by 1
LemmaRay parity is unchanged across a vertical move#✓fully proved
The ray parity is the same for cells (a, b) and (a, b + 1) when no horizontal step lies
between them.
lemma rayParity_vstep (d : Fin n → Fin 4) (a b : ℤ)
(h : ∀ k : Fin n, isHorizEdge (d k) →
min ((pos d k).1) ((pos d (k+1)).1) = a → (pos d k).2 ≠ b + 1) :
rayParity d a b = rayParity d a (b + 1)
def isHorizEdge (w : Fin 4) : Prop := w = 0 ∨ w = 2
MathlibExt/Combinatorics/SimpleGraph/Lattice/TurningNumber/WalkCrossing.lean:55
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 rayParity (d : Fin n → Fin 4) (a b : ℤ) : ZMod 2 := (upCross d a b : ZMod 2)
MathlibExt/Combinatorics/SimpleGraph/Lattice/TurningNumber/JordanParity.lean:55
Uses 5 · Used by 9
LemmaNo upward crossings for cells above a walk#✓fully proved
Cells at or above the top height of the walk have no upward crossings.
lemma upCross_topOutside (d : Fin n → Fin 4) (a b T : ℤ)
(hT : ∀ j : Fin n, (pos d j).2 ≤ T) (hb : T ≤ b) :
upCross d a b = 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
def upCross (d : Fin n → Fin 4) (a b : ℤ) : ℕ :=
(Finset.univ.filter
(fun k : Fin n =>
isHorizEdge (d k) ∧
min ((pos d k).1) ((pos d (k+1)).1) = a ∧
b < (pos d k).2)).card
MathlibExt/Combinatorics/SimpleGraph/Lattice/TurningNumber/JordanParity.lean:46
Uses 3 · Used by 1
LemmaCells above a walk are outside#✓fully proved
Cells at or above the top height of the walk are outside.
lemma rayParity_topOutside (d : Fin n → Fin 4) (a b T : ℤ)
(hT : ∀ j : Fin n, (pos d j).2 ≤ T) (hb : T ≤ b) :
rayParity d a b = 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
def rayParity (d : Fin n → Fin 4) (a b : ℤ) : ZMod 2 := (upCross d a b : ZMod 2)
MathlibExt/Combinatorics/SimpleGraph/Lattice/TurningNumber/JordanParity.lean:55
Uses 4 · Used by 2
LemmaUpward crossing counts of horizontal neighbours sum to an even number#✓fully proved
When no vertical step separates the cells (a, b) and (a + 1, b), their upward crossing
counts add up to an even number.
lemma upCross_hstep (d : Fin n → Fin 4) (hclosed : ∑ i, stepOf (d i) = 0) (a b : ℤ)
(hstr : ∀ k : Fin n, isVertEdge (d k) → (pos d k).1 = a + 1 →
¬ (min ((pos d k).2) ((pos d (k + 1)).2) ≤ b ∧
b < max ((pos d k).2) ((pos d (k + 1)).2))) :
upCross d a b + upCross d (a + 1) b
= 2 * (Finset.univ.filter (fun k : Fin n =>
¬ ((pos d k).1 = a + 1 ∧ b + 1 ≤ (pos d k).2) ∧
((pos d (k + 1)).1 = a + 1 ∧ b + 1 ≤ (pos d (k + 1)).2))).card
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 isVertEdge (w : Fin 4) : Prop := w = 1 ∨ w = 3
MathlibExt/Combinatorics/SimpleGraph/Lattice/TurningNumber/WalkCrossing.lean:52
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 upCross (d : Fin n → Fin 4) (a b : ℤ) : ℕ :=
(Finset.univ.filter
(fun k : Fin n =>
isHorizEdge (d k) ∧
min ((pos d k).1) ((pos d (k+1)).1) = a ∧
b < (pos d k).2)).card
MathlibExt/Combinatorics/SimpleGraph/Lattice/TurningNumber/JordanParity.lean:46
Uses 8 · Used by 1
LemmaRay parity is unchanged across a horizontal move#✓fully proved
The ray parity is the same for cells (a, b) and (a + 1, b) when no vertical step lies
between them.
lemma rayParity_hstep (d : Fin n → Fin 4) (hclosed : ∑ i, stepOf (d i) = 0) (a b : ℤ)
(hstr : ∀ k : Fin n, isVertEdge (d k) → (pos d k).1 = a + 1 →
¬ (min ((pos d k).2) ((pos d (k + 1)).2) ≤ b ∧
b < max ((pos d k).2) ((pos d (k + 1)).2))) :
rayParity d a b = rayParity d (a + 1) b
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 isVertEdge (w : Fin 4) : Prop := w = 1 ∨ w = 3
MathlibExt/Combinatorics/SimpleGraph/Lattice/TurningNumber/WalkCrossing.lean:52
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 rayParity (d : Fin n → Fin 4) (a b : ℤ) : ZMod 2 := (upCross d a b : ZMod 2)
MathlibExt/Combinatorics/SimpleGraph/Lattice/TurningNumber/JordanParity.lean:55
Uses 6 · Used by 8
TheoremMoving horizontally inside a closed walk#✓fully proved
If cell (a, b) is inside and no vertical step separates it from (a + 1, b), then (a + 1,
b) is inside.
theorem inside_climb_x (d : Fin n → Fin 4) (hclosed : ∑ i, stepOf (d i) = 0) (a b : ℤ)
(hinside : rayParity d a b = 1)
(hstr : ∀ k : Fin n, isVertEdge (d k) → (pos d k).1 = a + 1 →
¬ (min ((pos d k).2) ((pos d (k + 1)).2) ≤ b ∧
b < max ((pos d k).2) ((pos d (k + 1)).2))) :
rayParity d (a + 1) b = 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 rayParity (d : Fin n → Fin 4) (a b : ℤ) : ZMod 2 := (upCross d a b : ZMod 2)
MathlibExt/Combinatorics/SimpleGraph/Lattice/TurningNumber/JordanParity.lean:55
def isVertEdge (w : Fin 4) : Prop := w = 1 ∨ w = 3
MathlibExt/Combinatorics/SimpleGraph/Lattice/TurningNumber/WalkCrossing.lean:52
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
TheoremMoving vertically inside a closed walk#✓fully proved
If cell (a, b) is inside and no horizontal step separates it from (a, b + 1), then (a, b +
1) is inside.
theorem inside_climb_y (d : Fin n → Fin 4) (a b : ℤ)
(hinside : rayParity d a b = 1)
(h : ∀ k : Fin n, isHorizEdge (d k) →
min ((pos d k).1) ((pos d (k + 1)).1) = a → (pos d k).2 ≠ b + 1) :
rayParity d a (b + 1) = 1
def rayParity (d : Fin n → Fin 4) (a b : ℤ) : ZMod 2 := (upCross d a b : ZMod 2)
MathlibExt/Combinatorics/SimpleGraph/Lattice/TurningNumber/JordanParity.lean:55
def isHorizEdge (w : Fin 4) : Prop := w = 0 ∨ w = 2
MathlibExt/Combinatorics/SimpleGraph/Lattice/TurningNumber/WalkCrossing.lean:55
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
TheoremCoordinates of the vertices around a north-then-west corner#✓fully proved
The vertices before and after a north-then-west corner.
theorem nw_corner_coords (d : Fin n → Fin 4) (hclosed : ∑ i, stepOf (d i) = 0)
(i : Fin n) (hN : d i = 1) (hW : d (i + 1) = 2) :
pos d i = ((pos d (i + 1)).1, (pos d (i + 1)).2 - 1) ∧
pos d (i + 1 + 1) = ((pos d (i + 1)).1 - 1, (pos d (i + 1)).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
TheoremThe north step at a corner blocks horizontal movement#✓fully proved
At a north-then-west corner, the north step separates the cell below-left of the corner from its right neighbour.
theorem nw_corner_not_climbable_x (d : Fin n → Fin 4) (hclosed : ∑ i, stepOf (d i) = 0)
(i : Fin n) (hN : d i = 1) (hW : d (i + 1) = 2) :
¬ (∀ k : Fin n, isVertEdge (d k) → (pos d k).1 = ((pos d (i + 1)).1 - 1) + 1 →
¬ (min ((pos d k).2) ((pos d (k + 1)).2) ≤ (pos d (i + 1)).2 - 1 ∧
(pos d (i + 1)).2 - 1 < max ((pos d k).2) ((pos d (k + 1)).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 isVertEdge (w : Fin 4) : Prop := w = 1 ∨ w = 3
MathlibExt/Combinatorics/SimpleGraph/Lattice/TurningNumber/WalkCrossing.lean:52
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
TheoremThe west step at a corner blocks vertical movement#✓fully proved
At a north-then-west corner, the west step separates the cell below-left of the corner from its top neighbour.
theorem nw_corner_not_climbable_y (d : Fin n → Fin 4) (hclosed : ∑ i, stepOf (d i) = 0)
(i : Fin n) (hN : d i = 1) (hW : d (i + 1) = 2) :
¬ (∀ k : Fin n, isHorizEdge (d k) →
min ((pos d k).1) ((pos d (k + 1)).1) = (pos d (i + 1)).1 - 1 →
(pos d k).2 ≠ ((pos d (i + 1)).2 - 1) + 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 isHorizEdge (w : Fin 4) : Prop := w = 0 ∨ w = 2
MathlibExt/Combinatorics/SimpleGraph/Lattice/TurningNumber/WalkCrossing.lean:55
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
TheoremUniqueness of the lexicographically largest vertex#✓fully proved
In a simple walk the lexicographically largest vertex is attained at a unique index.
theorem lexmax_unique (d : Fin n → Fin 4) (hsimple : Function.Injective (pos d))
{M M' : Fin n} (hM : ∀ j : Fin n, toLex (pos d j) ≤ toLex (pos d M))
(hM' : ∀ j : Fin n, toLex (pos d j) ≤ toLex (pos d M')) :
M = M'
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
TheoremExistence of a north-then-west corner#✓fully proved
A closed walk without right turns has a north-then-west corner.
theorem exists_lexmax_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) :
∃ i : Fin n, d i = 1 ∧ d (i + 1) = 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
Uses 2
DefinitionTwo north-then-west corners force a self-intersection#✓fully proved
Any two distinct north-then-west corners of d force pos d to be non-injective.
def two_nw_corners_not_injective (d : Fin n → Fin 4) : Prop :=
∀ i j : Fin n, i ≠ j → d i = 1 → d (i + 1) = 2 → d j = 1 → d (j + 1) = 2 →
¬ Function.Injective (pos d)
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 · Used by 1
TheoremFour left turns, given that two corners force a self-intersection#✓fully proved
A simple closed walk without right turns has four left turns, assuming that two distinct north-then-west corners force a self-intersection.
theorem cc_eq_four_of_selfAvoidanceWall (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)
(hwall : two_nw_corners_not_injective d) :
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 two_nw_corners_not_injective (d : Fin n → Fin 4) : Prop :=
∀ i j : Fin n, i ≠ j → d i = 1 → d (i + 1) = 2 → d j = 1 → d (j + 1) = 2 →
¬ Function.Injective (pos d)
MathlibExt/Combinatorics/SimpleGraph/Lattice/TurningNumber/InsidePropagation.lean:130
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
Loading dependency explorer…
The dependency explorer needs JavaScript and its graph data.