Commit graph

3425 commits

Author SHA1 Message Date
Leonardo de Moura
61b3e6bcb8 fix: reduce projections of expanded structures at copyDefaultValue? 2021-08-10 20:50:59 -07:00
Leonardo de Moura
0623bb3860 feat: update fieldMap with composite field 2021-08-10 20:04:41 -07:00
Leonardo de Moura
ae03f15c92 test: default value set at copied structure 2021-08-10 19:00:34 -07:00
Leonardo de Moura
3b1285bee8 feat: process overriden default values in copied parents 2021-08-10 18:55:12 -07:00
Leonardo de Moura
295cae8afd feat: copy field default values
Only basic examples are working. We still have many TODOs
2021-08-10 16:53:10 -07:00
Leonardo de Moura
972f00b0ff fix: pending metavariable issue
It fixes issue reported at https://leanprover.zulipchat.com/#narrow/stream/270676-lean4/topic/let.20overload
2021-08-10 14:52:53 -07:00
Leonardo de Moura
bc26a9b527 feat: improve copyNewFieldsFrom 2021-08-10 09:08:35 -07:00
Leonardo de Moura
9e5998baf0 feat: register instance/reducible attribute for structuer diamond coercions 2021-08-10 07:16:59 -07:00
Leonardo de Moura
a0bd964255 test: overriding default value of private field 2021-08-09 19:01:08 -07:00
Leonardo de Moura
3f3e5d9dcb fix: private field + default value bug 2021-08-09 19:01:08 -07:00
Daniel Selsam
0118c47117 refactor: separate pp.funBinderTypes and pp.piBinderTypes 2021-08-09 16:13:40 +02:00
Leonardo de Moura
1d9d8c7e75 chore: fix tests
close #402
2021-08-07 13:22:58 -07:00
Leonardo de Moura
a863f1b8a3 fix: fixes #616 2021-08-07 07:29:54 -07:00
Leonardo de Moura
8acbb55632 chore: fix tests 2021-08-06 14:05:00 -07:00
Leonardo de Moura
76cc99179d fix: fixes #370 2021-08-06 12:52:23 -07:00
Daniel Selsam
34a27f2d56 fix: pp.analyze strict implicits 2021-08-06 17:02:00 +02:00
Leonardo de Moura
bcfc927799 fix: fixes #602 2021-08-05 16:14:04 -07:00
Leonardo de Moura
4dbb3e6db1 fix: add workaround to prevent code explosion at deriving for FromJson
fixes #569
2021-08-05 06:58:07 -07:00
Wojciech Nawrocki
1b44768697 chore: fix test 2021-08-05 06:27:57 -07:00
Wojciech Nawrocki
3bbf19a404 feat: FromToJson for nested inductives 2021-08-05 06:27:57 -07:00
Leonardo de Moura
72e7bf4999 fix: synthPending bug 2021-08-04 20:07:06 -07:00
Daniel Selsam
d56db0a22d doc: pp.analyze one more comment about a failure 2021-08-03 09:13:18 +02:00
Daniel Selsam
2afc18323d doc: pp.analyze a few comments about failures 2021-08-03 09:13:18 +02:00
Daniel Selsam
d6253e091b fix: pp.analyze _s when forced explicit 2021-08-03 09:13:18 +02:00
Daniel Selsam
ea6fca24c2 refactor: pp.analyze StateT for analyzeApp 2021-08-03 09:13:18 +02:00
Daniel Selsam
aefd31b2a2 feat: better bottom-up/structure-type heuristics 2021-08-03 09:13:18 +02:00
Daniel Selsam
4c41142a61 chore: pp.analyze new test cases 2021-08-03 09:13:18 +02:00
Daniel Selsam
8dd8aea9c1 chore: new tests 2021-08-03 09:13:18 +02:00
Daniel Selsam
44f1f4e410 refactor: pp.analyze needs pp options 2021-08-03 09:13:18 +02:00
Daniel Selsam
48d5c0d2a6 chore: pp.proofs defaults to false 2021-08-03 09:13:18 +02:00
Daniel Selsam
a84291641b fix: pp.analyze restriction on _ 2021-08-03 09:13:18 +02:00
Daniel Selsam
702211db2a feat: pp.analyze detect when struct-inst type needed 2021-08-03 09:13:18 +02:00
Daniel Selsam
3bef119136 fix: pp.analyze missing inBottomUp 2021-08-03 09:13:18 +02:00
Daniel Selsam
4b57bc26b3 chore: rm stale test 2021-08-03 09:13:18 +02:00
Daniel Selsam
3309da8f1e fix: pp.analyze LocalInstances not in MessageData 2021-08-03 09:13:18 +02:00
Daniel Selsam
b3bb82ee7e feat: turn more delaborators into unexpanders 2021-08-03 09:13:18 +02:00
Daniel Selsam
a96a043618 feat: better coe support 2021-08-03 09:13:18 +02:00
Daniel Selsam
50d67e77ac fix: type ascriptions 2021-08-03 09:13:18 +02:00
Daniel Selsam
eed0fb6635 feat: special support for 'fun x => x' 2021-08-03 09:13:18 +02:00
Daniel Selsam
811bb56d10 fix: never set a negation 2021-08-03 09:13:18 +02:00
Daniel Selsam
e84a5ac432 fix: @ when there are inaccessible names 2021-08-03 09:13:18 +02:00
Daniel Selsam
280a3db653 fix: only print named patterns inside patterns 2021-08-03 09:13:18 +02:00
Daniel Selsam
d2ff2de4f6 feat: add @ to consts/locals with pi {..} type 2021-08-03 09:13:18 +02:00
Daniel Selsam
1c6cdceb64 refactor: simplify pp.analyze options 2021-08-03 09:13:18 +02:00
Daniel Selsam
89364b802b feat: top-down heuristic delaboration 2021-08-03 09:13:18 +02:00
Leonardo de Moura
bba9353619 fix: make sure isDefEqOffset does not expose kernel nat literals
This issue is similar to a bug where `isDefEqOffset` was exposing
`Nat.add` when processing `HAdd.hAdd`.

