mirror of
https://github.com/Brandon-Rozek/matmod.git
synced 2024-11-20 21:56:29 -05:00
Correctly find the top and bottom of the order lattice
This commit is contained in:
parent
6317dc054f
commit
087cbb278e
1 changed files with 12 additions and 4 deletions
16
vsp.py
16
vsp.py
|
@ -48,9 +48,13 @@ def find_top(algebra: Set[ModelValue], mconjunction: Optional[ModelFunction], md
|
||||||
return None
|
return None
|
||||||
|
|
||||||
for x in algebra:
|
for x in algebra:
|
||||||
|
is_top = True
|
||||||
for y in algebra:
|
for y in algebra:
|
||||||
if mdisjunction(x, y) == x and mconjunction(x, y) == y:
|
if mdisjunction(x, y) != x or mconjunction(x, y) != y:
|
||||||
return x
|
is_top = False
|
||||||
|
break
|
||||||
|
if is_top:
|
||||||
|
return x
|
||||||
|
|
||||||
print("[Warning] Failed to find the top of the lattice")
|
print("[Warning] Failed to find the top of the lattice")
|
||||||
return None
|
return None
|
||||||
|
@ -64,9 +68,13 @@ def find_bottom(algebra: Set[ModelValue], mconjunction: Optional[ModelFunction],
|
||||||
return None
|
return None
|
||||||
|
|
||||||
for x in algebra:
|
for x in algebra:
|
||||||
|
is_bottom = True
|
||||||
for y in algebra:
|
for y in algebra:
|
||||||
if mdisjunction(x, y) == y and mconjunction(x, y) == x:
|
if mdisjunction(x, y) != y or mconjunction(x, y) != x:
|
||||||
return x
|
is_bottom = False
|
||||||
|
break
|
||||||
|
if is_bottom:
|
||||||
|
return x
|
||||||
|
|
||||||
print("[Warning] Failed to find the bottom of the lattice")
|
print("[Warning] Failed to find the bottom of the lattice")
|
||||||
return None
|
return None
|
||||||
|
|
Loading…
Reference in a new issue