• 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
                • Flatten-statements/branches
                • Simplify-flattened-if
                • Flatten-expression
                • Fenv-option
                • Flatten-fundecl
                  • Fenv-const-add
                  • Fenv
                  • Fenv-const-lookup
                  • Init-fenv
                  • Const-fenv
                • Abstract-syntax
                • Dynamic-semantics
                • Compilation
                • Static-semantics
                • 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
    • Flattening

    Flatten-fundecl

    Flatten a function declaration.

    Signature
    (flatten-fundecl decl env) → new-decl
    Arguments
    decl — Guard (fundeclp decl).
    env — Guard (fenvp env).
    Returns
    new-decl — Type (fundecl-resultp new-decl).

    The flattening environment passed to this ACL2 function is meant to consist of the known values of the constant parameters. We are not yet handling function specialization here (which is where these environments will be calculated).

    Any case, given such an environment, the function declaration is flattened by flattening its body.

    Definitions and Theorems

    Function: flatten-fundecl

    (defun flatten-fundecl (decl env)
      (declare (xargs :guard (and (fundeclp decl) (fenvp env))))
      (let ((__function__ 'flatten-fundecl))
        (declare (ignorable __function__))
        (b* (((fundecl decl) decl)
             ((okf new-body)
              (flatten-statement-list decl.body env)))
          (change-fundecl decl :body new-body))))

    Theorem: fundecl-resultp-of-flatten-fundecl

    (defthm fundecl-resultp-of-flatten-fundecl
      (b* ((new-decl (flatten-fundecl decl env)))
        (fundecl-resultp new-decl))
      :rule-classes :rewrite)

    Theorem: flatten-fundecl-of-fundecl-fix-decl

    (defthm flatten-fundecl-of-fundecl-fix-decl
      (equal (flatten-fundecl (fundecl-fix decl) env)
             (flatten-fundecl decl env)))

    Theorem: flatten-fundecl-fundecl-equiv-congruence-on-decl

    (defthm flatten-fundecl-fundecl-equiv-congruence-on-decl
      (implies (fundecl-equiv decl decl-equiv)
               (equal (flatten-fundecl decl env)
                      (flatten-fundecl decl-equiv env)))
      :rule-classes :congruence)

    Theorem: flatten-fundecl-of-fenv-fix-env

    (defthm flatten-fundecl-of-fenv-fix-env
      (equal (flatten-fundecl decl (fenv-fix env))
             (flatten-fundecl decl env)))

    Theorem: flatten-fundecl-fenv-equiv-congruence-on-env

    (defthm flatten-fundecl-fenv-equiv-congruence-on-env
      (implies (fenv-equiv env env-equiv)
               (equal (flatten-fundecl decl env)
                      (flatten-fundecl decl env-equiv)))
      :rule-classes :congruence)