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
0ceac85c6d
chore: fix test
2021-02-21 16:29:13 -08:00
Leonardo de Moura
a55c9592e4
chore: update stage0
2021-02-21 16:24:25 -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
8d933ce83d
chore: update stage0
2021-02-21 13:04:31 -08:00
Leonardo de Moura
4908eaf396
perf: add workaround for destructive update issue
2021-02-21 13:03:45 -08:00
Leonardo de Moura
1b15a848e0
chore: fix test
2021-02-21 11:16:21 -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
604a89c185
chore: update stage0
2021-02-20 15:15:10 -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
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
6eeccdd675
test: for field auto implicit bound feature
2021-02-20 07:52:42 -08:00
Leonardo de Moura
62221f8a60
chore: update stage0
2021-02-20 07:51:30 -08:00
Leonardo de Moura
a264268a63
fix: structure field auto bound implicits
2021-02-20 07:46:55 -08:00
Sebastian Ullrich
0ac95965dc
chore: update vscode-lean4
2021-02-20 14:16:47 +01:00
Leonardo de Moura
0c4be69b5e
chore: update stage0
2021-02-19 15:24:33 -08:00
Leonardo de Moura
2264d2e99a
chore: update stage0
2021-02-19 15:19:07 -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
c55c8ee01b
chore: update stage0
2021-02-19 13:53:08 -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
c06ca8304d
fix: test
2021-02-18 16:54:45 -08:00
Leonardo de Moura
0a280793c7
chore: update stage0
2021-02-18 11:34:53 -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
083efd5825
chore: update stage0
2021-02-17 17:14:40 -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