lean4-htt/src/Lean/Meta/Tactic/Simp
Joachim Breitner dc001a01e5
feat: binderNameHint (#6947)
This PR adds the `binderNameHint` gadget. It can be used in rewrite and
simp rules to preserve a user-provided name where possible.

The expression `binderNameHint v binder e` defined to be `e`.

If it is used on the right-hand side of an equation that is applied by a
tactic like `rw` or `simp`,
and `v` is a local variable, and `binder` is an expression that (after
beta-reduction) is a binder
(so `fun w => …` or `∀ w, …`), then it will rename `v` to the name used
in the binder, and remove
the `binderNameHint`.

A typical use of this gadget would be as follows; the gadget ensures
that after rewriting, the local
variable is still `name`, and not `x`:
```
theorem all_eq_not_any_not (l : List α) (p : α → Bool) :
    l.all p = !l.any fun x => binderNameHint x p (!p x) := sorry

example (names : List String) : names.all (fun name => "Waldo".isPrefixOf name) = true := by
  rw [all_eq_not_any_not]
  -- ⊢ (!names.any fun name => !"Waldo".isPrefixOf name) = true
```

This gadget is supported by `simp`, `dsimp` and `rw` in the
right-hand-side of an equation, but not
in hypotheses or by other tactics.
2025-02-06 11:03:27 +00:00
..
BuiltinSimprocs fix: fix builtin simproc Nat.reduceAnd (#6773) 2025-01-25 12:57:24 +00:00
Attr.lean refactor: mark the Simp.Context constructor as private 2024-11-13 14:12:55 +11:00
BuiltinSimprocs.lean feat: simprocs for #[1,2,3,4,5][2] (#4765) 2024-07-17 03:05:17 +00:00
Diagnostics.lean fix: add workaround for MessageData limitations (#6669) 2025-01-16 16:58:20 +00:00
Main.lean feat: zetaUnused option (implementation) (#6755) 2025-01-26 11:14:12 +00:00
RegisterCommand.lean feat: attribute [simp ←] (#5870) 2024-10-29 11:07:08 +00:00
Rewrite.lean feat: binderNameHint (#6947) 2025-02-06 11:03:27 +00:00
SimpAll.lean chore: avoid runtime array bounds checks (#6134) 2024-11-21 05:04:52 +00:00
SimpCongrTheorems.lean feat: make it possible to use dot notation in m! strings (#5857) 2024-10-27 22:55:29 +00:00
Simproc.lean fix: isDefEq, whnf, simp caching and configuration (#6053) 2024-11-18 01:17:26 +00:00
SimpTheorems.lean refactor: simpMatch to not etaStruct (#6901) 2025-02-01 19:04:05 +00:00
Types.lean feat: zetaUnused option (option only) (#6754) 2025-01-23 14:37:41 +00:00