aesop icon indicating copy to clipboard operation
aesop copied to clipboard

`destructProducts` can add dependencies on implicit variables

Open girving opened this issue 1 year ago • 1 comments
trafficstars

Here's (arguably) a bug which may be difficult to fix:

import Aesop
import Mathlib.Data.Nat.Basic

variable {bad : ℕ × ℕ}

set_option trace.aesop true in  -- Shows that `destructProducts` is the culprit
lemma unused {n : ℕ} {p q : ℕ → Prop} (pq : ∀ n, p n → q n) (pn : p n) : q n := by
  aesop (config := { enableSimp := false })  -- Ban `simp` so `destructProducts` has time to fire

#check unused  -- unused {bad : ℕ × ℕ} {n : ℕ} {p q : ℕ → Prop} (pq : ∀ (n : ℕ), p n → q n) (pn : p n) : q n

I'm using aesop close a lemma unused that makes no mention of bad, and bad doesn't occur in the final proof (at least in spirit). However, during aesop's search, it uses destructProducts to take bad apart into components, and :boom:, now the first argument of unused is {bad : ℕ × ℕ}.

Zulip thread

girving avatar Feb 10 '24 21:02 girving

Possibly this needs to wait on more general changes to implicit variables: https://github.com/leanprover/lean4/issues/2452.

girving avatar Feb 11 '24 08:02 girving