Commit graph

333 commits

Author SHA1 Message Date
Leonardo de Moura
0ad5497462 refactor(library/io): make io easier to extend and use 2018-01-23 15:03:31 -08:00
matt rice
1538615e8c feat(util): allow some math alphanum symbol latin letter variations
Add the Script, Double-struck, and Fractur blocks from,
https://unicode.org/charts/PDF/U1D400.pdf
to is_letter_like() so they may be bound to variables.
2018-01-23 11:20:05 -08:00
Sebastian Ullrich
19f8bfd9eb chore(doc/make): add platform-generic build instructions 2018-01-23 11:14:18 -08:00
Leonardo de Moura
368f17d0b1 feat(library/tactic/simplify): add simp! 2018-01-16 17:29:24 -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
Sebastian Ullrich
1d1e997809 chore(doc/changes): document new leanpkg features 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
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
4bd314f7bd feat(library/tactic/simplify): simp reduces c_1 ... = c_2 ... to false 2018-01-12 11:30:45 -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
5cd0f25c1e doc(doc/changes): describe new "smart unfolding" feature 2018-01-09 16:47:32 -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
7db5d79c76 chore(doc/faq): typo 2018-01-03 15:43:48 -08:00
Leonardo de Moura
6079189162 doc(faq): add FAQ 2018-01-03 15:39:02 -08:00
Leonardo de Moura
91ff183b3e chore(library): remove out notation for out_param 2017-12-15 15:47:58 -08:00
Leonardo de Moura
f0352d31a1 feat(library/type_context, library): inout ==> out modifier in type class declarations
@kha: I decided to implement this change before I start the
type_context modifications. The change did not affect the corelib and
test suite much. The only annoying problem is that `out` cannot be
used to name locals anymore.
2017-12-15 14:46:47 -08:00
Leonardo de Moura
746134d11c feat(library/init/meta/interactive): add goal tagging support for by_cases
This commit also incorporates changes suggested at commit 84a1911949dec94.
2017-12-13 15:17:13 -08:00
Leonardo de Moura
6c44dd1b7f feat(frontends/lean): add hide command
cc: @kha
2017-12-13 11:53:21 -08:00
Leonardo de Moura
533ddc0279 fix(library/init/meta/interactive): remove buggy generalizing param from with_cases 2017-12-11 16:27:04 -08:00
Leonardo de Moura
b778d77c0c chore(doc/changes): with_cases and cases changes, - ==> * 2017-12-11 16:27:04 -08:00
Leonardo de Moura
d44996e034 feat(library/init/meta): propagate tag information 2017-12-10 19:15:41 -08:00
Leonardo de Moura
e23db3970a feat(library/init/meta/tactic): apply tactic return parameter name associated with new metavars 2017-12-10 12:11:58 -08:00
Leonardo de Moura
49e7a642c3 feat(library/init/meta/interactive): merge ginduction and induction
This commit is based on 638b34b16de6443.
The changes were applied manually to make sure all changes are
compatible with our plans to `induction`.
2017-12-07 19:10:10 -08:00
Leonardo de Moura
84db9e9e43 feat(library/init/meta/interactive): add constructor_matching tactic 2017-12-06 13:17:06 -08:00
Leonardo de Moura
c89e2457bb feat(library/init/meta/interactive): add cases_type tactic
see doc/changes.md
2017-12-06 12:55:10 -08:00
Leonardo de Moura
1b34160396 feat(library/tactic/tactic_state): display number of goals 2017-12-06 11:20:09 -08:00
Leonardo de Moura
e00c0de12e chore(library/data/rbtree, changes.md): cleanup 2017-12-06 09:55:06 -08:00
Leonardo de Moura
a056e87350 fix(library/init/meta/injection_tactic): add support for ginductive datatypes 2017-12-06 09:39:20 -08:00
Leonardo de Moura
03eda2ecc0 feat(library/init/meta/interactive): add cases_matching p tactic 2017-12-05 18:17:44 -08:00
Leonardo de Moura
b06549bc05 feat(library/init/meta): add guard_names { t } tactical 2017-12-05 16:29:46 -08:00
Leonardo de Moura
bc89ebc19c feat(kernel/inductive): improve how induction hypotheses are named
See doc/changes.md
2017-12-05 15:58:09 -08:00
Leonardo de Moura
a2f55e5d7b feat(library/tactic/induction_tactic): new name generator for induction and cases tactics 2017-12-05 14:57:36 -08:00
Leonardo de Moura
458958b9fc feat(kernel/inductive): use ih to name induction hypothesis (instead of ih_1) when there is only one 2017-12-05 13:50:24 -08:00
Leonardo de Moura
0c5ecf6441 feat(library/init/meta/interactive): add iterate n { t } 2017-12-05 12:52:18 -08:00
Leonardo de Moura
b5358b1b3e chore(library/init/meta/interactive): add comment to avoid confusion 2017-12-05 12:07:17 -08:00
Leonardo de Moura
c943576e5a feat(library/init): add funext tactic 2017-12-04 14:54:39 -08:00
Leonardo de Moura
53c9737c70 feat(library/init): new repeat tactic 2017-12-04 12:55:53 -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
d9322b16ca feat(library): add has_equiv type class 2017-12-03 15:03:58 -08:00
Sebastian Ullrich
30cfc6cf0b feat(frontends/lean/{parser,elaborator}): structure instance patterns 2017-11-22 12:16:28 -08:00
Sebastian Ullrich
0aacccd8c9 feat(frontends/lean): change structure update notation
`{s with ...}` is now `{..., ..s}`, which more clearly expresses that the
result type is not necessarily equal to the type of `s` (in absence of an
expected type and a structure name, we still default to the type of `s`).

