Commit graph

3093 commits

Author SHA1 Message Date
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
Gabriel Ebner
c2068dae46 fix(frontends/lean/tactic_notation): show error for unsolved focused goals at the end
Fixes #1531.
2017-04-23 11:23:08 -07:00
Leonardo de Moura
0d97700c60 feat(library/compiler): add support for and.rec in the code generator 2017-04-16 13:31:37 -07:00
Sebastian Ullrich
26ac6d31f2 fix(library/metavar_util): do not compress mvar assignments in tmp mode 2017-04-16 09:35:49 -07:00
Leonardo de Moura
210b7c8fb7 fix(library/tactic): fixes #1513
Implement rename tactic in Lean using revert/intro
2017-04-15 11:34:24 -07:00
Sebastian Ullrich
70a2c402ac feat(init/meta/interactive): Isabelle-like case tactic 2017-04-11 17:07:28 -07:00
Sebastian Ullrich
026c5ee509 fix(library/init/meta/expr,library/vm/vm_expr): fix macro args 2017-04-11 17:07:28 -07:00
Gabriel Ebner
cefc26d9cb refactor(library/system/process): add exit status and working directory 2017-04-11 16:42:17 -07:00
Gabriel Ebner
e2fa363423 feat(library/system/io,shell/lean): add --run switch 2017-04-11 16:41:30 -07:00
Gabriel Ebner
01a7efc007 fix(library/module_mgr): do not crash on missing imports
Fixes #1506.
2017-04-04 19:56:33 +02:00
Gabriel Ebner
c06bef0505 fix(library/aux_definition): also zeta expand the local context
@leodemoura The forced zeta-expansion in mk_aux_definition might
cause problems if we use tactic.abstract without zeta-reduction.
However, we never use the non-zeta mode, and it already fails right now
if you accidentally use zeta-expansion in the proof we want to abstract.
2017-04-04 09:04:37 +02:00
Leonardo de Moura
b42ae2cf54 fix(library/type_context): fixes #1500 2017-03-31 19:19:44 -07:00
Sebastian Ullrich
3f98eb84c5 fix(library/print): consider constant roots in is_used_name 2017-03-31 09:40:49 -07:00
Sebastian Ullrich
3f87755a2a fix(frontends/lean/pp): qualify constant shadowed by local 2017-03-31 09:40:49 -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
Sebastian Ullrich
93fdfdc4b6 feat(frontends/lean/elaborator): better error message on field notation that was probably supposed to be a single ident 2017-03-31 09:40:49 -07:00