• 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
            • Matchstate-fix
              • Matchstate-equiv
              • Make-matchstate
              • Matchstate->backrefs
              • Change-matchstate
              • Matchstate->index
              • Matchstate-p
            • 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
    • Matchstate

    Matchstate-fix

    Fixing function for matchstate structures.

    Signature
    (matchstate-fix x) → new-x
    Arguments
    x — Guard (matchstate-p x).
    Returns
    new-x — Type (matchstate-p new-x).

    Definitions and Theorems

    Function: matchstate-fix$inline

    (defun matchstate-fix$inline (x)
      (declare (xargs :guard (matchstate-p x)))
      (let ((__function__ 'matchstate-fix))
        (declare (ignorable __function__))
        (mbe :logic
             (b* ((index (nfix (std::prod-car x)))
                  (backrefs (backref-alist-fix (std::prod-cdr x))))
               (std::prod-hons index backrefs))
             :exec x)))

    Theorem: matchstate-p-of-matchstate-fix

    (defthm matchstate-p-of-matchstate-fix
      (b* ((new-x (matchstate-fix$inline x)))
        (matchstate-p new-x))
      :rule-classes :rewrite)

    Theorem: matchstate-fix-when-matchstate-p

    (defthm matchstate-fix-when-matchstate-p
      (implies (matchstate-p x)
               (equal (matchstate-fix x) x)))

    Function: matchstate-equiv$inline

    (defun matchstate-equiv$inline (acl2::x acl2::y)
      (declare (xargs :guard (and (matchstate-p acl2::x)
                                  (matchstate-p acl2::y))))
      (equal (matchstate-fix acl2::x)
             (matchstate-fix acl2::y)))

    Theorem: matchstate-equiv-is-an-equivalence

    (defthm matchstate-equiv-is-an-equivalence
      (and (booleanp (matchstate-equiv x y))
           (matchstate-equiv x x)
           (implies (matchstate-equiv x y)
                    (matchstate-equiv y x))
           (implies (and (matchstate-equiv x y)
                         (matchstate-equiv y z))
                    (matchstate-equiv x z)))
      :rule-classes (:equivalence))

    Theorem: matchstate-equiv-implies-equal-matchstate-fix-1

    (defthm matchstate-equiv-implies-equal-matchstate-fix-1
      (implies (matchstate-equiv acl2::x x-equiv)
               (equal (matchstate-fix acl2::x)
                      (matchstate-fix x-equiv)))
      :rule-classes (:congruence))

    Theorem: matchstate-fix-under-matchstate-equiv

    (defthm matchstate-fix-under-matchstate-equiv
      (matchstate-equiv (matchstate-fix acl2::x)
                        acl2::x)
      :rule-classes (:rewrite :rewrite-quoted-constant))

    Theorem: equal-of-matchstate-fix-1-forward-to-matchstate-equiv

    (defthm equal-of-matchstate-fix-1-forward-to-matchstate-equiv
      (implies (equal (matchstate-fix acl2::x) acl2::y)
               (matchstate-equiv acl2::x acl2::y))
      :rule-classes :forward-chaining)

    Theorem: equal-of-matchstate-fix-2-forward-to-matchstate-equiv

    (defthm equal-of-matchstate-fix-2-forward-to-matchstate-equiv
      (implies (equal acl2::x (matchstate-fix acl2::y))
               (matchstate-equiv acl2::x acl2::y))
      :rule-classes :forward-chaining)

    Theorem: matchstate-equiv-of-matchstate-fix-1-forward

    (defthm matchstate-equiv-of-matchstate-fix-1-forward
      (implies (matchstate-equiv (matchstate-fix acl2::x)
                                 acl2::y)
               (matchstate-equiv acl2::x acl2::y))
      :rule-classes :forward-chaining)

    Theorem: matchstate-equiv-of-matchstate-fix-2-forward

    (defthm matchstate-equiv-of-matchstate-fix-2-forward
      (implies (matchstate-equiv acl2::x (matchstate-fix acl2::y))
               (matchstate-equiv acl2::x acl2::y))
      :rule-classes :forward-chaining)