Commit graph

13418 commits

Author SHA1 Message Date
Sebastian Ullrich
6eeb90c8fb chore(frontends/lean/elaborator): remove confusing assign_mvar method 2018-02-02 08:58:53 -08:00
Sebastian Ullrich
040748419f refactor(frontends/lean/elaborator): refactor and document structure instance notation code 2018-02-02 08:58:53 -08:00
Sebastian Ullrich
6ab13a433d chore(library/type_context): should not have an implicit constructor, copy constructor, or assignment operator 2018-02-02 08:58:53 -08:00
Sebastian Ullrich
dc5e50e7f0 feat(frontends/lean/structure_cmd): hide out_param in projections 2018-02-02 08:58:52 -08:00
Sebastian Ullrich
3f497b8d8e fix(library/constructions/projection): out_params should always be implicit in projections 2018-02-02 08:58:52 -08:00
Sebastian Ullrich
33936cc4ad feat(frontends/lean/decl_cmds): save ident infos after attribute cmd 2018-02-02 08:58:52 -08:00
Sebastian Ullrich
be61ab4213 chore(frontends/lean/pp): document binding power intricacies 2018-02-02 08:58:52 -08:00
Sebastian Ullrich
e427068081 fix(frontends/lean/pp): missing parentheses around notation 2018-02-02 08:58:52 -08:00
Sebastian Ullrich
9f60fd5492 feat(frontends/lean/elaborator): ignore more sorry-containing type mismatch messages 2018-02-02 08:58:52 -08:00
Sebastian Ullrich
2f2540dc3b fix(frontends/lean/definition_cmds): hide kernel exceptions triggered by error recovery
They are never helpful compared to the original error
2018-02-02 08:58:52 -08:00
Sebastian Ullrich
0fe561d063 feat(init/function): comp_app simp lemma 2018-02-02 08:58:52 -08:00
Sebastian Ullrich
c600bca747 feat(frontends/lean/definition_cmds): hide scary kernel exception on duplicate declaration 2018-02-02 08:58:52 -08:00
Sebastian Ullrich
a4db338053 fix(init/category/functor): make $> actually usable
The abstraction in the previous definition prevented successful elaboration
2018-02-02 08:58:52 -08:00
Sebastian Ullrich
009cff6f79 feat(frontends/lean/elaborator): prefer taking subobjects from structure notation sources as a whole
This guarantees definitional equality on the field as witnessed by the test
2018-02-02 08:58:52 -08:00
Leonardo de Moura
b063edb6c7 chore(frontends/lean/elaborator): remove dead code 2018-02-02 08:49:10 -08:00
Leonardo de Moura
884e5a6d2c chore(library/compiler): remove obsolete optimization step
This optimization became obsolete after commit cd8c154bcd
2018-02-02 08:39:39 -08:00
Leonardo de Moura
dbeafaaeed chore(library/compiler/util): remove dead code 2018-02-02 08:34:14 -08:00
Leonardo de Moura
a6a1f7d874 chore(library/type_context): remove dead code from type_context 2018-02-02 08:30:01 -08:00
Leonardo de Moura
ffc04fd7df fix(library/tactic/smt): add temporary hack to workaround revert-all issue 2018-02-01 19:25:16 -08:00
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
Leonardo de Moura
8c9cee3efc doc(tmp/fresh_name): document impact of new mk_fresh_name design on thread local caches 2018-02-01 18:06:19 -08:00
Leonardo de Moura
a75b0d8eeb doc(library/local_context): document bug in the m_instance_fingerprint management 2018-02-01 18:03:46 -08:00
Leonardo de Moura
6060b75e62 fix(library/local_context): propagate m_instance_fingerprint 2018-02-01 17:46:31 -08:00
Leonardo de Moura
50a43da17c doc(tmp/fresh_name): plan for fixing mk_fresh_name
@kha If you have time, could you please take a look and send feedback.
I may be forgetting other problems and issues related with `mk_fresh_name`.
2018-02-01 16:19:25 -08:00
Leonardo de Moura
ec1a490a15 chore(*): annotate candidates for thread local cache reset 2018-02-01 14:59:37 -08:00
Leonardo de Moura
73b97084f7 chore(library/tactic): ac_manager ==> ac_manager_old
We will build the new one in `library/`
2018-02-01 12:39:43 -08:00
Leonardo de Moura
77767d5cb0 doc(library/tactic/ac_tactics): document another problem with ac_tactics module 2018-02-01 12:20:41 -08:00
Gabriel Ebner
6da6c143e6 fix(CMakeLists): emscripten build 2018-02-01 15:12:43 +01:00
Sebastian Ullrich
7644de75d8 chore(doc/make/msys2): link generic build instructions 2018-02-01 10:46:12 +01:00
Sean Leather
ddfd52b863 fix(doc/make/index.md): link typo 2018-02-01 09:53:26 +01:00
Leonardo de Moura
e6a98ffe9c feat(library/type_context): improve unifier first-order approximation
@kha We can now solve unification constraints of the form

         ?m unit =?= itactic

I'm not very confident this new extension will improve usuability
instead of creating new counter-intuitive behavior.
At least, in the process of implementing it, I fixed two bugs,
and removed a nasty hack that was being used in the unifier.
Thus, even if we disable this feature in the future, some good came out
of it.

