Proof with simpl; auto.
intros H1 H2. destruct c... destruct gamma, delta...
destruct p... destruct delta...
destruct d... intro H3.
simpl in H1; spec H1; auto. inversion H1. 2: inversion H. clear H1. subst priority0.
induction gamma. simpl in H2; spec H2; auto. induction delta...
inversion H2. left. apply rewrite_by_sound... right. apply IHdelta...
destruct H3 as [H3 H4]. apply IHgamma... intro H5. simpl in H2; spec H2.
split... rewrite <-rewrite_by_eqv in H3... auto.
induction gamma. simpl in H2; spec H2; auto. induction delta...
simpl in H2. intros _.
apply rewrite_in_space_sound; auto.
simpl in H1. spec H1; auto. inversion H1... inversion H.
simpl in H2. intros _. inversion H2.
left. apply rewrite_by_sound; auto.
simpl in H1. spec H1; auto. inversion H1... inversion H0.
right. rewrite (@listd_unfold_un _ state).
rewrite (@listd_unfold_un _ state) in H. inversion H.
left. clear - H0 H1. induction delta...
simpl in H0. destruct H0. left. apply rewrite_by_sound...
simpl in H1. spec H1... inversion H1... inversion H0.
right. apply IHdelta...
right. apply rewrite_in_space_sound...
simpl in H1. spec H1; auto. inversion H1... inversion H3.
intros. apply IHgamma... intros H3.
assert (H4: pure_atom_denote a s).
simpl in H. destruct H as [H4 H5].
apply rewrite_by_complete in H4...
simpl in H1. spec H1; auto. destruct H1... inversion H.
simpl in H2. spec H2; auto. split... (*apply H2.*)
apply listd_map_pred with (f:=pure_atom_denote).
intros a' H3. apply rewrite_by_sound...
simpl in H1. spec H1; auto. inversion H1... inversion H0.
simpl in H. destruct H as [H3 H4].
simpl in H1. spec H1; auto. destruct H1 as [H5|H5]; [|inversion H5].
clear - H3 H4 H5. induction gamma...
split... eapply rewrite_by_complete; eauto.
simpl in H4. destruct H4...
simpl in H4. destruct H4...
(* NegSpaceClause case *)
rewrite (@listd_unfold_inter _ state). intros [H3 H4].
cut (listd pure_atom_denote un FF delta s).
intros H5. simpl in H1. spec H1; auto. destruct H1 as [H6|H6]; [|inversion H6].
clear - H5 H6. induction delta... simpl in H5. inversion H5.
left. apply rewrite_by_sound... right...
apply H2. rewrite (@listd_unfold_inter _ state). split.
simpl in H1; spec H1; auto. destruct H1 as [H5|H5]; [|inversion H5].
clear - H3 H5. induction gamma...
simpl in H3; destruct H3 as [H3 H4]. split...
eapply rewrite_by_complete; eauto.
simpl in H1; spec H1; auto. destruct H1 as [H5|H5]; [|inversion H5].
clear - H4 H5. revert s H4 H5. induction sigma...
intros s H4 H5. simpl in H4. destruct H4 as [x [y [H4 [H6 H7]]]].
exists x; exists y. apply rewrite_in_space_eqv in H6...
split... split... apply IHsigma... rewrite <-var_eq_join_sub; eauto.
rewrite <-var_eq_join_sub; eauto.
Qed.

(* Specifications: *)
Lemma simplify_sound l c s :
listd clause_denote inter TT l s -> clause_denote c s ->
clause_denote (simplify l c) s.