• 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
      • Json
      • Jfkr
      • Equational
      • Cryptography
      • Poseidon
      • Where-do-i-place-my-book
      • Axe
      • Aleo
        • Aleobft
        • Aleovm
          • Circuits
          • Language
            • Grammar
            • Early-version
              • Abstract-syntax
                • Binary-op
                • Literal
                • Instruction
                • Hash-op
                • Literal-type
                • Operand
                • Unary-op
                • Identifier
                • Commit-op
                • Mapping
                • Function
                • Programdef
                • Finalize-type
                • Closure
                • Register-type
                • Finalizer
                • Value-type
                • Record-type
                • Command
                • Plaintext-type
                • Finalization-option
                • Visibility
                • Register
                • Reference
                • Programid
                • Locator
                • Finalization
                • Entry-type
                • Regaccess
                • Program
                  • Program-fix
                    • Program-equiv
                    • Make-program
                    • Program->imports
                    • Change-program
                    • Program->name
                    • Program->defs
                    • Programp
                  • Interface-type
                  • Ident+ptype
                  • Ident+etype
                  • Function-output
                  • Finalize-output
                  • Finalize-input
                  • Closure-output
                  • Closure-input
                  • Assert-op
                  • Function-input
                  • Equal-op
                  • Finalize-command
                  • Ternary-op
                  • Import
                  • Ident+ptype-list
                  • Operand-list
                  • Ident+etype-list
                  • Programdef-list
                  • Instruction-list
                  • Import-list
                  • Identifier-list
                  • Function-output-list
                  • Function-input-list
                  • Finalize-output-list
                  • Finalize-input-list
                  • Command-list
                  • Closure-output-list
                  • Closure-input-list
                • Parser
                • Concrete-syntax
              • Concrete-syntax
          • Leo
        • 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
    • Program

    Program-fix

    Fixing function for program structures.

    Signature
    (program-fix x) → new-x
    Arguments
    x — Guard (programp x).
    Returns
    new-x — Type (programp new-x).

    Definitions and Theorems

    Function: program-fix$inline

    (defun program-fix$inline (x)
     (declare (xargs :guard (programp x)))
     (let ((__function__ 'program-fix))
      (declare (ignorable __function__))
      (mbe
        :logic
        (b* ((name (identifier-fix (cdr (std::da-nth 0 (cdr x)))))
             (imports (import-list-fix (cdr (std::da-nth 1 (cdr x)))))
             (defs (programdef-list-fix (cdr (std::da-nth 2 (cdr x))))))
          (cons :program (list (cons 'name name)
                               (cons 'imports imports)
                               (cons 'defs defs))))
        :exec x)))

    Theorem: programp-of-program-fix

    (defthm programp-of-program-fix
      (b* ((new-x (program-fix$inline x)))
        (programp new-x))
      :rule-classes :rewrite)

    Theorem: program-fix-when-programp

    (defthm program-fix-when-programp
      (implies (programp x)
               (equal (program-fix x) x)))

    Function: program-equiv$inline

    (defun program-equiv$inline (acl2::x acl2::y)
      (declare (xargs :guard (and (programp acl2::x)
                                  (programp acl2::y))))
      (equal (program-fix acl2::x)
             (program-fix acl2::y)))

    Theorem: program-equiv-is-an-equivalence

    (defthm program-equiv-is-an-equivalence
      (and (booleanp (program-equiv x y))
           (program-equiv x x)
           (implies (program-equiv x y)
                    (program-equiv y x))
           (implies (and (program-equiv x y)
                         (program-equiv y z))
                    (program-equiv x z)))
      :rule-classes (:equivalence))

    Theorem: program-equiv-implies-equal-program-fix-1

    (defthm program-equiv-implies-equal-program-fix-1
      (implies (program-equiv acl2::x x-equiv)
               (equal (program-fix acl2::x)
                      (program-fix x-equiv)))
      :rule-classes (:congruence))

    Theorem: program-fix-under-program-equiv

    (defthm program-fix-under-program-equiv
      (program-equiv (program-fix acl2::x)
                     acl2::x)
      :rule-classes (:rewrite :rewrite-quoted-constant))

    Theorem: equal-of-program-fix-1-forward-to-program-equiv

    (defthm equal-of-program-fix-1-forward-to-program-equiv
      (implies (equal (program-fix acl2::x) acl2::y)
               (program-equiv acl2::x acl2::y))
      :rule-classes :forward-chaining)

    Theorem: equal-of-program-fix-2-forward-to-program-equiv

    (defthm equal-of-program-fix-2-forward-to-program-equiv
      (implies (equal acl2::x (program-fix acl2::y))
               (program-equiv acl2::x acl2::y))
      :rule-classes :forward-chaining)

    Theorem: program-equiv-of-program-fix-1-forward

    (defthm program-equiv-of-program-fix-1-forward
      (implies (program-equiv (program-fix acl2::x)
                              acl2::y)
               (program-equiv acl2::x acl2::y))
      :rule-classes :forward-chaining)

    Theorem: program-equiv-of-program-fix-2-forward

    (defthm program-equiv-of-program-fix-2-forward
      (implies (program-equiv acl2::x (program-fix acl2::y))
               (program-equiv acl2::x acl2::y))
      :rule-classes :forward-chaining)