diff --git a/vsp.py b/vsp.py index 6a50c63..7420b68 100644 --- a/vsp.py +++ b/vsp.py @@ -48,13 +48,9 @@ def find_top(algebra: Set[ModelValue], mconjunction: Optional[ModelFunction], md return None for x in algebra: - is_top = True for y in algebra: - if mdisjunction(x, y) != x or mconjunction(x, y) != y: - is_top = False - break - if is_top: - return x + if mdisjunction(x, y) == x and mconjunction(x, y) == y: + return x print("[Warning] Failed to find the top of the lattice") return None @@ -68,13 +64,9 @@ def find_bottom(algebra: Set[ModelValue], mconjunction: Optional[ModelFunction], return None for x in algebra: - is_bottom = True for y in algebra: - if mdisjunction(x, y) != y or mconjunction(x, y) != x: - is_bottom = False - break - if is_bottom: - return x + if mdisjunction(x, y) == y and mconjunction(x, y) == x: + return x print("[Warning] Failed to find the bottom of the lattice") return None