• Top
    • Documentation
    • Books
    • Boolean-reasoning
    • Projects
    • Debugging
    • Std
    • Proof-automation
    • Macro-libraries
    • ACL2
    • Interfacing-tools
    • Hardware-verification
      • Gl
      • Esim
      • Vl2014
      • Sv
        • Svex-stvs
        • Svex-decomposition-methodology
        • Sv-versus-esim
        • Svex-decomp
        • Svex-compose-dfs
        • Svex-compilation
        • Moddb
        • Svmods
        • Svstmt
        • Sv-tutorial
        • Expressions
          • Rewriting
          • Svex
            • Svar
              • Svar-p
              • Svar-fix
                • Make-svar
                • Svar-equiv
                • Svar->props
                • Svar->delay
                • Svar->bits
                • Change-svar
                • Svarlist
                • Svar->name
                • Svar-map
                • Svar-alist
              • Least-fixpoint
              • Svex-p
              • Svex-select
              • Svex-alist
              • Svex-equiv
              • Svexlist
              • Svex-call
              • Fnsym
              • Svex-quote
              • Svex-var
              • Svcall-rw
              • Svcall
              • Svex-kind
              • Svcall*
              • Svex-fix
              • Svex-count
              • Svex-1z
              • Svex-1x
              • Svex-z
              • Svex-x
            • Bit-blasting
            • Functions
            • 4vmask
            • Why-infinite-width
            • Svex-vars
            • Evaluation
            • Values
          • Symbolic-test-vector
          • Vl-to-svex
        • Fgl
        • Vwsim
        • Vl
        • X86isa
        • Svl
        • Rtl
      • Software-verification
      • Math
      • Testing-utilities
    • Svar

    Svar-fix

    Fixing function for svar structures.

    Signature
    (svar-fix x) → new-x
    Arguments
    x — Guard (svar-p x).
    Returns
    new-x — Type (svar-p new-x).

    Definitions and Theorems

    Function: svar-fix$inline

    (defun svar-fix$inline (x)
     (declare (xargs :guard (svar-p x)))
     (let ((__function__ 'svar-fix))
      (declare (ignorable __function__))
      (mbe
       :logic
       (b* ((name (if (atom x) x (cadr x)))
            (delay (nfix (if (atom x)
                             0
                           (b* ((rest (cddr x))
                                ((when (integerp rest))
                                 (loghead 4 rest))
                                ((when (integerp (first rest)))
                                 (first rest)))
                             (cdr (first rest))))))
            (bits (ifix (if (atom x)
                            0
                          (b* ((rest (cddr x))
                               ((when (integerp rest))
                                (logtail 4 rest))
                               ((when (integerp (first rest)))
                                (cdr rest)))
                            (cdr (second rest))))))
            (props (svar-proplist-fix
                        (if (atom x)
                            nil
                          (b* ((rest (cddr x))
                               ((when (integerp rest)) nil)
                               ((when (integerp (first rest))) nil))
                            (cddr rest))))))
        (cond
          (props
               (hons :var (hons name
                                (hons (hons :delay delay)
                                      (hons (hons :bits bits) props)))))
          ((>= delay 16)
           (hons :var (hons name (hons delay bits))))
          ((and (or (stringp name)
                    (and (symbolp name)
                         (not (booleanp name))))
                (eql delay 0)
                (eql bits 0))
           name)
          (t (hons :var (hons name (logapp 4 delay bits))))))
       :exec x)))

    Theorem: svar-p-of-svar-fix

    (defthm svar-p-of-svar-fix
      (b* ((new-x (svar-fix$inline x)))
        (svar-p new-x))
      :rule-classes :rewrite)

    Theorem: svar-fix-when-svar-p

    (defthm svar-fix-when-svar-p
      (implies (svar-p x)
               (equal (svar-fix x) x)))

    Function: svar-equiv$inline

    (defun svar-equiv$inline (x y)
      (declare (xargs :guard (and (svar-p x) (svar-p y))))
      (equal (svar-fix x) (svar-fix y)))

    Theorem: svar-equiv-is-an-equivalence

    (defthm svar-equiv-is-an-equivalence
      (and (booleanp (svar-equiv x y))
           (svar-equiv x x)
           (implies (svar-equiv x y)
                    (svar-equiv y x))
           (implies (and (svar-equiv x y) (svar-equiv y z))
                    (svar-equiv x z)))
      :rule-classes (:equivalence))

    Theorem: svar-equiv-implies-equal-svar-fix-1

    (defthm svar-equiv-implies-equal-svar-fix-1
      (implies (svar-equiv x x-equiv)
               (equal (svar-fix x) (svar-fix x-equiv)))
      :rule-classes (:congruence))

    Theorem: svar-fix-under-svar-equiv

    (defthm svar-fix-under-svar-equiv
      (svar-equiv (svar-fix x) x)
      :rule-classes (:rewrite :rewrite-quoted-constant))

    Theorem: equal-of-svar-fix-1-forward-to-svar-equiv

    (defthm equal-of-svar-fix-1-forward-to-svar-equiv
      (implies (equal (svar-fix x) y)
               (svar-equiv x y))
      :rule-classes :forward-chaining)

    Theorem: equal-of-svar-fix-2-forward-to-svar-equiv

    (defthm equal-of-svar-fix-2-forward-to-svar-equiv
      (implies (equal x (svar-fix y))
               (svar-equiv x y))
      :rule-classes :forward-chaining)

    Theorem: svar-equiv-of-svar-fix-1-forward

    (defthm svar-equiv-of-svar-fix-1-forward
      (implies (svar-equiv (svar-fix x) y)
               (svar-equiv x y))
      :rule-classes :forward-chaining)

    Theorem: svar-equiv-of-svar-fix-2-forward

    (defthm svar-equiv-of-svar-fix-2-forward
      (implies (svar-equiv x (svar-fix y))
               (svar-equiv x y))
      :rule-classes :forward-chaining)