Zulip Chat Archive

Stream: new members

Topic: Simp as a command / function?


Mark Aagaard (Aug 22 2024 at 22:17):

I'm using Lean in an intro to logic course for computer engineers and would like to demonstrate term simplification to the students. Is it feasible to wrap some code around the simp tactic to create a command or function that displays the simplified form of a term? If yes, then any pointers on where to start would be great.

For example:
variable (a b : Bool)

#simp a && b && true
a && b

-mark

Kyle Miller (Aug 22 2024 at 22:38):

If you're using mathlib, it's just an import away :smile:

import Mathlib.Tactic.Common

variable (a b : Bool)

#simp a && b && true
-- a && b

Kyle Miller (Aug 22 2024 at 22:40):

If you aren't using Mathlib, you can copy Mathlib/Tactic/Conv.lean and delete the import Mathlib.Init import.

Mark Aagaard (Aug 23 2024 at 15:56):

That's great. Thanks!

-mark


Last updated: May 02 2025 at 03:31 UTC