@@ -182,38 +182,58 @@ Definition set_itvE := (set_itv1, set_itvoo0, set_itvoc0, set_itvco0, set_itvoo,
182182Lemma set_itvxx a : [set` Interval a a] = set0.
183183Proof . by move: a => [[|] a |[|]]; rewrite !set_itvE. Qed .
184184
185- Lemma setUitv1 a x : (a <= BLeft x)%O ->
186- [set` Interval a (BLeft x)] `|` [set x] = [set` Interval a (BRight x)].
185+ Lemma setUitv1 a x b : (a <= BLeft x)%O ->
186+ [set` Interval a (BSide b x)] `|` [set x] = [set` Interval a (BRight x)].
187187Proof .
188- move=> ax; apply/predeqP => z /=; rewrite itv_splitU1// [in X in _ <-> X]inE.
188+ move=> ax; case: b; last first.
189+ by apply: setUidl => ? /= ->; rewrite itv_boundlr ax lexx.
190+ apply/predeqP => z /=; rewrite itv_splitU1// [in X in _ <-> X]inE.
189191by rewrite (rwP eqP) (rwP orP) orbC.
190192Qed .
191193
192- Lemma setU1itv a x : (BRight x <= a)%O ->
193- x |` [set` Interval (BRight x) a] = [set` Interval (BLeft x) a].
194+ Lemma setU1itv a x b : (BRight x <= a)%O ->
195+ x |` [set` Interval (BSide b x) a] = [set` Interval (BLeft x) a].
194196Proof .
195- move=> ax; apply/predeqP => z /=; rewrite itv_split1U// [in X in _ <-> X]inE.
197+ move=> ax; case: b.
198+ by apply: setUidr => ? /= ->; rewrite itv_boundlr ax lexx.
199+ apply/predeqP => z /=; rewrite itv_split1U// [in X in _ <-> X]inE.
196200by rewrite (rwP eqP) (rwP orP) orbC.
197201Qed .
198202
199- Lemma setDitv1r a x :
200- [set` Interval a (BRight x)] `\ x = [set` Interval a (BLeft x)].
203+ Lemma setUitv_set2 x y b1 b2 :
204+ (x <= y)%O ->
205+ [set` Interval (BSide b1 x) (BSide b2 y)] `|` [set x; y] = `[x, y]%classic.
201206Proof .
207+ rewrite le_eqVlt => /orP [/eqP->|xy].
208+ by case: b1; case: b2; rewrite !set_itvE !setUid // set0U.
209+ rewrite setUCA setUitv1; last by case: b1; rewrite bnd_simp// ltW.
210+ by rewrite setU1itv// bnd_simp ltW.
211+ Qed .
212+
213+ Lemma setDitv1r a x b :
214+ [set` Interval a (BSide b x)] `\ x = [set` Interval a (BLeft x)].
215+ Proof .
216+ case: b; first by apply: not_setD1; rewrite /= in_itv/= ltxx andbF.
202217apply/seteqP; split => [z|z] /=; rewrite !in_itv/=.
203218 by move=> [/andP[-> /= zx] /eqP xz]; rewrite lt_neqAle xz.
204219by rewrite lt_neqAle => /andP[-> /andP[/eqP ? ->]].
205220Qed .
206221
207- Lemma setDitv1l a x :
208- [set` Interval (BLeft x) a] `\ x = [set` Interval (BRight x) a].
222+ Lemma setDitv1l a x b :
223+ [set` Interval (BSide b x) a] `\ x = [set` Interval (BRight x) a].
209224Proof .
225+ case: b; last by apply: not_setD1; rewrite /= in_itv/= ltxx.
210226apply/seteqP; split => [z|z] /=; rewrite !in_itv/=.
211227 move=> [/andP[xz ->]]; rewrite andbT => /eqP.
212228 by rewrite lt_neqAle eq_sym => ->.
213229move=> /andP[]; rewrite lt_neqAle => /andP[xz zx ->].
214230by rewrite andbT; split => //; exact/nesym/eqP.
215231Qed .
216232
233+ Lemma setDitv_set2 x y b1 b2 :
234+ [set` Interval (BSide b1 x) (BSide b2 y)] `\` [set x; y] = `]x, y[%classic.
235+ Proof . by rewrite -setDDl setDitv1l setDitv1r. Qed .
236+
217237End set_itv_porderType.
218238Arguments neitv {disp T} _.
219239#[deprecated(since="mathcomp-analysis 1.10.0", note="renamed to `set_itvNyy`")]
@@ -314,6 +334,86 @@ move=> cab; apply/seteqP; split => [x /= [xab /eqP]|x[|]]/=.
314334 by apply/eqP; rewrite gt_eqF.
315335Qed .
316336
337+ Lemma setDitvoo (x y : T) (b1 b2 : bool) :
338+ neitv (Interval (BSide b1 x) (BSide b2 y)) ->
339+ [set` Interval (BSide b1 x) (BSide b2 y)] `\` `]x, y[ =
340+ (if b1 then [set x] else set0) `|` (if b2 then set0 else [set y]).
341+ Proof .
342+ move=> /neitv_lt_bnd/= xy.
343+ apply/seteqP; split => z/=; rewrite !in_itv/=; last first.
344+ move: b1 b2 xy.
345+ by move=> [] [] /[!bnd_simp]/= + []// -> => ->; rewrite ?(lexx,ltxx,andbF).
346+ case=> /[swap] /negP; rewrite negb_and.
347+ move: b1 b2 {xy} => [] [] /= + /andP[]; rewrite ?ltNge !negbK.
348+ - by move=> /orP[*|->//]; left; exact/le_anti/andP.
349+ - by case/orP => *; [left|right]; exact/le_anti/andP.
350+ - by case/orP => ->.
351+ - by move=> /orP[->//|*]; right; exact/le_anti/andP.
352+ Qed .
353+
354+ Lemma setDccitv (x y : T) (b1 b2 : bool) :
355+ neitv `[x, y] ->
356+ `[x, y] `\` [set` Interval (BSide b1 x) (BSide b2 y)] =
357+ (if b1 then set0 else [set x]) `|` (if b2 then [set y] else set0).
358+ Proof .
359+ move=> /neitv_lt_bnd/= xy.
360+ apply/seteqP; split => z/=; rewrite !in_itv/=; last first.
361+ move: b1 b2 xy.
362+ by move=> [] [] /[!bnd_simp]/= + []// -> => ->; rewrite ?(lexx,ltxx,andbF).
363+ case=> /[swap] /negP; rewrite negb_and.
364+ move: b1 b2 {xy} => [] [] /= + /andP[]; rewrite -?leNgt.
365+ - by move=> /orP[/negPf ->//|*]; right; exact/le_anti/andP.
366+ - by case/orP => /negPf ->.
367+ - by case/orP => *; [left|right]; exact/le_anti/andP.
368+ - by move=> /orP[*|/negPf ->//]; left; exact/le_anti/andP.
369+ Qed .
370+
371+ Lemma setDitvoy a (x : T) (b : bool) :
372+ neitv (Interval (BSide b x) a) ->
373+ [set` Interval (BSide b x) a] `\` `]x, +oo[ = if b then [set x] else set0.
374+ Proof .
375+ move/neitv_lt_bnd => /= bxa; apply/seteqP; split => z/=; rewrite !in_itv/=.
376+ - case: b {bxa}; rewrite /= andbT; last by case=> /andP[->].
377+ by case=> /andP[? _] /negP; rewrite -leNgt => ?; exact/le_anti/andP.
378+ - case: b bxa => //= /[swap] <-.
379+ by move: a => [[] ?|[]]; rewrite !bnd_simp.
380+ Qed .
381+
382+ Lemma setDitvNyo a (x : T) (b : bool) :
383+ neitv (Interval a (BSide b x)) ->
384+ [set` Interval a (BSide b x)] `\` `]-oo, x[ = if b then set0 else [set x].
385+ Proof .
386+ move/neitv_lt_bnd => /= abx; apply/seteqP; split => z/=; rewrite !in_itv/=.
387+ - case: b {abx} => /=; first by case=> /andP[_ ->].
388+ by case=> /andP[_ ?] /negP; rewrite -leNgt => ?; exact/le_anti/andP.
389+ - case: b abx => //= /[swap] <-.
390+ by move: a => [[] ?|[]]; rewrite !bnd_simp// andbT.
391+ Qed .
392+
393+ Lemma setD_cbnd_bndy a (x : T) (b : bool) :
394+ neitv (Interval (BLeft x) a) ->
395+ [set` Interval (BLeft x) a] `\` [set` Interval (BSide b x) +oo%O] =
396+ (if b then set0 else [set x]).
397+ Proof .
398+ move/neitv_lt_bnd => /= xa; apply/seteqP; split => z/=; rewrite !in_itv/=.
399+ - case: b {xa}; rewrite /= andbT; first by case=> /andP[->].
400+ by case=> /andP[? _] /negP; rewrite -leNgt => ?; exact/le_anti/andP.
401+ - case: b xa => //= /[swap] <-.
402+ by move: a => [[] ?|[]]; rewrite /= !bnd_simp.
403+ Qed .
404+
405+ Lemma setD_bndc_Nybnd a (x : T) (b : bool) :
406+ neitv (Interval a (BRight x)) ->
407+ [set` Interval a (BRight x)] `\` [set` Interval -oo%O (BSide b x)] =
408+ (if b then [set x] else set0).
409+ Proof .
410+ move/neitv_lt_bnd => /= ax; apply/seteqP; split => z/=; rewrite !in_itv/=.
411+ - case: b {ax} => /=; last by case=> /andP[_ ->].
412+ by case=> /andP[_ ?] /negP; rewrite -leNgt => ?; exact/le_anti/andP.
413+ - case: b ax => //= /[swap] <-.
414+ by move: a => [[] ?|[]]; rewrite /= !bnd_simp// andbT.
415+ Qed .
416+
317417End set_itv_orderType.
318418
319419Lemma set_itv_ge disp [T : porderType disp] [b1 b2 : itv_bound T] :
0 commit comments