Commit graph

125 commits

Author SHA1 Message Date
Leonardo de Moura
170579c803 feat(library/init/core): task builting primitives 2019-02-17 08:45:46 -08:00
Leonardo de Moura
456ed23cc2 feat(library/init): use extern when declarating nat primitives 2019-02-12 18:12:29 -08:00
Leonardo de Moura
7b0227572f fix(library/init/core): missing borrowed annotation 2019-02-11 16:01:56 -08:00
Leonardo de Moura
1703255330 fix(library/init/core): we simulate the unused attribute feature using extern inline 2019-02-11 11:38:24 -08:00
Sebastian Ullrich
d444b5ef49 chore(library/init/core): move sorry_ax up (temporarily) to get error recovery sooner 2019-01-15 17:42:09 +01:00
Leonardo de Moura
733bbc521f feat(library/init/core): mark thunk and task primitives with [noinline]
In the future, we should use the `[builtin]` attribute which cannot be
overwritten by the user.
2018-11-02 13:54:40 -07:00
Leonardo de Moura
1af1a8996b chore(library/init/core): classical.some ==> classical.choose
To avoid confusion with `option.some`.
2018-10-17 09:04:52 -07:00
Leonardo de Moura
fa9d6b4ddf chore(library/init): missing [inline] and remove unnecessary defs 2018-10-17 08:38:30 -07:00
Leonardo de Moura
338038a05e feat(library/init/core): add inline identity function 2018-10-10 18:17:29 -07:00
Leonardo de Moura
eb51b9ef26 chore(library/init/core): avoid . as end-of-command and empty equations 2018-10-05 17:30:27 -07:00
Sebastian Ullrich
959948b901 feat(library/init/lean): even more core.lean progress 2018-10-03 16:00:08 -07:00
Leonardo de Moura
761db5bc7e chore(library/init/core): remove obsolete lemmas
We don't need them anymore.
2018-10-01 14:17:11 -07:00
Sebastian Ullrich
e261d8f222 perf(library/init): missing [inline] attributes 2018-10-01 11:53:38 -07:00
Leonardo de Moura
a2ee4552fb chore(library/init/core): add inline annotations 2018-09-30 08:21:11 -07:00
Leonardo de Moura
923c8ea9a3 chore(library/init/core): missing @[inline] 2018-09-29 16:21:42 -07:00
Leonardo de Moura
0e4c5d932e feat(library/init/core): missing @[macro_inline] 2018-09-29 16:12:40 -07:00
Sebastian Ullrich
945bf39e05 feat(library/init/lean): progress 2018-09-28 20:50:18 -07:00
Sebastian Ullrich
64a6341751 chore(library/init/core): remove has_inv 2018-09-28 20:50:18 -07:00
Sebastian Ullrich
ba1da61dd0 chore(library/init/core): avoid unquoted notation symbol 2018-09-28 13:08:24 -07:00
Leonardo de Moura
7f64033111 chore(library/init): remove all occurrences of parameter command
We will not support the `parameter` command in Lean 4.
It is seldom used and creates many complications.
2018-09-26 17:54:11 -07:00
Leonardo de Moura
a31f12d8cd chore(library/init/core): revert ite+thunks modification
We don't need it since we marked `ite` as `[macro_inline]`
2018-09-23 19:27:06 -07:00
Leonardo de Moura
ad82ad69ec feat(library/init/core): cleanup bor and band 2018-09-23 19:27:06 -07:00
Leonardo de Moura
dd046b0e0a feat(library/init/core): mark id_rhs as [macro_inline] 2018-09-23 19:27:06 -07:00
Leonardo de Moura
d43f9627c2 feat(library/init/core): use [macro_inline] to get shortcircuit semantics in new compiler stack 2018-09-23 19:27:06 -07:00
Leonardo de Moura
54f04dca9f feat(library/init/core): use cases_on instead of rec_on 2018-09-18 15:25:15 -07:00
Leonardo de Moura
b07c718425 refactor(library/init/core): change ite signature 2018-09-17 14:27:28 -07:00
Leonardo de Moura
871e7de673 chore(library/init/core): move auxiliary constants to beginning of the file 2018-09-16 11:02:17 -07:00
Leonardo de Moura
9f2d543209 chore(library/init/core): hide arguments for lc_proof, lc_cast and lc_unreachable 2018-09-12 11:00:05 -07:00
Leonardo de Moura
d5d926b0ef feat(library/compiler/lcnf): eliminate no_confusion 2018-09-12 10:40:09 -07:00
Leonardo de Moura
9b21287a3e feat(library/compiler/lcnf): add lean compiler normal form 2018-09-11 18:10:10 -07:00
Leonardo de Moura
71dd8653bc feat(library/init/core): decidable_eq is a proper class
We need this to take advantage of the new indexing structure we are
going to add to improve performance.
2018-09-07 16:38:11 -07:00
Leonardo de Moura
c48eaed9a4 chore(library): remove relation_manager 2018-09-07 12:35:04 -07:00
Leonardo de Moura
5d41046170 refactor(library/init/core): remove exists_unique
We never used it in the corelib. Users can define it if they need it.
2018-08-28 14:01:33 -07:00
Sebastian Ullrich
47bff1ddcd fix(library/init/core): ∃! should not accept multiple binders 2018-08-28 13:13:14 -07:00
Leonardo de Moura
776c977742 refactor(kernel): continue constant_info/declaration refactoring 2018-08-27 17:23:26 -07:00
Leonardo de Moura
66adac6af6 chore(library/init): avoid calc at corelib 2018-08-27 12:17:30 -07:00
Leonardo de Moura
7a47406c4c chore(library/tactic): remove simp_lemmas 2018-08-23 14:10:36 -07:00
Leonardo de Moura
d0dc998873 chore(library/init/core): remove opaque comments
We don't need to use `opaque` for `thunk` and `task`. Their recursor and
projections can be implemented in constant time. We just need to create
a closure which uses the runtime thunk_get/task_get primitive.
2018-08-22 10:27:04 -07:00
Leonardo de Moura
3ab1ebcb3f feat(init/core): add task 2018-08-21 16:10:07 -07:00
Leonardo de Moura
261dc999d0 refactor(frontends/lean/elaborator): mark thunk as opaque, and thunk A to A is now a coercion
@kha I was working in the new declaration type and using tasks there.
Since we don't have tasks yet in Lean, I decided to start refactoring
the `thunk` type. I defined it as:

```
-- TODO(Leo): mark as opaque, it is implemented by the new runtime
structure thunk (α : Type u) : Type u :=
(fn : unit → α)

def thunk.pure {α : Type u} (a : α) : thunk α :=
⟨λ _, a⟩

def thunk.get {α : Type u} (t : thunk α) : α :=
t.fn ()
```

The idea is to use the runtime primitives to implement them.
Then, I realized the support for `thunk`s in the elaborator are quite
hacky. Given `f x`, if `f`'s domain has type `thunk A`, we elaborate
`f x` as `f (fun _, x)` even if `x` has type `thunk A`.
This is quite bad, for example, suppose we have
```
def f (x : thunk A) := ...
```
Then, the following definition is type incorrect.
```
def g (x : thunk A) := f x
```
and we are forced to write
```
def g (x : thunk A) := f (x ())
```
The term `f (x ())` will be elaborated as `f (fun _, x ())` and an
unnecessary closure is created at runtime.

This mechanism inherited from Lean 3 is also incompatible with the
new thunk definition. Given `x : thunk A`, I want to write `x.get`
to retrieve the value instead of `x ()` as in Lean 3.
However, `x.get` expands into the nonsensical `(fun _, x).get`.

So, I decided to view the mapping `A` to `thunk A` as a "coercion".
I used double quotes, because it is a macro instead of a function.
If it were a coercion, then we would be using `thunk.pure` to coerce
values but this is not we want most of the time.
For example, given `f : thunk A -> B` and a term `t : A`, when we write
`f t`, we want it to be converted into `f (fun _, t)` instead of
`f (thunk.pure t)` which would eagerly compute `t`. The transformation
`t` into `fun _, t` is syntactic.
We cannot implement it using type classes. I implemented it as
a hard-coded extra case like the one from `Prop` to `bool`.
We can also add a coercion from `thunk A` to `A` to avoid the `.get`.

