Commit graph

6279 commits

Author SHA1 Message Date
Leonardo de Moura
2c05e78728 fix: bug at CheckAssignment 2021-01-26 16:20:41 -08:00
Leonardo de Moura
31680c1255 fix: do not evaluate code containing sorry
closes #277
2021-01-26 15:01:53 -08:00
Leonardo de Moura
9d0edab6c3 chore: add issue 297 examples
The stack overflow reported on this issue has already been fixed.

closes #297
2021-01-26 08:07:41 -08:00
Sebastian Ullrich
1945ebd275 feat: delaborate sorryAx 2021-01-26 12:08:25 +01:00
Leonardo de Moura
f27ae71231 chore: fix test 2021-01-25 17:22:20 -08:00
Leonardo de Moura
d408c835d2 fix: defaultInstance priorities for Neg Int and OfScientific Float 2021-01-25 13:21:07 -08:00
Leonardo de Moura
b575087859 fix: unfold class projections when using TransparencyMode.instances 2021-01-25 12:30:26 -08:00
Leonardo de Moura
f53e83b182 feat: add options maxHeartbeats and synthInstance.maxHeartbeats 2021-01-24 17:45:50 -08:00
Sebastian Ullrich
446f953461 feat: allow hygienic capture of section variables in quotations 2021-01-24 11:46:04 -08:00
Leonardo de Moura
51de663e2c fix: crash when using TransparencyMode.instances 2021-01-22 14:17:19 -08:00
Leonardo de Moura
8f028a41ae fix: eta-expanded term at levelMVarToParam
This issue produced a nested inductive datatype that could not be
handled by the kernel. See new test.

Without the fix, the inductive declaration contained the term
```
 ((fun α {n : Nat} (t : Vec α n) => ...) Expr n x)
```
The nested occurrence `Vec Expr n` only becomes explicit after
beta-reduction.
2021-01-22 14:17:19 -08:00
Wojciech Nawrocki
d9c6a992b5 feat: specify version in waitForDiagnostics 2021-01-22 18:02:31 +01:00
Sebastian Ullrich
8a02dfec4f feat: subsume variables under variable
/cc @leodemoura
2021-01-22 14:36:05 +01:00
Leonardo de Moura
7ae861f6bd test: simplify 2021-01-21 18:32:23 -08:00
Leonardo de Moura
d6eb5a9ff2 feat: generate sizeOf equality lemmas for constructors
TODO: support for nested inductive types.
2021-01-21 17:44:15 -08:00
Leonardo de Moura
c78a06d9a5 test: add Kyle's experiment to test suite 2021-01-21 10:35:22 -08:00
Leonardo de Moura
0bce549d92 test: remove code that is being generated automatically 2021-01-21 10:35:22 -08:00
Leonardo de Moura
1abd36dc0d test: sizeOf 2021-01-20 18:14:52 -08:00
Leonardo de Moura
ea0fda39bc chore: Declaration.lean naming convention
`Declaration.lean` was one of the first Lean 4 files, and was still
using an old naming convention.

cc @Kha
2021-01-20 17:07:02 -08:00
Leonardo de Moura
21812541ea fix: solve method at isLevelDefEq
closes #283
2021-01-20 08:36:26 -08:00
Sebastian Ullrich
a9f96ace3e chore: naming 2021-01-20 16:48:50 +01:00
Sebastian Ullrich
79107a2316 feat: copy & store whole ref range in SourceInfo 2021-01-20 16:48:50 +01:00
Leonardo de Moura
e57a9fa78f fix: fixes #280
We are going to use a cleaner fix when we port this code to Lean.
2021-01-19 18:01:52 -08:00
Leonardo de Moura
c1bc0e44f6 fix: fixes #281
This issue exposed two bugs at `Structural.lean`

1- `getFixedPrefix` was using structural equality to detected fixed
arguments. We should use definitional equality.

2- The `replaceFVars` was broken. We should use `instantiateForall` instead.
2021-01-19 18:01:52 -08:00
Leonardo de Moura
1e7380a1f7 fix: fixes #282 2021-01-19 18:01:52 -08:00
Leonardo de Moura
67e5b05751 chore: fix test 2021-01-19 13:29:19 -08:00
Sebastian Ullrich
e5c485ff45 feat: incremental progress notification while compiling dependencies 2021-01-19 19:06:01 +01:00
Sebastian Ullrich
c63e85a0f1 test: playground for print-path 2021-01-19 19:06:01 +01:00
Leonardo de Moura
dc142cff13 test: sizeOf experiments 2021-01-18 17:21:03 -08:00
Leonardo de Moura
f1ed13efff feat: improve elabMatchAux
We now (try to) postpone `match ... with` elaboration when pattern
variables and patterns still contain metavariables before invoking `mkMatcher`.

This improvement makes sure we can elaborate an example submitted by
Daniel Selsam.

