Commit graph

9 commits

Author SHA1 Message Date
Leonardo de Moura
483f32edd8 feat: in pure code, do use assume Id monad at do notation
This feature produced counterintuitive behavior and confused users.
See discussion at #770.

As pointed out by @tydeu, it is not too much work to write `Id.run <|`
before the `do` when we want to use the `do` notation in pure code.

closes #770
2021-12-10 12:55:14 -08:00
Leonardo de Moura
99e8a98f06 feat: allow universes metavariables from any depth to be assigned when ignoreLevelDepth is true
We set `ignoreLevelDepth` to true during type class resolution.
2021-08-18 20:20:51 -07:00
Leonardo de Moura
c37d961fc3 chore: make sure both alternatives use throwError 2021-03-16 17:20:00 -07:00
Leonardo de Moura
25f1980ddd fix: fixes #345 2021-03-11 18:59:39 -08:00
Leonardo de Moura
f321ad213f fix: reset set of stuck mvars after reporting they are stuck
This bug produced the doubled error message at issue #337
2021-03-08 12:46:50 -08:00
Leonardo de Moura
0c1c6c0a73 feat: convert universe metavariables into parameters after elaborating theorem header
closes #318

Like Lean 3, we are doing it only for theorems.
@Kha, we talked about doing it for definitions too, it sounded like a
good idea, and it would make the system's behavior more uniform, but
unfortunately it creates too many problems. There are so many trivial
cases where it breaks. Here are some examples.

1- Definitions that take multiple bundled structures
```
def foo (s1 : Group) (s2 : CommRing) ...
```
They are universe polymorphic, and the different structures must be in
the same universe, but we don't know it when we elaborate the header,
that is, we need to elaborate the body.

An extreme case is `PUnit` occurring in the header. It is universe
polymorphic, but we only lear the constraints on this universe after
we elaborate the body.

2- All files containing unification hints broke.
Again, there are universe constraints on the header that we only learn
after we elaborate the body.

3- Many `CoeSort` and `CoeFun` examples broke.
Example:
```
structure Group :=
  (carrier : Type u) (mul : carrier → carrier → carrier) (one : carrier)

instance GroupToType : CoeSort Group (Type u) :=
  CoeSort.mk (fun g => g.carrier)
```
We would have to write
```
instance GroupToType : CoeSort Group.{u} (Type u) :=
  CoeSort.mk (fun g => g.carrier)
```
We would have to provide universe level parameters manually in this
kind of instance. I think it would be too annoying.
2021-02-25 16:53:58 -08:00
Leonardo de Moura
09de37e8e5 chore: improve error message 2021-02-05 12:26:39 -08:00
Leonardo de Moura
4fc2aead45 fix: missing checkAssignment at assignToConstFun
Fixes #297
2021-01-26 17:33:33 -08:00
Leonardo de Moura
9d0edab6c3 chore: add issue 297 examples
The stack overflow reported on this issue has already been fixed.

closes #297
2021-01-26 08:07:41 -08:00