Commit graph

16134 commits

Author SHA1 Message Date
Leonardo de Moura
ea3a38c5d3 chore(runtime/object): style 2019-03-27 14:08:10 -07:00
Leonardo de Moura
e71249f6b3 chore(tests): fix tests 2019-03-27 14:06:23 -07:00
Leonardo de Moura
af05e7257d chore(stage0): update 2019-03-27 13:55:08 -07:00
Leonardo de Moura
90a6b36783 refactor(library/init/data/string/basic): avoid artificial "fuel" using partial
After we restore the tactic framework, we will be able to eliminate the
`partial` keywords in this module by using well-founded recursion.
2019-03-27 13:51:52 -07:00
Leonardo de Moura
9b47d134ae feat(library/equations_compiler/partial_rec): consider elements before : when constructing base case 2019-03-27 13:49:23 -07:00
Leonardo de Moura
d536ee347d chore(runtime/object): remove fixpoint* primitives 2019-03-27 13:17:25 -07:00
Leonardo de Moura
414c03363c chore(stage0): update 2019-03-27 13:13:34 -07:00
Leonardo de Moura
a43a40b7f5 chore(library/init): remove fix.lean
`partial def` is much more general
2019-03-27 13:11:00 -07:00
Leonardo de Moura
3936b2ba79 chore(library/init/io): we don't need fix anymore
`partial def` are much more general
2019-03-27 12:59:43 -07:00
Leonardo de Moura
62d7cc6b37 feat(library/init/wf): remove wf_term_hack 2019-03-27 12:41:16 -07:00
Leonardo de Moura
a3f30a5573 feat(library/init/lean): avoid wf_term_hack 2019-03-27 12:36:17 -07:00
Leonardo de Moura
895bf2c91d feat(library/equations_compiler/partial_rec): try assumption if inhabitant could not be found 2019-03-27 12:24:24 -07:00
Leonardo de Moura
b66f5dcf5c chore(library/init): avoid wf_term_hack 2019-03-27 12:12:21 -07:00
Leonardo de Moura
9a071c18e7 feat(library/equations_compiler): add support for partial definitions 2019-03-27 11:09:32 -07:00
Leonardo de Moura
ef5fac1481 chore(library/equations_compiler): add partial_rec skeleton 2019-03-27 08:37:59 -07:00
Leonardo de Moura
829a50ccf7 test(tests/playground/partial_eq_lemma): partial equation lemmas
@kha I added this example as a template for what the equation compiler
will have to do. The plan is:
- We can use `partial` to define any function if the result type is
inhabited.
- If the result type is of the form `Partial a`, the equation compiler
generates lemmas of the form:

```
theorem fooEq args : terminates (foo args) → foo args = lhs
```
The new test contains an example.
2019-03-26 18:06:04 -07:00
Leonardo de Moura
9ddc778ac3 feat(library/equations_compiler/equations): add m_is_partial to equation header 2019-03-26 16:18:43 -07:00
Leonardo de Moura
1f11429f98 feat(frontends/lean): add partial keyword 2019-03-26 16:09:55 -07:00
Leonardo de Moura
0ce97893de chore(tests/playground/parser): port test file to new String API 2019-03-26 16:00:03 -07:00
Leonardo de Moura
4b83585103 chore(stage0, runtime): update stage0 and remove old String API 2019-03-26 15:51:13 -07:00
Leonardo de Moura
b29fb57fcf refactor(library/init/data/string/basic): String.Pos as Nat
@kha: I initially planned to use the UTF8 API only in very special
cases, but I found them to be super useful. They allow us to implement
an efficient String library mostly in Lean.
However, the there was a problem: `abbrev String.Pos := USize`.
This definition is fine for a low level API, but this is not the case
anymore. By having `String.Pos := USize`, we will not be able to
prove natural theorems for the `String` API. For example,
`String.map id s = s` did not hold. We would have to include the
artificial antecedent `s.length <= usizeMax` (or something like this).
I suspect it would be very painful.
So, this commit defines `String.Pos` as `Nat`. The performance
overhead seems to be very small.
2019-03-26 15:35:52 -07:00
Leonardo de Moura
dd48d5ae18 feat(runtime/object): implement string primitives using Nat index 2019-03-26 15:27:14 -07:00
Leonardo de Moura
af16e79ed0 chore(stage0): update 2019-03-26 14:52:24 -07:00
Leonardo de Moura
f1f2994781 chore(library/compiler/emit_cpp): update 2019-03-26 14:51:14 -07:00
Leonardo de Moura
0d5ac5288a feat(runtime): increase small nat size
In 64-bit machines, the max small nat value should now be (2^63 - 1), and on 32-bit
machines (2^32 - 1).

