Commit graph

3252 commits

Author SHA1 Message Date
Leonardo de Moura
50fd39db89 fix: bug at allGoals 2021-03-12 17:48:33 -08:00
Leonardo de Moura
7627458aac chore: fix tests
We are not using the `!` suffix anymore for keywords.
2021-03-12 15:10:50 -08:00
Leonardo de Moura
be841a7cad chore: throwError! => throwError, throwErrorAt! => throwErrorAt
@Kha I marked the corresponding methods as `protected`.
I currently can't stand `throw_error`, and I am optimistic about
server highlighting feature you are working on :)
2021-03-11 11:59:45 -08:00
Leonardo de Moura
d46cb80362 chore: fix tests 2021-03-11 11:35:51 -08:00
Leonardo de Moura
656b7a8d87 chore: fix tests 2021-03-11 10:51:11 -08:00
Leonardo de Moura
8188789cf4 chore: fix test 2021-03-11 10:16:37 -08:00
Leonardo de Moura
35b2f596f1 test: use decide and nativeDecide
They are not active yet.
2021-03-11 07:46:33 -08:00
Leonardo de Moura
48b855bfe5 chore: fix tests 2021-03-10 18:45:22 -08:00
Leonardo de Moura
1ea4bdb9cd fix: add "band-aid" for #341
closes #341

This is another instance of a compiler bug.
It is in the code that is still written in C/C++.
We need to infer types in the compiler, and we reused the kernel type
checker for this.
However, the compiler performs transformations that may produce type
incorrect terms.
This happens in code that makes heavy use of dependent types (like the
new test).
This is just a workaround for this particular instance of the problem.
The definitive solution will only happen when we replace
this part of the compiler with Lean code, and implement a custom
`inferType` method for the compiler.
2021-03-10 08:11:41 -08:00
Leonardo de Moura
0ea267e4de feat: add simp lemma preprocessor 2021-03-09 19:16:14 -08:00
Leonardo de Moura
0c29987a82 chore: clenaup test 2021-03-08 18:19:15 -08:00
Leonardo de Moura
ef4ab9c1d1 fix: report error if too many variable names have been provided at induction/cases alternative 2021-03-08 16:26:53 -08:00
Leonardo de Moura
4bbcd305b5 fix: disable implicit-lambdas when elaborating patterns
@Kha, Jason's example on issue #337 suggests that injecting
implicit-lambdas while elaborating patterns is problematic.
The elaborator was injecting `fun {Γ} =>` before the
pattern variable `ftm`.
So, I disabled the implicit-lambda during pattern elaboration. I
didn't find an example where it would be useful.

see #337

cc @JasonGross
2021-03-08 15:45:30 -08:00
Leonardo de Moura
0e3aa2c29b fix: scope of forallTelescopeReducing
Nested constructors were being processed using an extended local context.
Fix issue reported by @JasonGross at Zulip.

closes #338
2021-03-08 08:29:48 -08:00
Leonardo de Moura
4bbf498004 chore: fix tests 2021-03-07 18:52:46 -08:00
Leonardo de Moura
0a881315ba feat: optional preprocessing tactic at induction and cases
cc @Kha
2021-03-07 14:50:49 -08:00
Leonardo de Moura
19899d087e refactor: induction 2021-03-07 12:04:36 -08:00
Leonardo de Moura
061b9bf60f feat: set_option in terms and tactics
closes #330
2021-03-06 16:43:10 -08:00
Leonardo de Moura
0ed3f08c1b feat: open in terms and tatics
See #330
2021-03-06 15:33:00 -08:00
Leonardo de Moura
9b02a80416 fix: fixes #335 2021-03-05 18:16:49 -08:00
Leonardo de Moura
5e9ccf19d7 fix: fixes #329 2021-03-05 13:42:54 -08:00
Leonardo de Moura
e228ca38b8 test: add set example 2021-03-04 19:16:12 -08:00
Leonardo de Moura
30287836b0 test: OfNatSound 2021-03-04 13:48:01 -08:00
Leonardo de Moura
1fedbfb9a3 feat: simp only 2021-03-04 11:58:34 -08:00
Leonardo de Moura
130a087ecf feat: Lean 3 french single quote notation 2021-03-04 09:43:59 -08:00
Leonardo de Moura
3107473c9f feat: add rename tactic
cc @Kha
2021-03-03 18:32:25 -08:00
Leonardo de Moura
1ecc50f809 test: contradiction 2021-03-03 17:13:25 -08:00
Leonardo de Moura
6cdc6cb1d0 feat: add contradiction 2021-03-03 17:00:54 -08:00
Leonardo de Moura
4aec7579db test: add do equivalence examples 2021-03-03 13:44:30 -08:00
Leonardo de Moura
f1245f9dc7 fix: bug at isDefEqOffset
fixes #326
2021-03-02 17:28:40 -08:00
Leonardo de Moura
5626b537c7 chore: move nondet to Std/Control/Nondet.lean 2021-03-02 07:57:25 -08:00
Leonardo de Moura
140cdbe942 test: tactic framework 2021-02-26 19:34:55 -08:00
Leonardo de Moura
0c1c6c0a73 feat: convert universe metavariables into parameters after elaborating theorem header
closes #318

