Preserve mapping between old and new representatives with AC symbols#823
Draft
bclement-ocp wants to merge 1 commit intoOCamlPro:nextfrom
Draft
Preserve mapping between old and new representatives with AC symbols#823bclement-ocp wants to merge 1 commit intoOCamlPro:nextfrom
bclement-ocp wants to merge 1 commit intoOCamlPro:nextfrom
Conversation
In CC(X), the leaves are always terms that were present in the original problem: we do not introduce new uninterpreted terms. In AC(X), this is no longer true: we might introduce new AC leaves dynamically that are not themselves term representatives (i.e. they don't have an entry in the `repr` map) through "deep" rewriting into the AC leaf. When we have a class representative `rr` for a semantic value `r`, and a new class representative `nrr` is found, the relations see an equality (with `Subst` origin) `r = nrr`. Normally, since `rr` is a term representative, we have `rr --> rr` as a mapping, and so the relation will see `rr = nrr` and can use this to update its internal state. With these "dynamic" representative, when they later get override by a new representative, the relations will *not* see an `rr = nrr` equality, which makes its internal state get out of sync and can cause bugs. This patch makes it so that, when we encounter one of these "dynamic" representatives, we artificially add the `rr = nrr` equality (by adding `rr --> nrr` as a pivot, which will in turn cause the equality to show up). Since this case should only be possible with AC rewriting, the `rr = nrr` equality is only added in `up_uf_rs`, i.e. if there are AC rewrite rules. Fixes OCamlPro#474
Collaborator
Author
|
Marking as draft for now since, while the diagnosis is correct, I am not sure the fix is the right one. |
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.
In CC(X), the leaves are always terms that were present in the original problem: we do not introduce new uninterpreted terms.
In AC(X), this is no longer true: we might introduce new AC leaves dynamically that are not themselves term representatives (i.e. they don't have an entry in the
reprmap) through "deep" rewriting into the AC leaf.When we have a class representative
rrfor a semantic valuer, and a new class representativenrris found, the relations see an equality (withSubstorigin)r = nrr. Normally, sincerris a term representative, we haverr --> rras a mapping, and so the relation will seerr = nrrand can use this to update its internal state.With these "dynamic" representative, when they later get override by a new representative, the relations will not see an
rr = nrrequality, which makes its internal state get out of sync and can cause bugs.This patch makes it so that, when we encounter one of these "dynamic" representatives, we artificially add the
rr = nrrequality (by addingrr --> nrras a pivot, which will in turn cause the equality to show up).Since this case should only be possible with AC rewriting, the
rr = nrrequality is only added inup_uf_rs, i.e. if there are AC rewrite rules.Fixes #474
(Note that I did not add the original test case from #474 as a test — this is because since #731, we simplify
if true then ruqv0 else ur_3intoruqv0which causes Alt-Ergo to not terminate with the CDCL solver)