• Top
    • Documentation
    • Books
    • Recursion-and-induction
    • Boolean-reasoning
    • Projects
    • Debugging
    • Std
    • Proof-automation
    • Macro-libraries
    • ACL2
    • Interfacing-tools
    • Hardware-verification
    • Software-verification
    • Testing-utilities
    • Math
      • Arithmetic
        • Lispfloat
        • Arithmetic-1
        • Number-theory
          • Tonelli-shanks-modular-sqrt-algorithm
          • Defprime
          • Defprime-alias
          • Prime
          • Dm::primep
          • Has-square-root?
          • Prime-fix
            • Secp256k1-group-prime
            • Secp256k1-field-prime
            • Jubjub-subgroup-prime
            • Edwards-bls12-subgroup-prime
            • Bn-254-group-prime
            • Bls12-381-scalar-field-prime
            • Baby-jubjub-subgroup-prime
            • Goldilocks-prime
          • Proof-by-arith
          • Arith-equivs
          • Number-theory
          • Arithmetic-3
          • Arithmetic-2
          • Arithmetic-light
          • Arithmetic-5
        • Bit-vectors
        • Algebra
    • 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)))