Skip to content

Commit

Permalink
feat: zetaUnused option (option only) (#6754)
Browse files Browse the repository at this point in the history
This PR adds the `+zetaUnused` option.

Implementation to follow after the stage0 update.
  • Loading branch information
nomeata authored Jan 23, 2025
1 parent d033804 commit 7e03920
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/Init/MetaTypes.lean
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,11 @@ structure Config where
to find candidate `simp` theorems. It approximates Lean 3 `simp` behavior.
-/
index : Bool := true
/--
When `true` (default : `true`), then simps will remove unused let-declarations:
`let x := v; e` simplifies to `e` when `x` does not occur in `e`.
-/
zetaUnused : Bool := true
deriving Inhabited, BEq

end DSimp
Expand Down Expand Up @@ -228,6 +233,11 @@ structure Config where
input and output terms are definitionally equal.
-/
implicitDefEqProofs : Bool := true
/--
When `true` (default : `true`), then simps will remove unused let-declarations:
`let x := v; e` simplifies to `e` when `x` does not occur in `e`.
-/
zetaUnused : Bool := true
deriving Inhabited, BEq

-- Configuration object for `simp_all`
Expand All @@ -248,6 +258,7 @@ def neutralConfig : Simp.Config := {
autoUnfold := false
ground := false
zetaDelta := false
zetaUnused := false
}

structure NormCastConfig extends Simp.Config where
Expand Down
5 changes: 5 additions & 0 deletions src/Lean/Meta/Basic.lean
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,11 @@ structure Config where
Zeta-delta reduction: given a local context containing entry `x : t := e`, free variable `x` reduces to `e`.
-/
zetaDelta : Bool := true
/--
Zeta reduction for unused let-declarations: `let x := v; e` reduces to `e` when `x` does not occur
in `e`.
-/
zetaUnused : Bool := true
deriving Inhabited, Repr

/-- Convert `isDefEq` and `WHNF` relevant parts into a key for caching results -/
Expand Down
2 changes: 2 additions & 0 deletions src/Lean/Meta/Tactic/Simp/Types.lean
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ private def mkIndexConfig (c : Config) : MetaM ConfigWithKey := do
beta := c.beta
iota := c.iota
zeta := c.zeta
zetaUnused := c.zetaUnused
zetaDelta := c.zetaDelta
etaStruct := c.etaStruct
/-
Expand All @@ -153,6 +154,7 @@ private def mkMetaConfig (c : Config) : MetaM ConfigWithKey := do
beta := c.beta
zeta := c.zeta
iota := c.iota
zetaUnused := c.zetaUnused
zetaDelta := c.zetaDelta
etaStruct := c.etaStruct
proj := if c.proj then .yesWithDelta else .no
Expand Down
2 changes: 2 additions & 0 deletions stage0/src/stdlib_flags.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#include "util/options.h"

// please update stage0!

namespace lean {
options get_default_options() {
options opts;
Expand Down

0 comments on commit 7e03920

Please sign in to comment.