Skip to content

Commit 1c8a611

Browse files
committed
refactor(Vorspiel): rename Matrix.map to Matrix.vecMap to avoid Mathlib clash
Foundation.Vorspiel.Matrix defined its own Matrix.map, a vector map (Fin k → α) → (Fin k → β), shadowing Mathlib's Matrix.map. Both auto-generate Matrix.map.eq_1, so importing Foundation alongside any Mathlib module that materializes Mathlib's Matrix.map.eq_1 (e.g. Bochner integration, matrix-heavy analysis) fails with an 'environment already contains Matrix.map.eq_1' clash. Because Vorspiel.Matrix sits in Foundation's prelude, this blocks co-importing Foundation with large parts of Mathlib. Rename the def to vecMap. The postfix notation ⨟ and all lemmas are unchanged in behavior; no qualified Matrix.map (vector) references exist elsewhere in the tree.
1 parent 1527b59 commit 1c8a611

1 file changed

Lines changed: 7 additions & 4 deletions

File tree

Foundation/Vorspiel/Matrix.lean

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -245,23 +245,26 @@ def foldr (f : α → β → β) (init : β) : {k : ℕ} → (Fin k → α) →
245245
| 0, _ => init
246246
| _ + 1, v => f (vecHead v) (Matrix.foldr f init (vecTail v))
247247

248-
def map (f : α → β) : (Fin k → α) → (Fin k → β) := fun v ↦ f ∘ v
248+
-- Renamed from `Matrix.map` to `Matrix.vecMap` to avoid clashing with Mathlib's
249+
-- `Matrix.map`: both auto-generate `Matrix.map.eq_1`, which makes Foundation
250+
-- unimportable alongside Mathlib matrix/analysis theory (e.g. Bochner integration).
251+
def vecMap (f : α → β) : (Fin k → α) → (Fin k → β) := fun v ↦ f ∘ v
249252

250253
section map
251254

252-
postfix:max "⨟" => map
255+
postfix:max "⨟" => vecMap
253256

254257
variable (f : α → β)
255258

256259
@[simp] lemma map_nil (v : Fin 0 → α) : f⨟ v = ![] := empty_eq (f⨟ v)
257260

258261
@[simp] lemma map_cons (a : α) (v : Fin k → α) : f⨟ (a :> v) = f a :> f⨟ v := by
259262
ext i
260-
cases i using Fin.cases <;> simp [map]
263+
cases i using Fin.cases <;> simp [vecMap]
261264

262265
@[simp] lemma map_cons' (v : Fin (k + 1) → α) : f⨟ v = f (vecHead v) :> f⨟ (vecTail v) := by
263266
ext i
264-
cases i using Fin.cases <;> { simp [map]; rfl }
267+
cases i using Fin.cases <;> { simp [vecMap]; rfl }
265268

266269
@[simp] lemma map_app (v : Fin k → α) (i : Fin k) : (f⨟ v) i = f (v i) := rfl
267270

0 commit comments

Comments
 (0)