Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions Export.lean
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,13 @@ def removeMData (e : Expr) : M Expr := do
pure <| e.updateApp! (← removeMData f) (← removeMData a)
| .lam _ d b _ =>
pure <| e.updateLambdaE! (← removeMData d) (← removeMData b)
| .letE _ d v b nonDep =>
pure <| e.updateLet! (← removeMData d) (← removeMData v) (← removeMData b) nonDep
| .letE _ d v b _ =>
-- Normalize `nonDep` to `false` to avoid duplicate expression indices.
-- Lean's `BEq` for `Expr` considers the `nonDep` flag, but external type checkers
-- (e.g., nanoda_lib) treat expressions as identical regardless of this optimization hint.
-- Without normalization, the same expression can get different indices, causing parse errors.
-- See: https://github.com/ammkrn/lean4export/commit/eb023e5
pure <| e.updateLet! (← removeMData d) (← removeMData v) (← removeMData b) false
| .forallE _ d b _ =>
pure <| e.updateForallE! (← removeMData d) (← removeMData b)
| .proj _ _ e2 =>
Expand Down