Definition locals2env (s: locals) : env :=
   fun x => match table_get s x with Some a => a | None => 0 end.Fixpoint eval (e: expr) : env -> adr :=
 fun s =>
 match e with
 | Const n => n
 | Var x => s x
 | Offset e n => n + eval e s
 | Mem e => 0
 end.Definition eval_list (xs: list expr) : env -> (list adr) := fun s => map (fun e => eval e s) xs.

(* Specifications: *)
Lemma offset_zero: forall a, eval (a .+ 0) = eval a.
Lemma offset_offset: forall a n m, eval ((a .+ n) .+ m) = eval (a .+ (n+m)).