• Top
    • Documentation
    • Books
    • Boolean-reasoning
    • Projects
    • Debugging
    • Std
    • Proof-automation
    • Macro-libraries
    • ACL2
    • Interfacing-tools
    • Hardware-verification
    • Software-verification
      • Kestrel-books
        • Crypto-hdwallet
        • Apt
        • Error-checking
        • Fty-extensions
        • Isar
        • Kestrel-utilities
        • Set
        • Soft
        • C
        • Bv
        • Imp-language
        • Event-macros
        • Java
        • Bitcoin
        • Ethereum
        • Yul
        • Zcash
        • ACL2-programming-language
        • Prime-fields
        • Json
        • Syntheto
        • File-io-light
        • Cryptography
          • R1cs
          • Interfaces
          • Sha-2
          • Keccak
          • Kdf
          • Mimc
          • Padding
          • Hmac
          • Elliptic-curves
            • Secp256k1-attachment
            • Twisted-edwards
            • Montgomery
            • Short-weierstrass-curves
            • Birational-montgomery-twisted-edwards
            • Has-square-root?-satisfies-pfield-squarep
            • Secp256k1
            • Secp256k1-domain-parameters
            • Secp256k1-types
            • Pfield-squarep
              • Prime-field-squares-euler-criterion
              • Pfield-odd-squarep
              • Pfield-even-squarep
              • Pfield-squarep-of-inv
            • Secp256k1-interface
            • Prime-field-extra-rules
            • Points
          • Attachments
          • Elliptic-curve-digital-signature-algorithm
        • Number-theory
        • Lists-light
        • Axe
        • Builtins
        • Solidity
        • Helpers
        • Htclient
        • Typed-lists-light
        • Arithmetic-light
      • X86isa
      • Axe
      • Execloader
    • Math
    • Testing-utilities
  • Elliptic-curves

Pfield-squarep

Check if a prime field element is a square.

This is more general than elliptic curve libraries, but it finds some uses in elliptic curves over prime fields (perhaps this should be moved to the prime field library). We non-constructively check whether there exists a square root in the prime field. The witness function returns a root, if one exists.

Definitions and Theorems

Theorem: pfield-squarep-suff

(defthm pfield-squarep-suff
  (implies (and (fep r p) (equal (mul r r p) x))
           (pfield-squarep x p)))

Theorem: booleanp-of-pfield-squarep

(defthm booleanp-of-pfield-squarep
  (b* ((yes/no (pfield-squarep x p)))
    (booleanp yes/no))
  :rule-classes :rewrite)

Subtopics

Prime-field-squares-euler-criterion
A weak formulation of Euler's criterion for prime field squares.
Pfield-odd-squarep
Check if a prime field element is a square of an odd field element.
Pfield-even-squarep
Check if a prime field element is a square of an even field element.
Pfield-squarep-of-inv
The inverse of x is a prime field square iff x is.