Commit graph

115 commits

Author SHA1 Message Date
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
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
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
Leonardo de Moura
cdafd4b791 chore(library): cleanup proofs 2017-04-25 17:23:42 -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
Mario Carneiro
5e8572b407 add set.Union and set.univ 2017-04-23 11:37:27 -07:00
Leonardo de Moura
f6556ecdcc fix(library/init): missing has_sizeof instances for subtype, char and string 2017-04-15 23:31:14 -07:00
Leonardo de Moura
e40dbffba9 chore(library): add auxiliary lemmas for hoare state monad experiment 2017-04-12 18:01:59 -07:00
Johannes Hölzl
c4c2d703f6 feat(library/init/data): simplify int.transfer; add int and nat to zero_ne_one_class 2017-03-28 18:44:56 -07:00
Leonardo de Moura
cb049f42b7 fix(frontends/lean/elaborator): resolve_local_name 2017-03-28 17:57:13 -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
Sebastian Ullrich
9e8ef54402 refactor(init/data/list/instances): simplify proofs 2017-03-27 13:42:08 -07:00
Sebastian Ullrich
dfd84666e2 feat(library): add functor, applicative, and monad laws, and prove them correct for non-meta instances 2017-03-27 13:42:08 -07:00
Sebastian Ullrich
3ead6be9ca feat(init): add default value proofs to the monadic hierarchy 2017-03-27 13:42:08 -07:00
Leonardo de Moura
900c56be05 feat(frontends/lean,library/equations_compiler): abstract proofs in equations and regular definitions 2017-03-25 14:22:52 -07:00
Leonardo de Moura
8feacb27a6 feat(library/data): add buffer 2017-03-21 18:47:50 -07:00
Gabriel Ebner
886c824e33 feat(library/init/data/list/instances): prove decidability of bounded quantification 2017-03-17 18:03:26 -07:00
Leonardo de Moura
36770119b6 feat(library): do not generate C.destruct (for structures), and C.induction_on (for structures and inductive datatypes) 2017-03-15 14:45:13 -07:00
Leonardo de Moura
e0e3f51c44 feat(library/init): add unification hint for add/succ 2017-03-12 13:45:30 -07:00
Simon Hudon
b6889e91fe feat(lib/init/data/nat): add function pow and a Galois connection between div and mul 2017-03-12 09:38:19 -07:00
Sebastian Ullrich
763097dbd2 refactor(library): revise the monadic hierarchy 2017-03-09 20:30:03 -08:00
Jeremy Avigad
95f75bbbee refactor(library/init/data/subtype/basic): rename subtype constructor and projections 2017-03-08 19:31:27 -08:00
Leonardo de Moura
7ac6b14d2a chore(library/init/data/int/basic): use abstract when transfering in an instance declaration
@johoelzl I'm using `abstract` tactic because instances are
automatically marked as [reducible], and they will be unfolded when
solving unification constraints. This cannot be avoided since we need to
solve unification constraints such as

      int.has_add =?= comm_ring.to_has_add int.comm_ring

The `abstract tac` tactic creates an auxiliary lemma to store the proof
generated by `tac`. If we use `print int.comm_ring` we can see that
the definition is much smaller. The proofs are irrelevant. So, this has
no drawbacks, and gives us a good performance boost.
2017-03-07 19:57:43 -08:00
Johannes Hölzl
1f45995c16 feat(library/init/meta/transfer): add transfer and use for int
This commit introduces the transfer method. As application it is
used it to prove that the integers form a commutative ring.
2017-03-07 19:30:51 -08:00
Johannes Hölzl
9e9b289031 feat(library/init/data/prod): add prod.map 2017-03-07 19:30:51 -08:00
Johannes Hölzl
b593d090f2 feat(library/init/data/list): add remove_all 2017-03-07 19:30:51 -08:00
Johannes Hölzl
1c30a593c1 feat(library/init/data/list): add enum 2017-03-07 19:30:51 -08:00
Johannes Hölzl
16aaa9b88e feat(library/init/data/list): add unzip 2017-03-07 19:30:51 -08:00
Johannes Hölzl
4c88e2c5b0 feat(library/init/data/int): use relators for proof of int is a ring 2017-03-07 19:30:51 -08:00
Leonardo de Moura
0c6108ce7a chore(library/init/data/quot): use Sort instead of Type
Remark: The kernel was already using Sort. So, the limitation was
artificial. Moreover, it may seem unnecessary to have quotients of
proofs in a proof irrelevant system, but this is useful for proving
a more general funext lemma. This more general version is needed in
the new tested contributed by @digama0.
2017-03-07 14:29:57 -08:00
Leonardo de Moura
9a263a2766 chore(library/init): instances are reducible and are inlined by the compiler
So, these instances would create two copies of `p` after inlining
2017-03-07 10:58:09 -08:00
Leonardo de Moura
7cae7a5b02 feat(library/init/data/fin/ops): add def lemmas 2017-03-05 16:57:36 -08:00
Leonardo de Moura
0049a42336 feat(library/init/data/fin): add div 2017-03-05 16:43:15 -08:00
Leonardo de Moura
1cdf13821c feat(library/init/data/unsigned): add basic unsigned operations 2017-03-05 16:14:16 -08:00
Leonardo de Moura
6134a4a70e feat(library/init): basic operations for (fin n) 2017-03-05 16:00:02 -08:00
Leonardo de Moura
76f989d51c chore(library/init/data/bool/lemmas): add (coe tt) and (coe ff) simp lemmas 2017-03-05 09:50:01 -08:00
Simon Hudon
b34eac6f1d feat(library/init/data/nat): add theorem decomposing numbers into quotient and remainder 2017-03-05 08:29:34 -08:00
Leonardo de Moura
471c3644a3 chore(library/init/data/option/basic): add lift for option_t 2017-03-05 08:17:55 -08:00
Leonardo de Moura
aeb370ac6b feat(library/init/data/bool/lemmas): add more simp lemmas for bool 2017-03-04 17:01:52 -08:00
Leonardo de Moura
c812e12651 chore(library/init/data/list/lemmas): remove old comment 2017-03-04 16:31:31 -08:00
Leonardo de Moura
05962604f1 feat(library/init/data/bool): add basic simp lemmas for bool 2017-03-04 16:31:16 -08:00
Leonardo de Moura
d8371a4b0d feat(library/data/hash_map): avoid read' and write' operations that require an extra test 2017-03-01 22:06:48 -08:00
Leonardo de Moura
04991692bf feat(library/init/data/nat/lemmas): aux lemmas 2017-03-01 20:28:27 -08:00
Leonardo de Moura
52221cdbd1 fix(frontends/lean/elaborator): {} elaboration issue 2017-02-24 21:20:39 -08:00
Leonardo de Moura
b9204cefbc feat(library/init/data/array): add helper functions and instances 2017-02-21 13:45:03 -08:00
Daniel Selsam
5f630e5866 fix(library/init/data/option/basic.lean): remove unused type parameter in instance 2017-02-21 11:00:40 -08:00
Leonardo de Moura
d1d5428808 feat(library): add check_constants.lean validation, cleanup unused names, minor stdlib fixes 2017-02-21 10:45:31 -08:00