Skip to content

Add Constr.in_context_prod and Constr.in_context_letin to Ltac2#22060

Open
JasonGross wants to merge 1 commit into
rocq-prover:masterfrom
JasonGross:ltac2-in-context-variants
Open

Add Constr.in_context_prod and Constr.in_context_letin to Ltac2#22060
JasonGross wants to merge 1 commit into
rocq-prover:masterfrom
JasonGross:ltac2-in-context-variants

Conversation

@JasonGross

Copy link
Copy Markdown
Member

Summary

  • Add Constr.in_context_prod, an Ltac2 wrapper around Constr.in_context that converts the resulting Lambda to a Prod, for conveniently building forall binders
  • Add Constr.in_context_letin, 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 via Control.refine, and returns a LetIn term
  • Both follow the existing in_context pattern and are declared in Ltac2.Constr

Test plan

  • New test file test-suite/ltac2/in_context_variants.v exercises both primitives:
    • in_context_prod builds a forall and checks the result matches expected term
    • in_context_letin builds a let ... in and checks the result matches expected term
    • in_context_letin verifies that the let-bound variable's definition is available in the extended context (via definitional equality eq_refl : x = 0)

🤖 Generated with Claude Code

@JasonGross JasonGross requested a review from a team as a code owner May 23, 2026 21:10
@coqbot-app coqbot-app Bot added the needs: full CI The latest GitLab pipeline that ran was a light CI. Say "@coqbot run full ci" to get a full CI. label May 23, 2026
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>
@JasonGross JasonGross added kind: enhancement Enhancement to an existing user-facing feature, tactic, etc. part: ltac2 Issues and PRs related to the (in development) Ltac2 tactic langauge. labels May 23, 2026
@JasonGross

Copy link
Copy Markdown
Member Author

@coqbot run full ci

@coqbot-app coqbot-app Bot removed the needs: full CI The latest GitLab pipeline that ran was a light CI. Say "@coqbot run full ci" to get a full CI. label May 23, 2026
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>
@JasonGross JasonGross force-pushed the ltac2-in-context-variants branch from 8915bee to c3f57a6 Compare May 23, 2026 23:37
@coqbot-app coqbot-app Bot added the needs: full CI The latest GitLab pipeline that ran was a light CI. Say "@coqbot run full ci" to get a full CI. label May 23, 2026
@SkySkimmer

SkySkimmer commented May 26, 2026

Copy link
Copy Markdown
Contributor

Do we really want to keep using goal mangllng? Wouldn't the direction of #21654 be better?

@JasonGross

Copy link
Copy Markdown
Member Author

Is #21654 almost ready? I agree that it is a better direction.

@SkySkimmer

Copy link
Copy Markdown
Contributor

"just" need to convince @ppedrot to merge

@SkySkimmer SkySkimmer added the needs: discussion Further discussion is needed. label Jun 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kind: enhancement Enhancement to an existing user-facing feature, tactic, etc. needs: discussion Further discussion is needed. needs: full CI The latest GitLab pipeline that ran was a light CI. Say "@coqbot run full ci" to get a full CI. part: ltac2 Issues and PRs related to the (in development) Ltac2 tactic langauge.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants