Commit graph

3298 commits

Author SHA1 Message Date
Leonardo de Moura
c132f555a9 fix(library/init/data/list/instances): decidable_bex
The previous `decidable_bex` was using a nasty hack.
First, it was relying on a bug in the local_context object that was
fixed at commit 6060b75e6. Note that, the type class resolution
will be even more restrictive after we implement the fix described at a75b0d8ee.
Second, it was built using tactics that are meant for constructing
proof irrelevant code (e.g., `simp`).
2018-02-01 18:30:52 -08:00
Mario Carneiro
316d67c3be fix(library/init/data/setoid): fix redundant parameter
`setoid.refl` has two instances of `setoid A` in it
2018-01-28 15:49:35 -08:00
Leonardo de Moura
9331945e8b fix(library/init/meta/interactive): alternative fix for issue at #1913
We also document the problem to make sure we don't spend time again
trying to understand the workaround. This is an instance of a bigger
problem that should be addressed later.
2018-01-28 09:07:11 -08:00
Leonardo de Moura
1c61129d40 feat(library/init/meta/tactic): expose approx at unify and is_def_eq tactics 2018-01-25 22:27:18 -08:00
Leonardo de Moura
d4e1a4a50a chore(library/system/io): tactic.run_io ==> tactic.unsafe_run_io 2018-01-24 10:32:32 -08:00
Leonardo de Moura
0ad5497462 refactor(library/io): make io easier to extend and use 2018-01-23 15:03:31 -08:00
Sebastian Ullrich
3a1ede2d73 refactor(leanpkg/config_vars): replace with core lib 2018-01-23 11:14:18 -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
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
ff346f875b feat(init/data/string/ops): add string.split 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
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
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
6ab792733d feat(library/type_context): smart unfolding
closes #1794
2018-01-09 15:09:08 -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
43d7bac49b feat(library/init/meta): add support for new unify at rw tactic 2018-01-04 13:05:55 -08:00
Leonardo de Moura
040722c7e7 feat(library/init/meta): add unify config option to apply_cfg
This commit also fixes a problem in the `apply` tactic error messages.
2018-01-04 12:51:59 -08:00
Sebastian Ullrich
2586f5b6f2 feat(system/io): get_cwd/set_cwd 2017-12-30 19:31:55 +01:00
Mario Carneiro
56c54a478f fix(init/coe): use Sort instead of Type in subtype coe 2017-12-20 14:02:03 -08:00
Leonardo de Moura
ddf014cc7f feat(library/init/version): add lean.githash : string 2017-12-20 14:00:41 -08:00
Leonardo de Moura
e89eece98c feat(library/init): add lean.version : nat × nat × nat
closes #1873
2017-12-15 17:48:26 -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
6eae78da01 chore(library/data/rbtree/insert): provide meaningful names to ins.induction minor premises
We use them with `case` tactic.
2017-12-13 14:44:48 -08:00
Mario Carneiro
17f77367cd chore(library/init/data/fin/ops): revert 107ad36259. 2017-12-12 10:53:12 -08:00
Sean Leather
107ad36259 feat(library/init/data/fin/ops): fin.succ.inj 2017-12-12 04:23:01 -05:00
Leonardo de Moura
cb74ef1670 chore(library/init/meta/interactive): fix docstring 2017-12-11 16:27:04 -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
5217ae735d feat(library/init/meta/interactive): do not make tag longer when constructor/apply create a single subgoal 2017-12-11 16:27:03 -08:00
Leonardo de Moura
f0231f17bc feat(library/init/meta): propagate tags in constructor-like tactics 2017-12-11 16:27:03 -08:00
Leonardo de Moura
ebeb5f713a feat(library/init/meta/interactive): do not make tag longer when induction/cases create a single subgoal 2017-12-11 16:27:03 -08:00
Leonardo de Moura
53961b12cb chore(library/data/rbtree/insert): use new case tactic to cleanup proofs 2017-12-11 16:27:03 -08:00
Leonardo de Moura
8bda71af6f feat(library/init/meta/interactive): new case tactic with support for with_cases and tagging 2017-12-11 16:27:03 -08:00
Leonardo de Moura
bf8fa50481 feat(library/init/data/list/basic): add is_prefix_of and is_suffix_of 2017-12-11 16:27:03 -08:00
Leonardo de Moura
ddfcc2cb0b feat(library/init/data/list/basic): define decidable_eq (list A) instance manually
Motivation: make sure we can use it before we define the tactic `mk_dec_eq_instance`.
2017-12-11 16:27:03 -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
41cfa1bf63 feat(library/init/meta/tactic): induction tactic returns constructor/param names 2017-12-10 09:46:39 -08:00
Leonardo de Moura
8577fe6984 fix(library/init/meta/interactive): induction ... generalizing ... bug 2017-12-10 08:57:25 -08:00