Zulip Chat Archive

Stream: lean4

Topic: How to find appropriate lib to import in Mathlib4


Jaeboum Kim (Apr 05 2024 at 17:24):

I am having a hard time getting used to Mathlib4, which is different structure from Mathlib3.
I have an error in the following code. "unknown tactic" at "mul_add".
How should I deal with problems that arise from not properly importing the lib?

import Mathlib.NumberTheory.ArithmeticFunction
import Mathlib.Data.Complex.Basic
import Mathlib.Data.Real.Basic
import Mathlib.FieldTheory.IsAlgClosed.AlgebraicClosure
import Mathlib.Logic.Equiv.Defs
import Mathlib.Tactic.Ring.Basic
import Mathlib.RingTheory.PowerSeries.Basic
import Mathlib.Algebra.Ring.Defs

theorem mathd_algebra
  (x : )
  (σ : Equiv  )
  (h₀ :  x, σ.1 x = 5 * x - 12)
  (h₁ : σ.1 (x + 1) = σ.2 x) :
  x = 47 / 24 :=
by
  mul_add

Kevin Buzzard (Apr 05 2024 at 17:45):

That looks like things are working fine. mul_add isn't a tactic so the error is expected.

Jaeboum Kim (Apr 05 2024 at 17:48):

Actually, I got "unexpected identifier; expected '['" errors at the last line.
While debugging, I found mul_add has an error.

theorem mathd_algebra
  (x : )
  (σ : Equiv  )
  (h₀ :  x, σ.1 x = 5 * x - 12)
  (h₁ : σ.1 (x + 1) = σ.2 x) :
  x = 47 / 24 :=
by
  field_simp [h₀, mul_add, add_mul, sub_add_cancel, mul_assoc, add_comm]
  have := congr_arg σ.to_fun h₁
  rw h₀ at this

Yaël Dillies (Apr 05 2024 at 17:52):

It should be rw [h₀] at this

Jaeboum Kim (Apr 05 2024 at 17:56):

@Yaël Dillies Yes, you're right! How can I find proper lib for import? ex) symmetry (unknown tactic)

Yaël Dillies (Apr 05 2024 at 17:56):

It's now called symm

Jaeboum Kim (Apr 05 2024 at 17:58):

How can I find these changes easily...?

Yaël Dillies (Apr 05 2024 at 17:59):

Ask here :smile:

Kevin Buzzard (Apr 05 2024 at 18:27):

Isn't there some "crash course to mathlib 4 for mathlib 3 users" somewhere? Maybe on the community website or the mathlib GitHub repo?

Yaël Dillies (Apr 05 2024 at 18:28):

https://github.com/leanprover-community/mathlib4/wiki/Lean-4-survival-guide-for-Lean-3-users


Last updated: May 02 2025 at 03:31 UTC