Commit graph

135 commits

Author SHA1 Message Date
Daniel Selsam
6940166db4 chore: rebase and rm rawPos 2021-08-03 09:13:18 +02:00
Daniel Selsam
89364b802b feat: top-down heuristic delaboration 2021-08-03 09:13:18 +02:00
Leonardo de Moura
49a87ceb4d feat: add basic isDefEq cache 2021-07-28 16:29:44 -07:00
Leonardo de Moura
6d05daf73b feat: add flag for allowing synthetic opaque mvars to be assigned at isDefEq
See issue #492
TODO: add a mechanism for detecting new metavariables.
2021-07-27 17:58:08 -07:00
Sebastian Ullrich
380c6c285a perf: specialize some monad instances 2021-06-17 11:25:58 +02:00
Leonardo de Moura
37da993032 chore: remove HashableUSize instances 2021-06-02 08:48:11 -07:00
Leonardo de Moura
43812444a7 chore: Hashable => HashableUSize 2021-06-02 07:24:26 -07:00
Leonardo de Moura
6a87bba9c0 chore: mixHash => mixUSizeHash 2021-06-02 07:05:42 -07:00
Leonardo de Moura
a247249880 feat: add configuration option for disabling proof irrelevance at MetaM 2021-05-27 13:37:26 -07:00
Leonardo de Moura
0e1f645b07 fix: fixes #450 2021-05-10 13:55:06 -07:00
Leonardo de Moura
d68d1f0841 fix: fixes #423 2021-04-25 10:00:38 -07:00
Leonardo de Moura
aaa072cf21 feat: add withNewBinderInfos 2021-04-16 09:59:40 -07:00
Daniel Fabian
cb18af6184 feat: add withLocalDecls and withLocalDeclsD
They are array versions of `withLocalDecl` and `withLocalDeclD`, respectively. They are useful when you need to create variables dynamically.
2021-04-16 07:54:04 -07:00
Leonardo de Moura
2694e7798a refactor: add MonadBacktrack
The new class specifies an interface for saving and restoring the
backtrackable part of the state.
This commit also fixes a few issues.

- `commitWhen` at `LevelDefEq` was defining a checkpoint for
  the `isDefEq` methods, and it affects how postponed universe
  constraints are handled. However, the name suggests it is
  similar to `commitWhenSome?`, and consequently it was used
  in other places that had nothing to do with `isDefEq`.
  So, I renamed it, and provided the generic `commitWhen` at the new
  `MonadBacktrack.lean` file.

- We were restoring more state then needed in a few places.
  For example, we were discarding all caches.

- At `SyntheticMVars.lean`, we were using the `Meta.commitWhenSome?`
  method which does not restore the `Term.State`.
