• Top
    • Documentation
    • Books
    • Boolean-reasoning
    • Projects
    • Debugging
    • Std
    • Proof-automation
    • Macro-libraries
    • ACL2
      • Theories
      • Rule-classes
      • Proof-builder
      • Recursion-and-induction
      • Hons-and-memoization
      • Events
      • Parallelism
      • History
      • Programming
        • Defun
        • Declare
        • System-utilities
        • Stobj
        • State
        • Mutual-recursion
        • Memoize
        • Mbe
        • Io
        • Defpkg
        • Apply$
        • Loop$
        • Programming-with-state
        • Arrays
        • Characters
        • Time$
        • Defmacro
        • Loop$-primer
        • Fast-alists
        • Defconst
        • Evaluation
        • Guard
        • Equality-variants
        • Compilation
        • Hons
        • ACL2-built-ins
        • Developers-guide
        • System-attachments
        • Advanced-features
        • Set-check-invariant-risk
        • Numbers
        • Efficiency
        • Irrelevant-formals
        • Introduction-to-programming-in-ACL2-for-those-who-know-lisp
        • Redefining-programs
        • Lists
        • Invariant-risk
        • Errors
        • Defabbrev
        • Conses
        • Alists
        • Set-register-invariant-risk
        • Strings
          • Std/strings
            • Pretty-printing
            • Printtree
            • Base64
            • Charset-p
            • Strtok!
            • Cases
            • Concatenation
            • Html-encoding
            • Character-kinds
            • Substrings
            • Strtok
            • Equivalences
            • Url-encoding
            • Lines
            • Explode-implode-equalities
            • Ordering
              • Charlistnat<
              • Ichar<
              • Istr<
              • Icharlist<
              • Strnat<
                • Strnat<-aux
              • Istrsort
            • Numbers
            • Pad-trim
            • Coercion
            • Std/strings/digit-to-char
            • Substitution
            • Symbols
          • String-listp
          • Stringp
          • Length
          • Search
          • Remove-duplicates
          • Position
          • Coerce
          • Concatenate
          • Reverse
          • String
          • Subseq
          • Substitute
          • String-upcase
          • String-downcase
          • Count
          • Char
          • String<
          • String-equal
          • String-utilities
          • String-append
          • String>=
          • String<=
          • String>
          • Hex-digit-char-theorems
          • String-downcase-gen
          • String-upcase-gen
        • Program-wrapper
        • Get-internal-time
        • Basics
        • Packages
        • Oracle-eval
        • Defmacro-untouchable
        • <<
        • Primitive
        • Revert-world
        • Unmemoize
        • Set-duplicate-keys-action
        • Symbols
        • Def-list-constructor
        • Easy-simplify-term
        • Defiteration
        • Fake-oracle-eval
        • Defopen
        • Sleep
      • Operational-semantics
      • Real
      • Start-here
      • Debugging
      • Miscellaneous
      • Output-controls
      • Macros
      • Interfacing-tools
    • Interfacing-tools
    • Hardware-verification
    • Software-verification
    • Math
    • Testing-utilities
  • Ordering

Strnat<

Mixed alphanumeric string less-than test.

Signature
(strnat< x y) → *

(strnat< x y) determines if the string x is "smaller" than the string y, using an ordering that is nice for humans.

See charlistnat< for a description of this order.

We avoid coercing the strings into character lists, and this is altogether pretty fast.

Definitions and Theorems

Function: strnat<$inline

(defun strnat<$inline (x y)
 (declare (type string x)
          (type string y))
 (let ((acl2::__function__ 'strnat<))
   (declare (ignorable acl2::__function__))
   (mbe :logic (charlistnat< (explode x) (explode y))
        :exec (strnat<-aux (the string x)
                           (the string y)
                           (the integer 0)
                           (the integer 0)
                           (the integer (length (the string x)))
                           (the integer (length (the string y)))))))

Theorem: streqv-implies-equal-strnat<-1

(defthm streqv-implies-equal-strnat<-1
  (implies (streqv x x-equiv)
           (equal (strnat< x y)
                  (strnat< x-equiv y)))
  :rule-classes (:congruence))

Theorem: streqv-implies-equal-strnat<-2

(defthm streqv-implies-equal-strnat<-2
  (implies (streqv y y-equiv)
           (equal (strnat< x y)
                  (strnat< x y-equiv)))
  :rule-classes (:congruence))

Theorem: strnat<-irreflexive

(defthm strnat<-irreflexive
  (not (strnat< x x)))

Theorem: strnat<-antisymmetric

(defthm strnat<-antisymmetric
  (implies (strnat< x y)
           (not (strnat< y x))))

Theorem: strnat<-transitive

(defthm strnat<-transitive
  (implies (and (strnat< x y) (strnat< y z))
           (strnat< x z)))

Theorem: strnat<-transitive-alt

(defthm strnat<-transitive-alt
  (implies (and (strnat< y z) (strnat< x y))
           (strnat< x z)))

Subtopics

Strnat<-aux
Implementation of strnat<.