Section LINEARIZATION.
Variable prog: LTL.program.
Variable tprog: Linear.program.
Hypothesis TRANSF: match_prog prog tprog.
Let ge := Genv.globalenv prog.
Let tge := Genv.globalenv tprog.
Proof (Genv.find_funct_transf_partial TRANSF).
Proof (Genv.find_funct_ptr_transf_partial TRANSF).
Proof (Genv.find_symbol_transf_partial TRANSF).
Proof (Genv.senv_transf_partial TRANSF).
(** * Correctness of reachability analysis *)
(** The entry point of the function is reachable. *)
(** The successors of a reachable instruction are reachable. *)
(** * Properties of node enumeration *)
(** An enumeration of CFG nodes is correct if the following conditions hold: - All nodes for reachable basic blocks must be in the list. - The list is without repetition (so that no code duplication occurs).  We prove that the result of the [enumerate] function satisfies both conditions. *)
(** * Properties related to labels *)
(** If labels are globally unique and the Linear code [c] contains a subsequence [Llabel lbl :: c1], then [find_label lbl c] returns [c1]. *)
Fixpoint unique_labels (c: code) : Prop :=
match c with
| nil => True
| Llabel lbl :: c => ~(In (Llabel lbl) c) /\ unique_labels c
| i :: c => unique_labels c
end.
(** Correctness of the [starts_with] test. *)
(** Connection between [find_label] and linearization. *)
Remark linearize_body_cons:
forall f pc enum,
linearize_body f (pc :: enum) =
match f.(LTL.fn_code)!pc with
| None => linearize_body f enum
| Some b => Llabel pc :: linearize_block b (linearize_body f enum)
end.
(** Unique label property for linearized code. *)

Lemma label_in_lin_block:
forall lbl k b,
In (Llabel lbl) (linearize_block b k) -> In (Llabel lbl) k.