This module contains the basic definitions for an AIG (And Inverter Graph) in the style of AIGNET, as described in https://arxiv.org/pdf/1304.7861.pdf section 3. It consists of an AIG definition, a description of its semantics and basic operations to construct nodes in the AIG.
This datatype is isomorphic to a pair of a Nat and a Bool, however the Bool is stored in the
lowest bit of the Nat in order to save memory. It is used to describe an input to an AIG circuit
node which consists of a Nat describing the input node and a Bool saying whether there is an inverter
on the input.
- ofRaw :: (
- val : Nat
- )
Instances For
Instances For
Equations
Equations
- Std.Sat.AIG.instReprFanin.repr x✝ prec✝ = Std.Format.bracket "{ " (Std.Format.nil ++ Std.Format.text "val" ++ Std.Format.text " := " ++ (Std.Format.nest 7 (repr x✝.val)).group) " }"
Instances For
Equations
- Std.Sat.AIG.instReprFanin = { reprPrec := Std.Sat.AIG.instReprFanin.repr }
Equations
Instances For
Equations
A circuit node. These are not recursive but instead contain indices into an AIG, with inputs indexed by α.
- false {α : Type} : Decl α
- atom
{α : Type}
(idx : α)
: Decl α
An input node to the circuit.
- gate
{α : Type}
(l r : Fanin)
: Decl α
An AIG gate with configurable input nodes and polarity.
landrare the input nodes together with their inverter bit.
Instances For
Equations
Instances For
Equations
Equations
- Std.Sat.AIG.instReprDecl = { reprPrec := Std.Sat.AIG.instReprDecl.repr }
Equations
- One or more equations did not get rendered due to their size.
- Std.Sat.AIG.instReprDecl.repr Std.Sat.AIG.Decl.false prec✝ = Repr.addAppParen (Std.Format.nest (if prec✝ ≥ 1024 then 1 else 2) (Std.Format.text "Std.Sat.AIG.Decl.false")).group prec✝
Instances For
Equations
- Std.Sat.AIG.instDecidableEqDecl.decEq Std.Sat.AIG.Decl.false Std.Sat.AIG.Decl.false = isTrue ⋯
- Std.Sat.AIG.instDecidableEqDecl.decEq Std.Sat.AIG.Decl.false (Std.Sat.AIG.Decl.atom idx) = isFalse ⋯
- Std.Sat.AIG.instDecidableEqDecl.decEq Std.Sat.AIG.Decl.false (Std.Sat.AIG.Decl.gate l r) = isFalse ⋯
- Std.Sat.AIG.instDecidableEqDecl.decEq (Std.Sat.AIG.Decl.atom idx) Std.Sat.AIG.Decl.false = isFalse ⋯
- Std.Sat.AIG.instDecidableEqDecl.decEq (Std.Sat.AIG.Decl.atom a) (Std.Sat.AIG.Decl.atom b) = if h : a = b then h ▸ isTrue ⋯ else isFalse ⋯
- Std.Sat.AIG.instDecidableEqDecl.decEq (Std.Sat.AIG.Decl.atom idx) (Std.Sat.AIG.Decl.gate l r) = isFalse ⋯
- Std.Sat.AIG.instDecidableEqDecl.decEq (Std.Sat.AIG.Decl.gate l r) Std.Sat.AIG.Decl.false = isFalse ⋯
- Std.Sat.AIG.instDecidableEqDecl.decEq (Std.Sat.AIG.Decl.gate l r) (Std.Sat.AIG.Decl.atom idx) = isFalse ⋯
- Std.Sat.AIG.instDecidableEqDecl.decEq (Std.Sat.AIG.Decl.gate a a_1) (Std.Sat.AIG.Decl.gate b b_1) = if h : a = b then h ▸ if h : a_1 = b_1 then h ▸ isTrue ⋯ else isFalse ⋯ else isFalse ⋯
Instances For
Instances For
Equations
Cache.WF xs is a predicate asserting that a cache : HashMap (Decl α) Nat is a valid lookup
cache for xs : Array (Decl α), that is, whenever cache.find? decl returns an index into
xs : Array Decl, xs[index] = decl. Note that this predicate does not force the cache to be
complete, if there is no entry in the cache for some node, it can still exist in the AIG.
- empty {α : Type} [Hashable α] [DecidableEq α] {decls : Array (Decl α)} : WF decls ∅
- push_id {α : Type} [Hashable α] [DecidableEq α] {decls : Array (Decl α)} {cache : HashMap (Decl α) Nat} {decl : Decl α} (h : WF decls cache) : WF (decls.push decl) cache
- push_cache {α : Type} [Hashable α] [DecidableEq α] {decls : Array (Decl α)} {cache : HashMap (Decl α) Nat} {decl : Decl α} (h : WF decls cache) : WF (decls.push decl) (cache.insert decl decls.size)
Instances For
A cache for reusing elements from decls if they are available.
Equations
- Std.Sat.AIG.Cache α decls = { map : Std.HashMap (Std.Sat.AIG.Decl α) Nat // Std.Sat.AIG.Cache.WF decls map }
Instances For
Given a cache, valid with respect to some decls, we can extend the decls
and the cache at the same time with the same values and remain valid.
Instances For
For a c : Cache α decls, any index idx that is a cache hit for some decl is within bounds of decls (i.e. idx < decls.size).
Equations
Instances For
An AIG with an empty AIG and cache.
Equations
- Std.Sat.AIG.empty = { decls := #[Std.Sat.AIG.Decl.false], cache := Std.Sat.AIG.Cache.empty, hdag := ⋯, hzero := ⋯, hconst := ⋯ }
Instances For
Equations
- Std.Sat.AIG.instMembership = { mem := Std.Sat.AIG.Mem }
The Ref.cast equivalent for BinaryInput.
Instances For
Flip the current inverter settings of the BinaryInput if linv or rinv is set respectively.
Instances For
The Ref.cast equivalent for TernaryInput.
Equations
Instances For
An entrypoint into an AIG. This can be used to evaluate a circuit, starting at a certain node,
with AIG.denote or to construct bigger circuits on top of this specific node.
- aig : AIG α
The AIG that we are in.
The reference to the node in
aigthat thisEntrypointtargets.
Instances For
Transform an Entrypoint into a graphviz string. Useful for debugging purposes.
Equations
- One or more equations did not get rendered due to their size.
Instances For
A sequence of references bundled with their AIG.
- aig : AIG α
Instances For
Evaluate an AIG.Entrypoint using some assignment for atoms.
Equations
Instances For
Denotation of an AIG at a specific Entrypoint.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Denotation of an AIG at a specific Entrypoint with the Entrypoint being constructed on the fly.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
The denotation of the Entrypoint is false for all assignments.
Instances For
Add a new and inverter gate to the AIG in aig. Note that this version is only meant for proving,
for production purposes use AIG.mkGateCached and equality theorems to this one.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Add a new input node to the AIG in aig. Note that this version is only meant for proving,
for production purposes use AIG.mkAtomCached and equality theorems to this one.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Add a new constant node to aig. Note that this version is only meant for proving,
for production purposes use AIG.mkConstCached and equality theorems to this one.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Determine whether ref is a Decl.const with value b.
Equations
Instances For
Get the value of ref if it is constant.
Equations
- aig.getConstant { gate := gate, invert := invert, hgate := hgate } = match aig.decls[gate] with | Std.Sat.AIG.Decl.false => some invert | x => none