Commit graph

13149 commits

Author SHA1 Message Date
Leonardo de Moura
52d6adc19c chore(library): use new structure update notation in the core lib 2017-11-17 16:57:54 -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
Sebastian Ullrich
d037ab1d4b refactor(frontends/lean/structure_cmd): remove awkward pointer index computation 2017-11-17 16:31:30 -08:00
Sebastian Ullrich
aa8791a9ee fix(frontends/lean/structure_cmd): support dependent parents in new structure cmd 2017-11-17 16:31:30 -08:00
Leonardo de Moura
65368a0c85 refactor(library): rbtree lemmas do not need to be in init folder 2017-11-17 16:14:28 -08:00
Leonardo de Moura
956f29cdb2 chore(library/init/data/rbtree/lemmas): do not rely on and.comm, and.assoc and and.left_comm as simp rules 2017-11-17 15:36:17 -08:00
Leonardo de Moura
2e66c422f3 feat(library/init/data/rbtree/lemmas): simplify blast_disjs 2017-11-17 15:06:49 -08:00
Leonardo de Moura
7dd70b0ef1 feat(library/init/algebra/classes): add is_strict_total_order type class 2017-11-17 15:06:32 -08:00
Leonardo de Moura
e2e8d56e6e feat(library/init/data/rbtree/lemmas): add equiv_or_mem_of_mem_insert lemma 2017-11-17 13:49:58 -08:00
Leonardo de Moura
3783eaa6e1 feat(library/init/algebra/classes): add is_trichotomous type class 2017-11-17 13:49:26 -08:00
Leonardo de Moura
17172cbbdd fix(library/tactic/simplify): imp_congr was not preserving binder name 2017-11-17 12:45:04 -08:00
Leonardo de Moura
1b8f9d6550 feat(library/init/data/rbtree/lemmas): add mem_ins_of_mem lemma 2017-11-17 11:42:55 -08:00
Leonardo de Moura
d2b27035ae feat(library/init/data/rbtree/lemmas): add contains_correct user lemma 2017-11-16 17:24:37 -08:00
Leonardo de Moura
d40b255d14 feat(library/init/data/rbtree/lemmas): show that a well formed red black tree is searchable 2017-11-16 17:04:33 -08:00
Leonardo de Moura
3f6d0979ae feat(library/init/meta/tactic): add any_hyp tactic 2017-11-16 14:28:00 -08:00
Leonardo de Moura
10a035a9ba feat(library/init/data/rbtree/lemmas): add contains_correct lemma 2017-11-16 12:20:49 -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
b9b3b43471 chore(library/init/meta/expr): helper predicates 2017-11-16 11:03:10 -08:00
Leonardo de Moura
a619bac008 feat(library/init/data/rbtree/lemmas): add is_searchable helper inductive predicate 2017-11-15 19:08:18 -08:00
Leonardo de Moura
7024eddf29 feat(library/init/algebra/classes): add is_incomp_trans type class 2017-11-15 19:08:05 -08:00
Leonardo de Moura
8311ec0afa feat(library/init/algebra/classes): helper lemmas 2017-11-15 18:29:38 -08:00
Leonardo de Moura
7f80bf60d1 feat(library/init/data): start rbtree module 2017-11-15 16:17:39 -08:00
Leonardo de Moura
3a216785ba feat(tmp/rbtree_no_index): cleanup interface 2017-11-14 17:22:24 -08:00
Leonardo de Moura
d88a6f663e fix(frontends/lean/elaborator): implicit arguments after auto_param arguments
Function applications `(f ...)` were not being elaborated correctly when
`f` has implicit parameters occurring after auto_params.
The new test exposes the problem.

This bug was found when developing the red black tree module.

This commit also fixes the following bugs:

- Invoke type class resolution again after tactic execution at
  synthesize method. Reason: metavariables occurring in type
  class instances may have been synthesized by tactics.

- mctx.assign optimization at invoke_tactic was incorrect
  when the metavariable was assigned by typing rules.
