Skip to content

Fix soundness bug with clone overrides of subtypes#1062

Merged
strub merged 1 commit into
mainfrom
fix-subtype
Jul 8, 2026
Merged

Fix soundness bug with clone overrides of subtypes#1062
strub merged 1 commit into
mainfrom
fix-subtype

Conversation

@oskgo

@oskgo oskgo commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

Emit error when overriding a subtype with a type that is not a subtype with compatible base type and predicate. See the added test for why this is a problem. The gist is that you could obtain theories with two sets of lemmas that are incompatible with each other, leading to contradictions.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR strengthens theory cloning soundness by rejecting subtype overrides that would otherwise allow cloning theories into inconsistent environments (potentially enabling contradictions).

Changes:

  • Adds a regression test that demonstrates an invalid subtype override during clone.
  • Extends cloning incompatibility reporting with subtype-specific incompatibility reasons (carrier type / predicate).
  • Implements subtype-compatibility checks during theory replay when overriding subtype-declared types.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
tests/subtype-override.ec New regression test ensuring invalid subtype overrides fail during cloning.
src/ecUserMessages.ml Adds user-facing error messages for subtype-specific incompatibilities.
src/ecTheoryReplay.ml Adds subtype compatibility checks and attempts to preserve subtype metadata across type overrides.
src/ecThCloning.mli Extends incompatible with subtype-specific variants.
src/ecThCloning.ml Mirrors the incompatible type extensions in the implementation.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/ecTheoryReplay.ml
Comment thread src/ecTheoryReplay.ml Outdated
@oskgo oskgo requested a review from strub July 1, 2026 15:24
@strub strub added this pull request to the merge queue Jul 8, 2026
Merged via the queue into main with commit 9ecaecc Jul 8, 2026
17 checks passed
@strub strub deleted the fix-subtype branch July 8, 2026 05:02
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.

3 participants