• Top
    • Documentation
    • Books
    • Boolean-reasoning
    • Projects
    • Debugging
    • Std
    • Community
    • Proof-automation
    • Macro-libraries
    • ACL2
    • Interfacing-tools
    • Hardware-verification
      • Gl
      • Esim
      • Vl2014
      • Sv
      • Fgl
      • Vwsim
      • Vl
        • Syntax
        • Loader
          • Preprocessor
          • Vl-loadconfig
          • Vl-loadstate
          • Lexer
            • Lex-strings
            • Lex-identifiers
            • Vl-typo-uppercase-p
            • Vl-typo-number-p
            • Vl-typo-lowercase-p
            • Lex-numbers
            • Chartypes
            • Vl-lex
            • Defchar
            • Tokens
            • Lex-keywords
            • Lexstate
            • Make-test-tokens
            • Lexer-utils
              • Def-prefix/remainder-thms
              • Def-token/remainder-thms
              • Vl-read-until-literal
              • Vl-read-through-literal
              • Vl-matches-string-p
                • Vl-matches-string-p-impl
              • Vl-read-literal
              • Vl-echarlist-kill-underscores
              • Vl-read-some-literal
            • Lex-comments
            • Vl-typo-uppercase-list-p
            • Vl-typo-lowercase-list-p
            • Vl-typo-number-list-p
          • Parser
          • Vl-load-merge-descriptions
          • Vl-find-basename/extension
          • Vl-load-file
          • Vl-loadresult
          • Scope-of-defines
          • Vl-find-file
          • Vl-flush-out-descriptions
          • Vl-description
          • Vl-read-file
          • Vl-includeskips-report-gather
          • Vl-load-main
          • Extended-characters
          • Vl-load
          • Vl-load-description
          • Vl-descriptions-left-to-load
          • Inject-warnings
          • Vl-preprocess-debug
          • Vl-write-preprocessor-debug-file
          • Vl-read-file-report-gather
          • Vl-load-descriptions
          • Vl-load-files
          • Translate-off
          • Vl-load-read-file-hook
          • Vl-read-file-report
          • Vl-loadstate-pad
          • Vl-load-summary
          • Vl-collect-modules-from-descriptions
          • Vl-loadstate->warnings
          • Vl-iskips-report
          • Vl-descriptionlist
        • Warnings
        • Getting-started
        • Utilities
        • Printer
        • Kit
        • Mlib
        • Transforms
      • X86isa
      • Svl
      • Rtl
    • Software-verification
    • Math
    • Testing-utilities
  • Lexer-utils

Vl-matches-string-p

See if a string occurs at the front of an vl-echarlist-p.

Signature
(vl-matches-string-p string echars) → bool
Arguments
string — String we're looking for.
echars — Characters we're lexing.
    Guard (vl-echarlist-p echars).

This function determines if some string occurs at the front of echars. More exactly, it computes:

(prefixp (explode string)
         (vl-echarlist->chars echars))

But we actually implement the operation with a fast function that does not call explode or build the list of characters.

Definitions and Theorems

Function: vl-matches-string-p$inline

(defun vl-matches-string-p$inline (string echars)
  (declare (type string string))
  (declare (xargs :guard (vl-echarlist-p echars)))
  (declare (xargs :guard (not (equal string ""))))
  (let ((__function__ 'vl-matches-string-p))
    (declare (ignorable __function__))
    (mbe :logic (prefixp (explode string)
                         (vl-echarlist->chars echars))
         :exec (vl-matches-string-p-impl string 0 (length string)
                                         echars))))

Theorem: len-when-vl-matches-string-p-fc

(defthm len-when-vl-matches-string-p-fc
  (implies (vl-matches-string-p string echars)
           (<= (len (explode string))
               (len echars)))
  :rule-classes ((:forward-chaining) (:linear)))

Theorem: consp-when-vl-matches-string-p-fc

(defthm consp-when-vl-matches-string-p-fc
  (implies (and (vl-matches-string-p string echars)
                (stringp string)
                (not (equal string "")))
           (consp echars))
  :rule-classes :forward-chaining)

Theorem: vl-matches-string-p-when-acl2-count-zero

(defthm vl-matches-string-p-when-acl2-count-zero
  (implies (and (equal 0 (acl2-count echars))
                (force (stringp string)))
           (equal (vl-matches-string-p string echars)
                  (equal string ""))))

Subtopics

Vl-matches-string-p-impl