Skip to content

Show variable origins and clause context in SMT2 comments - #273

Merged
coord-e merged 4 commits into
mainfrom
clause-var-mapping
Sep 23, 2026
Merged

coord-e merged 4 commits into
mainfrom
clause-var-mapping

Conversation

@coord-e

@coord-e coord-e commented Sep 23, 2026

Copy link
Copy Markdown
Owner

SMT2 variables such as v0 do not show which environment binding or refinement variable they represent. Preserve this information in dedicated clause-origin types and print it before each assert, with the environment under Γ, assumptions as _: { p }, and grouped body entries followed by head. Variable mappings appear directly beneath the corresponding entry, including existential variables, without changing SMT variable names.

A separate commit fixes an extra leading space when pretty-printing atoms without guards.

Validation: cargo test --lib (3 passed), cargo fmt --all -- --check, the passing and failing simple_mut examples with Z3, and annot_exists with PCSat. The layout change preserves the non-comment SMT tokens in the simple_mut output.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot review overview

🟢 Approval recommended

Only a minor request for regression coverage remains; no approval-blocking issues were identified.

Review effort: Balanced
Findings: None

What changed in this PR

Adds source-level provenance to SMT-LIB2 comments while preserving solver-facing constraints and variable names.

Changes:

  • Tracks environment, body, head, and existential origins.
  • Prints structured origin comments before assertions.
  • Fixes leading whitespace for unguarded atoms.
File Description
src/​rty/​subtyping.rs Records function parameter origins.
src/​rty/​clause_builder.rs Records refinement and existential mappings.
src/​refine/​env.rs Captures binding and assumption origins.
src/​chc/​unbox.rs Preserves origins during unboxing.
src/​chc/​smtlib2.rs Renders structured clause-origin comments.
src/​chc/​debug/​origin.rs Defines provenance metadata and mappings.
src/​chc/​debug.rs Exposes the origin module.
src/​chc/​clause_builder.rs Propagates origins into generated clauses.
src/​chc.rs Adds origins and fixes atom formatting.
src/​analyze/​crate_.rs Records entry-parameter mappings.
src/​analyze/​basic_block.rs Records block parameter and assumption origins.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@coord-e
coord-e marked this pull request as ready for review September 23, 2026 10:36
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, you can upgrade your account or add credits to your account and enable them for code reviews in your settings.

@coord-e
coord-e merged commit 5d49ccb into main Sep 23, 2026
7 checks passed
@coord-e
coord-e deleted the clause-var-mapping branch September 23, 2026 12:44
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.

2 participants