Run abc on an aignet; takes and returns state.
(aignet-run-abc-core-st input-aignet output-aignet frames script &key script-filename input-filename output-filename ctrex-filename (force-status 'nil) (quiet 'nil) (state 'state)) → (mv status new-output-aignet new-frames new-state)
See aignet-run-abc-core, which is identical except that it hides the usage of state.
Function:
(defun aignet-run-abc-core-st-fn (input-aignet output-aignet frames script script-filename input-filename output-filename ctrex-filename force-status quiet state) (declare (xargs :stobjs (input-aignet output-aignet frames state))) (declare (xargs :guard (and (stringp script) (stringp script-filename) (stringp input-filename) (acl2::maybe-stringp output-filename) (acl2::maybe-stringp ctrex-filename)))) (let ((__function__ 'aignet-run-abc-core-st)) (declare (ignorable __function__)) (b* ((output-aignet (aignet-clear output-aignet)) (input-filename (mbe :logic (acl2::str-fix input-filename) :exec input-filename)) (script-filename (mbe :logic (acl2::str-fix script-filename) :exec script-filename)) (state (aignet-write-aiger input-filename input-aignet state)) ((mv channel state) (open-output-channel! script-filename :character state)) ((unless channel) (mv "Aignet-run-abc: Failed to write the ABC script." output-aignet frames state)) (state (princ$ script channel state)) (state (close-output-channel channel state)) ((mv exit-status lines state) (acl2::tshell-call (str::cat (if quiet "abc -f " "abc -F ") script-filename) :print (not quiet) :save t)) ((unless (equal exit-status 0)) (mv (msg "Aignet-run-abc: abc failed with exit status ~x0" exit-status) output-aignet frames state)) ((mv read-err output-aignet state) (if output-filename (aignet-read-aiger (mbe :logic (acl2::str-fix output-filename) :exec output-filename) output-aignet state) (mv nil output-aignet state))) ((when read-err) (mv (msg "Aignet-run-abc: failed to read result AIG: ~s0" read-err) output-aignet frames state)) ((mv status frames state) (abc-output-status-and-trace lines ctrex-filename force-status (num-ins input-aignet) frames state))) (mv status output-aignet frames state))))
Theorem:
(defthm frames-ncols-of-aignet-run-abc-core-st-when-refuted (b* (((mv ?status ?new-output-aignet ?new-frames ?new-state) (aignet-run-abc-core-st-fn input-aignet output-aignet frames script script-filename input-filename output-filename ctrex-filename force-status quiet state))) (implies (and (equal status :refuted) ctrex-filename) (equal (stobjs::2darr->ncols new-frames) (num-ins input-aignet)))))
Theorem:
(defthm aignet-run-abc-core-st-preserves-state-p1 (b* (((mv ?status ?new-output-aignet ?new-frames ?new-state) (aignet-run-abc-core-st-fn input-aignet output-aignet frames script script-filename input-filename output-filename ctrex-filename force-status quiet state))) (implies (state-p1 state) (state-p1 new-state))))
Theorem:
(defthm w-state-of-aignet-run-abc-core-st (b* (((mv ?status ?new-output-aignet ?new-frames ?new-state) (aignet-run-abc-core-st-fn input-aignet output-aignet frames script script-filename input-filename output-filename ctrex-filename force-status quiet state))) (equal (w new-state) (w state))))