Commit graph

7543 commits

Author SHA1 Message Date
Leonardo de Moura
e53435979f fix: remove hacky addAutoBoundImplicitsOld 2022-03-25 09:23:43 -07:00
Leonardo de Moura
6631d92d7b fix: addAutoBoundImplicitsOld occurrences at MutualDef.lean and Structure.lean
This commit also fixes non-termination at `collectUnassignedMVars`
2022-03-25 09:07:59 -07:00
Leonardo de Moura
e48cc8901e fix: add new addAutoBoundImplicits that avoids the hack at addAutoBoundImplicitsOld 2022-03-25 08:40:57 -07:00
Leonardo de Moura
370e9c421f fix: bug at deriving Hashable 2022-03-24 18:46:10 -07:00
Leonardo de Moura
fdbe893c40 fix: catch mkAppM exceptions 2022-03-23 17:35:04 -07:00
Leonardo de Moura
9d32d7bcf5 test: for issue #1062
closes #1062
2022-03-22 14:14:28 -07:00
Leonardo de Moura
6007147d71 fix: allow universes to be postponed further
closes #1058
2022-03-22 13:57:58 -07:00
Mario Carneiro
c29da66c5a
fix: annotate binders in intro for hover / go to def 2022-03-22 12:10:51 +00:00
Leonardo de Moura
3d9e587862 fix: check type mismatch at dependent pattern matching compiler
see issue #1057
2022-03-21 09:28:02 -07:00
Leonardo de Moura
9944feb095 test: use [reducible] 2022-03-21 07:39:44 -07:00
Leonardo de Moura
3a75cf1920 test: nested inductives 2022-03-21 05:57:02 -07:00
Leonardo de Moura
321d6b0e67 feat: support for user-defined simp attributes in the simp tactic.
See `RELEASES.md`

TODO: make sure `-thm` also removes `thm` from user-defined simp attributes.
2022-03-20 18:45:57 -07:00
Leonardo de Moura
a2690d5278 feat: improve #eval command 2022-03-20 15:18:47 -07:00
Leonardo de Moura
7b1091770c test: Repr for HList 2022-03-20 15:05:34 -07:00
Leonardo de Moura
6d926c7989 feat: macro expand match alternatives
see #371

This commit does not implement all features discussed in this issue.
It has implemented it as a macro expansion. Thus, the following is
accepted
```lean
inductive StrOrNum where
  | S (s : String)
  | I (i : Int)

def StrOrNum.asString (x : StrOrNum) :=
  match x with
  | I a | S a => toString a
```
It may confuse the Lean LSP server. The `a` on `toString` shows the
information for the first alternative after expansion (i.e., `a` is an `Int`).
After expansion, we have
```
def StrOrNum.asString (x : StrOrNum) :=
  match x with
  | I a => toString a
  | S a => toString a
```
2022-03-20 14:20:13 -07:00
Leonardo de Moura
51ee6fe4f1 chore: fix test 2022-03-20 13:27:19 -07:00
Leonardo de Moura
87bb299f08 feat: add Iterator.atEnd 2022-03-20 11:40:46 -07:00
Leonardo de Moura
3862e7867b refactor: make String.Pos opaque
TODO: this refactoring exposed bugs in `FuzzyMatching` and `Lake`

closes #410
2022-03-20 10:47:13 -07:00
Jakob von Raumer
a91f92c11e feat: allow constants to be type classes
There no reason against constants to be type classes so it is just the check in `addClass` that is needed to be modified.

Closes #1054
2022-03-20 08:03:34 -07:00
Leonardo de Moura
1b357db3b0 fix: nasty bug at findDeclarationRangesCore?
We must search the environment extension first, and then the builtin
table. Otherwise, the builtin declarations do not change when we
modify the files.

closes #1021
2022-03-19 16:53:22 -07:00
Leonardo de Moura
ed7c8904a9 fix: propagate local and scope modifiers at elab_rules
closes #1039
2022-03-19 16:08:06 -07:00
E.W.Ayers
d954706fcf feat: ApplyNewGoals config for apply
Lean.Meta.Tactic.apply now accepts an ApplyConfig argument.
`apply` now changes which metavariables are stored with choice
of the newGoals config.
This allows one to implement `fapply` and `eapply`.
An example of this is given in tests/lean/run/apply_tac.lean.

