lean4-htt/src/Std
Joachim Breitner ac9a1cb415
feat: add @[backward_defeq] attribute and local useBackward simp option (#13492)
This PR introduces stricter inference for the `@[defeq]` attribute and a
companion `@[backward_defeq]` attribute that preserves the pre-PR
behavior
as an opt-in.

### What changed

* `@[defeq]` is now inferred only when the equation holds at
  `.instances` transparency (the transparency `dsimp` operates at).
* `@[backward_defeq]` is the old set: every theorem whose `rfl` proof
the legacy inference would have accepted is tagged `@[backward_defeq]`,
  so `defeq ⊆ backward_defeq` holds by construction.
* The option `backward.defeqAttrib.useBackward` (default `false`) makes
  `dsimp` also use `@[backward_defeq]` theorems, restoring the pre-PR
  behavior for a specific proof or file.
* The option is eqn-affecting: its value at the point of a function's
  definition is recorded so that the equation lemmas later generated for
  that function use the same value, regardless of the ambient option at
  the use site.

### Mathlib adaption

A companion adaption branch (`lean-pr-testing-backward-defeq-attrib` on
mathlib4) builds cleanly against this PR and passes `lake test` without
warnings. Most adaption changes are scoped
`set_option backward.defeqAttrib.useBackward true in` additions on the
failing declarations; a small number of files needed proof-level edits
where the stored form of a `dsimp%`/`@[reassoc]`/`@[elementwise]`
/`@[simps]`/`@[to_app]`-generated lemma had drifted under the stricter
regime.

---------

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-27 10:07:59 +00:00
..
Async refactor: move Async and Http from Internal to Std (#13511) 2026-04-23 19:55:22 +00:00
Data feat: add @[backward_defeq] attribute and local useBackward simp option (#13492) 2026-04-27 10:07:59 +00:00
Do chore: rename mvcgen_invariant_type attribute to spec_invariant_type, part 2 (#13157) 2026-03-27 13:06:17 +00:00
Http refactor: move Async and Http from Internal to Std (#13511) 2026-04-23 19:55:22 +00:00
Internal refactor: move Async and Http from Internal to Std (#13511) 2026-04-23 19:55:22 +00:00
Net feat: introduce HTTP/1.1 server (#12151) 2026-04-20 16:25:45 +00:00
Sat perf: remove the additional relabeling step during AIG to CNF conversion (#12480) 2026-02-14 17:08:07 +00:00
Sync refactor: move Async and Http from Internal to Std (#13511) 2026-04-23 19:55:22 +00:00
Tactic feat: use explicit allowlist instead of transparency bump in whnfMatcher (#13363) 2026-04-24 13:50:30 +00:00
Time fix: assorted fixes in the string library (#13201) 2026-03-31 06:28:20 +00:00
Async.lean refactor: move Async and Http from Internal to Std (#13511) 2026-04-23 19:55:22 +00:00
Data.lean feat: String.toNat? lemmas (#12828) 2026-03-19 11:02:56 +00:00
Do.lean chore: remove public section from end of files (#10684) 2025-10-06 13:30:48 +00:00
Http.lean refactor: move Async and Http from Internal to Std (#13511) 2026-04-23 19:55:22 +00:00
Internal.lean refactor: move Async and Http from Internal to Std (#13511) 2026-04-23 19:55:22 +00:00
Net.lean chore: remove public section from end of files (#10684) 2025-10-06 13:30:48 +00:00
Sat.lean chore: remove public section from end of files (#10684) 2025-10-06 13:30:48 +00:00
Sync.lean feat: introduce HTTP/1.1 server (#12151) 2026-04-20 16:25:45 +00:00
Tactic.lean refactor: module-ize remainder of Std (#9195) 2025-07-17 11:43:57 +00:00
Time.lean style: fix typos in Init/ and Std/ docstrings (#11864) 2026-01-09 07:24:07 +00:00