Add Constr.in_context_prod and Constr.in_context_letin to Ltac2#22060
Open
JasonGross wants to merge 1 commit into
Open
Add Constr.in_context_prod and Constr.in_context_letin to Ltac2#22060JasonGross wants to merge 1 commit into
JasonGross wants to merge 1 commit into
Conversation
JasonGross
added a commit
to theorem-labs/rocq
that referenced
this pull request
May 23, 2026
…tac2 (rocq-prover#22060) Backport of rocq-prover#22060 to v9.2. in_context_prod is a simple Ltac2 wrapper around in_context that converts the resulting Lambda to a Prod. in_context_letin is a new OCaml primitive that extends the proof context with a LetIn binding (LocalDef) instead of a hypothesis (LocalAssum), runs a callback to fill the body, and returns a LetIn term. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 task
Member
Author
|
@coqbot run full ci |
Add a new Unsafe.in_context primitive that extends the proof context with either a LocalAssum (when body_opt is None) or LocalDef (when body_opt is Some) and returns a (binder, body) pair. Three Ltac2 wrappers use this primitive: - in_context: wraps the result in Lambda (same behavior as the old external) - in_context_prod: wraps the result in Prod - in_context_letin: wraps the result in LetIn The old constr_in_context external is kept for backward compatibility. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
8915bee to
c3f57a6
Compare
Contributor
|
Do we really want to keep using goal mangllng? Wouldn't the direction of #21654 be better? |
Member
Author
|
Is #21654 almost ready? I agree that it is a better direction. |
Contributor
|
"just" need to convince @ppedrot to merge |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Constr.in_context_prod, an Ltac2 wrapper aroundConstr.in_contextthat converts the resultingLambdato aProd, for conveniently buildingforallbindersConstr.in_context_letin, a new OCaml primitive that extends the proof context with aLetInbinding (LocalDef) instead of a hypothesis (LocalAssum), runs a callback to fill the body viaControl.refine, and returns aLetIntermin_contextpattern and are declared inLtac2.ConstrTest plan
test-suite/ltac2/in_context_variants.vexercises both primitives:in_context_prodbuilds aforalland checks the result matches expected termin_context_letinbuilds alet ... inand checks the result matches expected termin_context_letinverifies that the let-bound variable's definition is available in the extended context (via definitional equalityeq_refl : x = 0)🤖 Generated with Claude Code