definition
No public endorsements yet.
Loading review…
Sign in with ORCIDConcept map
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
| 1 | import Mathlib.Combinatorics.SimpleGraph.Hasse |
| 2 | |
| 3 | /-! |
| 4 | --- |
| 5 | title: Grids and walls |
| 6 | type: definition |
| 7 | --- |
| 8 | A nonempty rectangular grid has vertices in rows and columns, with edges |
| 9 | between orthogonally consecutive positions. A wall is the brick-wall subgraph |
| 10 | obtained by retaining alternating vertical grid edges. |
| 11 | -/ |
| 12 | |
| 13 | set_option autoImplicit false |
| 14 | |
| 15 | namespace Lax68.GridsAndWalls |
| 16 | |
| 17 | def consecutive (a b : ℕ) : Prop := |
| 18 | a + 1 = b ∨ b + 1 = a |
| 19 | |
| 20 | def WallAdjacent {m n : ℕ} (u v : Fin m × Fin n) : Prop := |
| 21 | (u.1 = v.1 ∧ consecutive 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 | |
| 26 | def 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 | |
| 33 | def 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 | |
| 41 | def IsGrid {V : Type*} (G : SimpleGraph V) : Prop := |
| 42 | HasGridShape G |
| 43 | |
| 44 | def IsWall {V : Type*} (G : SimpleGraph V) : Prop := |
| 45 | HasWallShape G |
| 46 | |
| 47 | end Lax68.GridsAndWalls |
| 48 |
Builds on
none
From Mathlib
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