• Top
    • Documentation
    • Books
    • Recursion-and-induction
    • Boolean-reasoning
    • Projects
    • Debugging
    • Std
      • Std/lists
      • Std/alists
      • Obags
      • Std/util
      • Std/strings
        • Pretty-printing
        • Printtree
        • Base64
        • Charset-p
        • Strtok!
        • Cases
        • Concatenation
        • Html-encoding
        • Character-kinds
        • Substrings
        • Strtok
        • Equivalences
        • Url-encoding
        • Lines
        • Ordering
          • Charlistnat<
          • Istr<
          • Ichar<
          • Icharlist<
          • Strnat<
            • Strnat<-aux
          • Istrsort
        • Numbers
        • Pad-trim
        • Coercion
        • Std/strings-extensions
        • Std/strings/digit-to-char
        • Substitution
        • Symbols
      • Std/io
      • Std/osets
      • Std/system
      • Std/basic
      • Std/typed-lists
      • Std/bitsets
      • Std/testing
      • Std/typed-alists
      • Std/stobjs
      • Std-extensions
    • Proof-automation
    • Macro-libraries
    • ACL2
    • Interfacing-tools
    • Hardware-verification
    • Software-verification
    • Testing-utilities
    • Math
  • 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<.