Zulip Chat Archive

Stream: lean4

Topic: combined check and simp command


Chris Henson (Oct 22 2024 at 20:15):

Is there a command similiar to #check that also simplifies the type, possibly with simp?

Damiano Testa (Oct 22 2024 at 20:17):

Is #simp ... a thing?

Damiano Testa (Oct 22 2024 at 20:18):

docs#Mathlib.Tactic.Conv.«command#simpOnly_=>__», maybe?

Yaël Dillies (Oct 22 2024 at 20:19):

Yes, but it only simplifies the expression. It does not infer the type. #simp %type_of your_thing should do

Damiano Testa (Oct 22 2024 at 20:20):

Ah, I had missed "simplifying the type"!

Floris van Doorn (Oct 22 2024 at 20:24):

Yael's code has a small typo. This works:

import Mathlib.Tactic

#simp type_of% true

Yaël Dillies (Oct 22 2024 at 20:28):

Argh, I was trying really hard to remember which side the % went on :see_no_evil:

Chris Henson (Oct 22 2024 at 20:28):

No worries, I figured it out. Thanks!

Damiano Testa (Oct 22 2024 at 20:28):

It should go where a percentage would go, right?

Damiano Testa (Oct 22 2024 at 20:29):

This is also how I remember # and % in bash...

Yaël Dillies (Oct 22 2024 at 20:29):

Damiano Testa said:

It should go where a percentage would go, right?

Well actually I thought it went at the start because no Lean identifier can start with it

Damiano Testa (Oct 22 2024 at 20:30):

I see, but that mnemonic gives the wrong answer... :smile:

Yaël Dillies (Oct 22 2024 at 20:32):

Do you have a mnemonic for which mnemonic gives the right answer? :dizzy:

Damiano Testa (Oct 22 2024 at 20:34):

:lol: I had not thought of yours, so I simply went for where I would expect the symbol to go:

  • my first reaction to # is a cardinality and I place it before the object,
  • my first reaction to % is a percentage and I place it after the object.

Kyle Miller (Oct 22 2024 at 20:37):

With # I think "time to start a command" and with % I think "oh right, this was a special elaborator"


Last updated: May 02 2025 at 03:31 UTC