Exhaustively simulate an AIG with one output node to determine if it is satisfiable
(random-sim num-sims invals aignet state) → (mv ctrexp invals new-state)
Given a combinational AIG with 37 or fewer inputs and no registers,
this uses aignet-vecsim to run through all combinations of inputs to
check the satisfiability of the 0th output of the AIG. This function returns
NIL if that output is unsatisfiable (always 0), and otherwise returns a natural
number giving the satisfying assignment for the PIs; i.e.
Function:
(defun random-sim (num-sims invals aignet state) (declare (xargs :stobjs (invals aignet state))) (declare (xargs :guard (natp num-sims))) (declare (xargs :guard (<= 1 (num-outs aignet)))) (let ((__function__ 'random-sim)) (declare (ignorable __function__)) (b* (((local-stobjs s32v) (mv ctrexp invals s32v state)) (s32v (s32v-resize-cols 1 s32v)) (s32v (s32v-resize-rows (num-fanins aignet) s32v))) (random-sim-aux num-sims invals s32v aignet state))))
Theorem:
(defthm w-state-of-random-sim (b* (((mv ?ctrexp ?invals ?new-state) (random-sim num-sims invals aignet state))) (equal (w new-state) (w state))))
Theorem:
(defthm random-sim-of-nfix-num-sims (equal (random-sim (nfix num-sims) invals aignet state) (random-sim num-sims invals aignet state)))
Theorem:
(defthm random-sim-nat-equiv-congruence-on-num-sims (implies (nat-equiv num-sims num-sims-equiv) (equal (random-sim num-sims invals aignet state) (random-sim num-sims-equiv invals aignet state))) :rule-classes :congruence)