Commit graph

3189 commits

Author SHA1 Message Date
Leonardo de Moura
4e4194af41 feat: add autoBoundImplicit support for structure fields 2021-02-06 17:58:29 -08:00
Leonardo de Moura
023d7605fb feat: add "transitivity" to "has_loose_bvars_in_domain" 2021-02-06 17:42:38 -08:00
Leonardo de Moura
78fb026201 test: add test for issue #305
Issue #305 was fixed by previous commits submitted today for problems
exposed by the `for in` notation based on typeclasses :)

closes #305
2021-02-05 18:15:11 -08:00
Leonardo de Moura
83775b08cb fix: whnfCore not expanding delayed assignments 2021-02-05 15:14:12 -08:00
Leonardo de Moura
8c0346f00c feat: improve binrel! macro 2021-02-05 13:28:57 -08:00
Leonardo de Moura
10a10b38d8 fix: fixes #303 2021-02-05 07:53:18 -08:00
Leonardo de Moura
53539b1dff chore: use polymorphic method forIn 2021-02-04 18:13:01 -08:00
Leonardo de Moura
d494756d00 fix: inline loop 2021-02-04 17:17:51 -08:00
Leonardo de Moura
729047b5a2 feat: auto bound implicit at constructors
@Kha This commit adds auto bound implicits to constructors.
I was excited until I tried to define the `Bigstep` type again without
`autoBoundImplicitLocal`, and found small typos.
Example, I had
```
  | ifTrue  : eval σ₁ b = true  → Bigstep (c₁, σ₁) σ₂ t → Bigstep (cond b c₁ c₂, σ₁) σ₂ (t₁ + 1)
```
where `t₁` should be `t`, but the declaration was accepted. I am
wondering whether Isabelle performs some kind of sanity checking,
and/or enforces rules such as: auto-bound implicits may only be
introduced by hypotheses.
Note that this is not an issue for definitions, because the body of
the definition will probably not type check when we have this kind of
typo in the header.
Anyway, I am putting the experiment in this branch for now.
That being said, the `Bigstep` declaration is way nicer with
`autoBoundImplicitLocal`s.

Another option is to add a new option `ctorAutoBoundImplicitLocal`
that is false by default, and activates auto implicit locals for
constructors when set to true.
2021-02-02 10:18:21 -08:00
Sebastian Ullrich
b83875301a chore: move test without output
/cc @leodemoura
2021-02-02 13:37:56 +01:00
Sebastian Ullrich
dd6c291788 fix: relax eager mvar instantiation during constructor elaboration
@leodemoura: Could you double-check?
2021-02-02 13:19:15 +01:00
Leonardo de Moura
ac104213e3 test: cases-using name resolution issue 2021-02-01 13:16:19 -08:00
Sebastian Ullrich
d4dc54a724 fix: make sure to instantiate mvars in constructors 2021-02-01 12:10:26 +01:00
Leonardo de Moura
c4cfbceb71 test: div0 crash 2021-01-31 08:52:39 -08:00
Leonardo de Moura
b7a0bdb9c9 fix: Injection.lean 2021-01-30 11:58:56 -08:00
Leonardo de Moura
d71aab5dc4 fix: allow bigger ctor objects
`IR/Checker.lean` is now also checking the maximum number of fields
and scalar size
2021-01-29 18:23:38 -08:00
Leonardo de Moura
f1a0044241 fix: use previously generated sizeOf_spec lemmas to expand rhs 2021-01-27 18:14:25 -08:00
Leonardo de Moura
c47c25cf33 feat: finish sizeOf_spec lemma generation 2021-01-27 17:20:23 -08:00
Leonardo de Moura
17edc1d615 test: inductive types for testing SizeOf.lean 2021-01-27 16:26:03 -08:00
Leonardo de Moura
8b3a28dd2b test: reflection 2021-01-27 12:11:43 -08:00
Sebastian Ullrich
7e521f0105 chore: remove remaining #lang lean4 in tests 2021-01-27 14:45:31 +01:00
Sebastian Ullrich
a3a8d76e96 chore: move pp_options.cpp to Lean 2021-01-27 14:16:12 +01:00
Leonardo de Moura
2c05e78728 fix: bug at CheckAssignment 2021-01-26 16:20:41 -08:00
Leonardo de Moura
f53e83b182 feat: add options maxHeartbeats and synthInstance.maxHeartbeats 2021-01-24 17:45:50 -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
Sebastian Ullrich
8a02dfec4f feat: subsume variables under variable
/cc @leodemoura
2021-01-22 14:36:05 +01: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
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
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
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
7e0d76aff0 fix: losing local instances at assertAfter
closes #270
2021-01-15 19:30:03 -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
310a2ab6a3 feat: minimal hovers MVP 2021-01-15 13:29:22 -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
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
Leonardo de Moura
b5fdc5e364 fix: expand abbreviations at isClass? 2021-01-12 06:56:23 -08:00
Leonardo de Moura
36008271ea feat: ensure no unassigned metavariables in the declaration header when type is explicitly provided 2021-01-11 16:40:14 -08:00
Leonardo de Moura
7dec568ef6 fix: missing withDeclName 2021-01-11 06:50:55 -08:00
Leonardo de Moura
300fcc3321 fix: bug at getStuckMVar? 2021-01-11 06:43:08 -08:00
Leonardo de Moura
873634be7e feat: hierarchical InfoTree 2021-01-09 14:10:11 -08:00
Leonardo de Moura
11c7ca40c3 fix: missing case at Match.lean 2021-01-07 17:38:22 -08:00