Section ConstraintGraphs.
(*s Axiomatisation of the domain of interpretation [D] *)
Variable D : Set.
Variable Dz : D.
Variable Dplus : D -> D -> D.
Variable Dneg : D -> D.
Variable Dle : D -> D -> bool.
Variable Dplus_d_z : forall d : D, Dplus d Dz = d.
Variable Dplus_z_d : forall d : D, Dplus Dz d = d.
Variable
Dplus_assoc :
forall d d' d'' : D, Dplus (Dplus d d') d'' = Dplus d (Dplus d' d'').
Variable Dplus_neg : forall d : D, Dplus d (Dneg d) = Dz.
Variable Dle_refl : forall d : D, Dle d d = true.
Variable
Dle_antisym :
forall d d' : D, Dle d d' = true -> Dle d' d = true -> d = d'.
Variable
Dle_trans :
forall d d' d'' : D,
Dle d d' = true -> Dle d' d'' = true -> Dle d d'' = true.
Variable Dle_total : forall d d' : D, {Dle d d' = true} + {Dle d' d = true}.
Variable
Dle_plus_mono :
forall d d' d'' d''' : D,
Dle d d' = true ->
Dle d'' d''' = true -> Dle (Dplus d d'') (Dplus d' d''') = true.
(*s Properties of [Dle] *)
intros; case (sumbool_of_bool (Dle d' d)); intro; auto.
Qed.
(*s Definition of the minimum function *)
Definition Dmin (d d' : D) := if Dle d d' then d else d'.
unfold Dmin in |- *; intros d d' H; rewrite H; trivial.
Qed.
unfold Dmin in |- *; intros d d' H.
case (sumbool_of_bool (Dle d d')); intro H'; rewrite H'; auto.
Qed.
Hint Resolve Dle_true_Dmin Dle_inv_Dmin.
(*s Properties of [Dneg] *)
(*s Properties of [Dplus] *)
red in |- *; intros.
apply diff_true_false.
rewrite H0 in H.
rewrite (Dle_refl d') in H; trivial.
Qed.
Hint Immediate Dnotle_not_eq.
Hint Immediate Dnotle_not_eq_sym.
(*s Equality on [D] is decidable *)
intros.
case (Dle_total d d'); intro H'; auto.
case diff_true_false.
rewrite <- H'; trivial.
Qed.
(*s Extending D with an element None representing infinity *)
Definition Ddmin (dd dd' : option D) :=
match dd, dd' with
| None, _ => dd'
| _, None => dd
| Some d, Some d' => Some (Dmin d d')
end.
(*s The order [Dle] extended to $D_{\infty}$ *)
Definition Ddle (dd dd' : option D) :=
match dd, dd' with
| _, None => true
| None, _ => false
| Some d, Some d' => Dle d d'
end.
(*s Operation [Ddplus] on $D_{\infty}$ *)
Definition Ddplus (dd : option D) (d' : D) :=
match dd with
| Some d => Some (Dplus d d')
| _ => dd
end.

Lemma Ddplus_reg_r :
forall (dd dd' : option D) (d'' : D),
Ddle (Ddplus dd d'') (Ddplus dd' d'') = true -> Ddle dd dd' = true.