Lean 4 fork for HoTT-compatible kernel extensions (Path types, transport, HITs). Maintained against upstream leanprover/lean4.
Find a file
Leonardo de Moura 7cdf917c97 fix: compiler do a; b as a >>= fun _ => b
Consider the following example
```lean
def div!: Nat → Nat → Nat
| x, 0 => panic! "division by zero"
| x, y => x/y

def weird (x : Nat) : MetaM Nat :=
unless (x > 0) (throwOther "x == 0") *>
let y := div! 10 x;
pure y
```
If we execute `weird 0`, it produces a "division by zero" panic
message.
This is a simple version of a much bigger function in the new
frontend.
This is not due to a bug in the compiler.
It produces the panic message because of the `do`-encoding
refactoring. Recall that, a few months ago,
we started to compile `do a; b` as `a *> b` (i.e., `seqRight a b`).
Thus, the example above is
`seqRight action1 (let y := div! 10 x; pure y)`
where `action1` is the `unless ...`.
In A-normal form, this is equivalent to

```lean
let y:= div! 10 x;
let action2 := pure y;
seqRight action1 action2
```
Thus, we execute `div! 10 x` before we even execute the `seqRight`.
This is counterintuitive and demonstrates once again how impure
features such as `panic!` are dangerous.

This commit reverts the `do`-encoding refactoring, and encodes
`do a; b` as `a >>= fun _ b` as we did in Lean3.

cc @Kha
2020-08-15 15:51:00 -07:00
.github chore: de-Nix-ify macOS binary 2020-06-10 21:30:38 +02:00
doc chore: add stage 1.5 (yes, really) 2020-08-12 09:15:59 -07:00
images
lean4-mode chore: add new_frontend 2020-06-17 21:28:03 -07:00
nix chore: update nixpkgs, changing back to LLVM 10 2020-07-08 12:14:49 +02:00
script chore: update CI 2020-06-10 21:30:38 +02:00
src fix: compiler do a; b as a >>= fun _ => b 2020-08-15 15:51:00 -07:00
stage0 chore: update stage0 2020-08-15 08:20:12 -07:00
tests fix: tryPostponeIfMVar 2020-08-15 14:36:16 -07:00
tmp feat: add caseValues tactic 2020-08-06 15:37:00 -07:00
.clang-format feat(library/vm/process): add basic process support 2017-03-28 18:08:06 -07:00
.codecov.yml fix(.codecov.yml): do not fail github ci if coverage drops by 0.01% 2017-06-25 10:35:02 +02:00
.gitattributes chore: restore marking stage0/ as binary files, which we lost at some point 2020-08-14 11:12:13 +02:00
.gitignore chore: move bin/ and .oleans into build directory 2020-05-14 14:47:54 +02:00
CMakeLists.txt chore: add stage 1.5 (yes, really) 2020-08-12 09:15:59 -07:00
default.nix chore: add separate "Linux release" CI job using Nix channel with older glibc for compatibility 2020-06-10 21:30:38 +02:00
LICENSE
README.md chore(README): update 2019-04-24 11:40:46 -07:00
shell.nix chore: update temci 2020-07-21 18:30:22 +02:00

We are currently developing Lean 4. Lean 3 is still the latest official release. This repository contains work in progress.

Important. Unless you are one of our collaborators

  • We strongly suggest you use Lean 3.
  • Pull requests are not welcome.
  • New issues are not welcome, and will be closed without any feedback.