Skip to content

Commit

Permalink
min and max are continuous
Browse files Browse the repository at this point in the history
  • Loading branch information
zstone1 committed Nov 10, 2024
1 parent e792f1a commit 08592f2
Showing 1 changed file with 99 additions and 1 deletion.
100 changes: 99 additions & 1 deletion theories/topology_theory/order_topology.v
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
From HB Require Import structures.
From mathcomp Require Import all_ssreflect all_algebra finmap all_classical.
From mathcomp Require Import topology_structure uniform_structure.
From mathcomp Require Import pseudometric_structure.
From mathcomp Require Import product_topology pseudometric_structure.

(**md**************************************************************************)
(* # Order topology *)
Expand Down Expand Up @@ -220,3 +220,101 @@ Qed.

HB.instance Definition _ := Order_isNbhs.Build _ oT order_nbhs_itv.
End induced_order_topology.

Lemma min_continuous {d} {T : orderTopologicalType d} :
continuous (fun xy : T * T => Order.min xy.1 xy.2).
Proof.
case=> x y; case : (pselect (x = y)).
move=> <- U; rewrite /= min_l // => ux; exists (U, U) => //=.
case=> a b [/= ? ?]; case /orP : (le_total a b) => ?; first by rewrite min_l.
by rewrite min_r.
move=>/eqP; wlog xy : x y / (x < y)%O.
move=> WH /[dup] /lt_total/orP []; first exact: WH.
rewrite eq_sym; move=> yx yNx.
have -> : (fun (xy : T *T ) => Order.min xy.1 xy.2) =
((fun xy => Order.min xy.1 xy.2) \o @swap T T).
apply/funext; case => a b /=; have /orP [? | ?] := le_total a b.
by rewrite min_l // min_r.
by rewrite min_r // min_l.
apply: continuous_comp; first exact: swap_continuous.
by apply: WH.
move=> _ U /=; (rewrite min_l //; last exact: ltW) => Ux.
case : (pselect (exists z, x < z < y)%O).
case=> z xzy; exists (U `&` `]-oo,z[, `]z,+oo[%classic) => //=.
- split; [apply: filterI =>// |]; apply: open_nbhs_nbhs; split.
+ exact: lray_open.
+ by rewrite set_itvE; case/andP: xzy.
+ exact: rray_open.
+ by rewrite set_itvE; case/andP: xzy.
- case=> a b /= [][Ua]; rewrite ?in_itv andbT /= => az ?.
by rewrite min_l //; apply: ltW; apply: (lt_trans az).
move/forallNP => /= xNy.
exists (U `&` `]-oo,y[, `]x,+oo[%classic) => //=.
- split; [apply: filterI =>// |]; apply: open_nbhs_nbhs; split.
+ exact: lray_open.
+ by rewrite set_itvE.
+ exact: rray_open.
+ by rewrite set_itvE.
- case=> a b /= [][Ua]; rewrite ?in_itv andbT /= => ay xb.
rewrite min_l //; rewrite leNgt; have := xNy b; apply: contra_notN.
move=> ba; apply/andP; split => //.
by apply: (lt_trans ba).
Qed.

Lemma min_fun_continuous {d} {X : topologicalType} {T : orderTopologicalType d}
(f g : X -> T):
continuous f -> continuous g -> continuous (f \min g).
Proof.
move=> fc gc z; apply: continuous2_cvg; first apply min_continuous.
exact: fc.
exact: gc.
Qed.

Lemma max_continuous {d} {T : orderTopologicalType d} :
continuous (fun xy : T * T => Order.max xy.1 xy.2).
Proof.
case=> x y; case : (pselect (x = y)).
move=> <- U; rewrite /= max_r // => ux; exists (U, U) => //=.
case=> a b [/= ? ?]; case /orP : (le_total a b) => ?; first by rewrite max_r.
by rewrite max_l.
move=>/eqP; wlog xy : x y / (x < y)%O.
move=> WH /[dup] /lt_total/orP []; first exact: WH.
rewrite eq_sym; move=> yx yNx.
have -> : (fun (xy : T *T ) => Order.max xy.1 xy.2) =
((fun xy => Order.max xy.1 xy.2) \o @swap T T).
apply/funext; case => a b /=; have /orP [? | ?] := le_total a b.
by rewrite max_r // max_l.
by rewrite max_l // max_r.
apply: continuous_comp; first exact: swap_continuous.
by apply: WH.
move=> _ U /=; (rewrite max_r //; last exact: ltW) => Ux.
case : (pselect (exists z, x < z < y)%O).
case=> z xzy; exists (`]-oo,z[%classic, U `&` `]z,+oo[%classic) => //=.
- split; [|apply: filterI =>//]; apply: open_nbhs_nbhs; split.
+ exact: lray_open.
+ by rewrite set_itvE; case/andP: xzy.
+ exact: rray_open.
+ by rewrite set_itvE; case/andP: xzy.
- case=> a b /= [] + []; rewrite ?in_itv andbT /= => az ? zb.
by rewrite max_r //; apply: ltW; apply: (lt_trans az).
move/forallNP => /= xNy.
exists (`]-oo,y[%classic, U `&` `]x,+oo[%classic) => //=.
- split; [|apply: filterI =>//]; apply: open_nbhs_nbhs; split.
+ exact: lray_open.
+ by rewrite set_itvE.
+ exact: rray_open.
+ by rewrite set_itvE.
- case=> a b /=; rewrite ?in_itv /= andbT => [/=] [ay] [?] xb.
rewrite max_r //; rewrite leNgt; have := xNy b; apply: contra_notN.
move=> ba; apply/andP; split => //.
by apply: (lt_trans ba).
Qed.

Lemma max_fun_continuous {d} {X : topologicalType} {T : orderTopologicalType d}
(f g : X -> T):
continuous f -> continuous g -> continuous (f \max g).
Proof.
move=> fc gc z; apply: continuous2_cvg; first apply max_continuous.
exact: fc.
exact: gc.
Qed.

0 comments on commit 08592f2

Please sign in to comment.