• Top
    • Documentation
    • Books
    • Recursion-and-induction
    • Boolean-reasoning
    • Debugging
    • Projects
    • 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
            • Tonelli-shanks-algorithm-is-correct
            • Tonelli-shanks-even-sqrt
            • Tonelli-shanks-lesser-sqrt
            • Tonelli-shanks-greater-sqrt
            • Tonelli-shanks-odd-sqrt
            • Tonelli-shanks-sqrt
            • Tonelli-shanks-either-sqrt
            • Tonelli-shanks-supportive-functions
              • Repeated-square
              • Q*2^s
            • 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
    • Tonelli-shanks-supportive-functions

    Q*2^s

    Signature
    (q*2^s n) → (mv q s)
    Arguments
    n — Guard (natp n).
    Returns
    q — Type (natp q).
    s — Type (natp s).

    Definitions and Theorems

    Function: q*2^s

    (defun q*2^s (n)
           (declare (xargs :guard (natp n)))
           (let ((acl2::__function__ 'q*2^s))
                (declare (ignorable acl2::__function__))
                (if (or (not (natp n)) (= n 0))
                    (mv 0 0)
                    (if (oddp n)
                        (mv n 0)
                        (mv-let (inner-q inner-s)
                                (q*2^s (/ n 2))
                                (mv inner-q (+ inner-s 1)))))))

    Theorem: natp-of-q*2^s.q

    (defthm natp-of-q*2^s.q
            (b* (((mv ?q ?s) (q*2^s n))) (natp q))
            :rule-classes :rewrite)

    Theorem: natp-of-q*2^s.s

    (defthm natp-of-q*2^s.s
            (b* (((mv ?q ?s) (q*2^s n))) (natp s))
            :rule-classes :rewrite)