• 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
            • Field-eq
            • Field-assert-neq
            • Field-assert-eq
              • Field-assert-eq-correctness
                • Field-assert-eq-lifting
                • Field-assert-eq-circuit
                • Field-assert-eq-spec
              • 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
    • Field-assert-eq

    Field-assert-eq-correctness

    Correctness of the circuit.

    Soundness is proved by expanding the existentially quantified field equality assertion predicate to the field 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 field equality and truth assertion predicates and all the specifications, but we we use the suff theorem for the field 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: field-assert-eq-pred-soundness

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

    Theorem: field-assert-eq-pred-completeness

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

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

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

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

    (defthm field-assert-eq-circuit-to-spec
     (implies
      (and
          (equal (pfcs::lookup-definition (pfname "field_assert_eq")
                                          defs)
                 (field-assert-eq-circuit))
          (equal (pfcs::lookup-definition (pfname "boolean_assert_true")
                                          defs)
                 (boolean-assert-true-circuit))
          (equal (pfcs::lookup-definition (pfname "field_eq")
                                          defs)
                 (field-eq-circuit))
          (equal (pfcs::lookup-definition (pfname "field_neq")
                                          defs)
                 (field-neq-circuit))
          (equal (pfcs::lookup-definition (pfname "boolean_not")
                                          defs)
                 (boolean-not-circuit))
          (primep prime)
          (pfield::fep x prime)
          (pfield::fep y prime))
      (equal (pfcs::definition-satp (pfname "field_assert_eq")
                                    defs (list x y)
                                    prime)
             (field-assert-eq-spec x y prime))))