• Top
    • Documentation
    • Books
    • Boolean-reasoning
    • Projects
    • Debugging
    • Community
    • 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
        • C
          • Syntax-for-tools
          • Atc
          • Transformation-tools
          • Language
            • Abstract-syntax
            • Integer-ranges
            • Implementation-environments
              • Integer-format-templates
              • Ienv
              • Integer-formats
                • Integer-format-llong-wfp
                  • Integer-format-short-wfp
                  • Integer-format-long-wfp
                  • Integer-format-int-wfp
                  • Char+short+int+long+llong+bool-format
                  • Char+short+int+long+llong+bool-format-wfp
                  • Llong-format-64tcnt
                  • Short-format-16tcnt
                  • Long-format-32tcnt
                  • Int-format-16tcnt
                  • Integer-format-short/int/long/llong-wfp-of-inc-sign-tcnpnt
                  • Char8+short16+int16+long32+llong64+bool0-tcnt
                • Ienv-ushort-rangep
                • Ienv-ulong-rangep
                • Ienv-ullong-rangep
                • Ienv-uint-rangep
                • Ienv-uchar-rangep
                • Ienv-sshort-rangep
                • Ienv-slong-rangep
                • Ienv-sllong-rangep
                • Ienv-sint-rangep
                • Ienv-schar-rangep
                • Ienv-char-rangep
                • Ienv->schar-min
                • Ienv->schar-max
                • Ienv->char-size
                • Ienv->char-min
                • Ienv->char-max
                • Ienv->uchar-max
                • Ienv->short-bit-size
                • Ienv->long-bit-size
                • Ienv->llong-bit-size
                • Ienv->int-bit-size
                • Ienv->short-byte-size
                • Ienv->long-byte-size
                • Ienv->llong-byte-size
                • Ienv->int-byte-size
                • Versions
                • Ienv->ushort-max
                • Ienv->ullong-max
                • Ienv->sshort-min
                • Ienv->sllong-min
                • Ienv->sllong-max
                • Ienv->bool-byte-size
                • Ienv->bool-bit-size
                • Ienv->ulong-max
                • Ienv->uint-max
                • Ienv->sshort-max
                • Ienv->slong-min
                • Ienv->slong-max
                • Ienv->sint-min
                • Ienv->sint-max
                • Schar-formats
                • Char-formats
                • Uchar-formats
                • Signed-formats
                • Bool-formats
              • Dynamic-semantics
              • Static-semantics
              • Grammar
              • Types
              • Integer-formats-definitions
              • Computation-states
              • Portable-ascii-identifiers
              • Values
              • Integer-operations
              • Object-designators
              • Operations
              • Errors
              • Tag-environments
              • Function-environments
              • Character-sets
              • Flexible-array-member-removal
              • Arithmetic-operations
              • Pointer-operations
              • Real-operations
              • Array-operations
              • Scalar-operations
              • Structure-operations
            • Representation
            • Insertion-sort
            • Pack
          • Soft
          • Bv
          • Imp-language
          • Ethereum
          • Event-macros
          • Java
          • Riscv
          • Bitcoin
          • Zcash
          • Yul
          • ACL2-programming-language
          • Prime-fields
          • Json
          • Syntheto
          • File-io-light
          • Cryptography
          • Number-theory
          • Axe
          • Lists-light
          • Builtins
          • Solidity
          • Helpers
          • Htclient
          • Typed-lists-light
          • Arithmetic-light
        • X86isa
        • Axe
        • Execloader
      • Math
      • Testing-utilities
    • Integer-formats

    Integer-format-llong-wfp

    Check if an integer format is well-formed when used for (signed and unsigned) long long.

    Signature
    (integer-format-llong-wfp llong-format uchar-format long-format) 
      → 
    yes/no
    Arguments
    llong-format — Guard (integer-formatp llong-format).
    uchar-format — Guard (uchar-formatp uchar-format).
    long-format — Guard (integer-formatp long-format).
    Returns
    yes/no — Type (booleanp yes/no).

    The number of bits must be a multiple of CHAR_BIT [C17:6.2.6.1/4].

    The possible signed values must cover at least the range from -9223372036854775807 to +9223372036854775807 (both inclusive) [C17:5.2.4.2.1/1]. The possible unsigned values must cover at least the range from 0 to 18446744073709551615 (both inclusive) [C17:5.2.4.2.1/1].

    The possible signed values must at least include those of signed long, and the possible unsigned values must at least include those of unsigned long [C17:6.2.5/8].

    Definitions and Theorems

    Function: integer-format-llong-wfp

    (defun integer-format-llong-wfp
           (llong-format uchar-format long-format)
      (declare (xargs :guard (and (integer-formatp llong-format)
                                  (uchar-formatp uchar-format)
                                  (integer-formatp long-format))))
      (b*
       ((bit-size (integer-format->bit-size llong-format))
        (signed-llong-min (integer-format->signed-min llong-format))
        (signed-llong-max (integer-format->signed-max llong-format))
        (unsigned-llong-max (integer-format->unsigned-max llong-format))
        (signed-long-min (integer-format->signed-min long-format))
        (signed-long-max (integer-format->signed-max long-format))
        (unsigned-long-max (integer-format->unsigned-max long-format)))
       (and (integerp (/ bit-size
                         (uchar-format->size uchar-format)))
            (<= signed-llong-min -9223372036854775807)
            (<= 9223372036854775807 signed-llong-max)
            (<= 18446744073709551615 unsigned-llong-max)
            (<= signed-llong-min signed-long-min)
            (<= signed-long-max signed-llong-max)
            (<= unsigned-long-max unsigned-llong-max))))

    Theorem: booleanp-of-integer-format-llong-wfp

    (defthm booleanp-of-integer-format-llong-wfp
      (b* ((yes/no (integer-format-llong-wfp
                        llong-format uchar-format long-format)))
        (booleanp yes/no))
      :rule-classes :rewrite)

    Theorem: integer-format-llong-wf-bit-size-lower-bound

    (defthm integer-format-llong-wf-bit-size-lower-bound
     (implies
         (integer-format-llong-wfp llong-format uchar-format long-fomat)
         (>= (integer-format->bit-size llong-format)
             64))
     :rule-classes :linear)

    Theorem: integer-format-llong-wfp-of-integer-format-fix-llong-format

    (defthm integer-format-llong-wfp-of-integer-format-fix-llong-format
     (equal
      (integer-format-llong-wfp (integer-format-fix llong-format)
                                uchar-format long-format)
      (integer-format-llong-wfp llong-format uchar-format long-format)))

    Theorem: integer-format-llong-wfp-integer-format-equiv-congruence-on-llong-format

    (defthm
     integer-format-llong-wfp-integer-format-equiv-congruence-on-llong-format
     (implies
      (integer-format-equiv llong-format llong-format-equiv)
      (equal
        (integer-format-llong-wfp llong-format uchar-format long-format)
        (integer-format-llong-wfp llong-format-equiv
                                  uchar-format long-format)))
     :rule-classes :congruence)

    Theorem: integer-format-llong-wfp-of-uchar-format-fix-uchar-format

    (defthm integer-format-llong-wfp-of-uchar-format-fix-uchar-format
     (equal
      (integer-format-llong-wfp llong-format
                                (uchar-format-fix uchar-format)
                                long-format)
      (integer-format-llong-wfp llong-format uchar-format long-format)))

    Theorem: integer-format-llong-wfp-uchar-format-equiv-congruence-on-uchar-format

    (defthm
     integer-format-llong-wfp-uchar-format-equiv-congruence-on-uchar-format
     (implies
      (uchar-format-equiv uchar-format uchar-format-equiv)
      (equal
        (integer-format-llong-wfp llong-format uchar-format long-format)
        (integer-format-llong-wfp llong-format
                                  uchar-format-equiv long-format)))
     :rule-classes :congruence)

    Theorem: integer-format-llong-wfp-of-integer-format-fix-long-format

    (defthm integer-format-llong-wfp-of-integer-format-fix-long-format
     (equal
      (integer-format-llong-wfp llong-format uchar-format
                                (integer-format-fix long-format))
      (integer-format-llong-wfp llong-format uchar-format long-format)))

    Theorem: integer-format-llong-wfp-integer-format-equiv-congruence-on-long-format

    (defthm
     integer-format-llong-wfp-integer-format-equiv-congruence-on-long-format
     (implies
      (integer-format-equiv long-format long-format-equiv)
      (equal
        (integer-format-llong-wfp llong-format uchar-format long-format)
        (integer-format-llong-wfp llong-format
                                  uchar-format long-format-equiv)))
     :rule-classes :congruence)