Skip to content

Instantly share code, notes, and snippets.

@bollu
Last active October 4, 2021 15:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bollu/471121c586a6021d2e0e9b293ad0bb20 to your computer and use it in GitHub Desktop.
Save bollu/471121c586a6021d2e0e9b293ad0bb20 to your computer and use it in GitHub Desktop.
PANIC at Lean.Expr.bindingDomain! Lean.Expr:618:23: binding expected

Prerequisites

  • Put an X between the brackets on this line if you have done all of the following:
    • Checked that your issue isn't already filed.
    • Reduced the issue to a self-contained, reproducible test case.

Description

The compiler panics with the error:

> LEAN_PATH=././build /home/bollu/work/lean4/build/stage1/bin/lean -o build/GAP/P.olean -c build/temp/GAP/P.c ./GAP/P.lean
> LEAN_PATH=././build /home/bollu/work/lean4/build/stage1/bin/lean -o build/GAP/AST.olean -c build/temp/GAP/AST.c ./GAP/AST.lean
PANIC at Lean.Expr.bindingDomain! Lean.Expr:618:23: binding expected
PANIC at Lean.Expr.bindingDomain! Lean.Expr:618:23: binding expected
...
Build failed.

Steps to Reproduce

The minimal test case is as follows:

/home/bollu/temp/lean-gap$ tree
.
├── GAP
│   ├── AST.lean
│   └── P.lean
├── GAP.lean
└── leanpkg.toml

with file contents:

-- GAP.lean
import GAP.P
import GAP.AST
-- GAP/P.lean
namespace GAP.P
structure P (a: Type) where 
   runP: a
instance : Monad P := {
  pure := fun a => { runP := a },
  bind := fun a => fun a2mb => a2mb (a.runP)
}
-- GAP/AST.lean
  import GAP.P
  open GAP.P
  namespace GAP.AST
  mutual
  def parse_expr_logical : P Expr := do 
    let l <- parse_expr
  def parse_expr : P Expr := parse_expr_logical
  end
# leanpkg.toml
[package]
name = "gap"
version = "0.1"
lean_version = "leanprover/lean4:master"

Expected behavior: [The compiler should not panic]

Actual behavior: [the compiler panics]

Reproduces how often: [all the time]

Versions

You can get this information from copy and pasting the output of lean --version, please include the OS and what version of the OS you're running.

/home/bollu/temp/lean-gap$ lean --version
Lean (version 4.0.0, commit af12c91b0a50, Release)
/home/bollu/temp/lean-gap$ uname -r
5.9.16-1-MANJARO

Additional Information

Any additional information, configuration or data that might be necessary to reproduce the issue.

/home/bollu/temp/lean-gap$ leanpkg build
configuring gap 0.1
> LEAN_PATH=././build /home/bollu/work/lean4/build/stage1/bin/lean -o build/GAP/P.olean -c build/temp/GAP/P.c ./GAP/P.lean
> LEAN_PATH=././build /home/bollu/work/lean4/build/stage1/bin/lean -o build/GAP/AST.olean -c build/temp/GAP/AST.c ./GAP/AST.lean
PANIC at Lean.Expr.bindingDomain! Lean.Expr:618:23: binding expected
PANIC at Lean.Expr.bindingDomain! Lean.Expr:618:23: binding expected
./GAP/AST.lean:5:29: error: unknown identifier 'Expr'
./GAP/AST.lean:7:21: error: unknown identifier 'Expr'
./GAP/AST.lean:5:6: error: fail to show termination for
GAP.AST.parse_expr_logical
GAP.AST.parse_expr
with errors
structural recursion does not handle mutually recursive functions
unexpected bound variable #0
external command exited with status 1
Build failed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment