• 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-const

    Map a constant to a constant in the language definition.

    Signature
    (ldm-const const) → (mv erp const1)
    Arguments
    const — Guard (constp const).
    Returns
    const1 — Type (c::constp const1).

    Definitions and Theorems

    Function: ldm-const

    (defun ldm-const (const)
      (declare (xargs :guard (constp const)))
      (let ((__function__ 'ldm-const))
        (declare (ignorable __function__))
        (b* (((reterr)
              (c::const-enum (c::ident "irrelevant"))))
          (const-case
               const :int
               (retok (c::const-int (ldm-iconst const.unwrap)))
               :float
               (reterr (msg "Unsupported floating constant ~x0."
                            const.unwrap))
               :enum
               (b* (((erp ident1) (ldm-ident const.unwrap)))
                 (retok (c::const-enum ident1)))
               :char (reterr (msg "Unsupported character constant ~x0."
                                  const.unwrap))))))

    Theorem: constp-of-ldm-const.const1

    (defthm constp-of-ldm-const.const1
      (b* (((mv acl2::?erp ?const1)
            (ldm-const const)))
        (c::constp const1))
      :rule-classes :rewrite)

    Theorem: ldm-const-ok-when-const-formalp

    (defthm ldm-const-ok-when-const-formalp
      (implies (const-formalp const)
               (b* (((mv acl2::?erp ?const1)
                     (ldm-const const)))
                 (not erp))))

    Theorem: ldm-const-of-const-fix-const

    (defthm ldm-const-of-const-fix-const
      (equal (ldm-const (const-fix const))
             (ldm-const const)))

    Theorem: ldm-const-const-equiv-congruence-on-const

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