• Top
    • Documentation
    • Books
    • Boolean-reasoning
    • Projects
    • Debugging
    • Std
    • Proof-automation
    • Macro-libraries
    • ACL2
    • Interfacing-tools
      • Io
      • Defttag
      • Sys-call
      • Save-exec
      • Quicklisp
      • Std/io
      • Oslib
      • Bridge
      • Clex
        • Example-lexer
        • Sin
          • Strin-p
          • Sin$c
            • Line-and-column-tracking
            • Sin$c-okp
            • Sin$c-init
            • Sin$c-nthcdr
            • Sin$c-cdr
            • Sin$c-firstn
            • Sin$c-count-charset
            • Sin$c-nth
            • Sin$c-matches-p
            • Sin$c-imatches-p
            • Sin$c-find
              • Sin$c-len
              • Sin$c-endp
              • Sin$c-car
              • Sin$corr
              • Sin$c-get-line
              • Sin$c-get-file
              • Sin$c-get-col
          • Matching-functions
          • Def-sin-progress
        • Tshell
        • Unsound-eval
        • Hacker
        • ACL2s-interface
        • Startup-banner
        • Command-line
      • Hardware-verification
      • Software-verification
      • Math
      • Testing-utilities
    • Sin$c

    Sin$c-find

    Concrete implementation of strin-find.

    Signature
    (sin$c-find lit sin$c) → *
    Arguments
    lit — Guard (stringp lit).
    sin$c — Guard (sin$c-okp sin$c).

    Definitions and Theorems

    Function: sin$c-find

    (defun sin$c-find (lit sin$c)
      (declare (xargs :stobjs (sin$c)))
      (declare (xargs :guard (and (stringp lit) (sin$c-okp sin$c))))
      (let ((__function__ 'sin$c-find))
        (declare (ignorable __function__))
        (b* (((the string str) (sin$c-str sin$c))
             ((the (unsigned-byte 60) pos)
              (sin$c-pos sin$c))
             ((the (unsigned-byte 60) len)
              (length str))
             ((the (integer 0 *) litlen)
              (length lit))
             (idx (str::strpos-fast lit str pos litlen len)))
          (and idx
               (the (unsigned-byte 60) (- idx pos))))))

    Theorem: sin-find{correspondence}

    (defthm sin-find{correspondence}
      (implies (and (sin$corr sin$c sin)
                    (stringp lit)
                    (strin-p sin))
               (equal (sin$c-find lit sin$c)
                      (strin-find lit sin))))