Zulip Chat Archive

Stream: lean4

Topic: Grind can't solve a rfl equation


Fernando Chu (Aug 06 2025 at 11:40):

import Mathlib

def vecInit {α} {n : } (v : Fin n.succ  α) : Fin n  α :=
  fun i  v i.1, Nat.lt_succ_of_lt i.2

-- grind doesn't work but rfl does
theorem foo {α} {n : } (v : Fin n.succ  α) (x : ) (p : x < n.succ)
  (h : x < n) : vecInit v x, (by grind) = v x, p := by grind

Robin Arnez (Aug 06 2025 at 11:52):

Yeah it can't for the same reason that simp won't: it won't look at the definition of non-reducible functions unless explicitly told to do so:

import Mathlib

def vecInit {α} {n : } (v : Fin n.succ  α) : Fin n  α :=
  fun i  v i.1, Nat.lt_succ_of_lt i.2

theorem foo {α} {n : } (v : Fin n.succ  α) (x : ) (p : x < n.succ)
    (h : x < n) : vecInit v x, (by grind) = v x, p := by
  grind [vecInit] -- works

Fernando Chu (Aug 06 2025 at 11:53):

I see, thanks!


Last updated: Dec 20 2025 at 21:32 UTC