Commit graph

112 commits

Author SHA1 Message Date
Leonardo de Moura
1ad1080f11 refactor(library): keep only basic nat theorems
All theorems are proved without using the tactic framework.
Thus, we can define `fin/uint32/uint64` types and their operations
before we define the tactic framework.
2018-04-11 16:47:54 -07:00
Leonardo de Moura
ce0467638e chore(*): remove unification hints 2018-04-10 16:29:04 -07:00
Leonardo de Moura
7aaac31e35 chore(library/init/data/nat): remove dependency 2018-04-10 15:48:13 -07:00
Leonardo de Moura
a023128738 chore(*): reduce corelib 2018-04-10 13:11:40 -07:00
Leonardo de Moura
a2f0bf7c1b chore(*): disable SMT tactic framework and backward chaining 2018-04-10 12:05:51 -07:00
Sebastian Ullrich
8f55ec4c50 fix(init/core): remove out_param from has_pow
With the current elaboration scheme, out_params and coercions do not mix well,
as evidenced by the following example by @digama:

```
variables {α : Type*} [group α]
def gpow : α → ℤ → α := sorry
instance group.has_pow : has_pow α ℤ := ⟨gpow⟩

example (a : α) : a ^ 0 = 1 := sorry -- failed to synth ⊢ has_pow α ℕ
example (a : α) : a ^ (0:ℕ) = 1 := sorry -- ok, coerces
example (a : α) : a ^ (0:ℤ) = 1 := sorry -- ok
```

The issue is that
* we first try to solve `has_pow ?α ?β`, which is postponed
* then infer `?α = nat` from `a`
* then at some point call `elaborator::synthesize()` and default `β` to `nat`
* then try to solve `has_pow nat nat`, which fails at `int =?= nat`
2018-04-04 13:05:59 +02:00
Leonardo de Moura
d387103aa2 fix(library/init/core): closes #1951
- Add has_pow type class
- Make `^` notation right associative
2018-03-29 16:25:47 -07:00
Leonardo de Moura
7762dc381a feat(library/type_context): use context_cache interface 2018-02-21 15:04:20 -08:00
Leonardo de Moura
da032ccc3b feat(library/init/data/nat/lemmas): add lemma for termination proofs 2018-02-21 10:37:07 -08:00
Leonardo de Moura
bddc84664c chore(library/init/data/nat): remove pow.lean 2018-02-20 13:50:23 -08:00
Leonardo de Moura
ddfbaa6c8d fix(library/init/data/nat/basic): missing lemma 2018-02-15 14:36:28 -08:00
Leonardo de Moura
f048da4c98 refactor(library/init/data): replace char.zero_lt_d800 proof
See issue https://github.com/leanprover/tc/issues/8

cc @dselsam
2018-02-15 14:36:28 -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
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
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
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
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
6d96741010 feat(library): provide names for constructor arguments
Motivation: `cases` and `induction` tactics use these names when the
user does not provide them.
2017-12-04 16:25:16 -08:00
Leonardo de Moura
c943576e5a feat(library/init): add funext tactic 2017-12-04 14:54:39 -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
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
49db6793f0 feat(library/init/data/ordering): cleanup ordering module, and add default cmp implementation 2017-11-13 21:55:41 -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
4fbc172099 chore(library/init/data/nat/lemmas): tail recursive version 2017-11-08 16:23:11 -08:00
Mario Carneiro
0f7fdae33e refactor(algebra/ordered_group): remove redundant axioms
for ordered_cancel_comm_monoid. The change to partial_order, with a derived lt relation, makes the lt axioms of ordered groups derivable with no additional assumptions.
2017-10-23 12:20:42 -07:00
Mario Carneiro
5c8409b1a0 chore(init/data/nat/lemmas): pred_le_pred: remove superfluous assumption 2017-09-15 12:33:46 -07:00
Leonardo de Moura
d4f2bb77b8 feat(frontends/lean): recursive equation preprocessor
To make the equation compiler more convenient to use, we will add a
couple of preprocessing steps.
This commit adds the first one of them. In this step, we use
type inference to refine pattern variables, and we relax the
restrictions on inaccessible annotations.

