Commit graph

6 commits

Author SHA1 Message Date
Sebastian Ullrich
c67686132a feat: include unexpected token in error message 2023-09-12 11:42:24 +02:00
Leonardo de Moura
fedf235cba fix: fixes #2011
In Lean 4, we have support for typing constraints of the form
```
(?m ...).1 =?= v
```
where the type of `?m ...` is a structure with a single field.
This kind of constraint is reduced to `?m ... =?= ⟨v⟩`

This feature is implemented by the function `isDefEqSingleton`.
As far as I remember, Lean 3 does not implement this feature.

This commit disables this feature if the structure is a class.
The goal is to avoid the generation of counterintuitive instances by
typing inference.

For example, in the example at issue #2011, the following weird
instance was being generated for `Zero (f x)`
```
(@Zero.mk (f x✝) ((@instZero I (fun i => f i) fun i => inst✝¹ i).1 x✝)
```
where `inst✝¹` is the local instance `[∀ i, Zero (f i)]`
Note that this instance is definitinally equal to the expected nicer
instance `inst✝¹ x✝`.
However, the nasty instance trigger nasty unification higher order
constraints later.

Note that a few tests broke because different error messages were
produced. The new error messages seem better. I do not expect this
change to affect Mathlib4 since Lean 3 does not have this feature.
2023-01-05 17:33:45 -08:00
Leonardo de Moura
d3b0b49c43 feat: improve elabBinRelCore
See new test and comments at `elaBinRelCore`
2022-09-15 15:17:57 -07:00
Leonardo de Moura
7fc6607611 feat: have ... := ... syntax closer to let 2021-05-06 15:38:57 -07:00
Sebastian Ullrich
75e95f93a9 feat: improve let error locality 2021-04-27 16:38:46 -07:00
Sebastian Ullrich
60f2faefb7 feat: display placeholder & goal errors even on parse error 2021-04-17 23:46:15 +02:00