Skip to content

Ship the reference Rocq extraction setup (rocq/, ExtrEncore.v) - #24

Merged
vbergeron merged 1 commit into
mainfrom
claude/zen-babbage-72xoce
Sep 23, 2026
Merged

vbergeron merged 1 commit into
mainfrom
claude/zen-babbage-72xoce

Conversation

@vbergeron

Copy link
Copy Markdown
Owner

Add the Encore.Extraction Rocq theory (opam package rocq-encore, Rocq
9.1, dune >= 3.21), based on encore-benchmarks' EncoreExtraction.v and
EncoreInput.v:

  • ExtrEncore.v: nat -> VM integer; add/mul/sub/pred/min/max/eqb/leb/
    ltb/even/odd/div/modulo/div2/land/lor/lxor/shiftl/shiftr mapped to
    primitives for both Init.Nat and PeanoNat.Nat (with the reason
    written down); bool/list/prod constructor names pinned to the
    pre-registered False/True/Nil/Cons/Pair. Without the pin, a nat
    literal above 5000 pulls in Decimal.uint and Rocq renames list's Nil
    to Nil1.
  • ExtrEncoreBytes.v: abstract bytes type over the byte-string
    primitives; bytes_of_string is the identity on string literals
    folded by the frontend (Compile-time folding of Rocq-extracted (String (Ascii ...)) to native byte sequences #7), so ascii/string stay at their default
    extraction.
  • ExtrEncoreInput.v: the Parameter + (extern (slot N) ...) idiom, with
    its trust assumption.

examples/gcd now extracts through the library (no more opaque wrappers)
and a new examples/digits covers div/mod, lists and byte strings. Both
.scm files are promoted by dune and committed.

CI: a rocq job runs dune build in rocq/rocq-prover:9.1 and fails if the
committed extraction differs; an extracted job compiles and runs both
examples with the encore CLI. A Rust test checks the pinned names
against CtorRegistry and runs the extracted examples.

SCHEME.md gains "Extracting from Rocq" and "Trust assumptions"
sections; README and CLAUDE.md point to them.

Fixes #19

Co-Authored-By: Claude Opus 5.5 noreply@anthropic.com
Claude-Session: https://claude.ai/code/session_0175AB987hvh5vSeisGfEpq7

Add the Encore.Extraction Rocq theory (opam package rocq-encore, Rocq
9.1, dune >= 3.21), based on encore-benchmarks' EncoreExtraction.v and
EncoreInput.v:

- ExtrEncore.v: nat -> VM integer; add/mul/sub/pred/min/max/eqb/leb/
  ltb/even/odd/div/modulo/div2/land/lor/lxor/shiftl/shiftr mapped to
  primitives for both Init.Nat and PeanoNat.Nat (with the reason
  written down); bool/list/prod constructor names pinned to the
  pre-registered False/True/Nil/Cons/Pair. Without the pin, a nat
  literal above 5000 pulls in Decimal.uint and Rocq renames list's Nil
  to Nil1.
- ExtrEncoreBytes.v: abstract bytes type over the byte-string
  primitives; bytes_of_string is the identity on string literals
  folded by the frontend (#7), so ascii/string stay at their default
  extraction.
- ExtrEncoreInput.v: the Parameter + (extern (slot N) ...) idiom, with
  its trust assumption.

examples/gcd now extracts through the library (no more opaque wrappers)
and a new examples/digits covers div/mod, lists and byte strings. Both
.scm files are promoted by dune and committed.

CI: a rocq job runs dune build in rocq/rocq-prover:9.1 and fails if the
committed extraction differs; an extracted job compiles and runs both
examples with the encore CLI. A Rust test checks the pinned names
against CtorRegistry and runs the extracted examples.

SCHEME.md gains "Extracting from Rocq" and "Trust assumptions"
sections; README and CLAUDE.md point to them.

Fixes #19

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0175AB987hvh5vSeisGfEpq7
@vbergeron
vbergeron merged commit 352ad39 into main Sep 23, 2026
4 checks passed
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.

Ship a reference Rocq extraction setup (ExtrEncore.v) with the toolchain

2 participants