Commit graph

5678 commits

Author SHA1 Message Date
Leonardo de Moura
3f4499be08 feat: allow trailing ; at doSeqBracketed 2020-09-26 14:20:47 -07:00
Leonardo de Moura
13ded3f964 chore: use doElem category 2020-09-26 12:51:24 -07:00
Leonardo de Moura
2754d78749 proto: type classes for the for in notation 2020-09-25 18:48:23 -07:00
Leonardo de Moura
8e159f004c fix: missing synthesizeSyntheticMVarsNoPostponing at elabMatch 2020-09-25 18:48:23 -07:00
Leonardo de Moura
b71e5b4648 test: cdot tests 2020-09-25 18:48:23 -07:00
Sebastian Ullrich
eae32b08a6 fix: pretty printing multiple universe levels
Fixes #190
2020-09-25 20:06:18 +02:00
Leonardo de Moura
240680db1a feat: add binductionOn support 2020-09-25 07:18:14 -07:00
Leonardo de Moura
d17c20be25 test: add old Lean3 tests 2020-09-25 06:48:51 -07:00
Leonardo de Moura
1775d9b04b fix: visit types
See new test `tests/lean/run/def14.lean`
2020-09-25 06:48:51 -07:00
Leonardo de Moura
0e16bd60dc fix: missing case 2020-09-25 06:48:51 -07:00
Leonardo de Moura
afa2f9b74c test: add old Lean3 tests 2020-09-25 06:48:51 -07:00
Leonardo de Moura
e4f492d68a feat: add support for reflexive inductive datatypes 2020-09-24 20:30:12 -07:00
Leonardo de Moura
66d35cdd76 fix: the generated matcher must be able to eliminate into different universe levels 2020-09-24 19:34:14 -07:00
Leonardo de Moura
98f7e9b3e4 chore: naming convention 2020-09-24 19:22:24 -07:00
Leonardo de Moura
bdf412bf49 test: add old Lean3 tests 2020-09-24 18:01:23 -07:00
Leonardo de Moura
3256a24813 fix: bug at toBelow 2020-09-24 17:38:51 -07:00
Leonardo de Moura
bdefe91fbf test: add old Lean3 tests 2020-09-24 17:32:47 -07:00
Leonardo de Moura
7edc52682b fix: processNonVariable 2020-09-24 17:16:50 -07:00
Leonardo de Moura
8383177c96 fix: nonoptimal specialization
@Kha Here is the fix for the problem I told you this morning.
Please, take a look at `specialize.cpp` and see whether it makes sense.
2020-09-24 12:40:28 -07:00
Leonardo de Moura
6fe8a0e179 test: issue 29
New frontend fixed this issue.
closes #29
2020-09-23 18:30:28 -07:00
Leonardo de Moura
e22d2f6cb1 test: new tests for structural recursion
@Kha The structural recursion is working :)
It is so much more powerful than the one in Lean3.
I added examples with `let rec`, nested and multiple
`match`-expressions.
I will keep testing and adding missing features tomorrow, and
will hopefully start porting stdlib to new frontend before the end of
the week.
2020-09-23 18:24:56 -07:00
Leonardo de Moura
6a51ec8427 fix: missing case (kernel projection) at isExprDefEqAuxImpl 2020-09-23 18:24:56 -07:00
Leonardo de Moura
c46e64b089 feat: add Array.zipWith and Array.zip 2020-09-23 18:24:56 -07:00
Sebastian Ullrich
fa55c1e088 fix: pretty printing loose bvars
Fixes #192
2020-09-23 11:13:23 +02:00
Leonardo de Moura
d66b6738ee chore: fix test 2020-09-22 19:07:46 -07:00
Leonardo de Moura
0511b73d80 feat: add replaceFVars 2020-09-22 14:24:03 -07:00
Leonardo de Moura
bbc1f4d461 fix: throwAppTypeMismatch should be polymorphic
We use it from `TermElabM` and `MetaM`, and they have different
`TermElabM` implementations.
2020-09-22 09:35:59 -07:00
Leonardo de Moura
05e5d934d3 feat: change default precedence for new syntax
Now, the following example produces a syntax error.
```lean
macro "foo!" x:term : term => `($x + 1)

