Zulip Chat Archive
Stream: mathlib4
Topic: Flexible linter doesn't trigger on `simp` + `exact`
Snir Broshi (Nov 25 2025 at 13:35):
I might be misunderstanding the flexible linter, but this looks like a bug to me.
- Doesn't trigger:
theorem foo {x₁ x₂ : Nat} {l₁ l₂ : List Nat} (h : x₁ :: l₁ = x₂ :: l₂) : l₁ = l₂ := by
simp at h
exact h.right
- Doesn't trigger:
theorem foo {x₁ x₂ : Nat} {l₁ l₂ : List Nat} (h : x₁ :: l₁ = x₂ :: l₂) : l₁ = l₂ := by
simp at h
have := h.right
sorry
- Triggers (false positive):
theorem foo {x₁ x₂ : Nat} {l₁ l₂ : List Nat} (h : x₁ :: l₁ = x₂ :: l₂) : l₁ = l₂ := by
simp at h
let h := 3
sorry
Damiano Testa (Nov 25 2025 at 13:52):
The first one should definitely complain, and indeed this version does complain:
import Mathlib
set_option linter.flexible true
theorem foo {x₁ x₂ : Nat} {l₁ l₂ : List Nat} (h : x₁ :: l₁ = x₂ :: l₂) : l₁ = l₂ := by
simp at h
cases h
assumption
Damiano Testa (Nov 25 2025 at 13:52):
I am a bit surprised that the linter even says anything when there is a sorry: I thought that the linter was quiet when there were other messages already.
Snir Broshi (Nov 29 2025 at 22:35):
Opened issue #32257
Last updated: Dec 20 2025 at 21:32 UTC