Skip to content

Qualify Constr.in_context for Rocq dev - #19

Draft
JasonGross wants to merge 2 commits into
Matafou:masterfrom
JasonGross:claude/rocq-dev-compat
Draft

Qualify Constr.in_context for Rocq dev#19
JasonGross wants to merge 2 commits into
Matafou:masterfrom
JasonGross:claude/rocq-dev-compat

Conversation

@JasonGross

@JasonGross JasonGross commented Jul 28, 2026

Copy link
Copy Markdown

Rocq dev (9.4+alpha) resolves unqualified Ltac2 in_context to this module's unit -> unit helper instead of the constructor-context primitive. Qualify the three calls as Constr.in_context.

Commit 9574016 was produced by a Claude coding agent. OpenAI Codex reproduced the failure and validated the library and tests:

  • opam exec --switch=rocq-dev-testing -- ./configure.sh
  • opam exec --switch=rocq-dev-testing -- make -j8 all

All library files and regression/demo tests pass.

Authorship note: this was researched and written by an AI coding agent
(OpenAI Codex), working on Jason Gross's behalf; Jason reviews what is
posted from this account.

Wordsmithed by Codex.

Rocq dev added a new `Constr.Unsafe.in_context` primitive with an extra
`constr option` argument (the optional let-binding body), keeping the
old three-argument `Constr.in_context` as an Ltac2-level wrapper.

`LibHypsNaming.v` does `Import Constr.Unsafe.`, so the unqualified
`in_context` now resolves to the new four-argument `Unsafe` version:

    Error: This expression has type unit -> unit
    but an expression was expected of type constr option

Qualify the three call sites as `Constr.in_context`, which names the
same function on Coq 8.x / Rocq 9.0-9.3 as well.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01L9BGQT7XUuubV6C619DW4b
@JasonGross

Copy link
Copy Markdown
Author

Superseded by #20, which retains the validated Claude compatibility commit and adds the required logical-library mapping fix on a distinct Codex branch. No changes were made to this PR's source branch.

Authorship note: this was researched and written by an AI coding agent
(OpenAI Codex), working on Jason Gross's behalf; Jason reviews what is
posted from this account.

map_all_hyps, map_all_hyps_rev and then_eachnh_gen all reach
Control.hyps via all_hyps_ident.  Control.hyps is a single-goal
primitive and raises Init.Not_focussed whenever more than one goal is
under focus, so any script writing

  1-4: onAllHyps (fun h => idtac h)
  all: onAllHypsRev (fun h => idtac h)

fails.  In 4.0 these tactics were pure Ltac1 and a range selector
dispatched them goal-wise automatically; 5.0 routes them through an
ltac2:() quotation, which evaluates in the multi-goal context instead.

Wrap each entry point in Control.enter, which reinstates the goal-wise
dispatch rather than choosing new semantics.  then_eachnh_gen already
had an inner Control.enter, but it guarded only hyps_after -- hyps_before
was computed in the caller's context and hit the exception one line
earlier.

Verified against rocq-dev 9.4+alpha:

  - five repros covering onAllHyps / onAllHypsRev / then_eachnh under
    `1-4:` and `all:` fail before and pass after; the single-focused-goal
    case passed both before and after, which is why this went unnoticed
  - tests/ is unchanged: all 14 files give byte-identical exit codes
    before and after (3 pass, 9 pre-existing `no Ltac named rename_depth`,
    2 pre-existing timeouts).  The 3 that pass are the ones exercising
    onAllHyps -- demo.v, LibHypsTest.v, LibHypsRegression.v
  - coq-matching-logic, which broke at Syntax.v:2968 on `1-3: wf_auto2`,
    now builds 87/87 with `dune build -p coq-matching-logic` (rc=0),
    matching what it reaches against LibHyps 4.0.0

Found by port-frozen's 4.0-vs-5.0 A/B.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01L9BGQT7XUuubV6C619DW4b
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant