Commit graph

7042 commits

Author SHA1 Message Date
Leonardo de Moura
d3de12fa09 test: another dependent pattern matching test 2020-09-09 16:51:46 -07:00
Leonardo de Moura
b136c519e2 fix: scope and improve error message 2020-09-09 16:44:43 -07:00
Leonardo de Moura
20bc004c70 feat: improve subst tactic 2020-09-09 16:20:15 -07:00
Leonardo de Moura
83410083a8 fix: do not generate code for noncomputable definitions 2020-09-09 15:28:41 -07:00
Leonardo de Moura
c78d0cf1f8 feat: use | position for reporting dependent-match elimination errors 2020-09-09 14:07:23 -07:00
Leonardo de Moura
854cc3418e feat: improve error message for dependent-match elimination failures
@Kha This is a first attempt to improve the error message for examples
like the one Andrew Kent posted on Zulip.
I created a simpler example using "vectors".
2020-09-09 13:43:06 -07:00
Leonardo de Moura
c9f4f858b1 feat: ellipsis in constructor application patterns
Given
```
inductive Foo
| mk₁ (x y z w : Nat)
| mk₂ (x y z w : Nat)
```
We can now write
```
def Foo.z : Foo → Nat
| mk₁ (z := z) .. => z
| mk₂ (z := z) .. => z
```
instead of
```
def Foo.z : Foo → Nat
| mk₁ _ _ z _ => z
| mk₂ _ _ z _ => z
```

cc @Kha
2020-09-09 10:21:06 -07:00
Leonardo de Moura
276e6a55ba feat: improve collectPatternVars
Add support for `@` and named parameters.
Fix how ctor fields are processed.
2020-09-09 09:52:25 -07:00
Leonardo de Moura
2e11053eb5 fix: matchAlt macros should not consume implicit arguments
As in Lean3, the following example is a valid definition

```
def head : {α : Type} → List α → Option α
| _, a::as => some a
| _, _     => none
```
2020-09-08 17:31:57 -07:00
Leonardo de Moura
ea2e86afba feat: add Array.allDiff 2020-09-08 16:16:14 -07:00
Leonardo de Moura
77f8fe0e41 fix: mkLetRecClosureFor 2020-09-08 15:14:46 -07:00
Leonardo de Moura
fc1e4cb533 feat: add Array.isPrefixOf 2020-09-08 14:40:43 -07:00
Leonardo de Moura
ecda364985 feat: add Expr.forEach 2020-09-08 13:03:53 -07:00
Leonardo de Moura
9151fef49d feat: abstract proofs occurring in binders 2020-09-08 12:29:35 -07:00
Leonardo de Moura
0a853b2c44 feat: abstract nested proofs in definitions 2020-09-08 11:59:26 -07:00
Leonardo de Moura
ebe2cf272e feat: add MonadCacheT 2020-09-08 10:48:47 -07:00
Leonardo de Moura
ef87b33cdc test: add another missing hole test 2020-09-07 17:18:20 -07:00
Leonardo de Moura
fc0be5e391 feat: improve error message position when definition type is metavar 2020-09-07 17:16:44 -07:00
Leonardo de Moura
18a9cb9b43 feat: improve error message position for binders with implicit types 2020-09-07 17:02:43 -07:00
Leonardo de Moura
722608d0c6 chore: fix test 2020-09-07 16:35:28 -07:00
Leonardo de Moura
b6079e12b8 feat: expand macros infix, infixl, infixr, prefix, and postfix 2020-09-07 16:35:25 -07:00
Leonardo de Moura
fded18d114 chore: mkElim ==> mkMatcher 2020-09-07 14:33:39 -07:00
Leonardo de Moura
91363bae19 feat: improve resolveLVal 2020-09-07 12:25:43 -07:00
Leonardo de Moura
7809fe0b01 fix: def+match macro 2020-09-07 11:34:53 -07:00
Leonardo de Moura
a12bc273bb refactor: src/Lean/Meta/EqnCompiler ==> src/Lean/Meta/Match 2020-09-07 11:09:48 -07:00
Leonardo de Moura
ddf12c91c2 fix: do not consider auxiliary declarations as local instances 2020-09-07 08:08:35 -07:00
Leonardo de Moura
79130bc3f9 feat: add addAndCompilePartial 2020-09-07 07:56:11 -07:00
Leonardo de Moura
81582e4482 feat: break PreDefinitions into strongly connected components 2020-09-06 14:22:06 -07:00
Leonardo de Moura
56e6b9b398 feat: add Tarjan's SCC 2020-09-06 14:19:59 -07:00
Leonardo de Moura
565d617bab chore: fix test 2020-09-06 08:57:33 -07:00
Leonardo de Moura
6704468f07 feat: add coeId instance
Add an example showing why it is useful.

TODO: reconsider whether we should use the approximation described in
the new test or not.
2020-09-06 08:27:26 -07:00
Leonardo de Moura
d8855c2673 feat: elaborate all definitions using elabMutualDef 2020-09-06 07:23:47 -07:00
Leonardo de Moura
102d2ae57d fix: avoid unnecessary reduction
```lean
forallBoundedTelescope `(Nat -> IO Nat) 1 fun xs type => ...
```
should assign `IO Nat` to `type` instead of `IO.RealWorld -> ...`
2020-09-06 06:57:52 -07:00
Leonardo de Moura
3ae3c51a8c feat: add Array.partition 2020-09-05 08:48:15 -07:00
Leonardo de Moura
250dc3e3a9 fix: adjust expanders and elaborators to new matchAlts node 2020-09-04 18:59:28 -07:00
Leonardo de Moura
70c42456b9 feat: expand intro+matchAlts macro 2020-09-04 18:22:56 -07:00
Leonardo de Moura
ef64e1c25a feat: fun+match macro
Example:
```
fun
  | 0 => true
  | _ => false
```
2020-09-04 16:23:01 -07:00
Leonardo de Moura
3dbd2b728b feat: add Array.getMax? 2020-09-04 10:40:34 -07:00
Leonardo de Moura
555a3f0dcf feat: new and improved mkAuxDefinition 2020-09-03 17:37:06 -07:00
Leonardo de Moura
f34fd3e6b4 refactor: move Closure.lean to Meta
We will need to improve the support for let-decls. We will use
the new `trackZeta`.
2020-09-03 11:54:08 -07:00
Leonardo de Moura
ad774ae397 feat: support for tracking which let-decls have been zeta expanded 2020-09-03 11:32:46 -07:00
Leonardo de Moura
f2a6562eed feat: validate 'let rec' types 2020-09-02 17:02:40 -07:00
Leonardo de Moura
8aa5409bac feat: elaborate 'let rec'
Remark: the actual lift is going to be performed at `MutualDef.lean`.
2020-09-02 17:02:35 -07:00
Leonardo de Moura
93bc39f897 chore: parameters do not need to match in mutually recursive definitions 2020-09-02 10:30:35 -07:00
Leonardo de Moura
907a202961 feat: expand in command macro 2020-09-02 10:04:58 -07:00
Leonardo de Moura
988bb09aaf feat: new inductive command syntax
cc @Kha
2020-09-02 09:41:52 -07:00
Leonardo de Moura
c5cd5f2e5b feat: check kinds 2020-09-01 17:20:06 -07:00
Leonardo de Moura
d74551b19e feat: elaborate header of mutually recursive definitions 2020-09-01 16:13:04 -07:00
Leonardo de Moura
095e07d52d chore: letrec => let rec
cc @Kha
2020-09-01 13:27:41 -07:00
Leonardo de Moura
5e5b75af61 chore: remove withDeclId 2020-09-01 13:04:08 -07:00