Like Lean 3, we are doing it only for theorems.
@Kha, we talked about doing it for definitions too, it sounded like a
good idea, and it would make the system's behavior more uniform, but
unfortunately it creates too many problems. There are so many trivial
cases where it breaks. Here are some examples.

1- Definitions that take multiple bundled structures
```
def foo (s1 : Group) (s2 : CommRing) ...
```
They are universe polymorphic, and the different structures must be in
the same universe, but we don't know it when we elaborate the header,
that is, we need to elaborate the body.

An extreme case is `PUnit` occurring in the header. It is universe
polymorphic, but we only lear the constraints on this universe after
we elaborate the body.

2- All files containing unification hints broke.
Again, there are universe constraints on the header that we only learn
after we elaborate the body.

3- Many `CoeSort` and `CoeFun` examples broke.
Example:
```
structure Group :=
  (carrier : Type u) (mul : carrier → carrier → carrier) (one : carrier)

instance GroupToType : CoeSort Group (Type u) :=
  CoeSort.mk (fun g => g.carrier)
```
We would have to write
```
instance GroupToType : CoeSort Group.{u} (Type u) :=
  CoeSort.mk (fun g => g.carrier)
```
We would have to provide universe level parameters manually in this
kind of instance. I think it would be too annoying.
2021-02-25 16:53:58 -08:00
Leonardo de Moura
d770c55326 feat: universe level parameters in instances are outParam by default
This commit makes sure Lean 4 treats universe level parameters in
instances as `outParam`s. This the behavior in Lean 3.

fixes #319
2021-02-25 13:21:53 -08:00
Leonardo de Moura
162062b3de feat: improve Lawful.lean 2021-02-23 12:38:00 -08:00
Leonardo de Moura
1ed2ee4df8 fix: local simp lemmas with implicits 2021-02-20 14:29:15 -08:00
Leonardo de Moura
d8ca6d847b test: lost synthetic mvar issue 2021-02-20 13:01:36 -08:00
Leonardo de Moura
6eeccdd675 test: for field auto implicit bound feature 2021-02-20 07:52:42 -08:00
Leonardo de Moura
e1f6965266 feat: allow user to define rewrite lemmas with (local) match expressions 2021-02-19 15:18:19 -08:00
Leonardo de Moura
d493e700cc fix: matchUnit simplification 2021-02-19 13:51:08 -08:00
Leonardo de Moura
2861f71c61 feat: add option autoLift 2021-02-19 11:02:58 -08:00
Leonardo de Moura
c06ca8304d fix: test 2021-02-18 16:54:45 -08:00
Leonardo de Moura
df8634e9ad fix: assertAfter 2021-02-17 13:52:43 -08:00
Leonardo de Moura
bb2ca97df9 refactor: add options for controlling whether variables are included or not at mkLambdaFVars and mkForallFVars 2021-02-17 13:49:27 -08:00
Leonardo de Moura
c97ae92afe chore: cleanup 2021-02-17 13:03:24 -08:00
Leonardo de Moura
79a4aebf96 feat: add byCases tactic 2021-02-17 13:03:24 -08:00
Leonardo de Moura
08927f1e66 test: tactic framework and AC by reflection 2021-02-17 13:03:24 -08:00
Leonardo de Moura
1a7535263e fix: unfolding class projections at simp 2021-02-16 17:55:57 -08:00
Leonardo de Moura
5f80659b45 fix: unfold constants at simp 2021-02-16 15:42:31 -08:00
Leonardo de Moura
5e24da0c2e fix: simp argument issue
See new test.
2021-02-16 13:12:57 -08:00