Commit graph

278 commits

Author SHA1 Message Date
Leonardo de Moura
55c8627f2c feat(frontends/lean): {! ... !} takes a list of pre-terms 2017-06-13 22:19:17 -07:00
Leonardo de Moura
bb2c39b471 feat(frontends/lean): add hole notation {! ... !}
Holes {! ... !} are elaborated using `sorry`.
We report an error if their value is fixed by typing and/or
elaboration rules.

We store the tactic_state and the optional attribute in the
info_manager. The idea is to allow users to execute commands with
respect to the stored tactic state and optional attribute.
The optional attribute is a pre term.

We are planning to add commands such as:
- Check type of the given argument.
- Reduce the given argument.
- Synthesize the hole automatically, where the given argument encodes
hint to the synthesizer.
- Use the given argument to fill the hole.
2017-06-13 18:53:05 -07:00
Sebastian Ullrich
283d8ade1a fix(library/quote): use opaque macro for elaborated expr quotations 2017-06-07 10:00:17 -07:00
Leonardo de Moura
603bbe5987 fix(*): gcc 7 linking errors 2017-05-31 16:35:09 -07:00
Gabriel Ebner
47629e9da3 feat(frontends/lean): make most parser_errors recoverable 2017-05-23 11:14:31 -07:00
Leonardo de Moura
4575c9e038 feat(frontends/lean): swap (t) and ``(t) semantics 2017-05-15 09:41:31 -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
Leonardo de Moura
f4ebd38ce3 feat(frontends/lean/builtin_exprs): improve infix paren notation
After this commit, `(+)` is notation for (add) instead of `(fun x y, add x y)`.
This change is relevant when defining type class instances such as

```lean
instance semigroup_to_is_associative [semigroup α] : is_associative α (*) :=
⟨mul_assoc⟩
```
2017-04-27 12:33:33 -07:00
Sebastian Ullrich
e9a6c544af refactor(frontends/lean/{elaborator,structure_cmd}): compile structure inheritance to nested fields 2017-04-24 19:35:15 +02:00
Sebastian Ullrich
6ab0a008f9 feat(frontends/lean/{builtin_cmds,interactive}): complete namespace/section after end 2017-04-23 11:26:31 -07:00
Sebastian Ullrich
669c4130b1 fix(frontends/lean/builtin_expr): no field notation after @/@@ 2017-03-31 09:40:49 -07:00
Sebastian Ullrich
cd013f22c0 chore(*): replace "'^.' notation" with "field notation", pretty print using "." 2017-03-31 09:40:49 -07:00
Leonardo de Moura
71685e4dd6 feat(frontends/lean): add support for t.<id> and t.<idx> when t is a composite term
Replace `^.` with `.` in the stdlib
2017-03-28 17:47:49 -07:00
Leonardo de Moura
87932f1c56 feat(frontends/lean): change notation for inaccessible patterns
The following are accepted
 .(t)
 ._

