Commit graph

3421 commits

Author SHA1 Message Date
Leonardo de Moura
dea8a856dc chore(library/equations_compiler/compiler): generate error when using well founded recursion in meta definitions 2017-05-17 12:24:47 -07:00
Sebastian Ullrich
75786e9a6e feat(frontends/lean/pp): hide (some) defaulted arguments on pp.implicit true 2017-05-17 10:38:12 -07:00
Sebastian Ullrich
84997bf4de refactor(init/meta/expr): unify expr and pexpr 2017-05-17 10:38:12 -07:00
Leonardo de Moura
7d2ec25e81 fix(tests/lean/interactive/complete_field): fix tests 2017-05-16 14:50:15 -07:00
Leonardo de Moura
0091cef9f2 feat(library/tactic): start algebraic normalizer 2017-05-15 21:46:19 -07:00
Leonardo de Moura
4575c9e038 feat(frontends/lean): swap (t) and ``(t) semantics 2017-05-15 09:41:31 -07:00
Leonardo de Moura
76ff23c154 chore(tests/lean): fix tests 2017-05-14 19:40:36 -07:00
Mario Carneiro
7ace147f25 refactor(init/meta/tactic): replace assertv -> note, definev -> pose 2017-05-14 19:34:27 -07:00
Sebastian Ullrich
27c1d2f4fb fix(init/meta/interactive): simp: accept local refs as simp names 2017-05-14 19:19:22 -07:00
Sebastian Ullrich
14425bd2d3 fix(frontends/lean/decl_util): double-elaboration of include params 2017-05-14 19:19:22 -07:00
Gabriel Ebner
85673cdd8d fix(frontends/lean/definition_cmds): examples in noncomputable theories 2017-05-13 09:04:07 +02:00
Sebastian Ullrich
4b21b13649 refactor(init): replace has_quote class with reflected 2017-05-09 16:02:42 -07:00
Sebastian Ullrich
ead6318ee0 feat(frontends/lean/elaborator): substitute reflected locals into expr quotes 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
Sebastian Ullrich
aa601d3e51 chore(tests): move tests to correct dir 2017-05-09 16:02:41 -07:00
Gabriel Ebner
b536df3596 feat(library/type_context): add option to unfold lemmas 2017-05-08 10:14:47 -07:00
Gabriel Ebner
40bf75cbff fix(library/equations_compiler/structural_rec): fix indices 2017-05-07 15:52:39 +02:00
Gabriel Ebner
4b22e2309c refactor(system/io): use spawn_args structure in all process functions 2017-05-04 16:41:11 -07:00
Gabriel Ebner
f0d22ed3e5 feat(library/process,system/io): set environment variables for spawned processes 2017-05-04 16:41:11 -07:00
Daniel Selsam
b7d20a333f chore(src/library/constants): rm unused constants 2017-05-04 16:34:32 -07:00
Sebastian Ullrich
ad4f8cec73 chore(tests): forgot to commit test 2017-05-03 13:27:35 -07:00
Sebastian Ullrich
3c525bef6a fix(frontends/lean/pp): parenthesize Type u where necessary 2017-05-03 13:27:35 -07:00
Sebastian Ullrich
7eb04f0d44 fix(frontends/lean/elaborator): instantiate mvars in [reflected a] params
Fixes #1562
2017-05-03 13:27:35 -07:00
Sebastian Ullrich
b37b1fb7c6 refactor(library/type_context,frontends/lean/elaborator): move reflected code back into elaborator
Since we do not want recursive special handling of `reflected`, this seems to be
the simpler design.
2017-05-03 13:27:35 -07:00
Sebastian Ullrich
d0c2c73b35 refactor(init/meta,tools): rename now tactic to done
It was pointed out that Coq already uses `now` for a different kind of tactic.
And `done` is more descriptive anyway.
2017-05-03 11:18:31 +02:00
Leonardo de Moura
73b4e42485 chore(frontends/lean,library): fix character pretty printer 2017-05-02 13:17:22 -07:00
Leonardo de Moura
a0a8103804 chore(frontends/lean): go back to 'c' as notation for characters
This suggestion has been discussed at Slack.
We have decided to use #"c" as notation because we wanted to allow `'`
in the beginning of identifiers like in SML and F*. In particular,
we wanted to allow users to use 'a 'b 'c for naming type parameters
like in SML. However, nobody used this notation. In the Lean standard
library, we are using greek letters for naming type parameters.
So, there is no real motivation for the ugly #"c" syntax.
2017-05-02 13:00:51 -07:00
Leonardo de Moura
f64b3cb874 chore(frontends/lean): do not allow identifiers starting with ' 2017-05-02 10:43:44 -07:00
Leonardo de Moura
55fee26b36 feat(library/class): add attribute for tracking symbols occurring in instances of type classes
For more information see:
https://github.com/leanprover/lean/wiki/Refactoring-structures
The new attribute [algebra] implements the [algebraic_class] described
in the page above.
2017-05-01 18:02:30 -07:00
Leonardo de Moura
039f5571cd test(tests/lean/run): add regression test for #1525 2017-05-01 14:59:24 -07:00
Leonardo de Moura
ba5eccdca8 refactor(library/init/core): rename out_param => inout_param
It is really input/output.
2017-05-01 14:01:41 -07:00
Leonardo de Moura
74550fbebc feat(library/init/core): add notation for out_param 2017-05-01 13:52:17 -07:00
Leonardo de Moura
66a1fec94e feat(library/init/category): add has_orelse type class 2017-05-01 09:58:27 -07:00
Leonardo de Moura
5cef84709f refactor(library): avoid auxiliary definitions such as add/mul/le/etc
See Section "Other goodies" at
https://github.com/leanprover/lean/wiki/Refactoring-structures

