mirror of
				https://github.com/Brandon-Rozek/matmod.git
				synced 2025-11-03 03:11:12 +00: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
				
			
		
							
								
								
									
										12
									
								
								vsp.py
									
										
									
									
									
								
							
							
						
						
									
										12
									
								
								vsp.py
									
										
									
									
									
								
							| 
						 | 
					@ -48,8 +48,12 @@ 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:
 | 
				
			||||||
 | 
					                is_top = False
 | 
				
			||||||
 | 
					                break
 | 
				
			||||||
 | 
					        if is_top:
 | 
				
			||||||
            return x
 | 
					            return x
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    print("[Warning] Failed to find the top of the lattice")
 | 
					    print("[Warning] Failed to find the top of the lattice")
 | 
				
			||||||
| 
						 | 
					@ -64,8 +68,12 @@ 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:
 | 
				
			||||||
 | 
					                is_bottom = False
 | 
				
			||||||
 | 
					                break
 | 
				
			||||||
 | 
					        if is_bottom:
 | 
				
			||||||
            return x
 | 
					            return x
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    print("[Warning] Failed to find the bottom of the lattice")
 | 
					    print("[Warning] Failed to find the bottom of the lattice")
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue