lean4-htt/tests/lean/run/grind_section_var.lean
Leonardo de Moura 1695b940b1
feat: do not simp instances (#12244)
This PR ensures `simp` does not "simplify" instances by default. The old
behavior can be retrieved by using `simp +instances`. This PR is similar
to #12195, but for `dsimp`.
The backward compatibility flag for `dsimp` also deactivates this new
feature.

```
set_option backward.dsimp.instances true
```

Applying `simp` (and `dsimp`) to instances creates non-standard
instances, and this creates all sorts of problems in Mathlib.

---------

Co-authored-by: Henrik Böving <hargonix@gmail.com>
Co-authored-by: Sebastian Graf <sgraf1337@gmail.com>
Co-authored-by: Kim Morrison <kim@tqft.net>
2026-02-05 04:53:46 +00:00

26 lines
956 B
Text
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import Std.Do
/-
Section variables should not be included.
-/
variable {Q : Std.Do.PostCond α ps}
def Id.instLawfulMonad' : LawfulMonad Id := by
apply LawfulMonad.mk' <;> (simp only [Functor.map, id, Functor.mapConst, Seq.seq, SeqRight.seqRight, SeqLeft.seqLeft, bind, pure]; grind)
/-- info: Id.instLawfulMonad'.{u_1} : LawfulMonad Id -/
#guard_msgs in
#check Id.instLawfulMonad'
/-
Note that they are included when using `grind +revert`.
The problem is that the idiom `revert` and then re-`intro` while simplifying creates the
illusion that the section variables are needed.
-/
def Id.instLawfulMonad'' : LawfulMonad Id := by
apply LawfulMonad.mk' <;> (simp only [Functor.map, id, Functor.mapConst, Seq.seq, SeqRight.seqRight, SeqLeft.seqLeft, bind, pure]; grind +revert)
/--
info: Id.instLawfulMonad''.{u_1, u_2} {α : Type u_2} {ps : Std.Do.PostShape} {Q : Std.Do.PostCond α ps} : LawfulMonad Id
-/
#guard_msgs in
#check Id.instLawfulMonad''