• Top
    • Documentation
    • Books
    • Boolean-reasoning
    • Projects
      • Apt
      • Zfc
      • Acre
        • Acre-internals
          • Regex
          • Match-string-at
          • Matchstatelist-measure
          • Parse-primitive
          • Matches-remove-zero-length
          • Parse-repeatop
          • Parse-repeatbase
          • Matchstatelist-in-bounds
          • Parse-range
          • Parse-charset-set
          • Parse-charset-atom
          • Match-regex-locs
          • Parse-octal-charcode
          • Parse-k-backref
          • Parse-g-backref
          • Matchstatelist-all-have-backref
          • Parse-repeatmod
          • Parse-charset-elem
          • Parse-charset-aux
          • Parse-hex-charcode
          • Parse-charset
          • Matchstatelist-indices-lte
          • Matchstatelist-indices-gte
          • Match-exact
            • Matches-add-backref
            • Matchresult
            • Preproc-legible-aux
            • Maybe-backref
            • Match-charset
            • Undup-equiv
            • Find-substr
            • Maybe-backref-extract-substr
            • Matchstatelist-min-index
            • Matchstate-in-bounds
            • Match-add-backref
            • Undup
            • Backref-alist-in-bounds
            • Backref
            • Matchstate
            • Matchresult->matched-substr
            • Matchresult->captured-substr!
            • Matchresult->captured-substr
            • Maybe-backref-in-bounds
            • Matchmode
            • Backref-extract-substr
            • Charset-range
            • Matchstate-measure
            • Backref-in-bounds
            • Rev-keys
            • Parse-regex
            • Undup-exec
            • Get-charset
            • Regex-concat2
            • Preproc-legible
            • Matchresult-in-bounds
            • Regex-disjunct2
            • Backref-alist
            • Named-captures-bindings
            • Captures-bindings
            • Matchstatelist
            • Charset-char-regex
            • Repeatmod-p
          • Parse-and-match-regex
          • Match-regex
          • Parse
          • Matchresult->matchedp
          • Match
        • Milawa
        • Smtlink
        • Abnf
        • Vwsim
        • Isar
        • Wp-gen
        • Dimacs-reader
        • Pfcs
        • Legacy-defrstobj
        • Proof-checker-array
        • Soft
        • C
        • Farray
        • Rp-rewriter
        • Instant-runoff-voting
        • Imp-language
        • Sidekick
        • Leftist-trees
        • Java
        • Taspi
        • Bitcoin
        • Riscv
        • Des
        • Ethereum
        • X86isa
        • Sha-2
        • Yul
        • Zcash
        • Proof-checker-itp13
        • Regex
        • ACL2-programming-language
        • Json
        • Jfkr
        • Equational
        • Cryptography
        • Poseidon
        • Where-do-i-place-my-book
        • Axe
        • Bigmems
        • Builtins
        • Execloader
        • Aleo
        • Solidity
        • Paco
        • Concurrent-programs
        • Bls12-377-curves
      • Debugging
      • Std
      • Proof-automation
      • Macro-libraries
      • ACL2
      • Interfacing-tools
      • Hardware-verification
      • Software-verification
      • Math
      • Testing-utilities
    • Acre-internals

    Match-exact

    Signature
    (match-exact pat x index mode) → new-index
    Arguments
    pat — Guard (stringp pat).
    x — Guard (stringp x).
    index — Guard (natp index).
    mode — Guard (matchmode-p mode).
    Returns
    new-index — Type (maybe-natp new-index).

    Definitions and Theorems

    Function: match-exact

    (defun match-exact (pat x index mode)
      (declare (xargs :guard (and (stringp pat)
                                  (stringp x)
                                  (natp index)
                                  (matchmode-p mode))))
      (let ((__function__ 'match-exact))
        (declare (ignorable __function__))
        (b* ((index (lnfix index))
             (pat (lstrfix pat))
             (x (lstrfix x))
             ((matchmode mode))
             (patlen (strlen pat))
             (new-index (+ index patlen)))
          (and (<= new-index (strlen x))
               (if mode.case-insens
                   (str::istreqv pat (subseq x index new-index))
                 (equal pat (subseq x index new-index)))
               new-index))))

    Theorem: maybe-natp-of-match-exact

    (defthm maybe-natp-of-match-exact
      (b* ((new-index (match-exact pat x index mode)))
        (maybe-natp new-index))
      :rule-classes :type-prescription)

    Theorem: bound-of-match-exact

    (defthm bound-of-match-exact
      (b* ((?new-index (match-exact pat x index mode)))
        (implies new-index (<= (nfix index) new-index)))
      :rule-classes :linear)

    Theorem: upper-bound-of-match-exact

    (defthm upper-bound-of-match-exact
      (b* ((?new-index (match-exact pat x index mode)))
        (implies new-index
                 (<= new-index (len (acl2::explode x)))))
      :rule-classes :linear)

    Theorem: match-exact-of-str-fix-pat

    (defthm match-exact-of-str-fix-pat
      (equal (match-exact (acl2::str-fix pat)
                          x index mode)
             (match-exact pat x index mode)))

    Theorem: match-exact-streqv-congruence-on-pat

    (defthm match-exact-streqv-congruence-on-pat
      (implies (acl2::streqv pat pat-equiv)
               (equal (match-exact pat x index mode)
                      (match-exact pat-equiv x index mode)))
      :rule-classes :congruence)

    Theorem: match-exact-of-str-fix-x

    (defthm match-exact-of-str-fix-x
      (equal (match-exact pat (acl2::str-fix x)
                          index mode)
             (match-exact pat x index mode)))

    Theorem: match-exact-streqv-congruence-on-x

    (defthm match-exact-streqv-congruence-on-x
      (implies (acl2::streqv x x-equiv)
               (equal (match-exact pat x index mode)
                      (match-exact pat x-equiv index mode)))
      :rule-classes :congruence)

    Theorem: match-exact-of-nfix-index

    (defthm match-exact-of-nfix-index
      (equal (match-exact pat x (nfix index) mode)
             (match-exact pat x index mode)))

    Theorem: match-exact-nat-equiv-congruence-on-index

    (defthm match-exact-nat-equiv-congruence-on-index
      (implies (acl2::nat-equiv index index-equiv)
               (equal (match-exact pat x index mode)
                      (match-exact pat x index-equiv mode)))
      :rule-classes :congruence)

    Theorem: match-exact-of-matchmode-fix-mode

    (defthm match-exact-of-matchmode-fix-mode
      (equal (match-exact pat x index (matchmode-fix mode))
             (match-exact pat x index mode)))

    Theorem: match-exact-matchmode-equiv-congruence-on-mode

    (defthm match-exact-matchmode-equiv-congruence-on-mode
      (implies (matchmode-equiv mode mode-equiv)
               (equal (match-exact pat x index mode)
                      (match-exact pat x index mode-equiv)))
      :rule-classes :congruence)