• Top
    • Documentation
    • Books
    • Boolean-reasoning
    • Projects
    • Debugging
    • 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
        • Soft
        • C
        • Bv
        • Imp-language
        • Event-macros
        • Java
        • Bitcoin
        • Ethereum
        • Yul
        • Zcash
        • ACL2-programming-language
          • Primitive-functions
            • Eval-intern-in-package-of-symbol
            • Eval-pkg-witness
            • Eval-pkg-imports
            • Primitive-function-namep
            • Primitive-function-arity
            • Eval-if
            • Eval-bad-atom<=
            • Eval-<
            • Eval-coerce
              • Eval-complex
              • Eval-binary-+
              • Eval-binary-*
              • Eval-equal
              • Eval-cons
              • Eval-symbol-package-name
              • Eval-complex-rationalp
              • Eval-unary-/
              • Eval-symbol-name
              • Eval-denominator
              • Eval-code-char
              • Eval-unary--
              • Eval-realpart
              • Eval-rationalp
              • Eval-numerator
              • Eval-integerp
              • Eval-imagpart
              • Eval-characterp
              • Eval-char-code
              • Eval-ACL2-numberp
              • Eval-symbolp
              • Eval-stringp
              • Eval-consp
              • Eval-cdr
              • Eval-car
            • Translated-terms
            • Values
            • Evaluation
            • Program-equivalence
            • Functions
            • Packages
            • Programs
            • Interpreter
            • Evaluation-states
          • 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
    • Primitive-functions

    Eval-coerce

    Evaluation semantics of coerce.

    Signature
    (eval-coerce x y) → result
    Arguments
    x — Guard (valuep x).
    y — Guard (valuep y).
    Returns
    result — Type (valuep result).

    Definitions and Theorems

    Theorem: verify-guards-lemma

    (defthm verify-guards-lemma
      (implies (character-listp x)
               (good-valuep x)))

    Function: eval-coerce

    (defun eval-coerce (x y)
     (declare (xargs :guard (and (valuep x) (valuep y))))
     (let ((__function__ 'eval-coerce))
      (declare (ignorable __function__))
      (cond
          ((value-equiv y (value-symbol (lift-symbol 'list)))
           (if (value-case x :string)
               (lift-value (coerce (value-string->get x) 'list))
             (value-nil)))
          (t (value-string (coerce (make-character-list (lower-value x))
                                   'string))))))

    Theorem: valuep-of-eval-coerce

    (defthm valuep-of-eval-coerce
      (b* ((result (eval-coerce x y)))
        (valuep result))
      :rule-classes :rewrite)

    Theorem: eval-coerce-of-value-fix-x

    (defthm eval-coerce-of-value-fix-x
      (equal (eval-coerce (value-fix x) y)
             (eval-coerce x y)))

    Theorem: eval-coerce-value-equiv-congruence-on-x

    (defthm eval-coerce-value-equiv-congruence-on-x
      (implies (value-equiv x x-equiv)
               (equal (eval-coerce x y)
                      (eval-coerce x-equiv y)))
      :rule-classes :congruence)

    Theorem: eval-coerce-of-value-fix-y

    (defthm eval-coerce-of-value-fix-y
      (equal (eval-coerce x (value-fix y))
             (eval-coerce x y)))

    Theorem: eval-coerce-value-equiv-congruence-on-y

    (defthm eval-coerce-value-equiv-congruence-on-y
      (implies (value-equiv y y-equiv)
               (equal (eval-coerce x y)
                      (eval-coerce x y-equiv)))
      :rule-classes :congruence)