@@ -12,22 +12,28 @@ From mathcomp Require Import functions.
1212(* This files contains lemmas about sets and intervals. *)
1313(* *)
1414(* ``` *)
15- (* neitv i == the interval i is non-empty *)
16- (* when the support type is a numFieldType, this *)
17- (* is equivalent to (i.1 < i.2)%O (lemma neitvE) *)
18- (* set_itv_infty_set0 == multirule to simplify empty intervals *)
19- (* line_path a b t := (1 - t) * a + t * b, convexity operator over a *)
20- (* numDomainType *)
21- (* ndline_path == line_path a b with the constraint that a < b *)
22- (* factor a b x := (x - a) / (b - a) *)
23- (* set_itvE == multirule to turn intervals into inequalities *)
24- (* disjoint_itv i j == intervals i and j are disjoint *)
25- (* itv_is_ray i == i is either `]x, +oo[ or `]-oo, x[ *)
26- (* itv_is_bd_open i == i is `]x, y[ *)
27- (* itv_open_ends i == i has open endpoints, i.e., it is one of the two *)
28- (* above *)
29- (* is_open_itv A == the set A can be written as an open interval *)
30- (* open_itv_cover A == the set A can be covered by open intervals *)
15+ (* neitv i == the interval i is non-empty *)
16+ (* when the support type is a numFieldType, this *)
17+ (* is equivalent to (i.1 < i.2)%O (lemma neitvE) *)
18+ (* set_itv_infty_set0 == multirule to simplify empty intervals *)
19+ (* line_path a b t := (1 - t) * a + t * b, convexity operator over *)
20+ (* a numDomainType *)
21+ (* ndline_path == line_path a b with the constraint that a < b *)
22+ (* factor a b x := (x - a) / (b - a) *)
23+ (* set_itvE == multirule to turn intervals into inequalities *)
24+ (* disjoint_itv i j == intervals i and j are disjoint *)
25+ (* itv_is_open_unbounded i == i is either `]x, +oo[, `]-oo, x[ or *)
26+ (* `]-oo, +oo[ *)
27+ (* itv_is_oo i == i is `]x, y[ *)
28+ (* itv_open_ends i == i has open endpoints, i.e., it is one of the *)
29+ (* two above *)
30+ (* itv_is_closed_unbounded i == i is either `[x, +oo[, `]-oo, x] or *)
31+ (* `]-oo, +oo[ *)
32+ (* itv_is_cc i == i is `[x, y] *)
33+ (* itv_closed_ends i == i has closed endpoints, i.e., it is one of *)
34+ (* the two above *)
35+ (* is_open_itv A == the set A can be written as an open interval *)
36+ (* open_itv_cover A == the set A can be covered by open intervals *)
3137(* ``` *)
3238(* *)
3339(***************************************************************************** *)
@@ -806,22 +812,17 @@ Definition is_open_itv (A : set T) := exists ab, A = `]ab.1, ab.2[%classic.
806812Definition open_itv_cover (A : set T) := [set F : nat -> set T |
807813 (forall i, is_open_itv (F i)) /\ A `<=` \bigcup_k (F k)].
808814
809- Definition itv_is_ray (i : interval T) : Prop :=
815+ Definition itv_is_open_unbounded (i : interval T) : bool :=
810816 match i with
811- | Interval -oo%O (BLeft _) => True
812- | Interval (BRight _) +oo%O => True
813- | Interval -oo%O +oo%O => True
814- | _ => False
817+ | `]-oo, _[ | `]_, +oo[ | `]-oo, +oo[ => true
818+ | _ => false
815819 end .
816820
817- Definition itv_is_bd_open (i : interval T) : Prop :=
818- match i with
819- | Interval (BRight _) (BLeft _) => True
820- | _ => False
821- end .
821+ Definition itv_is_oo (i : interval T) : bool :=
822+ if i is `]_, _[ then true else false.
822823
823- Definition itv_open_ends (i : interval T) : Prop :=
824- itv_is_ray i \/ itv_is_bd_open i .
824+ Definition itv_open_ends (i : interval T) : bool :=
825+ (itv_is_open_unbounded i) || (itv_is_oo i) .
825826
826827Lemma itv_open_ends_rside l b (t : T) :
827828 itv_open_ends (Interval l (BSide b t)) -> b = true.
@@ -840,17 +841,35 @@ Lemma itv_open_ends_linfty l b :
840841Proof . by case: b => //; move: l => [[]?|[]] // []. Qed .
841842
842843Lemma is_open_itv_itv_is_bd_openP (i : interval T) :
843- itv_is_bd_open i -> is_open_itv [set` i].
844+ itv_is_oo i -> is_open_itv [set` i].
844845Proof .
845846by case: i=> [] [[]l|[]] // [[]r|[]] // ?; exists (l,r).
846847Qed .
847848
848849End open_endpoints.
849850
851+ Section closed_endpoints.
852+ Context {d} {T : porderType d}.
853+
854+ Definition itv_is_closed_unbounded (i : interval T) : bool :=
855+ match i with
856+ | `[_, +oo[ | `]-oo, _[ | `]-oo, +oo[ => true
857+ | _ => false
858+ end .
859+
860+ Definition itv_is_cc (i : interval T) : bool :=
861+ if i is `[_, _] then true else false.
862+
863+ Definition itv_closed_ends (i : interval T) : bool :=
864+ (itv_is_closed_unbounded i) || (itv_is_cc i).
865+
866+ End closed_endpoints.
867+
850868Lemma itv_open_endsI {d} {T : orderType d} (i j : interval T) :
851869 itv_open_ends i -> itv_open_ends j -> itv_open_ends (i `&` j)%O.
852870Proof .
853- move: i => [][[]a|[]] [[]b|[]] []//= _; move: j => [][[]x|[]] [[]y|[]] []//= _;
871+ move: i => [][[]a|[]] [[]b|[]] /orP []//= _;
872+ move: j => [][[]x|[]] [[]y|[]] /orP []//= _;
854873by rewrite /itv_open_ends/= ?orbF ?andbT -?negb_or ?le_total//=;
855874 try ((by left)||(by right)).
856875Qed .
0 commit comments