Zulip Chat Archive
Stream: new members
Topic: How to see what `grind` is doing?
Bbbbbbbbba (Jan 10 2026 at 03:34):
I have a grind proof but I want to learn why grind works in this case and not others, and whether it might be worthwhile to convert this into an explicit proof. Neither show_term nor trace.grind yields anything useful.
import Mathlib
set_option trace.grind true
example (N x : ℝ) (hx : x ^ 3 = N) : x ^ 9 = N * (N * N) := by
show_term grind
Ilmārs Cīrulis (Jan 10 2026 at 04:52):
Explicit proof seems to be short, so, probably yes, you can use it instead of grind.
import Mathlib
example (N x : ℝ) (hx : x ^ 3 = N) : x ^ 9 = N * (N * N) := by
rw [← hx]; ring
Yan Yablonovskiy 🇺🇦 (Jan 10 2026 at 05:27):
After the rewrite, you can run show_term on ring, but fair warning it is very horrible to look at. Tactics like this typically look rough.
Ilmārs Cīrulis (Jan 10 2026 at 05:41):
In this specific case the following proof that avoids ring works too, but in more complex situations automation offered by ring is probably the best option.
import Mathlib
example (N x : ℝ) (hx : x ^ 3 = N) : x ^ 9 = N * (N * N) := by
rw [← hx, ← pow_add, ← pow_add]
Eric Paul (Jan 10 2026 at 06:26):
You can see the proof that grind generated as follows, although it is fairly large:
import Mathlib
example (N x : ℝ) (hx : x ^ 3 = N) : x ^ 9 = N * (N * N) := by?
grind -abstractProof
Yoh Tanimoto (Jan 10 2026 at 10:02):
Eric Paul said:
You can see the proof that
grindgenerated as follows, although it is fairly large:
When I click [apply], it gives errors...
Vlad Tsyrklevich (Jan 10 2026 at 10:04):
It's because the delaborator is not including all of the necessary type information. If you instead click apply on this even more awful term, it will succeed.
import Mathlib
set_option pp.all true
example (N x : ℝ) (hx : x ^ 3 = N) : x ^ 9 = N * (N * N) := by?
grind -abstractProof
Bbbbbbbbba (Jan 10 2026 at 11:47):
Thanks a lot! All your answers helped in different ways.
Nick Adfor (Jan 14 2026 at 16:57):
Well, I want grind to have something like grind? and generate rw… or simp…
Nick Adfor (Jan 14 2026 at 16:58):
But the grind -abstractProof can only show large abstractProof without mathematical meaning :(
Henrik Böving (Jan 14 2026 at 20:16):
The best you will get is the grind? grind mode output which in your case becomes:
example (N x : ℝ) (hx : x ^ 3 = N) : x ^ 9 = N * (N * N) := by?
grind => ring
For non trivial coals grind would produce a more verbose proof. Emitting rw or simp style proofs would not be efficient for grind. It operates based on very different data structures internally and enforces a lot of assumptions about the shape that the goal it is working on is in. You don't just get these assumptions in general tactic mode.
Last updated: Feb 28 2026 at 14:05 UTC