Skip to content

feat: adapt non-equality theorems in mkTheoremFromDecl#13041

Merged
leodemoura merged 1 commit intomasterfrom
lean-sym-interactive-8
Mar 22, 2026
Merged

feat: adapt non-equality theorems in mkTheoremFromDecl#13041
leodemoura merged 1 commit intomasterfrom
lean-sym-interactive-8

Conversation

@leodemoura
Copy link
Copy Markdown
Member

This PR extends mkTheoremFromDecl and mkTheoremFromExpr to handle
theorems whose conclusion is not an equality, enabling Sym.simp to use
a broader class of lemmas as rewrite rules.

Adaptations:

  • ¬ pp = False via eq_false
  • p ↔ qp = q via propext
  • p (proposition) → p = True via eq_true

Conjunctions (p ∧ q) are not handled here since the SymM E-graph
aggressively splits them via case analysis.

`mkTheoremFromDecl` and `mkTheoremFromExpr` now handle theorems whose
conclusion is not an equality:
- `¬ p` → adapted to `p = False` via `eq_false`
- `p ↔ q` → adapted to `p = q` via `propext`
- `p` (proposition) → adapted to `p = True` via `eq_true`

This enables `Sym.simp` to use hypotheses like `h : p x` as rewrite
rules that replace `p x` with `True`.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@leodemoura leodemoura added the changelog-tactics User facing tactics label Mar 22, 2026
@leodemoura leodemoura enabled auto-merge March 22, 2026 19:26
@leodemoura leodemoura added this pull request to the merge queue Mar 22, 2026
Merged via the queue into master with commit b858d0f Mar 22, 2026
21 checks passed
leodemoura added a commit that referenced this pull request Mar 22, 2026
The `simp` tactic in `sym =>` mode now resolves identifiers in the extra
theorem list against local hypotheses first, falling back to global
constants. Local hypotheses are adapted via `mkTheoremFromExpr` (using
the `eq_true`/`eq_false`/`propext` adapter from #13041).

- Add `ExtraTheorem` inductive (`.const` / `.fvar`) for cache keying
- Add `resolveExtraTheorem` that checks the local context before globals
- Update `addExtraTheorems`, `mkDefaultMethods`, `elabVariant` signatures

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
github-merge-queue bot pushed a commit that referenced this pull request Mar 22, 2026
This PR extends the `simp` tactic in `sym =>` mode to support local
hypotheses in the extra theorem list.

`simp myVariant [h]` now resolves `h` against the local context first,
falling back to global constants. Local hypotheses are converted to
rewrite rules via `mkTheoremFromExpr`, which applies the `eq_true`/
`eq_false`/`propext` adapter from #13041.

- Add `ExtraTheorem` inductive (`.const` / `.fvar`) for cache keying
- Add `resolveExtraTheorems` that checks the local context before
globals
- Update `addExtraTheorems`, `mkDefaultMethods`, `elabVariant`
signatures

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

changelog-tactics User facing tactics

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant