• Top
    • Documentation
    • Books
    • Boolean-reasoning
    • Projects
      • Apt
      • Zfc
      • Acre
      • Milawa
      • Smtlink
      • Abnf
      • Vwsim
      • Isar
      • Wp-gen
      • Dimacs-reader
      • Pfcs
      • Legacy-defrstobj
      • Proof-checker-array
      • Soft
      • C
        • Syntax-for-tools
        • Atc
        • Language
        • Representation
          • Representation-of-integer-operations
          • Atc-arrays
          • Representation-of-integers
            • Def-integer-values
            • Ushort-list-from-integer-list
            • Ullong-list-from-integer-list
            • Sshort-list-from-integer-list
            • Sllong-list-from-integer-list
            • Integer-list-from-ushort-list
            • Integer-list-from-ullong-list
            • Integer-list-from-sshort-list
            • Integer-list-from-sllong-list
            • Ulong-list-from-integer-list
            • Uchar-list-from-integer-list
            • Slong-list-from-integer-list
            • Schar-list-from-integer-list
            • Integer-list-from-ulong-list
            • Integer-list-from-uchar-list
            • Integer-list-from-slong-list
            • Integer-list-from-schar-list
            • Uint-list-from-integer-list
            • Sint-list-from-integer-list
            • Integer-list-from-uint-list
            • Integer-list-from-sint-list
            • Cinteger
            • Sintp
            • Ullongp
            • Ucharp
            • Ushortp
            • Ulongp
            • Uintp
            • Sllongp
            • Slongp
            • Sshortp
            • Scharp
            • Integer-from-sshort
            • Integer-from-sllong
            • Integer-from-sint
            • Integer-from-slong
            • Integer-from-schar
            • Integer-type-to-fixtype
            • Integer-from-ushort
            • Integer-from-ullong
            • Integer-from-uchar
            • Integer-from-cinteger
              • Integer-from-ulong
              • Integer-from-uint
              • Def-integer-values-loop
              • Sint-from-integer
              • Sint
              • Fixtype-to-integer-type
              • Uchar-from-integer
              • Ushort-from-integer-mod
              • Ushort-from-integer
              • Ulong-from-integer-mod
              • Ulong-from-integer
              • Ullong-from-integer-mod
              • Ullong-from-integer
              • Uchar-from-integer-mod
              • Sshort-from-integer
              • Slong-from-integer
              • Sllong-from-integer
              • Schar-from-integer
              • Uint-from-integer-mod
              • Uint-from-integer
              • Uchar
              • Schar
              • Ushort
              • Ulong
              • Ullong
              • Sshort
              • Slong
              • Sllong
              • Ullong-fix
              • Uint
              • Uchar-fix
              • Sint-fix
              • Ushort-fix
              • Ulong-fix
              • Uint-fix
              • Sshort-fix
              • Slong-fix
              • Sllong-fix
              • Schar-fix
              • Ushort-list
              • Ulong-list
              • Ullong-list
              • Uint-list
              • Uchar-list
              • Sshort-list
              • Slong-list
              • Sllong-list
              • Sint-list
              • Schar-list
              • Integer-type-to/from-fixtype-theorems
              • *nonchar-integer-fixtypes*
            • Representation-of-integer-conversions
            • Pointed-integers
            • Shallow-deep-embedding-relation
          • Transformation-tools
          • Insertion-sort
          • Pack
        • Farray
        • Rp-rewriter
        • Instant-runoff-voting
        • Imp-language
        • Sidekick
        • Leftist-trees
        • Java
        • Taspi
        • Bitcoin
        • Riscv
        • Des
        • Ethereum
        • X86isa
        • Sha-2
        • Yul
        • Zcash
        • Proof-checker-itp13
        • Regex
        • ACL2-programming-language
        • Json
        • Jfkr
        • Equational
        • Cryptography
        • Poseidon
        • Where-do-i-place-my-book
        • Axe
        • Bigmems
        • Builtins
        • Execloader
        • Aleo
        • Solidity
        • Paco
        • Concurrent-programs
        • Bls12-377-curves
      • Debugging
      • Std
      • Proof-automation
      • Macro-libraries
      • ACL2
      • Interfacing-tools
      • Hardware-verification
      • Software-verification
      • Math
      • Testing-utilities
    • Representation-of-integers

    Integer-from-cinteger

    ACL2 integer corresponding to the C integer.

    Signature
    (integer-from-cinteger cint) → int
    Arguments
    cint — Guard (cintegerp cint).
    Returns
    int — Type (integerp int).

    Definitions and Theorems

    Function: integer-from-cinteger

    (defun integer-from-cinteger (cint)
      (declare (xargs :guard (cintegerp cint)))
      (let ((__function__ 'integer-from-cinteger))
        (declare (ignorable __function__))
        (cinteger-case cint
                       :schar (integer-from-schar cint.get)
                       :uchar (integer-from-uchar cint.get)
                       :sshort (integer-from-sshort cint.get)
                       :ushort (integer-from-ushort cint.get)
                       :sint (integer-from-sint cint.get)
                       :uint (integer-from-uint cint.get)
                       :slong (integer-from-slong cint.get)
                       :ulong (integer-from-ulong cint.get)
                       :sllong (integer-from-sllong cint.get)
                       :ullong (integer-from-ullong cint.get))))

    Theorem: integerp-of-integer-from-cinteger

    (defthm integerp-of-integer-from-cinteger
      (b* ((int (integer-from-cinteger cint)))
        (integerp int))
      :rule-classes :rewrite)

    Theorem: integer-from-cinteger-alt-def

    (defthm integer-from-cinteger-alt-def
      (equal (integer-from-cinteger x)
             (cond ((scharp x) (integer-from-schar x))
                   ((ucharp x) (integer-from-uchar x))
                   ((sshortp x) (integer-from-sshort x))
                   ((ushortp x) (integer-from-ushort x))
                   ((sintp x) (integer-from-sint x))
                   ((uintp x) (integer-from-uint x))
                   ((slongp x) (integer-from-slong x))
                   ((ulongp x) (integer-from-ulong x))
                   ((sllongp x) (integer-from-sllong x))
                   (t (integer-from-ullong x)))))

    Theorem: integer-from-cinteger-of-cinteger-fix-cint

    (defthm integer-from-cinteger-of-cinteger-fix-cint
      (equal (integer-from-cinteger (cinteger-fix cint))
             (integer-from-cinteger cint)))

    Theorem: integer-from-cinteger-cinteger-equiv-congruence-on-cint

    (defthm integer-from-cinteger-cinteger-equiv-congruence-on-cint
      (implies (cinteger-equiv cint cint-equiv)
               (equal (integer-from-cinteger cint)
                      (integer-from-cinteger cint-equiv)))
      :rule-classes :congruence)