Skip to content

Commit 4d9168b

Browse files
authored
rename and boolify some predicates for open intervals (#1825)
* rename and boolify some predicates for open intervals
1 parent c0d7c38 commit 4d9168b

File tree

9 files changed

+71
-52
lines changed

9 files changed

+71
-52
lines changed

CHANGELOG_UNRELEASED.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,17 @@
33
## [Unreleased]
44

55
### Added
6+
- in set_interval.v
7+
+ definitions `itv_is_closed_unbounded`, `itv_is_cc`, `itv_closed_ends`
68

79
### Changed
10+
- in set_interval.v
11+
+ `itv_is_open_unbounded`, `itv_is_oo`, `itv_open_ends` (Prop to bool)
812

913
### Renamed
14+
- in set_interval.v
15+
+ `itv_is_ray` -> `itv_is_open_unbounded`
16+
+ `itv_is_bd_open` -> `itv_is_oo`
1017

1118
### Generalized
1219

classical/classical_orders.v

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -329,7 +329,7 @@ Lemma big_lexi_order_interval_prefix (i : interval (big_lexi_order K))
329329
itv_open_ends i -> x \in i ->
330330
exists n, same_prefix n x `<=` [set` i].
331331
Proof.
332-
move: i; case=> [][[]l|[]] [[]r|[]] [][]; rewrite ?in_itv /= ?andbT.
332+
move: i; case=> [][[]l|[]] [[]r|[]]// ?; rewrite ?in_itv /= ?andbT.
333333
- move=> /andP[lx xr].
334334
case E1 : (first_diff l x) => [m|]; first last.
335335
by move: lx; move/first_diff_NoneP : E1 ->; rewrite bnd_simp.

classical/set_interval.v

Lines changed: 49 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -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
(******************************************************************************)
@@ -800,28 +806,22 @@ End disjoint_itv_numDomain.
800806

801807
Section open_endpoints.
802808
Context {d} {T : porderType d}.
809+
Implicit Types (i : interval T).
803810

804811
Definition is_open_itv (A : set T) := exists ab, A = `]ab.1, ab.2[%classic.
805812

806813
Definition open_itv_cover (A : set T) := [set F : nat -> set T |
807-
(forall i, is_open_itv (F i)) /\ A `<=` \bigcup_k (F k)].
814+
(forall k, is_open_itv (F k)) /\ A `<=` \bigcup_k (F k)].
808815

809-
Definition itv_is_ray (i : interval T) : Prop :=
816+
Definition itv_is_open_unbounded i : bool :=
810817
match i with
811-
| Interval -oo%O (BLeft _) => True
812-
| Interval (BRight _) +oo%O => True
813-
| Interval -oo%O +oo%O => True
814-
| _ => False
818+
| `]-oo, _[ | `]_, +oo[ | `]-oo, +oo[ => true
819+
| _ => false
815820
end.
816821

817-
Definition itv_is_bd_open (i : interval T) : Prop :=
818-
match i with
819-
| Interval (BRight _) (BLeft _) => True
820-
| _ => False
821-
end.
822+
Definition itv_is_oo i : bool := 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 : bool := itv_is_open_unbounded i || itv_is_oo i.
825825

826826
Lemma itv_open_ends_rside l b (t : T) :
827827
itv_open_ends (Interval l (BSide b t)) -> b = true.
@@ -839,20 +839,32 @@ Lemma itv_open_ends_linfty l b :
839839
itv_open_ends (Interval (BInfty T b) l) -> b = true.
840840
Proof. by case: b => //; move: l => [[]?|[]] // []. Qed.
841841

842-
Lemma is_open_itv_itv_is_bd_openP (i : interval T) :
843-
itv_is_bd_open i -> is_open_itv [set` i].
844-
Proof.
845-
by case: i=> [] [[]l|[]] // [[]r|[]] // ?; exists (l,r).
846-
Qed.
842+
Lemma is_open_itv_itv_is_bd_openP i : itv_is_oo i -> is_open_itv [set` i].
843+
Proof. by case: i=> [] [[]l|[]] // [[]r|[]] // ?; exists (l,r). Qed.
847844

848845
End open_endpoints.
849846

847+
Section closed_endpoints.
848+
Context {d} {T : porderType d}.
849+
Implicit Types (i : interval T).
850+
851+
Definition itv_is_closed_unbounded i : bool :=
852+
match i with
853+
| `[_, +oo[ | `]-oo, _[ | `]-oo, +oo[ => true
854+
| _ => false
855+
end.
856+
857+
Definition itv_is_cc i : bool := if i is `[_, _] then true else false.
858+
859+
Definition itv_closed_ends i : bool := itv_is_closed_unbounded i || itv_is_cc i.
860+
861+
End closed_endpoints.
862+
850863
Lemma itv_open_endsI {d} {T : orderType d} (i j : interval T) :
851864
itv_open_ends i -> itv_open_ends j -> itv_open_ends (i `&` j)%O.
852865
Proof.
853-
move: i => [][[]a|[]] [[]b|[]] []//= _; move: j => [][[]x|[]] [[]y|[]] []//= _;
854-
by rewrite /itv_open_ends/= ?orbF ?andbT -?negb_or ?le_total//=;
855-
try ((by left)||(by right)).
866+
by move: i => [][[]a|[]] [[]b|[]]//=; move: j => [][[]x|[]] [[]y|[]]//=;
867+
rewrite /itv_open_ends/= ?orbF ?andbT -?negb_or ?le_total//=.
856868
Qed.
857869

858870
Lemma itv_setU {d} {T : orderType d} (i j : interval T) :

theories/normedtype_theory/ereal_normedtype.v

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -496,7 +496,7 @@ apply/seteqP; split=> A.
496496
+ case=> M [Mreal MA].
497497
exists `]-oo, M%:E[ => [|y/=]; rewrite in_itv/= ?ltNyr; last exact: MA.
498498
by split => //; left.
499-
- move=> [[ [[]/= r|[]] [[]/= s|[]] ]] [] []// _.
499+
- move=> [[ [[]/= r|[]] [[]/= s|[]] ]][]// _.
500500
+ move=> /[dup]/ltgte_fin_num/fineK <-; rewrite in_itv/=.
501501
move=> /andP[rx sx] rsA; apply: (nbhs_interval rx sx) => z rz zs.
502502
by apply: rsA =>/=; rewrite in_itv/= rz.

theories/topology_theory/bool_topology.v

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,9 @@ Proof.
3030
rewrite nbhs_principalE eqEsubset; split=> U; first last.
3131
by case => V [_ Vb] VU; apply/principal_filterP/VU; apply: Vb.
3232
move/principal_filterP; case: b.
33-
move=> Ut; exists `]false, +oo[; first split => //; first by left.
33+
move=> Ut; exists `]false, +oo[; first split => //.
3434
by move=> r /=; rewrite in_itv /=; case: r.
35-
move=> Ut; exists `]-oo, true[; first split => //; first by left.
35+
move=> Ut; exists `]-oo, true[; first split => //.
3636
by move=> r /=; rewrite in_itv /=; case: r.
3737
Qed.
3838

theories/topology_theory/nat_topology.v

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,9 @@ Proof.
2727
rewrite nbhs_principalE eqEsubset; split=> U; first last.
2828
by case => V [_ Vb] VU; apply/principal_filterP/VU; apply: Vb.
2929
move/principal_filterP; case: n.
30-
move=> U0; exists `]-oo, 1[; first split => //; first by left.
30+
move=> U0; exists `]-oo, 1[; first split => //.
3131
by move=> r /=; rewrite in_itv /=; case: r.
32-
move=> n USn; exists `]n, n.+2[; first split => //; first by right.
32+
move=> n USn; exists `]n, n.+2[; first split => //.
3333
by rewrite in_itv; apply/andP;split => //=; rewrite /Order.lt //=.
3434
move=> r /=; rewrite in_itv /= => nr2; suff: r = n.+1 by move=> ->.
3535
exact/esym/le_anti.

theories/topology_theory/num_topology.v

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,11 +86,11 @@ Lemma real_order_nbhsE (R : realFieldType) (x : R^o) : nbhs x =
8686
Proof.
8787
rewrite eqEsubset; split => U.
8888
case => _ /posnumP[e] xeU.
89-
exists (`]x - e%:num, x + e%:num[); first split; first by right.
89+
exists (`]x - e%:num, x + e%:num[); first split => //.
9090
by rewrite in_itv/= -lter_distl subrr normr0.
9191
apply: subset_trans xeU => z /=.
9292
by rewrite in_itv /= -lter_distl distrC.
93-
case => [][[[]l|[]]] [[]r|[]] [[]]//= _.
93+
case => [][[[]l|[]]] [[]r|[]] []//= _.
9494
- move=> xlr lrU; exists (Order.min (x - l) (r - x)).
9595
by rewrite /= lt_min ?lterBDr ?add0r ?(itvP xlr).
9696
apply/(subset_trans _ lrU)/subset_ball_prop_in_itv.

theories/topology_theory/order_topology.v

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ Hint Resolve itv_open : core.
9595

9696
Lemma itv_open_ends_open (i : interval T) : itv_open_ends i -> open [set` i].
9797
Proof.
98-
case: i; rewrite /itv_open_ends => [[[]t1|[]]] [[]t2|[]] []? => //.
98+
case: i; rewrite /itv_open_ends => [[[]t1|[]]] [[]t2|[]]// ?.
9999
by rewrite set_itvE; exact: openT.
100100
Qed.
101101

@@ -202,19 +202,19 @@ HB.instance Definition _ := isPointed.Build (interval T) (`]-oo,+oo[).
202202

203203
HB.instance Definition _ := Order.Total.on oT.
204204
HB.instance Definition _ := @isSubBaseTopological.Build oT
205-
(interval T) (itv_is_ray) (fun i => [set` i]).
205+
(interval T) (itv_is_open_unbounded) (fun i => [set` i]).
206206

207207
Lemma order_nbhs_itv (x : oT) : nbhs x = filter_from
208208
(fun i => itv_open_ends i /\ x \in i)
209209
(fun i => [set` i]).
210210
Proof.
211211
rewrite eqEsubset; split => U; first last.
212-
case=> /= i [ro xi /filterS]; apply; move: ro => [rayi|].
212+
case=> /= i [ro xi /filterS]; apply; move: ro => /orP [rayi|].
213213
exists [set` i]; split => //=.
214214
exists [set [set` i]]; last by rewrite bigcup_set1.
215215
move=> A ->; exists (fset1 i); last by rewrite set_fset1 bigcap_set1.
216216
by move=> ?; rewrite !inE => /eqP ->.
217-
case: i xi => [][[]l|[]] [[]r|[]] xlr []//=; exists `]l, r[%classic.
217+
case: i xi => [][[]l|[]] [[]r|[]] xlr//= ?; exists `]l, r[%classic.
218218
split => //; exists [set `]l, r[%classic]; last by rewrite bigcup_set1.
219219
move=> ? ->; exists [fset `]-oo, r[ ; `]l, +oo[]%fset.
220220
by move=> ?; rewrite !inE => /orP[] /eqP ->.
@@ -224,8 +224,8 @@ case=> ? [[ I Irp] <-] [?] /[dup] /(Irp _) [F rayF <-] IF Fix IU.
224224
pose j := \big[Order.meet/`]-oo, +oo[]_(i <- F) i.
225225
exists j; first split.
226226
- rewrite /j (@eq_fbig_cond _ _ _ _ _ F _ (mem F) _ id)//.
227-
+ apply: big_ind; [by left| exact: itv_open_endsI|].
228-
by move=> i /rayF /set_mem ?; left.
227+
+ apply: (big_ind itv_open_ends) => //=; first exact: itv_open_endsI.
228+
by rewrite /itv_open_ends; move=> i /rayF /set_mem ->.
229229
+ by move=> p /=; rewrite !inE/=; exact: andb_id2l.
230230
- pose f (i : interval T) : Prop := x \in i; suff : f j by [].
231231
rewrite /j (@eq_fbig_cond _ _ _ _ _ F _ (mem F) _ id)//=.

theories/topology_theory/weak_topology.v

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ Let WeakU : topologicalType := @weak_topology (sub_type Y) X val.
203203
Lemma open_order_weak (U : set Y) : @open OrdU U -> @open WeakU U.
204204
Proof.
205205
rewrite ?openE /= /interior => + x Ux => /(_ x Ux); rewrite itv_nbhsE /=.
206-
move=> [][][[]l|[]] [[]r|[]][][]//= _ xlr /filterS; apply.
206+
move=> [][][[]l|[]] [[]r|[]][]//= _ xlr /filterS; apply.
207207
- exists `]l, r[%classic; split => //=; exists `]\val l, \val r[%classic.
208208
exact: itv_open.
209209
by rewrite eqEsubset; split => z; rewrite preimage_itv.

0 commit comments

Comments
 (0)