Commit graph

15248 commits

Author SHA1 Message Date
Leonardo de Moura
ebba9d119d feat: unification hints 2020-11-27 18:12:49 -08:00
Leonardo de Moura
0869f38de4 chore: update structure, class, inductive 2020-11-27 15:09:30 -08:00
Wojciech Nawrocki
b1e6edefde fix: redirect child I/O to null on Process.Stdio.null
And don't use errno for Win32 API errors.
2020-11-27 13:17:32 -08:00
Leonardo de Moura
5981553e11 chore: remove workaround 2020-11-27 13:15:31 -08:00
Leonardo de Moura
3f720d778c fix: unnecessary unfolding 2020-11-27 13:08:18 -08:00
Leonardo de Moura
c0db9f1e0c chore: adjust stdlib to recent changes 2020-11-27 12:26:07 -08:00
Leonardo de Moura
58f1f512f1 feat: simplify heuristics at propagateExpectedType 2020-11-27 12:13:29 -08:00
Leonardo de Moura
d212a5b671 feat: add macro withoutExpectedType! <term> 2020-11-27 11:08:58 -08:00
Leonardo de Moura
09ed75f517 feat: remove restriction from propagateExpectedType 2020-11-27 09:14:26 -08:00
Leonardo de Moura
fcc382df08 fix: improve Offset.lean
It did not support for assigned metavariables.
2020-11-27 08:40:43 -08:00
Leonardo de Moura
2909313475 fix: doLetArrow and doReassignArrow
@Kha the new tests did not work without this fix.
The `| _ =>` was being parsed as part of the `doLetArrow` and `doReassignArrow`
2020-11-26 10:29:08 -08:00
Leonardo de Moura
43d98ef7e3 fix: Term/Sort parsers
missing `checkColGt`
2020-11-26 09:34:32 -08:00
Leonardo de Moura
8898988747 fix: namespace resolution 2020-11-26 08:17:35 -08:00
Leonardo de Moura
eabbb6eca0 feat: improve [defaultInstance]
cc @Kha
2020-11-25 18:33:06 -08:00
Leonardo de Moura
975271e1a3 feat: hide inaccessible names and add pp.inaccessibleNames
@Kha We will probably have to refine the heuristic for hiding the
inaccessible names, but the first version is already useful.
Here is the error message for a `_` before this commit
```
error: don't know how to synthesize placeholder
context:
x✝⁴ : List Nat
x✝³ : Nat
x✝² : x✝⁴ ≠ []
a b x✝¹ : Nat
x✝ : [a, b] ≠ []
⊢ Nat
```
After
```
error: don't know how to synthesize placeholder
a b : Nat
 : [a, b] ≠ []
⊢ Nat
```
2020-11-25 17:22:09 -08:00
Leonardo de Moura
276a8b99dd refactor: move ppGoal to Meta
We need `MetaM` methods such as `isProp` to improve `ppGoal`.
This commit also moves `currNamespace` and `openDecls` to
`Core.Context`. Without this change, `Meta.ppExpr` was not taking
`open` commands into account.
2020-11-25 14:17:13 -08:00
Leonardo de Moura
6f0919f08d chore: fix places that require erewrite 2020-11-25 11:02:26 -08:00
Leonardo de Moura
2c19eb08cb feat: add erewrite tactic
This commits also change `rewrite`. It was behaving like Lean 3
`erewrite` which is too expensive.
2020-11-25 11:02:25 -08:00
Leonardo de Moura
9023e93b3e refactor: move Array.set to Prelude 2020-11-25 11:02:25 -08:00
Leonardo de Moura
d6f778bec4 refactor: arbitrary without explicit arguments
@Kha I was tired of writing `arbitrary _` :)
There 0 places in the stdlib where the type needs to be provided.
If in the future we need to specify the type we can use
`arbitrary (α := <type>)`
2020-11-25 09:07:38 -08:00
Leonardo de Moura
3b75a56160 chore: prepare to make arbitrary argument implicit 2020-11-25 08:30:03 -08:00
Leonardo de Moura
6976f4501e chore: cleanup 2020-11-25 08:19:17 -08:00
Sebastian Ullrich
de20b14366 feat: delaborate basic do
/cc @leodemoura
2020-11-25 16:00:56 +01:00
Sebastian Ullrich
375e6232e0 chore: introduce doSeqItem kind 2020-11-25 12:10:49 +01:00
Sebastian Ullrich
bd7bb6f5b5 fix: do formatting 2020-11-25 11:30:24 +01:00
Sebastian Ullrich
b22e035b6f fix: pretty print empty matchers as nomatch
/cc @leodemoura
2020-11-25 11:30:24 +01:00
Sebastian Ullrich
cf9a2ae6af feat: formatter: preserve comments 2020-11-25 11:30:24 +01:00
Sebastian Ullrich
871cd105dc feat: Syntax.updateLeading: also choose "nicer" splits 2020-11-25 11:30:24 +01:00
Sebastian Ullrich
33c1e5ed9e fix: formatter: ignore all but one choice node 2020-11-25 11:30:24 +01:00
Sebastian Ullrich
6126fd6388 chore: improve pretty printer traces, avoid recursion 2020-11-25 11:30:24 +01:00
Leonardo de Moura
1cb7cb3ef6 feat: add exists tactic 2020-11-24 16:17:43 -08:00
Leonardo de Moura
22629b3c66 feat: add headBetaMVarType 2020-11-24 16:17:27 -08:00
Leonardo de Moura
36eb03c601 chore: cleanup Check.lean 2020-11-24 16:13:52 -08:00
Leonardo de Moura
b72a3c69b6 fix: ambiguity at induction/cases
See efc3a320fe
2020-11-24 14:59:12 -08:00
Leonardo de Moura
efc3a320fe chore: prepare to fix ambiguity at induction/cases notation
@Kha I was writing the following example
```
  ...
  induction as
  | nil          => cases h -- `h` is an empty type
  | cons b bs ih => cases h
    | head a bs => exact ⟨[], ⟨bs, rfl⟩⟩
    | tail a b bs h1 => ...
```
The current `syntax` assumes the `| cons b bs ih => ...` alternative
is part of the first `cases h`. Forcing the `|` to occur in a column
>= of the corresponding `cases` is not a nice solution since it would
preven us from writing the second `cases` as I wrote it above.
That is we would have to write
```
  induction as
  | nil          => cases h -- `h` is an empty type
  | cons b bs ih =>
    cases h
    | head a bs => exact ⟨[], ⟨bs, rfl⟩⟩
    | tail a b bs h1 => ...
```
or
```
  induction as
  | nil          => cases h -- `h` is an empty type
  | cons b bs ih => cases h
                    | head a bs => exact ⟨[], ⟨bs, rfl⟩⟩
                    | tail a b bs h1 => ...
```
I think the best solution is to use `with` when we have explicit
alternatives with `|`. The new syntax is similar to `match ... with | ...`
That is, we would write
```
  ...
  induction as with
  | nil          => cases h
  | cons b bs ih => cases h with
    | head a bs => exact ⟨[], ⟨bs, rfl⟩⟩
    | tail a b bs h1 => ...
```
2020-11-24 14:33:19 -08:00
Leonardo de Moura
5585f9823f chore: cleaner structure/class syntax
@Kha I implemented the syntax for structure/class that we discussed this morning.
It is much cleaner. See new tests at `struct2.lean`.
I updated the documentation to use it.
2020-11-24 13:07:43 -08:00
Leonardo de Moura
495b6a92e9 feat: add IO.sleep ms
I am going to use it in the documentation: `Task` examples.
2020-11-24 11:27:04 -08:00
Leonardo de Moura
8f1ad0411d fix: fixes #220 and #223 2020-11-24 10:18:02 -08:00
Leonardo de Moura
5c39cd5120 chore: cleanup 2020-11-24 10:18:02 -08:00
Leonardo de Moura
ecfe590268 refactor: split Match.lean 2020-11-24 10:18:02 -08:00
Sebastian Ullrich
feedb539cd chore: import orphaned files in Lean 2020-11-24 19:16:27 +01:00
Sebastian Ullrich
50abe8352b feat: allow specifying file name with --stdin 2020-11-24 19:16:27 +01:00
Leonardo de Moura
f456e006dc chore: test instance ... where 2020-11-23 18:24:23 -08:00
Leonardo de Moura
5884b9c19a feat: add support for instance ... where
@Kha The fields are not mutually recursive yet, but it is good enough
 for writing examples in the manual.

See new test
2020-11-23 18:07:02 -08:00
Leonardo de Moura
645c1034a0 chore: reduce compilation time 2020-11-23 16:18:55 -08:00
Leonardo de Moura
be812081f4 chore: using "unbound implicit locals" 2020-11-23 13:09:02 -08:00
Leonardo de Moura
ac85650e0a feat: add optional where clause at declarations
closes #191

@Kha Note that it expands into a "let rec".
There are many other places where an optional `where`-clause is
useful. We can add them later. It is relatively easy to add support in
other places using the new helper functions
`expandWhereDeclsOpt` and `expandMatchAltsWhereDecls`
2020-11-23 12:04:51 -08:00
Leonardo de Moura
3f27d7318e chore: prepare to add where clause to declarations 2020-11-23 10:41:12 -08:00
Leonardo de Moura
b4012fdd71 chore: remove old comment that is not true anymore 2020-11-23 08:44:50 -08:00
Leonardo de Moura
cb9574b086 chore: test unboundImplicitLocals and cleanup 2020-11-22 10:33:28 -08:00