Preserve mapping between old and new representatives with AC symbols #823
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
repr
map) through "deep" rewriting into the AC leaf.When we have a class representative
rr
for a semantic valuer
, and a new class representativenrr
is found, the relations see an equality (withSubst
origin)r = nrr
. Normally, sincerr
is a term representative, we haverr --> rr
as a mapping, and so the relation will seerr = 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 addingrr --> 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 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_3
intoruqv0
which causes Alt-Ergo to not terminate with the CDCL solver)