• Top
    • Documentation
    • Books
    • Boolean-reasoning
    • Projects
    • Debugging
    • Community
    • 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
        • C
          • Syntax-for-tools
            • Formalized-subset
            • Mapping-to-language-definition
            • Input-files
            • Compilation-database
            • Printer
            • Output-files
            • Abstract-syntax-operations
            • Implementation-environments
            • Abstract-syntax
            • Concrete-syntax
            • Disambiguation
            • Validation
              • Validator
              • Validation-information
                • Abstract-syntax-annop
                • Types
                • Abstract-syntax-anno-additional-theroems
                • Valid-ext-info
                • Valid-table
                • Valid-ord-info
                  • Valid-ord-info-fix
                  • Valid-ord-info-case
                    • Valid-ord-info-equiv
                    • Valid-ord-info-objfun
                    • Valid-ord-infop
                    • Valid-ord-info-typedef
                    • Valid-ord-info-kind
                    • Valid-ord-info-enumconst
                  • Uid
                  • Stmts-types
                  • Lifetime
                  • Initdeclor-info
                  • Fundef-types
                  • Expr-type
                  • Valid-defstatus
                  • Var-info
                  • Valid-ord-info-option
                  • Valid-ext-info-option
                  • Uid-option
                  • Linkage-option
                  • Linkage
                  • Lifetime-option
                  • Valid-table-option
                  • Iconst-info
                  • Param-declor-nonabstract-info
                  • Fundef-info
                  • Expr-null-pointer-constp
                  • Valid-scope
                  • Const-expr-null-pointer-constp
                  • Expr-string-info
                  • Expr-funcall-info
                  • Expr-arrsub-info
                  • Tyname-info
                  • Transunit-info
                  • Expr-unary-info
                  • Expr-const-info
                  • Expr-binary-info
                  • Stmt-types
                  • Block-item-list-types
                  • Initer-type
                  • Valid-ord-scope
                  • Uid-increment
                  • Uid-equal
                  • Coerce-var-info
                  • Valid-externals
                  • Irr-var-info
                  • Valid-scope-list
                  • Irr-valid-table
                  • Irr-lifetime
                  • Irr-uid
                  • Irr-linkage
                  • Block-item-types
                  • Comp-stmt-types
              • Gcc-builtins
              • Preprocessing
              • Parsing
            • Atc
            • Transformation-tools
            • Language
            • Representation
            • Insertion-sort
            • Pack
          • Soft
          • Bv
          • Imp-language
          • Ethereum
          • Event-macros
          • Java
          • Riscv
          • Bitcoin
          • Zcash
          • Yul
          • ACL2-programming-language
          • Prime-fields
          • Json
          • Syntheto
          • File-io-light
          • Cryptography
          • Number-theory
          • Axe
          • Lists-light
          • Builtins
          • Solidity
          • Helpers
          • Htclient
          • Typed-lists-light
          • Arithmetic-light
        • X86isa
        • Axe
        • Execloader
      • Math
      • Testing-utilities
    • Valid-ord-info

    Valid-ord-info-case

    Case macro for the different kinds of valid-ord-info structures.

    This is an ACL2::fty sum-type case macro, typically introduced by fty::defflexsum or fty::deftagsum. It allows you to safely check the type of a valid-ord-info structure, or to split into cases based on its type.

    Short Form

    In its short form, valid-ord-info-case allows you to safely check the type of a valid-ord-info structure. For example:

    (valid-ord-info-case x :objfun)

    is essentially just a safer alternative to writing:

    (equal (valid-ord-info-kind x) :objfun)

    Why is using valid-ord-info-case safer? When we directly inspect the kind with equal, there is no static checking being done to ensure that, e.g., :objfun is a valid kind of valid-ord-info structure. That means there is nothing to save you if, later, you change the kind keyword for this type from :objfun to something else. It also means you get no help if you just make a typo when writing the :objfun symbol. Over the course of developing VL, we found that such issues were very frequent sources of errors!

    Long Form

    In its longer form, valid-ord-info-case allows you to split into cases based on the kind of structure you are looking at. A typical example would be:

    (valid-ord-info-case x
      :objfun ...
      :enumconst ...
      :typedef ...)

    It is also possible to consolidate ``uninteresting'' cases using :otherwise.

    For convenience, the case macro automatically binds the fields of x for you, as appropriate for each case. That is, in the :objfun case, you can use fty::defprod-style foo.bar style accessors for x without having to explicitly add a objfun b* binder.