Remark: this update may create performance problems since we
backtrack `elabMatchTypeAndDiscrs` and `elabMatchAltView`.
We hope this is not a problem in practice since we use the "quick-check"
`waitExpectedTypeAndDiscrs`. Recall that we could compile Lean
without this commit. So, it suggests cases where we need to postpone
after `elabMatchAltView` are rare.
2021-01-18 15:33:48 -08:00
Leonardo de Moura
711d1754a6 chore: improve error message
closes #276
2021-01-17 07:51:08 -08:00
Leonardo de Moura
eb25b97501 fix: pattern variables cannot shadow each other 2021-01-16 08:23:45 -08:00
Leonardo de Moura
7e0d76aff0 fix: losing local instances at assertAfter
closes #270
2021-01-15 19:30:03 -08:00
Leonardo de Moura
f73eb1246a feat: add pp.safe_shadowing
When `pp.safe_shadowing` is set to true, we still use the
suggested name if the "body" does not contain a free variable with the
suggested name. This is the approach used in Lean 3, and I think it
improved the result in all affected tests.
The implementation was simple. The only nasty case was `delabAppMatch`.

The main motivation for this feature was hovering information such as
```lean
f : {α_1 : Type} → α_1 → α_1
```
when hovering over the `f` at
```lean
def g (α : Type) (a : α) :=
  f a
```
With `safe_shadowing`, we get the nicer
```lean
f : {α : Type} → α → α
```

cc @Kha
2021-01-15 18:53:25 -08:00
Leonardo de Moura
dcc2283426 fix: refineCore
closes #269
2021-01-15 17:03:40 -08:00
Leonardo de Moura
58d51bc764 feat: add FieldInfo 2021-01-15 15:01:45 -08:00
Wojciech Nawrocki
f3ab908888 fix: substring APIs 2021-01-15 13:29:22 -08:00
Wojciech Nawrocki
310a2ab6a3 feat: minimal hovers MVP 2021-01-15 13:29:22 -08:00
Leonardo de Moura
223a5d5ded fix: bug at isDefEqOffset
closes #268
2021-01-15 13:08:37 -08:00
Leonardo de Moura
ae60360d7a feat: add resolveName' which produces Syntax with position information for each field 2021-01-15 11:19:01 -08:00
Sebastian Ullrich
d7fe05b29d chore: script to copy .produced.out ~> .expected.out 2021-01-15 16:27:59 +01:00
Sebastian Ullrich
b2b78eb222 test: use printMessageEndPos for leantests 2021-01-15 16:27:59 +01:00
Andrew Kent
4f6bb1feb6
feat: add Float.ofInt 2021-01-15 15:45:28 +01:00
Leonardo de Moura
6a39c65bd2 feat: improve match error message 2021-01-14 14:58:34 -08:00
Leonardo de Moura
d2cdef85ea chore: fix tests 2021-01-14 14:25:41 -08:00
Leonardo de Moura
791388400b feat: improve do error messages
cc @Kha @Vtec234
2021-01-14 14:18:56 -08:00
Leonardo de Moura
25c9727a92 feat: add TermInfo for LVal
@Vtec234 Added the missing info.
Given
```lean
def f3 (s : Nat × Array (Array Nat)) : Array Nat :=
  s.2[1].push s.1
```
We produce the following `InfoTree` for the body (originally at line 30)
```
Array.push (Array.getOp s.snd 1) s.fst : Array Nat @ ⟨30, 2⟩-⟨30, 17⟩
  s : Nat × Array (Array Nat) @ ⟨30, 2⟩-⟨30, 3⟩
  Prod.snd : {α β : Type} → α × β → β @ ⟨30, 4⟩-⟨30, 5⟩
  Array.getOp : {α : Type} → [inst : Inhabited α] → Array α → Nat → α @ ⟨30, 5⟩-⟨30, 6⟩
  1 : Nat @ ⟨30, 6⟩-⟨30, 7⟩
  Array.push : {α : Type} → Array α → α → Array α @ ⟨30, 9⟩-⟨30, 13⟩
  s.fst : Nat @ ⟨30, 14⟩-⟨30, 17⟩
    s : Nat × Array (Array Nat) @ ⟨30, 14⟩-⟨30, 15⟩
    Prod.fst : {α β : Type} → α × β → α @ ⟨30, 16⟩-⟨30, 17⟩
```
2021-01-14 12:19:21 -08:00
Leonardo de Moura
fb52ec8ef5 feat: store binder information in the InfoTree
@Vtec234 I am storing the binder information using `TermInfo`.
If it helps, I can add a custom `Info` constructor.
Example: `| Info.ofBinderInfo (i : BinderInfo)`.
2021-01-14 12:19:21 -08:00
Leonardo de Moura
e5b93783b0 test: TC issue repro 2021-01-13 18:41:01 -08:00
Leonardo de Moura
6e3792e995 chore: fix tests 2021-01-13 18:31:50 -08:00