Zulip Chat Archive
Stream: general
Topic: Understanding evalConst in aesop tacgen
Frederick Pu (Mar 14 2025 at 17:02):
I'm having trouble understanding what evalConst is actually doing in tacGenImpl
-- Precondition: `decl` has type `TacGen`.
unsafe def tacGenImpl (decl : Name) : RuleTac := λ input => do
let tacGen ← evalConst TacGen decl
let initialState ← saveState
let suggestions ← tacGen input.goal
let mut apps := Array.mkEmpty suggestions.size
...
Aaron Liu (Mar 14 2025 at 17:05):
It's getting the TacGen from an name.
Frederick Pu (Mar 14 2025 at 19:35):
so does it run a compiler on the string?
Aaron Liu (Mar 14 2025 at 19:39):
It looks up the definition and evaluates it. Use like
def foo : TacGen := bar
-- evalConst TacGen `foo
-- works here
Kyle Miller (Mar 16 2025 at 21:43):
Yeah, my understanding is that evalConst TacGen decl looks up the declaration whose name is given by decl, which has already been compiled, and then uses the interpreter to evaluate the compiled code, returning some runtime value, which must be a TacGen. If it's not actually a TacGen, then unspecified behavior occurs.
Last updated: May 02 2025 at 03:31 UTC