• 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->captured-substr!

    Returns the substring matched by the capture group with the given name or index, or the empty string if the capture group was not matched

    Signature
    (matchresult->captured-substr! index x) → substr
    Arguments
    x — Guard (matchresult-p x).
    Returns
    substr — Type (stringp substr).

    Definitions and Theorems

    Function: matchresult->captured-substr!

    (defun matchresult->captured-substr! (index x)
           (declare (xargs :guard (matchresult-p x)))
           (declare (xargs :guard (matchresult-in-bounds x)))
           (let ((__function__ 'matchresult->captured-substr!))
                (declare (ignorable __function__))
                (b* (((matchresult x)))
                    (or (maybe-backref-extract-substr
                             (cdr (assoc-equal index x.backrefs))
                             x.str)
                        ""))))

    Theorem: stringp-of-matchresult->captured-substr!

    (defthm stringp-of-matchresult->captured-substr!
            (b* ((substr (matchresult->captured-substr! index x)))
                (stringp substr))
            :rule-classes :type-prescription)

    Theorem: matchresult->captured-substr!-of-matchresult-fix-x

    (defthm
        matchresult->captured-substr!-of-matchresult-fix-x
        (equal (matchresult->captured-substr! index (matchresult-fix x))
               (matchresult->captured-substr! index x)))

    Theorem: matchresult->captured-substr!-matchresult-equiv-congruence-on-x

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