• Top
    • Documentation
    • Books
    • Boolean-reasoning
      • Ipasir
      • Aignet
      • Aig
        • Aig-constructors
          • Aig-and
            • Aig-and-main
            • Aig-and-pass6a
            • Aig-and-pass5
            • Aig-and-pass3
            • Aig-and-pass4a
            • Aig-and-pass6
            • Aig-and-pass2a
            • Aig-and-pass2
            • Aig-and-pass4
            • Aig-and-dumb
            • Aig-negation-p
            • Aig-and-pass1
            • Aig-binary-and
            • Aig-and-macro-exec-part
            • Aig-and-macro-logic-part
          • Aig-or-list
          • Aig-and-list
          • Aig-or
          • Aig-not
          • Aig-implies
          • Aig-implies-lists
          • Aig-xor-lists
          • Aig-xor
          • Aig-orc2-lists
          • Aig-or-lists
          • Aig-nor-lists
          • Aig-nand-lists
          • Aig-iff-lists
          • Aig-iff
          • Aig-andc2-lists
          • Aig-andc1-lists
          • Aig-and-lists
          • Aig-not-list
          • Aig-ite
          • Aig-orc1-lists
          • Aig-orc1
          • Aig-nand
          • Aig-orc2
          • Aig-nor
          • Aig-andc2
          • Aig-andc1
        • Aig-vars
        • Aig-sat
        • Bddify
        • Aig-substitution
        • Aig-other
        • Aig-semantics
        • Aig-and-count
      • Satlink
      • Truth
      • Ubdds
      • Bdd
      • Faig
      • Bed
      • 4v
    • Projects
    • Debugging
    • Std
    • Proof-automation
    • Macro-libraries
    • ACL2
    • Interfacing-tools
    • Hardware-verification
    • Software-verification
    • Math
    • Testing-utilities
  • Aig-constructors

Aig-and

(aig-and x1 x2 ...) constructs an AIG representing (and x1 x2 ...).

The main function is aig-binary-and. It implements something like the algorithm described in:

  • Robert Brummayer and Armin Biere. Local Two-Level And Inverter Graph Minimization Without Blowup. Mathematical and Engineering Methods in Computer Science (MEMICS). 2006.

In particular, see Table 2 in that paper, which describes optimization rules that are ``locally size decreasing without affecting global sharing negatively.''

We try to implement these rules in aig-and-main, which returns:

(mv status arg1 arg2)

The status is either:

  • :fail if no rule applies, in which case arg1 and arg2 are just copies of x and y and we need to construct a new AND node that joins them together;
  • :subterm if a rewrite rule applies that reduces the AND of x and y to either a constant or to a subterm of x or y. This subterm is returned as both arg1 and arg2. In this case, we assume there is no more rewriting to be done and just return the reduced subterm.
  • :reduced if a rewrite rule applies that reduces the AND in some interesting way, where it is no longer a proper subterm of x or y. In this case, it may be possible to further reduce arg1 and arg2, so we want to recursively rewrite them.

aig-and itself is a macro which extends aig-binary-and across many arguments. As one last special optimization, when there is more than one argument we try to "short-circuit" the computation and avoid evaluating some arguments.

See also aig-and-dumb, which is much less sophisticated but may be easier to reason about in certain cases where you really care about the structure of the resulting AIGs.

A June 2015 experiment suggests that, for a particular 80-bit floating point addition problem, this fancier algorithm improves the size of AIGs produced by sv by about 3% when measured either by unique AND nodes or by unique conses.

Macro: aig-and

(defmacro aig-and (&rest args)
  (cons 'mbe
        (cons ':logic
              (cons (aig-and-macro-logic-part args)
                    (cons ':exec
                          (cons (aig-and-macro-exec-part args)
                                'nil))))))

Subtopics

Aig-and-main
And-Node, Main Optimizations, Non-Recursive.
Aig-and-pass6a
Level 3 Substitution Rules, Single Direction.
Aig-and-pass5
Level 2, Resolution Rule.
Aig-and-pass3
Level 2 Contradiction Rule 2 and all Level 4 Rules.
Aig-and-pass4a
Level 2, Subsumption Rules 1 and 2, Single Direction.
Aig-and-pass6
Level 3 Substitution Rules, Both Directions.
Aig-and-pass2a
Level 2 Contradiction Rule 1 and Idempotence Rule, Single Direction.
Aig-and-pass2
Level 2 Contradiction Rule 1 and Idempotence Rule, Both Directions.
Aig-and-pass4
Level 2, Subsumption Rules 1 and 2, Both Directions.
Aig-and-dumb
(aig-and-dumb x y) is a simpler alternative to aig-and.
Aig-negation-p
(aig-negation-p x y) determines if the AIGs x and y are (syntactically) negations of one another.
Aig-and-pass1
Level 1 simplifications.
Aig-binary-and
(aig-binary-and x y) constructs an AIG representing (and x y).
Aig-and-macro-exec-part
Generates the :exec part for a aig-and MBE call.
Aig-and-macro-logic-part
Generates the :logic part for a aig-and MBE call.