• Top
    • Documentation
    • Books
    • Boolean-reasoning
    • Projects
    • Debugging
    • Std
    • Community
    • Proof-automation
    • ACL2
    • Macro-libraries
    • 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
            • Atc-implementation
              • Atc-abstract-syntax
              • Atc-pretty-printer
              • Atc-event-and-code-generation
                • Atc-symbolic-computation-states
                • Atc-symbolic-execution-rules
                • Atc-gen-ext-declon-lists
                • Atc-function-and-loop-generation
                • Atc-statement-generation
                • Atc-gen-fileset
                • Atc-gen-everything
                • Atc-gen-obj-declon
                • Atc-gen-fileset-event
                • Atc-tag-tables
                • Atc-expression-generation
                • Atc-generation-contexts
                • Atc-gen-wf-thm
                • Term-checkers-atc
                  • Atc-check-cfun-call
                  • Atc-check-struct-write-array
                  • Atc-check-struct-read-array
                  • Atc-check-struct-write-scalar
                  • Atc-check-loop-call
                  • Atc-check-struct-read-scalar
                  • Atc-check-mv-let
                  • Atc-check-array-write
                  • Atc-check-let
                  • Atc-check-array-read
                  • Atc-check-integer-write
                  • Atc-check-declar/assign-n
                    • Atc-check-condexpr
                    • Atc-check-boolean-from-type
                    • Atc-check-integer-read
                    • Atc-check-sint-from-boolean
                  • Atc-variable-tables
                  • Term-checkers-common
                  • Atc-gen-init-fun-env-thm
                  • Atc-gen-appconds
                  • Read-write-variables
                  • Atc-gen-thm-assert-events
                  • Test*
                  • Atc-gen-prog-const
                  • Atc-gen-expr-bool
                  • Atc-theorem-generation
                  • Atc-tag-generation
                  • Atc-gen-expr-pure
                  • Atc-function-tables
                  • Atc-object-tables
                • Fty-pseudo-term-utilities
                • Atc-term-recognizers
                • Atc-input-processing
                • Atc-shallow-embedding
                • Atc-process-inputs-and-gen-everything
                • Atc-table
                • Atc-fn
                • Atc-pretty-printing-options
                • Atc-types
                • Atc-macro-definition
              • Atc-tutorial
            • Language
            • Representation
            • 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
    • Term-checkers-atc

    Atc-check-declar/assign-n

    Check if a term is a call of declar<n> or assign<n>.

    Signature
    (atc-check-declar/assign-n term) 
      → 
    (mv yes/no wrapper n wrapped)
    Arguments
    term — Guard (pseudo-termp term).
    Returns
    yes/no — Type (booleanp yes/no).
    wrapper — Type (symbolp wrapper).
    n — Type (natp n).
    wrapped — Type (pseudo-termp wrapped).

    These are the macros described in atc-let-designations. These macros expand to

    (mv-let (*0 *1 *2 ... *<n>)
      <wrapped>
      (mv (<wrapper> *0) *1 *2 ... *<n>))

    which in translated terms looks like

    ((lambda (mv)
             ((lambda (*0 *1 *2 ... *<n>)
                      (cons ((<wrapper> *0) (cons *1 ... (cons *<n> 'nil)))))
              (mv-nth '0 mv)
              (mv-nth '1 mv)
              ...
              (mv-nth '<n> mv)))
     <wrapped>)

    So here we attempt to recognize this for of translated terms. If successful, we return <wrapper>, <n>, and <wrapped>.

    Definitions and Theorems

    Function: atc-check-declar/assign-n

    (defun atc-check-declar/assign-n (term)
     (declare (xargs :guard (pseudo-termp term)))
     (let ((__function__ 'atc-check-declar/assign-n))
       (declare (ignorable __function__))
       (b*
        (((mv okp
              mv-var vars indices hides wrapped body)
          (fty-check-mv-let-call term))
         ((unless okp) (mv nil nil 0 nil))
         ((unless (eq mv-var 'mv))
          (mv nil nil 0 nil))
         (n+1 (len vars))
         ((unless (>= n+1 2)) (mv nil nil 0 nil))
         (n (1- n+1))
         ((unless (equal vars
                         (loop$ for i of-type integer
                                from 0 to n collect (pack '* i))))
          (mv nil nil 0 nil))
         ((unless (equal indices
                         (loop$ for i
                                of-type integer from 0 to n collect i)))
          (mv nil nil 0 nil))
         ((unless (equal hides (repeat n+1 nil)))
          (mv nil nil 0 nil))
         ((mv okp terms)
          (fty-check-list-call body))
         ((unless okp) (mv nil nil 0 nil))
         ((unless (equal (len terms) n+1))
          (mv nil nil 0 nil))
         ((cons term terms) terms)
         ((unless (pseudo-term-case term :fncall))
          (mv nil nil 0 nil))
         (wrapper (pseudo-term-fncall->fn term))
         ((unless (member-eq wrapper '(declar assign)))
          (mv nil nil 0 nil))
         ((unless (equal (pseudo-term-fncall->args term)
                         (list '*0)))
          (mv nil nil 0 nil))
         ((unless (equal terms
                         (loop$ for i of-type integer
                                from 1 to n collect (pack '* i))))
          (mv nil nil 0 nil)))
        (mv t wrapper n wrapped))))

    Theorem: booleanp-of-atc-check-declar/assign-n.yes/no

    (defthm booleanp-of-atc-check-declar/assign-n.yes/no
      (b* (((mv ?yes/no ?wrapper ?n ?wrapped)
            (atc-check-declar/assign-n term)))
        (booleanp yes/no))
      :rule-classes :rewrite)

    Theorem: symbolp-of-atc-check-declar/assign-n.wrapper

    (defthm symbolp-of-atc-check-declar/assign-n.wrapper
      (b* (((mv ?yes/no ?wrapper ?n ?wrapped)
            (atc-check-declar/assign-n term)))
        (symbolp wrapper))
      :rule-classes :rewrite)

    Theorem: natp-of-atc-check-declar/assign-n.n

    (defthm natp-of-atc-check-declar/assign-n.n
      (b* (((mv ?yes/no ?wrapper ?n ?wrapped)
            (atc-check-declar/assign-n term)))
        (natp n))
      :rule-classes :rewrite)

    Theorem: pseudo-termp-of-atc-check-declar/assign-n.wrapped

    (defthm pseudo-termp-of-atc-check-declar/assign-n.wrapped
      (b* (((mv ?yes/no ?wrapper ?n ?wrapped)
            (atc-check-declar/assign-n term)))
        (pseudo-termp wrapped))
      :rule-classes :rewrite)

    Theorem: pseudo-term-count-of-atc-check-declar/assign-n-wrapped

    (defthm pseudo-term-count-of-atc-check-declar/assign-n-wrapped
      (b* (((mv ?yes/no ?wrapper ?n ?wrapped)
            (atc-check-declar/assign-n term)))
        (implies yes/no
                 (< (pseudo-term-count wrapped)
                    (pseudo-term-count term))))
      :rule-classes :linear)