Draft — mutable and not usable as a dependency; its citation marks the draft state.

Lax68.GridsAndWalls

Grids and walls

concepts/Lax68/GridsAndWalls.lean · lax-68

definition

Loading review…

Sign in with ORCID

Community review

Flags

Each flag is tied to a public ORCID identity and explains why this concept may be incorrect.

No flags have been submitted.

    Community review

    Flag this concept

    State precisely what appears incorrect. This explanation will be public under your ORCID name.

    No source line selected.

    Concept map

    Proven claimOpen claimDefinitionThis conceptRelated conceptA → B: B builds on A

    Definition

    A nonempty rectangular grid has vertices in rows and columns, with edges between orthogonally consecutive positions. A wall is the brick-wall subgraph obtained by retaining alternating vertical grid edges.

    Lean source view on GitHub

    1import Mathlib.Combinatorics.SimpleGraph.Hasse
    2
    3/-!
    4---
    5title: Grids and walls
    6type: definition
    7---
    8A nonempty rectangular grid has vertices in rows and columns, with edges
    9between orthogonally consecutive positions. A wall is the brick-wall subgraph
    10obtained by retaining alternating vertical grid edges.
    11-/
    12
    13set_option autoImplicit false
    14
    15namespace Lax68.GridsAndWalls
    16
    17def consecutive (a b : ℕ) : Prop :=
    18 a + 1 = b ∨ b + 1 = a
    19
    20def WallAdjacent {m n : ℕ} (u v : Fin m × Fin n) : Prop :=
    21 (u.1 = v.1consecutive u.2.val v.2.val) ∨
    22 (u.2 = v.2
    23 consecutive u.1.val v.1.val ∧
    24 (Nat.min u.1.val v.1.val + u.2.val) % 2 = 0)
    25
    26def HasGridShape {V : Type*} (G : SimpleGraph V) : Prop :=
    27 ∃ m n : ℕ,
    28 0 < m ∧
    29 0 < n ∧
    30 Nonempty
    31 (G ≃g (SimpleGraph.pathGraph m □ SimpleGraph.pathGraph n))
    32
    33def HasWallShape {V : Type*} (G : SimpleGraph V) : Prop :=
    34 ∃ m n : ℕ,
    35 0 < m ∧
    36 0 < n ∧
    37 ∃ e : Fin m × Fin n ≃ V,
    38 ∀ u v,
    39 G.Adj (e u) (e v) ↔ WallAdjacent u v
    40
    41def IsGrid {V : Type*} (G : SimpleGraph V) : Prop :=
    42 HasGridShape G
    43
    44def IsWall {V : Type*} (G : SimpleGraph V) : Prop :=
    45 HasWallShape G
    46
    47end Lax68.GridsAndWalls
    48

    Community review

    Discussion

    Ask a question or add context. Endorsements and structured flags are kept in the review panel above; your ORCID profile must share a public name.

    0 comments

    Loading discussion…