mirror of
https://github.com/Brandon-Rozek/matmod.git
synced 2025-12-19 05:10:25 +00:00
Only discard when top is in the right subalgebra or bottom is in the left
This commit is contained in:
parent
f057ba64fc
commit
30ad57c867
2 changed files with 17 additions and 27 deletions
18
vsp.py
18
vsp.py
|
|
@ -145,30 +145,28 @@ def has_vsp(model: Model, interpretation: Dict[Operation, ModelFunction]) -> VSP
|
|||
continue
|
||||
|
||||
# NOTE: Optimization
|
||||
# if either subalgebra contains top or bottom, move
|
||||
# onto the next pair
|
||||
if top is not None and (top in xs or top in ys):
|
||||
# If the left subalgebra contains bottom
|
||||
# or the right subalgebra contains top
|
||||
# skip this pair
|
||||
if top is not None and top in ys:
|
||||
continue
|
||||
if bottom is not None and (bottom in xs or bottom in ys):
|
||||
if bottom is not None and bottom in xs:
|
||||
continue
|
||||
|
||||
# Compute the closure of all operations
|
||||
# with just the xs
|
||||
carrier_set_left: Set[ModelValue] = model_closure(xs, model.logical_operations, top, bottom)
|
||||
carrier_set_left: Set[ModelValue] = model_closure(xs, model.logical_operations, bottom)
|
||||
|
||||
# Save to cache
|
||||
if cached_xs[0] is not None and not cached_ys[1]:
|
||||
closure_cache.append((orig_xs, carrier_set_left))
|
||||
|
||||
if top is not None and top in carrier_set_left:
|
||||
continue
|
||||
if bottom is not None and bottom in carrier_set_left:
|
||||
continue
|
||||
|
||||
|
||||
# Compute the closure of all operations
|
||||
# with just the ys
|
||||
carrier_set_right: Set[ModelValue] = model_closure(ys, model.logical_operations, top, bottom)
|
||||
carrier_set_right: Set[ModelValue] = model_closure(ys, model.logical_operations, top)
|
||||
|
||||
# Save to cache
|
||||
if cached_ys[0] is not None and not cached_ys[1]:
|
||||
|
|
@ -176,8 +174,6 @@ def has_vsp(model: Model, interpretation: Dict[Operation, ModelFunction]) -> VSP
|
|||
|
||||
if top is not None and top in carrier_set_right:
|
||||
continue
|
||||
if bottom is not None and bottom in carrier_set_right:
|
||||
continue
|
||||
|
||||
# If the carrier set intersects, then move on to the next
|
||||
# subalgebra
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue