• 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-xor-correctness
                • Boolean-xor-spec
                • Boolean-xor-circuit
                • Boolean-xor-lifting
              • 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-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-xor

    Boolean-xor-correctness

    Correctness of the circuit.

    We need to split into cases based on whether the prime is 2 or not. This is not too surprising, because of the 2 that appears in the constraints, which is the same as 0 if the prime happens to be 2. It turns out that, if the prime is 2, the constraint still works (i.e. it realizes exclusive disjunction); but apparently ACL2 needs to consider this case separately. We also need to enable bitp for this proof to work. We use the prime fields library rules as with other circuits.

    The extension to the circuit is boilerplate.

    Definitions and Theorems

    Theorem: boolean-xor-pred-to-spec

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

    Theorem: boolean-xor-circuit-to-spec

    (defthm boolean-xor-circuit-to-spec
      (implies
           (and (equal (pfcs::lookup-definition (pfname "boolean_xor")
                                                defs)
                       (boolean-xor-circuit))
                (primep prime)
                (pfield::fep x prime)
                (pfield::fep y prime)
                (pfield::fep z prime)
                (bitp x)
                (bitp y))
           (equal (pfcs::definition-satp (pfname "boolean_xor")
                                         defs (list x y z)
                                         prime)
                  (boolean-xor-spec x y z prime))))