• 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
        • Bv
        • Imp-language
        • Event-macros
        • Java
        • Bitcoin
        • Ethereum
        • Yul
          • Transformations
          • Language
            • Abstract-syntax
            • Dynamic-semantics
            • Concrete-syntax
            • Static-soundness
            • Static-semantics
              • Static-safety-checking
                • Check-safe-statements/blocks/cases/fundefs
                • Check-safe-expressions
                • Check-safe-fundef-list
                • Check-safe-variable-multi
                • Check-safe-variable-single
                • Check-safe-assign-multi
                • Check-safe-assign-single
                • Check-safe-path
                • Check-safe-extends-varset
                • Vars+modes
                • Add-vars
                • Add-var
                • Add-funtypes
                • Check-safe-literal
                • Funtype
                • Get-funtype
                • Check-var
                • Check-safe-top-block
                • Check-safe-path-list
                • Vars+modes-result
                • Funtype-result
                • Funtable-result
                • Funtable-for-fundefs
                • Funtype-for-fundef
                • Funtable
              • Static-shadowing-checking
              • Mode-set-result
              • Literal-evaluation
              • Static-identifier-checking
              • Static-safety-checking-evm
              • Mode-set
              • Modes
            • Errors
          • Yul-json
        • 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
  • Static-semantics

Static-safety-checking

Static safety checking of Yul.

This is (the main) part of the Yul static semantics. It consists of checks that ensure the safety of execution, i.e. that certain situations never happen during execution, such as reading or writing a non-existent variable. Our formal dynamic semantics of Yul defensively checks these conditions, returning error values when the conditions are not satisfied. The static safety checks formalized here ensure that those error values are never returned by the dynamic semantics, as proved in static-soundness.

The static safety of the Yul constructs is checked with respect to (i) a set of variable names (identifiers) and (ii) an omap from function names (identifiers) to function input/output information. These are essentially symbol tables for variables and functions: they describe the variables and functions in scope.

These symbol tables for variables consists of the variables that are not only visible, but also accessible, according to [Yul: Specification of Yul: Scoping Rules]: a variable is visible in the rest of the block in which it is declared, including sub-blocks, but it is not accessible in function definitions in the block or sub-blocks. Variables that are visible but inaccessible are not represented in these symbol tables for variables.

The Yul static semantics requires that visible but inaccessible variables are not shadowed [Yul: Specification of Yul: Scoping Rules]. However, this requirement is not needed for safety, as evidenced by the fact that the static soundness proof in static-soundness does not make use of that requirement. In fact, we do not include that requirement in the static safety checks formalized here. This requirement is formalized separately in static-shadowing-checking.

Subtopics

Check-safe-statements/blocks/cases/fundefs
Check if statements, blocks, cases, and function definitions are safe.
Check-safe-expressions
Check if expressions are safe.
Check-safe-fundef-list
Check if a list of function definitions is safe.
Check-safe-variable-multi
Check if a multiple variable declaration is safe.
Check-safe-variable-single
Check if a single variable declaration is safe.
Check-safe-assign-multi
Check if a multiple assignment is safe.
Check-safe-assign-single
Check if a single assignment is safe.
Check-safe-path
Check if a path is safe.
Check-safe-extends-varset
Theorems about the variable table being extended by the ACL2 safety checking functions.
Vars+modes
Fixtype of pairs consisting of a variable table and a set of modes.
Add-vars
Add (a list of) variables to a variable table.
Add-var
Add a variable to a variable table.
Add-funtypes
Add functions to a function table.
Check-safe-literal
Check if a literal is safe.
Funtype
Fixtype of function types.
Get-funtype
Look up a function in a function table.
Check-var
Check if a variable is in a variable table.
Check-safe-top-block
Check if the top block is safe.
Check-safe-path-list
Check if a list of paths is safe.
Vars+modes-result
Fixtype of errors and pairs consisting of a variable table and a set of modes.
Funtype-result
Fixtype of errors and function types.
Funtable-result
Fixtype of errors and function tables.
Funtable-for-fundefs
Function table for a list of function definitions.
Funtype-for-fundef
Function type for a function definition.
Funtable
Fixtype of function tables.