(cond)
Extract all terms and test for each term if its truism impacts the truism of the entire condition. If not, the
        term is redundant and can be replaced with a True.
Extract all terms and test for each term if its truism impacts the truism of the entire condition. If not, the
        term is redundant and can be replaced with a True.
Extract all terms and test for each term if its truism impacts the truism of the entire condition . If not the term is redundant and can be replaced with a True .
def _remove_redundant_terms(cond):
        """
        Extract all terms and test for each term if its truism impacts the truism of the entire condition. If not, the
        term is redundant and can be replaced with a True.
        """

        all_terms = set()
        for term in ConditionProcessor._extract_terms(cond):
            if term not in all_terms:
                all_terms.add(term)

        negations = {}
        to_skip = set()
        all_terms_without_negs = set()
        for term in all_terms:
            if term in to_skip:
                continue
            neg = claripy.Not(term)
            if neg in all_terms:
                negations[term] = neg
                to_skip.add(neg)
                all_terms_without_negs.add(term)
            else:
                all_terms_without_negs.add(term)

        solver = claripy.SolverCacheless()
        for term in all_terms_without_negs:
            neg = negations.get(term, None)

            replaced_with_true = ConditionProcessor._replace_term_in_ast(cond, term, claripy.true, neg, claripy.false)
            sat0 = solver.satisfiable(extra_constraints=(cond, claripy.Not(replaced_with_true),))
            sat1 = solver.satisfiable(extra_constraints=(claripy.Not(cond), replaced_with_true,))
            if sat0 or sat1:
                continue

            replaced_with_false = ConditionProcessor._replace_term_in_ast(cond, term, claripy.false, neg, claripy.true)
            sat0 = solver.satisfiable(extra_constraints=(cond, claripy.Not(replaced_with_false),))
            sat1 = solver.satisfiable(extra_constraints=(claripy.Not(cond), replaced_with_false,))
            if sat0 or sat1:
                continue

            # TODO: Finish the implementation
            print(term, "is redundant")
def _remove_redundant_terms ( cond ) : all_terms = set ( ) for term in ConditionProcessor . _extract_terms ( cond ) : if term not in all_terms : all_terms . add ( term ) negations = { } to_skip = set ( ) all_terms_without_negs = set ( ) for term in all_terms : if term in to_skip : continue neg = claripy . Not ( term ) if neg in all_terms : negations [ term ] = neg to_skip . add ( neg ) all_terms_without_negs . add ( term ) else : all_terms_without_negs . add ( term ) solver = claripy . SolverCacheless ( ) for term in all_terms_without_negs : neg = negations . get ( term , None ) replaced_with_true = ConditionProcessor . _replace_term_in_ast ( cond , term , claripy . true , neg , claripy . false ) sat0 = solver . satisfiable ( extra_constraints = ( cond , claripy . Not ( replaced_with_true ) , ) ) sat1 = solver . satisfiable ( extra_constraints = ( claripy . Not ( cond ) , replaced_with_true , ) ) if sat0 or sat1 : continue replaced_with_false = ConditionProcessor . _replace_term_in_ast ( cond , term , claripy . false , neg , claripy . true ) sat0 = solver . satisfiable ( extra_constraints = ( cond , claripy . Not ( replaced_with_false ) , ) ) sat1 = solver . satisfiable ( extra_constraints = ( claripy . Not ( cond ) , replaced_with_false , ) ) if sat0 or sat1 : continue # TODO: Finish the implementation print ( term , "is redundant" )