• 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
            • Least-fixpoint
            • Svex-p
            • Svex-select
            • Svex-alist
            • Svex-equiv
            • Svexlist
              • Svexlist-p
              • Svex-update-nth
              • Svexlist-equiv
              • Svex-nth
                • Svexlist-fix
                • Patbind-svex-nths
              • 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
    • Svexlist

    Svex-nth

    nth for svexlists, with proper fty-discipline.

    Signature
    (svex-nth n x) → expr
    Arguments
    n — Guard (natp n).
    x — Guard (svexlist-p x).
    Returns
    expr — Type (svex-p expr).

    Definitions and Theorems

    Function: svex-nth

    (defun svex-nth (n x)
      (declare (xargs :guard (and (natp n) (svexlist-p x))))
      (let ((__function__ 'svex-nth))
        (declare (ignorable __function__))
        (mbe :logic (svex-fix (nth n x))
             :exec
             (if (< n (len x))
                 (nth n x)
               (svex-quote (4vec-x))))))

    Theorem: svex-p-of-svex-nth

    (defthm svex-p-of-svex-nth
      (b* ((expr (svex-nth n x)))
        (svex-p expr))
      :rule-classes :rewrite)

    Theorem: svex-nth-of-nfix-n

    (defthm svex-nth-of-nfix-n
      (equal (svex-nth (nfix n) x)
             (svex-nth n x)))

    Theorem: svex-nth-nat-equiv-congruence-on-n

    (defthm svex-nth-nat-equiv-congruence-on-n
      (implies (nat-equiv n n-equiv)
               (equal (svex-nth n x)
                      (svex-nth n-equiv x)))
      :rule-classes :congruence)

    Theorem: svex-nth-of-svexlist-fix-x

    (defthm svex-nth-of-svexlist-fix-x
      (equal (svex-nth n (svexlist-fix x))
             (svex-nth n x)))

    Theorem: svex-nth-svexlist-equiv-congruence-on-x

    (defthm svex-nth-svexlist-equiv-congruence-on-x
      (implies (svexlist-equiv x x-equiv)
               (equal (svex-nth n x)
                      (svex-nth n x-equiv)))
      :rule-classes :congruence)