Commit graph

12115 commits

Author SHA1 Message Date
Gabriel Ebner
c8bb77a3df fix(emacs): demote errors 2017-05-01 14:11:38 -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
Gabriel Ebner
fd6407eccb feat(library/data/buffer/parser): parser combinators for char_buffer 2017-05-01 14:11:38 -07:00
Gabriel Ebner
c46ffbde4c feat(library/init/data/char): character class predicates 2017-05-01 14:11:38 -07:00
Gabriel Ebner
867c38e1ea feat(library/data/buffer,library/init/data/array): utility functions on buffers 2017-05-01 14:11:38 -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
949ed3ac5c feat(library/init/category/applicative): add has_seq type classes 2017-05-01 12:57:05 -07:00
Leonardo de Moura
f6b47ea5c7 feat(library/init/category): add has_map type class, delete fmap 2017-05-01 10:13:02 -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
3e2e9ed98a fix(frontends/lean/module_parser): make the #exit command end at the end of the file
Fixes #1553.
2017-05-01 13:22:26 +02:00
Gabriel Ebner
e6a62b8030 fix(util/sexpr/format): incorrect assertion 2017-05-01 13:13:07 +02:00
Gabriel Ebner
8554b8eac1 fix(frontends/lean/pp): insert line breaks in notations 2017-05-01 13:13:07 +02:00
Leonardo de Moura
701b51a882 chore(library/tools/mini_crush/default): increase timeout 2017-04-30 16:27:55 -07:00
Leonardo de Moura
fc9a8ed3be fix(library/init/meta/smt): fail tactic result type 2017-04-30 14:39:51 -07:00
Gabriel Ebner
ca2eab3a2f fix(frontends/lean/structure_cmd): instantiate universe levels in projections to parents 2017-04-29 15:00:17 +02:00
Scott Morrison
832c38d3cb fix(library/vm/vm_environment) use is_structure rather than try to catch an assertion 2017-04-29 12:55:50 +02:00
Scott Morrison
41c648905e fix(library/tactic/smt/ematch.cpp) check if new_states is empty before pushing 2017-04-28 08:50:45 -07: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
Sebastian Ullrich
4479eebaf0 feat(init/meta/{environment,pexpr}): expose some structure APIs 2017-04-27 16:04:41 -07:00
Gabriel Ebner
3352c31029 fix(library/tactic/smt/ematch): fix compiler warning 2017-04-27 16:04:18 -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
8cf98d9974 fix(library/type_context): fix tmp_mode assertion error
Fixes #1543
2017-04-26 14:23:14 -07:00
Sebastian Ullrich
cfbc449769 refactor(frontends/lean/structure_cmd): some more cleanup 2017-04-26 14:22:46 -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
Leonardo de Moura
08e094139d feat(library/init/meta): add by_contradiction and by_cases to tactic.interactive 2017-04-26 12:54:52 -07:00
Leonardo de Moura
bcf34f1b6f fix(library/inductive_compiler/nested): do not crash if we fail to unfold sizeof 2017-04-26 12:54:52 -07:00
Sebastian Ullrich
0d02136a09 fix(frontends/lean/inductive_cmds): do not whnf pre-exprs
Fixes #1507
2017-04-25 17:47:29 -07:00
Sebastian Ullrich
dd1f3e5f8c fix(frontends/lean/structure_cmd): reject internal field names
Fixes #1539
2017-04-25 17:47:08 -07:00
Johannes Hölzl
b27100ec5a fix(library/init/meta/transfer): add check if target contains (universe) meta variables (see #1535) 2017-04-25 17:46:48 -07:00
Leonardo de Moura
cdafd4b791 chore(library): cleanup proofs 2017-04-25 17:23:42 -07:00
Leonardo de Moura
e59fd2927a feat(library): process explicit arguments before implicit
Moreover, we process the implicit arguments using at least the Semireducible
transparency mode. The idea is to make sure to reduce counterintuitive
behavior in rw and simp where the user believes a lemma is applicable
but it does not work because the implicit part fails to unify.

The modification above fixes the simplifier issues found by @kha when proving the
monadic laws.

This commit also improves constraints of the form

          n =?= m

where n and m are big distinct numerals. The type_context fails quickly
for this kind of constraint even using transparency mode Semireducible.
We need this feature otherwise we timeout at

      @eq char a b =?= @eq unsigned ?x ?y

Recall that

       char     := fin char_sz
       unsigned := fin unsigned_sz
2017-04-25 17:16:06 -07:00
Leonardo de Moura
e51ff591f7 chore(library/type_context): disable all trace messages inside type class resolution if trace.class_instances is not set to true 2017-04-25 14:16:10 -07:00
Leonardo de Moura
d0dede53f5 chore(library/tactic): make sure "pattern" is the first argument of is_def_eq 2017-04-25 09:59:04 -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
cdd3f7fd6e fix(util/rb_tree): fix remove(rb_tree) 2017-04-24 19:31:56 +02:00
Sebastian Ullrich
b26d15b9e9 fix(frontends/lean/elaborator): error message 2017-04-24 19:31:15 +02:00
Mario Carneiro
7ef4428124 add new interactive tactics skip, ginduction, exacts 2017-04-23 11:48:33 -07:00
Mario Carneiro
5e8572b407 add set.Union and set.univ 2017-04-23 11:37:27 -07: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