Subject: Ssreflect Users Discussion List
List archive
- From: Florent Hivert <>
- To: "" <>
- Subject: Re: [ssreflect] trivIset and intersecting sets...
- Date: Fri, 12 Feb 2016 00:43:48 +0100
- Authentication-results: mail3-smtp-sop.national.inria.fr; spf=None ; spf=None ; spf=None
- Ironport-phdr: 9a23:S9BfUROgV4rzBCNtz1gl6mtUPXoX/o7sNwtQ0KIMzox0KPT+rarrMEGX3/hxlliBBdydsKIbzbGK+Pm5ASQp2tWojjMrSNR0TRgLiMEbzUQLIfWuLgnFFsPsdDEwB89YVVVorDmROElRH9viNRWJ+iXhpQAbFhi3DwdpPOO9QteU1JTokbvusMSKO01hv3mUX/BbFF2OtwLft80b08NJC50a7V/3mEZOYPlc3mhyJFiezF7W78a0+4N/oWwL46pyv50IbaKvNb8jV7FWCDktL0gw/9eutB/ZTALJ530GU2xQnAACS1ze9wv3UJP8uTfSs/FnnSicJ8z/C7EyQzWrqalxHkzGkiACYhA993vajNA4rKNFrQi970hRx4nObYeJctp/YK7HYfseX2sHUNwHBH8JOZ+1c4ZaV7lJBu1ftYSo/1Y=
Dear All,
Thanks to Georges, I managed to get something...
Here is my Goal: I'd like to write a function that given a P : {set {set t}}
- either returns P if trivIset P holds, that is the elements of P have trivial
intersection;
- or finds two distinct intersecting sets A and B in P
and replace them in P by their union
The actual return value is not important here, the question is more about
handling the counter example to trivIset P.
I got that in three steps:
Lemma trivIsetEn (T : finType) (P : {set {set T}}) :
~~ trivIset P =
[exists A in P, [exists B in P, (A != B) && (A :&: B != set0)]].
Lemma trivIset_VpairI (T : finType) (P : {set {set T}}) :
( trivIset P ) +
{ AB : {set T} * {set T} |
[/\ AB.1 \in P, AB.2 \in P, AB.1 != AB.2 & AB.1 :&: AB.2 != set0] }.
Definition join_inter (T : finType) (P : {set {set T}}) : {set {set T}}.
case: (trivIset_VpairI P) => [_ | [[A B] _]].
- exact P.
- exact ((A :&: B) |: P :\: [set A; B]). (* replace A and B by their union
*)
Defined.
I'd like to know if there is a more simpler or natural way. Here are some
comments:
- in trivIsetEn I only need the implication.
- trivIset_VpairI is merely a rephrasing of trivIsetEn; Still, I need it.
Indeed, I tried to merge the proof of trivIset_VpairI into the definition of
join_inter. I managed to get a working function join_inter_fail, where
instead of
writing
case: (trivIset_VpairI P)
in the definition of I wrote
case: (boolP (trivIset P))
- ...
- rewrite trivIsetEn
However, with this second version, I can't manage to prove anything
useful. Indeed, having trivIsetEn (with a call to eq_rect) into the definition
leads to dependent type error if I try to make the same case analysis (case:
(boolP (trivIset P))) in a proof about join_inter_fail.
I think that, more generally, my question is the following. Is there some
basic pattern to write function which does something if a certain boolean is
true and otherwise compute something from a counter example ?
Thanks for any suggestion.
Best,
Florent
By the way, here is the complete code:
Lemma trivIsetEn (T : finType) (P : {set {set T}}) :
~~ trivIset P =
[exists A in P, [exists B in P, (A != B) && (A :&: B != set0)]].
Proof.
apply/idP/idP.
- apply contraR; rewrite negb_exists_in => /forall_inP Hall.
apply/trivIsetP => A B /Hall {Hall}.
rewrite negb_exists_in => /forall_inP Hall/Hall{Hall} H Hneq.
move: H; rewrite Hneq /= negbK => /eqP H.
by rewrite -setI_eq0 H.
- move=> /existsP [] A /andP [] HA /existsP [] B /andP [] HB /andP [] HAB
Hn0.
apply (introN idP) => /trivIsetP/(_ A B HA HB HAB) /disjoint_setI0 H.
by move: Hn0; rewrite H eq_refl.
Qed.
Lemma trivIset_VpairI (T : finType) (P : {set {set T}}) :
( trivIset P ) +
{ AB : {set T} * {set T} |
[/\ AB.1 \in P, AB.2 \in P, AB.1 != AB.2 & AB.1 :&: AB.2 != set0] }.
Proof.
case: (boolP (trivIset P)) => H; [by left | right].
move: H; rewrite trivIsetEn.
move=> /existsP/sigW [] A /andP [] HA /existsP/sigW [] B /and3P [] HB Hneq
H0.
by exists (A, B).
Qed.
Definition join_inter (T : finType) (P : {set {set T}}) : {set {set T}}.
case: (trivIset_VpairI P) => [_ | [[A B] _]].
- exact P.
- exact ((A :&: B) |: P :\: [set A; B]).
Defined.
(* Due to dependant type error, I can't prove anything about this function *)
Definition join_inter_fail (P : {set {set T}}) : {set {set T}}.
case: (boolP (trivIset P)) => [_ |].
exact: P.
rewrite trivIsetEn => /existsP/sigW [] A /andP [] _ /existsP/sigW [] B _.
apply ((A :&: B) |: P :\: [set A; B]).
Defined.
- [ssreflect] Choice function in Set, Florent Hivert, 02/11/2016
- RE: [ssreflect] Choice function in Set, Georges Gonthier, 02/11/2016
- Re: [ssreflect] Choice function in Set, Florent Hivert, 02/11/2016
- Re: [ssreflect] trivIset and intersecting sets..., Florent Hivert, 02/12/2016
- Re: [ssreflect] trivIset and intersecting sets..., Beta Ziliani, 02/12/2016
- Re: [ssreflect] trivIset and intersecting sets..., Emilio Jesús Gallego Arias, 02/12/2016
- Re: [ssreflect] trivIset and intersecting sets..., Emilio Jesús Gallego Arias, 02/12/2016
- Re: [ssreflect] trivIset and intersecting sets..., Emilio Jesús Gallego Arias, 02/12/2016
- Re: [ssreflect] trivIset and intersecting sets..., Florent Hivert, 02/12/2016
- Re: [ssreflect] trivIset and intersecting sets..., Emilio Jesús Gallego Arias, 02/12/2016
- Re: [ssreflect] trivIset and intersecting sets..., Emilio Jesús Gallego Arias, 02/12/2016
- Re: [ssreflect] trivIset and intersecting sets..., Florent Hivert, 02/12/2016
- Re: [ssreflect] trivIset and intersecting sets..., Emilio Jesús Gallego Arias, 02/12/2016
- Re: [ssreflect] trivIset and intersecting sets..., Emilio Jesús Gallego Arias, 02/12/2016
- Re: [ssreflect] trivIset and intersecting sets..., Assia Mahboubi, 02/21/2016
- RE: [ssreflect] Choice function in Set, Georges Gonthier, 02/11/2016
Archive powered by MHonArc 2.6.18.