Skip to content

Commit 1ff81db

Browse files
authored
feat: add zetaHave/letToHave simp options (#8788)
This PR adds the `zetaHave` and `letToHave` options to `simp`. Implementations will appear in future PRs.
1 parent 019ea2a commit 1ff81db

File tree

1 file changed

+19
-3
lines changed

1 file changed

+19
-3
lines changed

src/Init/MetaTypes.lean

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -161,8 +161,9 @@ structure Config where
161161
-/
162162
singlePass : Bool := false
163163
/--
164-
When `true` (default: `true`), performs zeta reduction of let expressions.
164+
When `true` (default: `true`), performs zeta reduction of `let` and `have` expressions.
165165
That is, `let x := v; e[x]` reduces to `e[v]`.
166+
If `zetaHave` is `false` then `have` expressions are not zeta reduced.
166167
See also `zetaDelta`.
167168
-/
168169
zeta : Bool := true
@@ -226,7 +227,8 @@ structure Config where
226227
unfoldPartialApp : Bool := false
227228
/--
228229
When `true` (default: `false`), local definitions are unfolded.
229-
That is, given a local context containing entry `x : t := e`, the free variable `x` reduces to `e`.
230+
That is, given a local context containing `x : t := e`, then the free variable `x` reduces to `e`.
231+
Otherwise, `x` must be provided as a `simp` argument.
230232
-/
231233
zetaDelta : Bool := false
232234
/--
@@ -240,7 +242,7 @@ structure Config where
240242
-/
241243
implicitDefEqProofs : Bool := true
242244
/--
243-
When `true` (default : `true`), then simps will remove unused let-declarations:
245+
When `true` (default : `true`), then `simp` will remove unused `let` and `have` expressions:
244246
`let x := v; e` simplifies to `e` when `x` does not occur in `e`.
245247
-/
246248
zetaUnused : Bool := true
@@ -249,6 +251,19 @@ structure Config where
249251
convert them into `simp` exceptions.
250252
-/
251253
catchRuntime : Bool := true
254+
/--
255+
(Unimplemented)
256+
When `false` (default: `true`), then disables zeta reduction of `have` expressions.
257+
If `zeta` is `false`, then this option has no effect.
258+
Unused `have`s are still removed if `zeta` or `zetaUnused` are true.
259+
-/
260+
zetaHave : Bool := true
261+
/--
262+
(Unimplemented)
263+
When `true` (default : `true`), then `simp` will attempt to transform `let`s into `have`s
264+
if they are non-dependent. This only applies when `zeta := false`.
265+
-/
266+
letToHave : Bool := true
252267
deriving Inhabited, BEq
253268

254269
-- Configuration object for `simp_all`
@@ -270,6 +285,7 @@ def neutralConfig : Simp.Config := {
270285
ground := false
271286
zetaDelta := false
272287
zetaUnused := false
288+
letToHave := false
273289
}
274290

275291
structure NormCastConfig extends Simp.Config where

0 commit comments

Comments
 (0)