Zulip Chat Archive
Stream: general
Topic: localHyps not getting have statments
Frederick Pu (Jan 29 2026 at 23:33):
example (x : Nat) : x = x := by
have : x = x := rfl
run_tac do
let womp ← Lean.Elab.Tactic.getMainGoal
-- IO.println (← Lean.getLocalHyps).size
IO.println (← Lean.MonadLCtx.getLCtx).size
for hyp in ← Lean.getLocalHyps do
IO.println (← hyp.fvarId!.getType)
-- Nat
exact this
as you can see in the above the x = x have statement isn't showing up in the getLocalHyps call
Eric Wieser (Jan 29 2026 at 23:35):
docs#Lean.Elab.Tactic.withMainContext
Frederick Pu (Jan 29 2026 at 23:36):
oh thanks
Eric Wieser (Jan 29 2026 at 23:36):
Without that you get the local context at the very start of the by block
Frederick Pu (Jan 29 2026 at 23:36):
also how do you print an expr in raw form
Frederick Pu (Jan 29 2026 at 23:37):
so i can see which constructors are being applied and stuff
Jakub Nowak (Jan 29 2026 at 23:38):
s!"{e}" or e.dbgToString.
Eric Wieser (Jan 29 2026 at 23:41):
m!"{repr e}" I think?
Frederick Pu (Jan 29 2026 at 23:41):
thanks so much!!!
Last updated: Feb 28 2026 at 14:05 UTC