Commit graph

607 commits

Author SHA1 Message Date
Daniel Fabian
eda4bdd337 test: extend inductive_pred.lean with tests using the new construction. 2021-04-25 20:02:22 -07:00
Daniel Fabian
371504e9cf feat: add ProofBelow construction for inductive predicates.
This construction allows us to define `brecOn` for inductive predicates.
2021-04-25 20:02:22 -07:00
Leonardo de Moura
675bebb446 fix: isLevelDefEq missing case 2021-04-25 10:27:14 -07:00
Leonardo de Moura
d68d1f0841 fix: fixes #423 2021-04-25 10:00:38 -07:00
Leonardo de Moura
030f53fa43 fix: closes #421
The unifier used to implement the `cases` tactic should not discard
equations of the form `x = t` and `t = x` using proof irrelanvance.
The new test demonstrates the issue. The unifier was reaching the
state
```
x : Conw Con.nil
|- x = Conw.nilw -> x = Conw.nilw
```
and discarding the equality instead of substituting `x`
because `x` and `Conw.nilw` are definionally equal due to
proof irrelevance.

@javra Do you have more complicated examples that were being
affected by this issue?
2021-04-23 12:27:39 -07:00
Leonardo de Moura
3a80e87793 chore: #405 step 1 2021-04-22 20:03:48 -07:00
Leonardo de Moura
157ef80c5a feat: match auto generalization 2021-04-16 21:48:38 -07:00
Leonardo de Moura
aaa072cf21 feat: add withNewBinderInfos 2021-04-16 09:59:40 -07:00
Daniel Fabian
cb18af6184 feat: add withLocalDecls and withLocalDeclsD
They are array versions of `withLocalDecl` and `withLocalDeclD`, respectively. They are useful when you need to create variables dynamically.
2021-04-16 07:54:04 -07:00
Leonardo de Moura
555b978d67 refactor: add GeneralizeVars.lean
Helper methods for performing auto generalization.
2021-04-15 21:37:48 -07:00
Leonardo de Moura
dbc84c502c chore: make sure we don't lift methods over binders 2021-04-15 12:06:46 -07:00
Leonardo de Moura
484a3a4e7c fix: should only cache inferred type when there are no metavars 2021-04-11 19:10:41 -07:00
Leonardo de Moura
2694e7798a refactor: add MonadBacktrack
The new class specifies an interface for saving and restoring the
backtrackable part of the state.
This commit also fixes a few issues.

- `commitWhen` at `LevelDefEq` was defining a checkpoint for
  the `isDefEq` methods, and it affects how postponed universe
  constraints are handled. However, the name suggests it is
  similar to `commitWhenSome?`, and consequently it was used
  in other places that had nothing to do with `isDefEq`.
  So, I renamed it, and provided the generic `commitWhen` at the new
  `MonadBacktrack.lean` file.

- We were restoring more state then needed in a few places.
  For example, we were discarding all caches.

- At `SyntheticMVars.lean`, we were using the `Meta.commitWhenSome?`
  method which does not restore the `Term.State`.
