• Top
    • Documentation
    • Books
    • Boolean-reasoning
    • Projects
    • Debugging
    • Community
    • 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$
        • Defconst
        • Fast-alists
        • Defmacro
        • Loop$-primer
        • 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
            • Character-kinds
            • Html-encoding
            • Substrings
            • Strtok
            • Equivalences
            • Url-encoding
            • Lines
            • Explode-implode-equalities
            • Ordering
              • Charlistnat<
              • Ichar<
              • Istr<
              • Icharlist<
                • Strnat<
                • 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
        • Miscellaneous
        • Output-controls
        • Bdd
        • Macros
        • Installation
        • Mailing-lists
      • Interfacing-tools
      • Hardware-verification
      • Software-verification
      • Math
      • Testing-utilities
    • Ordering

    Icharlist<

    Case-insensitive character-list less-than test.

    (icharlist< x y) determines whether the character list x preceeds y in alphabetical order without regards to case. The characters are compared with ichar< and shorter strings are considered smaller than longer strings.

    Definitions and Theorems

    Function: icharlist<

    (defun icharlist< (x y)
     (declare (xargs :guard (and (character-listp x)
                                 (character-listp y))))
     (mbe
      :logic (cond ((atom y) nil)
                   ((atom x) t)
                   ((ichar< (car x) (car y)) t)
                   ((ichar< (car y) (car x)) nil)
                   (t (icharlist< (cdr x) (cdr y))))
      :exec
      (cond
       ((atom y) nil)
       ((atom x) t)
       (t
        (let* ((xc (the (unsigned-byte 8)
                        (char-code (the character (car x)))))
               (yc (the (unsigned-byte 8)
                        (char-code (the character (car y)))))
               (xc-fix (if (and (<= (big-a) (the (unsigned-byte 8) xc))
                                (<= (the (unsigned-byte 8) xc) (big-z)))
                           (the (unsigned-byte 8)
                                (+ (the (unsigned-byte 8) xc) 32))
                         (the (unsigned-byte 8) xc)))
               (yc-fix (if (and (<= (big-a) (the (unsigned-byte 8) yc))
                                (<= (the (unsigned-byte 8) yc) (big-z)))
                           (the (unsigned-byte 8)
                                (+ (the (unsigned-byte 8) yc) 32))
                         (the (unsigned-byte 8) yc))))
          (cond ((< (the (unsigned-byte 8) xc-fix)
                    (the (unsigned-byte 8) yc-fix))
                 t)
                ((< (the (unsigned-byte 8) yc-fix)
                    (the (unsigned-byte 8) xc-fix))
                 nil)
                (t (icharlist< (cdr x) (cdr y)))))))))

    Theorem: icharlist<-irreflexive

    (defthm icharlist<-irreflexive
      (equal (icharlist< x x) nil))

    Theorem: icharlist<-antisymmetric

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

    Theorem: icharlist<-transitive

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

    Theorem: icharlist<-trichotomy-weak

    (defthm icharlist<-trichotomy-weak
      (implies (and (not (icharlist< x y))
                    (not (icharlist< y x)))
               (equal (icharlisteqv x y) t)))

    Theorem: icharlisteqv-implies-equal-icharlist<-1

    (defthm icharlisteqv-implies-equal-icharlist<-1
      (implies (icharlisteqv x x-equiv)
               (equal (icharlist< x y)
                      (icharlist< x-equiv y)))
      :rule-classes (:congruence))

    Theorem: icharlisteqv-implies-equal-icharlist<-2

    (defthm icharlisteqv-implies-equal-icharlist<-2
      (implies (icharlisteqv y y-equiv)
               (equal (icharlist< x y)
                      (icharlist< x y-equiv)))
      :rule-classes (:congruence))

    Theorem: icharlist<-trichotomy-strong

    (defthm icharlist<-trichotomy-strong
      (equal (icharlist< x y)
             (and (not (icharlisteqv x y))
                  (not (icharlist< y x))))
      :rule-classes ((:rewrite :loop-stopper ((x y)))))