• Top
    • Documentation
    • Books
    • Recursion-and-induction
    • Boolean-reasoning
    • Debugging
    • Projects
      • Apt
      • Acre
        • Acre-internals
          • Regex
          • Match-string-at
          • Matchstatelist-measure
          • Parse-primitive
          • Parse-repeatop
          • Parse-repeatbase
          • Matches-remove-zero-length
          • Parse-range
          • Matchstatelist-in-bounds
          • Parse-charset-set
          • Match-regex-locs
          • Parse-octal-charcode
          • Parse-k-backref
          • Parse-charset-elem
          • Parse-charset-atom
          • Parse-g-backref
          • Parse-charset-aux
          • Matchstatelist-all-have-backref
          • Parse-repeatmod
          • Parse-hex-charcode
          • Parse-charset
          • Match-exact
          • Matchstatelist-indices-lte
          • Matchstatelist-indices-gte
          • Matches-add-backref
          • Preproc-legible-aux
          • Matchresult
          • Match-charset
          • Undup-equiv
          • Maybe-backref
          • 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
            • Backref-extract-substr
            • Maybe-backref-in-bounds
            • Matchmode
            • Charset-range
            • Matchstate-measure
            • Backref-in-bounds
            • Parse-regex
            • Rev-keys
            • 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
        • Isar
        • Wp-gen
        • Dimacs-reader
        • Legacy-defrstobj
        • Prime-field-constraint-systems
        • Proof-checker-array
        • Soft
        • Rp-rewriter
        • Farray
        • Instant-runoff-voting
        • Imp-language
        • Sidekick
        • Leftist-trees
        • Taspi
        • Bitcoin
        • Des
        • Ethereum
        • Sha-2
        • Yul
        • Zcash
        • Proof-checker-itp13
        • Bigmem
        • Regex
        • ACL2-programming-language
        • Java
        • C
        • Jfkr
        • X86isa
        • Equational
        • Cryptography
        • Where-do-i-place-my-book
        • Json
        • Built-ins
        • Execloader
        • Solidity
        • Paco
        • Concurrent-programs
      • Std
      • Proof-automation
      • Macro-libraries
      • ACL2
      • Interfacing-tools
      • Hardware-verification
      • Software-verification
      • Testing-utilities
      • Math
    • Acre-internals

    Matchresult->matched-substr

    When the regular expression matched the string, returns the substring that it matched

    Signature
    (matchresult->matched-substr x) → substr
    Arguments
    x — Guard (matchresult-p x).
    Returns
    substr — Type (acl2::maybe-stringp substr).

    Definitions and Theorems

    Function: matchresult->matched-substr

    (defun matchresult->matched-substr (x)
           (declare (xargs :guard (matchresult-p x)))
           (declare (xargs :guard (matchresult-in-bounds x)))
           (let ((__function__ 'matchresult->matched-substr))
                (declare (ignorable __function__))
                (b* (((matchresult x)) ((unless x.loc) nil))
                    (subseq x.str x.loc (+ x.loc x.len)))))

    Theorem: maybe-stringp-of-matchresult->matched-substr

    (defthm maybe-stringp-of-matchresult->matched-substr
            (b* ((substr (matchresult->matched-substr x)))
                (acl2::maybe-stringp substr))
            :rule-classes :type-prescription)

    Theorem: matchresult->matched-substr-under-iff

    (defthm matchresult->matched-substr-under-iff
            (b* ((?substr (matchresult->matched-substr x)))
                (iff substr (matchresult->matchedp x))))

    Theorem: matchresult->matched-substr-of-matchresult-fix-x

    (defthm matchresult->matched-substr-of-matchresult-fix-x
            (equal (matchresult->matched-substr (matchresult-fix x))
                   (matchresult->matched-substr x)))

    Theorem: matchresult->matched-substr-matchresult-equiv-congruence-on-x

    (defthm
         matchresult->matched-substr-matchresult-equiv-congruence-on-x
         (implies (matchresult-equiv x x-equiv)
                  (equal (matchresult->matched-substr x)
                         (matchresult->matched-substr x-equiv)))
         :rule-classes :congruence)