Commit graph

281 commits

Author SHA1 Message Date
Leonardo de Moura
587540f11b feat(frontends/lean): add abbreviation command
This command is not just a cosmetic feature.
We need it to defined `id_rhs` before the tactic framework is defined.
We want `id_rhs` to be used in all definitions generated by the equation
compiler. Right now, it is only used in definitions defined after the
tactic framework.
2018-01-05 15:40:59 -08:00
Leonardo de Moura
6c44dd1b7f feat(frontends/lean): add hide command
cc: @kha
2017-12-13 11:53:21 -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
Leonardo de Moura
4faae27069 perf(frontends/lean): add notation #[...]
The new notation should be use to input long sequences.
Closes #1755
2017-07-21 04:20:48 -07:00
Sebastian Ullrich
c8d6b40991 refactor(frontends/lean/builtin_exprs,library): suppose ~> assume : 2017-07-05 11:20:10 -07:00
Sebastian Ullrich
f024ccd75d refactor(frontends/lean/token_table,library): take ~> assume 2017-07-05 11:20:10 -07:00
Sebastian Ullrich
9033cba7d3 feat(frontends/lean,init/meta/interactive): assume and suppose tactics 2017-06-27 18:50:10 -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
Johannes Hölzl
1352d4a5b3 feat(src/frontents/lean): support for coinduction command in frontend 2017-06-12 20:42:48 -07:00
Sebastian Ullrich
b3884d5f42 refactor(init/meta/interactive,frontends/lean/token_table): introduce generalizing keyword in Lean 2017-04-16 15:11:49 -07:00
Sebastian Ullrich
8ea2bc08cb feat(init/meta/interactive): add generalizing parameter to induction 2017-04-11 17:07:28 -07:00
Leonardo de Moura
84bfd3e298 chore(frontends/lean): update keywords
Remark: "as" doesn't need to be a keyword.
So, we can now write patterns such as (a::as).
2017-03-30 16:51:08 -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
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
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
9d3c0497cb chore(frontends/lean): rename transient commands
See issue #1432
2017-03-09 18:41:19 -08:00
Leonardo de Moura
a00f2e49a7 chore(frontends/lean): remove several command aliases
We still have many more to remove and rename.
See issue #1432
2017-03-09 16:49:03 -08:00
Leonardo de Moura
51958df84b chore(frontends/lean/token_table): remove dead keywords 2017-03-07 14:00:49 -08:00
Leonardo de Moura
c427350dc0 chore(frontends/lean/token_table): remove dead commands 2017-03-07 13:50:14 -08:00
Sebastian Ullrich
5d68938a9c feat(frontends/lean): expr literals ```(...) 2017-03-05 08:37:16 -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
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
Leonardo de Moura
f650a1b873 refactor(library/init/meta): avoid '_core' idiom using default parameters
I kept a few core methods (e.g., exact_core and apply_core). Reason:
if we use default parameters

    meta constant exact (e : expr) (md := semireducible) : tactic unit

then, we will not be able to write

    to_expr p >>= exact

The workaround is

    do t <- to_expr p, exact t

or
    to_expr p >>= (fun x, exact x)

One alternative is to change how we handle default parameters, and
eta-expand applications that involve default parameters.
We may also have an attribute [eta_expand]. Then

    attribute [eta_expand] foo

instructs the elaborator to automatically eta-expand foo-applications.
The attribute would give users more control, and avoid potential
performance problems. Without the attribute, then for every function
application the elaborator has to check the type and decide whether it
must be eta-expanded or not.

@gebner @kha What do you think?
2017-02-14 09:46:55 -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
385ea13688 feat(kernel/declaration,*): all theorems are delayed, and are revealed on delta-reduction 2016-11-29 11:12:43 -08:00
Leonardo de Moura
97dd2f34d5 feat(library,frontends/lean): add basic doc string support 2016-11-25 18:52:56 -08:00
Leonardo de Moura
dfd2a23cd4 feat(frontends/lean): use #"c" instead of 'c' for character literals
The new notation is the same one used in Standard ML.
It will also allow us to use ' in the beginning of identifiers like Standard ML.
2016-11-17 11:35:54 -08:00
Leonardo de Moura
0bb155a427 chore(*): remove .clean support
In Lean2, we used to cache elaborated definitions in .clean files. The
main goal was to optimize each flycheck invocation produced by Emacs.

The Lean3 definition package was not updating this cache. Moreover, it
is not necessary because the new compilation server subsumes it.
2016-10-13 19:58:58 -07:00
Leonardo de Moura
3fbdb71f3e feat(library/tactic/simplifier): remove simp_extensions 2016-10-06 20:50:23 -07:00
Leonardo de Moura
73ed9db161 chore(frontends/lean/token_table): remove old keyword 2016-10-05 08:46:23 -07:00
Leonardo de Moura
c0022253a7 feat(frontends/lean/tactic_notation): allow lemmas to be removed 2016-09-30 19:53:51 -07:00
Leonardo de Moura
051b6bd026 feat(frontends/lean/tactic_notation): add notation for entering auto-quotation mode 2016-09-30 16:18:52 -07:00
Leonardo de Moura
c6ec659bf5 feat(frontends/lean): improve 'begin...end' blocks 2016-09-27 13:34:11 -07:00
Leonardo de Moura
70ca497654 feat(frontends/lean/token_table): add ASCII notation for anonymous constructor 2016-09-25 13:48:52 -07:00
Leonardo de Moura
d5a28f91cc refactor(library/init): reorganize files and cleanup notation 2016-09-25 13:37:45 -07:00
Leonardo de Moura
49cffc0b20 feat(frontends/lean): add compact notation for setting attributes suggested by Sebastian 2016-09-24 15:45:06 -07:00
Leonardo de Moura
5957022adb feat(frontends/lean): add 'class' keyword 2016-09-24 14:32:01 -07:00
Leonardo de Moura
148da46481 feat(frontends/lean): 'mutual' and 'meta' are now keywords 2016-09-24 10:44:40 -07:00
Leonardo de Moura
6bfd4eb9cf feat(frontends/lean): add 'instance' keyword 2016-09-23 12:19:05 -07:00
Leonardo de Moura
85e03da7db feat(frontends/lean): add 'def' as shorthand for 'definition' 2016-09-23 08:25:16 -07:00
Leonardo de Moura
7ae778e925 feat(frontends/lean): generalize '~>' notation, and add alias '^.' for '~>' 2016-09-23 08:18:19 -07:00
Leonardo de Moura
b7abd61579 feat(frontends/lean): change subtype notation (again)
We had conflicts with the set notation.
2016-09-21 17:02:18 -07:00
Leonardo de Moura
c0ff9967af feat(frontends/lean): add basic notation for collections 2016-09-21 16:20:57 -07:00
Leonardo de Moura
dde5f7ac70 feat(frontends/lean): add aliases such as: .1 for ~>1 2016-09-21 11:32:02 -07:00
Leonardo de Moura
8657230435 chore(frontends/lean): new token for projections, and cleanup 2016-09-21 10:18:49 -07:00
Leonardo de Moura
318ef761d3 feat(frontends/lean): lambda+anonymous_constructor+match notation 2016-09-21 08:49:05 -07:00
Leonardo de Moura
5e8f2add84 refactor(library/init): use universe variables 2016-09-17 12:25:02 -07:00
Leonardo de Moura
a74f02546b refactor(*): remove abbreviation command 2016-09-03 17:11:29 -07:00
Leonardo de Moura
cd77f7167e chore(frontends/lean): run_tactic ==> run_command
add `command` as alias for `tactic unit`
2016-08-18 12:53:21 -07:00