• Top
    • Documentation
    • Books
    • Boolean-reasoning
    • Projects
      • Apt
      • Zfc
      • Acre
      • Milawa
      • Smtlink
      • Abnf
        • Deftreeops
        • Defdefparse
        • Defgrammar
        • Tree-utilities
        • Notation
          • Syntax-abstraction
          • Semantics
            • Tree-terminatedp
            • Tree->string
            • String-has-finite-parse-trees-p
            • Parse-trees-of-string-p
            • Tree-match-element-p
            • Parse-treep
            • Symbol
            • String-unambiguousp
            • Tree-match-num-val-p
            • Nat-match-insensitive-char-p
            • Nats-match-insensitive-chars-p
            • Tree-option
            • String-parsablep
            • Lookup-rulename
            • Nats-match-sensitive-chars-p
            • Numrep-match-repeat-range-p
            • Tree-match-char-val-p
            • Tree-list-match-repetition-p
            • String-ambiguousp
            • Parse
            • Tree-match-prose-val-p
            • Nat-match-sensitive-char-p
            • Theorems-about-terminated-trees-matching-elements
            • Tree-option-result
            • Tree-list-result
            • Tree-list-list-result
            • Tree-result
            • Tree-list-list-match-concatenation-p
            • Languagep
            • Terminal-string-for-rules-p
            • Tree-list-list-match-alternation-p
            • Tree-list-match-element-p
            • Parse!
            • String
              • String-fix
                • String-equiv
                • Stringp
                • Stringp-when-nat-listp
              • Tree-set
              • Trees
            • Abstract-syntax
            • Core-rules
            • Concrete-syntax
          • Grammar-parser
          • Meta-circular-validation
          • Parsing-primitives-defresult
          • Parsing-primitives-seq
          • Operations
          • Examples
          • Differences-with-paper
          • Constructor-utilities
          • Grammar-printer
          • Parsing-tools
        • 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
    • String

    String-fix

    (string-fix x) is a usual ACL2::fty list fixing function.

    Signature
    (string-fix x) → fty::newx
    Arguments
    x — Guard (stringp x).
    Returns
    fty::newx — Type (stringp fty::newx).

    In the logic, we apply symbol-fix to each member of the x. In the execution, none of that is actually necessary and this is just an inlined identity function.

    Definitions and Theorems

    Function: string-fix$inline

    (defun string-fix$inline (x)
      (declare (xargs :guard (stringp x)))
      (let ((__function__ 'string-fix))
        (declare (ignorable __function__))
        (mbe :logic
             (if (atom x)
                 nil
               (cons (symbol-fix (car x))
                     (string-fix (cdr x))))
             :exec x)))

    Theorem: stringp-of-string-fix

    (defthm stringp-of-string-fix
      (b* ((fty::newx (string-fix$inline x)))
        (stringp fty::newx))
      :rule-classes :rewrite)

    Theorem: string-fix-when-stringp

    (defthm string-fix-when-stringp
      (implies (stringp x)
               (equal (string-fix x) x)))

    Function: string-equiv$inline

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

    Theorem: string-equiv-is-an-equivalence

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

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

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

    Theorem: string-fix-under-string-equiv

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

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

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

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

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

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

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

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

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

    Theorem: car-of-string-fix-x-under-symbol-equiv

    (defthm car-of-string-fix-x-under-symbol-equiv
      (symbol-equiv (car (string-fix acl2::x))
                    (car acl2::x)))

    Theorem: car-string-equiv-congruence-on-x-under-symbol-equiv

    (defthm car-string-equiv-congruence-on-x-under-symbol-equiv
      (implies (string-equiv acl2::x x-equiv)
               (symbol-equiv (car acl2::x)
                             (car x-equiv)))
      :rule-classes :congruence)

    Theorem: cdr-of-string-fix-x-under-string-equiv

    (defthm cdr-of-string-fix-x-under-string-equiv
      (string-equiv (cdr (string-fix acl2::x))
                    (cdr acl2::x)))

    Theorem: cdr-string-equiv-congruence-on-x-under-string-equiv

    (defthm cdr-string-equiv-congruence-on-x-under-string-equiv
      (implies (string-equiv acl2::x x-equiv)
               (string-equiv (cdr acl2::x)
                             (cdr x-equiv)))
      :rule-classes :congruence)

    Theorem: cons-of-symbol-fix-x-under-string-equiv

    (defthm cons-of-symbol-fix-x-under-string-equiv
      (string-equiv (cons (symbol-fix acl2::x) acl2::y)
                    (cons acl2::x acl2::y)))

    Theorem: cons-symbol-equiv-congruence-on-x-under-string-equiv

    (defthm cons-symbol-equiv-congruence-on-x-under-string-equiv
      (implies (symbol-equiv acl2::x x-equiv)
               (string-equiv (cons acl2::x acl2::y)
                             (cons x-equiv acl2::y)))
      :rule-classes :congruence)

    Theorem: cons-of-string-fix-y-under-string-equiv

    (defthm cons-of-string-fix-y-under-string-equiv
      (string-equiv (cons acl2::x (string-fix acl2::y))
                    (cons acl2::x acl2::y)))

    Theorem: cons-string-equiv-congruence-on-y-under-string-equiv

    (defthm cons-string-equiv-congruence-on-y-under-string-equiv
      (implies (string-equiv acl2::y y-equiv)
               (string-equiv (cons acl2::x acl2::y)
                             (cons acl2::x y-equiv)))
      :rule-classes :congruence)

    Theorem: consp-of-string-fix

    (defthm consp-of-string-fix
      (equal (consp (string-fix acl2::x))
             (consp acl2::x)))

    Theorem: string-fix-under-iff

    (defthm string-fix-under-iff
      (iff (string-fix acl2::x)
           (consp acl2::x)))

    Theorem: string-fix-of-cons

    (defthm string-fix-of-cons
      (equal (string-fix (cons a x))
             (cons (symbol-fix a) (string-fix x))))

    Theorem: len-of-string-fix

    (defthm len-of-string-fix
      (equal (len (string-fix acl2::x))
             (len acl2::x)))

    Theorem: string-fix-of-append

    (defthm string-fix-of-append
      (equal (string-fix (append std::a std::b))
             (append (string-fix std::a)
                     (string-fix std::b))))

    Theorem: string-fix-of-repeat

    (defthm string-fix-of-repeat
      (equal (string-fix (repeat acl2::n acl2::x))
             (repeat acl2::n (symbol-fix acl2::x))))

    Theorem: list-equiv-refines-string-equiv

    (defthm list-equiv-refines-string-equiv
      (implies (list-equiv acl2::x acl2::y)
               (string-equiv acl2::x acl2::y))
      :rule-classes :refinement)

    Theorem: nth-of-string-fix

    (defthm nth-of-string-fix
      (equal (nth acl2::n (string-fix acl2::x))
             (if (< (nfix acl2::n) (len acl2::x))
                 (symbol-fix (nth acl2::n acl2::x))
               nil)))

    Theorem: string-equiv-implies-string-equiv-append-1

    (defthm string-equiv-implies-string-equiv-append-1
      (implies (string-equiv acl2::x fty::x-equiv)
               (string-equiv (append acl2::x acl2::y)
                             (append fty::x-equiv acl2::y)))
      :rule-classes (:congruence))

    Theorem: string-equiv-implies-string-equiv-append-2

    (defthm string-equiv-implies-string-equiv-append-2
      (implies (string-equiv acl2::y fty::y-equiv)
               (string-equiv (append acl2::x acl2::y)
                             (append acl2::x fty::y-equiv)))
      :rule-classes (:congruence))

    Theorem: string-equiv-implies-string-equiv-nthcdr-2

    (defthm string-equiv-implies-string-equiv-nthcdr-2
      (implies (string-equiv acl2::l l-equiv)
               (string-equiv (nthcdr acl2::n acl2::l)
                             (nthcdr acl2::n l-equiv)))
      :rule-classes (:congruence))

    Theorem: string-equiv-implies-string-equiv-take-2

    (defthm string-equiv-implies-string-equiv-take-2
      (implies (string-equiv acl2::l l-equiv)
               (string-equiv (take acl2::n acl2::l)
                             (take acl2::n l-equiv)))
      :rule-classes (:congruence))