summaryrefslogtreecommitdiff
path: root/Day10.lean
diff options
context:
space:
mode:
authorAndreas Grois <andi@grois.info>2024-12-17 19:47:14 +0100
committerAndreas Grois <andi@grois.info>2024-12-17 19:47:14 +0100
commit19d4b4e41a967c0c8b3329cd1c4a0617178c5a94 (patch)
treee5aff19158c526ebf5fbec2b51c8cde9da8e129f /Day10.lean
parent8f1a6c619a238531aed9dd3f4479d658fcf1d101 (diff)
Lean 4.14
Diffstat (limited to 'Day10.lean')
-rw-r--r--Day10.lean10
1 files changed, 5 insertions, 5 deletions
diff --git a/Day10.lean b/Day10.lean
index 829da83..720b7b9 100644
--- a/Day10.lean
+++ b/Day10.lean
@@ -517,7 +517,7 @@ private theorem Area.ParseLine_start_at_tile (previous : Area.Raw) (pos : Nat) (
split at h₄; contradiction
case isFalse h₇ =>
have h₈ : (previous.fields.push t)[previous.width * (previous.height - 1) + pos]! = t := by
- have := Array.get_push_eq previous.fields t
+ have := Array.getElem_push_eq previous.fields t
simp[h₂, Array.getElem!_eq_getElem] at this
assumption
have : t = Tile.start := beq_iff_eq.mp h₆
@@ -1018,8 +1018,8 @@ private def noSolution {area : Area} : (List $ Area.PathHead area) → Bool
section ListMonad
local instance : Monad List where
- bind := List.bind
- pure := List.pure
+ bind := List.flatMap
+ pure := List.singleton
def part1 (area : Area) : List Nat := do
let mut paths : List (Area.PathHead area) := area.pathStartsList
@@ -1470,8 +1470,8 @@ private def PipeAtCoordinate.totalAndTransitiveLe (area : Area) : BinaryHeap.Tot
section ListMonad
-- We can do this here without perf issues. The list in question will never have more than 2 elements.
local instance : Monad List where
- pure := List.pure
- bind := List.bind
+ pure := List.singleton
+ bind := List.flatMap
private inductive WestEastFoldState (area : Area)
| inside : Coordinate area.width area.height → WestEastFoldState area