Commit graph

4128 commits

Author SHA1 Message Date
Leonardo de Moura
3f5bbfa0cf fix(library/parray): missing lock 2017-05-09 13:57:28 -07:00
Leonardo de Moura
a3679a43a1 fix(library/parray): unique_lock ==> lock_guard 2017-05-09 13:57:28 -07:00
Leonardo de Moura
0ef0a7f466 chore(library/parray): more assertions 2017-05-09 13:57:28 -07:00
Leonardo de Moura
8802f7cd19 chore(library/phashtable): unnecessary/incorrect annotations 2017-05-09 13:57:28 -07:00
Leonardo de Moura
00887ba3ec chore(library/parray): more assertions 2017-05-09 13:57:28 -07:00
Leonardo de Moura
2ddd413bef fix(library/parray): reroot split optimization is incorrect when ThreadSafe == true 2017-05-09 13:57:28 -07:00
Leonardo de Moura
970529a8e9 fix(library/parray): copy method must create a copy of the mutex too (when ThreadSafe == true) 2017-05-09 13:57:28 -07:00
Leonardo de Moura
afadf2b1e1 feat(library/phash_map): add name_hash_map 2017-05-09 13:57:28 -07:00
Leonardo de Moura
bea122bb22 fix(library/phash_map,library/phashtable): missing const and operator 2017-05-09 13:57:28 -07:00
Gabriel Ebner
b536df3596 feat(library/type_context): add option to unfold lemmas 2017-05-08 10:14:47 -07:00
Gabriel Ebner
b4c73e562e fix(library/vm/vm_io): use correct memory layout for io.environment 2017-05-08 15:07:48 +02:00
Gabriel Ebner
40bf75cbff fix(library/equations_compiler/structural_rec): fix indices 2017-05-07 15:52:39 +02:00
Leonardo de Moura
d21945fa86 feat(library/phash_map): add persistent hash_map based on phashtable 2017-05-05 12:36:13 -07:00
Gabriel Ebner
f0d22ed3e5 feat(library/process,system/io): set environment variables for spawned processes 2017-05-04 16:41:11 -07:00
Gabriel Ebner
1b8533130b feat(system/io): add function to get environment variables 2017-05-04 16:41:11 -07:00
Daniel Selsam
b7d20a333f chore(src/library/constants): rm unused constants 2017-05-04 16:34:32 -07:00
Daniel Selsam
d727abeefc chore(library/inductive_compiler/nested.cpp): prove all theorems in C++ 2017-05-04 16:34:32 -07:00
Leonardo de Moura
9d5dacd554 test(tests/library/phashtable): add tests 2017-05-04 16:18:03 -07:00
Leonardo de Moura
bdf4d69702 feat(library): add persistent hashtable based on parray 2017-05-04 15:35:25 -07:00
Leonardo de Moura
39165ad66b feat(library/parray): add helper methods and exclusive_access helper class 2017-05-04 15:35:14 -07:00
Leonardo de Moura
ae96ebf6ee feat(library/parray): split "long" delta paths 2017-05-03 16:07:49 -07:00
Leonardo de Moura
90e434f78c refactor(library/parray): minor refactoring 2017-05-03 13:44:42 -07:00
Sebastian Ullrich
b37b1fb7c6 refactor(library/type_context,frontends/lean/elaborator): move reflected code back into elaborator
Since we do not want recursive special handling of `reflected`, this seems to be
the simpler design.
2017-05-03 13:27:35 -07:00
Leonardo de Moura
6092966702 fix(library/parray): missing desctrutor/constructor invocations at reroot 2017-05-03 13:17:26 -07:00
Leonardo de Moura
97ab603325 feat(library/parray): add ensure_unshared 2017-05-03 12:57:15 -07:00
Leonardo de Moura
2e5702d31e fix(library/parray): it is unsafe to return reference
A reroot operation performed by another thread may invalidate the reference.
2017-05-03 10:02:10 -07:00
Leonardo de Moura
a8cc5c4e31 fix(library/parray): race conditions 2017-05-03 09:36:35 -07:00
Leonardo de Moura
a69052e7ee feat(library/parray): add parray thread safe version
We will use the thread safe version for implementing persistent hash maps.
The hash maps will be used to implement decision procedures and refactor
the congruence closure and ematching modules.
The persistent hash maps based on thread safe parrays are performant
when most of the time there is a single thread updating them.

We use a small hack to make sure we don't have any overhead for

   parray<T, false>

