• 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

    To-preprocess-db

    Transform a compilation-database to prepare for use in preprocessing.

    Signature
    (to-preprocess-db db path drop-shared state) → (mv er? db$)
    Arguments
    db — Guard (comp-dbp db).
    path — Guard (stringp path).
    drop-shared — Guard (booleanp drop-shared).
    Returns
    er? — Type (maybe-msgp er?).
    db$ — Type (comp-dbp db$).

    Definitions and Theorems

    Function: to-preprocess-db

    (defun to-preprocess-db (db path drop-shared state)
     (declare (xargs :stobjs (state)))
     (declare (xargs :guard (and (comp-dbp db)
                                 (stringp path)
                                 (booleanp drop-shared))))
     (b*
      (((reterr) (comp-db-fix db))
       (path (mbe :logic (acl2::str-fix path)
                  :exec path))
       (path$ (canonical-pathname path t state))
       ((unless path$)
        (retmsg$
          "The specified path does not exist or is not a directory: ~x0"
          path))
       (db (comp-db-drop-non-c db))
       (db (if drop-shared (comp-db-drop-shared db)
             db))
       (db (comp-db-keep-only-preprocessor-args db))
       (db (comp-db-absolute-dirs db state))
       ((erp db)
        (comp-db-relativize-keys db path$))
       (db (comp-db-escape-for-shell db)))
      (retok db)))

    Theorem: maybe-msgp-of-to-preprocess-db.er?

    (defthm maybe-msgp-of-to-preprocess-db.er?
      (b* (((mv ?er? ?db$)
            (to-preprocess-db db path drop-shared state)))
        (maybe-msgp er?))
      :rule-classes :rewrite)

    Theorem: comp-dbp-of-to-preprocess-db.db$

    (defthm comp-dbp-of-to-preprocess-db.db$
      (b* (((mv ?er? ?db$)
            (to-preprocess-db db path drop-shared state)))
        (comp-dbp db$))
      :rule-classes :rewrite)

    Theorem: to-preprocess-db-of-comp-db-fix-db

    (defthm to-preprocess-db-of-comp-db-fix-db
      (equal (to-preprocess-db (comp-db-fix db)
                               path drop-shared state)
             (to-preprocess-db db path drop-shared state)))

    Theorem: to-preprocess-db-comp-db-equiv-congruence-on-db

    (defthm to-preprocess-db-comp-db-equiv-congruence-on-db
      (implies
           (comp-db-equiv db db-equiv)
           (equal (to-preprocess-db db path drop-shared state)
                  (to-preprocess-db db-equiv path drop-shared state)))
      :rule-classes :congruence)

    Theorem: to-preprocess-db-of-str-fix-path

    (defthm to-preprocess-db-of-str-fix-path
      (equal (to-preprocess-db db (acl2::str-fix path)
                               drop-shared state)
             (to-preprocess-db db path drop-shared state)))

    Theorem: to-preprocess-db-streqv-congruence-on-path

    (defthm to-preprocess-db-streqv-congruence-on-path
      (implies
           (acl2::streqv path path-equiv)
           (equal (to-preprocess-db db path drop-shared state)
                  (to-preprocess-db db path-equiv drop-shared state)))
      :rule-classes :congruence)

    Theorem: to-preprocess-db-of-bool-fix-drop-shared

    (defthm to-preprocess-db-of-bool-fix-drop-shared
      (equal (to-preprocess-db db path (bool-fix drop-shared)
                               state)
             (to-preprocess-db db path drop-shared state)))

    Theorem: to-preprocess-db-iff-congruence-on-drop-shared

    (defthm to-preprocess-db-iff-congruence-on-drop-shared
      (implies
           (iff drop-shared drop-shared-equiv)
           (equal (to-preprocess-db db path drop-shared state)
                  (to-preprocess-db db path drop-shared-equiv state)))
      :rule-classes :congruence)