Commit graph

721 commits

Author SHA1 Message Date
Leonardo de Moura
83eaa47e0a chore: move MatchEqs 2021-08-17 21:32:32 -07:00
Leonardo de Moura
158636b8c0 feat: add spliIfGoal
TODO: remove unnecessary complexity, `MatchEqs` doesn't need all this
complexity, and we should not recurse here.
2021-08-17 21:32:32 -07:00
Leonardo de Moura
e04976614f feat: check if metavar is not assigned at simp tactics
and make sure `simpLocalDecl` does not change the goal if it didn't simplify
2021-08-17 21:32:32 -07:00
Leonardo de Moura
60d38606e7 fix: missing instantiateMVars 2021-08-17 21:32:32 -07:00
Leonardo de Moura
a5b9306e04 fix: deep recursion at contradiction 2021-08-17 21:32:32 -07:00
Leonardo de Moura
4cfbe6030f feat: add simpLocalDecl 2021-08-17 21:32:32 -07:00
Leonardo de Moura
52b52b22ef fix: to do unfold matcher applications that cannot be reduced when smartUnfolding is true
https://leanprover.zulipchat.com/#narrow/stream/270676-lean4/topic/How.20to.20WHNF.20without.20exposing.20recursors.3F
2021-08-17 21:32:32 -07:00
Leonardo de Moura
60ff468a8b feat: add simpGoal helper method
chore: rename `simpGoal?`
2021-08-17 21:32:32 -07:00
Leonardo de Moura
5a76f70bc8 feat: add optional argument discharge? to simp basic methods 2021-08-17 21:32:32 -07:00
Leonardo de Moura
571a0491ee feat: add Meta.byCases helper tactic 2021-08-16 14:58:51 -07:00
Leonardo de Moura
f59b9813fb feat: add environment extension for caching Simp.Context for splitIf 2021-08-16 13:05:01 -07:00
Leonardo de Moura
ca0c205389 feat: add registerSimpAttr 2021-08-16 09:59:58 -07:00
Leonardo de Moura
9182ebd4c1 feat: elaborate * simp argument 2021-08-15 08:02:21 -07:00
Leonardo de Moura
3c68703f39 feat: elaborate <- modifier at simp arguments 2021-08-15 07:07:58 -07:00
Leonardo de Moura
d52de3392b chore: remove workaround 2021-08-13 19:35:47 -07:00
Leonardo de Moura
a15a36b8d3 chore: cleanup Subarray instances 2021-08-13 19:29:09 -07:00
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