Closes #1045
2022-03-19 15:51:40 -07:00
Leonardo de Moura
4f318d3304 test: use dot notation in the example 2022-03-19 10:39:58 -07:00
Leonardo de Moura
d1eb180aae test: add non mutually recursive version 2022-03-19 10:38:39 -07:00
Leonardo de Moura
bdb2e9597a chore: naming convention 2022-03-19 10:20:42 -07:00
Leonardo de Moura
6c8322d20a test: use builtin Char.isDigit and Char.toNat 2022-03-19 10:18:34 -07:00
Leonardo de Moura
a8ddb56e0e chore: cleanup David's example 2022-03-19 10:13:27 -07:00
Leonardo de Moura
c95d5f25a3 feat: convert ites into dites in the WF module
Motivation: the condition is often used in termination proofs.
2022-03-19 10:11:50 -07:00
Leonardo de Moura
c7cdbf8ff8 feat: improve auto generated termination_by a bit 2022-03-19 09:28:19 -07:00
Leonardo de Moura
64c5cda612 test: David's lex with string iterators 2022-03-19 09:15:29 -07:00
Leonardo de Moura
9722aeaf32 feat: use String.Iterator.sizeOf_next_lt in the builtin decreasing_tactic 2022-03-19 09:04:40 -07:00
Leonardo de Moura
fa74194638 fix: missing s.restore at expandTacticMacroFns 2022-03-19 08:34:54 -07:00
Leonardo de Moura
4ac88d0eb8 test: lex example from David 2022-03-18 19:53:17 -07:00
Leonardo de Moura
3193acecfa fix: flush the CoreM and MetaM caches at modifyEnv
This fix may impact performance. Note that we don't need to flush the
cache if we are "adding" stuff to the environment. We only need to
flush the caches if the change is not monotonic. BTW, most of the
changes are monotonic. I think this is why we did not hit this bug before.

We may also move all these caches to an environment extension. It is
an easy way to make sure we preserve the cache when extending the
environment.

I tried a few benchmarks and did not notice a significant difference.

cc @kha @gebner

fixes #1051
2022-03-17 16:02:30 -07:00
Leonardo de Moura
184b0b8e8d feat: improve "result types must be in the same universe level" error message
The new error message makes it clear why the definition is not accepted.

See issue #1050
2022-03-17 07:41:37 -07:00
Daniel Fabian
cf4e873974 feat: support Sort u in ac_refl. 2022-03-16 17:21:20 -07:00
Daniel Fabian
d667d5ab5d feat: rewrite the tactic using simp as the basis. 2022-03-16 17:21:20 -07:00
Daniel Fabian
ed63274874 refactor: move ac_refl syntaxt to Init/Notation 2022-03-16 17:21:20 -07:00
Daniel Fabian
73a59e5bc4 feat: use simp instead of rewrite inside of ac_refl 2022-03-16 17:21:20 -07:00
Daniel Fabian
84f72b9389 test: add further ac_refl tests. 2022-03-16 17:21:20 -07:00
Daniel Fabian
a60220b036 feat: add tactic for ac_refl. 2022-03-16 17:21:20 -07:00
Leonardo de Moura
4320a61f4d chore: use Prod notation in test 2022-03-16 17:14:16 -07:00
Leonardo de Moura
50813429b8 fix: add expected type hint
Other tactics (e.g., `simp_all`) may try to infer the type of the
proof, and `Nat.Linear.eq_of_toNormPoly_eq` has a messy resulting type.
2022-03-16 17:07:22 -07:00
Sebastian Ullrich
4fd520e902 feat: generalize inferred namespace notation to functions 2022-03-16 23:40:05 +01:00
Leonardo de Moura
68154a6c69 test: add Pos view 2022-03-16 10:08:43 -07:00
Leonardo de Moura
05a2778b0d fix: ensure explicit pattern variables provided by the uses are indeed pattern variables 2022-03-16 07:50:29 -07:00
Leonardo de Moura
d6de53a7aa perf: custom splitAnd 2022-03-15 16:59:11 -07:00
Leonardo de Moura
49e33fdb23 chore: fix tests 2022-03-15 11:35:47 -07:00
Leonardo de Moura
aa68057c85 chore: more general type universes in example 2022-03-15 05:19:02 -07:00
Leonardo de Moura
4e261b15e5 fix: smart unfolding bug in over applications 2022-03-14 19:17:21 -07:00