Commit graph

203 commits

Author SHA1 Message Date
Sebastian Ullrich
eb170d1f43 fix: compiled string literals containing null bytes 2022-05-17 09:24:34 -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
Leonardo de Moura
49e33fdb23 chore: fix tests 2022-03-15 11:35:47 -07:00
Leonardo de Moura
189f4bd372 chore: fix tests 2022-01-15 12:18:09 -08:00
Leonardo de Moura
c1fccf19cb chore: fix test 2022-01-15 11:46:11 -08:00
Leonardo de Moura
e3241e82bc feat: define PointedType as { α : Type u // Nonempty α } 2022-01-14 20:36:51 -08:00
Sebastian Ullrich
d7b8479760 chore: use configured C++ compiler for foreign test
Fixes #775
2021-11-09 09:27:10 +01:00
Sebastian Ullrich
d5e05f31e4 chore: compiler-dependent test flag 2021-11-06 23:37:19 +01:00
Sebastian Ullrich
85fb03f22c fix: cannot dynamically link against library that depends on statically linked runtime on Windows 2021-11-04 15:32:07 -07:00
Sebastian Ullrich
697e34e229 test: --load-dynlib 2021-11-04 15:32:07 -07:00
Leonardo de Moura
48a40c4d0a fix: quoteString at EmitC.lean
Fix issue reported at https://leanprover.zulipchat.com/#narrow/stream/270676-lean4/topic/Incorrect.20escaping.20of.20.5Cr.20.3F/near/257061704
2021-10-11 06:16:56 -07:00
Leonardo de Moura
28d81ee456 fix: do not extract closed terms containing constants being defined
It may produce crashes during initialization.
2021-09-30 12:46:38 -07:00
Leonardo de Moura
b85d95b7b6 fix: panic in monadic polymorphic code
fixes #695
2021-09-28 17:46:19 -07:00
Leonardo de Moura
eb94e87195 chore: fix some tests 2021-09-07 17:20:21 -07:00
Leonardo de Moura
ebd8f1efa7 chore: avoid object.h dependencies 2021-09-07 07:31:48 -07:00
Leonardo de Moura
09326df213 chore: fix test output 2021-09-06 07:39:57 -07:00
Daniel Selsam
0118c47117 refactor: separate pp.funBinderTypes and pp.piBinderTypes 2021-08-09 16:13:40 +02:00
Daniel Selsam
89364b802b feat: top-down heuristic delaboration 2021-08-03 09:13:18 +02:00
Leonardo de Moura
90a79a0b06 chore: remove command universes
Now, `universe` may declare many universes. The goal is to make it
consistent with the `variable` command
2021-06-29 17:01:07 -07:00
Leonardo de Moura
2018dc0959 fix: disable panic messages during initialization
This is a temporary workaround until we implement #467.
Fixes #534
2021-06-29 14:48:48 -07:00
Sebastian Ullrich
4ed66cae3e feat: add --print-prefix, --print-libdir flags
The names were taken from `llvm-config`
2021-06-11 17:53:51 -07:00
Leonardo de Moura
b91e22af2b fix: fixes #241 2021-05-22 19:10:07 -07:00
Leonardo de Moura
a498a64490 chore: disable injectivity theorems generation for big structure tests
The test was producing a stack overflow in debug mode in CI.
2021-05-15 21:30:40 -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
d71aab5dc4 fix: allow bigger ctor objects
`IR/Checker.lean` is now also checking the maximum number of fields
and scalar size
2021-01-29 18:23:38 -08:00
Sebastian Ullrich
7e521f0105 chore: remove remaining #lang lean4 in tests 2021-01-27 14:45:31 +01:00
Sebastian Ullrich
a3a8d76e96 chore: move pp_options.cpp to Lean 2021-01-27 14:16:12 +01:00
Sebastian Ullrich
8a02dfec4f feat: subsume variables under variable
/cc @leodemoura
2021-01-22 14:36:05 +01:00
Andrew Kent
4f6bb1feb6
feat: add Float.ofInt 2021-01-15 15:45:28 +01:00
Leonardo de Moura
403699f5e4 fix: elim_array_cases 2021-01-04 16:10:49 -08:00
Leonardo de Moura
bbafaf8805 fix: Array.mk and Array.data externs 2020-12-13 11:10:01 -08:00
Leonardo de Moura
06ad52575a feat: force users to use discard when action result is not being bound and it is not PUnit
After this commit, we have to use an explicit `discard` in code such as
```
def g (x : Nat) : IO Nat := ...
def f (x : Nat) : IO Unit := do
  discard <| g x   -- type error without the `discard`
  IO.println x
```

Motivation: prevent users from making mistakes such as
```
def f (xs : Array Nat) : IO Unit := do
  xs.set! 0 1
  IO.println xs
```
when they meant to write
```
def f (xs : Array Nat) : IO Unit := do
  let xs := xs.set! 0 1
  IO.println xs
```
2020-12-08 06:14:48 -08:00
Leonardo de Moura
2120883307 refactor: heterogeneous operators
@Kha I had some unexpected surprises, but it is a good change.
Here is the summary.

1- We could get rid of `a %ₙ b` and `ModN` class. We can use `HMod`
instead. It was a positive surprise since I didn't remember we had
this `ModN` class.

2- Coercions are never used in heterogeneous operators. This is
expected since `a * b` is now notation for `HMul.hMul a b`, and
`a` and `b` may have different types. I manually added instances such
as `HMul Nat Int Int`. However, I did not try to add generic instances
such as
```
instance [Coe a b] [Mul b] : HMul a b b where
  hMul x y := mul (coe x) y
```
I will try later.

3- Give `h : cs.size > 0`, I got a type error at
```
let idx : Fin cs.size := ⟨cs.size - 1, Nat.predLt h⟩
```
`Nat.predLt h` has type `Nat.pred cs.size < cs.size`
However, `Nat.pred cs.size` doesn't unify with `cs.size - 1`.
The problem is that we can't synthesize the `HSub` instance until
we apply the default instances.
It worked before because `isDefEq` would force the pending TC
problem `Sub Nat` to be resolved, and after that we would be able
to reduce `cs.size - 1` and establish that it is definitionally
equal to `Nat.pred cs.size`.
I considered two possible workarounds
a) `let idx : Fin cs.size := ⟨cs.size - (1:Nat), Nat.predLt h⟩`
b) `let idx : Fin cs.size := ⟨cs.size - 1, by exact Nat.predLt h⟩`
The first one works because we are not providing enough information
for synthesizing the `HSub` instance. The second works because it
postpones the elaboration of `Nat.predLt h`. The default instances
will be applied before we start applying tactics.

