Module CL  := CL_Sound VSM.       Import CL.
(* import theorem prover *)
(* end hide *)
(* proof of soundness of the main loop *)
Local Open Scope nat_scope.
Local Coercion bool2Prop (b: bool) := b = true.
(*begin hide*)
(* NOTE: obsolete stuff related to proving the invariant the clauses fed into unfolding contain no reflexive spatial atoms of the form Lseg x x. *)
(*Lemma pure_nlsegrefl c : is_pure_clause c -> no_refl_Lseg_clause c. Proof with simpl; auto; try solve[congruence]. destruct c... Qed.*)
(*Lemma drop_reflex_lseg_nlsegreflatms sigma : no_refl_Lseg_spaceatom (drop_reflex_lseg sigma). Proof with simpl; auto; try congruence. unfold no_refl_Lseg_spaceatom. intros x H1. induction sigma... simpl in H1. destruct a. inversion H1... destruct e... destruct e0... inversion H1... destruct e0. inversion H1... remember (negb (eq_var v v0)) as b. if_tac in H1... inversion H1... inversion H. inversion H3. subst. unfold eq_var in Heqb. rewrite fresh.var_compare_refl in Heqb; simpl in Heqb... Qed. *)
(*Local Hint Resolve drop_reflex_lseg_nlsegreflatms.*)
(*Lemma norm_nlsegrefl sel nc : no_refl_Lseg_clause (norm sel nc). Proof with simpl; auto; try congruence. destruct nc as [gamma delta|gamma delta sigma|gamma sigma delta]. apply pure_nlsegrefl; apply norm_pure_pure... unfold norm. unfold normalize2_4. remember (fold_right normalize1_3 (PosSpaceClause gamma delta sigma) (rsort_uniq (rev_cmp compare_clause) (M.elements sel))) as c. destruct c... unfold norm. unfold normalize2_4. remember (fold_right normalize1_3 (NegSpaceClause gamma sigma delta) (rsort_uniq (rev_cmp compare_clause) (M.elements sel))) as c. destruct c... Qed. *)
(*end hide*)

Lemma loop_sound n sigma nc s cl st :
clause_denote nc st -> space_denote sigma st ->
setd clause_denote inter TT s st -> the_loop n sigma nc s cl = Valid ->
clause_denote empty_clause st.