4.3. Assignment
The left side denotes a location and has the type of the right side. The order is the one C++17 fixes for assignment, the right operand before the left one. The location must be live.
\dfrac{\Gamma \vdash_{\ell} e_1 : \tau \qquad \Gamma \vdash e_2 : \tau}{\Gamma \vdash e_1 = e_2 \dashv \Gamma}\;\textsf{(T-Assign)}
\dfrac{\begin{array}{c} \rho, \sigma \vdash e_2 \Rightarrow v, \sigma_1 \qquad \rho, \sigma_1 \vdash e_1 \Rightarrow_{\ell} \ell, \sigma_2 \\ \ell \in \mathrm{dom}\,\sigma_2 \end{array}}{\rho, \sigma \vdash e_1 = e_2 \Rightarrow \mathsf{normal}, \rho, \sigma_2[\ell \mapsto v]}\;\textsf{(Assign)}
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.3.1●2 definitions
Associated Lean declarations
-
CoreCpp.Typing.cmd[complete]
-
CoreCpp.Eval.cmd[complete]
-
CoreCpp.Typing.cmd[complete] -
CoreCpp.Eval.cmd[complete]
-
opaquedefined in CoreCpp/Typing.leancomplete
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.leancomplete
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, ρ', σ'