• 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
                • Execution
                • Values
                • Dynamic-environments
                • Arithmetic-operations
                • Curve-parameterization
                • Shift-operations
                • Errors
                • Value-expressions
                • Locations
                • Input-execution
                • Edwards-bls12-generator
                • Equality-operations
                • Logical-operations
                • Program-execution
                • Ordering-operations
                • Bitwise-operations
                • Literal-evaluation
                • Type-maps-for-struct-components
                • Output-execution
                • Tuple-operations
                • Struct-operations
                  • Op-struct-write
                  • Op-struct-make
                  • Op-struct-read
                • Compilation
                • Static-semantics
                • 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
    • Struct-operations

    Op-struct-read

    Leo struct reading operation.

    Signature
    (op-struct-read circval comp) → result
    Arguments
    circval — Guard (valuep circval).
    comp — Guard (identifierp comp).
    Returns
    result — Type (value-resultp result).

    The value must be a struct value, otherwise it is an error. The struct value must have a component with the given name, otherwise it is an error.

    Definitions and Theorems

    Function: op-struct-read

    (defun op-struct-read (circval comp)
     (declare (xargs :guard (and (valuep circval)
                                 (identifierp comp))))
     (let ((__function__ 'op-struct-read))
       (declare (ignorable __function__))
       (b*
         (((unless (value-case circval :struct))
           (reserrf (list :not-struct-value (value-fix circval))))
          (valmap (value-struct->components circval))
          (name+val (omap::assoc (identifier-fix comp)
                                 valmap))
          ((unless (consp name+val))
           (reserrf (list :component-not-found (identifier-fix comp)))))
         (cdr name+val))))

    Theorem: value-resultp-of-op-struct-read

    (defthm value-resultp-of-op-struct-read
      (b* ((result (op-struct-read circval comp)))
        (value-resultp result))
      :rule-classes :rewrite)

    Theorem: op-struct-read-of-value-fix-circval

    (defthm op-struct-read-of-value-fix-circval
      (equal (op-struct-read (value-fix circval)
                             comp)
             (op-struct-read circval comp)))

    Theorem: op-struct-read-value-equiv-congruence-on-circval

    (defthm op-struct-read-value-equiv-congruence-on-circval
      (implies (value-equiv circval circval-equiv)
               (equal (op-struct-read circval comp)
                      (op-struct-read circval-equiv comp)))
      :rule-classes :congruence)

    Theorem: op-struct-read-of-identifier-fix-comp

    (defthm op-struct-read-of-identifier-fix-comp
      (equal (op-struct-read circval (identifier-fix comp))
             (op-struct-read circval comp)))

    Theorem: op-struct-read-identifier-equiv-congruence-on-comp

    (defthm op-struct-read-identifier-equiv-congruence-on-comp
      (implies (identifier-equiv comp comp-equiv)
               (equal (op-struct-read circval comp)
                      (op-struct-read circval comp-equiv)))
      :rule-classes :congruence)