Zulip Chat Archive
Stream: metaprogramming / tactics
Topic: How do I interact with MetaM within a proof?
nrs (Oct 26 2024 at 20:06):
Suppose my cursor is at the end of the following line in my editor:
example {α} (a : α) (f : α → α) (h : ∀ a, f a = a) : f (f a) = a := by
Is there a way to call Lean.MVarId.getDecl
in this context to get info about a metavariable, or is such a call only available when I'm defining a tactic?
Damiano Testa (Oct 26 2024 at 20:11):
run_tac
"opens" the TacticM monad for you: is this close to what you wanted?
Kyle Miller (Oct 26 2024 at 20:12):
open Lean Meta Elab Tactic
example {α} (a : α) (f : α → α) (h : ∀ a, f a = a) : f (f a) = a := by
run_tac
let g ← getMainDecl
logInfo m!"the type is {g.type}"
-- the type is f (f a) = a
nrs (Oct 26 2024 at 20:12):
ah this is exactly it! thank you very much to both!!
Last updated: May 02 2025 at 03:31 UTC