• Top
    • Documentation
    • Books
    • 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
          • Charlisteqv
          • Icharlisteqv
          • Istreqv
          • Ichareqv
          • Streqv
          • Chareqv
          • Char-fix
            • Charlist-fix
          • Str-fix
        • Url-encoding
        • Lines
        • Explode-implode-equalities
        • Ordering
        • Numbers
        • Pad-trim
        • Coercion
        • Std/strings/digit-to-char
        • Substitution
        • Symbols
      • Std/osets
      • Std/io
      • Std/basic
      • Std/system
      • Std/typed-lists
      • Std/bitsets
      • Std/testing
      • Std/typed-alists
      • Std/stobjs
    • Proof-automation
    • Macro-libraries
    • ACL2
    • Interfacing-tools
    • Hardware-verification
    • Software-verification
    • Math
    • Testing-utilities
  • Std/basic
  • Equivalences

Char-fix

Coerce to a character.

(char-fix x) is the identity on characters, and returns the NUL character (i.e., the character whose code is 0) for any non-character.

This is similar to other fixing functions like fix and nfix. See also chareqv.

Definitions and Theorems

Function: char-fix$inline

(defun char-fix$inline (x)
  (declare (xargs :guard t))
  (if (characterp x) x (code-char 0)))

Theorem: characterp-of-char-fix

(defthm characterp-of-char-fix
  (characterp (char-fix x))
  :rule-classes :type-prescription)

Theorem: char-fix-default

(defthm char-fix-default
  (implies (not (characterp x))
           (equal (char-fix x) (code-char 0))))

Theorem: char-fix-when-characterp

(defthm char-fix-when-characterp
  (implies (characterp x)
           (equal (char-fix x) x)))

Subtopics

Charlist-fix
(charlist-fix x) maps ACL2::char-fix across a list.