• 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

    Parse-regex

    Signature
    (parse-regex x) → (mv err pat)
    Arguments
    x — Guard (stringp x).
    Returns
    err — Type (acl2::maybe-stringp err).
    pat — Type (implies (not err) (regex-p pat)).

    Definitions and Theorems

    Function: parse-regex

    (defun parse-regex (x)
     (declare (xargs :guard (stringp x)))
     (let ((__function__ 'parse-regex))
      (declare (ignorable __function__))
      (b*
       (((mv err regex index ?br-index)
         (parse-regex-rec x 0 1))
        ((when err) (mv err nil))
        ((when (< index (strlen x)))
         (mv
          (str::cat
            "Regex parsing didn't consume the whole string: Remaining: "
            (subseq x index nil))
          nil)))
       (mv nil regex))))

    Theorem: maybe-stringp-of-parse-regex.err

    (defthm maybe-stringp-of-parse-regex.err
      (b* (((mv ?err ?pat) (parse-regex x)))
        (acl2::maybe-stringp err))
      :rule-classes :rewrite)

    Theorem: return-type-of-parse-regex.pat

    (defthm return-type-of-parse-regex.pat
      (b* (((mv ?err ?pat) (parse-regex x)))
        (implies (not err) (regex-p pat)))
      :rule-classes :rewrite)

    Theorem: parse-regex-of-str-fix-x

    (defthm parse-regex-of-str-fix-x
      (equal (parse-regex (acl2::str-fix x))
             (parse-regex x)))

    Theorem: parse-regex-streqv-congruence-on-x

    (defthm parse-regex-streqv-congruence-on-x
      (implies (acl2::streqv x x-equiv)
               (equal (parse-regex x)
                      (parse-regex x-equiv)))
      :rule-classes :congruence)