Core C++

4.8. Expression statement🔗

Definition4.8.1
Group: Variables, update and commands. (9)
Group member previews
Preview
Definition 4.1.1
Loading preview
Group member preview content is loaded from the rendered-fragment cache.
Statement uses 2
Statement dependency previews
Preview
Definition 2.2.3
Loading preview
Statement dependency preview content is loaded from the rendered-fragment cache.
used by 0✓L∃∀N

An expression followed by ; is a command that evaluates the expression and discards the value. Any type is accepted, void included, which allows a call to a void function as a statement.

\dfrac{\Gamma \vdash e : \tau}{\Gamma \vdash e; \dashv \Gamma}\;\textsf{(T-ExprStmt)}

\dfrac{\rho, \sigma \vdash e \Rightarrow v, \sigma'}{\rho, \sigma \vdash e; \Rightarrow \mathsf{normal}, \rho, \sigma'}\;\textsf{(ExprStmt)}

The implementations are partial, so Lean records opaque constants that carry the type and not the body, and no property of them is proved here.

Lean code for Definition4.8.1●2 definitions
  • opaquedefined in CoreCpp/Typing.lean
    complete
    opaque CoreCpp.Typing.cmd (p : CoreCpp.Program) (τᵣ : CoreCpp.Ty)
      (Γ : CoreCpp.TEnv) : CoreCpp.Cmd → CoreCpp.T CoreCpp.TEnv
    opaque CoreCpp.Typing.cmd (p : CoreCpp.Program)
      (τᵣ : CoreCpp.Ty) (Γ : CoreCpp.TEnv) :
      CoreCpp.Cmd → CoreCpp.T CoreCpp.TEnv
    Γ ⊢ c ⊣ Γ', under the return type τᵣ of the enclosing function. 
  • opaquedefined in CoreCpp/Eval.lean
    complete
    opaque CoreCpp.Eval.cmd (fs : CoreCpp.FunEnv) (ρ : CoreCpp.Env)
      (σ : CoreCpp.Store) (c : CoreCpp.Cmd) :
      CoreCpp.M (CoreCpp.Ctrl × CoreCpp.Env × CoreCpp.Store)
    opaque CoreCpp.Eval.cmd (fs : CoreCpp.FunEnv)
      (ρ : CoreCpp.Env) (σ : CoreCpp.Store)
      (c : CoreCpp.Cmd) :
      CoreCpp.M
        (CoreCpp.Ctrl ×
          CoreCpp.Env × CoreCpp.Store)
    ρ, σ ⊢ c ⇒ r, ρ', σ'