1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205
|
Set Implicit Arguments.
Unset Strict Implicit.
(****)
Definition is_transitive (A : Type) (r : A -> A -> Prop) :=
forall x y z : A, r x y -> r y z -> r x z.
Definition is_reflexive (A : Type) (r : A -> A -> Prop) :=
forall x : A, r x x.
Definition is_symmetric (A : Type) (r : A -> A -> Prop) :=
forall x y : A, r x y -> r y x.
(****)
Record po : Type :=
{ po_carrier :> Type;
sub : po_carrier -> po_carrier -> Prop;
sub_transitive : is_transitive sub;
sub_reflexive : is_reflexive sub }.
Section equivalence.
Variable A : po.
Definition equiv (x y : A) := sub x y /\ sub y x.
(* Antisymmetry *)
Lemma equiv_intro : forall x y : A, sub x y -> sub y x -> equiv x y.
intros; split; trivial.
Qed.
Lemma equiv_elim_1 : forall x y : A, equiv x y -> sub x y.
intros x y (H, H'); trivial.
Qed.
Lemma equiv_elim_2 : forall x y : A, equiv x y -> sub y x.
intros x y (H, H'); trivial.
Qed.
Lemma equiv_transitive : is_transitive equiv.
intros x y z (H1, H2) (H3, H4); split;
[ exact (sub_transitive H1 H3) | exact (sub_transitive H4 H2) ].
Qed.
Lemma equiv_reflexive : is_reflexive equiv.
intros x; split; apply sub_reflexive.
Qed.
Lemma equiv_symmetric : is_symmetric equiv.
intros x y (H1, H2); split; trivial.
Qed.
End equivalence.
Opaque equiv.
(****)
Lemma opposite_transitive :
forall (A : Type) (r : A -> A -> Prop),
is_transitive r -> is_transitive (fun x y => r y x).
unfold is_transitive in |- *; eauto.
Qed.
Lemma opposite_reflexive :
forall (A : Type) (r : A -> A -> Prop),
is_reflexive r -> is_reflexive (fun x y => r y x).
trivial.
Qed.
Section opposite.
Variable A : po.
Definition opposite_po :=
Build_po (opposite_transitive (sub_transitive (p:=A)))
(opposite_reflexive (sub_reflexive (p:=A))).
Lemma equiv_opp_intro :
forall x y : A, equiv x y -> equiv (A:=opposite_po) x y.
intros x y H; apply equiv_intro;
[ apply equiv_elim_2; trivial | apply equiv_elim_1; trivial ].
Qed.
Lemma equiv_opp_elim :
forall x y : A, equiv (A:=opposite_po) x y -> equiv x y.
intros x y H; apply equiv_intro;
[ apply equiv_elim_2; trivial | apply equiv_elim_1; trivial ].
Qed.
End opposite.
(****)
Definition is_monotone (A B : po) (f : A -> B) :=
forall x y : A, sub x y -> sub (f x) (f y).
Record monotone_fun (A B : po) : Type :=
{ m_fun :> A -> B;
monotone : is_monotone m_fun }.
Definition monotone_sub_def (A B : po) (f g : monotone_fun A B) :=
forall x : A, sub (f x) (g x).
Lemma monotone_sub_refl :
forall A B : po, is_reflexive (monotone_sub_def (A:=A) (B:=B)).
intros A B f x; apply sub_reflexive.
Qed.
Lemma monotone_sub_trans :
forall A B : po, is_transitive (monotone_sub_def (A:=A) (B:=B)).
intros A B f g h H1 H2 x; exact (sub_transitive (H1 x) (H2 x)).
Qed.
Definition monotone_fun_po (A B : po) :=
Build_po (monotone_sub_trans (A:=A) (B:=B))
(monotone_sub_refl (A:=A) (B:=B)).
Lemma monotone_eq :
forall (A B : po) (f : monotone_fun A B) (x y : A),
equiv x y -> equiv (f x) (f y).
intros A B f x y H; apply equiv_intro;
[ apply monotone; exact (equiv_elim_1 H)
| apply monotone; exact (equiv_elim_2 H) ].
Qed.
Let compose_monotone :
forall (A B C : po) (f : monotone_fun A B)
(g : monotone_fun B C), is_monotone (fun x => g (f x)).
unfold is_monotone in |- *; intros; apply monotone; apply monotone; trivial.
Qed.
Definition compose (A B C : po) (f : monotone_fun A B)
(g : monotone_fun B C) := Build_monotone_fun (compose_monotone f g).
Let opp_monotone :
forall (A B : po) (f : A -> B),
is_monotone f -> is_monotone (A:=opposite_po A) (B:=opposite_po B) f.
unfold is_monotone in |- *; simpl in |- *; eauto.
Qed.
Definition opposite_monotone (A B : po) (f : monotone_fun A B) :=
Build_monotone_fun (opp_monotone (monotone f)).
Lemma constant_implies_monotone :
forall (A B : po) (y : B), is_monotone (fun x : A => y).
intros A B y x x' H; apply sub_reflexive.
Qed.
Definition constant_monotone (A B : po) (y : B) :=
Build_monotone_fun (@constant_implies_monotone A B y).
(****)
Definition is_fixpoint (A : po) (f : A -> A) (a : A) := equiv a (f a).
Definition is_upper_bound (A : po) (P : A -> Prop) (x : A) :=
forall y : A, P y -> sub y x.
Definition postfixpoint (A : po) (f : A -> A) (x : A) := sub x (f x).
Definition prefixpoint (A : po) (f : A -> A) (x : A) := sub (f x) x.
(****)
Definition sub_product (A B : po) (x y : prodT A B) :=
sub (fstT x) (fstT y) /\ sub (sndT x) (sndT y).
Lemma sub_product_transitive :
forall A B : po, is_transitive (sub_product (A:=A) (B:=B)).
intros A B x y z (H1, H1') (H2, H2'); split;
[ exact (sub_transitive H1 H2) | exact (sub_transitive H1' H2') ].
Qed.
Lemma sub_product_reflexive :
forall A B : po, is_reflexive (sub_product (A:=A) (B:=B)).
intros A B x; split; apply sub_reflexive.
Qed.
Definition product_po (A B : po) :=
Build_po (sub_product_transitive (A:=A) (B:=B))
(sub_product_reflexive (A:=A) (B:=B)).
(****)
Definition pwe_lift (A : Type) (B : po) (r : B -> B -> Prop) (f g : A -> B) :=
forall x : A, r (f x) (g x).
Definition sub_pwe (A : Type) (B : po) (f g : A -> B) :=
forall x : A, sub (f x) (g x).
Lemma sub_pwe_transitive :
forall (A : Type) (B : po), is_transitive (sub_pwe (A:=A) (B:=B)).
intros A B f g h H1 H2 x; apply sub_transitive with (1 := H1 x); apply H2.
Qed.
Lemma sub_pwe_reflexive :
forall (A : Type) (B : po), is_reflexive (sub_pwe (A:=A) (B:=B)).
intros A B f x; apply sub_reflexive.
Qed.
Definition pwe_po (A : Type) (B : po) :=
Build_po (sub_pwe_transitive (A:=A) (B:=B))
(sub_pwe_reflexive (A:=A) (B:=B)).
|