Commit graph

705 commits

Author SHA1 Message Date
Leonardo de Moura
4b58c4cc02 refactor: instances that "hide" coercions
Example:
```
instance [CoeHTCT α β] [Add β] : HAdd α β β where
  hAdd a b := Add.add a b
```
2021-08-13 17:18:55 -07:00
Leonardo de Moura
be23709737 chore: use binop% to define ++ notation 2021-08-13 16:26:35 -07:00
Sebastian Ullrich
16026e9edd perf: restore monad instance specialization hack 2021-08-12 21:09:09 +02:00
Leonardo de Moura
63ad42ba47 refactor: move and generalize reduceProj? 2021-08-10 20:21:04 -07:00
Leonardo de Moura
16ea00586d fix: fixes #620 2021-08-10 15:06:06 -07:00
Leonardo de Moura
97664de3ee fix: diamonds with dependent fields 2021-08-09 19:01:08 -07:00
Leonardo de Moura
56c2f595c7 feat: add getFieldType 2021-08-09 19:01:08 -07:00
Leonardo de Moura
a821dcbff2 chore: enforce naming convention for theorems
see issue #402

fix: `ElabTerm.lean`
2021-08-07 12:48:38 -07:00
Leonardo de Moura
d482212a1c feat: add Meta.abstract
closes #474
2021-08-06 18:19:06 -07:00
Leonardo de Moura
3293e9ef08 chore: fix module comments, they must occur after the imports 2021-08-06 14:02:42 -07:00
Leonardo de Moura
a230fe2d06 fix: forallMetaTelescope issue
This commit incorporates the fix at PR #612, and clean up
`Meta/Basic.lean` using Lean 4 features.
2021-08-06 09:47:10 -07:00
Leonardo de Moura
84b155cfc0 chore: add docstring 2021-08-05 18:12:14 -07:00
Leonardo de Moura
bcfc927799 fix: fixes #602 2021-08-05 16:14:04 -07:00
Leonardo de Moura
789c7073dc fix: avoid eager TC synthesis at isDefEq 2021-08-05 12:09:22 -07:00
Leonardo de Moura
72e7bf4999 fix: synthPending bug 2021-08-04 20:07:06 -07:00
Leonardo de Moura
d1d7ce1839 feat: start support for strict implicit binder annotation 2021-08-03 18:42:15 -07:00
Leonardo de Moura
6e1620ca8d refactor: replace IO.Ref with the extern/export hack at MetaM 2021-08-03 11:50:57 -07:00
Daniel Selsam
6940166db4 chore: rebase and rm rawPos 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
cfb7e27b87 fix: isStructure vs isStructureLike 2021-08-02 18:54:19 -07: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
Leonardo de Moura
6e9afe1b3d feat: refine tryResolveCore
We need this refinement to be able to process the following example.

```
import Mathlib.RingTheory.Nullstellensatz
import Mathlib.PostPort.Coe

namespace MvPolynomial.Fun
open Ideal

variable {k : Type u} [instField : Field k]
variable {σ : Type v}
variable [instIAC : IsAlgClosed k] [instF : Fintype σ]

    (@Ideal.{max v u}
      (@MvPolynomial.{v, u} σ k
        (@CommRingS.toCommSemiring.{u} k
          (@EuclideanDomain.toCommRing.{u} k (@Field.toEuclideanDomain.{u} k instField))))
      (@RingS.toSemiring.{max v u}
        (@MvPolynomial.{v, u} σ k
          (@CommRingS.toCommSemiring.{u} k
            (@EuclideanDomain.toCommRing.{u} k (@Field.toEuclideanDomain.{u} k instField))))
        (@Domain.toRing.{max v u}
          (@MvPolynomial.{v, u} σ k
            (@CommRingS.toCommSemiring.{u} k
              (@EuclideanDomain.toCommRing.{u} k (@Field.toEuclideanDomain.{u} k instField))))
          (@IntegralDomain.toDomain.{max v u}
            (@MvPolynomial.{v, u} σ k
              (@CommRingS.toCommSemiring.{u} k
                (@EuclideanDomain.toCommRing.{u} k (@Field.toEuclideanDomain.{u} k instField))))
            (@MvPolynomial.integralDomain.{u, v} k σ (@Field.toIntegralDomain.{u} k instField))))))
```

