Zulip Chat Archive
Stream: lean4
Topic: elaborating from InfoTree
Patrick Massot (Jan 17 2023 at 15:54):
Assume I have a docs4#Lean.Elab.TacticInfo object info and I get some Syntax object derived from part of info.stx. Can I elaborate this to an Expr?
Patrick Massot (Jan 17 2023 at 17:29):
@Sebastian Ullrich do you know about the above question? Is there a magic monad lifting or hidden state to save me or should a I somehow recreate a TermElabM context by hand?
Wojciech Nawrocki (Jan 17 2023 at 17:49):
@Patrick Massot what are you trying to do using this? The syntax for a TacticInfo is generally going to be a tactic which you could evaluate with evalTactic. But you should generally not have to do this.
Patrick Massot (Jan 17 2023 at 17:54):
evalTactic is even worse than elabTerm from this point of view since it needs to be in the TacticM monad, right?
Patrick Massot (Jan 17 2023 at 17:54):
The context is trying to translate a tactic proof into natural language.
Sebastian Ullrich (Jan 17 2023 at 17:55):
So there's a syntactic term embedded in info.stx and you want to (re-)elaborate it?
Wojciech Nawrocki (Jan 17 2023 at 17:56):
What Expr do you expect to get out of this? The code of the tactic metaprogram being run? The target / goal type? Something else?
Patrick Massot (Jan 17 2023 at 17:56):
Yes. It would be even better to access the result of the prior elaboration but I guess this isn't recorded anywhere.
Sebastian Ullrich (Jan 17 2023 at 17:57):
It should be, there should be a TermInfo node nested in the tactic node
Sebastian Ullrich (Jan 17 2023 at 17:57):
Are we talking about a set of specific tactics?
Patrick Massot (Jan 17 2023 at 17:59):
For instance if you have in you proof apply my_quantified_assumption my_object then I want the expression corresponding to my_quantified_assumption my_object.
Patrick Massot (Jan 17 2023 at 18:00):
Sebastian Ullrich said:
It should be, there should be a
TermInfonode nested in the tactic node
Oh indeed!
Patrick Massot (Jan 17 2023 at 18:00):
I didn't open enough nested stuff!
Patrick Massot (Jan 17 2023 at 18:00):
So this was a stupid question, I'm sorry.
Sebastian Ullrich (Jan 17 2023 at 18:01):
That's the advantage of using Emacs, I don't have tree nodes I can open to begin with
Wojciech Nawrocki (Jan 17 2023 at 18:05):
trace.Elab.info is not currently collapsible however! It shows the whole thing at once.
Patrick Massot (Jan 17 2023 at 18:06):
Actually I don't know how to get a nice tree in VSCode. We have code dumping xml that I then open in Firefox.
Patrick Massot (Jan 17 2023 at 18:06):
Can you display collapsible InfoTrees in VSCode?
Gabriel Ebner (Jan 17 2023 at 18:07):
See also https://github.com/leanprover/lean4/issues/1678 The built-in visualization options aren't great yet.
Patrick Massot (Jan 17 2023 at 18:11):
Thanks Wojciech and Sebastian anyway. I should be unstuck now.
Last updated: May 02 2025 at 03:31 UTC