other
(in-package "STR")
other
(include-book "bin-digit-char-listp")
other
(include-book "binary")
other
(include-book "case-conversion")
other
(include-book "cat")
other
(include-book "charset")
other
(include-book "charset-fns")
other
(include-book "dec-digit-char-listp")
other
(include-book "decimal")
other
(include-book "digit-to-char")
other
(include-book "eqv")
other
(include-book "firstn-chars")
other
(include-book "hexify")
other
(include-book "hex")
other
(include-book "hex-digit-char-listp")
other
(include-book "html-encode")
other
(include-book "url-encode")
other
(include-book "ieqv")
other
(include-book "iprefixp")
other
(include-book "iless")
other
(include-book "isort")
other
(include-book "istrpos")
other
(include-book "istrprefixp")
other
(include-book "isubstrp")
other
(include-book "strline")
other
(include-book "oct-digit-char-listp")
other
(include-book "octal")
other
(include-book "pad")
other
(include-book "prefix-lines")
other
(include-book "strpos")
other
(include-book "strrpos")
other
(include-book "strprefixp")
other
(include-book "strnatless")
other
(include-book "strsplit")
other
(include-book "strsubst")
other
(include-book "strtok")
other
(include-book "strtok-bang")
other
(include-book "substrp")
other
(include-book "subseq")
other
(include-book "suffixp")
other
(include-book "symbols")
other
(include-book "strrange-equiv")
other
(defxdoc std/strings :parents (std strings) :short "A library with many useful functions for working with strings, and for reasoning about ACL2's built-in string operations and these new operations." :long "<p>The @('std/strings') library is a rudimentary string library for ACL2. The functions here are all in logic mode, with verified guards. In many cases, some effort has been spent to make them both efficient and relatively straightforward to reason about.</p> <h3>Loading the library</h3> <p><b>Note:</b> All of the library's functions are found in the @('STR') package.</p> <p>Ordinarily, to use the library one should run</p> @({ (include-book "std/strings/top" :dir :system) }) <p>To keep the top book more lightweight, certain functionality is excluded by default. Here are additional books you may want to include:</p> <ul> <li>@('std/strings/base64') — support for @(see base64) encoding/decoding</li> <li>@('std/strings/pretty') — support for @(see pretty-printing) ACL2 expressions</li> </ul> <h5>Advanced Options</h5> <p>If you are willing to accept a trust tag, you may also include the @('fast-cat') book for faster string-concatenation; see @(see cat) for details.</p> <p>If you only need some subset of the available functions, it's generally reasonable to just include individual books instead of the @('top') book. However, book names and dependencies do sometimes change, so in general we recommend just loading the @('top') book.</p> <p>If you want to be able to use the string operations but don't have any need to reason about them, e.g., because you are writing code for macros, then you might instead want to load either:</p> <ul> <li>@('std/strings/defs') — logic mode definitions, minimal theorems</li> <li>@('std/strings/defs-program') — program mode definitions, no theorems</li> </ul> <p>These books may load slightly faster than the @('top') book and may help to minimize the effects of loading the library on your theory.</p>")
other
(defsection equivalences :parents (std/strings) :short "Basic equivalence relations." :long "<p>The string library provides the various @(see acl2::equivalence) relations about characters, character lists, and strings. We end up with the following @(see acl2::refinement) hierarchy:</p> @({ equal ______________|________________ | | | chareqv list-equiv streqv | | | ichareqv charlisteqv istreqv | icharlisteqv })")
other
(defsection concatenation :parents (std/strings) :short "Functions for joining strings together." :long "<p><b><color rgb='#ff0000'>Efficiency Warning</color></b>. Concatenating strings in ACL2 is fundamentally slow. Why? In Common Lisp, strings are just arrays of characters, and there is not any mechanism for efficiently splicing together arrays. Any kind of string concatenation, then, minimally requires creating a completely new array and copying all of the input characters into it. This makes it especially slow to repeatedly use, e.g., @(see cat) to build up a string.</p> <p>To build strings more efficiently, a good general strategy is to build up a reverse-order character list, and then convert it into a string at the end. See for instance the functions @(see revappend-chars) and @(see rchars-to-string), which make this rather easy to do.</p>")
other
(defsection coercion :parents (std/strings) :short "Functions for converting between strings, symbols, character lists, and so on.")
other
(defsection ordering :parents (std/strings) :short "Functions for comparing and ordering strings in various ways.")
other
(defsection substrings :parents (std/strings) :short "Functions for detecting substrings, prefixes, and suffixes.")
other
(defsection numbers :parents (std/strings) :short "Functions for working with numbers in strings." :long "<p>See also @(see ordering) for some functions that can sort strings in alphanumeric ways.</p>")
other
(defsection cases :parents (std/strings) :short "Functions for recognizing and translating between upper- and lower-case.")
other
(defsection symbols :parents (std/strings) :short "Functions for working with symbols.")
other
(defsection substitution :parents (std/strings) :short "Functions for doing string replacement.")
other
(defsection lines :parents (std/strings) :short "Functions for operating on the lines of a string." :long "<p>Note that these functions generally work with Unix-style newline characters, i.e., @('\n') instead of something like @('\r\n'). Depending on your application, this may or may not be appropriate.</p> <p>One option for treating a string as lines is to just use, e.g., @(see strtok) to literally split it into a list of lines. The functions here are generally meant to be more efficient, e.g., @(see prefix-lines) can add a prefix to every line without constructing an temporary string list or doing any intermediate string concatenation.</p>")