• 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
          • Preprocessor
          • Vl-loadconfig
          • Lexer
          • Vl-loadstate
          • Parser
            • Parse-expressions
            • Parse-udps
            • Vl-genelements
            • Parse-paramdecls
            • Parse-blockitems
            • Parse-utils
              • Defparser
              • Vl-endinfo-p
              • Vl-match-token
              • Vl-match-some-token
              • Vl-match-any-except
              • Vl-type-of-matched-token
              • Vl-maybe-match-token
              • Vl-tokstream-backup-p
              • Vl-parse-error
              • Vl-match
                • Vl-parse-warning
                • Vl-match-any
                • Vl-current-loc
                • Vl-parse-endblock-name
                • Vl-tokenlist-fix
                • Vl-lookahead-is-some-token?
                • Vl-is-some-token?
                • Vl-is-token?
                • Vl-tokstream-save
                • Vl-tokstream-restore
                • Vl-tokstream-fix
                • Vl-lookahead-is-token?
                • Vl-tokstream->tokens
                • Vl-tokstream-add-warning
                • Vl-tokstream->pstate
                • Expand-defparsers
                • *vl-default-token*
              • Parse-insts
              • Parse-datatype
              • Parse-functions
              • Parse-datatypes
              • Parse-strengths
              • Vl-parse-genvar-declaration
              • Vl-parse
              • Parse-ports
              • Seq
              • Parse-packages
            • Vl-load-merge-descriptions
            • Scope-of-defines
            • Vl-load-file
            • Vl-flush-out-descriptions
            • Vl-description
            • Vl-loadresult
            • Vl-read-file
            • Vl-find-basename/extension
            • Vl-find-file
            • Vl-read-files
            • Extended-characters
            • Vl-load
            • Vl-load-main
            • Vl-load-description
            • Vl-descriptions-left-to-load
            • Inject-warnings
            • Vl-load-descriptions
            • Vl-load-files
            • Vl-load-summary
            • Vl-collect-modules-from-descriptions
            • Vl-descriptionlist
          • Transforms
          • Lint
          • Mlib
          • Server
          • Kit
          • Printer
          • Esim-vl
          • Well-formedness
        • Sv
        • Fgl
        • Vwsim
        • Vl
        • X86isa
        • Svl
        • Rtl
      • Software-verification
      • Math
      • Testing-utilities
    • Parse-utils

    Vl-match

    Compatible with seq. Get the first token, no matter what kind of token it is. Only usable when you know there is a token there (via the guard).

    Signature
    (vl-match &key (tokstream 'tokstream)) 
      → 
    (mv errmsg? token new-tokstream)
    Returns
    errmsg? — Type (not errmsg?).
    token — Type (equal (vl-token-p token) (consp (vl-tokstream->tokens))).

    Definitions and Theorems

    Function: vl-match$inline

    (defun vl-match$inline (tokstream)
      (declare (xargs :stobjs (tokstream)))
      (declare (xargs :guard (consp (vl-tokstream->tokens))))
      (let ((__function__ 'vl-match))
        (declare (ignorable __function__))
        (b* ((tokens (vl-tokstream->tokens))
             (tokstream (vl-tokstream-update-tokens (cdr tokens))))
          (mv nil (car tokens) tokstream))))

    Theorem: not-of-vl-match.errmsg?

    (defthm not-of-vl-match.errmsg?
      (b* (((mv ?errmsg? ?token ?new-tokstream)
            (vl-match$inline tokstream)))
        (not errmsg?))
      :rule-classes :rewrite)

    Theorem: return-type-of-vl-match.token

    (defthm return-type-of-vl-match.token
      (b* (((mv ?errmsg? ?token ?new-tokstream)
            (vl-match$inline tokstream)))
        (equal (vl-token-p token)
               (consp (vl-tokstream->tokens))))
      :rule-classes :rewrite)

    Theorem: vl-match-under-iff

    (defthm vl-match-under-iff
      (iff (mv-nth 1 (vl-match))
           (consp (vl-tokstream->tokens))))

    Theorem: vl-match-count-strong-on-value

    (defthm vl-match-count-strong-on-value
     (and
         (<= (vl-tokstream-measure :tokstream (mv-nth 2 (vl-match)))
             (vl-tokstream-measure))
         (implies
              (mv-nth 1 (vl-match))
              (< (vl-tokstream-measure :tokstream (mv-nth 2 (vl-match)))
                 (vl-tokstream-measure))))
     :rule-classes ((:rewrite) (:linear)))

    Theorem: equal-of-vl-match-count

    (defthm equal-of-vl-match-count
     (equal
          (equal (vl-tokstream-measure :tokstream (mv-nth 2 (vl-match)))
                 (vl-tokstream-measure))
          (atom (vl-tokstream->tokens))))

    Theorem: vl-token->type-of-vl-match-when-vl-is-token?

    (defthm vl-token->type-of-vl-match-when-vl-is-token?
      (implies (vl-is-token? type)
               (equal (vl-token->type (mv-nth 1 (vl-match)))
                      type)))

    Theorem: vl-token->type-of-vl-match-when-vl-is-some-token?

    (defthm vl-token->type-of-vl-match-when-vl-is-some-token?
     (implies
       (vl-type-of-matched-token types (vl-tokstream->tokens))
       (equal (vl-token->type (mv-nth 1 (vl-match)))
              (vl-type-of-matched-token types (vl-tokstream->tokens)))))