4- The `.` notation is affected too. For example, `(x + 1).toUInt8`
doesn't work since we don't know the type of `x+1` until we apply
default instances. I fixed it by using `(x + (1:Nat)).toUInt8`.
Another possible fix is `Nat.toUInt8 (x + 1)`.
Similarly, `(x+1).fold ...` doesn't work.

5- The following code failed to be elaborated
```
indent (push s!"{ss'}\n") (some (0 - Format.getIndent (← getOptions)))
```
It was working before, but it relied on how the expected type is
propagated. The elaborator process
```
some (0 - Format.getIndent (← getOptions))
```
with expected type `(Option Int)`. So, the `-` is interpreted as
`Int.sub` although `Format.getIndent (← getOptions)` has type `Nat`.
In the new `HSub`, the expected type doesn't really influence TC
resolution since it is an `outparam`. So, we failed with the error
failed to synthesize `HSub Nat Nat Int`.
One possible fix was to add the instance `HSub Nat Nat Int` with
`Int.sub`, but I used the following fix
```
some ((0 : Int) - Format.getIndent (← getOptions))
```
which makes it clear that we want the `Int.sub` operator instead of
`Nat.sub`.
2020-12-01 14:02:46 -08:00
Leonardo de Moura
e3fb7010f1 chore: fix tests 2020-11-25 09:25:45 -08:00
Leonardo de Moura
b6a1914299 chore: remove $. notation
It has been replaced by `|>.`
2020-11-19 08:47:35 -08:00
Leonardo de Moura
7e533b4650 refactor: use Lists for Array reference implementation
Motivation: better reduction in the kernel.

cc @Kha
2020-11-17 17:05:53 -08:00
Leonardo de Moura
dbf99a17b6 chore: define notation using infix commands 2020-11-11 08:26:12 -08:00
Leonardo de Moura
7e8a7e6660 feat: elaborate fun/forall binder extensions 2020-11-09 19:00:40 -08:00
Leonardo de Moura
6c6595cd9b feat: only allow variables declared with mut to be reassigned 2020-11-07 17:32:13 -08:00
Leonardo de Moura
1c558d279f feat: add mut modifier to doLet 2020-11-07 17:32:13 -08:00
Leonardo de Moura
f9194737f0 chore: fix tests 2020-10-31 19:19:18 -07:00
Leonardo de Moura
4ba21ea10c chore: cleanup src/Array/Basic.lean 2020-10-28 19:35:42 -07:00
Leonardo de Moura
898a08a0c1 chore: avoid Has prefix in type classes
closes #203
2020-10-27 18:29:19 -07:00
Leonardo de Moura
10c32fcf94 chore: HasToString => ToString 2020-10-27 16:11:48 -07:00
Sebastian Ullrich
6fb0ae91c7 test: fix tests 2020-10-27 16:50:58 +01:00
Leonardo de Moura
db9e390b4d chore: remove new_frontend from tests 2020-10-25 09:16:38 -07:00
Leonardo de Moura
fa101444b4 chore: fix tests 2020-10-25 09:11:13 -07:00
Leonardo de Moura
a4c69ec32c chore: fix tests 2020-10-24 16:46:21 -07:00
Leonardo de Moura
21587ff19b chore: move tests to new frontend 2020-10-23 16:18:52 -07:00
Leonardo de Moura
8cb1ff206c chore: move tests to new frontend 2020-10-23 14:07:26 -07:00