Arguments total_strict_order {T}.
Arguments well_order {T}.
Arguments wo_well_founded {T} {R}.
Arguments wo_transitive {T} {R}.
Arguments wo_total_strict_order {T} {R}.
Arguments wo_irrefl {T} {R}.
Arguments wo_antisym {T} {R}.
Section WellOrderMinimum.
Variable T:Type.
Variable R:relation T.
Hypothesis well_ord: well_order R.
Definition WO_minimum:
forall S:Ensemble T, Inhabited S ->
{ x:T | In S x /\ forall y:T, In S y -> y = x \/ R x y }.
refine (fun S H => constructive_definite_description _ _).
pose proof (WF_implies_MEP T R (wo_well_founded well_ord)).
unfold minimal_element_property in H0.
pose proof (H0 S H).
destruct H1.
destruct H1.
exists x.
red.
split.
split.
assumption.
intros.
case (wo_total_strict_order well_ord x y).
tauto.
intro.
case H4.
auto.
intro.
contradict H5.
auto.
intros.
destruct H3.
case (wo_total_strict_order well_ord x x').
intro.
pose proof (H4 x H1).
case H6.
trivial.
intro.
contradict H7.
auto.
intro.
case H5.
trivial.
intro.
contradict H6.
auto.
Defined.
End WellOrderMinimum.
Arguments WO_minimum {T}.
Section WellOrderConstruction.
Variable T:Type.
Definition restriction_relation (R:relation T) (S:Ensemble T) :
relation ({z:T | In S z}) :=
fun (x y:{z:T | In S z}) => R (proj1_sig x) (proj1_sig y).
Record partial_WO : Type := {
pwo_S: Ensemble T;
pwo_R: relation T;
pwo_R_lives_on_S: forall (x y:T), pwo_R x y -> In pwo_S x /\ In pwo_S y;
pwo_wo: well_order (restriction_relation pwo_R pwo_S)
}.
(* the last condition below says that S WO1 is a downward closed subset of S WO2 *)
Record partial_WO_ord (WO1 WO2:partial_WO) : Prop := {
pwo_S_incl: Included (pwo_S WO1) (pwo_S WO2);
pwo_restriction: forall x y:T, In (pwo_S WO1) x -> In (pwo_S WO1) y ->
(pwo_R WO1 x y <-> pwo_R WO2 x y);
pwo_downward_closed: forall x y:T, In (pwo_S WO1) y -> In (pwo_S WO2) x ->
pwo_R WO2 x y -> In (pwo_S WO1) x
}.

(* Specifications: *)
Lemma partial_WO_preord : preorder partial_WO_ord.
Definition partial_WO_chain_ub: forall C:Ensemble partial_WO,
chain partial_WO_ord C -> partial_WO.