See what kind of file a path refers to.
(file-kind path &key (follow-symlinks 't) (state 'state)) → (mv err ans new-state)
We check whether
This is complicated by symbolic links. You can control how symlinks are
handled using
By default,
For finer-grained handling of symlinks, you can set
Function:
(defun file-kind-fn (path follow-symlinks state) (declare (xargs :stobjs (state))) (declare (xargs :guard (and (stringp path) (booleanp follow-symlinks)))) (let ((__function__ 'file-kind)) (declare (ignorable __function__)) (b* ((- (raise "Raw Lisp definition not installed?")) ((mv & err state) (read-acl2-oracle state)) ((mv & ans state) (read-acl2-oracle state))) (mv err (if (file-kind-p ans) ans nil) state))))
Theorem:
(defthm file-kind-p-of-file-kind.ans (b* (((mv ?err ?ans ?new-state) (file-kind-fn path follow-symlinks state))) (file-kind-p ans)) :rule-classes :rewrite)
Theorem:
(defthm state-p1-of-file-kind.new-state (implies (force (state-p1 state)) (b* (((mv ?err ?ans ?new-state) (file-kind-fn path follow-symlinks state))) (state-p1 new-state))) :rule-classes :rewrite)
Theorem:
(defthm type-of-file-kind.ans (let ((ans (mv-nth 1 (file-kind path)))) (and (symbolp ans) (not (equal ans t)))) :rule-classes :type-prescription)
Theorem:
(defthm w-state-of-file-kind (b* (((mv ?err ?ans ?new-state) (file-kind-fn path follow-symlinks state))) (equal (w new-state) (w state))))