lean4-htt/tests/bench/sym
Leonardo de Moura d2907b5c96
feat: add contextDependent to Sym.simp Result with two-tier cache (#12996)
This PR adds per-result `contextDependent` tracking to `Sym.Simp.Result`
and splits the simplifier cache into persistent (context-independent)
and transient (context-dependent, cleared on binder entry). This
replaces the coarse `wellBehavedMethods` flag.

Key changes:
- Add `contextDependent : Bool := false` to `Result.rfl` and
`Result.step`
- Split `State.cache` into `persistentCache` and `transientCache`
- Remove `wellBehavedMethods` from `Methods`
- Replace `withoutModifyingCacheIfNotWellBehaved` with
`withFreshTransientCache`
- Change `DischargeResult` to an inductive (`.failed`/`.solved`)
- Add `dischargeAssumption` (context-dependent discharger for testing)
- Add `sym.simp.debug.cache` trace class
- Propagate `contextDependent` through all combinators (congruence,
transitivity, control flow, arrows, rewriting)
- Add `mkRflResult`/`mkRflResultCD` to avoid dynamic allocation of rfl
results
- Fix `isRfl` to ignore `contextDependent` (was silently broken by the
extra field)

Propagation invariant: when combining sub-results, `cd` is the
disjunction of ALL sub-results' flags — including `.rfl` results. If
`simp` returned `.rfl (contextDependent := true)`, it means `simp` might
take a completely different code path in another local context, so all
downstream results must be marked context-dependent.

---------

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-20 00:22:08 +00:00
..
add_sub_cancel.lean feat: add Goal API for SymM + grind (#12143) 2026-01-24 20:30:08 +00:00
meta_simp_1.lean chore: include free variables (#11894) 2026-01-04 18:51:18 +00:00
meta_simp_2.lean test: benchmarks for lambda-telescopes (#11929) 2026-01-08 00:20:03 +00:00
meta_simp_4.lean feat: simpForall and simpArrow in Sym.simp (#11950) 2026-01-09 06:20:04 +00:00
shallow_add_sub_cancel.lean feat: add Goal API for SymM + grind (#12143) 2026-01-24 20:30:08 +00:00
shallow_add_sub_cancel_grind.lean test: local rewrite with Sym.simp (#12147) 2026-01-25 01:32:50 +00:00
simp_1.lean feat: add contextDependent to Sym.simp Result with two-tier cache (#12996) 2026-03-20 00:22:08 +00:00
simp_2.lean feat: add contextDependent to Sym.simp Result with two-tier cache (#12996) 2026-03-20 00:22:08 +00:00
simp_3.lean feat: add contextDependent to Sym.simp Result with two-tier cache (#12996) 2026-03-20 00:22:08 +00:00
simp_4.lean feat: add contextDependent to Sym.simp Result with two-tier cache (#12996) 2026-03-20 00:22:08 +00:00