Although, the new extension locally increases the number of constraints
that can be solved, it may prevent terms that could be elaborated before
from being elaborated. I am not too concerned at this point because
I could not construct a natural example. I encountered one case, but it
was due to a problem that I fixed in the previous commit.
I reconstruct it here for the record. Suppose we have a constraint

         ?m_1 ?m_2 =?= itactic

Without the fix from the previous commit, `itactic` would unfold too
`id_rhs Type (tactic unit)`, and the constrain would be solved as

         ?m_1 := (id_rhs Type)
         ?m_2 := (tactic unit)

It succeeds locally, but the elaboration fails later when it tries to
synthesize the type class `has_bind (id_rhs Type)`.
The previous fixes the problem by making sure `itactic` is unfolded to
`tactic unit` as expected. `id_rhs` is an auxiliary definition
used to implement smart unfolding. That being said, the user could in
principle define `itactic` as `@id Type (tactic unit)`, and the constraint

         ?m_1 ?m_2 =?= itactic

will be solved as

         ?m_1 := (@id Type)
         ?m_2 := (tactic unit)

which is not the solution we want.
2018-01-30 15:42:17 -08:00
Leonardo de Moura
8c1665aca0 fix(library/type_context): unfold_definition should remove auxiliary id_rhs marker even when smart unfolding is not used 2018-01-30 15:31:04 -08:00
Leonardo de Moura
815327fc93 fix(library/equations_compiler): bug at pull_nested_rec
closes #1917
2018-01-30 13:49:47 -08:00
Leonardo de Moura
105c838692 chore(library/type_context): remove hack from unifier
This commit removes a hack that forced first-order unification
to be used to solve unification constraints of the form

             ?m a =?= f ?x

during elaboration. The hack force first-order unification
even when `?m a` is a higher order pattern and a precise solution
exists.
Moreover, the example that motivated that hack is not applicable
anymore since the type class `has_mem` is now defined as:
```
class has_mem (α : out_param $ Type u) (γ : Type v) := (mem : α → γ → Prop)
```
instead of
```
class has_mem (α : Type u) (γ : Type u → Type v) := (mem : α → γ α → Prop)
```

cc @kha
2018-01-30 12:48:48 -08:00
Leonardo de Moura
3fa487c153 fix(frontends/lean/decl_util): as-is annotation was leaking into elaborated terms
@kha This commit fixes the repro you sent me. Could you please check
whether it also fixes the original file?
2018-01-30 12:48:48 -08:00
Leonardo de Moura
97ed299ce4 chore(frontends/lean/util): remove dead function 2018-01-30 12:48:48 -08:00
Leonardo de Moura
fa6697ffa8 feat(frontends/lean/pp): add option pp.annotations for debugging purposes 2018-01-30 12:48:48 -08:00
Leonardo de Moura
28b8020995 fix(library/type_context): bug in the unifier
One of the approximations used was generating type incorrect terms.
2018-01-30 12:48:48 -08:00
Leonardo de Moura
39f1cc0bab test(tests/lean/run): add new tests exposing bug in the unifier
This commit also documents the problem at type_context.cpp, and
describes a potential solution.
2018-01-30 12:48:48 -08:00
Leonardo de Moura
aa1473a6c8 refactor(library/type_context): add process_assignment_fo_approx 2018-01-30 12:48:48 -08:00
Sebastian Ullrich
0f16448bae chore(src/CMakeLists): expose LEAN_IGNORE_OLEAN_VERSION as cmake option CHECK_OLEAN_VERSION 2018-01-30 10:40:07 +01: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
Gabriel Ebner
aac833c8d4 test(tests/lean/run): test for mk_inj_eq 2018-01-28 09:10:26 -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
77ae133baa fix(library/type_context): preprocess_class
@kha This commit fixes the bug we discussed on slack.
I had to repair one of the tests. The broken test made me
realize that if we use the unbundled approach to define something like
`is_semiring`

```
class is_semiring (α : Type) (plus : α → α → α) (mul : α → α → α) (zero : out_param α) (one : out_param α) :=
...
```
Then, to retrieve a `is_semiring` instance, we need to know `α`, `plus`
and `mul`. This is problematic because we may be in a context where one
of them cannot be inferred. This would force user to manually provide
the missing (input) parameter. We are not considering the unbundled
approach for complex algebraic structures such as `semiring`, `ring` and
`field`, but I wanted to document this limitation here since we may face
it in other type classes.

I think it is a bad idea to add back `inout_param` and have both:
`inout_param` and `out_param`. The previous `inout_param` created
many instabilities and hard to diagnose failures.
2018-01-24 17:30:04 -08:00
Leonardo de Moura
b5e2e8ed92 doc(library/module): document the persistent set_option discussion
cc @kha
2018-01-24 17:12:40 -08:00
Leonardo de Moura
adae5b9fa1 chore(library/mpq_macro): delete mpq_macro 2018-01-24 15:24:28 -08:00
Leonardo de Moura
1e626e382f chore(frontends/smt2): remove SMT2 frontend 2018-01-24 15:21:52 -08:00
Leonardo de Moura
2ae080a6d2 doc(library): comment code that need to be refactored for AC matching and algebraic normalizer 2018-01-24 15:09:11 -08:00