This invariant ensures that we only insert an atom at most once and with a monotonically increasing index.
- empty: ∀ {α : Type} [inst : DecidableEq α] [inst_1 : Hashable α], Std.Sat.AIG.RelabelNat.State.Inv1 0 ∅
- insert: ∀ {α : Type} [inst : DecidableEq α] [inst_1 : Hashable α] {n : Nat} {map : Std.HashMap α Nat} {x : α}, Std.Sat.AIG.RelabelNat.State.Inv1 n map → map[x]? = none → Std.Sat.AIG.RelabelNat.State.Inv1 (n + 1) (map.insert x n)
Instances For
If a HashMap fulfills Inv1 it is in an injection.
This invariant says that we have already visited and inserted all nodes up to a certain index.
- empty: ∀ {α : Type} [inst : DecidableEq α] [inst_1 : Hashable α] {decls : Array (Std.Sat.AIG.Decl α)}, Std.Sat.AIG.RelabelNat.State.Inv2 decls 0 ∅
- newAtom: ∀ {α : Type} [inst : DecidableEq α] [inst_1 : Hashable α] {decls : Array (Std.Sat.AIG.Decl α)} {idx : Nat} {map : Std.HashMap α Nat} {a : α} {val : Nat}, Std.Sat.AIG.RelabelNat.State.Inv2 decls idx map → ∀ (hlt : idx < decls.size), decls[idx] = Std.Sat.AIG.Decl.atom a → map[a]? = none → Std.Sat.AIG.RelabelNat.State.Inv2 decls (idx + 1) (map.insert a val)
- oldAtom: ∀ {α : Type} [inst : DecidableEq α] [inst_1 : Hashable α] {decls : Array (Std.Sat.AIG.Decl α)} {idx : Nat} {map : Std.HashMap α Nat} {a : α} {n : Nat}, Std.Sat.AIG.RelabelNat.State.Inv2 decls idx map → ∀ (hlt : idx < decls.size), decls[idx] = Std.Sat.AIG.Decl.atom a → map[a]? = some n → Std.Sat.AIG.RelabelNat.State.Inv2 decls (idx + 1) map
- const: ∀ {α : Type} [inst : DecidableEq α] [inst_1 : Hashable α] {decls : Array (Std.Sat.AIG.Decl α)} {idx : Nat} {map : Std.HashMap α Nat} {b : Bool}, Std.Sat.AIG.RelabelNat.State.Inv2 decls idx map → ∀ (hlt : idx < decls.size), decls[idx] = Std.Sat.AIG.Decl.const b → Std.Sat.AIG.RelabelNat.State.Inv2 decls (idx + 1) map
- gate: ∀ {α : Type} [inst : DecidableEq α] [inst_1 : Hashable α] {decls : Array (Std.Sat.AIG.Decl α)} {idx : Nat} {map : Std.HashMap α Nat} {l r : Nat} {li ri : Bool}, Std.Sat.AIG.RelabelNat.State.Inv2 decls idx map → ∀ (hlt : idx < decls.size), decls[idx] = Std.Sat.AIG.Decl.gate l r li ri → Std.Sat.AIG.RelabelNat.State.Inv2 decls (idx + 1) map
Instances For
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.
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 : Std.HashMap α Nat
The translation
HashMap - inv1 : Std.Sat.AIG.RelabelNat.State.Inv1 self.max self.map
Proof that we never reuse a number.
- inv2 : Std.Sat.AIG.RelabelNat.State.Inv2 decls idx self.map
Proof that we inserted all atoms until
idx.
Instances For
The basic initial state.
Instances For
Insert a Decl.atom into the State structure.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Insert a Decl.const into the State structure.
Equations
- state.addConst b h = { max := state.max, map := state.map, inv1 := ⋯, inv2 := ⋯ }
Instances For
Insert a Decl.gate into the State structure.
Equations
- state.addGate lhs rhs linv rinv h = { max := state.max, map := state.map, inv1 := ⋯, inv2 := ⋯ }
Instances For
Build up a State that has all atoms of an AIG inserted.
Equations
- Std.Sat.AIG.RelabelNat.State.ofAIGAux aig = Std.Sat.AIG.RelabelNat.State.ofAIGAux.go aig.decls 0 Std.Sat.AIG.RelabelNat.State.empty
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
Obtain the atom mapping from α to Nat for a given AIG.
Equations
Instances For
Assuming that we find a Nat for an atom in the ofAIG map, that Nat is unique in the map.
We will find a Nat for every atom in the AIG that the ofAIG map was built from.
Equations
- One or more equations did not get rendered due to their size.
Instances For
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
- aig.relabelNat = aig.relabelNat'.fst
Instances For
relabelNat preserves unsatisfiablility.
Equations
- entry.relabelNat' = ({ aig := entry.aig.relabelNat'.fst, ref := let __src := entry.ref; { gate := __src.gate, hgate := ⋯ } }, entry.aig.relabelNat'.snd)
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
- entry.relabelNat = { aig := entry.aig.relabelNat, ref := let __src := entry.ref; { gate := __src.gate, hgate := ⋯ } }
Instances For
relabelNat preserves unsatisfiablility.