• Top
    • Documentation
    • Books
    • Recursion-and-induction
    • Boolean-reasoning
      • Ipasir
      • Aignet
      • Aig
      • Satlink
      • Truth
        • Index-permute-shrink
        • Permute-stretch
        • Env-mismatch-aux
        • Permute-shrink
        • Permute-polarity
        • Env-permute-polarity
        • Env-permute-shrink
        • Permute-var-down
        • Swap-vars-aux
        • Env-permute-stretch
        • Swap-vars
        • Permute-var-up
        • Negative-cofactor
        • Truth-perm-rev
        • Index-permute-stretch
        • Env-mismatch
        • Truth-perm
        • Swap-polarity
        • Positive-cofactor
        • Index-perm-rev
        • Env-perm-rev
        • Nth-set-bit-pos
        • Index-swap
        • Env-move-var-down
        • Is-xor-with-var
        • Index-perm
        • Env-swap-vars
        • Var
        • Truth-eval
        • Index-move-down
        • Env-update
        • Env-perm
        • Depends-on-witness
        • Env-swap-polarity
        • Var-repetitions
          • Env-move-var-up
          • Index-move-up
          • Depends-on
          • Truth-norm
          • Index-listp
          • Env-diff-index
          • Env-lookup
          • True
          • False
        • Ubdds
        • Bdd
        • Faig
        • Bed
        • 4v
      • Projects
      • Debugging
      • Std
      • Proof-automation
      • Macro-libraries
      • ACL2
      • Interfacing-tools
      • Hardware-verification
      • Software-verification
      • Testing-utilities
      • Math
    • Truth

    Var-repetitions

    Signature
    (var-repetitions n val numvars) → rep-val
    Arguments
    n — Guard (natp n).
    val — Guard (natp val).
    numvars — Guard (natp numvars).
    Returns
    rep-val — Type (natp rep-val).

    Definitions and Theorems

    Function: var-repetitions

    (defun
         var-repetitions (n val numvars)
         (declare (xargs :guard (and (natp n)
                                     (natp val)
                                     (natp numvars))))
         (declare (xargs :guard (and (<= n numvars)
                                     (unsigned-byte-p (ash 1 n) val))))
         (let ((__function__ 'var-repetitions))
              (declare (ignorable __function__))
              (mbe :logic (logrepeat (ash 1 (- (nfix numvars) (nfix n)))
                                     (ash 1 (nfix n))
                                     (nfix val))
                   :exec (b* ((shift (ash 1 n))
                              ((when (mbe :logic (zp (- numvars n))
                                          :exec (eql n numvars)))
                               val))
                             (var-repetitions (+ 1 n)
                                              (logapp shift val val)
                                              numvars)))))

    Theorem: natp-of-var-repetitions

    (defthm natp-of-var-repetitions
            (b* ((rep-val (var-repetitions n val numvars)))
                (natp rep-val))
            :rule-classes :type-prescription)

    Theorem: var-repetitions-of-nfix-n

    (defthm var-repetitions-of-nfix-n
            (equal (var-repetitions (nfix n) val numvars)
                   (var-repetitions n val numvars)))

    Theorem: var-repetitions-nat-equiv-congruence-on-n

    (defthm var-repetitions-nat-equiv-congruence-on-n
            (implies (nat-equiv n n-equiv)
                     (equal (var-repetitions n val numvars)
                            (var-repetitions n-equiv val numvars)))
            :rule-classes :congruence)

    Theorem: var-repetitions-of-nfix-val

    (defthm var-repetitions-of-nfix-val
            (equal (var-repetitions n (nfix val) numvars)
                   (var-repetitions n val numvars)))

    Theorem: var-repetitions-nat-equiv-congruence-on-val

    (defthm var-repetitions-nat-equiv-congruence-on-val
            (implies (nat-equiv val val-equiv)
                     (equal (var-repetitions n val numvars)
                            (var-repetitions n val-equiv numvars)))
            :rule-classes :congruence)

    Theorem: var-repetitions-of-nfix-numvars

    (defthm var-repetitions-of-nfix-numvars
            (equal (var-repetitions n val (nfix numvars))
                   (var-repetitions n val numvars)))

    Theorem: var-repetitions-nat-equiv-congruence-on-numvars

    (defthm var-repetitions-nat-equiv-congruence-on-numvars
            (implies (nat-equiv numvars numvars-equiv)
                     (equal (var-repetitions n val numvars)
                            (var-repetitions n val numvars-equiv)))
            :rule-classes :congruence)