• Top
    • Documentation
    • Books
    • Boolean-reasoning
    • Projects
      • Apt
      • Zfc
      • Acre
      • Milawa
      • Smtlink
      • Abnf
      • Vwsim
      • Isar
      • Pfcs
      • Wp-gen
      • Dimacs-reader
      • Legacy-defrstobj
      • Proof-checker-array
      • Soft
      • C
      • Farray
      • Rp-rewriter
      • Instant-runoff-voting
      • Imp-language
      • Sidekick
      • Leftist-trees
      • Java
      • Taspi
      • Riscv
      • Bitcoin
      • Des
      • Ethereum
      • X86isa
      • Sha-2
      • Yul
      • Zcash
      • Proof-checker-itp13
      • Regex
      • 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
        • Json
        • Jfkr
        • Equational
        • Cryptography
        • Poseidon
        • Where-do-i-place-my-book
        • Axe
        • Aleo
        • Bigmems
        • Builtins
        • Execloader
        • Solidity
        • Paco
        • Concurrent-programs
        • Bls12-377-curves
      • Debugging
      • Std
      • Community
      • Proof-automation
      • ACL2
      • Macro-libraries
      • Interfacing-tools
      • Hardware-verification
      • Software-verification
      • 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)