• 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
          • Svstmt-case
          • Svstmt-while
          • Svstmt-p
          • Svstmt-if
          • Svstmt-equiv
          • Svstmt-xcond
          • Svstmt-scope
          • Svstmt-assign
          • Svstmt-compile
            • Svstmt-compile.lisp
              • Svstate-merge-branches
              • Svex-alist-merge-branches
              • Svstmt-assign->subst
              • Svstack-merge-branches
              • Svstacks-compatible
              • Svjumpstate-merge-svstate-branches
              • Svjumpstate-svstate-compatible
              • Svstmt-lhs-check-masks
              • Svjumpstate
              • Svjumpstates-compatible
              • Svstmtlist-compile-top
              • Svjumpstate-sequence-svstates
              • Constraintlist-merge-branches
              • Svjumpstate-merge-branches
              • Svex-replace-range
              • Svex-svstmt-ite
                • Svstmt-process-write
                • Svjumpstate-sequence
                • Svstmt-process-writelist
                • Svstack-assign
                • Svstmt-writelist-var-sizes
                • Svstates-compatible
                • 4vec-replace-range
                • Svstmt-write-var-sizes
                • Make-empty-svjumpstate
                • Constraintlist-add-pathcond
                • Svjumpstate-pop-scope
                • Constraintlist-compose-svstack
                • Svstack-to-svex-alist
                • Svstack-filter-global-lhs-vars
                • Svjumpstate-vars
                • Svex-svstmt-or
                • Svex-svstmt-andc1
                • Svstate-push-scope
                • Svstate-pop-scope
                • Svstate-vars
                • Svstack-lookup
                • Svar-subtract-delay
                • Svstmt-initialize-locals
                • Svstack-fork
                • Svstack-clean
                • Svstack-nonempty-fix
                • Svstate-fork
                • Svstate-clean
                • Svstack-globalp
                • Svjumpstate-fork
                • Svar-delayed-member
                • Svjumpstate-levels
                • Svjumpstate-free
                • Svstate-free
                • Svstack-free
                • Svstack
                • Svar-size-alist
              • Svstate
            • Svstmt-constraints
            • Svstmt-jump
            • Svstmtlist
            • Svstmt-kind
            • Svstmt.lisp
            • Svstmt-fix
            • Svstmt-count
          • Sv-tutorial
          • Expressions
          • Symbolic-test-vector
          • Vl-to-svex
        • Fgl
        • Vwsim
        • Vl
        • X86isa
        • Svl
        • Rtl
      • Software-verification
      • Math
      • Testing-utilities
    • Svstmt-compile.lisp

    Svex-svstmt-ite

    Signature
    (svex-svstmt-ite test then else) → ite
    Arguments
    test — Guard (svex-p test).
    then — Guard (svex-p then).
    else — Guard (svex-p else).
    Returns
    ite — Type (svex-p ite).

    Definitions and Theorems

    Function: svex-svstmt-ite

    (defun svex-svstmt-ite (test then else)
      (declare (xargs :guard (and (svex-p test)
                                  (svex-p then)
                                  (svex-p else))))
      (let ((__function__ 'svex-svstmt-ite))
        (declare (ignorable __function__))
        (b* ((test (svex-fix test))
             (then (svex-fix then))
             (else (svex-fix else)))
          (or (svex-case test :quote
                         (if (eql (4vec-reduction-or test.val) -1)
                             then
                           (if (eql (4vec-reduction-or test.val) 0)
                               else
                             nil))
                         :otherwise nil)
              (and (hons-equal then else) then)
              (svex-call '?*
                         (list test then else))))))

    Theorem: svex-p-of-svex-svstmt-ite

    (defthm svex-p-of-svex-svstmt-ite
      (b* ((ite (svex-svstmt-ite test then else)))
        (svex-p ite))
      :rule-classes :rewrite)

    Theorem: svex-svstmt-ite-correct

    (defthm svex-svstmt-ite-correct
      (b* ((?ite (svex-svstmt-ite test then else)))
        (equal (svex-eval ite env)
               (4vec-?* (svex-eval test env)
                        (svex-eval then env)
                        (svex-eval else env)))))

    Theorem: vars-of-svex-svstmt-ite

    (defthm vars-of-svex-svstmt-ite
      (b* ((?ite (svex-svstmt-ite test then else)))
        (implies (and (not (member v (svex-vars test)))
                      (not (member v (svex-vars then)))
                      (not (member v (svex-vars else))))
                 (not (member v (svex-vars ite))))))

    Theorem: svex-svstmt-ite-under-iff

    (defthm svex-svstmt-ite-under-iff
      (b* ((?ite (svex-svstmt-ite test then else)))
        (iff ite t)))

    Theorem: svex-svstmt-ite-when-cond-true

    (defthm svex-svstmt-ite-when-cond-true
      (b* ((?ite (svex-svstmt-ite test then else)))
        (implies (equal (4vec-reduction-or (svex-eval test env))
                        -1)
                 (equal (svex-eval ite env)
                        (svex-eval then env)))))

    Theorem: svex-svstmt-ite-when-cond-false

    (defthm svex-svstmt-ite-when-cond-false
      (b* ((?ite (svex-svstmt-ite test then else)))
        (implies (equal (4vec-reduction-or (svex-eval test env))
                        0)
                 (equal (svex-eval ite env)
                        (svex-eval else env)))))

    Theorem: svex-svstmt-ite-of-svex-fix-test

    (defthm svex-svstmt-ite-of-svex-fix-test
      (equal (svex-svstmt-ite (svex-fix test)
                              then else)
             (svex-svstmt-ite test then else)))

    Theorem: svex-svstmt-ite-svex-equiv-congruence-on-test

    (defthm svex-svstmt-ite-svex-equiv-congruence-on-test
      (implies (svex-equiv test test-equiv)
               (equal (svex-svstmt-ite test then else)
                      (svex-svstmt-ite test-equiv then else)))
      :rule-classes :congruence)

    Theorem: svex-svstmt-ite-of-svex-fix-then

    (defthm svex-svstmt-ite-of-svex-fix-then
      (equal (svex-svstmt-ite test (svex-fix then)
                              else)
             (svex-svstmt-ite test then else)))

    Theorem: svex-svstmt-ite-svex-equiv-congruence-on-then

    (defthm svex-svstmt-ite-svex-equiv-congruence-on-then
      (implies (svex-equiv then then-equiv)
               (equal (svex-svstmt-ite test then else)
                      (svex-svstmt-ite test then-equiv else)))
      :rule-classes :congruence)

    Theorem: svex-svstmt-ite-of-svex-fix-else

    (defthm svex-svstmt-ite-of-svex-fix-else
      (equal (svex-svstmt-ite test then (svex-fix else))
             (svex-svstmt-ite test then else)))

    Theorem: svex-svstmt-ite-svex-equiv-congruence-on-else

    (defthm svex-svstmt-ite-svex-equiv-congruence-on-else
      (implies (svex-equiv else else-equiv)
               (equal (svex-svstmt-ite test then else)
                      (svex-svstmt-ite test then else-equiv)))
      :rule-classes :congruence)