(* *********************************************************************)
(*                                                                     *)
(*              The Compcert verified compiler                         *)
(*                                                                     *)
(*          Xavier Leroy, INRIA Paris-Rocquencourt                     *)
(*                                                                     *)
(*  Copyright Institut National de Recherche en Informatique et en     *)
(*  Automatique.  All rights reserved.  This file is distributed       *)
(*  under the terms of the INRIA Non-Commercial License Agreement.     *)
(*                                                                     *)
(* *********************************************************************)
(** Correctness proof for the [Debugvar] pass. *)
(** * Relational characterization of the transformation *)
Definition match_prog (p tp: program) :=
match_program (fun _ f tf => transf_fundef f = OK tf) eq p tp.
Inductive match_code: code -> code -> Prop :=
| match_code_nil:
match_code nil nil
| match_code_cons: forall i before after c c',
match_code c c' ->
match_code (i :: c) (i :: add_delta_ranges before after c').
Remark diff_same:
forall s, diff s s = nil.
Remark delta_state_same:
forall s, delta_state s s = (nil, nil).
Inductive match_function: function -> function -> Prop :=
| match_function_intro: forall f c,
match_code f.(fn_code) c ->
match_function f (mkfunction f.(fn_sig) f.(fn_stacksize) c).
Remark find_label_add_delta_ranges:
forall lbl c before after, find_label lbl (add_delta_ranges before after c) = find_label lbl c.
(** * Properties of availability sets *)
(** These properties are not used in the semantic preservation proof, but establish some confidence in the availability analysis. *)
Definition avail_above (v: ident) (s: avail) : Prop :=
forall v' i', In (v', i') s -> Plt v v'.
Inductive wf_avail: avail -> Prop :=
| wf_avail_nil:
wf_avail nil
| wf_avail_cons: forall v i s,
avail_above v s ->
wf_avail s ->
wf_avail ((v, i) :: s).

Lemma wf_remove_state:
forall v s, wf_avail s -> wf_avail (remove_state v s).