• Top
    • Documentation
    • Books
    • Boolean-reasoning
    • Projects
    • Debugging
    • Community
    • Std
    • Proof-automation
    • Macro-libraries
    • ACL2
    • Interfacing-tools
    • Hardware-verification
    • Software-verification
      • Kestrel-books
        • Crypto-hdwallet
        • Apt
        • Error-checking
        • Fty-extensions
        • Isar
        • Kestrel-utilities
        • Set
        • C
          • Syntax-for-tools
            • Formalized-subset
            • Mapping-to-language-definition
            • Input-files
            • Compilation-database
              • Comp-db-entry
              • Comp-db-arg
              • Json-to-comp-db-entry
              • Json-to-comp-db-entry-list
              • To-preprocess-db
              • To-preprocess-map
              • Comp-db-arguments-absolute-dirs
              • Comp-db-keep-only-preprocessor-args
              • Json-to-comp-db
              • Json-to-comp-db-arguments
              • Comp-db-relativize-keys
              • Json-to-comp-db-get-exec-and-arguments
              • Relativize-path
                • Preprocess-map-from-comp-file
                • Json-to-comp-db-exec-and-arguments
                • Comp-db-arguments-keep-only-preprocessor-args
                • Comp-db-arguments-escape-for-shell
                • Parse-comp-db
                • Json-to-comp-db-get-directory
                • Json-to-comp-db-get-output
                • Json-to-comp-db-get-file
                • Comp-db-drop-shared
                • Comp-db-drop-non-c
                • Comp-db-arg-list-to-string-list
                • Comp-db-absolute-dirs
                • Comp-db-escape-for-shell
                • Json-to-comp-db-try-parse-short-option
                • Preprocess-db-to-map
                • Comp-db-arg-to-string
                • Comp-db
                • Json-to-comp-db-try-parse-equal-arg
                • Defpreprocess-map-fn
                • String-escape-for-shell
                • Comp-db-arg-list
                • Irr-comp-db-arg
                • Show-warnings
                • *cc-options-space-sep*
                • *cc-options-equal-sep*
                • *cc-options-dir*
              • Printer
              • Output-files
              • Abstract-syntax-operations
              • Implementation-environments
              • Abstract-syntax
              • Concrete-syntax
              • Disambiguation
              • Validation
              • Gcc-builtins
              • Preprocessing
              • Parsing
            • Atc
            • Transformation-tools
            • Language
            • Representation
            • Insertion-sort
            • Pack
          • Soft
          • Bv
          • Imp-language
          • Ethereum
          • Event-macros
          • Java
          • Riscv
          • Bitcoin
          • Zcash
          • Yul
          • ACL2-programming-language
          • Prime-fields
          • Json
          • Syntheto
          • File-io-light
          • Cryptography
          • Number-theory
          • Axe
          • Lists-light
          • Builtins
          • Solidity
          • Helpers
          • Htclient
          • Typed-lists-light
          • Arithmetic-light
        • X86isa
        • Axe
        • Execloader
      • Math
      • Testing-utilities
    • Compilation-database

    Relativize-path

    Signature
    (relativize-path path base) → (mv erp relative-path)
    Arguments
    path — Guard (stringp path).
    base — Guard (stringp base).
    Returns
    erp — Type (booleanp erp).
    relative-path — Type (stringp relative-path).

    Definitions and Theorems

    Function: relativize-path

    (defun relativize-path (path base)
      (declare (xargs :guard (and (stringp path) (stringp base))))
      (b* (((reterr) "")
           (path (mbe :logic (acl2::str-fix path)
                      :exec path))
           (base (mbe :logic (acl2::str-fix base)
                      :exec base))
           ((unless (str::strprefixp base path))
            (reterr t)))
        (retok (subseq (the string path)
                       (length (the string base))
                       nil))))

    Theorem: booleanp-of-relativize-path.erp

    (defthm booleanp-of-relativize-path.erp
      (b* (((mv acl2::?erp ?relative-path)
            (relativize-path path base)))
        (booleanp erp))
      :rule-classes :rewrite)

    Theorem: stringp-of-relativize-path.relative-path

    (defthm stringp-of-relativize-path.relative-path
      (b* (((mv acl2::?erp ?relative-path)
            (relativize-path path base)))
        (stringp relative-path))
      :rule-classes :rewrite)

    Theorem: relativize-path-of-str-fix-path

    (defthm relativize-path-of-str-fix-path
      (equal (relativize-path (acl2::str-fix path)
                              base)
             (relativize-path path base)))

    Theorem: relativize-path-streqv-congruence-on-path

    (defthm relativize-path-streqv-congruence-on-path
      (implies (acl2::streqv path path-equiv)
               (equal (relativize-path path base)
                      (relativize-path path-equiv base)))
      :rule-classes :congruence)

    Theorem: relativize-path-of-str-fix-base

    (defthm relativize-path-of-str-fix-base
      (equal (relativize-path path (acl2::str-fix base))
             (relativize-path path base)))

    Theorem: relativize-path-streqv-congruence-on-base

    (defthm relativize-path-streqv-congruence-on-base
      (implies (acl2::streqv base base-equiv)
               (equal (relativize-path path base)
                      (relativize-path path base-equiv)))
      :rule-classes :congruence)