Module Clausify := Clausify_Sound VSM. Import Clausify.
Proof with simpl; auto; try solve[congruence].
intros H1 H2 H3.
remember (spatial_resolution c1 c2) as l.
case_eq (M.is_empty l); intros.
rewrite M.is_empty_spec in H.
rewrite (@setd_base_separate state); auto.
split; auto.
unfold setd.
rewrite empty_set_elems' in H. rewrite H. simpl; auto.
assert (exists c, l = M.singleton c).
subst l.
rewrite is_empty_spec' in H.
clear - H.
destruct c1; simpl in *; try (contradiction H; apply M.empty_spec).
destruct c2; simpl in *; try (contradiction H; apply M.empty_spec).
if_tac in H;simpl in *; try (contradiction H; apply M.empty_spec).
econstructor; eauto.
destruct H0 as [c ?].
subst l.
rewrite H0.
clear H.
eapply spatial_resolution_sound in H0; eauto.
unfold setd.
rewrite elements_singleton; simpl; split; auto.
Qed.
Definition Rule_U1 (nc pc : clause) :=
match nc , pc with
PosSpaceClause Gamma Delta ((Next x z)::Sigma) ,
NegSpaceClause Gamma' (Lseg x' z'::Sigma') Delta' =>
match expr_cmp x x', expr_cmp z z' with
Eq, Eq => Some (NegSpaceClause Gamma' (Next x' z'::Sigma')
(Eqv x z :: Delta'))
| _, _ => None
end
| _ , _ => None
end.
(*Lemma SR: forall pc nc , (forall s, clause_denote pc s /\ clause_denote nc s) -> forall s, setd clause_denote inter TT (spatial_resolution pc nc) s. *)
Definition Rule_U2 (nc pc : clause) :=
match nc , pc with
PosSpaceClause Gamma Delta ((Next x y)::Sigma) ,
NegSpaceClause Gamma' (Lseg x' z::Sigma') Delta' =>
match expr_cmp x x' with
Eq => Some (NegSpaceClause Gamma' (Next x y::Lseg y z::Sigma')
(Eqv x z :: Delta'))
|_ => None
end
| _ , _ => None
end.
Definition Rule_U3 (nc pc : clause) :=
match nc , pc with
PosSpaceClause Gamma Delta ((Lseg x y)::Sigma) ,
NegSpaceClause Gamma' (Lseg x' Nil::Sigma') Delta' =>
match expr_cmp x x' with
Eq => Some (NegSpaceClause Gamma' (Lseg x y::Lseg y Nil::Sigma') Delta')
|_ => None
end
| _ , _ => None
end.

Lemma U4: forall x y z w sigma l s
(SD1 : space_denote (Lseg x y :: Lseg y z :: sigma) s)
(SD2: space_denote (Lseg x y :: Next z w :: l) s),
space_denote (Lseg x z :: sigma) s.