Zulip Chat Archive

Stream: Machine Learning for Theorem Proving

Topic: Building up Lean.Expr's


Arthur Paulino (Apr 30 2025 at 19:11):

I had this idea yesterday and I wonder if anyone has tried it before. Instead of trying to write Lean code, an AI agent would try to create terms of Lean.Expr directly. This approach would be more easily plugged to Lean 4, as a meta program. I wonder if this path would be promising.

Adam Topaz (Apr 30 2025 at 19:31):

I had a similar idea a little while ago, but realized that the most convenient interface for an agent to interact with is still the tactic system, but with a restricted set of tactics (intro, apply and refine, primarily)

Arthur Paulino (Apr 30 2025 at 19:53):

It depends on what you mean by "convenient". Operating with Lean.Expr directly is very convenient too as it doesn't need to leave MetaM and avoids overheads related to parsing. In RL algorithms, the cycle cost is very important. That is, the cost of checking whether a new proof term attempt works or not.

Arthur Paulino (Apr 30 2025 at 19:55):

The main problem, however, is in the feedback the human would receive. Instead of a series of tactics, it would be some seriously ugly proof term. My thinking is that it's a tradeoff that favors the machine over the human in the loop

Eric Wieser (Apr 30 2025 at 21:11):

I think trying to build an Expr for a rw tactic is rather an ordeal

Eric Wieser (Apr 30 2025 at 21:14):

For instance, look at how large the proof term for the following is:

import Mathlib

open scoped TensorProduct

-- to show the full proof term
set_option pp.all true

set_option pp.all true
#check add_comm (1 :  []  [] ) 0

Aaron Liu (Apr 30 2025 at 21:16):

oh god

Eric Wieser (Apr 30 2025 at 21:19):

Giving up typeclass search and the elaborator is giving up some very carefully tuned algorithms written by humans, and asking your agent to learn those at the same time as learning formalizing mathematics

Eric Wieser (Apr 30 2025 at 21:19):

(and also to memorize all the instance names which are explicitly not part of any backwards compatibility guarantee)

Arthur Paulino (May 01 2025 at 09:24):

If not Lean.Expr, then maybe Syntax.
It's more constrained than pure text and still more easily pluggable via metaprogramming


Last updated: May 02 2025 at 03:31 UTC