• Top
    • Documentation
    • Books
    • Boolean-reasoning
    • Projects
    • Debugging
    • Std
    • Proof-automation
    • Macro-libraries
    • ACL2
    • Interfacing-tools
    • Hardware-verification
    • Software-verification
      • Kestrel-books
        • Crypto-hdwallet
        • Apt
        • Error-checking
        • Fty-extensions
        • Isar
        • Kestrel-utilities
        • Set
        • Soft
        • C
          • Syntax-for-tools
          • Atc
          • Language
          • Representation
            • Representation-of-integer-operations
            • Atc-arrays
              • Atc-def-integer-arrays
              • Ushort-array-write
              • Ushort-array-integer-write
              • Ulong-array-integer-write
              • Ullong-array-write
              • Ullong-array-integer-write
              • Uchar-array-integer-write
              • Sshort-array-write
              • Sshort-array-integer-write
              • Slong-array-integer-write
              • Sllong-array-write
              • Sllong-array-integer-write
              • Schar-array-integer-write
              • Ulong-array-write
              • Uchar-array-write
              • Slong-array-write
              • Schar-array-write
              • Uint-array-write
              • Uint-array-integer-write
              • Sint-array-write
              • Sint-array-integer-write
              • Ushort-array
              • Ullong-array
              • Sshort-array
              • Sllong-array
              • Ulong-array
              • Uint-array
              • Uchar-array
              • Slong-array
              • Sint-array
              • Schar-array
                • Schar-array-fix
                  • Schar-array-equiv
                  • Make-schar-array
                  • Schar-arrayp
                  • Schar-array->elemtype
                  • Schar-array->elements
                  • Change-schar-array
                • Ushort-array-integer-read
                • Ushort-array-integer-index-okp
                • Ullong-array-integer-read
                • Ullong-array-integer-index-okp
                • Sshort-array-integer-read
                • Sshort-array-integer-index-okp
                • Sllong-array-integer-read
                • Sllong-array-integer-index-okp
                • Ulong-array-integer-read
                • Ulong-array-integer-index-okp
                • Ullong-array-read
                • Uint-array-integer-read
                • Uint-array-integer-index-okp
                • Uchar-array-integer-read
                • Uchar-array-integer-index-okp
                • Slong-array-integer-read
                • Slong-array-integer-index-okp
                • Sllong-array-read
                • Sint-array-integer-read
                • Sint-array-integer-index-okp
                • Schar-array-integer-read
                • Schar-array-integer-index-okp
                • Ushort-array-read
                • Ushort-array-index-okp
                • Ulong-array-read
                • Ulong-array-index-okp
                • Ullong-array-index-okp
                • Uint-array-read
                • Uchar-array-read
                • Uchar-array-index-okp
                • Sshort-array-read
                • Sshort-array-index-okp
                • Slong-array-read
                • Slong-array-index-okp
                • Sllong-array-index-okp
                • Sint-array-read
                • Schar-array-read
                • Schar-array-index-okp
                • Uint-array-index-okp
                • Sint-array-index-okp
                • Ushort-array-of
                • Ullong-array-of
                • Uchar-array-length
                • Sshort-array-of
                • Sllong-array-of
                • Ulong-array-of
                • Uint-array-of
                • Uchar-array-of
                • Slong-array-of
                • Sint-array-of
                • Schar-array-of
                • Ushort-array-length
                • Ulong-array-length
                • Ullong-array-length
                • Sshort-array-length
                • Sllong-array-length
                • Uint-array-length
                • Slong-array-length
                • Sint-array-length
                • Schar-array-length
                • Atc-def-integer-arrays-loop
              • Representation-of-integers
              • Representation-of-integer-conversions
              • Pointed-integers
              • Shallow-deep-embedding-relation
            • Transformation-tools
            • Insertion-sort
            • Pack
          • Bv
          • Imp-language
          • Event-macros
          • Java
          • Bitcoin
          • Ethereum
          • Yul
          • Zcash
          • ACL2-programming-language
          • Prime-fields
          • Json
          • Syntheto
          • File-io-light
          • Cryptography
          • Number-theory
          • Lists-light
          • Axe
          • Builtins
          • Solidity
          • Helpers
          • Htclient
          • Typed-lists-light
          • Arithmetic-light
        • X86isa
        • Axe
        • Execloader
      • Math
      • Testing-utilities
    • Schar-array

    Schar-array-fix

    Fixing function for schar-array structures.

    Signature
    (schar-array-fix x) → new-x
    Arguments
    x — Guard (schar-arrayp x).
    Returns
    new-x — Type (schar-arrayp new-x).

    Definitions and Theorems

    Function: schar-array-fix$inline

    (defun schar-array-fix$inline (x)
      (declare (xargs :guard (schar-arrayp x)))
      (let ((__function__ 'schar-array-fix))
        (declare (ignorable __function__))
        (mbe :logic
             (b* ((elemtype (type-fix (std::da-nth 0 (cdr x))))
                  (elements (schar-list-fix (std::da-nth 1 (cdr x)))))
               (let ((elemtype (if (type-case elemtype :schar)
                                   elemtype
                                 (type-schar)))
                     (elements (if (consp elements)
                                   elements
                                 (list (schar-from-integer 0)))))
                 (cons :array (list elemtype elements))))
             :exec x)))

    Theorem: schar-arrayp-of-schar-array-fix

    (defthm schar-arrayp-of-schar-array-fix
      (b* ((new-x (schar-array-fix$inline x)))
        (schar-arrayp new-x))
      :rule-classes :rewrite)

    Theorem: schar-array-fix-when-schar-arrayp

    (defthm schar-array-fix-when-schar-arrayp
      (implies (schar-arrayp x)
               (equal (schar-array-fix x) x)))

    Function: schar-array-equiv$inline

    (defun schar-array-equiv$inline (acl2::x acl2::y)
      (declare (xargs :guard (and (schar-arrayp acl2::x)
                                  (schar-arrayp acl2::y))))
      (equal (schar-array-fix acl2::x)
             (schar-array-fix acl2::y)))

    Theorem: schar-array-equiv-is-an-equivalence

    (defthm schar-array-equiv-is-an-equivalence
      (and (booleanp (schar-array-equiv x y))
           (schar-array-equiv x x)
           (implies (schar-array-equiv x y)
                    (schar-array-equiv y x))
           (implies (and (schar-array-equiv x y)
                         (schar-array-equiv y z))
                    (schar-array-equiv x z)))
      :rule-classes (:equivalence))

    Theorem: schar-array-equiv-implies-equal-schar-array-fix-1

    (defthm schar-array-equiv-implies-equal-schar-array-fix-1
      (implies (schar-array-equiv acl2::x x-equiv)
               (equal (schar-array-fix acl2::x)
                      (schar-array-fix x-equiv)))
      :rule-classes (:congruence))

    Theorem: schar-array-fix-under-schar-array-equiv

    (defthm schar-array-fix-under-schar-array-equiv
      (schar-array-equiv (schar-array-fix acl2::x)
                         acl2::x)
      :rule-classes (:rewrite :rewrite-quoted-constant))

    Theorem: equal-of-schar-array-fix-1-forward-to-schar-array-equiv

    (defthm equal-of-schar-array-fix-1-forward-to-schar-array-equiv
      (implies (equal (schar-array-fix acl2::x)
                      acl2::y)
               (schar-array-equiv acl2::x acl2::y))
      :rule-classes :forward-chaining)

    Theorem: equal-of-schar-array-fix-2-forward-to-schar-array-equiv

    (defthm equal-of-schar-array-fix-2-forward-to-schar-array-equiv
      (implies (equal acl2::x (schar-array-fix acl2::y))
               (schar-array-equiv acl2::x acl2::y))
      :rule-classes :forward-chaining)

    Theorem: schar-array-equiv-of-schar-array-fix-1-forward

    (defthm schar-array-equiv-of-schar-array-fix-1-forward
      (implies (schar-array-equiv (schar-array-fix acl2::x)
                                  acl2::y)
               (schar-array-equiv acl2::x acl2::y))
      :rule-classes :forward-chaining)

    Theorem: schar-array-equiv-of-schar-array-fix-2-forward

    (defthm schar-array-equiv-of-schar-array-fix-2-forward
      (implies (schar-array-equiv acl2::x (schar-array-fix acl2::y))
               (schar-array-equiv acl2::x acl2::y))
      :rule-classes :forward-chaining)