i.e., the thread unsafe version used in the VM.
2017-05-02 17:15:09 -07:00
Leonardo de Moura
ff916b3a93 chore(library/parray): avoid T m_elem; field at cell
This was bad since T default constructor would be invoked even when not
needed.
2017-05-02 16:20:15 -07:00
Leonardo de Moura
915c5c5ad8 chore(library/parray): remove unnecessary conditional 2017-05-02 15:20:42 -07:00
Leonardo de Moura
73b4e42485 chore(frontends/lean,library): fix character pretty printer 2017-05-02 13:17:22 -07:00
Leonardo de Moura
55fee26b36 feat(library/class): add attribute for tracking symbols occurring in instances of type classes
For more information see:
https://github.com/leanprover/lean/wiki/Refactoring-structures
The new attribute [algebra] implements the [algebraic_class] described
in the page above.
2017-05-01 18:02:30 -07:00
Gabriel Ebner
44bfceb6a6 feat(library/process): support working directory on windows 2017-05-01 14:11:39 -07:00
Gabriel Ebner
f14763b777 fix(library/module_mgr): fall back to olean if lean does not exist 2017-05-01 14:11:39 -07:00
Gabriel Ebner
3810e8950d refactor(util/lean_path,util/path): separate search path functions 2017-05-01 14:11:38 -07:00
Gabriel Ebner
baa4c48f1f refactor(util/lean_path): explicitly pass around search path 2017-05-01 14:11:38 -07:00
Leonardo de Moura
ba5eccdca8 refactor(library/init/core): rename out_param => inout_param
It is really input/output.
2017-05-01 14:01:41 -07:00
Leonardo de Moura
66a1fec94e feat(library/init/category): add has_orelse type class 2017-05-01 09:58:27 -07:00
Leonardo de Moura
5cef84709f refactor(library): avoid auxiliary definitions such as add/mul/le/etc
See Section "Other goodies" at
https://github.com/leanprover/lean/wiki/Refactoring-structures

This commit also improves the support for projections in the
unifier/matcher.

Now, we consider the extra case-split for projections.
Given a projection `proj`, and the constraint `proj s =?= proj t`, we need to try first `s =?= t` and if it fails, then try to reduce.
This is needed in the standard library because we now have constraints such as:
```
@has_le.le ?A ?s ?a ?b  =?=  @has_le.le nat nat.has_add x y
```
If we reduce the right hand side, we get the unsolvable constraint
```
@has_le.le ?A ?s ?a ?b  =?=  nat.le x y
```
Before this change, the constraint was `@le ?A ?s ?a ?b  =?=  @le nat nat.has_add x y`, and we already perform a case-split in this case.
Moreover, projections were eagerly reduced whenever possible.
The extra case-split generates a performance problem in several tests. For example `fib 8 = 34` was timing out.
I worked around this issue by performing the case-split only when the constraint contains meta-variables.
There are also minor issues. Example. `<` is notation for `has_lt.lt`, but `>` is for `gt`.
2017-05-01 08:52:19 -07:00
Scott Morrison
832c38d3cb fix(library/vm/vm_environment) use is_structure rather than try to catch an assertion 2017-04-29 12:55:50 +02:00
Scott Morrison
41c648905e fix(library/tactic/smt/ematch.cpp) check if new_states is empty before pushing 2017-04-28 08:50:45 -07:00
Sebastian Ullrich
0ca6e2c96f refactor(library/{type_context,compiler/preprocess},frontends/lean/elaborator): use opaque, general type class instead of special app elaboration for eval_expr 2017-04-27 16:04:59 -07:00
Sebastian Ullrich
4479eebaf0 feat(init/meta/{environment,pexpr}): expose some structure APIs 2017-04-27 16:04:41 -07:00
Gabriel Ebner
3352c31029 fix(library/tactic/smt/ematch): fix compiler warning 2017-04-27 16:04:18 -07:00
Leonardo de Moura
d3eca9fa35 feat(library/type_context): improve unifier support for projections
We need this improvement to be able to finish Section "Other goodies" described at
https://github.com/leanprover/lean/wiki/Refactoring-structures

Before this commit, Lean would not be able to solve constraints such as

```lean
@has_add.add nat nat.has_add a b =?= @had_add.add ?A ?inst a b
```

The problem is that projections were being reduced eagerly, and the
constraint would be reduced to

```lean
nat.add a b =?= @had_add.add ?A ?inst a b
```

The new test proj_uniy.lean contains similar unification problems.
2017-04-27 15:55:09 -07:00
Sebastian Ullrich
8cf98d9974 fix(library/type_context): fix tmp_mode assertion error
Fixes #1543
2017-04-26 14:23:14 -07:00
Leonardo de Moura
cabb4350d9 feat(library): instances are not reducible by default anymore
Motivation: see "Other goodies" section at
https://github.com/leanprover/lean/wiki/Refactoring-structures

We had to add a new transparency mode: Instances at type_context.
In this mode, instances and reducible definitions are considered
transparent.

The new mode is used in the defeq_canonizer, code generator,
and sizeof lemma generation at inductive_compiler.

We also use the new mode in the unfold tactics.
2017-04-26 14:10:11 -07:00
Leonardo de Moura
bcf34f1b6f fix(library/inductive_compiler/nested): do not crash if we fail to unfold sizeof 2017-04-26 12:54:52 -07:00
Leonardo de Moura
e59fd2927a feat(library): process explicit arguments before implicit
Moreover, we process the implicit arguments using at least the Semireducible
transparency mode. The idea is to make sure to reduce counterintuitive
behavior in rw and simp where the user believes a lemma is applicable
but it does not work because the implicit part fails to unify.

The modification above fixes the simplifier issues found by @kha when proving the
monadic laws.

This commit also improves constraints of the form

          n =?= m

where n and m are big distinct numerals. The type_context fails quickly
for this kind of constraint even using transparency mode Semireducible.
We need this feature otherwise we timeout at

      @eq char a b =?= @eq unsigned ?x ?y

Recall that

       char     := fin char_sz
       unsigned := fin unsigned_sz
2017-04-25 17:16:06 -07:00
Leonardo de Moura
e51ff591f7 chore(library/type_context): disable all trace messages inside type class resolution if trace.class_instances is not set to true 2017-04-25 14:16:10 -07:00