Model of R that has VSP

This commit is contained in:
Brandon Rozek 2024-05-03 17:04:03 -04:00
parent e105c4bf5e
commit f3c82f090f
No known key found for this signature in database
GPG key ID: 26E457DA82C9F480
2 changed files with 188 additions and 14 deletions

View file

@ -212,15 +212,10 @@ def model_closure(initial_set: Set[ModelValue], mfunctions: Set[ModelFunction]):
return current_set
def violates_vsp(model: Model, interpretation: Dict[Operation, ModelFunction]) -> bool:
def has_vsp(model: Model, interpretation: Dict[Operation, ModelFunction]) -> bool:
"""
Tells you whether a model violates the
variable sharing property.
If it returns false, it is still possible that
the variable sharing property is violated
just that we didn't check for the appopriate
subalgebras.
"""
impfunction = interpretation[Implication]
@ -233,6 +228,8 @@ def violates_vsp(model: Model, interpretation: Dict[Operation, ModelFunction]) -
if impfunction(x, y) not in model.designated_values:
I.add((x, y))
print("I", [(str(x), str(y)) for (x, y) in I])
# Construct the powerset without the empty set
s = list(I)
I_power = chain.from_iterable(combinations(s, r) for r in range(1, len(s) + 1))
@ -251,12 +248,18 @@ def violates_vsp(model: Model, interpretation: Dict[Operation, ModelFunction]) -
# If the carrier set intersects, then we violate VSP
if len(carrier_set_left & carrier_set_right) > 0:
print("FAIL: Carrier sets intersect")
return True
continue
# print("FAIL: Carrier sets intersect")
# print(xys)
# return True
for (x2, y2) in product(carrier_set_left, carrier_set_right):
if impfunction(x2, y2) in model.designated_values:
continue
print(f"({x2}, {y2}) take on a designated value")
return True
return True
return False