2017-11-14 17:22:12 -08:00
Leonardo de Moura
6e4ef51f26 feat(library/tmp/rbtree_no_index): unbundled rbtree experiment 2017-11-14 12:31:53 -08:00
Leonardo de Moura
394e0d5f0a refactor(library/init): remove has_cmp and is_ordering type classes
Now, `cmp` is just a fixed helper function.
In the future, we will be able to use (more efficient) specialized
versions during code generation by defining simp rules.
2017-11-14 08:33:24 -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
f063824e0a feat(library/init/algebra/classes): add is_total_preorder is_ordering type classes
This commit also adds a lemma relating is_strict_weak_order and total_preorder.
2017-11-13 21:55:22 -08:00
Leonardo de Moura
8e076da666 feat(library/init/data/list/basic): has_le and has_lt instances for lists 2017-11-13 21:52:12 -08:00
Leonardo de Moura
13b0070c20 feat(library/init/logic): double negation helper lemmas 2017-11-13 21:51:35 -08:00
Leonardo de Moura
445cd8f0ae chore(library/init/data/list/lemmas): ._ ==> _ 2017-11-13 21:50:25 -08:00
Leonardo de Moura
2c8a901df9 feat(library/init/data/prod): has_lt for prod 2017-11-13 15:51:14 -08:00
Leonardo de Moura
a39c0531cf feat(library/init/data): has_lt for string and list 2017-11-13 15:30:41 -08:00
Leonardo de Moura
e421808b8c refactor(library/init/data/char, library/init/data/fin): has_lt, has_le for char and fin 2017-11-13 15:09:08 -08:00
Leonardo de Moura
c4605b3b96 refactor(library/init): rename has_ordering => has_cmp 2017-11-13 14:47:14 -08:00
Sebastian Ullrich
c838cdab34 fix(library/process): do not strip signal information from child exit status
This should match the meaning of "$?" in bash:

"3.7.5 Exit Status

The exit status of an executed command is the value returned by the waitpid system call or equivalent function. Exit statuses fall between 0 and 255."

Fixes #1868
2017-11-13 17:15:28 +01:00
Gabriel Ebner
d7c90ecbf5 chore(bin): remove obsolete files 2017-11-12 12:04:47 +01:00
Sebastian Ullrich
55276a5c36 chore(emacs): remove obsolete files 2017-11-11 15:17:05 +01:00
Leonardo de Moura
0388dd9640 perf(init/data/ordering): avoid thunk 2017-11-10 17:05:17 -08:00
Leonardo de Moura
308bc8de4a chore(tests/lean): fix test suite 2017-11-10 16:59:09 -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
db4c9838d1 test(tmp/rbtree_no_index): rbtree without indexed families 2017-11-09 19:42:53 -08:00
Leonardo de Moura
97d875eb9a perf(library/vm): add native int.cmp and nat.cmp 2017-11-09 14:18:28 -08:00
Leonardo de Moura
f2ef24696d perf(library/compiler/cse): make sure we eliminate common sub expressions in match-cases associated with 0-ary constructors
The new test exposes the problem. Before this commit, the common
subexpressions at

```
def tst : tree → nat
| (tree.leaf v) := v
| (tree.node v l r) :=
  match f v with
  | tt := tst l + tst l - tst l   -- <<< HERE
  | ff := tst r
  end
```

were not converted into a let-exprs.
2017-11-09 13:32:15 -08:00
Leonardo de Moura
0bbe51615e chore(library/compiler/vm_compiler): add helper function 2017-11-09 13:29:32 -08:00
Leonardo de Moura
76ddda493d refactor(library/compiler/cse): isolate cse processor procedure
We will use it to fix a performance problem in case expressions for
inductive datatypes that have constructors without data.
2017-11-09 12:41:36 -08:00
Leonardo de Moura
fabf7f6380 perf(library/equations_compiler, library/compiler): expand auxiliary _match_idx definitions when generating byte code
We use the auxiliary procedure pull_nested_rec_fn to pull recursive
application in nested match expressions. This is needed because the
nested match expression is compiled before we process the recursive
procedure that contains it. This transformation may produce
performance problems if the recursive application does not depend on
the data being matched. Here is an example from the new test:

```
def tst : tree → nat
| (tree.leaf v) := v
| (tree.node v l r) :=
  match f v with
  | tt := tst l
  | ff := tst r
  end
```

pull_nested_rec_fn will convert it into

```
def tst : tree → nat
| (tree.leaf v)     := v
| (tree.node v l r) := tst._match_1 (f v) (tst l) (tst r)
```

Since our interpreter uses eager evaluation, both `(tst l)` and `(tst r)`
are executed. This commit fixes this issue by expanding `tst._match_1`
during code generation.
2017-11-09 11:14:57 -08:00
Leonardo de Moura
2c1f50cc04 fix(library/num): fixes #1862 2017-11-09 09:49:53 -08:00
Leonardo de Moura
2c3e99d538 chore(tmp): save rbtree experiment 2017-11-08 16:23:12 -08:00