Commit graph

312 commits

Author SHA1 Message Date
Wojciech Nawrocki
7aca461a35 fix: hovers on elabFieldName fields 2021-07-19 09:55:37 +02:00
Wojciech Nawrocki
b2d712a766 fix: Substring.splitOn 2021-07-19 09:55:37 +02:00
Daniel Fabian
93a3fd14ad refactor: do not use explicit instance, but use deriving instead. 2021-07-13 09:58:27 -07:00
Daniel Fabian
0d41fd03f7 feat: add xml parser.
in order to generate the LLVM extern declarations we want to use a generator that spits out XML. Hence adding a small XML parser.
2021-07-13 09:58:27 -07:00
Wojciech Nawrocki
4ea3d2df2f feat: add missing UInt coercions 2021-07-05 19:42:01 +02:00
Leonardo de Moura
f4a7ffd8c8 chore: fix codebase and tests 2021-06-29 17:14:52 -07:00
Sebastian Ullrich
eb1e285e26 chore: style 2021-06-21 10:17:26 -07:00
Leonardo de Moura
e8a958d8f3 chore: parameter naming convention 2021-06-06 17:09:26 -07:00
Leonardo de Moura
37da993032 chore: remove HashableUSize instances 2021-06-02 08:48:11 -07:00
Leonardo de Moura
cbab9438c9 chore: Hashable instances for Expr and Level 2021-06-02 08:30:25 -07:00
Leonardo de Moura
5ac2e14173 chore: add Hashable that uses UInt64 2021-06-02 07:47:41 -07:00
Leonardo de Moura
43812444a7 chore: Hashable => HashableUSize 2021-06-02 07:24:26 -07:00
Leonardo de Moura
6a87bba9c0 chore: mixHash => mixUSizeHash 2021-06-02 07:05:42 -07:00
Sebastian Ullrich
3fb7a2c0e1 fix: make problematic Ord -> LT instance a def 2021-05-31 19:05:50 -07:00
François G. Dorais
29dc5c5b1b fix: duplicate namespace prefix 2021-05-31 13:31:57 +02:00
Sebastian Ullrich
693c2ccf71 feat: min, max, List.min/maximum? 2021-05-30 17:29:54 +02:00
Sebastian Ullrich
37dcbf3421 feat: have Ord imply LT/LE 2021-05-30 17:29:54 +02:00
Sebastian Ullrich
94aea76922 feat: FilePath.metadata 2021-05-30 17:29:54 +02:00
Sebastian Ullrich
4354534fda feat: make FilePath a concrete type
Resolves #363
2021-05-28 14:19:59 +02:00
Sebastian Ullrich
a02c6fd3eb chore: adapt stdlib & tests 2021-05-20 15:17:36 -07:00
Sebastian Ullrich
7c3101a51c chore: produce more efficient/pp-able array code from quotations 2021-05-19 09:52:35 +02:00
Leonardo de Moura
eae1f5412b fix: bugs introduced in the previous commits 2021-05-17 15:00:51 -07:00
Leonardo de Moura
3b7bcdc449 feat: add endPos field to SourceInfo.original
We need an update stage0 before we use it.
2021-05-17 14:32:58 -07:00
Leonardo de Moura
c7096f54a2 feat: injectivity theorems for types defined in the prelude 2021-05-14 18:32:26 -07:00
Leonardo de Moura
8e81f03e3a chore: adjust stdlib to recent changes 2021-05-06 15:43:56 -07:00
Leonardo de Moura
7398db5f3f fix: rw final goal state 2021-05-04 16:58:44 -07:00
Sebastian Ullrich
aabb4a50aa feat: remove bracket-less rw 2021-05-04 15:24:22 -07:00
Leonardo de Moura
ba5d622e59 chore: avoid case tactic 2021-05-01 19:50:50 -07:00
Leonardo de Moura
920a2b2a14 perf: Ord USize instance and missing inline 2021-04-27 12:08:21 -07:00
Daniel Fabian
0238bf8c33 refactor: use Ordering inside of rbmap instead of lt. 2021-04-27 07:58:58 -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
Daniel Fabian
401765f587 test: add test that deriving Ord compiles in various cases. 2021-04-03 21:27:26 -07:00
Daniel Fabian
fb4a119ed7 fix: allow also recursive types in the Ord construction. 2021-04-03 21:27:26 -07:00
Daniel Fabian
a8914380dc feat: add Ord and deriving instance for it.
For many data structures having an ordering is necessary. This one adds the `Ord` type class and a deriving handler for it. The ordering is based on order of constructors followed by lexicographical ordering within a constructor.
2021-04-03 21:27:26 -07:00
Daniel Fabian
ed75005422 feat: make proofs Hashable
change the `Hashable` class from taking a hash function of `Type u` to taking a
hash function from `Sort u`. This allows to implement `Hashable` for
propositions, which in turn is needed for inductives carrying proofs
2021-03-30 13:36:52 -07:00
Daniel Fabian
fee3390dd1 feat: add Hashable deriving
add support for the `Hashable` deriving by combining structural
hashes over fields
2021-03-30 13:36:52 -07:00
Leonardo de Moura
efe67453ac chore: add Repr Lean.SourceInfo 2021-03-29 16:55:56 -07:00
Leonardo de Moura
3176be136c feat: improve "discriminant refinement" 2021-03-24 21:05:08 -07:00
Leonardo de Moura
9a5f239513 refactor: remove Monad Option and Alternative Option
We should use `OptionM` instead.
`Option` still implements `Functor` and `OrElse`.

