• Top
    • Documentation
    • Books
    • Recursion-and-induction
    • Boolean-reasoning
    • Debugging
    • Projects
    • Std
    • Proof-automation
    • Macro-libraries
    • ACL2
    • Interfacing-tools
      • Io
      • Defttag
      • Sys-call
      • Save-exec
      • Quicklisp
      • Oslib
        • File-types
        • Argv
        • Copy
        • Catpath
        • Universal-time
        • Ls
        • Basename
        • Tempfile
        • Dirname
        • Copy!
        • Mkdir
        • Ls-files
        • Lisp-version
        • Rmtree
        • Ls-subdirs
        • Lisp-type
        • Date
        • Getpid
        • Basenames
        • Dirnames
        • Ls-subdirs!
        • Ls-files!
        • Dirname!
          • Basename!
          • Catpaths
          • Mkdir!
          • Ls!
          • Rmtree!
          • Remove-nonstrings
        • Std/io
        • Bridge
        • Clex
        • Tshell
        • Unsound-eval
        • Hacker
        • Startup-banner
        • Command-line
      • Hardware-verification
      • Software-verification
      • Testing-utilities
      • Math
    • Oslib

    Dirname!

    Strip the non-directory suffix from a file name, or cause a hard error if there is any problem.

    Signature
    (dirname! path &key (state 'state)) → (mv dirname state)
    Arguments
    path — Guard (stringp path).
    Returns
    dirname — Type (stringp dirname).
    state — Type (state-p1 state), given (force (state-p1 state)).

    This is just a wrapper for dirname that causes an error on any failure.

    Definitions and Theorems

    Function: dirname!-fn

    (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: stringp-of-dirname!.dirname

    (defthm stringp-of-dirname!.dirname
            (b* (((mv ?dirname acl2::?state)
                  (dirname!-fn path state)))
                (stringp dirname))
            :rule-classes :type-prescription)

    Theorem: state-p1-of-dirname!.state

    (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)