Commit graph

24104 commits

Author SHA1 Message Date
Leonardo de Moura
b9ef6f89a4 chore: cleanup 2021-02-26 19:34:39 -08:00
Leonardo de Moura
1c50603112 fix: ReplaceLocalDecl 2021-02-26 19:31:40 -08:00
Leonardo de Moura
f329726711 fix: missing withMainMVarContext 2021-02-26 19:00:09 -08:00
Leonardo de Moura
5662e2e745 refactor: move ToString Syntax and BEq Syntax to Init 2021-02-26 13:21:04 -08:00
Sebastian Ullrich
e2a8ee8520 feat: highlight corresponding do (if any) when hovering over return 2021-02-26 14:58:09 +01:00
Sebastian Ullrich
a519f723cd chore: improve watchdog error message on file worker crash 2021-02-26 14:58:09 +01:00
Sebastian Ullrich
7c73ff072f chore: print unhandled file worker errors to stderr 2021-02-26 14:58:09 +01:00
Sebastian Ullrich
8b20a939aa fix: Reader 2021-02-26 14:58:09 +01:00
Leonardo de Moura
597635c074 fix: is_recursive_fn 2021-02-25 19:48:12 -08:00
Leonardo de Moura
6e950ff216 chore: compilation time 2021-02-25 18:00:58 -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
352337479b chore: remove duplicate 2021-02-25 16:20:12 -08:00
Zygimantas Straznickas
49ebd30fd5 fix: fix deriving Repr for structure-like inductives
The deriving code currently uses isStructureLike when choosing whether to use
Inductive or Structure logic, which fails for inductives that are
structure-like. The commit changes the code to use isStructure.
2021-02-25 13:38:33 -08:00
Leonardo de Moura
1b16f9b33c fix: make sure kernel checks examples
We discard the resulting environment for examples.

closes #309

cc @Kha
2021-02-25 13:34:27 -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
d9d948087f fix: use TransparencyMode.instances at SynthInstance 2021-02-25 13:08:51 -08:00
Leonardo de Moura
d3a914c1ff chore: cleanup 2021-02-23 12:52:14 -08:00
Leonardo de Moura
162062b3de feat: improve Lawful.lean 2021-02-23 12:38:00 -08:00
Leonardo de Moura
506602c650 chore: remove unnecessary let 2021-02-23 11:35:50 -08:00
Leonardo de Moura
98348dfe7f feat: add ExceptT.run_bind_lift and ExceptT.bind_throw
Remove `[simp]` attribute from `ExceptT.run_bind`
2021-02-23 08:17:11 -08:00
Leonardo de Moura
c1231b1b43 fix: fixes #317
BTW, I had to add the auxiliary `loop` fuction to workaround a bug in the
old compiler C++ code.

cc @Kha
2021-02-22 11:09:19 -08:00
Leonardo de Moura
3850b1a9aa perf: workaround for increasing the number of destructive updates
See 4908eaf396
2021-02-21 16:22:53 -08:00
Leonardo de Moura
322fc79d84 perf: cache inferConstType 2021-02-21 15:48:36 -08:00
Leonardo de Moura
50b6561f8f chore: cleanup 2021-02-21 14:04:00 -08:00
Leonardo de Moura
4908eaf396 perf: add workaround for destructive update issue 2021-02-21 13:03:45 -08:00
Leonardo de Moura
d0574d8eb1 feat: add LawfulMonad for StateT 2021-02-21 10:52:53 -08:00
Leonardo de Moura
b1faed895a chore: change inferInstance and inferInstanceAs types 2021-02-21 08:36:03 -08:00
Leonardo de Moura
ae48feeb07 feat: add LawfulMonad for ReaderT 2021-02-21 08:27:59 -08:00
Leonardo de Moura
d77f335ff0 feat: add LawfulMonad instance for ExceptT 2021-02-20 17:01:27 -08:00
Leonardo de Moura
1ed2ee4df8 fix: local simp lemmas with implicits 2021-02-20 14:29:15 -08:00
Leonardo de Moura
2cf56f5e10 fix: synthesizeSyntheticMVars at liftTacticElabM 2021-02-20 13:00:26 -08:00
Leonardo de Moura
65ea26422a fix: use Term.withSynthesize at rewrite 2021-02-20 12:59:41 -08:00
Leonardo de Moura
bcd8f09672 feat: monad polymorphic withSynthesize 2021-02-20 12:32:05 -08:00
Leonardo de Moura
8fa1ecde49 fix: throw error when default value contains metavariables 2021-02-20 11:31:56 -08:00
Leonardo de Moura
caf54d78e2 feat: add Control/Lawful.lean 2021-02-20 09:37:43 -08:00
Leonardo de Moura
a264268a63 fix: structure field auto bound implicits 2021-02-20 07:46:55 -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
d1d26e5ba6 fix: use try clear 2021-02-19 13:46:02 -08:00
Leonardo de Moura
2861f71c61 feat: add option autoLift 2021-02-19 11:02:58 -08:00
Leonardo de Moura
8392b09db2 feat: shouldAddAsStar only for nested terms 2021-02-18 11:33:56 -08:00
Joe Hendrix
ffef5635bb fix: Json.num
Handle negative numbers correctly.
2021-02-18 13:27:31 +01:00
Leonardo de Moura
51771d5d07 feat: erase _discr auxiliary variables 2021-02-17 18:10:02 -08:00
Leonardo de Moura
c5673b6025 feat: auxiliary tactic for erasing auxiliary discriminants 2021-02-17 16:59:21 -08:00
Leonardo de Moura
ea26caa3fa chore: minor cleanup 2021-02-17 16:47:30 -08:00
Leonardo de Moura
6263141f7b fix: preserve InfoTree when tactics fail
cc @Kha @Vtec234
2021-02-17 15:20:33 -08:00
Leonardo de Moura
64413e9d4a chore: cleanup 2021-02-17 15:13:05 -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
79a4aebf96 feat: add byCases tactic 2021-02-17 13:03:24 -08:00