• 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
              • Field-div-flagged-correctness
                • Field-div-flagged-spec
                • Field-div-flagged-circuit
                • Field-div-flagged-lifting
              • 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-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-div-flagged

    Field-div-flagged-correctness

    Correctness of the circuit.

    Soundness is proved by expanding the predicate and specification, as well as pfield::div to expose pfield::inv, and we need a :use hint to apply a theorem in the right way.

    Completeness is proved by expanding all the specifications, the correctness theorems for the called circuits, and using the suff theorem to obtain the conclusion. We also need to enable pfield::div; but here there is no need to disable the rule disabled in the soundness theorem (see above).

    The extension to the circuit is boilerplate.

    Definitions and Theorems

    Theorem: field-div-flagged-soundness

    (defthm field-div-flagged-soundness
      (implies (and (primep prime)
                    (pfield::fep x prime)
                    (pfield::fep y prime)
                    (pfield::fep z prime)
                    (pfield::fep e prime))
               (implies (field-div-flagged-pred x y z e prime)
                        (field-div-flagged-spec x y z e prime))))

    Theorem: field-div-flagged-completeness

    (defthm field-div-flagged-completeness
      (implies (and (primep prime)
                    (pfield::fep x prime)
                    (pfield::fep y prime)
                    (pfield::fep z prime)
                    (pfield::fep e prime))
               (implies (field-div-flagged-spec x y z e prime)
                        (field-div-flagged-pred x y z e prime))))

    Theorem: field-div-flagged-pred-to-spec

    (defthm field-div-flagged-pred-to-spec
      (implies (and (primep prime)
                    (pfield::fep x prime)
                    (pfield::fep y prime)
                    (pfield::fep z prime)
                    (pfield::fep e prime))
               (equal (field-div-flagged-pred x y z e prime)
                      (field-div-flagged-spec x y z e prime))))

    Theorem: field-div-flagged-circuit-to-spec

    (defthm field-div-flagged-circuit-to-spec
     (implies
       (and (equal (pfcs::lookup-definition (pfname "field_div_flagged")
                                            defs)
                   (field-div-flagged-circuit))
            (primep prime)
            (pfield::fep x prime)
            (pfield::fep y prime)
            (pfield::fep z prime)
            (pfield::fep e prime))
       (equal (pfcs::definition-satp (pfname "field_div_flagged")
                                     defs (list x y z e)
                                     prime)
              (field-div-flagged-spec x y z e prime))))