Skip to content

Commit

Permalink
do not pull let out of lambdas by default in lsimp
Browse files Browse the repository at this point in the history
  • Loading branch information
lecopivo committed Dec 4, 2024
1 parent acb136d commit 082e0c4
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions SciLean/Tactic/LSimp/Main.lean
Original file line number Diff line number Diff line change
Expand Up @@ -362,13 +362,17 @@ partial def simpLambda (e : Expr) : LSimpM Result := do
withParent e <| lambdaTelescopeDSimp e fun xs e => do
withoutModifyingLCtx pure do withoutModifyingCache do withNewLemmas xs do
let r ← lsimp e

let (eNew,vars) ← xs.foldrM (init:=(r.expr,r.vars)) fun x (e,vars) => do
let deps ← collectForwardDeps #[x] false
let (vars', vars) := vars.partition deps.contains
let e ← mkLambdaFVars (#[x] ++ vars') e
pure (e,vars)
let eNew ← mkLambdaFVars vars eNew

let r ← r.bindVars
let pullLetOutOfLambda := false -- todo: turn this into `lsimp` config option
let eNew ← if pullLetOutOfLambda then pure eNew else mkLambdaFVars xs r.expr
match r.proof? with
| none => return { expr := eNew }
| some h =>
Expand Down

0 comments on commit 082e0c4

Please sign in to comment.