Class EqualityInference


  • public class EqualityInference
    extends Object
    Makes equality based inferences to rewrite Expressions and generate equality sets in terms of specified symbol scopes
    • Method Detail

      • rewrite

        public Expression rewrite​(Expression expression,
                                  Set<Symbol> scope)
        Attempts to rewrite an Expression in terms of the symbols allowed by the symbol scope given the known equalities. Returns null if unsuccessful.
      • generateEqualitiesPartitionedBy

        public EqualityInference.EqualityPartition generateEqualitiesPartitionedBy​(Set<Symbol> scope)
        Dumps the inference equalities as equality expressions that are partitioned by the symbolScope. All stored equalities are returned in a compact set and will be classified into three groups as determined by the symbol scope:
        1. equalities that fit entirely within the symbol scope
        2. equalities that fit entirely outside of the symbol scope
        3. equalities that straddle the symbol scope
         Example:
           Stored Equalities:
             a = b = c
             d = e = f = g
        
           Symbol Scope:
             a, b, d, e
        
           Output EqualityPartition:
             Scope Equalities:
               a = b
               d = e
             Complement Scope Equalities
               f = g
             Scope Straddling Equalities
               a = c
               d = f
         
      • isInferenceCandidate

        public static boolean isInferenceCandidate​(Metadata metadata,
                                                   Expression expression)
        Determines whether an Expression may be successfully applied to the equality inference
      • nonInferrableConjuncts

        public static List<Expression> nonInferrableConjuncts​(Metadata metadata,
                                                              Expression expression)
        Provides a convenience Iterable of Expression conjuncts which have not been added to the inference