2021-04-11 19:10:41 -07:00
Sebastian Ullrich
1b1ac393d8 fix: do not try to pretty-print unknown metavariables
Fixes #380
2021-04-08 18:16:05 +02:00
Leonardo de Moura
566fad77d4 chore: helper methods 2021-03-27 18:48:03 -07:00
Leonardo de Moura
865316bbf9 feat: improve error message when stuck solving universe constraints
closes #343
2021-03-11 17:46:44 -08:00
Leonardo de Moura
be841a7cad chore: throwError! => throwError, throwErrorAt! => throwErrorAt
@Kha I marked the corresponding methods as `protected`.
I currently can't stand `throw_error`, and I am optimistic about
server highlighting feature you are working on :)
2021-03-11 11:59:45 -08:00
Leonardo de Moura
08fc25217d chore: cleanup, fix docs 2021-03-07 09:01:54 -08:00
Leonardo de Moura
3850b1a9aa perf: workaround for increasing the number of destructive updates
See 4908eaf396
2021-02-21 16:22:53 -08:00
Leonardo de Moura
50b6561f8f chore: cleanup 2021-02-21 14:04:00 -08:00
Leonardo de Moura
bb2ca97df9 refactor: add options for controlling whether variables are included or not at mkLambdaFVars and mkForallFVars 2021-02-17 13:49:27 -08:00
Leonardo de Moura
761b64c929 fix: missing occursCheck at SyntheticMVars
fixes #301
2021-01-29 17:13:04 -08:00
Leonardo de Moura
fdab5ca835 feat: add helper methods whnfR and whnfI 2021-01-25 17:18:08 -08:00
Leonardo de Moura
b575087859 fix: unfold class projections when using TransparencyMode.instances 2021-01-25 12:30:26 -08:00
Sebastian Ullrich
0c91b3769e chore: replace variables in src/ 2021-01-22 14:36:05 +01:00
Leonardo de Moura
b6abf19656 fix: unfold abbreviations only
For example, we should not reduce types of the form `let x := ...; ...`
2021-01-12 08:11:04 -08:00
Leonardo de Moura
b5fdc5e364 fix: expand abbreviations at isClass? 2021-01-12 06:56:23 -08:00
Leonardo de Moura
3388c63e11 fix: typo at ParamInfo.isExplicit 2021-01-11 07:08:17 -08:00
Leonardo de Moura
5baa162713 chore: lean 3 behavior for apply 2021-01-05 12:29:29 -08:00
Leonardo de Moura
698908584b fix: revert 2020-12-31 09:47:05 -08:00
Leonardo de Moura
78aa3d8e72 chore: use deriving BEq 2020-12-22 18:10:20 -08:00
Leonardo de Moura
3b6d65c3c3 chore: use deriving Inhabited 2020-12-13 10:09:20 -08:00
Leonardo de Moura
25ecc43a84 fix: missing try at isClass? 2020-12-09 15:19:49 -08:00
Leonardo de Moura
63ab55289e chore: remove "liftable methods"
The new frontend "auto lifting" feature makes them obsolete.
2020-12-09 15:06:07 -08:00
Leonardo de Moura
72215c7144 feat: add TransparencyMode.instances 2020-11-29 18:12:33 -08:00
Leonardo de Moura
ebba9d119d feat: unification hints 2020-11-27 18:12:49 -08:00
Leonardo de Moura
0869f38de4 chore: update structure, class, inductive 2020-11-27 15:09:30 -08:00
Leonardo de Moura
5981553e11 chore: remove workaround 2020-11-27 13:15:31 -08:00
Leonardo de Moura
c0db9f1e0c chore: adjust stdlib to recent changes 2020-11-27 12:26:07 -08:00
Leonardo de Moura
276a8b99dd refactor: move ppGoal to Meta
We need `MetaM` methods such as `isProp` to improve `ppGoal`.
This commit also moves `currNamespace` and `openDecls` to
`Core.Context`. Without this change, `Meta.ppExpr` was not taking
`open` commands into account.
2020-11-25 14:17:13 -08:00
Leonardo de Moura
d6f778bec4 refactor: arbitrary without explicit arguments
@Kha I was tired of writing `arbitrary _` :)
There 0 places in the stdlib where the type needs to be provided.
If in the future we need to specify the type we can use
`arbitrary (α := <type>)`
2020-11-25 09:07:38 -08:00
Leonardo de Moura
22629b3c66 feat: add headBetaMVarType 2020-11-24 16:17:27 -08:00
Leonardo de Moura
645c1034a0 chore: reduce compilation time 2020-11-23 16:18:55 -08:00
Leonardo de Moura
cb9574b086 chore: test unboundImplicitLocals and cleanup 2020-11-22 10:33:28 -08:00
Leonardo de Moura
f67c93191f feat: use |>. 2020-11-19 08:38:47 -08:00
Leonardo de Moura
91dca53274 refactor: remove MonadIO
There is no reason for having `MonadIO` anymore. The `MonadLift` type
class is well behaved in the new frontend, the `MonadFinally` solves
the problem at monad stacks such as `ExcepT e IO`.

This commit also changes the type of the IO printing functions.
For example, the type of `IO.println` was
```
def IO.println {m} [MonadIO m] {α} [ToString α] (s : α) : m Unit
```
and now it is just
```
def IO.println {α} [ToString α] (s : α) : IO Unit
```
We rely on the new frontend auto-lifting feature.
That is, if there is an instance `[MonadLiftT IO m]`, then
a term of type `IO a` is automatically coerced to `m a`

We also want a simpler `IO.println` for writing tests.
For example,
```
```
doesn't work because there isn't sufficient information for inferring
the parameter `m` in the previous `IO.println`.
The shortest workaround looked very weird
```
```

I considered adding `IO` as a default value for `m` when we have
`MonadIO m`, as we use `Nat` as the default for `ofNat a`, but it felt
like uncessary complexity.

@Kha The commit seems to work well. The auto-lifting featuring has
been working great for me. There is still room for improvement.
For example, given `MonadLiftT m n`, it doesn't automatically lift
`a -> m b` into `a -> n b`. So, code such as
`foo >>= IO.println`
had to be rewritten as
`foo >>= fun x => IO.println x`
I will add this feature later.
If you have time, please try to play with this feature and figure out
if it is stable enough for making it the default.
That is, if it roboust enough, we can stop using the following idiom
for writing functions that can be lifted automatically.
```
def instantiateLevelMVarsImp (u : Level) : MetaM Level :=
  ...

def instantiateLevelMVars {m} [MonadLiftT MetaM m] (u : Level) : m Level :=
  liftMetaM $ instantiateLevelMVarsImp u
```
I think we only need this idiom when using `MonadControlT` which is
not as common as `MonadLiftT`.
2020-11-18 18:47:22 -08:00
Leonardo de Moura
35b193ebc0 chore: helper instances 2020-11-18 18:47:22 -08:00
Leonardo de Moura
21bfb6a51e chore: use mutual instead of old idiom: high order functions + specialize
Before we moved to the new frontend, we used to simulate mutual
recursion using high order functions + `[specialize]`. This is not
needed anymore, and the new generated code is more efficient and compact.

@Kha I don't usually indent `mutual` blocks, but I found it helpful
for big ones like this one. Not sure whether we should keep indenting
them or not.
2020-11-13 16:00:33 -08:00
Leonardo de Moura
cca9cceab0 chore: minor cleanup 2020-11-13 16:00:33 -08:00