Multiple fallback sources can be given: `{..., ..s, ..t}` will fall back to
searching a field in `s`, then in `t`. The last component can also be `..`,
which will replace any missing fields with a placeholder.

The old notation will be removed in the future.
2017-11-17 16:40:47 -08:00
Sebastian Ullrich
e7e05a3ad0 feat(frontends/lean): add aliasing patterns id@pat 2017-11-17 16:35:21 -08:00
Leonardo de Moura
062ebf4344 fix(library/tactic/apply_tactic): when using elimator-like definitions
We found this problem when developing the red-black tree module.
2017-11-16 11:21:17 -08:00
Leonardo de Moura
b40f3af801 feat(library/init/meta): move rb_tree and rb_map to native namespace
cc @kha
2017-11-07 13:41:45 -08:00
Leonardo de Moura
e96026651b feat(library/init): add d_array type
@kha I added the `d_array` type that we discussed today.
However, the VM implemantion is still using persistent arrays.
If we remove the persistent array support, then code using
hash_map will only be efficient if the hash_map is used linearly.
This is not the case in the reader module because we are planning
to support backtracking.

On the other hand, it is awkward we currently don't have a vanilla
array implementation in the VM. I suspect this will be a problem in
the future.

So, I see the following possibilities:

1- We implement a map data-structure using red-black trees in Lean.
We use this new data-structure to implement all maps in the new reader and
macro expander.

2- We implement a very simple map as a list of pairs.
Then, we replace it in the VM with an efficient implementation.
The VM implementation may use our internal red-black trees.
We may also use a persistent hash table implemented in C++,
but it would be awkward to ask the user to provide a hash function in the reference
implementation (i.e., the one using list of pairs), but not use it
anywhere :)
In contrast, if we use the red-black tree implementation we
would have to ask the user to provide a total order.
It is overkill for the list of pair reference implementation because
we just need an equality test, but, at least, the comparison function
will be used in the implementation.

3- Add types `d_parray` (dependent persistent array) and
`parray` (persistent array). In Lean, they would just wrap the
`d_array` and `array` types. In the VM, `d_array` and `array` would
be implemented using vanilla arrays and `d_parray` and `parray` would
be implemented using persistent arrays. Then, we could have
`d_hash_map`, `hash_map`, `d_phash_map` and `phash_map`. Argh, so many
versions :(
We would use `phash_map` to implement our reader and macro expander.

4- Add a `(persistent : bool := ff)` parameter to `d_array` and
`array` types. The disadvantage of this approach is that it has
a performance impact. The VM implementation would have to check
the `persisent` flag at runtime. The value of this flag is known
at compilation time, but we currently don't have a mechanism
for specializing native builtin C++ implementations for VM functions.
2017-11-06 14:56:11 -08:00
Leonardo de Moura
403059acac doc(doc/changes): document change in the code generator 2017-11-01 14:41:36 -07:00
Leonardo de Moura
d2497d554f feat(frontends/lean): add support for unicode char literals and escape sequences
TODO: we are not checking if the unicode escape values provide by the
user correspond to valud unicode scalar values. We should check how
other languanges handle this case.
2017-10-23 13:46:57 -07:00