Leonardo de Moura
6ab792733d
feat(library/type_context): smart unfolding
...
closes #1794
2018-01-09 15:09:08 -08:00
Leonardo de Moura
75aa94b34c
refactor(library): rename repeat ==> iterate
...
Reason: we will implement a new `repeat` tactic.
2017-12-04 12:34:59 -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
Leonardo de Moura
52d6adc19c
chore(library): use new structure update notation in the core lib
2017-11-17 16:57:54 -08:00
Leonardo de Moura
394e0d5f0a
refactor(library/init): remove has_cmp and is_ordering type classes
...
Now, `cmp` is just a fixed helper function.
In the future, we will be able to use (more efficient) specialized
versions during code generation by defining simp rules.
2017-11-14 08:33:24 -08:00
Leonardo de Moura
31461b6fc7
feat(library/init): add ordering unbundled type classes, add has_strict_weak_ordering for cmp
...
This commit also shows that nat.cmp is an instance of has_strict_weak_ordering.
2017-11-10 16:45:54 -08:00
Leonardo de Moura
97d875eb9a
perf(library/vm): add native int.cmp and nat.cmp
2017-11-09 14:18:28 -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
Gabriel Ebner
b1954f949b
chore(init/data/int): remove unused lemmas
2017-08-02 14:41:35 +01:00
Gabriel Ebner
ce509e621a
refactor(library/init/algebra): remove order_pair classes
2017-08-02 14:41:35 +01:00
Mario Carneiro
1b28b9f5bd
chore(init/data/int/basic): define nat_abs using equation compiler
2017-07-28 16:47:53 +01:00
Mario Carneiro
cc81118892
refactor(init/data): move out some nat lemmas
2017-07-26 11:52:10 +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
c8d6b40991
refactor(frontends/lean/builtin_exprs,library): suppose ~> assume :
2017-07-05 11:20:10 -07:00
Sebastian Ullrich
f024ccd75d
refactor(frontends/lean/token_table,library): take ~> assume
2017-07-05 11:20:10 -07:00
Leonardo de Moura
df091f5c34
feat(library/init/meta/interactive): simp and unfold can unfold projection applications
...
@Armael: we finally can write `simp [proj]` to unfold the `proj`
projection application.
Remark: we still need to add similar support for `dsimp`.
2017-07-02 16:28:04 -07:00
Leonardo de Moura
70b27fb2d3
feat(library/init/meta/interactive): unfold is now based on the simp framework
...
See issue #1694 .
There is an orthogonal issue. `simp` (and consequently `unfold`) cannot be used to
reduce projections (e.g., `has_add.add`). This issue has been
previously raised by @Armael, but it was not addressed yet.
2017-07-02 11:30:48 -07:00
Leonardo de Moura
01003b79cc
fix(library/init/meta/interactive): simp [...] at *
...
closes #1675
After this commit, the following example works as expected.
```
example (p : nat → Prop) (a b : nat) : a = 0 ∧ b = 0 → p (a + b) → p 0 :=
begin
intros h₁ h₂,
simp [h₁] at *,
/- produces the state
(p : nat → Prop) (a b : nat)
h₁ : true
h₂ : p 0
|- p 0
-/
assumption
end
```
as expected.
Remark: the original issue raised by issue #1675 is actually solved by the
`simp_all` tactic.
2017-07-01 20:50:46 -07:00
Leonardo de Moura
b1bdc4690f
feat(library/init/meta/simp_tactic): cleanup dunfold
...
Here are modifications:
- It fails if no definition is unfolded.
See comment https://github.com/leanprover/lean/issues/1694#issuecomment-310956315
at issue #1694
- Users can provide configuration parameters.
- `dunfold_occs` was deleted.
2017-06-30 20:49:20 -07:00
Leonardo de Moura
52d4189805
feat(library/tactic): add dsimp_config configuration object for the dsimp tactic family
...
Now, `dsimp` fails if the goal did not change.
We can use the config object to obtain the previous behavior:
```
dsimp {fail_if_unchaged := ff}
```
See comment https://github.com/leanprover/lean/issues/1694#issuecomment-310956315
at issue #1694
2017-06-30 17:15: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
9f4f93e931
feat(init/data/int): prove int bitwise ops
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
d1d5428808
feat(library): add check_constants.lean validation, cleanup unused names, minor stdlib fixes
2017-02-21 10:45:31 -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
3061d8b9a3
feat(library): add mk_int_val_ne_proof
2016-12-24 15:22:31 -08:00
Leonardo de Moura
58ca9a3059
feat(library/init/data/int/comp_lemmas): add auxiliary lemmas for comparing int numerals
2016-12-24 13:52:48 -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
Leonardo de Moura
bcf15b0d39
feat(library/init/data/int): import int by default
2016-12-15 16:59:36 -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