Added case for when negation is defined

This commit is contained in:
Brandon Rozek 2025-02-09 11:28:09 -05:00
parent 4b907281a5
commit d431030b41
2 changed files with 12 additions and 6 deletions

7
vsp.py
View file

@ -107,7 +107,10 @@ Subalgebra 1: {set_to_str(self.subalgebra1)}
Subalgebra 2: {set_to_str(self.subalgebra2)}
"""
def has_vsp(model: Model, impfunction: ModelFunction, mconjunction: Optional[ModelFunction] = None, mdisjunction: Optional[ModelFunction] = None) -> VSP_Result:
def has_vsp(model: Model, impfunction: ModelFunction,
mconjunction: Optional[ModelFunction] = None,
mdisjunction: Optional[ModelFunction] = None,
mnegation: Optional[ModelFunction] = None) -> VSP_Result:
"""
Checks whether a model has the variable
sharing property.
@ -173,6 +176,8 @@ def has_vsp(model: Model, impfunction: ModelFunction, mconjunction: Optional[Mod
# If the subalgebras are order-dependent, skip this pair
if order_dependent(xs, ys, model.ordering):
continue
if mnegation is not None and order_dependent(ys, xs, model.ordering):
continue
# Compute the closure of all operations
# with just the xs