Commit graph

670 commits

Author SHA1 Message Date
Leonardo de Moura
efb9fb0802 chore(kernel): remove opportunistic hash consing support
It just adds extra complexity and is in conflict for our plans for
Lean4. Moreover, in our experiments it impacts negatively on
performance: master and lean4 branches. The negative impact has been
confirmed by @kha too.
2018-04-12 16:43:10 -07:00
Leonardo de Moura
c08a3bc557 refactor(library/typed_expr): move typed_expr to frontends/lean 2018-04-09 15:25:40 -07:00
Leonardo de Moura
8dd53cd94f chore(*): rename expr_struct_* to expr_*
We don't need to modifier `_struct` anymore since we don't use the
pointer equality based hashtables anymore.
2018-04-09 12:55:48 -07:00
Leonardo de Moura
faf8e025e7 chore(kernel): remove m_hash_alloc field from expressions
This field was originally added to create hashtables based on pointer
equality. We don't use them anymore, and the caches based on
m_hash_alloc can be implemented using m_hash without any performance
impact. This commit also fixes two places where `expr_set` was used
instead of `expr_struct_set`.

This commit is also important for the Lean4 plans where `expr` will
be implemented in Lean, and fields like `m_hash_alloc` would require us
to track state.
2018-04-09 10:05:56 -07:00
Leonardo de Moura
bdea7d420d chore(*): type_context ==> type_context_old 2018-03-05 12:38:24 -08:00
Leonardo de Moura
11e87545be chore(frontends/lean): remove dead variables 2018-02-21 15:04:19 -08:00
Leonardo de Moura
b16f641179 feat(util/name_generator): name generator prefix bookkeeping 2018-02-21 15:04:19 -08:00
Leonardo de Moura
ce028d651d refactor(kernel): abstract_type_context::mk_fresh_name ==> abstract_type_context::next_name 2018-02-21 15:04:19 -08:00
Leonardo de Moura
28d6326228 refactor(frontends/lean/parser): add name_generator 2018-02-21 15:04:19 -08:00
Leonardo de Moura
2e5b66a5f1 refactor(kernel): make sure kernel does not use global ::lean::mk_fresh_name 2018-02-21 15:04:19 -08:00
Leonardo de Moura
78d8ff8031 feat(*): add reset_thread_local 2018-02-21 15:04:19 -08:00
Sebastian Ullrich
450ca5834c fix(frontends/lean/parser): fix debug build 2017-11-30 17:47:49 +01:00
Sebastian Ullrich
7c63b2f046 fix(frontends/lean/parser): unicode pattern aliases 2017-11-27 12:43:15 +01:00
Sebastian Ullrich
30cfc6cf0b feat(frontends/lean/{parser,elaborator}): structure instance patterns 2017-11-22 12:16:28 -08:00
Sebastian Ullrich
0aacccd8c9 feat(frontends/lean): change structure update notation
`{s with ...}` is now `{..., ..s}`, which more clearly expresses that the
result type is not necessarily equal to the type of `s` (in absence of an
expected type and a structure name, we still default to the type of `s`).

Multiple fallback sources can be given: `{..., ..s, ..t}` will fall back to
searching a field in `s`, then in `t`. The last component can also be `..`,
which will replace any missing fields with a placeholder.

The old notation will be removed in the future.
2017-11-17 16:40:47 -08:00
Sebastian Ullrich
e7e05a3ad0 feat(frontends/lean): add aliasing patterns id@pat 2017-11-17 16:35:21 -08:00
Leonardo de Moura
d2497d554f feat(frontends/lean): add support for unicode char literals and escape sequences
TODO: we are not checking if the unicode escape values provide by the
user correspond to valud unicode scalar values. We should check how
other languanges handle this case.
2017-10-23 13:46:57 -07:00
Leonardo de Moura
28501a0e0e feat(library/init/data/string): string as a list of unicode scalar values, and iterator abstraction
TODO:
- Implement string primitives in the VM.
- Support for unicode char literals.
2017-10-23 10:55:26 -07:00
Leonardo de Moura
f36fca875c feag(frontends/lean): explicit delimiters in declaration parameters
Comment from parser.h

This commit makes sure that all declaration parameters must be surrounded with some kind of bracket. (e.g., '()', '{}', '[]').
The goal is to avoid counter-intuitive declarations such as:

              example p : false := trivial
              def main proof : false := trivial

which would be parsed as

              example (p : false) : _ := trivial

              def main (proof : false) : _ := trivial

where `_` in both cases is elaborated into `true`. This issue was raised by @gebner in the slack channel.

Remark: we still want implicit delimiters for lambda/pi expressions. That is, we want to write

               fun x : t, s
           or
               fun x, s

instead of

               fun (x : t), s
