• 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
        • Number-theory
          • Tonelli-shanks-modular-sqrt-algorithm
          • Defprime
          • Dm::primep
          • Defprime-alias
          • Prime
          • Has-square-root?
          • Prime-fix
            • Secp256k1-group-prime
            • Secp256k1-field-prime
            • Jubjub-subgroup-prime
            • Bn-254-group-prime
            • Bls12-381-scalar-field-prime
            • Baby-jubjub-subgroup-prime
            • Goldilocks-prime
          • Lists-light
          • Axe
          • Builtins
          • Solidity
          • Helpers
          • Htclient
          • Typed-lists-light
          • Arithmetic-light
        • X86isa
        • Axe
        • Execloader
      • Math
      • Testing-utilities
    • Number-theory

    Prime-fix

    Fixer for dm::primep.

    Signature
    (prime-fix x) → fixed-x
    Arguments
    x — Guard (dm::primep x).
    Returns
    fixed-x — Type (dm::primep fixed-x).

    Definitions and Theorems

    Function: prime-fix

    (defun prime-fix (x)
      (declare (xargs :guard (dm::primep x)))
      (mbe :logic (if (dm::primep x) x 2)
           :exec x))

    Theorem: primep-of-prime-fix

    (defthm primep-of-prime-fix
      (b* ((fixed-x (prime-fix x)))
        (dm::primep fixed-x))
      :rule-classes :rewrite)

    Theorem: prime-fix-when-primep

    (defthm prime-fix-when-primep
      (implies (dm::primep x)
               (equal (prime-fix x) x)))

    Theorem: posp-of-prime-fix

    (defthm posp-of-prime-fix
      (posp (prime-fix x)))