cc @Kha
2021-03-20 18:25:25 -07:00
Leonardo de Moura
04e3f21783 chore: add OptionM monad
Motivation: `Option` is data, `OptionM` is control.
2021-03-20 17:50:45 -07:00
Sebastian Ullrich
e62542ed29 feat: CoeSort Bool Prop 2021-03-20 14:52:16 +01:00
Leonardo de Moura
0720a53a9d chore: refactoring and cleanup 2021-03-17 14:56:08 -07:00
pcpthm
f645429df4 chore: slightly nicer UInt shift definition 2021-03-17 10:08:02 +01:00
pcpthm
419a6190e8 fix: bitwise shift overflow of UInt types
It is an undefined behavior in C when the right operand of a shift operation exceeds the bit-width of the left operand.
We define the shift operation to be `x << (y % B)` where `B` is the bit-width of the left operand.
2021-03-17 10:08:02 +01:00
Leonardo de Moura
091fadbf64 feat: add List.rotateLeft and List.rotateRight 2021-03-12 17:09:22 -08:00
Leonardo de Moura
bf8119a5cd chore: convert keywords to snake_case
Again `!` is only for functions that can panic.
2021-03-12 13:34:51 -08:00
Leonardo de Moura
472c5fb900 fix: indentation issues 2021-03-12 11:09:28 -08:00
Leonardo de Moura
df994fd16f fix: add checkColGe to matchAlt
@Kha this is a fix for the example that @gebner posted on Zulip.
There are other possible workarounds, but I think this one is
"intuitive".

Here is the problem description and workaround.
We currently use the `withPosition` combinator at `matchAlts`. The
original motivation was nested `match`-expressions without
parenthesis.
We also have the `checkColGt` in the application parser.

Thus, `frob 5` is not parsed as an application. That is, the term
parser after the `then` keyword stops at `frob`.
Then, we get the weird "expected 'else'" error message at `5` :)

In this commit, I add a `checkColGe` check at the beginning of each
alternative right-hand-side.

The effect on the stdlib was minimal. It basically affected old code
that used the Lean 3 workaround for partial functions
```
partial def f : N -> N | i =>
  ...
```
In Lean 4, we can use the more natural
```
partial def f (i : N) : N :=
...
```
or
```
partial def f : N -> N := fun i =>
...
```

It also affected code such as
```
instance : Repr String.Iterator where
  reprPrec | ⟨s, pos⟩, prec =>
    Repr.addAppParen ("String.Iterator.mk " ++ reprArg s ++ " " ++ reprArg pos) prec
```
This is a workaround for a missing feature. We really wanted to write
```
instance : Repr String.Iterator where
  reprPrec ⟨s, pos⟩ prec :=
    Repr.addAppParen ("String.Iterator.mk " ++ reprArg s ++ " " ++ reprArg pos) prec
```
2021-03-12 11:06:07 -08:00
Leonardo de Moura
1112ab6eff chore: use new notation 2021-03-11 11:19:33 -08:00