Commit graph

691 commits

Author SHA1 Message Date
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
Daniel Fabian
822c551aa2 test: Add a bunch of test for structural recursion on predicates. 2021-06-06 06:40:09 -07:00
Daniel Fabian
ec6f7d9bd6 feat: Implement structural recursion for inductive predicates. 2021-06-06 06:40:09 -07:00
Leonardo de Moura
37da993032 chore: remove HashableUSize instances 2021-06-02 08:48:11 -07:00
Leonardo de Moura
43812444a7 chore: Hashable => HashableUSize 2021-06-02 07:24:26 -07:00
Leonardo de Moura
6a87bba9c0 chore: mixHash => mixUSizeHash 2021-06-02 07:05:42 -07:00
Leonardo de Moura
764ccc4fb4 chore: add default value for parameter 2021-05-31 18:52:00 -07:00
Leonardo de Moura
7303761569 feat: add modifyTarget 2021-05-31 18:17:07 -07:00
Leonardo de Moura
4062dee864 fix: fixes #498 2021-05-31 15:42:13 -07:00
Leonardo de Moura
a247249880 feat: add configuration option for disabling proof irrelevance at MetaM 2021-05-27 13:37:26 -07:00
Leonardo de Moura
8b4cdcfddd chore: fix mutable variable shadowing 2021-05-22 19:24:41 -07:00
Daniel Fabian
c426a816a1 refactor: Make the non-below version of a premise in the below type for inductive predicates implicit.
Since it is always fully implied by the below version thereof, it carries no real information and shouldn't be used in pattern matching.
2021-05-22 18:09:32 -07:00
Leonardo de Moura
28b055463f fix: fixes #471 2021-05-22 15:42:52 -07:00
Leonardo de Moura
edb203ca54 fix: fixes #481 2021-05-21 20:40:26 -07:00
Leonardo de Moura
795e3a8646 chore: use "theorem" instead of "lemma" in messages 2021-05-21 20:35:23 -07:00