Collect paths that do not
(missing-paths paths &key (state 'state)) → (mv err ans new-state)
Function:
(defun missing-paths-exec-fn (paths acc state) (declare (xargs :stobjs (state))) (declare (xargs :guard (string-listp paths))) "Tail recursive version for execution." (let ((__function__ 'missing-paths-exec)) (declare (ignorable __function__)) (b* (((when (atom paths)) (mv nil acc state)) ((mv err exists-p state) (path-exists-p (car paths))) ((when err) (mv err acc state)) (acc (if exists-p acc (cons (car paths) acc)))) (missing-paths-exec (cdr paths) acc))))
Function:
(defun missing-paths-fn (paths state) (declare (xargs :stobjs (state))) (declare (xargs :guard (string-listp paths))) (let ((__function__ 'missing-paths)) (declare (ignorable __function__)) (mbe :logic (b* (((when (atom paths)) (mv nil nil state)) ((mv err exists-p state) (path-exists-p (car paths))) ((when err) (mv err nil state)) ((mv err rest state) (missing-paths (cdr paths))) (ans (if exists-p rest (cons (car paths) rest)))) (mv err ans state)) :exec (b* (((mv err acc state) (missing-paths-exec paths nil))) (mv err (reverse acc) state)))))
Theorem:
(defthm string-listp-of-missing-paths.ans (implies (string-listp paths) (b* (((mv ?err ?ans ?new-state) (missing-paths-fn paths state))) (string-listp ans))) :rule-classes :rewrite)
Theorem:
(defthm state-p1-of-missing-paths.new-state (implies (force (state-p1 state)) (b* (((mv ?err ?ans ?new-state) (missing-paths-fn paths state))) (state-p1 new-state))) :rule-classes :rewrite)
Theorem:
(defthm missing-paths-exec-removal (equal (missing-paths-exec paths acc) (b* (((mv err ans state) (missing-paths paths))) (mv err (revappend ans acc) state))))
Theorem:
(defthm true-listp-of-missing-paths (true-listp (mv-nth 1 (missing-paths paths))) :rule-classes :type-prescription)
Theorem:
(defthm w-state-of-missing-paths (b* (((mv ?err ?ans ?new-state) (missing-paths-fn paths state))) (equal (w new-state) (w state))))