Skip to content

Implement map_var and subst_var for rty::Formula#89

Merged
coord-e merged 1 commit into
mainfrom
coord-e/formula-map-subst
May 17, 2026
Merged

Implement map_var and subst_var for rty::Formula#89
coord-e merged 1 commit into
mainfrom
coord-e/formula-map-subst

Conversation

@coord-e
Copy link
Copy Markdown
Owner

@coord-e coord-e commented May 17, 2026

for #88

existing specialized impl of Refinement::{map,subst}_var are renamed to *_free_var

Copy link
Copy Markdown

Copilot AI left a comment

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 extends rty::Formula with generic map_var and subst_var helpers and adjusts rty::Refinement’s previously-specialized variable mapping/substitution APIs to explicitly target only free variables (renaming to map_free_var / subst_free_var). This aligns the API surface with the follow-up work in #88 by making “map/subst which variables?” explicit.

Changes:

  • Add Formula::{map_var, subst_var} that delegate to the underlying chc::Body transformations while preserving the formula’s existential binder metadata.
  • Rename the specialized Refinement::{map_var, subst_var} to Refinement::{map_free_var, subst_free_var}, implemented in terms of the new Formula helpers.
  • Update call sites to use the renamed free-var APIs.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.

File Description
src/rty.rs Adds Formula::{map_var, subst_var} and renames/refactors Refinement free-variable mapping/substitution helpers.
src/rty/clause_builder.rs Updates refinement instantiation to use map_free_var when mapping free vars into CHC builder variables.
src/refine/env.rs Updates refinement handling to use map_free_var for free-var mapping prior to instantiation.
src/analyze/local_def.rs Updates refinement substitutions to use subst_free_var where only free vars should be rewritten.

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

@coord-e coord-e merged commit 361872e into main May 17, 2026
10 checks passed
@coord-e coord-e deleted the coord-e/formula-map-subst branch May 17, 2026 03:07
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