leanprover / lean4

Lean 4 programming language and theorem prover
https://lean-lang.org
Apache License 2.0
3.82k stars 325 forks source link

fix: have app unexpanders be considered before field notation #4071

Closed kmill closed 1 week ago

kmill commented 1 week ago

On Zulip, Peter Nelson reported that notations that could be pretty printed with generalized field notation did not pretty print using the intended notation.

This PR makes it so that app unexpanders are considered before generalized field notation. The complexity before was that we wanted to do parent projection collapse, and since we did the collapse before pretty printing that argument, it meant it wasn't possible to do app unexpanders when there was a field notation candidate. The new solution is to collapse parent projections only when actually considering field notation, which can be done because we can safely strip off projection syntax in an expression-directed way.

leanprover-community-mathlib4-bot commented 1 week ago

Mathlib CI status (docs):