Commit graph

49 commits

Author SHA1 Message Date
Leonardo de Moura
2ea0baeb99 chore(library): use lowercase in imports 2019-03-21 15:06:44 -07:00
Leonardo de Moura
675003318e chore(*): small fixes 2019-03-21 15:06:44 -07:00
Sebastian Ullrich
beda5f5f43 chore(library): capitalize types and namespaces 2019-03-21 15:06:43 -07:00
Sebastian Ullrich
f7aeeaf237 exclude export/extern, translate constants.txt 2019-03-21 15:06:43 -07:00
Sebastian Ullrich
b939162168 chore(library): switch from snake_case to camelCase 2019-03-21 15:06:43 -07:00
Leonardo de Moura
52db59eb87 fix(library/init/data/int/basic): nasty bug at int.repr 2019-02-12 15:58:59 -08:00
Leonardo de Moura
425a4b70d1 feat(library/init/data/int/basic): use extern attribute, and fix div/mod mess
Now, int.div and int.mod behave like C++ `/` and `%` for int,
moreover, they satisfy

          (a/b)*b + (a%b) = a
2019-02-12 11:41:46 -08:00
Leonardo de Moura
835b3a10cc chore(library/init): consistent names 2018-11-14 13:08:57 -08:00
Leonardo de Moura
3ee863da68 feat(library/compiler/erase_irrelevant): eliminate cases_on for builtin types 2018-10-23 14:58:38 -07:00
Leonardo de Moura
71dd8653bc feat(library/init/core): decidable_eq is a proper class
We need this to take advantage of the new indexing structure we are
going to add to improve performance.
2018-09-07 16:38:11 -07:00
Leonardo de Moura
e9b4b811de chore(library/equations_compiler/util): disable generation of equational lemmas
@kha, `eqn_compiler.lemmas` is false by default.
I will keep them disabled until I remove the inductive compiler.
I'm building the new inductive datatype module (to replace the inductive
compiler), and the lemmas will fail to be proved in the next commits
until the transition is complete.
2018-06-12 13:03:25 -07:00
Leonardo de Moura
032a101262 chore(*): remove more files
@kha I'm trying to remove as much as possible before I start
modifying `expr`
2018-05-21 06:42:58 -07:00
Leonardo de Moura
d5fe509c36 chore(*): remove end after each match-expression
`end` is not optional anymore
2018-05-04 11:30:06 -07:00
Leonardo de Moura
1289037e56 chore(library/init): cleanup 2018-04-30 09:25:25 -07:00
Leonardo de Moura
c9e4c89d9c chore(library/init/meta): remove mk_dec_eq_instance
The tactic mk_dec_eq_instance constructs a function using the brec_on
recursor. The compiler generates horrible code for this kind of
definition. It creates a closure for each recursive call.
Moreover, `brec_on` accumulates all intermediate results.

To generate efficient code, we need to generate a collection of
recursive equations, and then invoke the equation compiler.

cc @kha
2018-04-27 16:13:10 -07:00
Leonardo de Moura
7aaac31e35 chore(library/init/data/nat): remove dependency 2018-04-10 15:48:13 -07:00
Leonardo de Moura
b0e49535fa chore(*): remove transfer and coinductive predicates 2018-04-10 13:38:18 -07:00
Leonardo de Moura
c03d351744 chore(library/init/data/int): keep only definitions 2018-04-10 13:29:06 -07:00
Leonardo de Moura
6ab792733d feat(library/type_context): smart unfolding
closes #1794
2018-01-09 15:09:08 -08:00
Leonardo de Moura
7b97e82fb3 chore(library): remove unnecessary repeat applications 2017-12-04 12:16:11 -08:00
Leonardo de Moura
b7322e28c1 feat(library): do not using simp lemmas for sorting arguments of AC operators by default 2017-12-03 15:03:58 -08:00
Sebastian Ullrich
52a9f82bc2 feat(init/meta/derive): implement [derive] attribute 2017-09-05 23:14:34 +02:00
Sebastian Ullrich
f255513fdc fix(frontends/lean/definition_cmds): apply attributes after declaring equational lemmas
Fixes `@[simp] def ...`
2017-09-01 13:36:53 +02:00
Mario Carneiro
1b28b9f5bd chore(init/data/int/basic): define nat_abs using equation compiler 2017-07-28 16:47:53 +01:00
Leonardo de Moura
bb9e3ddae2 feat(library/init/meta/interactive): rw [-h] ==> rw [← h]
@Armael: this change may affect your project.

The file `doc/changes.md` explains the motivation for the change.
2017-07-05 11:42:55 -07:00
Sebastian Ullrich
f024ccd75d refactor(frontends/lean/token_table,library): take ~> assume 2017-07-05 11:20:10 -07:00
Mario Carneiro
9f2980a524 feat(init/data/int): int lemmas, more bitwise theorems 2017-06-27 18:55:52 -07:00
Mario Carneiro
e705d89490 feat(init/data/int): bitwise ops for integers 2017-06-27 18:55:52 -07:00
Sebastian Ullrich
0a48809469 refactor(frontends/lean/tactic_notation): rename note/define tactics to have/let 2017-06-22 08:03:23 -07:00
Mario Carneiro
b775a01fba refactor(init/meta/interactive): merge assert -> note 2017-06-22 08:03:23 -07:00
Gabriel Ebner
82bb37422d fix(library/init/data/int): add to_string instance for integers 2017-06-19 14:30:58 +02:00
Leonardo de Moura
dc1a1c8540 refactor(library): has_to_string ==> has_repr
See issue #1664

This is just the first step to implement proposal described at issue #1664.
2017-06-18 18:29:19 -07:00
Mario Carneiro
d82b8ed59e feat(init/data/int,init/data/nat,init/algebra): more algebra theorems 2017-06-01 15:15:40 -07:00
Mario Carneiro
a0503f964c feat(init/algebra, init/data/int): more ring theorems 2017-05-27 04:14:04 -04:00
Mario Carneiro
07f4055dc0 feat(init/data/int): some more basic int theorems 2017-05-27 04:14:02 -04: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
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
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
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
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
0795acaf6a refactor(library/init/algebra): new transport from multiplicative to additive
The motivation is to avoid the problems produced by the "declare as
structure and then tag as class idiom" described in the file ring.lean.
2017-01-18 19:39:53 -08:00
Leonardo de Moura
db70c78704 feat(library/equations_compiler): make sure automatically generated equational lemmas use internal names 2017-01-06 11:40:34 -08:00
Leonardo de Moura
244e115412 chore(library/init/data): add more "short-circuit" instances for int/nat 2016-12-27 11:51:42 -08:00
Leonardo de Moura
6b416b4618 feat(library/vm): use native representation for int in the VM 2016-12-18 15:04:02 -08:00
Leonardo de Moura
d2ffa6c476 fix(library/init/data/int/basic): bug in instance definition 2016-12-18 14:45:55 -08:00
Leonardo de Moura
1d0d45d890 feat(library/init/data/to_string): mark list.to_string as protected 2016-12-18 13:17:10 -08:00
Sebastian Ullrich
26ead0e7ac feat(library/data/int/basic): has_to_string int 2016-12-18 13:15:41 -08:00
Jeremy Avigad
8b84af4853 feat(library/init/data/int/basic,order): the integers as an ordered ring 2016-12-15 09:56:22 -08:00