• 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
      • Taspi
      • Bitcoin
      • Riscv
      • Des
      • Ethereum
      • X86isa
      • Sha-2
      • Yul
        • Transformations
        • Language
          • Abstract-syntax
          • Dynamic-semantics
            • Exec
            • Find-fun
            • Init-local
            • Write-vars-values
            • Add-vars-values
            • Add-funs
            • Eoutcome
            • Soutcome
            • Ensure-funscope-disjoint
            • Write-var-value
            • Restrict-vars
            • Add-var-value
            • Funinfo
            • Exec-top-block
            • Values
            • Cstate
            • Funinfo+funenv
            • Read-vars-values
            • Read-var-value
            • Funenv
            • Funscope-for-fundefs
            • Exec-path
            • Path-to-var
              • Funinfo+funenv-result
              • Exec-literal
              • Soutcome-result
              • Mode-set-result
              • Literal-evaluation
              • Funscope-result
              • Funinfo-result
              • Funenv-result
              • Eoutcome-result
              • Cstate-result
              • Paths-to-vars
              • Funinfo-for-fundef
              • Lstate
              • Funscope
              • Mode-set
              • Modes
            • Concrete-syntax
            • Static-soundness
            • Static-semantics
            • Errors
          • Yul-json
        • Zcash
        • Proof-checker-itp13
        • Regex
        • ACL2-programming-language
        • Json
        • Jfkr
        • Equational
        • Cryptography
        • Poseidon
        • Where-do-i-place-my-book
        • Axe
        • Bigmems
        • Builtins
        • Execloader
        • Aleo
        • Solidity
        • Paco
        • Concurrent-programs
        • Bls12-377-curves
      • Debugging
      • Std
      • Proof-automation
      • Macro-libraries
      • ACL2
      • Interfacing-tools
      • Hardware-verification
      • Software-verification
      • Math
      • Testing-utilities
    • Dynamic-semantics

    Path-to-var

    Extract a variable from a path.

    Signature
    (path-to-var path) → var
    Arguments
    path — Guard (pathp path).
    Returns
    var — Type (identifier-resultp var).

    As in the static semantics, also in the dynamic semantics we require a path to consist of a single identifier. This ACL2 function makes that check, returning the identifier. This is the variable denoted by the path.

    Definitions and Theorems

    Function: path-to-var

    (defun path-to-var (path)
      (declare (xargs :guard (pathp path)))
      (let ((__function__ 'path-to-var))
        (declare (ignorable __function__))
        (b* ((idens (path->get path))
             ((unless (consp idens))
              (reserrf (list :empty-path (path-fix path))))
             ((unless (endp (cdr idens)))
              (reserrf (list :non-singleton-path (path-fix path))))
             (var (car idens)))
          var)))

    Theorem: identifier-resultp-of-path-to-var

    (defthm identifier-resultp-of-path-to-var
      (b* ((var (path-to-var path)))
        (identifier-resultp var))
      :rule-classes :rewrite)

    Theorem: error-info-wfp-of-path-to-var

    (defthm error-info-wfp-of-path-to-var
      (b* ((?var (path-to-var path)))
        (implies (reserrp var)
                 (error-info-wfp var))))

    Theorem: path-to-var-of-path-fix-path

    (defthm path-to-var-of-path-fix-path
      (equal (path-to-var (path-fix path))
             (path-to-var path)))

    Theorem: path-to-var-path-equiv-congruence-on-path

    (defthm path-to-var-path-equiv-congruence-on-path
      (implies (path-equiv path path-equiv)
               (equal (path-to-var path)
                      (path-to-var path-equiv)))
      :rule-classes :congruence)