2021-04-11 19:10:41 -07:00
Leonardo de Moura
e56bf66d8d chore: rename option hygienicIntro ==> tactic.hygienic
It is easier to find.
2021-04-10 16:09:04 -07:00
Leonardo de Moura
6dbf227cf2 fix: issues #387 part 2
see #387
2021-04-10 15:51:07 -07:00
Leonardo de Moura
91cb4aad2a refactor: simplify and document SimpLemma encoding 2021-04-10 15:03:04 -07:00
Leonardo de Moura
4f09390b8e feat: create SimpLemmas.Proof.abst at the simp tactic frontend 2021-04-10 14:17:43 -07:00
Leonardo de Moura
8be9a13679 feat: support for SimpLemma.Proof.abst 2021-04-10 12:46:48 -07:00
Leonardo de Moura
a1205afac2 feat: allow simp lemmas to be AbstractMvarsResult 2021-04-10 11:37:39 -07:00
Sebastian Ullrich
1b1ac393d8 fix: do not try to pretty-print unknown metavariables
Fixes #380
2021-04-08 18:16:05 +02:00
Leonardo de Moura
0a94aaabc9 feat: use expected type to prioritize completion candidates 2021-04-03 14:12:42 -07:00
Leonardo de Moura
9d45ea6721 feat: try to improve dependent pattern matching failure error message 2021-03-30 23:40:11 -07:00
Leonardo de Moura
41539a7725 fix: leftovers in the local context when applying induction 2021-03-27 19:42:22 -07:00
Leonardo de Moura
566fad77d4 chore: helper methods 2021-03-27 18:48:03 -07:00
Leonardo de Moura
b899447817 refactor: move collectFVars to Meta 2021-03-26 19:16:21 -07:00
Leonardo de Moura
f20fc6328c fix: better error message when cases fails and there are no alternatives 2021-03-26 16:28:21 -07:00
Leonardo de Moura
dd9cc7a273 fix: typo 2021-03-25 15:57:10 -07:00
Leonardo de Moura
083301e286 fix: non-dependent arrow vs dependent arrow issue at DiscrTree 2021-03-25 13:04:24 -07:00
Leonardo de Moura
b7acc38810 feat: add support for "arrow" at DiscrTree 2021-03-25 12:21:10 -07:00
Leonardo de Moura
ce1dda8eea fix: missing withMVarContext 2021-03-24 18:25:41 -07:00
Leonardo de Moura
650c6df380 feat: try other variables after failure 2021-03-22 21:02:26 -07:00
Leonardo de Moura
17907a7829 fix: perform topological sort on pattern variables 2021-03-22 20:35:07 -07:00
Leonardo de Moura
3749213e08 fix: missing whnf at Unify.unify 2021-03-21 22:38:46 -07:00
Leonardo de Moura
2fd0b8c663 feat: contradiction catches empty inductive types 2021-03-21 21:48:43 -07:00
Leonardo de Moura
3d6154f147 fix: contradiction
It must ignore auxiliary declarations.
2021-03-21 20:05:15 -07:00
Leonardo de Moura
123783d5f9 fix: some issues at cases and subst 2021-03-21 18:35:31 -07:00
Leonardo de Moura
880f1372bd feat: set pp.inaccessibleNames true when visualizing tactic state
@Kha The default value (false) for `pp.inaccessibleNames == false` help when
visualizing error messages (see test
`hidingInaccessibleNames.lean`). We added this feature after to hide
intermediate variables created by `match_syntax`.
However, this default value confused me in tactic mode. For example,
it will hide a hypotheses `x : Fin 0` if nobody depends on it, but as
a user we want to know we have it since we can close the goal using
it. Thus, I added `withPPInaccessibleNames act`, it executes `act`
using `pp.inaccessibleNames true` if the user did not explicitly set
it. I use this combinator at `FileWorker` and when producing the
`unsolved goals` error message. In all other scenarios, I believe
hiding these inaccessible variables is a good thing.
2021-03-21 18:21:46 -07:00
Leonardo de Moura
d9273786c7 chore: remove when and «unless»
They are obsolete.

cc @Kha
2021-03-20 18:52:18 -07:00
Sebastian Ullrich
2f168e3364 feat: mkConstWithLevelParams 2021-03-20 08:28:18 -07:00
Leonardo de Moura
86a204d8a1 feat: add simp_all tactic
cc @Kha
2021-03-19 22:34:35 -07:00
Leonardo de Moura
d70740fef2 fix: location notation and simp 2021-03-19 19:54:22 -07:00
Leonardo de Moura
94465e8a02 feat: add helper simp methods 2021-03-19 14:11:15 -07:00
Leonardo de Moura
da8e5150c9 feat: add getNondepPropHyps 2021-03-18 14:25:50 -07:00
Leonardo de Moura
dd8ead186f feat: allow caller to set lemma id 2021-03-18 14:25:16 -07:00
Leonardo de Moura
1af02dcaca feat: allow users to mark definitions with [simp]
cc @JasonGross @Kha
2021-03-17 19:11:55 -07:00
Leonardo de Moura
3208faa192 feat: add set of declarations to unfold at SimpLemmas 2021-03-17 18:52:23 -07:00
Leonardo de Moura
5eda786f6e feat: use False.elim when simplifying local declarations that rewrite to False 2021-03-17 15:30:54 -07:00
Leonardo de Moura
89797c4485 chore: improve congrDefault
We don't need `congrMatch` anymore.
2021-03-16 15:59:11 -07:00
Leonardo de Moura
8227d3afcd feat: support for simplifying match discriminants 2021-03-16 15:51:36 -07:00
Leonardo de Moura
2970c6ca79 feat: add mkCongrDepArg and mkCongrDep 2021-03-16 15:40:48 -07:00