Zulip Chat Archive

Stream: mathlib4

Topic: Mono tactic explosion


Eric Wieser (Jul 22 2024 at 11:57):

How many goals do you think mono creates here?

import Mathlib

theorem mono_explodes (a :   ) (i zi : ) (h :  (b : ), i  b  a zi  a b) :
    a zi  a zi := by
  mono
  run_tac Lean.logInfo m!"{(← Lean.Elab.Tactic.getGoals).length}"
  repeat sorry

Eric Wieser (Jul 22 2024 at 12:02):

attribute [-mono] hasProd_mono hasSum_mono seems to fix it (docs#hasProd_mono)

Damiano Testa (Jul 22 2024 at 12:06):

Here is another fix:

import Mathlib

theorem mono_explodes (a :   ) (i zi : ) (h :  (b : ), i  b  a zi  a b) :
    ((((((((((((((((((((((((((((((((((((((((((((((((((((a zi)^1)^1)^1)^1)^1)^1)^1)^1)^1)^1)^1)^1)^1)^1)^1)^1)^1)^1)^1)^1)^1)^1)^1)^1)^1)^1)^1)^1)^1)^1)^1)^1)^1)^1)^1)^1)^1)^1)^1)^1)^1)^1)^1)^1)^1)^1)^1)^1)^1)^1)^1)^1  ((((((((((((((((((((((((((((((((((((((((((((((((((((a zi)^1)^1)^1)^1)^1)^1)^1)^1)^1)^1)^1)^1)^1)^1)^1)^1)^1)^1)^1)^1)^1)^1)^1)^1)^1)^1)^1)^1)^1)^1)^1)^1)^1)^1)^1)^1)^1)^1)^1)^1)^1)^1)^1)^1)^1)^1)^1)^1)^1)^1)^1)^1 := by
  mono
  run_tac Lean.logInfo m!"{(← Lean.Elab.Tactic.getGoals).length}"
  sorry

Thomas Murrills (Jul 22 2024 at 20:06):

Btw, this could also be attributed to the fact that mono is a thin wrapper around solve_by_elim, and uses backtracking := false. Changing this to backtracking := true fixes the issue. (Unfortunately passing a config option is not enough since these fields are overwritten; this would have to be done in source)


Last updated: May 02 2025 at 03:31 UTC