We don't accept .t anymore because it will conflict with the field
access notation.
2017-03-28 16:09:15 -07:00
Leonardo de Moura
6183c7676e feat(frontends/lean): use . for field access 2017-03-28 15:29:54 -07:00
Leonardo de Moura
8e2dcb8ad8 chore(frontends/lean): remove ^. variants (~> and )
This modification was motivated by a discussion at slack.
2017-03-28 12:23:33 -07:00
Leonardo de Moura
71bf0bcc5d fix(frontends/lean/builtin_exprs): fixes #1493 2017-03-27 17:57:13 -07:00
Sebastian Ullrich
68c1ff6219 feat(frontends/lean/builtin_exprs): use local field inference for info too 2017-03-27 14:01:38 -07:00
Sebastian Ullrich
00cb784bd8 fix(frontends/lean/builtin_exprs): do not hide elaborated field info when local inference fails 2017-03-27 14:01:29 -07:00
Sebastian Ullrich
897b4f9db1 fix(frontends/lean/builtin_exprs): override scope behavior for strict quoted names 2017-03-22 07:34:50 -07:00
Sebastian Ullrich
e0856284b0 feat(frontends/lean,emacs): tactic info before elaboration, fix many edge cases 2017-03-17 18:20:44 -07:00
Leonardo de Moura
c694dbd600 fix(frontends/lean/elaborator): conflict between (: t :) and (::) notations
It was preventing us from using `(::)`
2017-03-12 09:29:42 -07:00
Leonardo de Moura
8d3c7e7180 fix(frontends/lean/builtin_exprs): fixes #1433 2017-03-07 16:21:12 -08:00
Leonardo de Moura
fa99861788 feat(frontends/lean/elaborator): add new ^. notation
see #1403
2017-03-05 20:12:49 -08:00
Sebastian Ullrich
5d68938a9c feat(frontends/lean): expr literals ```(...) 2017-03-05 08:37:16 -08:00
Leonardo de Moura
552a185e6a feat(frontends/lean): 'let' in 'do' blocks 2017-02-24 09:10:36 -08:00
Sebastian Ullrich
dfe1874365 refactor(frontends/lean/{parser,util}): extract quote functions
Also fixes ``f when f is private
2017-02-23 01:52:13 +01:00
Leonardo de Moura
74f7bc0473 feat(frontends/lean): improve notation for converting infix notation into functions 2017-02-17 23:11:22 -08:00
Leonardo de Moura
077176b82f feat(frontends/lean): add Haskell-like for converting infix notation into functions
Examples:

 qsort (<) [20, 5, 10, 3, 2, 14, 1]

 foldl (+) 0 [1, 2, 3]
2017-02-17 22:51:50 -08:00
Leonardo de Moura
10c881266b refactor(frontends/lean): add parse_lparen 2017-02-17 21:46:39 -08:00
Sebastian Ullrich
b9424975b3 refactor(init/meta): replace dynamically-checked quotes where possible 2017-02-17 19:59:57 -08:00
Sebastian Ullrich
d15591a2d8 feat(library,frontends/lean): expose parser to Lean and use for parsing tactic parameters 2017-02-17 13:45:56 +01:00
Sebastian Ullrich
339713091f refactor(frontends/lean): simpler field notation info that also works with implicit parameters 2017-02-17 13:03:47 +01:00
Leonardo de Moura
c1c1cd417a fix(frontends/lean/builtin_exprs): make sure we use internal names (i.e., names starting with _) when compiling do-blocks
@johoelzl This commit fixes the problem you reported at slack.
2017-02-15 22:45:59 -08:00
Leonardo de Moura
55aa2023f4 feat(frontends/lean): add support for monad_fail type class in 'do' blocks 2017-02-05 20:09:08 -08:00
Leonardo de Moura
3ef463ccc9 chore(frontends/lean/builtin_exprs): update error messages for do-blocks 2017-02-05 19:07:23 -08:00
Leonardo de Moura
4283fe9bb7 fix(frontends/lean/builtin_exprs): missing pattern when lhs is a constant constructor 2017-02-05 19:03:00 -08:00
Leonardo de Moura
36dc796f6c refactor(frontends/lean): add more parser_state methods 2017-02-04 11:37:26 -08:00
Leonardo de Moura
bb9a0c79f4 feat(frontends/lean/builtin_exprs): better syntax for quoted terms with type ascription 2017-02-01 12:49:38 -08:00
Leonardo de Moura
77a9feaf70 refactor(frontends/lean): PType ==> Sort
see #1341
2017-01-30 11:54:00 -08:00
Leonardo de Moura
bf9f7560f7 feat(frontends/lean): (Type u) can't be a proposition
(Type u)  is the old (Type (u+1))
(PType u) is the old (Type u)
Type*     is the old (Type (_+1))
PType*    is the old Type*

The stdlib can be compiled, but we still have > 70 broken tests

See discussion at #1341
2017-01-30 11:54:00 -08:00
Gabriel Ebner
5fdc737dfc feat(library/tactic): store name of current declaration in tactic_state 2017-01-28 08:27:19 +01:00
Sebastian Ullrich
92ebaaa0f8 fix(frontends/lean/builtin_exprs): ite/dite prec should be lowest 2017-01-26 18:52:20 +01:00
Leonardo de Moura
c52be7e8c5 feat(frontends/lean,shell): autocompletion for ^.
@kha, I added autocompletion for ^. I try to elaborate the expression
before ^. using the local context provided by the parser.

The autocompletion only works if the type for the expression before ^. can be
inferred. This is a big limitation because this information cannot be
obtained in many cases. Here are examples that do not work:

  meta def proof_for (e : expr) : smt_tactic expr :=
  do cc ← to_cc_state, cc^.proof_for e
                         --^ does not work here

If we annotate cc with its type, it works:

  meta def proof_for (e : expr) : smt_tactic expr :=
  do cc : cc_state ← to_cc_state, cc^.proof_for e
                                    --^ works

We don't have typing information on the equation lhs at
autocompletion time. So, the following will not work

   private meta def mk_smt_goals_for (cfg : smt_config)
        : list expr → list smt_goal → list expr → tactic (list smt_goal × list expr)
   | []        sr tr := return (sr^.reverse, tr^.reverse)
                                  --^ does not work since
   | (tg::tgs) sr tr := ...
2017-01-17 19:27:59 -08:00
Leonardo de Moura
30cea2dceb fix(frontends/lean): auxiliary bind-application in do-notation was not allowing us to obtain type information for the monadic actions.
The new test exposes the problem.
2017-01-12 18:38:31 -08:00
Leonardo de Moura
46a3aacc17 fix(frontends/lean): begin...end block scope 2017-01-03 21:01:14 -08:00
Leonardo de Moura
9c069a3eda refactor(library/tactic/congruence): rename directory to smt 2016-12-30 13:15:19 -08:00
Leonardo de Moura
6a5f6a84cd feat(library/tactic/congruence/hinst_lemma): add heuristic instantiation lemmas 2016-12-25 20:11:58 -08:00
Sebastian Ullrich
00b8c2ca81 feat(frontends/lean/elaborator): save info on field of field expression 2016-12-18 23:48:50 -08:00