Implement map_var and subst_var for rty::Formula#89
Merged
Conversation
There was a problem hiding this comment.
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 underlyingchc::Bodytransformations while preserving the formula’s existential binder metadata. - Rename the specialized
Refinement::{map_var, subst_var}toRefinement::{map_free_var, subst_free_var}, implemented in terms of the newFormulahelpers. - 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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
for #88
existing specialized impl of Refinement::{map,subst}_var are renamed to *_free_var