We will also add a preprocessing step that implements the "complete
transition" step before we execute the elim_match step.
2017-08-18 15:06:11 -07:00
Gabriel Ebner
5922f71c50 feat(library/init/algebra/order): add default value for lt 2017-08-02 14:41:35 +01: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
490cc50b51 chore(init/data/nat): mark simp rules 2017-07-28 16:47:53 +01:00
Mario Carneiro
bd19736b21 feat(init/data/nat/bitwise): definitional lemmas for nat.shiftl 2017-07-28 16:47:53 +01:00
Leonardo de Moura
1ec65bed44 refactor(library/init): move bitvector to main repo
@digama0 I moved bitvec back to the main repo, and many nat lemmas.
I want these lemmas here for now. I will need some of them for future
decision procedures.
2017-07-26 13:35:38 +01:00
Mario Carneiro
813fda9ba5 refactor(init/data/{nat,list}): rename for consistency with stdlib 2017-07-26 11:52:10 +01:00
Mario Carneiro
09f9cada65 chore(init/data/nat): rename add_one_eq_succ -> add_one 2017-07-26 11:52:10 +01:00
Mario Carneiro
cc81118892 refactor(init/data): move out some nat lemmas 2017-07-26 11:52:10 +01:00
Sebastian Ullrich
7d39b3e948 refactor(init/meta/interactive): merge generalize and generalize2 and introduce nicer syntax 2017-07-20 01:51:00 -07:00
Mario Carneiro
4ae2f87bc8 refactor(init/meta/tactic): use dite instead of cases in by_cases
This fixes the issue in PR #1752 by using `dite`, which is essentially nondependent cases, so that the decidable instances are not substituted.
2017-07-20 01:28:21 -07:00
Gabriel Ebner
ee56f71260 fix(library/init/data/nat/lemmas): make various lemmas rfl 2017-07-15 10:38:06 +01:00
Leonardo de Moura
b7b331957a chore(library/init/data/nat/bitwise): we now support rw [f] for applying f-eqn_lemmas 2017-07-07 12:03:47 -07:00
Gabriel Ebner
c5b6c52ad1 feat(library/init/data/nat/lemmas): decidable_linear_ordered_cancel_comm_monoid instance 2017-07-07 08:49:12 +02:00
Mario Carneiro
b557d9012d refactor(init/data/nat/gcd): swap args in gcd.induction
to match swapped induction arg of gcd
2017-07-05 12:37:54 -07: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
Leonardo de Moura
e24f3341d4 feat(library/init/meta/interactive): simp without foo ==> simp [-foo]
This commit also adds "exception" validation.
A bad "exception" was being silently ignored.
We can also exclude hypotheses. Example: `simp [*, -h]`
2017-07-03 17:10:46 -07:00
Leonardo de Moura
76799db032 feat(library/init/meta/interactive): simph ==> simp [*]
This modification was suggested by @kha.

TODO:
- Use `simp [-f]` instead of `simp without f`
- Allow users to remove hypothesis from `*`. Example: `simp [*, -h]`
  for simplify using all hypotheses but `h`.
2017-07-03 15:14:47 -07:00
Leonardo de Moura
9a41f0f899 fix(library/init/meta/tactic): by_cases tactic
Before this commit, the `by_cases p` tactic would synthesize
`inst : decidable p` type class resolution, and then use the
`cases` tactic (dependent elimination). This would create
problems since occurrences of `inst` would be replaced with
`decidable.is_true h` in one branch, and `decidable.is_false h` in the
other. Where `h`s (we have two of them, one for each branch) are
fresh hypotheses introduced by the `cases` tactic.
For example, assume we have the term in our goal.

        `@ite p inst A a b`

This term would become

        `@ite p (decidable.is_true h) A a b` (in the first branch where `h : p`)

and
        `@ite p (decidable.is_false h) A a b` (in the second where `h : not p`)

Now, suppose we try to executed the following tactic in the first branch

        `rw [if_pos h]`

it will fail since `if_pos h` is actually `@if_pos p inst h`, and
we will not be able to unify

        `@ite p (decidable.is_true h) A a b =?= @ite p inst ?A ?a ?b`

This commit workarounds this problem by applying cases on
`@decidable.em p inst : p or not p` instead of `inst : decidable p`.
Thus, the term `inst` is not replaced with `decidable.is_true h` and
`decidable.is_false h`.

The new test `tests/lean/run/simp_dif.lean` demonstrates the problem above.
2017-07-02 21:34:10 -07:00
Leonardo de Moura
16711fcdba feat(library/tactic/dsimplify): new configuration options for dsimp
TODO for `dsimp`:
- Add an option for reducing [reducible] definitions
- Add (to_unfold : list name) similar to the one in the `simp` tactic
2017-07-02 18:26:03 -07:00