mirror of
				https://github.com/ethereum/solidity
				synced 2023-10-03 13:03:40 +00:00 
			
		
		
		
	
		
			
				
	
	
		
			25 lines
		
	
	
		
			327 B
		
	
	
	
		
			Python
		
	
	
	
	
	
			
		
		
	
	
			25 lines
		
	
	
		
			327 B
		
	
	
	
		
			Python
		
	
	
	
	
	
from opcodes import EQ, ISZERO, SUB
 | 
						|
from rule import Rule
 | 
						|
from z3 import BitVec
 | 
						|
 | 
						|
"""
 | 
						|
Rule:
 | 
						|
ISZERO(SUB(X, Y)) -> EQ(X, Y)
 | 
						|
"""
 | 
						|
 | 
						|
rule = Rule()
 | 
						|
 | 
						|
n_bits = 256
 | 
						|
 | 
						|
# Input vars
 | 
						|
X = BitVec('X', n_bits)
 | 
						|
Y = BitVec('Y', n_bits)
 | 
						|
 | 
						|
# Non optimized result
 | 
						|
nonopt = ISZERO(SUB(X, Y))
 | 
						|
 | 
						|
# Optimized result
 | 
						|
opt = EQ(X, Y)
 | 
						|
 | 
						|
rule.check(nonopt, opt)
 |