This example was extracted from a failure at
```
theorem vanishing_ideal_zero_locus_eq_radical (I : Ideal (MvPolynomial σ k)) : vanishingIdeal (ZeroLocus I) = I.radical
```
2021-08-01 11:42:39 -07:00
Wojciech Nawrocki
a937fa26ba chore: fewer explicit types 2021-08-01 09:58:44 +02:00
Wojciech Nawrocki
f51b80060d feat: generic tagged Format 2021-08-01 09:58:44 +02:00
Leonardo de Moura
c6308a0f1f feat: add support for kernel projections to DiscrTree 2021-07-29 16:59:47 -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
c08ce69a51 refactor: break DiscrTree -> WHNF dependency
Motivation: we want to use `whnfCore` at `DiscrTree.lean`
2021-07-29 15:26:35 -07:00
Leonardo de Moura
ad216db08d chore: add Repr instance for Literal and Key 2021-07-29 09:34:55 -07:00
Leonardo de Moura
16d803c0b3 chore: update comment 2021-07-28 17:18:41 -07:00
Leonardo de Moura
49a87ceb4d feat: add basic isDefEq cache 2021-07-28 16:29:44 -07:00
Leonardo de Moura
6d05daf73b feat: add flag for allowing synthetic opaque mvars to be assigned at isDefEq
See issue #492
TODO: add a mechanism for detecting new metavariables.
2021-07-27 17:58:08 -07:00
Leonardo de Moura
8c12a264ee fix: offset support at isDefEq should not use HAdd.hAdd
fixes #550
2021-07-27 16:16:03 -07:00
Leonardo de Moura
8a98987e26 chore: use isDefEq heuristic on regular definitions only 2021-07-26 07:11:55 -07:00
Leonardo de Moura
cce6165d4e perf: refine tryHeuristic 2021-07-23 12:04:11 -07:00
Leonardo de Moura
0d9c5f5bb8 chore: use zeta expansion at AbstractNestedProofs module 2021-07-23 11:48:59 -07:00
Leonardo de Moura
1630cd3eb5 chore: missing argument 2021-07-23 11:37:28 -07:00
Leonardo de Moura
a6af257b7a fix: missing condition 2021-07-21 07:36:35 -07:00
Formally Verified Waffle Maker
c5ffcc5dd6 refactor: remove redundant condition 2021-07-21 09:39:58 +02:00
Leonardo de Moura
f4a7ffd8c8 chore: fix codebase and tests 2021-06-29 17:14:52 -07:00
Leonardo de Moura
818efe719e fix: fixes #533 2021-06-29 15:20:46 -07:00
Sebastian Ullrich
9f7af2b77b doc: document a few tactics 2021-06-29 06:35:45 -07:00
Gabriel Ebner
3cff5ceb99 perf: make trace[...] ... notation lazy 2021-06-23 00:07:27 -07:00
Sebastian Ullrich
eb1e285e26 chore: style 2021-06-21 10:17:26 -07:00
Sebastian Ullrich
380c6c285a perf: specialize some monad instances 2021-06-17 11:25:58 +02:00
Leonardo de Moura
a435f3d641 feat: reduce s.1 =?= v to s =?= ⟨v⟩ if structure has a single field
This feature was suggested by @dselsam at PR #521.
It closes #509
2021-06-11 11:23:19 -07:00
Gabriel Ebner
94e299a730 fix: instantiate mvars in rewrite tactic 2021-06-11 10:27:05 -07:00
Daniel Fabian
9200de01ef refactor: fix code review comments. 2021-06-06 06:40:09 -07:00
Daniel Fabian
968ae18f20 fix: deal with params for inductive predicates. 2021-06-06 06:40:09 -07:00
Daniel Fabian
4e53b3bdbf fix: use motive from brecOn in structural recursion for predicates. 2021-06-06 06:40:09 -07:00
Daniel Fabian
4e88fdc99a feat: add getMkMatcherInputInContext. 2021-06-06 06:40:09 -07:00