Skip to content

Fix singleton extraction after implicit erasure - #22349

Open
JiaJunDeng5930 wants to merge 1 commit into
rocq-prover:masterfrom
JiaJunDeng5930:agent/fix-extraction-implicit-singleton
Open

Fix singleton extraction after implicit erasure#22349
JiaJunDeng5930 wants to merge 1 commit into
rocq-prover:masterfrom
JiaJunDeng5930:agent/fix-extraction-implicit-singleton

Conversation

@JiaJunDeng5930

Copy link
Copy Markdown

Fixes #22348

Summary

  • Classify singleton inductives from constructor fields that remain after logical erasure and Extraction Implicit.
  • Reuse the same constructor-field filter when producing the extracted inductive packets.
  • Add regression coverage for constructor applications, pattern matches, parameter offsets, and the existing SafeImplicits diagnostic.

Root cause

extract_really_ind only excluded logical fields when deciding whether an inductive used the Singleton representation. extract_inductive later also removed fields declared through Extraction Implicit. Erasing the sole field could therefore leave a Singleton with no payload, violating the assumptions in constructor and match lowering.

When no field remains, the corrected classification uses the Standard representation. Code that does not depend on the erased field now extracts as a nullary constructor; code that still depends on it reaches the existing SafeImplicits error.

Testing

  • opam exec -- dune exec --root . rocq -- compile -q -bt test-suite/bugs/bug_22348.v

  • The same focused command passed for test-suite/success/extraction_impl.v, test-suite/bugs/bug_11114.v, and test-suite/bugs/bug_13581.v.

  • git diff --check

  • Added / updated test-suite.

@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 Aug 14, 2026
@JiaJunDeng5930

Copy link
Copy Markdown
Author

@coqbot run full ci

@coqbot-app

coqbot-app Bot commented Aug 15, 2026

Copy link
Copy Markdown
Contributor

Sorry, @JiaJunDeng5930, I only accept requests from members of the @rocq-prover/contributors team. If you are a regular contributor, you can request to join the team by asking any core developer.

@JiaJunDeng5930
JiaJunDeng5930 marked this pull request as ready for review August 15, 2026 05:35
@JiaJunDeng5930
JiaJunDeng5930 requested a review from a team as a code owner August 15, 2026 05:35
@ppedrot

ppedrot commented Aug 15, 2026

Copy link
Copy Markdown
Member

@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 Aug 15, 2026
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.

Extraction Implicit on the sole field of a singleton inductive crashes in extract_cons_app

2 participants