The main motivation for this modification are the array indexing
operations. With the new representation, if a Nat index is not small,
then it must not be a valid index. This was not true in 64-bit
machines. Example: an array of size 2^33 would fit in memory, and but
an index `i` > 2^32 - 1 would not be a small nat value.
2019-03-26 14:21:03 -07:00
Leonardo de Moura
b0da4360d0 chore(runtime, library/init/data/string/basic): prepare to change String.Pos 2019-03-26 12:25:12 -07:00
Leonardo de Moura
d7bf1821a6 chore(stage0): update 2019-03-26 11:11:47 -07:00
Leonardo de Moura
681f3ec81b fix(library/compiler/llnf): constructor reuse
We were not reusing constructor values for constructors that contained only
scalar values.
2019-03-26 11:10:51 -07:00
Sebastian Ullrich
040ec9767d fix(library/init/lean/parser/combinators): (x) -> e should not be a dependent function 2019-03-26 11:26:39 +01:00
Sebastian Ullrich
2df060be44 feat(frontends/lean/elaborator): node!: support parameterized parsers 2019-03-26 11:21:53 +01:00
Leonardo de Moura
2a37e60ba9 feat(library/init/core): add != notation 2019-03-25 16:58:01 -07:00
Leonardo de Moura
b10e824d94 chore(stage0): update 2019-03-25 16:48:11 -07:00
Leonardo de Moura
3ad7d2ba81 fix(library/compiler/lcnf): disable transformation for Bool
@kha Here is another motivation for re-implementing the equation compiler.
2019-03-25 16:48:11 -07:00
Leonardo de Moura
7db4f60e50 feat(library/init/core): eagerly expanding Decidable.toBool seems to be a bad idea
After we erase types and proofs, `Decidable.toBool` can be replaced with
the identity function since `Decidable A` and `Bool` have the same
runtime representation. By eagerly expanding `toBool`, we introduce
unnecessary `cases` expressions.
2019-03-25 16:48:11 -07:00
Leonardo de Moura
5679a17603 doc(doc/make/index): add instructions for invoking makefile manually 2019-03-25 14:57:57 -07:00
Leonardo de Moura
fc4af7ae48 chore(stage0): update 2019-03-25 14:19:11 -07:00
Leonardo de Moura
87cab24a1d fix(library/compiler/csimp): at_most_once at elim_jp1_fn
`elim_jp1_fn` was incorrectly expanding join points that were used more
than once. The issue is that the `foreach` combinator "may" skip nodes
that have already been visited.
2019-03-25 14:19:11 -07:00
Leonardo de Moura
d70b88a453 chore(stage0): update 2019-03-25 14:19:11 -07:00
Leonardo de Moura
7f58843d48 feat(library/init/lean/compiler/util): atMostOnce visitor 2019-03-25 14:19:10 -07:00
Leonardo de Moura
79b6a144d5 feat(library/init/data/string/basic): improve and cleanup String/Substring API 2019-03-25 14:19:10 -07:00
Sebastian Ullrich
762ccb0d1d feat(tests/playground/environment_extension): scoped extensions in Lean 2019-03-25 17:35:01 +01:00
Leonardo de Moura
bbe93c036d feat(library/init/data/string): add Substring 2019-03-25 09:29:06 -07:00
Leonardo de Moura
18f3ec41a9 chore(library/init/data/string/basic): reorg and cleanup 2019-03-25 09:29:06 -07:00
Sebastian Ullrich
beec014890 feat(library/init/lean/{parser/term,expander}): remove (x : e) → f macro hack and replace with actual parser 2019-03-25 16:12:14 +01:00
Sebastian Ullrich
360a1476cc chore(tests/playground/environment_ext): use nicer full name like in C++ 2019-03-25 16:12:14 +01:00
Sebastian Ullrich
7c0912d41c refactor(frontends/lean/lean_environment): move environment parts out of lean_elaborator.cpp 2019-03-25 16:12:14 +01:00
Leonardo de Moura
60f8d17942 refactor(library/init/data/string/basic): simplify String.Iterator
The `offset` field is problematic because it prevents us from having an
efficient way of moving back and forth between `String.Pos` and `String.Iterator`.

@kha I temporarily added `String.OldIterator` for making sure the
parser doesn't break. This is a temporary fix that will be eliminated
after we replace `parsec`.
2019-03-25 07:57:12 -07:00
Sebastian Ullrich
88af3c948a fix(lean4-mode/lean4-flycheck): update lean4-bootstrapped-checker 2019-03-24 20:55:20 +01:00
Sebastian Ullrich
082b217928 fix(util/kvmap): adjust to Lean definition 2019-03-24 20:46:40 +01:00
Sebastian Ullrich
6ea5f5196e feat(library/init/lean/expander): support Agda-like (a : b) → c syntax 2019-03-24 20:25:11 +01:00