• 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

    Preproc-legible-aux

    Signature
    (preproc-legible-aux x index acc) → new-x
    Arguments
    x — Guard (stringp x).
    index — Guard (natp index).
    acc — Guard (character-listp acc).
    Returns
    new-x — Type (stringp new-x).

    Definitions and Theorems

    Function: preproc-legible-aux

    (defun preproc-legible-aux (x index acc)
     (declare (xargs :guard (and (stringp x)
                                 (natp index)
                                 (character-listp acc))))
     (declare (xargs :guard (<= index (strlen x))))
     (let ((__function__ 'preproc-legible-aux))
       (declare (ignorable __function__))
       (b*
        (((when (mbe :logic (zp (- (strlen x) (nfix index)))
                     :exec (eql index (strlen x))))
          (mbe :logic (reverse (coerce (make-character-list acc)
                                       'string))
               :exec (reverse (coerce acc 'string))))
         (x (lstrfix x))
         (index (lnfix index))
         (char (char x index))
         ((when (member char
                        '(#\Newline #\Space #\Tab #\Return #\Page)))
          (preproc-legible-aux x (+ 1 index) acc))
         ((when (eql char #\#))
          (b* ((index (find-substr (coerce '(#\Newline) 'string)
                                   x index))
               ((unless index)
                (reverse (coerce acc 'string))))
            (preproc-legible-aux x (+ 1 index)
                                 acc)))
         ((unless (and (eql char #\\)
                       (< (+ 1 index) (strlen x))))
          (preproc-legible-aux x (+ 1 index)
                               (cons char acc)))
         (char2 (char x (+ 1 index)))
         ((when (member (char x (+ 1 index))
                        '(#\Newline #\Space #\Tab #\Return #\Page #\#)))
          (preproc-legible-aux x (+ 2 index)
                               (cons char2 acc))))
        (preproc-legible-aux x (+ 2 index)
                             (cons char2 (cons char acc))))))

    Theorem: stringp-of-preproc-legible-aux

    (defthm stringp-of-preproc-legible-aux
      (b* ((new-x (preproc-legible-aux x index acc)))
        (stringp new-x))
      :rule-classes :type-prescription)

    Theorem: preproc-legible-aux-of-str-fix-x

    (defthm preproc-legible-aux-of-str-fix-x
      (equal (preproc-legible-aux (acl2::str-fix x)
                                  index acc)
             (preproc-legible-aux x index acc)))

    Theorem: preproc-legible-aux-streqv-congruence-on-x

    (defthm preproc-legible-aux-streqv-congruence-on-x
      (implies (acl2::streqv x x-equiv)
               (equal (preproc-legible-aux x index acc)
                      (preproc-legible-aux x-equiv index acc)))
      :rule-classes :congruence)

    Theorem: preproc-legible-aux-of-nfix-index

    (defthm preproc-legible-aux-of-nfix-index
      (equal (preproc-legible-aux x (nfix index) acc)
             (preproc-legible-aux x index acc)))

    Theorem: preproc-legible-aux-nat-equiv-congruence-on-index

    (defthm preproc-legible-aux-nat-equiv-congruence-on-index
      (implies (acl2::nat-equiv index index-equiv)
               (equal (preproc-legible-aux x index acc)
                      (preproc-legible-aux x index-equiv acc)))
      :rule-classes :congruence)

    Theorem: preproc-legible-aux-of-make-character-list-acc

    (defthm preproc-legible-aux-of-make-character-list-acc
      (equal (preproc-legible-aux x index (make-character-list acc))
             (preproc-legible-aux x index acc)))

    Theorem: preproc-legible-aux-charlisteqv-congruence-on-acc

    (defthm preproc-legible-aux-charlisteqv-congruence-on-acc
      (implies (str::charlisteqv acc acc-equiv)
               (equal (preproc-legible-aux x index acc)
                      (preproc-legible-aux x index acc-equiv)))
      :rule-classes :congruence)