This commit also improves the support for projections in the
unifier/matcher.

Now, we consider the extra case-split for projections.
Given a projection `proj`, and the constraint `proj s =?= proj t`, we need to try first `s =?= t` and if it fails, then try to reduce.
This is needed in the standard library because we now have constraints such as:
```
@has_le.le ?A ?s ?a ?b  =?=  @has_le.le nat nat.has_add x y
```
If we reduce the right hand side, we get the unsolvable constraint
```
@has_le.le ?A ?s ?a ?b  =?=  nat.le x y
```
Before this change, the constraint was `@le ?A ?s ?a ?b  =?=  @le nat nat.has_add x y`, and we already perform a case-split in this case.
Moreover, projections were eagerly reduced whenever possible.
The extra case-split generates a performance problem in several tests. For example `fib 8 = 34` was timing out.
I worked around this issue by performing the case-split only when the constraint contains meta-variables.
There are also minor issues. Example. `<` is notation for `has_lt.lt`, but `>` is for `gt`.
2017-05-01 08:52:19 -07:00
Gabriel Ebner
8554b8eac1 fix(frontends/lean/pp): insert line breaks in notations 2017-05-01 13:13:07 +02:00
Gabriel Ebner
ca2eab3a2f fix(frontends/lean/structure_cmd): instantiate universe levels in projections to parents 2017-04-29 15:00:17 +02:00
Johannes Hölzl
9535a14e94 fix(frontent/lean/elaborator): check if field is found in structure update
Fixes #1549
2017-04-28 17:42:07 +02:00
Sebastian Ullrich
0ca6e2c96f refactor(library/{type_context,compiler/preprocess},frontends/lean/elaborator): use opaque, general type class instead of special app elaboration for eval_expr 2017-04-27 16:04:59 -07:00
Gabriel Ebner
271d8ca47a fix(frontends/lean/definition_cmds): make sure auxiliary definitions introduced by abstract do not clash 2017-04-27 16:04:18 -07:00
Gabriel Ebner
5324f8c3d3 fix(frontends/lean/definition_cmds): use real name as prefix for abstracted proofs 2017-04-27 16:04:18 -07:00
Gabriel Ebner
a7d58008ac fix(frontends/lean/parser): show exception message in import errors 2017-04-27 16:04:18 -07:00
Leonardo de Moura
d3eca9fa35 feat(library/type_context): improve unifier support for projections
We need this improvement to be able to finish Section "Other goodies" described at
https://github.com/leanprover/lean/wiki/Refactoring-structures

Before this commit, Lean would not be able to solve constraints such as

```lean
@has_add.add nat nat.has_add a b =?= @had_add.add ?A ?inst a b
```

The problem is that projections were being reduced eagerly, and the
constraint would be reduced to

```lean
nat.add a b =?= @had_add.add ?A ?inst a b
```

The new test proj_uniy.lean contains similar unification problems.
2017-04-27 15:55:09 -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
d968b9a1c8 fix(frontends/lean/structure_cmd): remove evil Pi overload that accidentally abstracted constants in structure decls 2017-04-26 14:22:36 -07:00
Leonardo de Moura
cabb4350d9 feat(library): instances are not reducible by default anymore
Motivation: see "Other goodies" section at
https://github.com/leanprover/lean/wiki/Refactoring-structures

We had to add a new transparency mode: Instances at type_context.
In this mode, instances and reducible definitions are considered
transparent.

The new mode is used in the defeq_canonizer, code generator,
and sizeof lemma generation at inductive_compiler.

We also use the new mode in the unfold tactics.
2017-04-26 14:10:11 -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
Jared Roesch
4704b68035 chore(*): remove smt2 bindings from standard libary 2017-04-23 11:32:11 -07: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
a54514fead feat(frontends/lean/print_cmd): complete identifiers after #print 2017-04-23 11:26:31 -07:00
Sebastian Ullrich
5b17c3cbd9 fix(frontends/lean/interactive): fall back to elaborator info when not an interactive tactic
Fixes #1530
2017-04-23 11:26:31 -07:00