• Top
    • Documentation
    • Books
    • Boolean-reasoning
    • Projects
      • Apt
      • Zfc
      • Acre
      • Milawa
      • Smtlink
      • Abnf
      • Vwsim
      • Isar
      • Wp-gen
      • Dimacs-reader
      • Pfcs
      • Legacy-defrstobj
      • Proof-checker-array
      • Soft
      • C
      • Farray
      • Rp-rewriter
      • Instant-runoff-voting
      • Imp-language
      • Sidekick
      • Leftist-trees
      • Java
      • Riscv
      • Taspi
      • Bitcoin
      • Des
      • Ethereum
      • X86isa
      • Sha-2
      • Yul
      • Zcash
      • Proof-checker-itp13
      • Regex
      • ACL2-programming-language
      • Json
      • Jfkr
      • Equational
      • Cryptography
      • Poseidon
      • Where-do-i-place-my-book
      • Axe
      • Aleo
        • Aleobft
        • Aleovm
        • Leo
          • Grammar
          • Early-version
            • Json2ast
            • Testing
            • Definition
              • Flattening
              • Abstract-syntax
              • Dynamic-semantics
              • Compilation
              • Static-semantics
                • Type-checking
                • Static-environments
                • Curve-parameterization
                • Function-recursion
                • Struct-recursion
                • Input-checking
                • Program-checking
                • Type-maps-for-struct-components
                • Program-and-input-checking
                • Output-checking
                  • Check-output-expression
                    • Check-output-section
                    • Check-output-item
                    • Check-output-file
                • Concrete-syntax
        • Bigmems
        • Builtins
        • Execloader
        • Solidity
        • Paco
        • Concurrent-programs
        • Bls12-377-curves
      • Debugging
      • Community
      • Std
      • Proof-automation
      • Macro-libraries
      • ACL2
      • Interfacing-tools
      • Hardware-verification
      • Software-verification
      • Math
      • Testing-utilities
    • Output-checking

    Check-output-expression

    Check an output expression.

    Signature
    (check-output-expression outexpr env) → type
    Arguments
    outexpr — Guard (output-expressionp outexpr).
    env — Guard (senvp env).
    Returns
    type — Type (type-resultp type).

    The expression must be a value expression. We type-check it in the initial (i.e. empty) static environment.

    Definitions and Theorems

    Function: check-output-expression

    (defun check-output-expression (outexpr env)
      (declare (xargs :guard (and (output-expressionp outexpr)
                                  (senvp env))))
      (let ((__function__ 'check-output-expression))
        (declare (ignorable __function__))
        (b* ((expr (output-expression->get outexpr))
             ((unless (expression-valuep expr))
              (reserrf (list :not-value-expression expr)))
             ((okf etype)
              (typecheck-expression expr env)))
          (expr-type->type etype))))

    Theorem: type-resultp-of-check-output-expression

    (defthm type-resultp-of-check-output-expression
      (b* ((type (check-output-expression outexpr env)))
        (type-resultp type))
      :rule-classes :rewrite)

    Theorem: check-output-expression-of-output-expression-fix-outexpr

    (defthm check-output-expression-of-output-expression-fix-outexpr
      (equal (check-output-expression (output-expression-fix outexpr)
                                      env)
             (check-output-expression outexpr env)))

    Theorem: check-output-expression-output-expression-equiv-congruence-on-outexpr

    (defthm
     check-output-expression-output-expression-equiv-congruence-on-outexpr
     (implies (output-expression-equiv outexpr outexpr-equiv)
              (equal (check-output-expression outexpr env)
                     (check-output-expression outexpr-equiv env)))
     :rule-classes :congruence)

    Theorem: check-output-expression-of-senv-fix-env

    (defthm check-output-expression-of-senv-fix-env
      (equal (check-output-expression outexpr (senv-fix env))
             (check-output-expression outexpr env)))

    Theorem: check-output-expression-senv-equiv-congruence-on-env

    (defthm check-output-expression-senv-equiv-congruence-on-env
      (implies (senv-equiv env env-equiv)
               (equal (check-output-expression outexpr env)
                      (check-output-expression outexpr env-equiv)))
      :rule-classes :congruence)