• 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
      • Farray
      • Rp-rewriter
      • Instant-runoff-voting
      • Imp-language
      • Sidekick
      • Leftist-trees
      • Java
      • Riscv
      • Taspi
      • Bitcoin
      • 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
      • Aleo
        • Aleobft
        • Aleovm
        • Leo
          • Grammar
          • Early-version
            • Json2ast
            • Testing
            • Definition
              • Flattening
              • Abstract-syntax
              • Dynamic-semantics
              • Compilation
              • Static-semantics
                • Type-checking
                • Static-environments
                • Curve-parameterization
                • Function-recursion
                • Struct-recursion
                  • Topdecl-list-struct-graph
                  • Structdecl-struct-graph
                  • File-struct-recursion-okp
                  • Compdecl-list-type-identifiers
                  • Topdecl-struct-graph
                  • Compdecl-type-identifiers
                • Input-checking
                • Program-checking
                • Type-maps-for-struct-components
                • Program-and-input-checking
                • Output-checking
              • Concrete-syntax
      • Bigmems
      • Builtins
      • Execloader
      • Solidity
      • Paco
      • Concurrent-programs
      • Bls12-377-curves
    • Debugging
    • Community
    • Std
    • Proof-automation
    • Macro-libraries
    • ACL2
    • Interfacing-tools
    • Hardware-verification
    • Software-verification
    • Math
    • Testing-utilities
  • Static-semantics

Struct-recursion

Struct type recursion checks in Leo.

Struct types may contain components with other struct types, but there cannot be any circularity: a struct type cannot include, directly or indirectly, components of the same struct type. If such a circularity existed, it would be impossible to construct values of the struct type, because values in Leo are finite objects.

Thus, the Leo static semantics includes the requirement that there is no recursion in struct types (in the sense above). Here we formalize this requirement, by constructing a dependency graph among type identifiers and ensuring that there are no circularities in the graph.

Subtopics

Topdecl-list-struct-graph
Struct graph induced by a list of top-level declarations.
Structdecl-struct-graph
Struct graph induced by a struct definition.
File-struct-recursion-okp
Check if a Leo file has no struct type recursion.
Compdecl-list-type-identifiers
Type identifiers in a list of struct component declarations.
Topdecl-struct-graph
Struct graph induced by a top-level definition.
Compdecl-type-identifiers
Type identifiers in a struct component declaration.