That being said, I had a few breakages in the code base since we only
use coercions when the given and expected type do not contain
metavariables.
2018-08-21 15:27:51 -07:00
Leonardo de Moura
e80ad07590 chore(library/init/core): remove dead code 2018-06-15 16:05:11 -07:00
Leonardo de Moura
70fc656931 refactor(library/init/data/nat/basic): remove nat.less_than_or_equal inductive predicate
We now define nat.le using (nat.ble : nat -> nat -> bool) function.
We will add builtin support for reducing `nat.ble` efficiently when the arguments are the to be added nat literals.
2018-06-14 11:30:09 -07:00
Leonardo de Moura
a7d08d2f3d feat(kernel/inductive/inductive): dependent elimination for inductive predicates
In Lean4, we will not generate non dependent recursors for inductive
predicates. The main goal is to make the shape of the automatically
generated recursors more uniform. The non uniform representation is
leftover from Lean2. In Lean2, we wanted to support different kernels
with different features. For example: we could create proof relevant
kernels, no impredicative universe, etc.
Recall that, in a kernel with an impredicative Prop and no proof
irrelevance, inductive predicates without dependent elimination are
weaker that inductive predicates with dependent elimination.
When proof irrelevance is enabled, we can generate the dependent
recursor from the non dependent one. Actually, the module drec.cpp
generates the dependent recursor.
Now, we only support one kind of kernel, and it doesn't make sense
anymore to generate non dependent recursors for inductive predicates.
This would only produce an unnecessary asymmetry on the inductive
datatype module.

Remark: we had to create non dependent recursors to help the elaborator.
This can be avoid if we improve the elaborator. I will do that in the
new elaborator implemented in Lean.

Remark: equation lemmas are broken for definitions that pattern match on
nested inductive datatypes. The problem is the super messy
`prove_eq_rec_invertible_aux` function. This function will not be needed
after I finish the new inductive datatype support in the kernel.

cc @kha
2018-06-12 13:03:26 -07:00
Leonardo de Moura
ac0352b584 refactor(kernel): remove quotitent normalizer extension
The `quot` type is now implemented in the kernel.
We will do the same thing for inductives.
We will not support normalizer extensions anymore in Lean4.
It doesn't make sense since we settled with 2 extensions: quotients and
inductives. Moreover, any new extension would require substantial
changes (e.g., code generator).
The normalizer_extension feature was useful when we were experimenting
with different kernel flavors.
2018-06-01 10:52:17 -07:00
Leonardo de Moura
1332fbabd6 feat(library,frontends): remove sorry macro
Lean4 will not have macros.
2018-05-24 14:00:30 -07:00
Leonardo de Moura
af4f831a9f feat(library/init/data/hashmap): hash function produces an uint32 instead of nat
Most efficient hash functions use uint32/uint64 and produce values
that do not fit in out small nat representation. Thus, GMP big numbers
would have to be created.
2018-05-03 17:56:10 -07:00
Leonardo de Moura
9aa459c7e1 feat(library/init/data/nat/basic): add auxiliary power theorems 2018-05-03 11:23:59 -07:00
Sebastian Ullrich
bd7109dc02 chore(library/init/core): cleanup matches 2018-05-03 10:35:39 +02:00
Sebastian Ullrich
16190610dc feat(frontends/lean/match_expr): make end after match optional, remove eventually 2018-05-03 10:35:39 +02:00
Leonardo de Moura
92fa43e7d8 feat(library/init/lean/ir/ir): use name 2018-05-01 12:40:49 -07:00