Documentation

Std.Sat.AIG.RelabelNat

This invariant ensures that we only insert an atom at most once and with a monotonically increasing index.

Instances For
    theorem Std.Sat.AIG.RelabelNat.State.Inv1.lt_of_get?_eq_some {α : Type} [DecidableEq α] [Hashable α] [EquivBEq α] {n m : Nat} (map : HashMap α Nat) (x : α) (hinv : Inv1 n map) :
    map[x]? = some mm < n
    theorem Std.Sat.AIG.RelabelNat.State.Inv1.property {α : Type} [DecidableEq α] [Hashable α] [EquivBEq α] {n m : Nat} (x y : α) (map : HashMap α Nat) (hinv : Inv1 n map) (hfound1 : map[x]? = some m) (hfound2 : map[y]? = some m) :
    x = y

    If a HashMap fulfills Inv1 it is in an injection.

    inductive Std.Sat.AIG.RelabelNat.State.Inv2 {α : Type} [DecidableEq α] [Hashable α] (decls : Array (Decl α)) :
    NatHashMap α NatProp

    This invariant says that we have already visited and inserted all nodes up to a certain index.

    Instances For
      theorem Std.Sat.AIG.RelabelNat.State.Inv2.upper_lt_size {α : Type} [DecidableEq α] [Hashable α] {upper : Nat} {map : HashMap α Nat} {decls : Array (Decl α)} (hinv : Inv2 decls upper map) :
      upper decls.size
      theorem Std.Sat.AIG.RelabelNat.State.Inv2.property {α : Type} [DecidableEq α] [Hashable α] (decls : Array (Decl α)) (idx upper : Nat) (map : HashMap α Nat) (hidx : idx < upper) (a : α) (hinv : Inv2 decls upper map) (heq : decls[idx] = Decl.atom a) :
      (n : Nat), map[a]? = some n

      The key property provided by Inv2, if we have Inv2 at a certain index, then all atoms below that index have been inserted into the HashMap.

      structure Std.Sat.AIG.RelabelNat.State (α : Type) [DecidableEq α] [Hashable α] (decls : Array (Decl α)) (idx : Nat) :

      The invariant carrying state structure for building the HashMap that translates from arbitrary atom identifiers to Nat.

      • max : Nat

        The next number to use for identifying an atom.

      • map : HashMap α Nat

        The translation HashMap

      • inv1 : Inv1 self.max self.map

        Proof that we never reuse a number.

      • inv2 : Inv2 decls idx self.map

        Proof that we inserted all atoms until idx.

      Instances For
        def Std.Sat.AIG.RelabelNat.State.empty {α : Type} [DecidableEq α] [Hashable α] {decls : Array (Decl α)} :
        State α decls 0

        The basic initial state.

        Equations
          Instances For
            def Std.Sat.AIG.RelabelNat.State.addAtom {α : Type} [DecidableEq α] [Hashable α] {idx : Nat} {decls : Array (Decl α)} {hidx : idx < decls.size} (state : State α decls idx) (a : α) (h : decls[idx] = Decl.atom a) :
            State α decls (idx + 1)

            Insert a Decl.atom into the State structure.

            Equations
              Instances For
                def Std.Sat.AIG.RelabelNat.State.addFalse {α : Type} [DecidableEq α] [Hashable α] {idx : Nat} {decls : Array (Decl α)} {hidx : idx < decls.size} (state : State α decls idx) (h : decls[idx] = Decl.false) :
                State α decls (idx + 1)

                Insert a Decl.false into the State structure.

                Equations
                  Instances For
                    def Std.Sat.AIG.RelabelNat.State.addGate {α : Type} [DecidableEq α] [Hashable α] {idx : Nat} {decls : Array (Decl α)} {hidx : idx < decls.size} (state : State α decls idx) (lhs rhs : Fanin) (h : decls[idx] = Decl.gate lhs rhs) :
                    State α decls (idx + 1)

                    Insert a Decl.gate into the State structure.

                    Equations
                      Instances For

                        Build up a State that has all atoms of an AIG inserted.

                        Equations
                          Instances For
                            @[irreducible]
                            def Std.Sat.AIG.RelabelNat.State.ofAIGAux.go {α : Type} [DecidableEq α] [Hashable α] (decls : Array (Decl α)) (idx : Nat) (state : State α decls idx) :
                            State α decls decls.size
                            Equations
                              Instances For

                                Obtain the atom mapping from α to Nat for a given AIG.

                                Equations
                                  Instances For

                                    The map returned by ofAIG fulfills the Inv1 property.

                                    The map returned by ofAIG fulfills the Inv2 property.

                                    theorem Std.Sat.AIG.RelabelNat.State.ofAIG_find_unique {α : Type} [DecidableEq α] [Hashable α] {n : Nat} {aig : AIG α} (a : α) (ha : (ofAIG aig)[a]? = some n) (a' : α) :
                                    (ofAIG aig)[a']? = some na = a'

                                    Assuming that we find a Nat for an atom in the ofAIG map, that Nat is unique in the map.

                                    theorem Std.Sat.AIG.RelabelNat.State.ofAIG_find_some {α : Type} [DecidableEq α] [Hashable α] {aig : AIG α} (a : α) :
                                    a aig (n : Nat), (ofAIG aig)[a]? = some n

                                    We will find a Nat for every atom in the AIG that the ofAIG map was built from.

                                    def Std.Sat.AIG.relabelNat' {α : Type} [DecidableEq α] [Hashable α] (aig : AIG α) :
                                    Equations
                                      Instances For
                                        def Std.Sat.AIG.relabelNat {α : Type} [DecidableEq α] [Hashable α] (aig : AIG α) :

                                        Map an AIG with arbitrary atom identifiers to one that uses Nat as atom identifiers. This is useful for preparing an AIG for CNF translation if it doesn't already use Nat identifiers.

                                        Equations
                                          Instances For
                                            theorem Std.Sat.AIG.relabelNat_unsat_iff {α : Type} [DecidableEq α] [Hashable α] {idx : Nat} {invert : Bool} [Nonempty α] {aig : AIG α} {hidx1 : idx < aig.relabelNat.decls.size} {hidx2 : idx < aig.decls.size} :
                                            aig.relabelNat.UnsatAt idx invert hidx1 aig.UnsatAt idx invert hidx2

                                            relabelNat preserves unsatisfiablility.

                                            Equations
                                              Instances For

                                                Map an Entrypoint with arbitrary atom identifiers to one that uses Nat as atom identifiers. This is useful for preparing an AIG for CNF translation if it doesn't already use Nat identifiers.

                                                Equations
                                                  Instances For

                                                    relabelNat preserves unsatisfiablility.