Zulip Chat Archive

Stream: mathlib4

Topic: LinearAlgebra.Prod !4#2415


Johan Commelin (Feb 21 2023 at 13:05):

theorem prodMap_comp (f₁₂ : M →ₗ[R] M₂) (f₂₃ : M₂ →ₗ[R] M₃) (g₁₂ : M₄ →ₗ[R] M₅)
    (g₂₃ : M₅ →ₗ[R] M₆) :
    f₂₃.prodMap g₂₃ ∘ₗ f₁₂.prodMap g₁₂ = (f₂₃ ∘ₗ f₁₂).prodMap (g₂₃ ∘ₗ g₁₂) :=
  rfl

gives me

Prod.lean:347:4
unknown identifier 'include✝'
Prod.lean:347:4
unknown constant 'σ₁₃✝'
Prod.lean:347:42
unknown identifier 'include✝'
Prod.lean:347:42
unknown constant 'σ₁₃✝'

Johan Commelin (Feb 21 2023 at 13:06):

The only other error in the files is with

@[simp, norm_cast]
theorem coe_prod :
    (e₁.prod e₂ : M × M₃ →ₗ[R] M₂ × M₄) = (e₁ : M →ₗ[R] M₂).prodMap (e₂ : M₃ →ₗ[R] M₄) :=
  rfl

complaining

norm_cast: badly shaped lemma, lhs must contain at least one coe
  (LinearEquiv.prod e₁ e₂).toLinearMap

Mario Carneiro (Feb 21 2023 at 13:08):

is there an include in the file?

Mario Carneiro (Feb 21 2023 at 13:08):

perhaps after the theorem

Johan Commelin (Feb 21 2023 at 13:09):

include is an error in Lean 4, right?

Mario Carneiro (Feb 21 2023 at 13:09):

it's not a keyword, so it gets interpreted as an (unknown) identifier

Johan Commelin (Feb 21 2023 at 13:09):

https://github.com/leanprover-community/mathlib4/pull/2415/files says that there is no include

Mario Carneiro (Feb 21 2023 at 13:11):

CI also says that there is no error in the file

Mario Carneiro (Feb 21 2023 at 13:14):

there is an include σ₁₃ on line 560 of Algebra.Module.LinearMap

Johan Commelin (Feb 21 2023 at 13:14):

aha!

Mario Carneiro (Feb 21 2023 at 13:15):

Aha more:

infixr:80 " ∘ₗ " =>
  @LinearMap.comp _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ (RingHom.id _) (RingHom.id _) (RingHom.id _)
    RingHomCompTriple.ids

include σ₁₃

it's accidentally in the infix

Mario Carneiro (Feb 21 2023 at 13:16):

so you don't get the error unless you use ∘ₗ

Mario Carneiro (Feb 21 2023 at 13:17):

aha even more:

-- mathport name: «expr ∘ₗ »
set_option quotPrecheck false in -- Porting note: error message suggested to do this
/-- `∘ₗ` is notation for composition of two linear (not semilinear!) maps into a linear map.
This is useful when Lean is struggling to infer the `RingHomCompTriple` instance. -/
infixr:80 " ∘ₗ " =>
  @LinearMap.comp _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ (RingHom.id _) (RingHom.id _) (RingHom.id _)
    RingHomCompTriple.ids

include σ₁₃

normally this would be an error, but it has been suppressed by what appears to be a confused porter

Johan Commelin (Feb 21 2023 at 13:22):

oof, thanks for debugging!

Johan Commelin (Feb 21 2023 at 15:23):

This "include" issue is now fixed.

Johan Commelin (Feb 21 2023 at 15:23):

So this is the only error that is left

@[simp, norm_cast]
theorem coe_prod :
    (e₁.prod e₂ : M × M₃ →ₗ[R] M₂ × M₄) = (e₁ : M →ₗ[R] M₂).prodMap (e₂ : M₃ →ₗ[R] M₄) :=
  rfl

complaining

norm_cast: badly shaped lemma, lhs must contain at least one coe
  (LinearEquiv.prod e₁ e₂).toLinearMap

Eric Wieser (Feb 21 2023 at 15:24):

Is toLinearMap missing a @[coe] attribute?

Johan Commelin (Feb 21 2023 at 15:27):

Thanks! That fixes it!


Last updated: Dec 20 2023 at 11:08 UTC