Strip the non-directory suffix from a file name, or cause a hard error if there is any problem.
This is just a wrapper for dirname that causes an error on any failure.
Function:
(defun dirname!-fn (path state) (declare (xargs :stobjs (state))) (declare (xargs :guard (stringp path))) (let ((__function__ 'dirname!)) (declare (ignorable __function__)) (b* (((mv err dirname state) (dirname path)) ((when err) (raise "Dirname failed: ~@0" err) (mv "" state))) (mv dirname state))))
Theorem:
(defthm stringp-of-dirname!.dirname (b* (((mv ?dirname acl2::?state) (dirname!-fn path state))) (stringp dirname)) :rule-classes :type-prescription)
Theorem:
(defthm state-p1-of-dirname!.state (implies (force (state-p1 state)) (b* (((mv ?dirname acl2::?state) (dirname!-fn path state))) (state-p1 state))) :rule-classes :rewrite)