• Top
    • Documentation
    • Books
    • Boolean-reasoning
    • Projects
      • Apt
      • Zfc
      • Acre
      • Milawa
      • Smtlink
      • Abnf
      • Vwsim
      • Isar
      • Wp-gen
      • Dimacs-reader
      • Pfcs
      • Legacy-defrstobj
      • C
      • Proof-checker-array
      • Soft
      • Farray
      • Rp-rewriter
      • Instant-runoff-voting
      • Imp-language
      • Sidekick
      • Ethereum
      • Leftist-trees
      • Java
      • Riscv
      • Taspi
      • Bitcoin
      • Zcash
      • Des
      • X86isa
      • Sha-2
      • Yul
      • Proof-checker-itp13
      • Regex
      • ACL2-programming-language
      • Json
      • Jfkr
      • Equational
      • Cryptography
      • Axe
      • Poseidon
      • Where-do-i-place-my-book
      • Aleo
        • Aleobft
        • Aleovm
          • Circuits
            • Circuits-pfcs
            • Circuits-r1cs
            • Field-div-flagged
            • Boolean-assert-true
            • Field-inv-flagged
            • Boolean-assert
            • Field-div-unchecked
            • Field-neq
            • Boolean-not
            • Boolean-assert-all
            • Boolean-if
            • Field-if
            • Boolean-xor
            • Boolean-or
            • Boolean-nor
            • Boolean-and
            • Boolean-nand
            • Boolean-neq
            • Boolean-eq
            • Field-div-checked
            • Field-inv-checked
            • Boolean-assert-neq
            • Boolean-assert-eq
              • Boolean-assert-eq-correctness
                • Boolean-assert-eq-lifting
                • Boolean-assert-eq-circuit
                • Boolean-assert-eq-spec
              • Field-eq
              • Field-assert-neq
              • Field-assert-eq
              • Field-mul
              • Field-sub
              • Field-square
              • Field-neg
              • Field-double
              • Field-add
            • Language
          • Leo
        • 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
    • Boolean-assert-eq

    Boolean-assert-eq-correctness

    Correctness of the circuit.

    Soundness is proved by expanding the existentially quantified boolean equality assertion predicate to the boolean equality and truth assertion predicates, using the correcness theorems of the latter two, and expanding all three specifications.

    Completeness is proved also by expanding the boolean equality and truth assertion predicates and all the specifications, but we we use the suff theorem for the boolean equality assertion predicate. The witness for the existential quantification is the result of comparing the two operands for equality.

    The extension to the circuit is boilerplate.

    Definitions and Theorems

    Theorem: boolean-assert-eq-pred-soundness

    (defthm boolean-assert-eq-pred-soundness
      (implies (and (primep prime)
                    (pfield::fep x prime)
                    (pfield::fep y prime)
                    (bitp x)
                    (bitp y))
               (implies (boolean-assert-eq-pred x y prime)
                        (boolean-assert-eq-spec x y prime))))

    Theorem: boolean-assert-eq-pred-completeness

    (defthm boolean-assert-eq-pred-completeness
      (implies (and (primep prime)
                    (pfield::fep x prime)
                    (pfield::fep y prime)
                    (bitp x)
                    (bitp y))
               (implies (boolean-assert-eq-spec x y prime)
                        (boolean-assert-eq-pred x y prime))))

    Theorem: boolean-assert-eq-pred-to-spec

    (defthm boolean-assert-eq-pred-to-spec
      (implies (and (primep prime)
                    (pfield::fep x prime)
                    (pfield::fep y prime)
                    (bitp x)
                    (bitp y))
               (equal (boolean-assert-eq-pred x y prime)
                      (boolean-assert-eq-spec x y prime))))

    Theorem: boolean-assert-eq-circuit-to-spec

    (defthm boolean-assert-eq-circuit-to-spec
     (implies
      (and
          (equal (pfcs::lookup-definition (pfname "boolean_assert_eq")
                                          defs)
                 (boolean-assert-eq-circuit))
          (equal (pfcs::lookup-definition (pfname "boolean_assert_true")
                                          defs)
                 (boolean-assert-true-circuit))
          (equal (pfcs::lookup-definition (pfname "boolean_eq")
                                          defs)
                 (boolean-eq-circuit))
          (equal (pfcs::lookup-definition (pfname "boolean_neq")
                                          defs)
                 (boolean-neq-circuit))
          (equal (pfcs::lookup-definition (pfname "boolean_not")
                                          defs)
                 (boolean-not-circuit))
          (equal (pfcs::lookup-definition (pfname "boolean_xor")
                                          defs)
                 (boolean-xor-circuit))
          (primep prime)
          (pfield::fep x prime)
          (pfield::fep y prime)
          (bitp x)
          (bitp y))
      (equal (pfcs::definition-satp (pfname "boolean_assert_eq")
                                    defs (list x y)
                                    prime)
             (boolean-assert-eq-spec x y prime))))