check id foo! 10
```

@Kha, I think the heuristic is simple and defensible.
If the new syntax starts and ends with token, than the precedence is
`maxPrec`. Otherwise, it is `leadPrec`.

see #180
2020-09-21 19:04:03 -07:00
Leonardo de Moura
dc9626ceab feat: try to improve weird error message
@Kha Before this commit, we were producing the error "expected command" at the `let` token
```lean
check id let x := 1; x
```
The new error is "expected command, but found term; this error may be
due to parsing precedence levels, consider parenthesizing the term".

The example above looks artificial, but it will happen all the time as
users start to define their own notation.
2020-09-21 18:29:01 -07:00
Leonardo de Moura
f4b5ec710f fix: fixes #175 2020-09-21 17:12:07 -07:00
Leonardo de Moura
c19814a624 chore: avoid memory leak
@Kha I suspect the memory leaks reported at the CI are due to
an exception produced by the compiler.
The compiler is currently a mix of Lean and C++ code.
I think the exception was thrown from C++ code, crossed Lean code (producing
memory leaks), and was caught by the old frontend written in C++.

We will eventually replace the compiler C++ code with Lean code.
So, I think this is a low priority issue.
2020-09-21 13:30:58 -07:00
Leonardo de Moura
151e877513 refactor: seal EnvExtension type
The motivation is to prevent users from tinkering with its internal
implementation details that rely on unsafe features.
The new test crashed before this commit.
2020-09-21 12:24:44 -07:00
Sebastian Ullrich
f693e910b1 fix: skip minimum amount of tokens during parser recovery
Fixes #186
2020-09-21 11:37:50 +02:00
Leonardo de Moura
6a90fbf855 test: String interpolation
@Kha I wrote this extended test using the new frontend. The new
frontend worked great. I only had a minor issue with `#exit`.
The example uses `let rec`, parsers, macros, lift-method notation, etc.
It implements the new parser `strInterpolant p` for string
interpolation. The parser `p` is used to process the elements inside
`{...}`. Then, I use this parser to implement the macro `toString!`.
Example: `toString! "1+2 = {1+2}"` produces `"1+2 = 3"`.
Even the new "lift-method" notation works inside the string interpolant.
```lean
def g (x : Nat) : StateRefT Nat IO Nat := do
modify (· + x);
get

def ex : StateRefT Nat IO Unit := do
IO.println $ toString! ">> hello {(<- g 1)}";
IO.println $ toString! ">> world {(<- g 1)}";
pure ()
```
2020-09-20 18:11:19 -07:00
Leonardo de Moura
d33f7c7885 feat: attribute command 2020-09-20 09:11:36 -07:00
Leonardo de Moura
7d9118d2e2 feat: add resolveGlobalConst and resolveGlobalConstNoOverload 2020-09-20 08:54:24 -07:00
Leonardo de Moura
ac2a9539f9 fix: old&new frontend interference
The new test was not working because new frontend was using old
frontend function.
2020-09-20 08:25:45 -07:00
Leonardo de Moura
87381e3329 feat: add support for parser priorities in the syntax command
@Kha Parser priorities are working :)
2020-09-19 18:47:08 -07:00
Leonardo de Moura
c43450f027 feat: macros for the syntax category
This is the last of a series of commits for adding this feature.
2020-09-19 15:00:41 -07:00
Leonardo de Moura
052e67d1af feat: rewrite tactic 2020-09-18 16:13:14 -07:00
Sebastian Ullrich
f1386672c8 chore: disable format-reparse test until hard linebreaks are working 2020-09-18 13:15:40 -07:00
Sebastian Ullrich
68568e78d3 feat: formatter: use hard space after opening structure instance brace 2020-09-18 13:15:40 -07:00
Sebastian Ullrich
519eda2459 feat: formatter: interpret checkWsBefore as soft space 2020-09-18 13:15:40 -07:00
Sebastian Ullrich
95007171a8 feat: formatter: group+indent binders and structure instance fields 2020-09-18 13:15:40 -07:00
Sebastian Ullrich
97a2198fe0 feat: change default indent width from 4 to 2 spaces 2020-09-18 13:15:40 -07:00
Sebastian Ullrich
ec3682ce15 feat: formatter: automatically group+indent syntax categories 2020-09-18 13:15:40 -07:00
Sebastian Ullrich
ac6c2b7a8e feat: formatter: interpret space after token as soft space 2020-09-18 13:15:40 -07:00
Leonardo de Moura
5a24cb5ef7 feat: add hygienicIntro option
@Kha `hygienicIntro` is true by default. `hygienicIntro == false` is
the Lean3 behavior. If we find `hygienicIntro` too inconvenient in
practice, we set the default to false.
2020-09-18 13:02:38 -07:00
Leonardo de Moura
02e6f019c4 refactor: move nextMacroScope to Core.State
@Kha We now can create scoped user-facing names at `CoreM` and `MetaM`
methods.
2020-09-18 12:00:24 -07:00
Leonardo de Moura
0e8f8117a1 refactor: simpler mechanism for never backtracking traces
We do backtrack messages but not traces.

cc @Kha
2020-09-18 10:31:42 -07:00