2017-09-15 10:07:09 -07:00
Sebastian Ullrich
d82df26ff0 fix(frontends/lean/elaborator): go back to ignoring implicit args in quote patterns 2017-09-11 09:33:38 -07:00
Sebastian Ullrich
0bf96e5752 fix(frontends/lean/elaborator): revert dubious workaround of mine
Synthesizing an expr placeholder in an elaborated term doesn't make much sense
2017-09-08 13:23:16 +02:00
Gabriel Ebner
effd624911 fix(frontends/lean/parser): add check_system call 2017-08-18 08:54:04 +02:00
Sebastian Ullrich
9c2d42b269 fix(frontends/lean/parser): to_pattern_fn: replace invalid choice pattern with sorry
Fixes #1749
2017-07-17 14:59:07 +02:00
Leonardo de Moura
9afb53fad5 feat(kernel/expr): allow metavariables to have user-facing names
We need this feature for:
1) Defining nonlinear search patterns. Example: (?m <= ?m + 1)
2) Preprocessing recursive equations and support the pattern
refinement approach used in Agda. Example: in Agda, they accept
```
def append {A : Type} : Π (m n : nat), Vec A m -> Vec A n -> Vec A (m + n)
| m n nil            ys := ys
| m n (cons m' x xs) ys := cons x (append m' n xs ys)
```
These equations have to be refined. For example, `m` has to be
replaced with `0` (in the first equation), and `succ m'` in the
second. To implement this kind of refinement, we need to convert
the pattern variables (local constants) into metavariables during
elaboration. Then, the unassigned metavariables become local constants
again. This preprocessing step will fix some of the issues on #1594.
To completely fix #1594, we will need yet another preprocessing step
which will implement "complete transition" used in the equation
compiler before we start elim_match.cpp
2017-07-16 07:16:41 -07:00
Gabriel Ebner
68ee9396c6 fix(frontends/lean/parser): support backtracking from empty expressions
Fixes #1745.
2017-07-15 11:12:09 +01:00
Leonardo de Moura
8dcccd3bfc fix(frontends/lean/parser): make sure imax and max level arguments are parsed using the same precendence we use to parse application arguments
This commit addresses an issue raised by @digama0 on the Lean slack channel.
2017-07-07 12:43:07 -07:00
Sebastian Ullrich
2ca44459ba feat(init/meta/interactive): add from synonym for exact 2017-07-05 11:20:10 -07:00
Sebastian Ullrich
f53fa97c4a feat(frontends/lean): escape identifiers when pretty-printing 2017-06-28 10:43:19 -07:00
Leonardo de Moura
3300eafd39 fix(frontends/lean/parser): fixes #1705
This is a temporary fix.
We will be able to implement a better solution after #1674.
2017-06-27 13:20:37 -07:00
Leonardo de Moura
582aa3338b fix(frontends/lean): compilation warnings with older versions of gcc 2017-06-19 11:14:22 -07:00
Sebastian Ullrich
95b317fa64 refactor(frontends/lean): do not hard code commands accepting attributes & modifiers 2017-06-19 11:09:26 -07:00
Leonardo de Moura
bf0d785888 feat(library/messages, frontends/lean): optional end position for messages
We need this information to be able to fix issues with the transient
message boxes feature (#1667).
2017-06-15 10:47:58 -07:00
Johannes Hölzl
1352d4a5b3 feat(src/frontents/lean): support for coinduction command in frontend 2017-06-12 20:42:48 -07:00
Leonardo de Moura
748eb856c3 fix(frontends/lean): fixes #1649
This issue is yet another reason for refactoring how parameters are
represented in Lean.
2017-06-06 21:33:24 -07:00
Leonardo de Moura
56215b36e8 fix(*): [[fallthrough]] ==> /* fall-thru */
Older gcc compilers generate a warning when the attribute is used.
I found out that GCC 7 will not produce a warning if comments
such as /* fall-thru */ or /* FALLTHRU */ are used instead of the
attribute [[fallthrough]]
2017-05-31 21:18:47 -07:00
Leonardo de Moura
24048c4258 fix(*): gcc 7 weird uninitialized warnings
I think most of them are incorrect.
I didn't find a workaround for the one at json.hpp.
So, I just disabled this warning at server.cpp
2017-05-31 18:05:03 -07:00
Leonardo de Moura
919cf420ea fix(*): gcc 7 warnings 2017-05-31 16:35:09 -07:00
Gabriel Ebner
ce44566c7d fix(frontends/lean/parser): do not skip command tokens after error recovery 2017-05-23 11:14:31 -07:00
Gabriel Ebner
47629e9da3 feat(frontends/lean): make most parser_errors recoverable 2017-05-23 11:14:31 -07:00
Gabriel Ebner
183bf63e26 fix(frontends/lean/parser): pass error-recovery flag from parser to elaborator 2017-05-23 11:14:31 -07:00
Gabriel Ebner
6b956ad658 fix(frontends/lean): prevent endless loops 2017-05-23 11:14:30 -07:00
Gabriel Ebner
345cd1bc2a feat(frontends/lean/parser): error recovery in interactive tactics 2017-05-23 11:14:30 -07:00
Gabriel Ebner
8c80cb8fe9 feat(frontends/lean/equations_validator): report errors instead of
exceptions
2017-05-23 11:14:30 -07:00
Gabriel Ebner
00ac867ddf feat(frontends/lean/elaborator,library/sorry): suppress error message that mention synthetic sorrys 2017-05-23 11:14:30 -07:00
Gabriel Ebner
1468461c47 feat(frontends/lean): recover from many parser errors 2017-05-23 11:14:30 -07:00
Sebastian Ullrich
84997bf4de refactor(init/meta/expr): unify expr and pexpr 2017-05-17 10:38:12 -07:00
Sebastian Ullrich
8c0394b294 refactor(library,frontends/lean): separate expr and pexpr macros 2017-05-09 16:02:41 -07:00
Sebastian Ullrich
2825c5fbcc feat(frontends/lean/elaborator): elaborate ``(e) to type reflected e` if possible and add coercion reflected -> expr 2017-05-09 16:02:41 -07:00
Gabriel Ebner
d79909a1b8 refactor(util/lean_path): support leanpkg.path files 2017-05-01 14:11:38 -07:00
Gabriel Ebner
baa4c48f1f refactor(util/lean_path): explicitly pass around search path 2017-05-01 14:11:38 -07:00