Fixes #561
The example at issue #561 is now working, but we may have other places
where raw literals are being accidentally exposed.
2021-08-02 11:27:00 -07:00
Wojciech Nawrocki
d2e23ff5cf fix: deriving RpcEncoding 2021-08-01 09:58:44 +02:00
Sebastian Ullrich
2833c61a60 fix: respect preresolved names at resolveConst*
This makes sure we can properly quote e.g. `deriving` clauses and avoids
a suspicious `eraseMacroScopes` call (though not at `Elab.Syntax`, since
categories do not have to be declaration names)
2021-07-30 07:17:50 -07:00
Leonardo de Moura
b25bb78e2a feat: improve DiscrTree
Try to improve the performance issue described at #587.

The issue is that Mathlib contains thousands of theorems where the
associated key for the discrimination tree is just
`Key.other`. The indexing is not effective for them. This happens because

1- Lambda expressions are indexed using `Key.other`. The
   discrimination tree mainly focus on the first-order structure.

2- It unfolds reducible constants when inserting and retrieving
   entries. The motivation is that users expect simp theorems to fire
   modulo reducible constants.

Then, we have many theorems such as
```lean
map ?g ∘ map ?f = map (?g ∘ ?f)
```
when we expand the function composition on the left-hand side, we get
```lean
fun (x : List ?α) => map ?g (map ?f x)
```
Which is indexed as `Key.other`.

We should not avoid the `Array`s in the discrimination tree nodes
If the index is working effectively, these arrays are all very small.

In this commit, we try to address the problem by using a different
approach. When processing the root of a pattern, we interrupt
reduction as soon as the we hit something that would be indexed
as `Key.other`. Note that, in Lean 3, the root of a pattern also
receives special treatment.
2021-07-29 16:08:26 -07:00
Leonardo de Moura
49a87ceb4d feat: add basic isDefEq cache 2021-07-28 16:29:44 -07:00