(** Safe expressions are well-formed with respect to l-values and r-values. *)
Definition expr_kind (a: expr) : kind :=
match a with
| Eloc _ _ _ => LV
| Evar _ _ => LV
| Ederef _ _ => LV
| Efield _ _ _ => LV
| _ => RV
end.

(* Specifications: *)
Lemma lred_kind:
forall e a m a' m', lred ge e a m a' m' -> expr_kind a = LV.
Lemma rred_kind:
forall a m t a' m', rred ge a m t a' m' -> expr_kind a = RV.
Lemma callred_kind:
forall a m fd args ty, callred ge a m fd args ty -> expr_kind a = RV.
Lemma context_kind:
forall a from to C, context from to C -> expr_kind a = from -> expr_kind (C a) = to.
Lemma imm_safe_kind:
forall e k a m, imm_safe ge e k a m -> expr_kind a = k.
Lemma safe_expr_kind:
forall from C f a k e m,
context from RV C ->
safe (ExprState f (C a) k e m) ->
expr_kind a = from.