• Top
    • Documentation
    • Books
    • Boolean-reasoning
    • Projects
    • Debugging
    • Std
    • Proof-automation
    • Macro-libraries
    • ACL2
    • Interfacing-tools
    • Hardware-verification
      • Gl
      • Esim
      • Vl2014
        • Warnings
        • Primitives
        • Use-set
        • Syntax
        • Getting-started
        • Utilities
        • Loader
        • Transforms
          • Expression-sizing
          • Occform
          • Oprewrite
          • Expand-functions
          • Delayredux
          • Unparameterization
          • Caseelim
          • Split
          • Selresolve
          • Weirdint-elim
          • Vl-delta
          • Replicate-insts
          • Rangeresolve
          • Propagate
          • Clean-selects
          • Clean-params
          • Blankargs
          • Inline-mods
          • Expr-simp
          • Trunc
          • Always-top
            • Edgesynth
            • Stmtrewrite
            • Cblock
            • Vl-always-convert-regports
            • Vl-always-convert-regs
            • Stmttemps
            • Edgesplit
            • Vl-always-check-reg
            • Vl-convert-regs
            • Latchsynth
            • Vl-always-check-regs
            • Vl-match-always-at-some-edges
            • Unelse
              • Vl-modulelist-unelse
              • Vl-alwayslist-unelse
              • Vl-ifstmt-unelse
                • Vl-stmt-unelse
                • Vl-module-unelse
                • Vl-always-unelse
                • Vl-design-unelse
              • Vl-always-convert-reg
              • Vl-design-always-backend
              • Vl-stmt-guts
              • Vl-always-convert-regport
              • Vl-always-scary-regs
              • Eliminitial
              • Ifmerge
              • Vl-edge-control-p
              • Elimalways
            • Gatesplit
            • Gate-elim
            • Expression-optimization
            • Elim-supplies
            • Wildelim
            • Drop-blankports
            • Clean-warnings
            • Addinstnames
            • Custom-transform-hooks
            • Annotate
            • Latchcode
            • Elim-unused-vars
            • Problem-modules
          • Lint
          • Mlib
          • Server
          • Kit
          • Printer
          • Esim-vl
          • Well-formedness
        • Sv
        • Fgl
        • Vwsim
        • Vl
        • X86isa
        • Svl
        • Rtl
      • Software-verification
      • Math
      • Testing-utilities
    • Unelse

    Vl-ifstmt-unelse

    Just handles a single if statement (not recursive).

    Signature
    (vl-ifstmt-unelse x) → new-x
    Arguments
    x — any statement, but we only rewrite it when it's an if statement; this makes writing vl-stmt-unelse very simple.
        Guard (vl-stmt-p x).
    Returns
    new-x — Type (vl-stmt-p new-x), given the guard.

    Definitions and Theorems

    Function: vl-ifstmt-unelse

    (defun vl-ifstmt-unelse (x)
      (declare (xargs :guard (vl-stmt-p x)))
      (let ((__function__ 'vl-ifstmt-unelse))
        (declare (ignorable __function__))
        (b* (((unless (eq (vl-stmt-kind x) :vl-ifstmt))
              x)
             ((vl-ifstmt x) x)
             ((when (eq (vl-stmt-kind x.falsebranch)
                        :vl-nullstmt))
              x)
             ((unless (and (vl-expr->finaltype x.condition)
                           (posp (vl-expr->finalwidth x.condition))
                           (vl-expr-welltyped-p x.condition)))
              x)
             (!condition (vl-condition-neg x.condition))
             (nullstmt (make-vl-nullstmt))
             (stmt1 (make-vl-ifstmt :condition x.condition
                                    :truebranch x.truebranch
                                    :falsebranch nullstmt))
             (stmt2 (make-vl-ifstmt :condition !condition
                                    :truebranch x.falsebranch
                                    :falsebranch nullstmt))
             (new-x (make-vl-blockstmt :sequentialp t
                                       :stmts (list stmt1 stmt2))))
          new-x)))

    Theorem: vl-stmt-p-of-vl-ifstmt-unelse

    (defthm vl-stmt-p-of-vl-ifstmt-unelse
      (implies (and (force (vl-stmt-p x)))
               (b* ((new-x (vl-ifstmt-unelse x)))
                 (vl-stmt-p new-x)))
      :rule-classes :rewrite)