[Verif] Add RefinementCheckingOp #8713
                
     Merged
            
            
          
      
        
          +122
        
        
          −26
        
        
          
        
      
    
  
  Add this suggestion to a batch that can be applied as a single commit.
  This suggestion is invalid because no changes were made to the code.
  Suggestions cannot be applied while the pull request is closed.
  Suggestions cannot be applied while viewing a subset of changes.
  Only one suggestion per line can be applied in a batch.
  Add this suggestion to a batch that can be applied as a single commit.
  Applying suggestions on deleted lines is not supported.
  You must change the existing code in this line in order to create a valid suggestion.
  Outdated suggestions cannot be applied.
  This suggestion has been applied or marked resolved.
  Suggestions cannot be applied from pending reviews.
  Suggestions cannot be applied on multi-line comments.
  Suggestions cannot be applied while the pull request is queued to merge.
  Suggestion cannot be applied right now. Please check back later.
  
    
  
    
This PR adds the
RefinementCheckingOpto theverifdialect. The motivation behind this operation is to be able to automatically check whether a 'target' circuit is a refinement of a 'source' circuit. This should be a small step towards performing translation validation comparable to Alive2. The operation is structurally identical to theLogicEquivalenceCheckingOp, so I factored out most of the ODS into a commonCircuitRelationCheckOp. If there is no non-determinism present in the circuits, the operation is also functionally identical toLogicEquivalenceCheckingOp.Finding a good definition of the
refinesrelation is hard, so please just consider this as a humble first attempt. In essence, there are (at least) three factors to consider:Our current definition of logical equivalence is too restrictive for translation validation. In the presence of non-determinism it is not guaranteed that
A == A, see #7025 . Stating that a circuit cannot be translated to itself is problematic.In contrast, the
RefinementCheckingOpas described here compares the sets of possible outputs for a given input. This ispotentially too permissive, as it allows a different non-deterministic value to be picked for each possible input assignment.
Note that the current specification of the undefined value in
combputs the non-determinism in the domain of functions, getting us dangerously close to second-order logic. While I think it is a good model for the likely behavior of real hardware, it is probably impractical for SMT modeling.