Commit graph

13353 commits

Author SHA1 Message Date
Leonardo de Moura
eff960d498 feat(library/ac_match): add AC match design notes 2018-01-22 18:04:23 -08:00
Leonardo de Moura
ba5bdf639b feat(library/init/algebra/classes) add is_symm_op type class 2018-01-22 15:43:30 -08:00
Leonardo de Moura
368f17d0b1 feat(library/tactic/simplify): add simp! 2018-01-16 17:29:24 -08:00
Leonardo de Moura
91b9e96582 feat(library/tactic/eqn_lemmas): store flag indicating whether a declaration has only simple equation lemmas or not 2018-01-16 16:55:05 -08:00
Leonardo de Moura
c195d7c2a1 feat(library/tactic/simp_tactic): improve mk_simp_attr
- An new simp attribute may depend on other existing attributes

- Add `[norm]` simp attribute. It is an extension of the default `[simp]` attribute.
  It should be used to add extra rules for normalizing goals.
  These extra rules are used to produce normal forms and/or reduce the
  number of constants used in a goal. Here is an example coming from a
  discussion with @kha. When working with monads, we may want to
  eliminate `<$>` by using the lemma `f <$> x = x >>= pure ∘ f`.
  This lemma is in the `[norm]` simp set, but it is not in `[simp]`
2018-01-16 16:47:30 -08:00
Mario Carneiro
147436bfb8 fix(init/data/nat/lemmas): generalize nat.iterate to (Sort u) 2018-01-16 11:37:33 -08:00
Leonardo de Moura
6635f6c8c1 chore(library/init/coe): document why @[reducible] annotation is needed 2018-01-16 11:31:43 -08:00
Sebastian Ullrich
c64284a377 perf(init/data/string/ops): make string.split linear 2018-01-15 10:51:27 +01:00
Sebastian Ullrich
f3b0cb936f feat(util/lean_path): detect all instances of ambiguous imports 2018-01-15 09:58:19 +01:00
Sebastian Ullrich
1d1e997809 chore(doc/changes): document new leanpkg features 2018-01-15 09:58:19 +01:00
Sebastian Ullrich
837f015a14 chore(leanpkg/README): remove text redundant with the reference 2018-01-15 09:58:19 +01:00
Sebastian Ullrich
18fb3244e7 feat(leanpkg): add help command 2018-01-15 09:58:19 +01:00
Sebastian Ullrich
49e1cf9a79 feat(leanpkg): leanpkg new/init: initialize git repository to correct branch 2018-01-15 09:58:19 +01:00
Sebastian Ullrich
f047a2b73b feat(leanpkg): leanpkg add/install user/repo shorthand 2018-01-15 09:58:19 +01:00
Sebastian Ullrich
ff346f875b feat(init/data/string/ops): add string.split 2018-01-15 09:58:19 +01:00
Sebastian Ullrich
94cb177677 feat(leanpkg): never delete information from _target
Some people seem to be doing development inside it
2018-01-15 09:58:19 +01:00
Sebastian Ullrich
b354feb8b9 fix(leanpkg): mandate path = "src"
Fixes #1880
2018-01-15 09:58:19 +01:00
Leonardo de Moura
cebde17bec feat(library/tactic/simplify): simp reduces c a_1 ... a_n = c b_1 ... b_n into a_1 = b_1 /\ ... /\ a_n = b_n 2018-01-12 18:18:56 -08:00
Leonardo de Moura
9eb22cd548 feat(library/constructions/injective): automatically generate auxiliary lemma *.inj_eq for constructors
We are going to use these lemmas in the simplifier.
2018-01-12 16:41:12 -08:00
Leonardo de Moura
58fce78282 feat(library/init/meta/interactive): add interactive tactic subst_vars 2018-01-12 14:37:11 -08:00
Leonardo de Moura
5bad6d5372 feat(library/init/meta/tactic): subst supports heterogeneous equalities that are actually homogeneous 2018-01-12 14:32:49 -08:00
Leonardo de Moura
1437d7209a feat(library/tactic/simplify): add support for generalized inductive datatypes 2018-01-12 11:51:49 -08:00
Leonardo de Moura
4bd314f7bd feat(library/tactic/simplify): simp reduces c_1 ... = c_2 ... to false 2018-01-12 11:30:45 -08:00
Leonardo de Moura
56920639fa chore(library/init/meta/coinductive_predicates): remove old comment 2018-01-12 10:56:39 -08:00
Leonardo de Moura
c3d4a9456e feat(library/init/meta/interactive): add sorry interactive tactic (alias for admit). 2018-01-11 16:58:46 -08:00
Leonardo de Moura
c5df94ed17 feat(library/tactic): add support for auto params at simp tactic 2018-01-11 16:47:22 -08:00
Leonardo de Moura
5a320e260a refactor(library/tactic): code duplication 2018-01-11 14:12:15 -08:00
Leonardo de Moura
3b0e23e1f0 fix(library/equations_compiler/util): make sure untrusted macros are unfolded when creating auxiliary *._sunfold definitions 2018-01-11 12:45:42 -08:00
Leonardo de Moura
fc760f57d2 chore(library/init/algebra/classes): typos 2018-01-10 15:17:02 -08:00
Leonardo de Moura
26da50ab0e feat(library/vm/vm_string): efficient iterator.extract
@kha I've added

   iterator.extract : iterator -> iterator -> option string

It returns `none` if the iterators are "incompatible".
If this function is inconvenient to use, we can change it and return the
empty string in these cases.

Given iterators `it1` and `it2`, if they are sharing the same string
object in memory, then the cost is O(pos(it2) - pos(it1)).
If not, we have an extra O(N) step where we check whether the strings
being iterated by it1 and it2 are equal (`N` is the size of the strings).
In most applications, I believe the iterators will share the string
object.

I didn't test the code much. BTW, I found an unrelated bug at
vm_string.cpp. So, I'm not very confident this code is rock solid.
2018-01-10 13:27:28 -08:00
Leonardo de Moura
78708b4697 fix(library/vm/vm_string): bug at iterator.set_curr 2018-01-10 13:25:26 -08:00
Leonardo de Moura
8e172afdc1 fix(library/type_context): typo 2018-01-09 16:55:44 -08:00
Leonardo de Moura
5cd0f25c1e doc(doc/changes): describe new "smart unfolding" feature 2018-01-09 16:47:32 -08:00
Leonardo de Moura
60be2bf2aa feat(frontends/lean/builtin_cmds): use type_context to implement #reduce command 2018-01-09 16:42:52 -08:00
Leonardo de Moura
0c5c1a27c6 refactor(frontends/lean, library/equations_compiler): move smart unfolding auxiliary function generation to equations_compiler module 2018-01-09 16:27:36 -08:00
Leonardo de Moura
a55b641651 chore(library/type_context): add mk_smart_unfolding_name_for 2018-01-09 16:19:59 -08:00
Leonardo de Moura
7841314795 feat(library/type_context): add option type_context.smart_unfolding 2018-01-09 16:05:26 -08:00
Leonardo de Moura
a923f3e72d doc(library/type_context): remove refl lemma comment, and document smart unfolding 2018-01-09 15:48:06 -08:00
Leonardo de Moura
c2bd8626d7 fix(library/type_context): put back same_head_symbol heuristic
The timeout at qed_perf_bug test demonstrates why it is useful.
2018-01-09 15:31:33 -08:00
Leonardo de Moura
532fa735c6 chore(library/type_context): remove global 2018-01-09 15:25:30 -08:00
Leonardo de Moura
c60b594839 chore(library/type_context): remove unnecessary #include 2018-01-09 15:18:58 -08:00
Leonardo de Moura
96792cd9aa chore(tests/lean): fix tests 2018-01-09 15:09:32 -08:00
Leonardo de Moura
6ab792733d feat(library/type_context): smart unfolding
closes #1794
2018-01-09 15:09:08 -08:00
Leonardo de Moura
bff40665b0 fix(library/aux_definition): make sure aux_definition level params are sorted
This modification guarantees that the order of universe parameters in a
declaration `f` is identical to the one in `f._meta_aux` (if it exists).
2018-01-09 13:12:23 -08:00
Leonardo de Moura
e0bdb10ab4 fix(library/type_context): clenaup whnf_head_pred
The code had a few leftovers from the old `whnf_pred` method.
We don't use `whnf_pred` anymore.
2018-01-08 11:31:03 -08:00
Leonardo de Moura
600a32d323 chore(library/equations_compiler/pack_mutual): _mutual should be a suffix instead of prefix 2018-01-08 10:43:34 -08:00
Leonardo de Moura
587540f11b feat(frontends/lean): add abbreviation command
This command is not just a cosmetic feature.
We need it to defined `id_rhs` before the tactic framework is defined.
We want `id_rhs` to be used in all definitions generated by the equation
compiler. Right now, it is only used in definitions defined after the
tactic framework.
2018-01-05 15:40:59 -08:00
Leonardo de Moura
d2ae028cbe chore(library/type_context): missing CACHE_CODE 2018-01-05 14:10:28 -08:00
Leonardo de Moura
b7de24715b fix(util/rbtree): make sure traversal methods do not crash if given function updates the tree
This is a fix for a nasty bug at `type_context::set_instance_fingerprint`.
This method traverses the local context `m_lctx` and invokes `is_class`
which may invoke `whnf`, and `whnf` may temporarily update the local
context. The local context is implemented using a `rb_tree`.
Note that the updates performed by `whnf` are temporary, but it
its representation in memory may be different.
2018-01-05 14:10:28 -08:00
Leonardo de Moura
43d7bac49b feat(library/init/meta): add support for new unify at rw tactic 2018-01-04 13:05:55 -08:00