• 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
            • Atc-implementation
              • Atc-abstract-syntax
              • Atc-pretty-printer
              • Atc-event-and-code-generation
              • Fty-pseudo-term-utilities
              • Atc-term-recognizers
              • Atc-input-processing
              • Atc-shallow-embedding
                • Defstruct
                • Defobject
                • Atc-let-designations
                  • Declar
                  • Assign
                  • Declar9
                  • Declar8
                  • Declar7
                  • Declar6
                  • Declar5
                  • Declar4
                  • Declar3
                  • Declar2
                  • Assign9
                  • Assign8
                  • Assign7
                  • Assign6
                  • Assign5
                  • Assign4
                  • Assign3
                  • Assign2
                  • Declar1
                  • Assign1
                • Pointer-types
                • Atc-conditional-expressions
              • 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
  • Atc-shallow-embedding

Atc-let-designations

Designations of let and mv-let representations for ATC.

ACL2's let is used to represent different things in C:

  1. A local variable declaration with an initializer.
  2. An assignment of an expression to a local variable.
  3. An assignment to an integer by pointer.
  4. An assignment to an element of an array.
  5. An assignment to an integer member of a structure.
  6. An assignment to an element of an array member of a structure.
  7. A transformation of a variable via statements.

The third, fourth, fifth, and sixth cases are recognized by the presence of certain write functions, according to the patterns described in the user documentation. The other three cases could be recognized by looking at the conditions that must hold in each cases, but in order to ease ATC's task, and also to encourage the user to explicate their intentions, we use declar and assign to indicate the declaration and assignment cases, as explained in the user documentation. Thus, the seventh case is what remains when the others do not apply.

In all four cases above, the term to which the variable is bound must be single-valued. For multi-valued terms, we follow a similar approach for mv-let, which is used to represent three different things in C:

  1. A local variable declaration with an initializer that side-effects some variable(s) in addition to returning the value to initialize the variable with.
  2. An assignment of an expression to a local variable where the expression side-effects some variable(s) in addition to returning the value to assign to the variable.
  3. A transformation of two or more variables via statements.

These cases mirror the first, second, and last cases described above for let.

For these mv-let cases, we use a similiar approach to the let cases, i.e. we explicitly use indicators for declarations and assignments. But the functions declar and assign cannot be applied to multi-valued terms. Thus, we introduce macros declar<n> and assign<n>, for <n> equal to 1, 2, 3, etc. (we stop at some point, but it is easy to add more if needed). Note that <n> indicates the number of side-effected variables, in addition to the declared or assigned variable; it does not indicate the number of variables bound by mv-let, which are always <n> + 1. These must be macros, and cannot be functions, because function may be only applied to single-valued terms, while macros do not have that restriction; and we need to have different macros for different values of <n>. These representations are described in the user documentation.

Since ATC works on translated terms, it does not directly see the macros declar<n> and assign<n>. But it recognizes their presence as the term patterns they expand to. See the ATC developer documentation for details.

We remark that an external (APT) transformation could automatically add the needed wrappers based on the conditions under which a let or mv-let occurs. Thus, our approach does not forgo automation, but rather modularizes the problem into simpler pieces.

Subtopics

Declar
Wrapper to indicate a C local variable declaration in a let.
Assign
Wrapper to indicate a C local variable assignment in a let.
Declar9
Wrapper to indicate a C local variable declaration in an mv-let that side-effects 9 additional variables.
Declar8
Wrapper to indicate a C local variable declaration in an mv-let that side-effects 8 additional variables.
Declar7
Wrapper to indicate a C local variable declaration in an mv-let that side-effects 7 additional variables.
Declar6
Wrapper to indicate a C local variable declaration in an mv-let that side-effects 6 additional variables.
Declar5
Wrapper to indicate a C local variable declaration in an mv-let that side-effects 5 additional variables.
Declar4
Wrapper to indicate a C local variable declaration in an mv-let that side-effects 4 additional variables.
Declar3
Wrapper to indicate a C local variable declaration in an mv-let that side-effects 3 additional variables.
Declar2
Wrapper to indicate a C local variable declaration in an mv-let that side-effects 2 additional variables.
Assign9
Wrapper to indicate a C local variable assignment in an mv-let that side-effects 9 additional variables.
Assign8
Wrapper to indicate a C local variable assignment in an mv-let that side-effects 8 additional variables.
Assign7
Wrapper to indicate a C local variable assignment in an mv-let that side-effects 7 additional variables.
Assign6
Wrapper to indicate a C local variable assignment in an mv-let that side-effects 6 additional variables.
Assign5
Wrapper to indicate a C local variable assignment in an mv-let that side-effects 5 additional variables.
Assign4
Wrapper to indicate a C local variable assignment in an mv-let that side-effects 4 additional variables.
Assign3
Wrapper to indicate a C local variable assignment in an mv-let that side-effects 3 additional variables.
Assign2
Wrapper to indicate a C local variable assignment in an mv-let that side-effects 2 additional variables.
Declar1
Wrapper to indicate a C local variable declaration in an mv-let that side-effects 1 additional variable.
Assign1
Wrapper to indicate a C local variable assignment in an mv-let that side-effects 1 additional variable.