• Top
    • Documentation
    • Books
    • Boolean-reasoning
    • Projects
    • Debugging
    • Std
    • Community
    • Proof-automation
    • Macro-libraries
    • ACL2
    • Interfacing-tools
    • Hardware-verification
    • Software-verification
      • Kestrel-books
        • Crypto-hdwallet
        • Apt
        • Error-checking
        • Fty-extensions
        • Isar
        • Kestrel-utilities
        • Set
        • Soft
        • C
          • Syntax-for-tools
            • Disambiguator
            • Abstract-syntax
            • Parser
            • Validator
            • Printer
            • Formalized-subset
            • Mapping-to-language-definition
              • Ldm-type-spec-list
              • Ldm-stmts/blocks
              • Ldm-exprs
              • Ldm-declor-obj
              • Ldm-absdeclor-obj
              • Ldm-dirdeclor-obj
              • Ldm-declor-fun
              • Ldm-dirdeclor-fun
              • Ldm-decl-tag
              • Ldm-decl-obj
              • Ldm-transunit-ensemble
              • Ldm-structdecl
              • Ldm-dirabsdeclor-obj
              • Ldm-decl-fun
              • Ldm-extdecl
              • Ldm-fundef
              • Ldm-param-declor
              • Ldm-param-declon
              • Ldm-structdecl-list
              • Ldm-stor-spec-list
              • Ldm-param-declon-list
              • Ldm-transunit
                • Ldm-desiniter
                • Ldm-tyname
                • Ldm-isuffix-option
                • Ldm-expr-option
                • Ldm-desiniter-list
                • Ldm-dec/oct/hex-const
                • Ldm-isuffix
                • Ldm-ident
                • Ldm-extdecl-list
                • Ldm-binop
                • Ldm-initer
                • Ldm-const
                • Ldm-enumer-list
                • Ldm-enumer
                • Ldm-label
                • Ldm-lsuffix
                • Ldm-iconst
                • Ldm-expr
                • Ldm-expr-list
                • Ldm-block-item-list
                • Ldm-stmt
                • Ldm-block-item
              • Input-files
              • Defpred
              • Output-files
              • Abstract-syntax-operations
              • Validation-information
              • Implementation-environments
              • Concrete-syntax
              • Ascii-identifiers
              • Unambiguity
              • Preprocessing
              • Abstraction-mapping
            • Atc
            • Language
            • Representation
            • Transformation-tools
            • Insertion-sort
            • Pack
          • Bv
          • Imp-language
          • Event-macros
          • Java
          • Bitcoin
          • Ethereum
          • Yul
          • Zcash
          • ACL2-programming-language
          • Prime-fields
          • Json
          • Syntheto
          • File-io-light
          • Cryptography
          • Number-theory
          • Lists-light
          • Axe
          • Builtins
          • Solidity
          • Helpers
          • Htclient
          • Typed-lists-light
          • Arithmetic-light
        • X86isa
        • Axe
        • Execloader
      • Math
      • Testing-utilities
    • Mapping-to-language-definition

    Ldm-transunit

    Map a translation unit to the language definition.

    Signature
    (ldm-transunit tunit) → (mv erp file)
    Arguments
    tunit — Guard (transunitp tunit).
    Returns
    file — Type (c::filep file).

    A translation unit consists of a list of external declarations. We map all of them to the language definition (if possible), obtaining a corresponding list of external declaration, which we put into a c::file.

    Definitions and Theorems

    Function: ldm-transunit

    (defun ldm-transunit (tunit)
      (declare (xargs :guard (transunitp tunit)))
      (declare (xargs :guard (transunit-unambp tunit)))
      (let ((__function__ 'ldm-transunit))
        (declare (ignorable __function__))
        (b* (((reterr) (c::file nil))
             (extdecls (transunit->decls tunit))
             ((erp extdecls1)
              (ldm-extdecl-list extdecls)))
          (retok (c::make-file :declons extdecls1)))))

    Theorem: filep-of-ldm-transunit.file

    (defthm filep-of-ldm-transunit.file
      (b* (((mv acl2::?erp ?file)
            (ldm-transunit tunit)))
        (c::filep file))
      :rule-classes :rewrite)

    Theorem: ldm-transunit-ok-when-transunit-formalp

    (defthm ldm-transunit-ok-when-transunit-formalp
      (implies (transunit-formalp tunit)
               (b* (((mv acl2::?erp ?file)
                     (ldm-transunit tunit)))
                 (not erp))))

    Theorem: ldm-transunit-of-transunit-fix-tunit

    (defthm ldm-transunit-of-transunit-fix-tunit
      (equal (ldm-transunit (transunit-fix tunit))
             (ldm-transunit tunit)))

    Theorem: ldm-transunit-transunit-equiv-congruence-on-tunit

    (defthm ldm-transunit-transunit-equiv-congruence-on-tunit
      (implies (transunit-equiv tunit tunit-equiv)
               (equal (ldm-transunit tunit)
                      (ldm-transunit tunit-equiv)))
      :rule-classes :congruence)