Commit graph

336 commits

Author SHA1 Message Date
Leonardo de Moura
6976f4501e chore: cleanup 2020-11-25 08:19:17 -08:00
Leonardo de Moura
1cb7cb3ef6 feat: add exists tactic 2020-11-24 16:17:43 -08:00
Leonardo de Moura
22629b3c66 feat: add headBetaMVarType 2020-11-24 16:17:27 -08:00
Leonardo de Moura
36eb03c601 chore: cleanup Check.lean 2020-11-24 16:13:52 -08:00
Leonardo de Moura
8f1ad0411d fix: fixes #220 and #223 2020-11-24 10:18:02 -08:00
Leonardo de Moura
5c39cd5120 chore: cleanup 2020-11-24 10:18:02 -08:00
Leonardo de Moura
ecfe590268 refactor: split Match.lean 2020-11-24 10:18:02 -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
e8ae23b7a6 chore: minor 2020-11-21 20:53:19 -08:00
Leonardo de Moura
76025c9d18 feat: add attribute [defaultInstance] 2020-11-21 08:24:28 -08:00
Leonardo de Moura
6830291fd5 chore: remove dead code at Class.lean used by old frontend 2020-11-20 16:51:44 -08:00
Leonardo de Moura
304c80d610 feat: use <| 2020-11-19 09:03:38 -08:00
Leonardo de Moura
f67c93191f feat: use |>. 2020-11-19 08:38:47 -08:00
Leonardo de Moura
c305c2691f chore: use := 2020-11-19 07:22:31 -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
e991f1993f feat: add Delta.lean 2020-11-18 18:47:22 -08:00
Leonardo de Moura
45cd9fe725 feat: add Core.transform 2020-11-18 18:47:22 -08:00
Leonardo de Moura
83deff4cde feat: add transform 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
c81dbeb53c feat: improve smart unfolding 2020-11-15 17:34:37 -08:00
Leonardo de Moura
f1b88e1304 feat: add option for disabling smart unfolding and fix tests 2020-11-15 17:00:51 -08:00
Leonardo de Moura
461c0786fd feat: generate auxiliary declaration for "smart unfolding" 2020-11-15 16:31:40 -08:00
Leonardo de Moura
f5ba036d8f chore: add support for reducing matchers 2020-11-15 15:07:53 -08:00
Leonardo de Moura
49e9064202 refactor: add MatcherInfo.lean 2020-11-15 14:22:05 -08:00
Leonardo de Moura
db5fe843de chore: add expandInterpolatedStr helper function, rename msg! => m! 2020-11-14 13:52:52 -08:00
Leonardo de Moura
a80c7ff882 feat: add mkLevelMax' and mkLevelIMax' 2020-11-14 08:11:49 -08:00
Leonardo de Moura
bf242f434d fix: missing case 2020-11-14 07:14:25 -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
Leonardo de Moura
396e767f3d refactor: move Ref to Prelude and rename it to MonadRef
`MacroM` will implement `MonadRef` because
1- It will be easier to throw errors from macros
2- We will be able to `getRef` to retrieve the syntax node at macro
rules.

I renamed `Ref` to `MonadRef` to make it consistent with other classes
providing monadic methods (e.g. `MonadEnv`, `MonadState`, etc).

cc @Kha
2020-11-13 16:00:31 -08:00
Leonardo de Moura
fc6c8e0348 fix: beta reduce value at processAssignmentFOApprox 2020-11-12 14:46:28 -08:00
Leonardo de Moura
f17e226638 chore: naming convention
Example: `mkNameStr` => `Name.mkStr`

cc @Kha
2020-11-11 10:08:55 -08:00
Leonardo de Moura
a8c791ecae chore: remove dead files and functions
Remove obsolete combinators: `whenM`, `unlessM`, and `condM`

cc @Kha
2020-11-10 18:37:15 -08:00
Leonardo de Moura
2daeb195b5 chore: use new names 2020-11-10 10:15:19 -08:00
Leonardo de Moura
2ef9199c56 chore: prepare to rename "predicate-like" classes 2020-11-10 10:12:21 -08:00
Sebastian Ullrich
3665e3b7b5 feat: pretty print match
Fixes #177
2020-11-10 10:11:24 -08:00
Leonardo de Moura
defa45ae2f feat: improve error message
when match-expression LHSs still contain metavariables after elaboration
2020-11-09 18:26:14 -08:00
Leonardo de Moura
f91b2cc89c chore: typo 2020-11-09 18:13:02 -08:00
Leonardo de Moura
2d2d39c78e chore: use mut 2020-11-07 17:32:13 -08:00
Leonardo de Moura
81d6e065e7 chore: adjust files and tests 2020-11-07 17:32:12 -08:00
Leonardo de Moura
abd6914ac2 fix: missing indentExpr at error message 2020-11-03 17:20:52 -08:00
Leonardo de Moura
dbe376a45a chore: control code size explosion 2020-11-03 17:20:52 -08:00
Leonardo de Moura
69abb0a35a feat: avoid unnecessary whnfs at unifyEqs 2020-11-03 17:20:52 -08:00
Leonardo de Moura
68ef8655bb feat: improve getElimInfo 2020-11-02 18:45:52 -08:00
Leonardo de Moura
7d752353a1 feat: add getElimInfo 2020-11-02 17:51:18 -08:00
Leonardo de Moura
1bec9ac3e0 feat: add generalizeTargets and more general unifyEqs 2020-11-02 17:43:43 -08:00
Leonardo de Moura
7b5f283507 chore: remove Expr.localE constructor
It was used by the old frontend
2020-11-01 09:37:48 -08:00
Leonardo de Moura
eb2b1d56eb chore: argument name 2020-11-01 08:03:37 -08:00
Leonardo de Moura
de8f8f0e28 feat: improve local context reduction approximation 2020-10-31 19:19:18 -07:00