lean4-htt/tests/lean/run/7353.lean
JovanGerb 11aff52fb1
fix: abstractNestedProofs should see into the head of an application (#7353)
This PR changes `abstractNestedProofs` so that it also visits the
subterms in the head of an application.

This oversight caused some definitions in mathlib to have unabstracted
proofs, such as
[CategoryTheory.StructuredArrow.commaMapEquivalenceInverse](https://leanprover-community.github.io/mathlib4_docs/Mathlib/CategoryTheory/Comma/StructuredArrow/CommaMap.html#CategoryTheory.StructuredArrow.commaMapEquivalenceInverse)

Mathlib
[bench](https://github.com/leanprover-community/mathlib4/pull/22613#issuecomment-2704288815):
build instructions -0,166 %
lint instructions -0.72 %

This speedup comes from files containing `CategoryTheory.Functor`, which
contains beta unreduced expressions, where abstracting proofs used to
not happen.

Zulip:
https://leanprover.zulipchat.com/#narrow/channel/270676-lean4/topic/dsimp.20simplifies.20proofs.2C.20which.20is.20slow/near/503630173
2025-03-06 20:08:38 +00:00

19 lines
488 B
Text

structure Foo where
obj : Unit → Type
map : obj ()
def foo : Foo where
obj _ := Function.const (() = ()) Nat (id rfl)
map := id (0 : Nat)
set_option pp.proofs true
set_option pp.explicit true
/--
info: def foo : Foo :=
Foo.mk (fun x => @Function.const Type (@Eq Unit Unit.unit Unit.unit) Nat foo.proof_1)
(@id ((fun x => @Function.const Type (@Eq Unit Unit.unit Unit.unit) Nat foo.proof_1) Unit.unit)
(@OfNat.ofNat Nat 0 (instOfNatNat 0)))
-/
#guard_msgs in
#print foo